• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "device_protection_ability_connection.h"
17 
18 namespace OHOS {
19 namespace CameraStandard {
20 constexpr int32_t PARAM_NUM = 1;
OnAbilityConnectDone(const AppExecFwk::ElementName & element,const sptr<IRemoteObject> & remoteObject,int32_t resultCode)21 void DeviceProtectionAbilityConnection::OnAbilityConnectDone(const AppExecFwk::ElementName &element,
22     const sptr<IRemoteObject> &remoteObject, int32_t resultCode)
23 {
24     MEDIA_INFO_LOG("OnAbilityConnectDone, resultCode = %{public}d", resultCode);
25     if (remoteObject == nullptr) {
26         MEDIA_ERR_LOG("remote object is nullptr");
27         return;
28     }
29     MessageParcel data;
30     MessageParcel reply;
31     MessageOption option;
32     data.WriteInt32(PARAM_NUM);
33     data.WriteString16(u"parameters");
34     data.WriteString16(Str8ToStr16(commandStr_));
35     int32_t sendRequestRet = remoteObject->SendRequest(code_,
36         data, reply, option);
37     MEDIA_INFO_LOG("OnAbilityConnectDone, sendRequestRet = %{public}d", sendRequestRet);
38 }
39 
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)40 void DeviceProtectionAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element,
41     int32_t resultCode)
42 {
43     MEDIA_INFO_LOG("OnAbilityDisconnectDone, resultCode = %{public}d", resultCode);
44     callback_();
45 }
46 
47 } // namespace CameraStandard
48 } // namespace OHOS
49