fix NimBLE notify characteristic registration
This commit is contained in:
@@ -45,6 +45,21 @@ static uint32_t get_u32_le(const uint8_t *input)
|
|||||||
((uint32_t)input[2] << 16) | ((uint32_t)input[3] << 24);
|
((uint32_t)input[2] << 16) | ((uint32_t)input[3] << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int data_access(
|
||||||
|
uint16_t connection_handle,
|
||||||
|
uint16_t attribute_handle,
|
||||||
|
struct ble_gatt_access_ctxt *context,
|
||||||
|
void *argument)
|
||||||
|
{
|
||||||
|
(void)connection_handle;
|
||||||
|
(void)attribute_handle;
|
||||||
|
(void)context;
|
||||||
|
(void)argument;
|
||||||
|
// NimBLE requires every characteristic definition to have an access
|
||||||
|
// callback, even though this notify-only value is never client-accessible.
|
||||||
|
return BLE_ATT_ERR_UNLIKELY;
|
||||||
|
}
|
||||||
|
|
||||||
static int ack_access(
|
static int ack_access(
|
||||||
uint16_t connection_handle,
|
uint16_t connection_handle,
|
||||||
uint16_t attribute_handle,
|
uint16_t attribute_handle,
|
||||||
@@ -94,6 +109,7 @@ static const struct ble_gatt_svc_def TRIKKE_GATT_SERVICES[] = {
|
|||||||
.characteristics = (struct ble_gatt_chr_def[]) {
|
.characteristics = (struct ble_gatt_chr_def[]) {
|
||||||
{
|
{
|
||||||
.uuid = &TRIKKE_DATA_UUID.u,
|
.uuid = &TRIKKE_DATA_UUID.u,
|
||||||
|
.access_cb = data_access,
|
||||||
.flags = BLE_GATT_CHR_F_NOTIFY,
|
.flags = BLE_GATT_CHR_F_NOTIFY,
|
||||||
.val_handle = &s_data_value_handle,
|
.val_handle = &s_data_value_handle,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user