Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Revision 737:79d95f9b93be, committed 2015-07-06
- Comitter:
- rgrover1
- Date:
- Mon Jul 06 10:10:35 2015 +0100
- Parent:
- 736:87c756801625
- Child:
- 738:9c2edf20ea56
- Commit message:
- Synchronized with git rev 0d55096d
Author: Rohit Grover
fix #53: add GattClient::onHVX() and GattHVXCallbackParams
Changed in this revision
--- a/ble/GattCallbackParamTypes.h Mon Jul 06 10:10:35 2015 +0100
+++ b/ble/GattCallbackParamTypes.h Mon Jul 06 10:10:35 2015 +0100
@@ -75,4 +75,12 @@
* request is to proceed; false otherwise. */
};
+/* For encapsulating handle-value update events (notifications or indications) generated at the remote server. */
+struct GattHVXCallbackParams {
+ GattAttribute::Handle_t handle; /**< Attribute Handle to which the HVx operation applies. */
+ HVXType_t type; /**< Indication or Notification, see @ref HVXType_t. */
+ uint16_t len; /**< Attribute data length. */
+ const uint8_t *data; /**< Attribute data, variable length. */
+};
+
#endif /*__GATT_CALLBACK_PARAM_TYPES_H__*/
\ No newline at end of file
--- 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 */
--- a/ble/blecommon.h Mon Jul 06 10:10:35 2015 +0100
+++ b/ble/blecommon.h Mon Jul 06 10:10:35 2015 +0100
@@ -129,6 +129,11 @@
/** @brief Default MTU size. */
static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23;
+enum HVXType_t {
+ BLE_HVX_NOTIFICATION = 0x01, /**< Handle Value Notification. */
+ BLE_HVX_INDICATION = 0x02, /**< Handle Value Indication. */
+};
+
#ifdef __cplusplus
}
#endif
