• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_DM_SERVICE_H
17 #define OHOS_DM_SERVICE_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "dm_ability_manager.h"
23 #include "dm_auth_manager.h"
24 #include "dm_device_info.h"
25 #include "dm_device_info_manager.h"
26 #include "dm_device_state_manager.h"
27 #include "dm_discovery_manager.h"
28 #include "single_instance.h"
29 #include "softbus_connector.h"
30 
31 namespace OHOS {
32 namespace DistributedHardware {
33 class DeviceManagerService {
34 DECLARE_SINGLE_INSTANCE_BASE(DeviceManagerService);
35 public:
36     int32_t Init();
37     ~DeviceManagerService();
38     int32_t GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
39                                  std::vector<DmDeviceInfo> &deviceList);
40     int32_t GetLocalDeviceInfo(DmDeviceInfo &info);
41     int32_t GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &udid);
42     int32_t GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &uuid);
43     int32_t StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
44                                  const std::string &extra);
45     int32_t StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId);
46     int32_t AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId,
47                                const std::string &extra);
48     int32_t UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId);
49     int32_t VerifyAuthentication(const std::string &authParam);
50     int32_t GetFaParam(std::string &pkgName, DmAuthParam &authParam);
51     int32_t SetUserOperation(std::string &pkgName, int32_t action, const std::string &params);
52     int32_t RegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
53     int32_t UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
54     bool IsServiceInitialized();
55 private:
56     DeviceManagerService() = default;
57     bool intFlag_ = false;
58     std::shared_ptr<DmAuthManager> authMgr_;
59     std::shared_ptr<DmDeviceInfoManager> deviceInfoMgr_;
60     std::shared_ptr<DmDeviceStateManager> deviceStateMgr_;
61     std::shared_ptr<DmDiscoveryManager> discoveryMgr_;
62     std::shared_ptr<SoftbusConnector> softbusConnector_;
63     std::shared_ptr<DeviceManagerServiceListener> listener_;
64     std::shared_ptr<DmAbilityManager> abilityMgr_;
65     std::shared_ptr<HiChainConnector> hiChainConnector_;
66 };
67 } // namespace DistributedHardware
68 } // namespace OHOS
69 #endif // OHOS_DM_SERVICE_H
70