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 nRF51822 by
Revision 101:18a6f0b9c350, committed 2015-03-23
- Comitter:
- rgrover1
- Date:
- Mon Mar 23 16:27:00 2015 +0000
- Parent:
- 100:422b051b7151
- Child:
- 102:bdc690669431
- Commit message:
- Synchronized with git rev afdc7154
Author: Rohit Grover
updated to use of new APIs for authorizeRead() and authorizeWrite() which return status.
Changed in this revision
| nRF51GattServer.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/nRF51GattServer.cpp Mon Mar 23 16:26:59 2015 +0000
+++ b/nRF51GattServer.cpp Mon Mar 23 16:27:00 2015 +0000
@@ -329,8 +329,7 @@
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
.params = {
.write = {
- .gatt_status = (p_characteristics[i]->authorizeWrite(&cbParams) ?
- BLE_GATT_STATUS_SUCCESS : BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED)
+ .gatt_status = p_characteristics[i]->authorizeWrite(&cbParams)
}
}
};
@@ -363,24 +362,22 @@
.data = NULL
};
- /* Ask for authorization and, potentially, new data. Use updated parameters to construct reply. */
- p_characteristics[i]->authorizeRead(&cbParams);
-
ble_gatts_rw_authorize_reply_params_t reply = {
- .type = BLE_GATTS_AUTHORIZE_TYPE_READ
+ .type = BLE_GATTS_AUTHORIZE_TYPE_READ,
+ .params = {
+ .read = {
+ .gatt_status = p_characteristics[i]->authorizeRead(&cbParams)
+ }
+ }
};
- if (cbParams.authorizationReply == true) {
- reply.params.read.gatt_status = BLE_GATT_STATUS_SUCCESS;
-
+ if (cbParams.authorizationReply == BLE_GATT_STATUS_SUCCESS) {
if (cbParams.data != NULL) {
reply.params.read.update = 1;
reply.params.read.offset = cbParams.offset;
reply.params.read.len = cbParams.len;
reply.params.read.p_data = cbParams.data;
}
- } else {
- reply.params.read.gatt_status = BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED;
}
sd_ble_gatts_rw_authorize_reply(gattsEventP->conn_handle, &reply);
