Skip to content

Commit 4f1e574

Browse files
committed
Cordio GattServer: Fix uses of designated initializer.
These are not legal in C++ code.
1 parent 7e043ea commit 4f1e574

File tree

1 file changed

+64
-64
lines changed

1 file changed

+64
-64
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,38 @@
2929
namespace {
3030

3131
static const ble_gatts_rw_authorize_reply_params_t write_auth_queue_full_reply = {
32-
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
33-
.params = {
34-
.write = {
35-
.gatt_status = BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL
32+
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
33+
/* .params = */ {
34+
/* .write = */ {
35+
/* .gatt_status = */ BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL
3636
}
3737
}
3838
};
3939

4040
static const ble_gatts_rw_authorize_reply_params_t write_auth_invalid_offset_reply = {
41-
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
42-
.params = {
43-
.write = {
44-
.gatt_status = BLE_GATT_STATUS_ATTERR_INVALID_OFFSET
41+
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
42+
/* .params = */ {
43+
/* .write = */ {
44+
/* .gatt_status = */ BLE_GATT_STATUS_ATTERR_INVALID_OFFSET
4545
}
4646
}
4747
};
4848

4949
static const ble_gatts_rw_authorize_reply_params_t write_auth_succes_reply = {
50-
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
51-
.params = {
52-
.write = {
53-
.gatt_status = BLE_GATT_STATUS_SUCCESS,
54-
.update = 0
50+
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
51+
/* .params = */ {
52+
/* .write = */ {
53+
/* .gatt_status = */ BLE_GATT_STATUS_SUCCESS,
54+
/* .update = */ 0
5555
}
5656
}
5757
};
5858

5959
static const ble_gatts_rw_authorize_reply_params_t write_auth_invalid_reply = {
60-
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
61-
.params = {
62-
.write = {
63-
.gatt_status = BLE_GATT_STATUS_ATTERR_INVALID
60+
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
61+
/* .params = */ {
62+
/* .write = */ {
63+
/* .gatt_status = */ BLE_GATT_STATUS_ATTERR_INVALID
6464
}
6565
}
6666
};
@@ -260,9 +260,9 @@ ble_error_t nRF5xGattServer::read(GattAttribute::Handle_t attributeHandle, uint8
260260
ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP)
261261
{
262262
ble_gatts_value_t value = {
263-
.len = *lengthP,
264-
.offset = 0,
265-
.p_value = buffer,
263+
/* .len = */ *lengthP,
264+
/* .offset = */ 0,
265+
/* .p_value = */ buffer,
266266
};
267267

268268
ASSERT_TRUE( ERROR_NONE ==
@@ -302,9 +302,9 @@ ble_error_t nRF5xGattServer::write(Gap::Handle_t connectionHandle, GattAttribute
302302
ble_error_t returnValue = BLE_ERROR_NONE;
303303

304304
ble_gatts_value_t value = {
305-
.len = len,
306-
.offset = 0,
307-
.p_value = const_cast<uint8_t *>(buffer),
305+
/* .len = */ len,
306+
/* .offset = */ 0,
307+
/* .p_value = */ const_cast<uint8_t *>(buffer),
308308
};
309309

310310
if (localOnly) {
@@ -611,14 +611,14 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
611611

612612
// success, signal it to the softdevice
613613
ble_gatts_rw_authorize_reply_params_t reply = {
614-
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
615-
.params = {
616-
.write = {
617-
.gatt_status = BLE_GATT_STATUS_SUCCESS,
618-
.update = 1,
619-
.offset = input_req.offset,
620-
.len = input_req.len,
621-
.p_data = input_req.data
614+
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
615+
/* .params = */ {
616+
/* .write = */ {
617+
/* .gatt_status = */ BLE_GATT_STATUS_SUCCESS,
618+
/* .update = */ 1,
619+
/* .offset = */ input_req.offset,
620+
/* .len = */ input_req.len,
621+
/* .p_data = */ input_req.data
622622
}
623623
}
624624
};
@@ -639,12 +639,12 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
639639
}
640640

641641
GattWriteAuthCallbackParams cbParams = {
642-
.connHandle = conn_handle,
643-
.handle = req->attr_handle,
644-
.offset = req->offset,
645-
.len = req->length,
646-
.data = req->data,
647-
.authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
642+
/* .connHandle = */ conn_handle,
643+
/* .handle = */ req->attr_handle,
644+
/* .offset = */ req->offset,
645+
/* .len = */ req->length,
646+
/* .data = */ req->data,
647+
/* .authorizationReply = */ AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
648648
* set to AUTH_CALLBACK_REPLY_SUCCESS if the client
649649
* request is to proceed. */
650650
};
@@ -661,9 +661,9 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
661661

662662
// FIXME can't use ::write here, this function doesn't take the offset into account ...
663663
ble_gatts_value_t value = {
664-
.len = req->length,
665-
.offset = req->offset,
666-
.p_value = req->data
664+
/* .len = */ req->length,
665+
/* .offset = */ req->offset,
666+
/* .p_value = */ req->data
667667
};
668668
uint32_t update_err = sd_ble_gatts_value_set(conn_handle, req->attr_handle, &value);
669669
if (update_err) {
@@ -688,25 +688,25 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
688688
}
689689

690690
GattWriteAuthCallbackParams cbParams = {
691-
.connHandle = gattsEventP->conn_handle,
692-
.handle = handle_value,
693-
.offset = gattsEventP->params.authorize_request.request.write.offset,
694-
.len = gattsEventP->params.authorize_request.request.write.len,
695-
.data = gattsEventP->params.authorize_request.request.write.data,
696-
.authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
691+
/* .connHandle = */ gattsEventP->conn_handle,
692+
/* .handle = */ handle_value,
693+
/* .offset = */ gattsEventP->params.authorize_request.request.write.offset,
694+
/* .len = */ gattsEventP->params.authorize_request.request.write.len,
695+
/* .data = */ gattsEventP->params.authorize_request.request.write.data,
696+
/* .authorizationReply = */ AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
697697
* set to AUTH_CALLBACK_REPLY_SUCCESS if the client
698698
* request is to proceed. */
699699
};
700700

701701
ble_gatts_rw_authorize_reply_params_t reply = {
702-
.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE,
703-
.params = {
704-
.write = {
705-
.gatt_status = p_characteristics[characteristicIndex]->authorizeWrite(&cbParams),
706-
.update = 1,
707-
.offset = cbParams.offset,
708-
.len = cbParams.len,
709-
.p_data = cbParams.data
702+
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_WRITE,
703+
/* .params = */ {
704+
/* .write = */ {
705+
/* .gatt_status = */ p_characteristics[characteristicIndex]->authorizeWrite(&cbParams),
706+
/* .update = */ 1,
707+
/* .offset = */ cbParams.offset,
708+
/* .len = */ cbParams.len,
709+
/* .p_data = */ cbParams.data
710710
}
711711
}
712712
};
@@ -740,21 +740,21 @@ void nRF5xGattServer::hwCallback(ble_evt_t *p_ble_evt)
740740
}
741741
case GattServerEvents::GATT_EVENT_READ_AUTHORIZATION_REQ: {
742742
GattReadAuthCallbackParams cbParams = {
743-
.connHandle = gattsEventP->conn_handle,
744-
.handle = handle_value,
745-
.offset = gattsEventP->params.authorize_request.request.read.offset,
746-
.len = 0,
747-
.data = NULL,
748-
.authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
743+
/* .connHandle = */ gattsEventP->conn_handle,
744+
/* .handle = */ handle_value,
745+
/* .offset = */ gattsEventP->params.authorize_request.request.read.offset,
746+
/* .len = */ 0,
747+
/* .data = */ NULL,
748+
/* .authorizationReply = */ AUTH_CALLBACK_REPLY_SUCCESS /* the callback handler must leave this member
749749
* set to AUTH_CALLBACK_REPLY_SUCCESS if the client
750750
* request is to proceed. */
751751
};
752752

753753
ble_gatts_rw_authorize_reply_params_t reply = {
754-
.type = BLE_GATTS_AUTHORIZE_TYPE_READ,
755-
.params = {
756-
.read = {
757-
.gatt_status = p_characteristics[characteristicIndex]->authorizeRead(&cbParams)
754+
/* .type = */ BLE_GATTS_AUTHORIZE_TYPE_READ,
755+
/* .params = */ {
756+
/* .read = */ {
757+
/* .gatt_status = */ p_characteristics[characteristicIndex]->authorizeRead(&cbParams)
758758
}
759759
}
760760
};

0 commit comments

Comments
 (0)