1 /* 2 * Copyright (C) 2025 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 #ifndef BLUETOOTH_SPP_SERVER_IMPL_H 16 #define BLUETOOTH_SPP_SERVER_IMPL_H 17 18 #include <map> 19 20 #include "bluetooth_socket.h" 21 #include "bluetooth_spp_client_impl.h" 22 23 namespace OHOS { 24 namespace Bluetooth { 25 struct SppServerImpl { 26 static int32_t SppListen(std::string name, SppOption sppOption, int32_t* errCode); 27 static int32_t SppAccept(int32_t serverSocket, int32_t* errCode); 28 static int32_t SppCloseServerSocket(int32_t socket); 29 static int32_t RegisterSocketObserver(std::string type, int32_t clientSocket, int64_t cbId); 30 static int32_t DeRegisterSocketObserver(std::string type, int32_t clientSocket, int64_t cbId); 31 32 static std::map<int, std::shared_ptr<SppServerImpl>> serverMap; 33 static int count; 34 35 std::shared_ptr<ServerSocket> server_ = nullptr; 36 int id_ = -1; 37 }; 38 } // namespace Bluetooth 39 } // namespace OHOS 40 #endif /* BLUETOOTH_SPP_SERVER_IMPL_H */