• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 "dslm_callback_proxy.h"
17 
18 #include "hilog/log_cpp.h"
19 #include "message_option.h"
20 #include "message_parcel.h"
21 
22 #include "device_security_defines.h"
23 
24 namespace OHOS {
25 namespace Security {
26 namespace DeviceSecurityLevel {
27 using namespace OHOS::HiviewDFX;
DslmCallbackProxy(const sptr<IRemoteObject> & impl)28 DslmCallbackProxy::DslmCallbackProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IDeviceSecurityLevelCallback>(impl)
29 {
30 }
31 
ResponseDeviceSecurityLevel(uint32_t cookie,const ResponseInfo & response)32 int32_t DslmCallbackProxy::ResponseDeviceSecurityLevel(uint32_t cookie, const ResponseInfo &response)
33 {
34     MessageParcel data;
35     MessageParcel reply;
36 
37     if (!data.WriteInterfaceToken(GetDescriptor())) {
38         return ERR_INVALID_PARA;
39     }
40 
41     data.WriteUint32(cookie);
42     data.WriteUint32(response.result);
43     data.WriteUint32(response.level);
44 
45     if (response.extraBuff != nullptr && response.extraLen != 0) {
46         data.WriteUint32(response.extraLen);
47         data.WriteBuffer(response.extraBuff, response.extraLen);
48     }
49 
50     MessageOption ipcOption = {MessageOption::TF_ASYNC};
51     return Remote()->SendRequest(CMD_SET_DEVICE_SECURITY_LEVEL, data, reply, ipcOption);
52 }
53 } // namespace DeviceSecurityLevel
54 } // namespace Security
55 } // namespace OHOS
56