Closed nashif closed 7 years ago
by Johan Hedberg:
I don't think Jira is the right place for questions (you should use the mailing list or IRC instead), however let me give you a quick answer anyway: you can use the bt_conn_get_info() API for this. The role member of the info struct will be BT_CONN_ROLE_MASTER when Zephyr is central and BT_CONN_ROLE_SLAVE when Zephyr is peripheral.
by Thanh Do:
Many thanks Johan.
Reported by Thanh Do:
Hi,
I have an application with BLE on Nordic nRF52832 with BLE Central and Peripheral at a moment.
The config: CONFIG_BT=y CONFIG_BT_DEBUG_LOG=y CONFIG_BT_DEBUG_MONITOR=n CONFIG_BT_SMP=n CONFIG_BT_CENTRAL=y CONFIG_BT_GATT_CLIENT=y CONFIG_BT_MAX_CONN=32 CONFIG_BT_DEVICE_NAME="perph_name" CONFIG_BT_PERIPHERAL=y CONFIG_BT_CONN=y
The application is working fine but I have a question. How to determine the connection which is connected to Central or Peripheral roles?
Because when an another device connect to my device, both Central and Peripheral Connected Callback is actived.
(Imported from Jira ZEP-2622)