1 /*
2 * Copyright (C) 2024 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 #include "distributed_manager.h"
16
17 #include <dlfcn.h>
18 #include <cstdint>
19 #include <unordered_set>
20 #include <utility>
21
22 #define SYMBOL_EXPORT __attribute__ ((visibility("default")))
23 namespace OHOS {
24 namespace Notification {
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
InitLocalDevice(const std::string & deviceId,uint16_t deviceType,DistributedDeviceConfig config)29 SYMBOL_EXPORT int32_t InitLocalDevice(const std::string &deviceId, uint16_t deviceType,
30 DistributedDeviceConfig config)
31 {
32 return DistributedManager::GetInstance().InitLocalDevice(deviceId, deviceType, config);
33 }
34
AddDevice(const std::string & deviceId,uint16_t deviceType,const std::string & networkId)35 SYMBOL_EXPORT void AddDevice(const std::string &deviceId, uint16_t deviceType,
36 const std::string &networkId)
37 {
38 DistributedManager::GetInstance().AddDevice(deviceId, deviceType, networkId);
39 }
40
ReleaseDevice(const std::string & deviceId,uint16_t deviceType)41 SYMBOL_EXPORT void ReleaseDevice(const std::string &deviceId, uint16_t deviceType)
42 {
43 DistributedManager::GetInstance().ReleaseDevice(deviceId, deviceType);
44 }
45
RefreshDevice(const std::string & deviceId,uint16_t deviceType,const std::string & networkId)46 SYMBOL_EXPORT void RefreshDevice(const std::string &deviceId, uint16_t deviceType,
47 const std::string &networkId)
48 {
49 DistributedManager::GetInstance().RefreshDevice(deviceId, deviceType, networkId);
50 }
51
ReleaseLocalDevice()52 SYMBOL_EXPORT void ReleaseLocalDevice()
53 {
54 DistributedManager::GetInstance().ReleaseLocalDevice();
55 }
56
InitHACallBack(std::function<void (int32_t,int32_t,uint32_t,std::string)> callback)57 SYMBOL_EXPORT void InitHACallBack(
58 std::function<void(int32_t, int32_t, uint32_t, std::string)> callback)
59 {
60 DistributedManager::GetInstance().InitHACallBack(callback);
61 }
62
InitSendReportCallBack(std::function<void (int32_t,int32_t,std::string)> callback)63 SYMBOL_EXPORT void InitSendReportCallBack(
64 std::function<void(int32_t, int32_t, std::string)> callback)
65 {
66 DistributedManager::GetInstance().InitSendReportCallBack(callback);
67 }
68
69 #ifdef __cplusplus
70 }
71 #endif
72 } // namespace Notification
73 } // namespace OHOS
74