How to make a BLE obscerver
I try to make an obscerver with a p-nucleo-wb55 that scan the surounding and give the adress id and the RSSI.
I used the project P2P client as a base and add some codes :
In the app.ble.c file
in the SVCCTL_App_Notification function
i add in the case HCI_LE_ADVERTISING_REPORT_SUBEVT_CODE , the following code
adv_report_data = (uint8_t*)(&le_advertising_event->Advertising_Report[0].Length_Data) + 1;
k = 0;
/* search AD TYPE 0x09 (Complete Local Name) */
/* search AD Type 0x02 (16 bits UUIDS) */
if (event_type == ADV_IND)
{
int8_t RSSI;
RSSI = (int8_t)*(uint8_t*) (adv_report_data + le_advertising_event->Advertising_Report[0].Length_Data);
printf(" MAC : %02x:%02x:%02x:%02x:%02x:%02x"
,le_advertising_event->Advertising_Report[0].Address[5]
,le_advertising_event->Advertising_Report[0].Address[4]
,le_advertising_event->Advertising_Report[0].Address[3]
,le_advertising_event->Advertising_Report[0].Address[2]
,le_advertising_event->Advertising_Report[0].Address[1]
,le_advertising_event->Advertising_Report[0].Address[0]);
printf("RSSI= %d\n",RSSI);
}
but i have no idea if it's working or not because there is no print in the debug mode
