From dde04982bc4d686a74bddbadc81caefd965de5e3 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Tue, 30 Jun 2015 07:46:19 +0100 Subject: [PATCH 01/10] fix mbedmicro/BLE_API/#16: move GATT_MTU_SIZE_DEFAULT into blecommon.h --- ble/blecommon.h | 3 +++ ble/services/UARTService.h | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ble/blecommon.h b/ble/blecommon.h index 1de64eb..7a6cd59 100644 --- a/ble/blecommon.h +++ b/ble/blecommon.h @@ -126,6 +126,9 @@ enum ble_error_t { BLE_ERROR_UNSPECIFIED = 9, /**< Unknown error. */ }; +/** @brief Default MTU size. */ +static const unsigned GATT_MTU_SIZE_DEFAULT = 23; + #ifdef __cplusplus } #endif diff --git a/ble/services/UARTService.h b/ble/services/UARTService.h index 64676fe..2b0ef49 100644 --- a/ble/services/UARTService.h +++ b/ble/services/UARTService.h @@ -41,7 +41,6 @@ extern const uint8_t UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] class UARTService { public: /**< Maximum length of data (in bytes) that can be transmitted by the UART service module to the peer. */ - static const unsigned GATT_MTU_SIZE_DEFAULT = 23; static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (GATT_MTU_SIZE_DEFAULT - 3); public: From 26015995993c56e9aa32d6946966fe8bfc4a4c9f Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 1 Jul 2015 07:31:24 +0100 Subject: [PATCH 02/10] #46: rename GATT_MTU_SIZE_DEFAULT to BLE_GATT_MTU_SIZE_DEFAULT. This avoids a name conflict with the contant defined in Nordic-SDK. --- ble/blecommon.h | 2 +- ble/services/UARTService.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ble/blecommon.h b/ble/blecommon.h index 7a6cd59..b572f08 100644 --- a/ble/blecommon.h +++ b/ble/blecommon.h @@ -127,7 +127,7 @@ enum ble_error_t { }; /** @brief Default MTU size. */ -static const unsigned GATT_MTU_SIZE_DEFAULT = 23; +static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23; #ifdef __cplusplus } diff --git a/ble/services/UARTService.h b/ble/services/UARTService.h index 2b0ef49..3ba367b 100644 --- a/ble/services/UARTService.h +++ b/ble/services/UARTService.h @@ -41,7 +41,7 @@ extern const uint8_t UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] 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 = (GATT_MTU_SIZE_DEFAULT - 3); + static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (BLE_GATT_MTU_SIZE_DEFAULT - 3); public: From 27bc31ee0cf81957b7804a7a693e8f8a93913e78 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 1 Jul 2015 07:36:55 +0100 Subject: [PATCH 03/10] minor white space and comment header diffs. --- ble/GattClient.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ble/GattClient.h b/ble/GattClient.h index ca36c19..f9f8ed4 100644 --- a/ble/GattClient.h +++ b/ble/GattClient.h @@ -28,8 +28,8 @@ class GattClient { 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,12 +39,11 @@ class GattClient { */ public: /** - * 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(). + * 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(). * * @param connectionHandle * Handle for the connection with the peer. From 2d5940487779f9629f09fb1f1cc2faf48829a585 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 1 Jul 2015 08:17:44 +0100 Subject: [PATCH 04/10] #49: replace DiscoveredCharacteristic::setupOnDataRead() with GattClient::onDataRead() --- ble/DiscoveredCharacteristic.h | 12 ---------- ble/GattClient.h | 35 +++++++++++++++++++++++++++++ source/DiscoveredCharacteristic.cpp | 3 --- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/ble/DiscoveredCharacteristic.h b/ble/DiscoveredCharacteristic.h index eeb0936..faccde9 100644 --- a/ble/DiscoveredCharacteristic.h +++ b/ble/DiscoveredCharacteristic.h @@ -135,14 +135,6 @@ class DiscoveredCharacteristic { */ 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); } @@ -182,10 +174,6 @@ class DiscoveredCharacteristic { GattAttribute::Handle_t valueHandle; Gap::Handle_t connHandle; - -public: - static GattClient::ReadCallback_t onDataReadCallback; - static GattClient::WriteCallback_t onDataWriteCallback; }; #endif /*__DISCOVERED_CHARACTERISTIC_H__*/ diff --git a/ble/GattClient.h b/ble/GattClient.h index f9f8ed4..89188a5 100644 --- a/ble/GattClient.h +++ b/ble/GattClient.h @@ -207,6 +207,23 @@ class GattClient { return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; 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; + } + /** * Setup callback for when serviceDiscovery terminates. */ @@ -219,6 +236,24 @@ class GattClient { /* 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 &); diff --git a/source/DiscoveredCharacteristic.cpp b/source/DiscoveredCharacteristic.cpp index 3991421..5d0133d 100644 --- a/source/DiscoveredCharacteristic.cpp +++ b/source/DiscoveredCharacteristic.cpp @@ -17,9 +17,6 @@ #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 { From 7fb8b66ebba7defc06a07af08b40c536ecba084e Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 1 Jul 2015 11:33:38 +0100 Subject: [PATCH 05/10] minor rename of a variable. --- ble/GattServer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ble/GattServer.h b/ble/GattServer.h index 101f5f9..eee4397 100644 --- a/ble/GattServer.h +++ b/ble/GattServer.h @@ -267,21 +267,21 @@ class GattServer { } } - void handleEvent(GattServerEvents::gattEvent_e type, GattAttribute::Handle_t charHandle) { + void handleEvent(GattServerEvents::gattEvent_e type, GattAttribute::Handle_t attributeHandle) { switch (type) { case GattServerEvents::GATT_EVENT_UPDATES_ENABLED: if (updatesEnabledCallback) { - updatesEnabledCallback(charHandle); + updatesEnabledCallback(attributeHandle); } break; case GattServerEvents::GATT_EVENT_UPDATES_DISABLED: if (updatesDisabledCallback) { - updatesDisabledCallback(charHandle); + updatesDisabledCallback(attributeHandle); } break; case GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED: if (confirmationReceivedCallback) { - confirmationReceivedCallback(charHandle); + confirmationReceivedCallback(attributeHandle); } break; default: From b633e90c9c4b90ed39c98f32bd9b43eebef32d8f Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 1 Jul 2015 12:57:17 +0100 Subject: [PATCH 06/10] replace use of updateCharacteristicValue() with ble.gattServer().write() --- ble/services/BatteryService.h | 2 +- ble/services/HealthThermometerService.h | 4 ++-- ble/services/HeartRateService.h | 4 ++-- ble/services/UARTService.h | 2 +- ble/services/URIBeaconConfigService.h | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ble/services/BatteryService.h b/ble/services/BatteryService.h index 6bc0723..b8ef8ec 100644 --- a/ble/services/BatteryService.h +++ b/ble/services/BatteryService.h @@ -53,7 +53,7 @@ class BatteryService { */ void updateBatteryLevel(uint8_t newLevel) { batteryLevel = newLevel; - ble.updateCharacteristicValue(batteryLevelCharacteristic.getValueAttribute().getHandle(), &batteryLevel, 1); + ble.gattServer().write(batteryLevelCharacteristic.getValueHandle(), &batteryLevel, 1); } protected: diff --git a/ble/services/HealthThermometerService.h b/ble/services/HealthThermometerService.h index 2afa1e5..53858e9 100644 --- a/ble/services/HealthThermometerService.h +++ b/ble/services/HealthThermometerService.h @@ -73,7 +73,7 @@ class HealthThermometerService { void updateTemperature(float temperature) { if (ble.getGapState().connected) { valueBytes.updateTemperature(temperature); - ble.updateCharacteristicValue(tempMeasurement.getValueAttribute().getHandle(), valueBytes.getPointer(), sizeof(TemperatureValueBytes)); + ble.gattServer().write(tempMeasurement.getValueHandle(), valueBytes.getPointer(), sizeof(TemperatureValueBytes)); } } @@ -83,7 +83,7 @@ class HealthThermometerService { * new location value. */ void updateLocation(SensorLocation_t loc) { - ble.updateCharacteristicValue(tempLocation.getValueHandle(), reinterpret_cast(&loc), sizeof(uint8_t)); + ble.gattServer().write(tempLocation.getValueHandle(), reinterpret_cast(&loc), sizeof(uint8_t)); } private: diff --git a/ble/services/HeartRateService.h b/ble/services/HeartRateService.h index 606dc9f..14479c1 100644 --- a/ble/services/HeartRateService.h +++ b/ble/services/HeartRateService.h @@ -93,7 +93,7 @@ class HeartRateService { */ void updateHeartRate(uint8_t hrmCounter) { valueBytes.updateHeartRate(hrmCounter); - ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes()); + ble.gattServer().write(hrmRate.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes()); } /** @@ -104,7 +104,7 @@ class HeartRateService { */ void updateHeartRate(uint16_t hrmCounter) { valueBytes.updateHeartRate(hrmCounter); - ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes()); + ble.gattServer().write(hrmRate.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes()); } /** diff --git a/ble/services/UARTService.h b/ble/services/UARTService.h index 3ba367b..08b1e92 100644 --- a/ble/services/UARTService.h +++ b/ble/services/UARTService.h @@ -117,7 +117,7 @@ class UARTService { if ((sendBufferIndex == BLE_UART_SERVICE_MAX_DATA_LEN) || // (sendBuffer[sendBufferIndex - 1] == '\r') || (sendBuffer[sendBufferIndex - 1] == '\n')) { - ble.updateCharacteristicValue(getRXCharacteristicHandle(), static_cast(sendBuffer), sendBufferIndex); + ble.gattServer().write(getRXCharacteristicHandle(), static_cast(sendBuffer), sendBufferIndex); sendBufferIndex = 0; } } diff --git a/ble/services/URIBeaconConfigService.h b/ble/services/URIBeaconConfigService.h index 4ceaa05..81ef844 100644 --- a/ble/services/URIBeaconConfigService.h +++ b/ble/services/URIBeaconConfigService.h @@ -267,7 +267,7 @@ class URIBeaconConfigService { paramsUpdated = true; } if (paramsUpdated) { - ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), reinterpret_cast(¶ms.beaconPeriod), sizeof(uint16_t)); + ble.gattServer().write(beaconPeriodChar.getValueHandle(), reinterpret_cast(¶ms.beaconPeriod), sizeof(uint16_t)); } } } else if (handle == resetChar.getValueHandle()) { @@ -295,13 +295,13 @@ class URIBeaconConfigService { * change to the internal state of the service object. */ void updateCharacteristicValues(void) { - ble.updateCharacteristicValue(lockedStateChar.getValueHandle(), &lockedState, 1); - ble.updateCharacteristicValue(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength); - ble.updateCharacteristicValue(flagsChar.getValueHandle(), ¶ms.flags, 1); - ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), + ble.gattServer().write(lockedStateChar.getValueHandle(), &lockedState, 1); + ble.gattServer().write(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength); + ble.gattServer().write(flagsChar.getValueHandle(), ¶ms.flags, 1); + ble.gattServer().write(beaconPeriodChar.getValueHandle(), reinterpret_cast(¶ms.beaconPeriod), sizeof(uint16_t)); - ble.updateCharacteristicValue(txPowerModeChar.getValueHandle(), ¶ms.txPowerMode, 1); - ble.updateCharacteristicValue(advPowerLevelsChar.getValueHandle(), + ble.gattServer().write(txPowerModeChar.getValueHandle(), ¶ms.txPowerMode, 1); + ble.gattServer().write(advPowerLevelsChar.getValueHandle(), reinterpret_cast(params.advPowerLevels), sizeof(PowerLevels_t)); } From 453681182a49b6fefa4ce958e5fd8ca57cc33431 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 1 Jul 2015 13:14:26 +0100 Subject: [PATCH 07/10] change access levels to protected for various members of the standard services --- ble/services/HealthThermometerService.h | 2 +- ble/services/LinkLossService.h | 2 +- ble/services/UARTService.h | 4 ++-- ble/services/URIBeaconConfigService.h | 2 +- ble/services/iBeaconService.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ble/services/HealthThermometerService.h b/ble/services/HealthThermometerService.h index 53858e9..063d5fc 100644 --- a/ble/services/HealthThermometerService.h +++ b/ble/services/HealthThermometerService.h @@ -140,7 +140,7 @@ class HealthThermometerService { uint8_t bytes[SIZEOF_VALUE_BYTES]; }; -private: +protected: BLE &ble; TemperatureValueBytes valueBytes; ReadOnlyGattCharacteristic tempMeasurement; diff --git a/ble/services/LinkLossService.h b/ble/services/LinkLossService.h index 88a0e04..a7c86fa 100644 --- a/ble/services/LinkLossService.h +++ b/ble/services/LinkLossService.h @@ -73,7 +73,7 @@ class LinkLossService { alertLevel = newLevel; } -private: +protected: /** * This callback allows receiving updates to the AlertLevel Characteristic. * diff --git a/ble/services/UARTService.h b/ble/services/UARTService.h index 08b1e92..ef9914e 100644 --- a/ble/services/UARTService.h +++ b/ble/services/UARTService.h @@ -159,7 +159,7 @@ class UARTService { return receiveBuffer[receiveBufferIndex++]; } -private: +protected: /** * This callback allows the UART service to receive updates to the * txCharacteristic. The application should forward the call to this @@ -177,7 +177,7 @@ class UARTService { } } -private: +protected: BLE &ble; uint8_t receiveBuffer[BLE_UART_SERVICE_MAX_DATA_LEN]; /**< The local buffer into which we receive diff --git a/ble/services/URIBeaconConfigService.h b/ble/services/URIBeaconConfigService.h index 81ef844..a7f82fe 100644 --- a/ble/services/URIBeaconConfigService.h +++ b/ble/services/URIBeaconConfigService.h @@ -305,7 +305,7 @@ class URIBeaconConfigService { reinterpret_cast(params.advPowerLevels), sizeof(PowerLevels_t)); } -private: +protected: void lockAuthorizationCallback(GattWriteAuthCallbackParams *authParams) { if (lockedState) { authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION; diff --git a/ble/services/iBeaconService.h b/ble/services/iBeaconService.h index a3f6af7..6072575 100644 --- a/ble/services/iBeaconService.h +++ b/ble/services/iBeaconService.h @@ -66,7 +66,7 @@ class iBeaconService ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED); } -private: +protected: BLE &ble; Payload data; }; From 9a0be47794404b9586f2caa3e4872ab6859bd14c Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 1 Jul 2015 14:52:17 +0100 Subject: [PATCH 08/10] Introduce GattServer API to determine notification status for a characteristic. follow up from https://github.com/mbedmicro/BLE_API/pull/41. @jeremybrodt did a lovely job submitting that pull request, but there had been too many changes in the neighbouring code recently to merge his work directly. I didn't take the trouble of preseving his submission in the history; my apologies--credit for this API goes entirely to him. --- ble/GattServer.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/ble/GattServer.h b/ble/GattServer.h index eee4397..7bbb3e1 100644 --- a/ble/GattServer.h +++ b/ble/GattServer.h @@ -148,6 +148,37 @@ class GattServer { return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; 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; /* default implementation; 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; /* default implementation; override this API if this capability is supported. */ + } + /** * A virtual function to allow underlying stacks to indicate if they support * onDataRead(). It should be overridden to return true as applicable. From 417b857d1b98dc9802ad88c10b0943cb3c477e2e Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Thu, 2 Jul 2015 08:19:12 +0100 Subject: [PATCH 09/10] changing a comment pattern to request action from porters. --- ble/Gap.h | 32 ++++++++++++++++---------------- ble/GattClient.h | 10 +++++----- ble/GattServer.h | 14 +++++++------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/ble/Gap.h b/ble/Gap.h index e18fa75..27304ed 100644 --- a/ble/Gap.h +++ b/ble/Gap.h @@ -154,7 +154,7 @@ class Gap { * @return BLE_ERROR_NONE on success. */ virtual ble_error_t setAddress(AddressType_t type, const Address_t address) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -163,7 +163,7 @@ class Gap { * @return BLE_ERROR_NONE on success. */ virtual ble_error_t getAddress(AddressType_t *typeP, Address_t address) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -188,7 +188,7 @@ class Gap { } virtual ble_error_t stopAdvertising(void) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -197,7 +197,7 @@ class Gap { * @retval BLE_ERROR_NONE if successfully stopped scanning procedure. */ virtual ble_error_t stopScan() { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -219,7 +219,7 @@ class Gap { Gap::AddressType_t peerAddrType, const ConnectionParams_t *connectionParams, const GapScanningParams *scanParams) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -231,7 +231,7 @@ class Gap { * 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -248,7 +248,7 @@ class Gap { * 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -264,7 +264,7 @@ class Gap { * the given structure pointed to by params. */ virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -276,7 +276,7 @@ class Gap { * The structure containing the desired parameters. */ virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -290,7 +290,7 @@ class Gap { * 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -299,7 +299,7 @@ class Gap { * The new value for the device-name. This is a UTF-8 encoded, NULL-terminated string. */ virtual ble_error_t setDeviceName(const uint8_t *deviceName) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -321,7 +321,7 @@ class Gap { * 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -330,7 +330,7 @@ class Gap { * The new value for the device-appearance. */ virtual ble_error_t setAppearance(GapAdvertisingData::Appearance appearance) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -339,7 +339,7 @@ class Gap { * The new value for the device-appearance. */ virtual ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -347,7 +347,7 @@ class Gap { * @param[in] txPower Radio transmit power in dBm. */ virtual ble_error_t setTxPower(int8_t txPower) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -365,7 +365,7 @@ class Gap { 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /* diff --git a/ble/GattClient.h b/ble/GattClient.h index 89188a5..8d3885f 100644 --- a/ble/GattClient.h +++ b/ble/GattClient.h @@ -97,7 +97,7 @@ class GattClient { 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -129,7 +129,7 @@ class GattClient { 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -160,7 +160,7 @@ class GattClient { ServiceDiscovery::ServiceCallback_t callback, GattAttribute::Handle_t startHandle, GattAttribute::Handle_t endHandle) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -180,7 +180,7 @@ class GattClient { /* 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -204,7 +204,7 @@ class GattClient { GattAttribute::Handle_t attributeHandle, size_t length, const uint8_t *value) const { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /* Event callback handlers. */ diff --git a/ble/GattServer.h b/ble/GattServer.h index 7bbb3e1..0f60a1e 100644 --- a/ble/GattServer.h +++ b/ble/GattServer.h @@ -53,7 +53,7 @@ class GattServer { * characteristics contained within. */ virtual ble_error_t addService(GattService &) { - return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -72,7 +72,7 @@ class GattServer { * @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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -97,7 +97,7 @@ class GattServer { * 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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -119,7 +119,7 @@ class GattServer { * @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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -145,7 +145,7 @@ class GattServer { * @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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -159,7 +159,7 @@ class GattServer { * @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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -176,7 +176,7 @@ class GattServer { * @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; /* default implementation; override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** From 4ac9700a2b0aa9585adc212a18faee7cca1c60bf Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Thu, 2 Jul 2015 08:27:54 +0100 Subject: [PATCH 10/10] update LinkLossService with changes to GattWriteCallbackParams --- ble/services/LinkLossService.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ble/services/LinkLossService.h b/ble/services/LinkLossService.h index a7c86fa..66a1ac2 100644 --- a/ble/services/LinkLossService.h +++ b/ble/services/LinkLossService.h @@ -81,7 +81,7 @@ class LinkLossService { * Information about the characterisitc being updated. */ virtual void onDataWritten(const GattWriteCallbackParams *params) { - if (params->charHandle == alertLevelChar.getValueHandle()) { + if (params->handle == alertLevelChar.getValueHandle()) { alertLevel = *reinterpret_cast(params->data); } }