Merge pull request #22 from marcuschangarm/master

Added optional data and length fields to the return struct for authorize...
This commit is contained in:
Rohit Grover 2014-12-17 08:52:15 +00:00
commit 846438af43
2 changed files with 14 additions and 2 deletions

View File

@ -383,7 +383,17 @@ public:
/**
* Helper function meant to be called from the guts of the BLE stack to
* determine the authorization reply for a read request.
* @param params to capture the context of the read-auth request; and also contains an out-parameter for reply.
* @param params to capture the context of the read-auth request.
*
* @NOTE: To authorize/deny the read the params->authorizationReply field
* should be set to true/false.
*
* If the read is approved and params->data is unchanged (NULL),
* the current characteristic value will be used.
*
* If the read is approved, a new value can be provided by setting
* the params->data pointer and params->len fields.
*
* @return true if the read is authorized to proceed.
*/
bool authorizeRead(GattCharacteristicReadAuthCBParams *params) {

View File

@ -44,7 +44,9 @@ struct GattCharacteristicWriteAuthCBParams {
struct GattCharacteristicReadAuthCBParams {
GattAttribute::Handle_t charHandle;
uint16_t offset; /**< Offset for the write operation. */
uint16_t offset; /**< Offset for the read operation. */
uint16_t len; /**< Optional: new length of the outgoing data. */
uint8_t *data; /**< Optional: new outgoing data. Leave at NULL if data is unchanged. */
bool authorizationReply; /* This is the out parameter which needs to be set to true by the callback if the
* request is to proceed; false otherwise. */
};