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 #ifndef SECURITY_GUARD_SG_CLASSIFY_CLIENT_H 17 #define SECURITY_GUARD_SG_CLASSIFY_CLIENT_H 18 19 #include "security_guard_api.h" 20 21 #ifdef __cplusplus 22 #include <string> 23 namespace OHOS::Security::SecurityGuard { 24 using SecurityModelResult = struct { 25 std::string devId; 26 uint32_t modelId; 27 std::string param; 28 std::string result; 29 }; 30 31 using SecurityGuardRiskCallback = std::function<void(const SecurityModelResult &result)>; 32 33 int32_t RequestSecurityModelResultSync(const std::string &devId, uint32_t modelId, 34 const std::string ¶m, SecurityModelResult &result); 35 36 int32_t RequestSecurityModelResultAsync(const std::string &devId, uint32_t modelId, 37 const std::string ¶m, SecurityGuardRiskCallback callback); 38 int32_t StartSecurityModel(uint32_t modelId, const std::string ¶m); 39 } 40 41 #endif 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 int32_t RequestSecurityModelResultSync(const DeviceIdentify *devId, uint32_t modelId, SecurityModelResult *result); 48 49 int32_t RequestSecurityModelResultAsync(const DeviceIdentify *devId, uint32_t modelId, 50 SecurityGuardRiskCallback callback); 51 52 #ifdef __cplusplus 53 } 54 #endif 55 56 #endif // SECURITY_GUARD_SG_CLASSIFY_CLIENT_H 57