mirror of https://github.com/ARMmbed/mbed-os.git
Cordio GattServer: Fix uses of designated initializer.
These are not legal in C++ code.pull/6932/head
parent
7e043ead96
commit
4f1e574eff
|
@ -29,38 +29,38 @@
|
|||
namespace {
|
||||
|
||||
static const ble_gatts_rw_authorize_reply_params_t write_auth_queue_full_reply = {
|
||||
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
.params = {
|
||||
.write = {
|
||||
.gatt_status = BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL
|
||||
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
/* .params = */ {
|
||||
/* .write = */ {
|
||||
/* .gatt_status = */ BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const ble_gatts_rw_authorize_reply_params_t write_auth_invalid_offset_reply = {
|
||||
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
.params = {
|
||||
.write = {
|
||||
.gatt_status = BLE_GATT_STATUS_ATTERR_INVALID_OFFSET
|
||||
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
/* .params = */ {
|
||||
/* .write = */ {
|
||||
/* .gatt_status = */ BLE_GATT_STATUS_ATTERR_INVALID_OFFSET
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const ble_gatts_rw_authorize_reply_params_t write_auth_succes_reply = {
|
||||
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
.params = {
|
||||
.write = {
|
||||
.gatt_status = BLE_GATT_STATUS_SUCCESS,
|
||||
.update = 0
|
||||
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
/* .params = */ {
|
||||
/* .write = */ {
|
||||
/* .gatt_status = */ BLE_GATT_STATUS_SUCCESS,
|
||||
/* .update = */ 0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const ble_gatts_rw_authorize_reply_params_t write_auth_invalid_reply = {
|
||||
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
.params = {
|
||||
.write = {
|
||||
.gatt_status = BLE_GATT_STATUS_ATTERR_INVALID
|
||||
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
/* .params = */ {
|
||||
/* .write = */ {
|
||||
/* .gatt_status = */ BLE_GATT_STATUS_ATTERR_INVALID
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -260,9 +260,9 @@ ble_error_t nRF5xGattServer::read(GattAttribute::Handle_t attributeHandle, uint8
|
|||
ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP)
|
||||
{
|
||||
ble_gatts_value_t value = {
|
||||
.len = *lengthP,
|
||||
.offset = 0,
|
||||
.p_value = buffer,
|
||||
/* .len = */ *lengthP,
|
||||
/* .offset = */ 0,
|
||||
/* .p_value = */ buffer,
|
||||
};
|
||||
|
||||
ASSERT_TRUE( ERROR_NONE ==
|
||||
|
@ -302,9 +302,9 @@ ble_error_t nRF5xGattServer::write(Gap::Handle_t connectionHandle, GattAttribute
|
|||
ble_error_t returnValue = BLE_ERROR_NONE;
|
||||
|
||||
ble_gatts_value_t value = {
|
||||
.len = len,
|
||||
.offset = 0,
|
||||
.p_value = const_cast<uint8_t *>(buffer),
|
||||
/* .len = */ len,
|
||||
/* .offset = */ 0,
|
||||
/* .p_value = */ const_cast<uint8_t *>(buffer),
|
||||
};
|
||||
|
||||
if (localOnly) {
|
||||
|
@ -611,14 +611,14 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
|
|||
|
||||
// success, signal it to the softdevice
|
||||
ble_gatts_rw_authorize_reply_params_t reply = {
|
||||
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
.params = {
|
||||
.write = {
|
||||
.gatt_status = BLE_GATT_STATUS_SUCCESS,
|
||||
.update = 1,
|
||||
.offset = input_req.offset,
|
||||
.len = input_req.len,
|
||||
.p_data = input_req.data
|
||||
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
/* .params = */ {
|
||||
/* .write = */ {
|
||||
/* .gatt_status = */ BLE_GATT_STATUS_SUCCESS,
|
||||
/* .update = */ 1,
|
||||
/* .offset = */ input_req.offset,
|
||||
/* .len = */ input_req.len,
|
||||
/* .p_data = */ input_req.data
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -639,12 +639,12 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
|
|||
}
|
||||
|
||||
GattWriteAuthCallbackParams cbParams = {
|
||||
.connHandle = conn_handle,
|
||||
.handle = req->attr_handle,
|
||||
.offset = req->offset,
|
||||
.len = req->length,
|
||||
.data = req->data,
|
||||
.authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
|
||||
/* .connHandle = */ conn_handle,
|
||||
/* .handle = */ req->attr_handle,
|
||||
/* .offset = */ req->offset,
|
||||
/* .len = */ req->length,
|
||||
/* .data = */ req->data,
|
||||
/* .authorizationReply = */ AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
|
||||
* set to AUTH_CALLBACK_REPLY_SUCCESS if the client
|
||||
* request is to proceed. */
|
||||
};
|
||||
|
@ -661,9 +661,9 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
|
|||
|
||||
// FIXME can't use ::write here, this function doesn't take the offset into account ...
|
||||
ble_gatts_value_t value = {
|
||||
.len = req->length,
|
||||
.offset = req->offset,
|
||||
.p_value = req->data
|
||||
/* .len = */ req->length,
|
||||
/* .offset = */ req->offset,
|
||||
/* .p_value = */ req->data
|
||||
};
|
||||
uint32_t update_err = sd_ble_gatts_value_set(conn_handle, req->attr_handle, &value);
|
||||
if (update_err) {
|
||||
|
@ -688,25 +688,25 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
|
|||
}
|
||||
|
||||
GattWriteAuthCallbackParams cbParams = {
|
||||
.connHandle = gattsEventP->conn_handle,
|
||||
.handle = handle_value,
|
||||
.offset = gattsEventP->params.authorize_request.request.write.offset,
|
||||
.len = gattsEventP->params.authorize_request.request.write.len,
|
||||
.data = gattsEventP->params.authorize_request.request.write.data,
|
||||
.authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
|
||||
/* .connHandle = */ gattsEventP->conn_handle,
|
||||
/* .handle = */ handle_value,
|
||||
/* .offset = */ gattsEventP->params.authorize_request.request.write.offset,
|
||||
/* .len = */ gattsEventP->params.authorize_request.request.write.len,
|
||||
/* .data = */ gattsEventP->params.authorize_request.request.write.data,
|
||||
/* .authorizationReply = */ AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
|
||||
* set to AUTH_CALLBACK_REPLY_SUCCESS if the client
|
||||
* request is to proceed. */
|
||||
};
|
||||
|
||||
ble_gatts_rw_authorize_reply_params_t reply = {
|
||||
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
.params = {
|
||||
.write = {
|
||||
.gatt_status = p_characteristics[characteristicIndex]->authorizeWrite(&cbParams),
|
||||
.update = 1,
|
||||
.offset = cbParams.offset,
|
||||
.len = cbParams.len,
|
||||
.p_data = cbParams.data
|
||||
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
|
||||
/* .params = */ {
|
||||
/* .write = */ {
|
||||
/* .gatt_status = */ p_characteristics[characteristicIndex]->authorizeWrite(&cbParams),
|
||||
/* .update = */ 1,
|
||||
/* .offset = */ cbParams.offset,
|
||||
/* .len = */ cbParams.len,
|
||||
/* .p_data = */ cbParams.data
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -740,21 +740,21 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
|
|||
}
|
||||
case GattServerEvents::GATT_EVENT_READ_AUTHORIZATION_REQ: {
|
||||
GattReadAuthCallbackParams cbParams = {
|
||||
.connHandle = gattsEventP->conn_handle,
|
||||
.handle = handle_value,
|
||||
.offset = gattsEventP->params.authorize_request.request.read.offset,
|
||||
.len = 0,
|
||||
.data = NULL,
|
||||
.authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
|
||||
/* .connHandle = */ gattsEventP->conn_handle,
|
||||
/* .handle = */ handle_value,
|
||||
/* .offset = */ gattsEventP->params.authorize_request.request.read.offset,
|
||||
/* .len = */ 0,
|
||||
/* .data = */ NULL,
|
||||
/* .authorizationReply = */ AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
|
||||
* set to AUTH_CALLBACK_REPLY_SUCCESS if the client
|
||||
* request is to proceed. */
|
||||
};
|
||||
|
||||
ble_gatts_rw_authorize_reply_params_t reply = {
|
||||
.type = BLE_GATTS_AUTHORIZE_TYPE_READ,
|
||||
.params = {
|
||||
.read = {
|
||||
.gatt_status = p_characteristics[characteristicIndex]->authorizeRead(&cbParams)
|
||||
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_READ,
|
||||
/* .params = */ {
|
||||
/* .read = */ {
|
||||
/* .gatt_status = */ p_characteristics[characteristicIndex]->authorizeRead(&cbParams)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue