espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.51k stars 7.26k forks source link

bluetooth master-slave integration (IDFGH-1838) #4047

Closed xielizyh closed 3 years ago

xielizyh commented 5 years ago

Hello, I'm using BLE as master and slave simultaneouly based on examples "gatt_client" and "gatt_server". When a device is connected, a connect event will be generated to the “gattc_profile_event_handler” and “gatts_profile_event_handler” at the same time. My problem is how to distinguish whether the connected remote device is a master or a slave.

gengyuchao commented 5 years ago

The master connection substate can only be entered from the initiating state. A device that becomes a master must initiate the connection to the peer device. The slave connection substate can only be entered from the advertising state. A device that becomes a slave must have been advertising to the peer device.

xielizyh commented 5 years ago

Hi @gengyuchao Thanks for your reply. However, as for the master-slave integration, while connected successfully, it will lead to two connect events, I am still confused about whether the peer device is the master or the slave.

WCCWCC commented 4 years ago

Hi @xielizyh ,

Alvin1Zhang commented 3 years ago

Thanks for reporting, feel free to reopen.