• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 OHOS_SOFTBUS_ADAPTER
17 #define OHOS_SOFTBUS_ADAPTER
18 
19 #include <mutex>
20 #include <map>
21 #include <set>
22 
23 #include "session.h"
24 #include "single_instance.h"
25 namespace OHOS {
26 namespace DistributedHardware {
27 class SoftbusAdapter {
28     DECLARE_SINGLE_INSTANCE_BASE(SoftbusAdapter);
29 public:
30     SoftbusAdapter();
31     ~SoftbusAdapter();
32     int32_t CreateSoftbusSessionServer(const std::string &pkgname, const std::string &sessionName);
33     int32_t RemoveSoftbusSessionServer(const std::string &pkgname, const std::string &sessionName);
34 
35     void OnSoftbusSessionOpened(int32_t sessionId, int32_t result);
36     void OnSoftbusSessionClosed(int32_t sessionId);
37     void OnBytesReceived(int32_t sessionId, const void *data, uint32_t dataLen);
38     void OnStreamReceived(int32_t sessionId, const StreamData *data, const StreamData *ext,
39         const StreamFrameInfo *frameInfo);
40     void OnMessageReceived(int sessionId, const void *data, unsigned int dataLen) const;
41     void OnQosEvent(int sessionId, int eventId, int tvCount, const QosTv *tvList) const;
42 
43 private:
44     ISessionListener sessListener_;
45 };
46 } // namespace DistributedHardware
47 } // namespace OHOS
48 #endif