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
Diff: ble/GattClient.h
- Revision:
- 720:ce8a760a4504
- Parent:
- 719:5f5c3812ea8f
- Child:
- 725:f4a355b35cf8
--- a/ble/GattClient.h Thu Jul 02 09:06:12 2015 +0100 +++ b/ble/GattClient.h Thu Jul 02 09:06:12 2015 +0100 @@ -207,6 +207,23 @@ return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ } + /* Event callback handlers. */ +public: + /** + * Setup a callback for read response events. + */ + void onDataRead(ReadCallback_t callback) { + onDataReadCallback = callback; + } + + /** + * Setup a callback for write response events. + * @Note: write commands (issued using writeWoResponse) don't generate a response. + */ + void onDataWrite(WriteCallback_t callback) { + onDataWriteCallback = callback; + } + /** * Setup callback for when serviceDiscovery terminates. */ @@ -219,6 +236,24 @@ /* empty */ } + /* Entry points for the underlying stack to report events back to the user. */ +public: + void processReadResponse(const GattReadCallbackParams *params) { + if (onDataReadCallback) { + onDataReadCallback(params); + } + } + + void processWriteResponse(const GattWriteCallbackParams *params) { + if (onDataWriteCallback) { + onDataWriteCallback(params); + } + } + +protected: + ReadCallback_t onDataReadCallback; + WriteCallback_t onDataWriteCallback; + private: /* disallow copy and assignment */ GattClient(const GattClient &);