• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 TELEPHONY_CLIENT_SESSION_H
17 #define TELEPHONY_CLIENT_SESSION_H
18 
19 #include "session_adapter.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 class ClientSession : public SessionAdapter {
24 public:
ClientSession(const std::shared_ptr<ISessionCallback> & callback)25     explicit ClientSession(const std::shared_ptr<ISessionCallback> &callback) : SessionAdapter(callback) {}
26     ~ClientSession() override;
Create(const std::string & localName)27     void Create(const std::string &localName) override {}
Destroy()28     void Destroy() override {}
29     void Connect(const std::string &peerDevId, const std::string &localName, const std::string &peerName) override;
30     void Disconnect() override;
31     void OnSessionBind(int32_t socket) override;
32     void OnSessionShutdown(int32_t socket) override;
33 
34 private:
35     int32_t CreateSocket(const std::string &peerDevId, const std::string &localName, const std::string &peerName);
36 
37 private:
38     int32_t clientSocket_{INVALID_SOCKET_ID};
39 };
40 
41 } // namespace Telephony
42 } // namespace OHOS
43 
44 #endif // TELEPHONY_CLIENT_SESSION_H
45