Lancaster University's fork of the mbed BLE API. Lives on github, https://github.com/lancaster-university/BLE_API

Dependents:   microbit-dal microbit-dal microbit-ble-open microbit-dal ... more

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Mon Jul 06 10:10:34 2015 +0100
Parent:
726:6884e374e2eb
Child:
728:997ba5e7b3b6
Commit message:
Synchronized with git rev 854fd111
Author: James Crosby
use mbed-classic to build (this will probably be a target-dependendency in the future)

Changed in this revision

ble/DiscoveredCharacteristic.h Show annotated file Show diff for this revision Revisions of this file
ble/Gap.h Show annotated file Show diff for this revision Revisions of this file
ble/GattClient.h Show annotated file Show diff for this revision Revisions of this file
ble/GattServer.h Show annotated file Show diff for this revision Revisions of this file
ble/blecommon.h Show annotated file Show diff for this revision Revisions of this file
ble/services/BatteryService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/HealthThermometerService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/HeartRateService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/LinkLossService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/UARTService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/URIBeaconConfigService.h Show annotated file Show diff for this revision Revisions of this file
ble/services/iBeaconService.h Show annotated file Show diff for this revision Revisions of this file
module.json Show annotated file Show diff for this revision Revisions of this file
source/DiscoveredCharacteristic.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ble/DiscoveredCharacteristic.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/DiscoveredCharacteristic.h	Mon Jul 06 10:10:34 2015 +0100
@@ -135,6 +135,14 @@
      */
     ble_error_t write(uint16_t length, const uint8_t *value) const;
 
+    static void setupOnDataRead(GattClient::ReadCallback_t callback) {
+        onDataReadCallback = callback;
+    }
+
+    static void setupOnDataWrite(GattClient::WriteCallback_t callback) {
+        onDataWriteCallback = callback;
+    }
+
     void setupLongUUID(UUID::LongUUIDBytes_t longUUID) {
         uuid.setupLong(longUUID);
     }
@@ -174,6 +182,10 @@
     GattAttribute::Handle_t  valueHandle;
 
     Gap::Handle_t            connHandle;
+
+public:
+    static GattClient::ReadCallback_t  onDataReadCallback;
+    static GattClient::WriteCallback_t onDataWriteCallback;
 };
 
 #endif /*__DISCOVERED_CHARACTERISTIC_H__*/
\ No newline at end of file
--- a/ble/Gap.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/Gap.h	Mon Jul 06 10:10:34 2015 +0100
@@ -154,7 +154,7 @@
      * @return BLE_ERROR_NONE on success.
      */
     virtual ble_error_t setAddress(AddressType_t type, const Address_t address) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -163,7 +163,7 @@
      * @return BLE_ERROR_NONE on success.
      */
     virtual ble_error_t getAddress(AddressType_t *typeP, Address_t address) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -188,7 +188,7 @@
     }
 
     virtual ble_error_t stopAdvertising(void) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -197,7 +197,7 @@
      * @retval BLE_ERROR_NONE if successfully stopped scanning procedure.
      */
     virtual ble_error_t stopScan() {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -219,7 +219,7 @@
                                 Gap::AddressType_t        peerAddrType,
                                 const ConnectionParams_t *connectionParams,
                                 const GapScanningParams  *scanParams) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -231,7 +231,7 @@
      *           The reason for disconnection to be sent back to the peer.
      */
     virtual ble_error_t disconnect(Handle_t connectionHandle, DisconnectionReason_t reason) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -248,7 +248,7 @@
      * altertive which takes a connection handle. It will be dropped in the future.
      */
     virtual ble_error_t disconnect(DisconnectionReason_t reason) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -264,7 +264,7 @@
      * the given structure pointed to by params.
      */
     virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -276,7 +276,7 @@
      *               The structure containing the desired parameters.
      */
     virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -290,7 +290,7 @@
      *              the parameters in the PPCP characteristic of the GAP service will be used instead.
      */
     virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -299,7 +299,7 @@
      *              The new value for the device-name. This is a UTF-8 encoded, <b>NULL-terminated</b> string.
      */
     virtual ble_error_t setDeviceName(const uint8_t *deviceName) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -321,7 +321,7 @@
      *     use this information to retry with a suitable buffer size.
      */
     virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -330,7 +330,7 @@
      *              The new value for the device-appearance.
      */
     virtual ble_error_t setAppearance(GapAdvertisingData::Appearance appearance) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -339,7 +339,7 @@
      *               The new value for the device-appearance.
      */
     virtual ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -347,7 +347,7 @@
      * @param[in] txPower Radio transmit power in dBm.
      */
     virtual ble_error_t setTxPower(int8_t txPower) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -365,7 +365,7 @@
 protected:
     /* Override the following in the underlying adaptation layer to provide the functionality of scanning. */
     virtual ble_error_t startRadioScan(const GapScanningParams &scanningParams) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /*
--- a/ble/GattClient.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/GattClient.h	Mon Jul 06 10:10:34 2015 +0100
@@ -28,8 +28,8 @@
     typedef void (*ReadCallback_t)(const GattReadCallbackParams *params);
 
     enum WriteOp_t {
-        GATT_OP_WRITE_REQ = 0x01,  /**< Write Request. */
-        GATT_OP_WRITE_CMD = 0x02,  /**< Write Command. */
+        GATT_OP_WRITE_REQ      = 0x01,  /**< Write Request. */
+        GATT_OP_WRITE_CMD      = 0x02,  /**< Write Command. */
     };
 
     typedef void (*WriteCallback_t)(const GattWriteCallbackParams *params);
