BLE_API for nRF51

Fork of BLE_API by Bluetooth Low Energy

Revision:
737:79d95f9b93be
Parent:
734:4872b70437ce
Child:
739:699b2a104ce3
diff -r 87c756801625 -r 79d95f9b93be ble/GattClient.h
--- 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 */