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_TRANS_CLIENT_PROXY_STANDARD_H_
17 #define INTERFACES_INNERKITS_TRANS_CLIENT_PROXY_STANDARD_H_
18 
19 #include "if_softbus_client.h"
20 
21 namespace OHOS {
22 class TransClientProxy : public IRemoteProxy<ISoftBusClient> {
23 public:
TransClientProxy(const sptr<IRemoteObject> & impl)24     explicit TransClientProxy(const sptr<IRemoteObject> &impl)
25         : IRemoteProxy<ISoftBusClient>(impl) {}
26     virtual ~TransClientProxy() = default;
27 
28     int32_t OnChannelOpened(const char *sessionName, const ChannelInfo *channel) override;
29     int32_t OnChannelBind(int32_t channelId, int32_t channelType) override;
30     int32_t OnChannelOpenFailed(int32_t channelId, int32_t channelType, int32_t errCode) override;
31     int32_t OnChannelLinkDown(const char *networkId, int32_t routeType) override;
32     int32_t OnChannelClosed(int32_t channelId, int32_t channelType, int32_t messageType) override;
33     int32_t OnChannelMsgReceived(int32_t channelId, int32_t channelType, const void *dataInfo,
34         uint32_t len, int32_t type) override;
35     int32_t OnChannelQosEvent(int32_t channelId, int32_t channelType, int32_t eventId, int32_t tvCount,
36         const QosTv *tvList) override;
37     int32_t SetChannelInfo(const char *sessionName, int32_t sessionId, int32_t channelId, int32_t channelType) override;
38     int32_t OnJoinLNNResult(void *addr, uint32_t addrTypeLen, const char *networkId, int retCode) override;
39     int32_t OnJoinMetaNodeResult(void *addr, uint32_t addrTypeLen, void *metaInfo, uint32_t infoLen,
40         int retCode) override;
41     int32_t OnLeaveLNNResult(const char *networkId, int retCode) override;
42     int32_t OnLeaveMetaNodeResult(const char *networkId, int retCode) override;
43     int32_t OnNodeOnlineStateChanged(const char *pkgName, bool isOnline, void *info, uint32_t infoTypeLen) override;
44     int32_t OnNodeBasicInfoChanged(const char *pkgName, void *info, uint32_t infoTypeLen, int32_t type) override;
45     int32_t OnNodeStatusChanged(const char *pkgName, void *info, uint32_t infoTypeLen, int32_t type) override;
46     int32_t OnTimeSyncResult(const void *info, uint32_t infoTypeLen, int32_t retCode) override;
47     void OnPublishLNNResult(int32_t publishId, int32_t reason) override;
48     void OnRefreshLNNResult(int32_t refreshId, int32_t reason) override;
49     void OnRefreshDeviceFound(const void *device, uint32_t deviceLen) override;
50     int32_t OnClientPermissonChange(const char *pkgName, int32_t state);
51     void OnDataLevelChanged(const char *networkId, const DataLevelInfo *dataLevelInfo) override;
52     int32_t OnClientTransLimitChange(int32_t channelId, uint8_t tos) override;
53     int32_t OnClientChannelOnQos(
54         int32_t channelId, int32_t channelType, QoSEvent event, const QosTV *qos, uint32_t count) override;
55 
56 private:
57     static inline BrokerDelegator<TransClientProxy> delegator_;
58 
59     int32_t MessageParcelWrite(MessageParcel &data, const char *sessionName, const ChannelInfo *channel);
60 };
61 } // namespace OHOS
62 
63 #endif // !defined(INTERFACES_INNERKITS_TRANS_CLIENT_PROXY_STANDARD_H_)