@@ -39,11 +39,12 @@
      */
 public:
     /**
-     * Launch service discovery. Once launched, application callbacks will be
-     * invoked for matching services/characteristics. isServiceDiscoveryActive()
-     * can be used to determine status; and a termination callback (if setup)
-     * will be invoked at the end. Service discovery can be terminated prematurely
-     * if needed using terminateServiceDiscovery().
+     * Launch service discovery. Once launched, service discovery will remain
+     * active with callbacks being issued back into the application for matching
+     * services/characteristics. isServiceDiscoveryActive() can be used to
+     * determine status; and a termination callback (if setup) will be invoked
+     * at the end. Service discovery can be terminated prematurely if needed
+     * using terminateServiceDiscovery().
      *
      * @param  connectionHandle
      *           Handle for the connection with the peer.
@@ -97,7 +98,7 @@
                                                ServiceDiscovery::CharacteristicCallback_t  cc                           = NULL,
                                                const UUID                                 &matchingServiceUUID          = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN),
                                                const UUID                                 &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -129,7 +130,7 @@
     virtual ble_error_t discoverServices(Gap::Handle_t                        connectionHandle,
                                          ServiceDiscovery::ServiceCallback_t  callback,
                                          const UUID                          &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -160,7 +161,7 @@
                                          ServiceDiscovery::ServiceCallback_t  callback,
                                          GattAttribute::Handle_t              startHandle,
                                          GattAttribute::Handle_t              endHandle) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -180,7 +181,7 @@
 
     /* Initiate a Gatt Client read procedure by attribute-handle. */
     virtual ble_error_t read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -204,24 +205,7 @@
                               GattAttribute::Handle_t  attributeHandle,
                               size_t                   length,
                               const uint8_t           *value) const {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
-    }
-
-    /* Event callback handlers. */
-public:
-    /**
-     * Setup a callback for read response events.
-     */
-    void onDataRead(ReadCallback_t callback) {
-        onDataReadCallback = callback;
-    }
-
-    /**
-     * Setup a callback for write response events.
-     * @Note: write commands (issued using writeWoResponse) don't generate a response.
-     */
-    void onDataWrite(WriteCallback_t callback) {
-        onDataWriteCallback = callback;
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -236,24 +220,6 @@
         /* empty */
     }
 
