|
|
发表于 2024-11-26 14:38:24
|
显示全部楼层
来自 上海
可以在BLE ACL断开回调使用API dev_char_get_conn_role_by_connhandle(u16 connhandle) 查询当前连接的角色。
int app_disconnect_event_handle(u8 *p)
{
event_disconnection_t *pCon = (event_disconnection_t *)p;
u8 role = dev_char_get_conn_role_by_connhandle (pCon->connHandle);
if(role == LL_ROLE_MASTER){
//The local device is the central, the peer is the B device (peripheral)
}
else if(role == LL_ROLE_SLAVE){
//The local device is peripheral, the peer is device A (central)
}
else{
//no connection match
}
...
} |
|