BLE_API for nRF51
Fork of BLE_API by
Diff: ble/GattClient.h
- Revision:
- 727:1a1f5c5aedfe
- Parent:
- 725:f4a355b35cf8
- Child:
- 728:997ba5e7b3b6
diff -r 6884e374e2eb -r 1a1f5c5aedfe ble/GattClient.h --- a/ble/GattClient.h Thu Jul 02 09:06:12 2015 +0100 +++ b/ble/GattClient.h Mon Jul 06 10:10:34 2015 +0100 @@ -28,8 +28,8 @@ typedef void (*ReadCallback_t)(const GattReadCallbackParams *params); enum WriteOp_t { - GATT_OP_WRITE_REQ = 0x01, /**< Write Request. */ - GATT_OP_WRITE_CMD = 0x02, /**< Write Command. */ + GATT_OP_WRITE_REQ = 0x01, /**< Write Request. */ + GATT_OP_WRITE_CMD = 0x02, /**< Write Command. */ }; typedef void (*WriteCallback_t)(const GattWriteCallbackParams *params); @@ -39,11 +39,12 @@ */ public: /** - * Launch service discovery. Once launched, application callbacks will be - * invoked for matching services/characteristics. isServiceDiscoveryActive() - * can be used to determine status; and a termination callback (if setup) - * will be invoked at the end. Service discovery can be terminated prematurely - * if needed using terminateServiceDiscovery(). + * Launch service discovery. Once launched, service discovery will remain + * active with callbacks being issued back into the application for matching + * services/characteristics. isServiceDiscoveryActive() can be used to + * determine status; and a termination callback (if setup) will be invoked + * at the end. Service discovery can be terminated prematurely if needed + * using terminateServiceDiscovery(). * * @param connectionHandle * Handle for the connection with the peer. @@ -97,7 +98,7 @@ ServiceDiscovery::CharacteristicCallback_t cc = NULL, const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN), const UUID &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) { - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ } /** @@ -129,7 +130,7 @@ virtual ble_error_t discoverServices(Gap::Handle_t connectionHandle, ServiceDiscovery::ServiceCallback_t callback, const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) { - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ } /** @@ -160,7 +161,7 @@ ServiceDiscovery::ServiceCallback_t callback, GattAttribute::Handle_t startHandle, GattAttribute::Handle_t endHandle) { - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ } /** @@ -180,7 +181,7 @@ /* Initiate a Gatt Client read procedure by attribute-handle. */ virtual ble_error_t read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const { - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ } /** @@ -204,24 +205,7 @@ GattAttribute::Handle_t attributeHandle, size_t length, const uint8_t *value) const { - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): 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; + return BLE_ERROR_NOT_IMPLEMENTED; /* default implementation; override this API if this capability is supported. */ } /** @@ -236,24 +220,6 @@ /* 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 &);