1 /* 2 * Copyright (c) 2021 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 OHOS_DEVICE_MANAGER_IPC_SERVER_ADAPTER_H 17 #define OHOS_DEVICE_MANAGER_IPC_SERVER_ADAPTER_H 18 19 #include <string> 20 21 #include "dm_app_image_info.h" 22 #include "dm_device_info.h" 23 #include "dm_subscribe_info.h" 24 25 #include "hichain_connector.h" 26 27 #include "single_instance.h" 28 #include "softbus_adapter.h" 29 30 namespace OHOS { 31 namespace DistributedHardware { 32 class IpcServerAdapter { 33 DECLARE_SINGLE_INSTANCE(IpcServerAdapter); 34 public: 35 int32_t ModuleInit(); 36 int32_t GetTrustedDeviceList(std::string &pkgName, std::string &extra, DmDeviceInfo **info, int32_t *infoNum); 37 int32_t StartDeviceDiscovery(std::string &pkgName, DmSubscribeInfo &dmSubscribeInfo); 38 int32_t StopDiscovery(std::string &pkgName, uint16_t subscribeId); 39 int32_t AuthenticateDevice(std::string &pkgName, const DmDeviceInfo &deviceInfo, 40 const DmAppImageInfo &imageInfo, std::string &extra); 41 int32_t CheckAuthentication(std::string &authPara); 42 int32_t GetAuthenticationParam(std::string &pkgName, DmAuthParam &authParam); 43 int32_t SetUserOperation(std::string &pkgName, int32_t action); 44 static int32_t GenRandInt(int32_t minPinToken, int32_t maxPinToken); 45 private: 46 int32_t CheckParamValid(nlohmann::json &extraJson, const DmAppImageInfo &imageInfo); 47 }; 48 } // namespace DistributedHardware 49 } // namespace OHOS 50 #endif // OHOS_DEVICE_MANAGER_IPC_SERVER_ADAPTER_H 51