1 /* 2 * Copyright (C) 2021-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 SOCKET_GAP_CLIENT_H 17 #define SOCKET_GAP_CLIENT_H 18 19 #include <stdint.h> 20 #include "base_def.h" 21 #include "gap_if.h" 22 23 namespace OHOS { 24 namespace bluetooth { 25 class SocketGapClient { 26 public: 27 /** 28 * @brief Constructor. 29 */ 30 SocketGapClient() = default; 31 32 /** 33 * @brief Destructor. 34 */ ~SocketGapClient()35 virtual ~SocketGapClient() 36 {} 37 38 /** 39 * @brief Register Service Security 40 * 41 * @param scn server channel number 42 * @param isServer is server or not 43 * @param securityFlag require the connection to be encrypted and authenticated. 44 * @return int 45 */ 46 static int RegisterServiceSecurity( 47 const BtAddr addr, uint8_t scn, int securityFlag, GAP_Service serviceId); 48 49 /** 50 * @brief UnRegister Service Security 51 * 52 * @param serviceId service id 53 * @return int 54 */ 55 static int UnregisterSecurity(const BtAddr addr, uint8_t scn, GAP_Service serviceId); 56 57 private: 58 static uint8_t AssignServiceId(); 59 BT_DISALLOW_COPY_AND_ASSIGN(SocketGapClient); 60 }; 61 } // namespace bluetooth 62 } // namespace OHOS 63 #endif // SOCKET_GAP_CLIENT_H 64