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 INTERFACES_INNERKITS_SOFTBUS_CLIENT_H_
17 #define INTERFACES_INNERKITS_SOFTBUS_CLIENT_H_
18 
19 #include "data_level_inner.h"
20 #include "iremote_broker.h"
21 #include "iremote_object.h"
22 #include "iremote_proxy.h"
23 #include "session.h"
24 #include "softbus_common.h"
25 #include "softbus_def.h"
26 
27 namespace OHOS {
28 class ISoftBusClient : public IRemoteBroker {
29 public:
30     ~ISoftBusClient() override = default;
31 
32     virtual int32_t OnChannelOpened(const char *sessionName, const ChannelInfo *channel);
33 
34     virtual int32_t OnChannelOpenFailed(int32_t channelId, int32_t channelType, int32_t errCode);
35 
36     virtual int32_t OnChannelLinkDown(const char *networkId, int32_t routeType);
37 
38     virtual int32_t OnChannelMsgReceived(int32_t channelId, int32_t channelType, const void *data,
39                                          uint32_t len, int32_t type);
40 
41     virtual int32_t OnChannelClosed(int32_t channelId, int32_t channelType, int32_t messageType);
42 
43     virtual int32_t OnChannelQosEvent(int32_t channelId, int32_t channelType, int32_t eventId, int32_t tvCount,
44                                       const QosTv *tvList);
45     virtual int32_t SetChannelInfo(const char *sessionName, int32_t sessionId, int32_t channelId, int32_t channelType);
46 
47     virtual int32_t OnJoinLNNResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode);
48 
49     virtual int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo, uint32_t infoLen,
50                                          int retCode);
51 
52     virtual int32_t OnLeaveLNNResult(const char *networkId, int retCode);
53 
54     virtual int32_t OnLeaveMetaNodeResult(const char *networkId, int retCode);
55 
56     virtual int32_t OnNodeOnlineStateChanged(const char *pkgName, bool isOnline, void *info, uint32_t infoTypeLen);
57 
58     virtual int32_t OnNodeBasicInfoChanged(const char *pkgName, void *info, uint32_t infoTypeLen, int32_t type);
59 
60     virtual int32_t OnNodeStatusChanged(const char *pkgName, void *info, uint32_t infoTypeLen, int32_t type);
61 
62     virtual int32_t OnLocalNetworkIdChanged(const char *pkgName);
63 
64     virtual int32_t OnNodeDeviceTrustedChange(const char *pkgName, int32_t type, const char *msg, uint32_t msgLen);
65 
66     virtual int32_t OnHichainProofException(
67         const char *pkgName, const char *deviceList, uint32_t deviceListLen, uint16_t deviceTypeId, int32_t errCode);
68 
69     virtual int32_t OnTimeSyncResult(const void *info, uint32_t infoTypeLen, int32_t retCode);
70 
71     virtual void OnPublishLNNResult(int32_t publishId, int32_t reason);
72 
73     virtual void OnRefreshLNNResult(int32_t refreshId, int32_t reason);
74 
75     virtual void OnRefreshDeviceFound(const void *device, uint32_t deviceLen);
76 
77     virtual void OnDataLevelChanged(const char *networkId, const DataLevelInfo *dataLevelInfo);
78 
79     virtual int32_t OnClientTransLimitChange(int32_t channelId, uint8_t tos);
80 
81     virtual int32_t OnChannelBind(int32_t channelId, int32_t channelType);
82 public:
83     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISoftBusClient");
84 };
85 }
86 #endif
87