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 "risk_analysis_manager_callback_proxy.h"
17 
18 namespace OHOS::Security::SecurityGuard {
RiskAnalysisManagerCallbackProxy(const sptr<IRemoteObject> & impl)19 RiskAnalysisManagerCallbackProxy::RiskAnalysisManagerCallbackProxy(const sptr<IRemoteObject> &impl)
20     : IRemoteProxy<IRiskAnalysisManagerCallback>(impl)
21 {
22 }
23 
ResponseSecurityModelResult(const std::string & devId,uint32_t modelId,std::string & result)24 int32_t RiskAnalysisManagerCallbackProxy::ResponseSecurityModelResult(const std::string &devId, uint32_t modelId,
25     std::string &result)
26 {
27     MessageParcel data;
28     MessageParcel reply;
29 
30     if (!data.WriteInterfaceToken(GetDescriptor())) {
31         return ERR_INVALID_OPERATION;
32     }
33 
34     data.WriteUint32(modelId);
35     data.WriteString(devId);
36     data.WriteString(result);
37 
38     MessageOption option = { MessageOption::TF_ASYNC };
39     return Remote()->SendRequest(CMD_SET_SECURITY_MODEL_RESULT, data, reply, option);
40 }
41 }