notify gives "

I am using the nrfconnectSDK v2.4.0  and zephyr

i called the function shown below

int notify_results = bt_gatt_notify_cb(conn, &params);

with params containing 

struct bt_gatt_notify_params params = {0};
params.attr = m_ble_metadata_response_attribute;
params.data = (const void*)&command_data->command;
params.len = (uint16_t)(command_data->parameter_length + 2);
params.func = vsg_service_metadata_response_complete;

the m_ble_metadata_response_attribute

pointed to the last characteristic in my service.

and it failed with 

<wrn> bt_gatt: gatt_notify: Device is not subscribed to characteristic

when i used nrfconnect on my iphone.

this is the end of my service.

they are my last two characteristics.

BT_GATT_CHARACTERISTIC(BT_UUID_CHR_METADATA_COMMAND,
BT_GATT_CHRC_WRITE ,
BT_GATT_PERM_WRITE,
NULL, write_metadata_command_cb, &m_queued_metadata_command),

BT_GATT_CHARACTERISTIC(BT_UUID_CHR_METADATA_RESPONSE,
BT_GATT_CHRC_NOTIFY,
BT_GATT_PERM_NONE,
NULL, NULL, NULL),

then i added one more line to my service and it worked.!!

BT_GATT_CHARACTERISTIC(BT_UUID_CHR_METADATA_COMMAND,
BT_GATT_CHRC_WRITE ,
BT_GATT_PERM_WRITE,
NULL, write_metadata_command_cb, &m_queued_metadata_command),

BT_GATT_CHARACTERISTIC(BT_UUID_CHR_METADATA_RESPONSE,
BT_GATT_CHRC_NOTIFY,
BT_GATT_PERM_NONE,
NULL, NULL, NULL),

BT_GATT_CCC(on_cccd_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),

so my question is 

Does the function bt_gatt_notify_cb(conn, &params); work correctly when the NOTIFY characteristic is the last characteristic in the service ?

thanks

phil

Related