This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to tell which service is connected from the BLE event parameters of nRF51 peripheral

I have several services on a nRF51 peripheral, and would like to have different initialization based on which service is being connected to. The related code is below:

static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
		    ......
			break;
		case BLE_GAP_EVT_DISCONNECTED:
		    ......
			break;
		case ...
		     ......
		default:
		    break;
	}
}

However, I don't know how to associate the BLE event with a specific active service. Please advise. Thanks.

Parents
  • You don't connect to a service - you connect to device.

    You can make some initialization ex. after enabling notifications on characteristics or something similar.

Reply
  • You don't connect to a service - you connect to device.

    You can make some initialization ex. after enabling notifications on characteristics or something similar.

Children
No Data