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 GATT_CONNECTION_H 17 #define GATT_CONNECTION_H 18 19 #include <cstdint> 20 #include "gatt_data.h" 21 22 namespace OHOS { 23 namespace bluetooth { 24 class GattConnection { 25 uint16_t connectionHandle_ = 0; 26 uint16_t mtu_ = 0; 27 GattDevice device_; 28 29 public: 30 // GattConnection() 31 // {} ~GattConnection()32 ~GattConnection() 33 {} GattConnection(const GattDevice & device)34 explicit GattConnection(const GattDevice &device) : device_(device) 35 {} GattConnection(const GattDevice & device,uint16_t mtu,uint16_t handle)36 GattConnection(const GattDevice &device, uint16_t mtu, uint16_t handle) 37 : connectionHandle_(handle), mtu_(mtu), device_(device) 38 {} 39 GetDevice()40 const GattDevice &GetDevice() const 41 { 42 return device_; 43 } 44 GetHandle()45 const uint16_t &GetHandle() const 46 { 47 return connectionHandle_; 48 } 49 SetHandle(uint16_t handle)50 void SetHandle(uint16_t handle) 51 { 52 connectionHandle_ = handle; 53 } 54 GetMtu()55 const uint16_t &GetMtu() const 56 { 57 return mtu_; 58 } 59 SetMtu(uint16_t mtu)60 void SetMtu(uint16_t mtu) 61 { 62 mtu_ = mtu; 63 } 64 }; 65 } // namespace bluetooth 66 } // namespace OHOS 67 68 #endif // GATT_CONNECTION_OBSERVER_H 69