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 #ifndef PAN_SDP_H 16 #define PAN_SDP_H 17 #include <cstdint> 18 #include "pan_defines.h" 19 namespace OHOS { 20 namespace bluetooth { 21 /** 22 * @brief pan sdp service 23 * pan sdp service 24 */ 25 class PanSdp { 26 public: 27 /** 28 * @brief constructor 29 * @details constructor 30 * @return 31 */ 32 PanSdp(); 33 /** 34 * @brief deconstructor 35 * @details deconstructor 36 * @return 37 */ 38 virtual ~PanSdp() = default; 39 /** 40 * @brief register sdp 41 * @details register sdp service 42 * @return int @c 0 success 43 * @c not 0 failure 44 */ 45 int Register(); 46 /** 47 * @brief deregister sdp 48 * @details deregister sdp service 49 */ 50 void Deregister(); 51 52 private: 53 static const uint16_t NAP_UUID16 = 0X1116; /* PAN profile */ 54 static const uint16_t PAN_VERSION_NUMBER = 0x0100; 55 static const uint16_t PAN_LANG_ID_CODE_ENGLISH = 0x656e; /* "en" */ 56 static const uint16_t PAN_LANG_ID_CHAR_ENCODE_UTF8 = 0x006a; /* UTF-8 */ 57 static const uint16_t PAN_LANGUAGE_BASE_ID = 0x0100; 58 static const uint16_t PAN_SERVICE_DESCRIPTION_ID = 0X0101; 59 static const uint16_t PAN_SECURITY_DESCRIPTION_ID = 0x030A; 60 static const uint16_t PAN_NET_ACCESS_TYPE_ID = 0x030B; 61 static const uint16_t PAN_MAX_NET_ACCESS_RATE_ID = 0x030C; 62 static const int UINT_DESC_TYPE = 1; 63 static const int PAN_NET_ACCESS_TYPE_LENGTH = 2; 64 static const int PAN_NET_ACCESS_RATE_LENGTH = 4; 65 int AddServiceClassIdList(); 66 int AddPanSecurityDescriptionId(); 67 int AddPanNetAccessRate(); 68 int AddPanNetAccessType(); 69 int AddPanDescriptionList(); 70 int AddBluetoothProfileDescriptorList(); 71 int AddServiceName(); 72 int AddLanguageBaseAttributeIdList(); 73 int AddBrowseGroupList(); 74 int AddServiceDescription(); 75 int RegisterServiceRecord(); 76 int RegisterNetInfo(); 77 int RegisterServiceInfo(); 78 uint32_t sdpHandle_ = 0; // sdp handler 79 }; 80 } // namespace bluetooth 81 } // namespace OHOS 82 #endif // PAN_SDP_H