1 /*
2  * Copyright (c) 2021-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 
16 #ifndef CLIENT_BUS_CENTER_MANAGER_H
17 #define CLIENT_BUS_CENTER_MANAGER_H
18 
19 #include "data_level.h"
20 #include "data_level_inner.h"
21 #include "softbus_bus_center.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 int32_t BusCenterClientInit(void);
28 void BusCenterClientDeinit(void);
29 
30 int32_t JoinLNNInner(const char *pkgName, ConnectionAddr *target, OnJoinLNNResult cb);
31 int32_t LeaveLNNInner(const char *pkgName, const char *networkId, OnLeaveLNNResult cb);
32 int32_t RegNodeDeviceStateCbInner(const char *pkgName, INodeStateCb *callback);
33 int32_t UnregNodeDeviceStateCbInner(INodeStateCb *callback);
34 int32_t GetAllNodeDeviceInfoInner(const char *pkgName, NodeBasicInfo **info, int32_t *infoNum);
35 int32_t GetLocalNodeDeviceInfoInner(const char *pkgName, NodeBasicInfo *info);
36 int32_t GetNodeKeyInfoInner(const char *pkgName, const char *networkId,
37     NodeDeviceInfoKey key, uint8_t *info, int32_t infoLen);
38 int32_t SetNodeDataChangeFlagInner(const char *pkgName, const char *networkId, uint16_t dataChangeFlag);
39 int32_t RegDataLevelChangeCbInner(const char *pkgName, IDataLevelCb *callback);
40 int32_t UnregDataLevelChangeCbInner(const char *pkgName);
41 int32_t SetDataLevelInner(const DataLevel *dataLevel);
42 void RestartRegDataLevelChange(void);
43 
44 int32_t StartTimeSyncInner(const char *pkgName, const char *targetNetworkId, TimeSyncAccuracy accuracy,
45     TimeSyncPeriod period, ITimeSyncCb *cb);
46 int32_t StopTimeSyncInner(const char *pkgName, const char *targetNetworkId);
47 int32_t PublishLNNInner(const char *pkgName, const PublishInfo *info, const IPublishCb *cb);
48 int32_t StopPublishLNNInner(const char *pkgName, int32_t publishId);
49 int32_t RefreshLNNInner(const char *pkgName, const SubscribeInfo *info, const IRefreshCallback *cb);
50 int32_t StopRefreshLNNInner(const char *pkgName, int32_t refreshId);
51 int32_t ActiveMetaNodeInner(const char *pkgName, const MetaNodeConfigInfo *info, char *metaNodeId);
52 int32_t DeactiveMetaNodeInner(const char *pkgName, const char *metaNodeId);
53 int32_t GetAllMetaNodeInfoInner(const char *pkgName, MetaNodeInfo *infos, int32_t *infoNum);
54 int32_t ShiftLNNGearInner(const char *pkgName, const char *callerId, const char *targetNetworkId,
55     const GearMode *mode);
56 int32_t SyncTrustedRelationShipInner(const char *pkgName, const char *msg, uint32_t msgLen);
57 
58 int32_t LnnOnJoinResult(void *addr, const char *networkId, int32_t retCode);
59 int32_t LnnOnLeaveResult(const char *networkId, int32_t retCode);
60 int32_t LnnOnNodeOnlineStateChanged(const char *pkgName, bool isOnline, void *info);
61 int32_t LnnOnNodeBasicInfoChanged(const char *pkgName, void *info, int32_t type);
62 int32_t LnnOnNodeStatusChanged(const char *pkgName, void *info, int32_t type);
63 int32_t LnnOnLocalNetworkIdChanged(const char *pkgName);
64 int32_t LnnOnNodeDeviceTrustedChange(const char *pkgName, int32_t type, const char *msg, uint32_t msgLen);
65 int32_t LnnOnHichainProofException(
66     const char *pkgName, const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode);
67 int32_t LnnOnTimeSyncResult(const void *info, int32_t retCode);
68 void LnnOnPublishLNNResult(int32_t publishId, int32_t reason);
69 void LnnOnRefreshLNNResult(int32_t refreshId, int32_t reason);
70 void LnnOnRefreshDeviceFound(const void *device);
71 void LnnOnDataLevelChanged(const char *networkId, const DataLevelInfo *dataLevelInfo);
72 
73 int32_t DiscRecoveryPublish(void);
74 int32_t DiscRecoverySubscribe(void);
75 int32_t DiscRecoveryPolicy(void);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 #endif
81