1 /* 2 * Copyright (C) 2022 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 OPP_SDP_SERVER_H 17 #define OPP_SDP_SERVER_H 18 19 #include <cstdint> 20 21 namespace OHOS { 22 namespace bluetooth { 23 /** 24 * @brief opp sdp server 25 * opp sdp server 26 */ 27 class OppSdpServer { 28 public: 29 /** 30 * @brief constructor 31 * @details constructor 32 * @return 33 */ 34 OppSdpServer() = default; 35 36 /** 37 * @brief deconstructor 38 * @details deconstructor 39 * @return 40 */ 41 virtual ~OppSdpServer() = default; 42 43 /** 44 * @brief register sdp 45 * @details register sdp service 46 * @return int @c 0 success 47 * @c not 0 failure 48 */ 49 int Register(uint8_t rfcommScn, uint16_t l2capPsm); 50 51 /** 52 * @brief deregister sdp 53 * @details deregister sdp service 54 */ 55 void Deregister(); 56 57 private: 58 uint32_t sdpHandle_ = 0; // sdp handler 59 60 int AddServiceClassIdList() const; 61 int AddProtocolDescriptorList(uint8_t rfcommScn) const; 62 int AddBrowseGroupList() const; 63 int AddBluetoothProfileDescriptorList() const; 64 int AddServiceName() const; 65 int AddL2capPsm(uint16_t l2capPsm) const; 66 int AddSupportedFormatsList() const; 67 }; 68 } // namespace bluetooth 69 } // namespace OHOS 70 #endif // OPP_SDP_SERVER_H 71