Hello, On S130 conn handles were 0 to 2 for connections as central and 3 for connection as device.
I migrated to S132. Question, when i set 3 / 1 as configuration, do handles still the sames ?
Hello, On S130 conn handles were 0 to 2 for connections as central and 3 for connection as device.
I migrated to S132. Question, when i set 3 / 1 as configuration, do handles still the sames ?
Hi,
You can not rely on the connection handles having specific values. As far as I know the handle values may depend on connection order and/or other things.
If you need the connection handle, you should read the handle on the connection event and then save it. You should never hard code it. You can check the connection handle on all BLE events, by reading p_ble_evt->evt.gap_evt.conn_handle
. (Here, p_ble_evt
is the pointer to the BLE event). See the SDK 11 example under <SDK folder>\examples\ble_central_and_peripheral\experimental\ble_app_hrs_rscs_relay\
, which uses the latest versions of s130/s132 with two connections as central and one connection as peripheral, using the s130 (pca10028) and the s132 (pca10036, pca10040). It only keeps track of the connection handlers for the central roles. In ble_evt_dispatch
it reads the connection handle from the event, and uses it to determine the connection role. If it is peripheral role then we know this is the one and only peripheral connection.
Regards, Terje