From e013eff2f0abc1c8bbee363067c7fd921ffdc047 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Thu, 5 Jun 2014 11:38:21 +0100 Subject: [PATCH] make GattService members private; add accessors --- GattService.h | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/GattService.h b/GattService.h index d81597d..f5bf61f 100644 --- a/GattService.h +++ b/GattService.h @@ -37,11 +37,6 @@ public: GattService(UUID uuid); virtual ~GattService(void); - UUID primaryServiceID; - uint8_t characteristicCount; - GattCharacteristic *characteristics[BLE_SERVICE_MAX_CHARACTERISTICS]; - uint16_t handle; - ble_error_t addCharacteristic(GattCharacteristic &); enum { @@ -64,6 +59,31 @@ public: UUID_SCAN_PARAMETERS_SERVICE = 0x1813, UUID_TX_POWER_SERVICE = 0x1804 }; + + const UUID &getUUID(void) const { + return primaryServiceID; + } + uint16_t *getHandlePtr(void) { + return &handle; + } + uint16_t getHandle(void) const { + return handle; + } + uint8_t getCharacteristicCount(void) const { + return characteristicCount; + } + GattCharacteristic *getCharacteristic(uint8_t index) { + if (index >= characteristicCount) { + return NULL; + } + return characteristics[index]; + } + +private: + UUID primaryServiceID; + uint8_t characteristicCount; + GattCharacteristic *characteristics[BLE_SERVICE_MAX_CHARACTERISTICS]; + uint16_t handle; }; #endif // ifndef __GATT_SERVICE_H__