Hello i read RSSI in beacon_evt_handler() hrs_scanner project:
printf("RSSI: %d\n\n\n",p_evt->rcv_adv_packet.adv_data.rssi);
but he show me a wrong value of RSSI: 4539
how i can fix this??
Best Regards
Nelson
Hello i read RSSI in beacon_evt_handler() hrs_scanner project:
printf("RSSI: %d\n\n\n",p_evt->rcv_adv_packet.adv_data.rssi);
but he show me a wrong value of RSSI: 4539
how i can fix this??
Best Regards
Nelson
Hi,
Yes, this value is indeed constant. This is the RSSI value of the beacon measured at 1 meter distance, which can be used for estimating the distance from the beacon. It's a constant value set together with the major, minor and the company id.
If you need the measured RSSI from the beacon, you can get this information in e.g. the function app_beacon_scanner_on_ble_evt()
in scanner_beacon.c
. Change it to something like this:
void app_beacon_scanner_on_ble_evt(ble_evt_t * p_ble_evt)
{
if (p_ble_evt->header.evt_id == BLE_GAP_EVT_ADV_REPORT)
{
ble_scan_beacon_evt_t evt;
printf("RSSI: %d\n",p_ble_evt->evt.gap_evt.params.adv_report.rssi);
uint32_t err_code = decode_advertising(p_ble_evt->evt.gap_evt.params.adv_report.data, p_ble_evt->evt.gap_evt.params.adv_report.dlen, &evt.rcv_adv_packet);
if (err_code == NRF_SUCCESS)
{
if (m_beacon_scanner.evt_handler != NULL)
{
evt.evt_type = BLE_SCAN_BEACON_ADVERTISER_FOUND;
m_beacon_scanner.evt_handler(&evt);
}
}
}
}
You can also add this to the on_ble_evt()
in main.c
, add the case BLE_GAP_EVT_ADV_REPORT
to the switch-statement, and get the rssi when you get the BLE_GAP_EVT_ADV_REPORT
.
Hi,
Yes, this value is indeed constant. This is the RSSI value of the beacon measured at 1 meter distance, which can be used for estimating the distance from the beacon. It's a constant value set together with the major, minor and the company id.
If you need the measured RSSI from the beacon, you can get this information in e.g. the function app_beacon_scanner_on_ble_evt()
in scanner_beacon.c
. Change it to something like this:
void app_beacon_scanner_on_ble_evt(ble_evt_t * p_ble_evt)
{
if (p_ble_evt->header.evt_id == BLE_GAP_EVT_ADV_REPORT)
{
ble_scan_beacon_evt_t evt;
printf("RSSI: %d\n",p_ble_evt->evt.gap_evt.params.adv_report.rssi);
uint32_t err_code = decode_advertising(p_ble_evt->evt.gap_evt.params.adv_report.data, p_ble_evt->evt.gap_evt.params.adv_report.dlen, &evt.rcv_adv_packet);
if (err_code == NRF_SUCCESS)
{
if (m_beacon_scanner.evt_handler != NULL)
{
evt.evt_type = BLE_SCAN_BEACON_ADVERTISER_FOUND;
m_beacon_scanner.evt_handler(&evt);
}
}
}
}
You can also add this to the on_ble_evt()
in main.c
, add the case BLE_GAP_EVT_ADV_REPORT
to the switch-statement, and get the rssi when you get the BLE_GAP_EVT_ADV_REPORT
.