• 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     CHECK_RETURN_ELOG(remoteObject == nullptr, "remote object is nullptr");
26     MessageParcel data;
27     MessageParcel reply;
28     MessageOption option;
29     data.WriteInt32(PARAM_NUM);
30     data.WriteString16(u"parameters");
31     data.WriteString16(Str8ToStr16(commandStr_));
32     int32_t sendRequestRet = remoteObject->SendRequest(code_,
33         data, reply, option);
34     MEDIA_INFO_LOG("OnAbilityConnectDone, sendRequestRet = %{public}d", sendRequestRet);
35 }
36 
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)37 void DeviceProtectionAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element,
38     int32_t resultCode)
39 {
40     MEDIA_INFO_LOG("OnAbilityDisconnectDone, resultCode = %{public}d", resultCode);
41     callback_();
42 }
43 
44 } // namespace CameraStandard
45 } // namespace OHOS
46