1 /* 2 * Copyright (C) 2021 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_IPC_DBINDER_DATABUS_SESSION_CALLBACK_H 17 #define OHOS_IPC_DBINDER_DATABUS_SESSION_CALLBACK_H 18 19 #include "ISessionListener.h" 20 21 using Communication::SoftBus::ISessionListener; 22 using Communication::SoftBus::Session; 23 24 namespace OHOS { 25 static const std::string DBINDER_SERVER_PKG_NAME = "DBinderBus"; 26 27 class DatabusSessionCallback : public ISessionListener { 28 public: 29 explicit DatabusSessionCallback() = default; 30 ~DatabusSessionCallback() = default; 31 32 int OnSessionOpened(std::shared_ptr<Session> session) override; 33 void OnSessionClosed(std::shared_ptr<Session> session) override; OnMessageReceived(std::shared_ptr<Session> session,const char * data,ssize_t len)34 void OnMessageReceived(std::shared_ptr<Session> session, const char* data, ssize_t len) override {} 35 void OnBytesReceived(std::shared_ptr<Session> session, const char *data, ssize_t len) override; OnDataAvailable(std::shared_ptr<Session> session,uint32_t status)36 bool OnDataAvailable(std::shared_ptr<Session> session, uint32_t status) override 37 { 38 return true; 39 }; 40 }; 41 } // namespace OHOS 42 #endif // OHOS_IPC_DBINDER_DATABUS_SESSION_CALLBACK_H 43