fork BLE_API to add update adv payload API
Fork of BLE_API by
Diff: public/GattClient.h
- Revision:
- 510:39612adfbf68
- Parent:
- 508:31e63ad6923f
- Child:
- 511:9f5046c0f741
--- a/public/GattClient.h Fri Jun 19 15:52:04 2015 +0100 +++ b/public/GattClient.h Fri Jun 19 15:52:04 2015 +0100 @@ -25,7 +25,7 @@ class GattClient { public: - typedef void (*ReadCallback_t)(const GattCharacteristicReadCBParams *params); + typedef void (*ReadCallback_t)(const GattReadCallbackParams *params); enum WriteOp_t { GATT_OP_INVALID = 0x00, /**< Invalid Operation. */ @@ -36,7 +36,7 @@ GATT_OP_EXEC_WRITE_REQ = 0x05, /**< Execute Write Request. */ }; - typedef void (*WriteCallback_t)(const GattCharacteristicWriteCBParams *params); + typedef void (*WriteCallback_t)(const GattWriteCallbackParams *params); public: /** @@ -116,9 +116,9 @@ void setOnDataSent(T *objPtr, void (T::*memberPtr)(unsigned count)) { onDataSent.add(objPtr, memberPtr); } - void setOnDataWritten(void (*callback)(const GattCharacteristicWriteCBParams *eventDataP)) {onDataWritten.add(callback);} + void setOnDataWritten(void (*callback)(const GattWriteCallbackParams *eventDataP)) {onDataWritten.add(callback);} template <typename T> - void setOnDataWritten(T *objPtr, void (T::*memberPtr)(const GattCharacteristicWriteCBParams *context)) { + void setOnDataWritten(T *objPtr, void (T::*memberPtr)(const GattWriteCallbackParams *context)) { onDataWritten.add(objPtr, memberPtr); } @@ -129,7 +129,7 @@ virtual bool isOnDataReadAvailable() const { return false; } - ble_error_t setOnDataRead(void (*callback)(const GattCharacteristicReadCBParams *eventDataP)) { + ble_error_t setOnDataRead(void (*callback)(const GattReadCallbackParams *eventDataP)) { if (!isOnDataReadAvailable()) { return BLE_ERROR_NOT_IMPLEMENTED; } @@ -138,7 +138,7 @@ return BLE_ERROR_NONE; } template <typename T> - ble_error_t setOnDataRead(T *objPtr, void (T::*memberPtr)(const GattCharacteristicReadCBParams *context)) { + ble_error_t setOnDataRead(T *objPtr, void (T::*memberPtr)(const GattReadCallbackParams *context)) { if (!isOnDataReadAvailable()) { return BLE_ERROR_NOT_IMPLEMENTED; } @@ -151,13 +151,13 @@ void setOnConfirmationReceived(EventCallback_t callback) {onConfirmationReceived = callback;} protected: - void handleDataWrittenEvent(const GattCharacteristicWriteCBParams *params) { + void handleDataWrittenEvent(const GattWriteCallbackParams *params) { if (onDataWritten.hasCallbacksAttached()) { onDataWritten.call(params); } } - void handleDataReadEvent(const GattCharacteristicReadCBParams *params) { + void handleDataReadEvent(const GattReadCallbackParams *params) { if (onDataRead.hasCallbacksAttached()) { onDataRead.call(params); } @@ -197,8 +197,8 @@ private: CallChainOfFunctionPointersWithContext<unsigned> onDataSent; - CallChainOfFunctionPointersWithContext<const GattCharacteristicWriteCBParams *> onDataWritten; - CallChainOfFunctionPointersWithContext<const GattCharacteristicReadCBParams *> onDataRead; + CallChainOfFunctionPointersWithContext<const GattWriteCallbackParams *> onDataWritten; + CallChainOfFunctionPointersWithContext<const GattReadCallbackParams *> onDataRead; EventCallback_t onUpdatesEnabled; EventCallback_t onUpdatesDisabled; EventCallback_t onConfirmationReceived;