-    /* Entry points for the underlying stack to report events back to the user. */
-public:
-    void processReadResponse(const GattReadCallbackParams *params) {
-        if (onDataReadCallback) {
-            onDataReadCallback(params);
-        }
-    }
-
-    void processWriteResponse(const GattWriteCallbackParams *params) {
-        if (onDataWriteCallback) {
-            onDataWriteCallback(params);
-        }
-    }
-
-protected:
-    ReadCallback_t  onDataReadCallback;
-    WriteCallback_t onDataWriteCallback;
-
 private:
     /* disallow copy and assignment */
     GattClient(const GattClient &);
--- a/ble/GattServer.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/GattServer.h	Mon Jul 06 10:10:34 2015 +0100
@@ -53,7 +53,7 @@
      * characteristics contained within.
      */
     virtual ble_error_t addService(GattService &) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -72,7 +72,7 @@
      * @return BLE_ERROR_NONE if a value was read successfully into the buffer.
      */
     virtual ble_error_t read(GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -97,7 +97,7 @@
      *     attribtues (such as the CCCDs).
      */
     virtual ble_error_t read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -119,7 +119,7 @@
      * @return BLE_ERROR_NONE if we have successfully set the value of the attribute.
      */
     virtual ble_error_t write(GattAttribute::Handle_t, const uint8_t *, uint16_t, bool localOnly = false) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -145,38 +145,7 @@
      * @return BLE_ERROR_NONE if we have successfully set the value of the attribute.
      */
     virtual ble_error_t write(Gap::Handle_t connectionHandle, GattAttribute::Handle_t, const uint8_t *, uint16_t, bool localOnly = false) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
-    }
-
-    /**
-     * Determine the updates-enabled status (notification/indication) for the current connection from a characteristic's CCCD.
-     *
-     * @param       characteristic
-     *                The characteristic
-     * @param[out]  enabledP
-     *                Upon return, *enabledP is true if updates are enabled, else false.
-     *
-     * @return BLE_ERROR_NONE if the connection and handle are found. false otherwise.
-     */
-    virtual ble_error_t areUpdatesEnabled(const GattCharacteristic &characteristic, bool *enabledP) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
-    }
-
-    /**
-     * Determine the connection-specific updates-enabled status (notification/indication) from a characteristic's CCCD.
-     *
-     * @param       connectionHandle
-     *                The connection handle
-     * @param[out]  enabledP
-     *                Upon return, *enabledP is true if updates are enabled, else false.
-     *
-     * @param  characteristic
-     *           The characteristic
-     *
-     * @return BLE_ERROR_NONE if the connection and handle are found. false otherwise.
-     */
-    virtual ble_error_t areUpdatesEnabled(Gap::Handle_t connectionHandle, const GattCharacteristic &characteristic, bool *enabledP) {
-        return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */
+        return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */
     }
 
     /**
@@ -298,21 +267,21 @@
         }
     }
 
-    void handleEvent(GattServerEvents::gattEvent_e type, GattAttribute::Handle_t attributeHandle) {
+    void handleEvent(GattServerEvents::gattEvent_e type, GattAttribute::Handle_t charHandle) {
         switch (type) {
             case GattServerEvents::GATT_EVENT_UPDATES_ENABLED:
                 if (updatesEnabledCallback) {
-                    updatesEnabledCallback(attributeHandle);
+                    updatesEnabledCallback(charHandle);
                 }
                 break;
             case GattServerEvents::GATT_EVENT_UPDATES_DISABLED:
                 if (updatesDisabledCallback) {
-                    updatesDisabledCallback(attributeHandle);
+                    updatesDisabledCallback(charHandle);
                 }
                 break;
             case GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED:
                 if (confirmationReceivedCallback) {
-                    confirmationReceivedCallback(attributeHandle);
+                    confirmationReceivedCallback(charHandle);
                 }
                 break;
             default:
--- a/ble/blecommon.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/blecommon.h	Mon Jul 06 10:10:34 2015 +0100
@@ -126,9 +126,6 @@
     BLE_ERROR_UNSPECIFIED             = 9, /**< Unknown error. */
 };
 
-/** @brief Default MTU size. */
-static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23;
-
 #ifdef __cplusplus
 }
 #endif
