Lightly modified version of the BLE stack, that doesn't bring up a DFUService by default... as we have our own.
Fork of BLE_API by
Diff: public/BLEDevice.h
- Revision:
- 342:152bd9c825d6
- Parent:
- 341:8a104d9d80c1
- Child:
- 343:4d2576324b62
--- a/public/BLEDevice.h Wed Apr 15 09:05:11 2015 +0100 +++ b/public/BLEDevice.h Thu Apr 30 08:37:21 2015 +0100 @@ -336,12 +336,20 @@ * output: Total length of attribute value upon successful return. */ ble_error_t readCharacteristicValue(GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP); + /** + * A version of the same as above with connection handle parameter to allow fetches for connection-specific multivalued attribtues (such as the CCCDs). + */ + ble_error_t readCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP); /** * @param localOnly * Only update the characteristic locally regardless of notify/indicate flags in the CCCD. */ ble_error_t updateCharacteristicValue(GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly = false); + /** + * A version of the same as above with connection handle parameter to allow updates for connection-specific multivalued attribtues (such as the CCCDs). + */ + ble_error_t updateCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly = false); /** * Yield control to the BLE stack or to other tasks waiting for events. This @@ -691,12 +699,23 @@ return transport->getGattServer().readValue(attributeHandle, buffer, lengthP); } +inline ble_error_t BLEDevice::readCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP) +{ + return transport->getGattServer().readValue(connectionHandle, attributeHandle, buffer, lengthP); +} + inline ble_error_t BLEDevice::updateCharacteristicValue(GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly) { return transport->getGattServer().updateValue(attributeHandle, const_cast<uint8_t *>(value), size, localOnly); } +inline ble_error_t +BLEDevice::updateCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly) +{ + return transport->getGattServer().updateValue(connectionHandle, attributeHandle, const_cast<uint8_t *>(value), size, localOnly); +} + inline void BLEDevice::waitForEvent(void) {