Skip to content

Commit

Permalink
Switch order of broadcasted characteristics
Browse files Browse the repository at this point in the history
This solves an issue with BearChess where the wrong characteristics were used to read the board data when the order of the broadcast was different.
  • Loading branch information
gkalab committed Aug 11, 2023
1 parent 9595a6b commit 31ae408
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions main/bleuart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ static const ble_uuid128_t gatt_svr_chr_board_read_uuid =
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
const struct ble_gatt_svc_def gatt_svr_svcs[] = {
{
/* Service: board */
.type = BLE_GATT_SVC_TYPE_PRIMARY,
.uuid = &gatt_svr_svc_board_uuid.u,
.characteristics = (struct ble_gatt_chr_def[]){{
.uuid = &gatt_svr_chr_board_read_uuid.u,
.access_cb = BleUart::gatt_svr_chr_access_uart_write,
.flags = BLE_GATT_CHR_F_NOTIFY,
.val_handle = &BleUart::g_bleuart_attr_board_read_handle,
},
{
.uuid = 0, /* No more characteristics in this service */
}},
},
{
/* Service: main */
.type = BLE_GATT_SVC_TYPE_PRIMARY,
Expand All @@ -83,20 +97,6 @@ const struct ble_gatt_svc_def gatt_svr_svcs[] = {
.uuid = 0, /* No more characteristics in this service */
}},
},
{
/* Service: board */
.type = BLE_GATT_SVC_TYPE_PRIMARY,
.uuid = &gatt_svr_svc_board_uuid.u,
.characteristics = (struct ble_gatt_chr_def[]){{
.uuid = &gatt_svr_chr_board_read_uuid.u,
.access_cb = BleUart::gatt_svr_chr_access_uart_write,
.flags = BLE_GATT_CHR_F_NOTIFY,
.val_handle = &BleUart::g_bleuart_attr_board_read_handle,
},
{
.uuid = 0, /* No more characteristics in this service */
}},
},
{
0, /* No more services */
},
Expand Down

0 comments on commit 31ae408

Please sign in to comment.