From 42aaf6bb9973f5e911698368252f89b68b05c79b Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Thu, 18 Jun 2015 14:49:33 +0100 Subject: [PATCH] add BLE::gattServer() --- common/BLEInstanceBase.h | 15 ++++++++------- public/BLE.h | 11 +++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/common/BLEInstanceBase.h b/common/BLEInstanceBase.h index 6398826..58aeb98 100644 --- a/common/BLEInstanceBase.h +++ b/common/BLEInstanceBase.h @@ -30,13 +30,14 @@ class GattClient; class BLEInstanceBase { public: - virtual ble_error_t init(void) = 0; - virtual ble_error_t shutdown(void) = 0; - virtual const char *getVersion(void) = 0; - virtual Gap& getGap() = 0; - virtual const Gap& getGap() const = 0; - virtual GattServer& getGattServer() = 0; - virtual GattClient& getGattClient() = 0; + virtual ble_error_t init(void) = 0; + virtual ble_error_t shutdown(void) = 0; + virtual const char *getVersion(void) = 0; + virtual Gap& getGap() = 0; + virtual const Gap& getGap() const = 0; + virtual GattServer& getGattServer() = 0; + virtual const GattServer& getGattServer() const = 0; + virtual GattClient& getGattClient() = 0; virtual ble_error_t initializeSecurity(bool enableBonding = true, bool requireMITM = true, Gap::SecurityIOCapabilities_t iocaps = Gap::IO_CAPS_NONE, diff --git a/public/BLE.h b/public/BLE.h index 37e3e13..b6744d9 100644 --- a/public/BLE.h +++ b/public/BLE.h @@ -74,6 +74,17 @@ public: return transport->getGap(); } + /* + * Accessors to GATT Server. Please refer to GattServer.h. All GATTServer related + * functionality requires going through this accessor. + */ + const GattServer& gattServer() const { + return transport->getGattServer(); + } + GattServer& gattServer() { + return transport->getGattServer(); + } + /** * Yield control to the BLE stack or to other tasks waiting for events. This * is a sleep function which will return when there is an application