prova invio BLE
Dependents: BLE_HeartRate_IDB04A1
Fork of BLE_API by
Diff: ble/GattClient.h
- Revision:
- 720:ce8a760a4504
- Parent:
- 719:5f5c3812ea8f
- Child:
- 725:f4a355b35cf8
diff -r 5f5c3812ea8f -r ce8a760a4504 ble/GattClient.h --- 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 &);