/
11111
1
Fork of nRF51822 by
Diff: nRF51GattServer.cpp
- Revision:
- 101:18a6f0b9c350
- Parent:
- 95:7f0d80ab964b
- Child:
- 108:27213b9fd4f9
--- 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);