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