add BLEDevice::readCharacteristicValue()

master
Rohit Grover 2014-06-13 11:22:03 +01:00
parent 36bc3dc050
commit 906d8cc00d
2 changed files with 9 additions and 2 deletions

View File

@ -142,7 +142,9 @@ public:
ble_error_t addService(GattService &service);
Gap::GapState_t getGapState(void) const;
ble_error_t updateCharacteristicValue(uint16_t handle, const uint8_t* value, uint16_t size, bool localOnly = false);
ble_error_t readCharacteristicValue(uint16_t handle, uint8_t *const buffer, uint16_t *const lengthP);
ble_error_t updateCharacteristicValue(uint16_t handle, const uint8_t* value, uint16_t size, bool localOnly = false);
/**
* Yield control to the BLE stack or to other tasks waiting for events. This
@ -373,6 +375,11 @@ BLEDevice::getGapState(void) const
return transport->getGap().getState();
}
inline ble_error_t BLEDevice::readCharacteristicValue(uint16_t handle, uint8_t *const buffer, uint16_t *const lengthP)
{
return transport->getGattServer().readValue(handle, buffer, lengthP);
}
inline ble_error_t
BLEDevice::updateCharacteristicValue(uint16_t handle, const uint8_t* value, uint16_t size, bool localOnly)
{

View File

@ -34,7 +34,7 @@ class GattServer
public:
/* These functions must be defined in the sub-class */
virtual ble_error_t addService(GattService &) = 0;
virtual ble_error_t readValue(uint16_t, uint8_t[], uint16_t) = 0;
virtual ble_error_t readValue(uint16_t handle, uint8_t buffer[], uint16_t *const lengthP) = 0;
virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false) = 0;
// ToDo: For updateValue, check the CCCD to see if the value we are