Hi all,
I am using SDK for mesh v. 3.1.0 next to SDK 15.2, nRF52832 DK. I have two services, NUS and Mesh Proxy Service. For both of the services there is registered a BLE observer. When the Notification in the NUS Service for TX Characteristic is enabled in the nRF Connect app, then it occurs BLE_GATTS_EVT_WRITE event on the side of GATT server. Snippet of code below regarding the NUS Service event handler shows the event and checking if Notification enabled:
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
uint32_t err_code;
ble_nus_t * p_nus = (ble_nus_t *)p_context;
switch (p_ble_evt->header.evt_id)
{
case BLE_GATTS_EVT_WRITE:
if((p_ble_evt->evt.gatts_evt.params.write.handle == p_nus->tx_handles.cccd_handle) &&
p_ble_evt->evt.gatts_evt.params.write.len == 2)
{
if (ble_srv_is_notification_enabled(p_ble_evt->evt.gatts_evt.params.write.data))
{
p_client->is_notification_enabled = true;
SEGGER_RTT_printf(0, "%s(): Notification has been enabled\n", __func__);
}
else{
SEGGER_RTT_printf(0, "%s(): Notification has been disabled\n", __func__);
}
}
break
}
}
But the same event also occurs when configuring the node using Mesh Proxy Service. I want to send some data to nRF Connect app when the Notification is enabled, but using NUS service, not Mesh Proxy Service. But how to distinguish which of the Services enabled Notification ???