--- a/ble/services/BatteryService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/BatteryService.h	Mon Jul 06 10:10:34 2015 +0100
@@ -53,7 +53,7 @@
      */
     void updateBatteryLevel(uint8_t newLevel) {
         batteryLevel = newLevel;
-        ble.gattServer().write(batteryLevelCharacteristic.getValueHandle(), &batteryLevel, 1);
+        ble.updateCharacteristicValue(batteryLevelCharacteristic.getValueAttribute().getHandle(), &batteryLevel, 1);
     }
 
 protected:
--- a/ble/services/HealthThermometerService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/HealthThermometerService.h	Mon Jul 06 10:10:34 2015 +0100
@@ -73,7 +73,7 @@
     void updateTemperature(float temperature) {
         if (ble.getGapState().connected) {
             valueBytes.updateTemperature(temperature);
-            ble.gattServer().write(tempMeasurement.getValueHandle(), valueBytes.getPointer(), sizeof(TemperatureValueBytes));
+            ble.updateCharacteristicValue(tempMeasurement.getValueAttribute().getHandle(), valueBytes.getPointer(), sizeof(TemperatureValueBytes));
         }
     }
 
@@ -83,7 +83,7 @@
      *        new location value.
      */
     void updateLocation(SensorLocation_t loc) {
-        ble.gattServer().write(tempLocation.getValueHandle(), reinterpret_cast<uint8_t *>(&loc), sizeof(uint8_t));
+        ble.updateCharacteristicValue(tempLocation.getValueHandle(), reinterpret_cast<uint8_t *>(&loc), sizeof(uint8_t));
     }
 
 private:
@@ -140,7 +140,7 @@
         uint8_t bytes[SIZEOF_VALUE_BYTES];
     };
 
-protected:
+private:
     BLE                                               &ble;
     TemperatureValueBytes                              valueBytes;
     ReadOnlyGattCharacteristic<TemperatureValueBytes>  tempMeasurement;
