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

Identify Device Based on Advertising Data

I am connecting to two identical devices, but one is configured as device 'A' and the other is device 'B'. I am currently advertising whether the device is configured as A or B, and am able to connect to them selectively, but I'm not sure how to associate the device configuration with the handle or some other identifier that would be available in device_manager_event_handler().

For example, in on_ble_evt() when I get an BLE_GAP_EVT_ADV_REPORT event, I check to see what configuration the device is advertising. I would like to store this along with some other identifier so that when I get a DM_EVT_DISCONNECTION event in device_manager_event_handler() I can print out "Device B Disconnected"

So my question is what identifier can I use for this, or is there another way to accomplish what I'm trying to do?

EDIT: I tried using the address to correlate the advertising device with the connected device, but the last byte of the addresses do not match:

on_ble_evt() : 
p_ble_evt->evt.gap_evt.params.scan_req_report.peer_addr

device_manager_event_handler():
p_event->event_param.p_gap_param->params.scan_req_report.peer_addr.addr
Related