|
现在是这样的,首先我手上拥有USB_Dongle+Nucleo Board以及自己设计的开发板(和USB_Dongle兼容),现在想使用USB_Dongle作为P2P_Client,其他两块板子分别为Sever1和Sever2。目前只能实现Client与其中任意一块链接,但不能实现多机的链接。 app_conf.h中配置如下, define CFG_MAX_CONNECTION 2define CFG_DEV_ID_P2P_SERVER1 (0x83)define CFG_DEV_ID_P2P_SERVER2 (0x84)app_ble.c如下: if (adlength >= 7 && adv_report_data[k + 2] == 0x01) { / ST VERSION ID 01 / APP_DBG_MSG("--- ST MANUFACTURER ID --- \n"); switch (adv_report_data[k + 3]) { / Demo ID / case CFG_DEV_ID_P2P_SERVER1: / End Device 1 / APP_DBG_MSG("-- SERVER DETECTED -- VIA MAN ID\n"); BleApplicationContext.DeviceServerFound = 0x01; SERVER_REMOTE_BDADDR[0] = le_advertising_event->Advertising_Report[0].Address[0]; SERVER_REMOTE_BDADDR[1] = le_advertising_event->Advertising_Report[0].Address[1]; SERVER_REMOTE_BDADDR[2] = le_advertising_event->Advertising_Report[0].Address[2]; SERVER_REMOTE_BDADDR[3] = le_advertising_event->Advertising_Report[0].Address[3]; SERVER_REMOTE_BDADDR[4] = le_advertising_event->Advertising_Report[0].Address[4]; SERVER_REMOTE_BDADDR[5] = le_advertising_event->Advertising_Report[0].Address[5]; break; case CFG_DEV_ID_P2P_SERVER2: / End Device 2 / APP_DBG_MSG("-- SERVER DETECTED -- VIA MAN ID\n"); BleApplicationContext.DeviceServerFound = 0x02; SERVER_REMOTE_BDADDR[0] = le_advertising_event->Advertising_Report[0].Address[0]; SERVER_REMOTE_BDADDR[1] = le_advertising_event->Advertising_Report[0].Address[1]; SERVER_REMOTE_BDADDR[2] = le_advertising_event->Advertising_Report[0].Address[2]; SERVER_REMOTE_BDADDR[3] = le_advertising_event->Advertising_Report[0].Address[3]; SERVER_REMOTE_BDADDR[4] = le_advertising_event->Advertising_Report[0].Address[4]; SERVER_REMOTE_BDADDR[5] = le_advertising_event->Advertising_Report[0].Address[5]; break; default: break; } |
。
看到了官方有相关的例程资料,参考一下哈