--- a/ble/services/HeartRateService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/HeartRateService.h	Mon Jul 06 10:10:34 2015 +0100
@@ -93,7 +93,7 @@
      */
     void updateHeartRate(uint8_t hrmCounter) {
         valueBytes.updateHeartRate(hrmCounter);
-        ble.gattServer().write(hrmRate.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
+        ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
     }
 
     /**
@@ -104,7 +104,7 @@
      */
     void updateHeartRate(uint16_t hrmCounter) {
         valueBytes.updateHeartRate(hrmCounter);
-        ble.gattServer().write(hrmRate.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
+        ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
     }
 
     /**
--- a/ble/services/LinkLossService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/LinkLossService.h	Mon Jul 06 10:10:34 2015 +0100
@@ -73,7 +73,7 @@
         alertLevel = newLevel;
     }
 
-protected:
+private:
     /**
      * This callback allows receiving updates to the AlertLevel Characteristic.
      *
@@ -81,7 +81,7 @@
      *     Information about the characterisitc being updated.
      */
     virtual void onDataWritten(const GattWriteCallbackParams *params) {
-        if (params->handle == alertLevelChar.getValueHandle()) {
+        if (params->charHandle == alertLevelChar.getValueHandle()) {
             alertLevel = *reinterpret_cast<const AlertLevel_t *>(params->data);
         }
     }
--- a/ble/services/UARTService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/UARTService.h	Mon Jul 06 10:10:34 2015 +0100
@@ -41,7 +41,8 @@
 class UARTService {
 public:
     /**< Maximum length of data (in bytes) that can be transmitted by the UART service module to the peer. */
-    static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (BLE_GATT_MTU_SIZE_DEFAULT - 3);
+    static const unsigned GATT_MTU_SIZE_DEFAULT         = 23;
+    static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (GATT_MTU_SIZE_DEFAULT - 3);
 
 public:
 
@@ -117,7 +118,7 @@
                 if ((sendBufferIndex == BLE_UART_SERVICE_MAX_DATA_LEN) ||
                     // (sendBuffer[sendBufferIndex - 1] == '\r')          ||
                     (sendBuffer[sendBufferIndex - 1] == '\n')) {
-                    ble.gattServer().write(getRXCharacteristicHandle(), static_cast<const uint8_t *>(sendBuffer), sendBufferIndex);
+                    ble.updateCharacteristicValue(getRXCharacteristicHandle(), static_cast<const uint8_t *>(sendBuffer), sendBufferIndex);
                     sendBufferIndex = 0;
                 }
             }
@@ -159,7 +160,7 @@
         return receiveBuffer[receiveBufferIndex++];
     }
 
-protected:
+private:
     /**
      * This callback allows the UART service to receive updates to the
      * txCharacteristic. The application should forward the call to this
@@ -177,7 +178,7 @@
         }
     }
 
-protected:
+private:
     BLE                &ble;
 
     uint8_t             receiveBuffer[BLE_UART_SERVICE_MAX_DATA_LEN]; /**< The local buffer into which we receive
--- a/ble/services/URIBeaconConfigService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/URIBeaconConfigService.h	Mon Jul 06 10:10:34 2015 +0100
@@ -267,7 +267,7 @@
                     paramsUpdated = true;
                 }
                 if (paramsUpdated) {
-                    ble.gattServer().write(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(&params.beaconPeriod), sizeof(uint16_t));
+                    ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(&params.beaconPeriod), sizeof(uint16_t));
                 }
             }
         } else if (handle == resetChar.getValueHandle()) {
@@ -295,17 +295,17 @@
      * change to the internal state of the service object.
      */
     void updateCharacteristicValues(void) {
-        ble.gattServer().write(lockedStateChar.getValueHandle(), &lockedState, 1);
-        ble.gattServer().write(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength);
-        ble.gattServer().write(flagsChar.getValueHandle(), &params.flags, 1);
-        ble.gattServer().write(beaconPeriodChar.getValueHandle(),
+        ble.updateCharacteristicValue(lockedStateChar.getValueHandle(), &lockedState, 1);
+        ble.updateCharacteristicValue(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength);
+        ble.updateCharacteristicValue(flagsChar.getValueHandle(), &params.flags, 1);
+        ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(),
                                       reinterpret_cast<uint8_t *>(&params.beaconPeriod), sizeof(uint16_t));
-        ble.gattServer().write(txPowerModeChar.getValueHandle(), &params.txPowerMode, 1);
-        ble.gattServer().write(advPowerLevelsChar.getValueHandle(),
+        ble.updateCharacteristicValue(txPowerModeChar.getValueHandle(), &params.txPowerMode, 1);
+        ble.updateCharacteristicValue(advPowerLevelsChar.getValueHandle(),
                                       reinterpret_cast<uint8_t *>(params.advPowerLevels), sizeof(PowerLevels_t));
     }
 
-protected:
+private:
     void lockAuthorizationCallback(GattWriteAuthCallbackParams *authParams) {
         if (lockedState) {
             authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION;
--- a/ble/services/iBeaconService.h	Thu Jul 02 09:06:12 2015 +0100
+++ b/ble/services/iBeaconService.h	Mon Jul 06 10:10:34 2015 +0100
@@ -66,7 +66,7 @@
         ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED);
     }
 
-protected:
+private:
     BLE     &ble;
     Payload  data;
 };
--- a/module.json	Thu Jul 02 09:06:12 2015 +0100
+++ b/module.json	Mon Jul 06 10:10:34 2015 +0100
@@ -19,7 +19,7 @@
     }
   ],
   "dependencies": {
-    "mbed": "^3.0.2"
+    "mbed-classic":"~0.0.1"
   },
   "targetDependencies": {
     "nrf51822": {
--- a/source/DiscoveredCharacteristic.cpp	Thu Jul 02 09:06:12 2015 +0100
+++ b/source/DiscoveredCharacteristic.cpp	Mon Jul 06 10:10:34 2015 +0100
@@ -17,6 +17,9 @@
 #include "ble/DiscoveredCharacteristic.h"
 #include "ble/GattClient.h"
 
+GattClient::ReadCallback_t  DiscoveredCharacteristic::onDataReadCallback;
+GattClient::WriteCallback_t DiscoveredCharacteristic::onDataWriteCallback;
+
 ble_error_t
 DiscoveredCharacteristic::read(uint16_t offset) const
 {