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