test

Dependents:   BLE_PowerBank_HeyFaradey

Fork of BLE_API by Bluetooth Low Energy

Revision:
737:79d95f9b93be
Parent:
734:4872b70437ce
Child:
739:699b2a104ce3
--- a/ble/GattClient.h	Mon Jul 06 10:10:35 2015 +0100
+++ b/ble/GattClient.h	Mon Jul 06 10:10:35 2015 +0100
@@ -34,6 +34,8 @@
 
     typedef void (*WriteCallback_t)(const GattWriteCallbackParams *params);
 
+    typedef void (*HVXCallback_t)(const GattHVXCallbackParams *params);
+
     /*
      * The following functions are meant to be overridden in the platform-specific sub-class.
      */
@@ -263,6 +265,15 @@
         /* default implementation; override this API if this capability is supported. */
     }
 
+    /**
+     * Setup a callback for when GattClient receives an update event
+     * corresponding to a change in value of a characteristic on the remote
+     * GattServer.
+     */
+    void onHVX(HVXCallback_t callback) {
+        onHVXCallback = callback;
+    }
+
 protected:
     GattClient() {
         /* empty */
@@ -282,9 +293,16 @@
         }
     }
 
+    void processHVXEvent(const GattHVXCallbackParams *params) {
+        if (onHVXCallback) {
+            onHVXCallback(params);
+        }
+    }
+
 protected:
     ReadCallback_t  onDataReadCallback;
     WriteCallback_t onDataWriteCallback;
+    HVXCallback_t   onHVXCallback;
 
 private:
     /* disallow copy and assignment */