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