abc

Fork of BLE_API by Bluetooth Low Energy

Revision:
295:4883b219983a
Parent:
294:ab928e365ea1
Child:
296:931da9973b89
diff -r ab928e365ea1 -r 4883b219983a public/BLEDevice.h
--- a/public/BLEDevice.h	Mon Mar 02 11:50:47 2015 +0000
+++ b/public/BLEDevice.h	Mon Mar 02 11:50:47 2015 +0000
@@ -71,9 +71,7 @@
      *              Any central device can connect to this peripheral.
      *
      *              \par ADV_SCANNABLE_UNDIRECTED
-     *              Any central device can connect to this peripheral, and
-     *              the secondary Scan Response payload will be included or
-     *              available to central devices.
+     *              Include support for Scan Response payloads.
      *
      *              \par
      *              See Bluetooth Core Specification 4.0 (Vol. 3), Part C,
@@ -252,20 +250,6 @@
     void onDataWritten(void (*callback)(const GattCharacteristicWriteCBParams *eventDataP));
     template <typename T> void onDataWritten(T * objPtr, void (T::*memberPtr)(const GattCharacteristicWriteCBParams *context));
 
-    /**
-     * Setup a callback for when a characteristic is being read by a client.
-     *
-     * @Note: it is possible to chain together multiple onDataRead callbacks
-     * (potentially from different modules of an application) to receive updates
-     * to characteristics. Services may add their own onDataRead callbacks
-     * behind the scenes to trap interesting events.
-     *
-     * @Note: it is also possible to setup a callback into a member function of
-     * some object.
-     */
-    ble_error_t onDataRead(void (*callback)(const GattCharacteristicReadCBParams *eventDataP));
-    template <typename T> ble_error_t onDataRead(T * objPtr, void (T::*memberPtr)(const GattCharacteristicReadCBParams *context));
-
     void onUpdatesEnabled(GattServer::EventCallback_t callback);
     void onUpdatesDisabled(GattServer::EventCallback_t callback);
     void onConfirmationReceived(GattServer::EventCallback_t callback);
@@ -283,13 +267,13 @@
      *     input:  Length in bytes to be read,
      *     output: Total length of attribute value upon successful return.
      */
-    ble_error_t readCharacteristicValue(uint16_t handle, uint8_t *const buffer, uint16_t *const lengthP);
+    ble_error_t readCharacteristicValue(GattAttribute::Handle_t handle, uint8_t *const buffer, uint16_t *const lengthP);
 
     /**
      * @param  localOnly
      *         Only update the characteristic locally regardless of notify/indicate flags in the CCCD.
      */
-    ble_error_t updateCharacteristicValue(uint16_t handle, const uint8_t *value, uint16_t size, bool localOnly = false);
+    ble_error_t updateCharacteristicValue(GattAttribute::Handle_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
@@ -567,16 +551,6 @@
     transport->getGattServer().setOnDataWritten(objPtr, memberPtr);
 }
 
-inline ble_error_t
-BLEDevice::onDataRead(void (*callback)(const GattCharacteristicReadCBParams *eventDataP)) {
-    return transport->getGattServer().setOnDataRead(callback);
-}
-
-template <typename T> inline ble_error_t
-BLEDevice::onDataRead(T *objPtr, void (T::*memberPtr)(const GattCharacteristicReadCBParams *context)) {
-    return transport->getGattServer().setOnDataRead(objPtr, memberPtr);
-}
-
 inline void
 BLEDevice::onUpdatesEnabled(GattServer::EventCallback_t callback)
 {
@@ -607,13 +581,13 @@
     return transport->getGap().getState();
 }
 
-inline ble_error_t BLEDevice::readCharacteristicValue(uint16_t handle, uint8_t *const buffer, uint16_t *const lengthP)
+inline ble_error_t BLEDevice::readCharacteristicValue(GattAttribute::Handle_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)
+BLEDevice::updateCharacteristicValue(GattAttribute::Handle_t handle, const uint8_t *value, uint16_t size, bool localOnly)
 {
     return transport->getGattServer().updateValue(handle, const_cast<uint8_t *>(value), size, localOnly);
 }