Simple question:
Is possible a central to evaluate RSSI before connecting to a peripheral?
The idea is to make central device connect and bond to a peripheral only if a determined RSSI is achieved.
Cheers
Fávero
Simple question:
Is possible a central to evaluate RSSI before connecting to a peripheral?
The idea is to make central device connect and bond to a peripheral only if a determined RSSI is achieved.
Cheers
Fávero
See the scanning section of the BLE Central Tutorial.
In most SDK examples you will have the following function handling BLE events:
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
uint32_t err_code;
const ble_gap_evt_t * p_gap_evt = &p_ble_evt->evt.gap_evt;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_ADV_REPORT:
{
const ble_gap_evt_adv_report_t *p_adv_report = &p_gap_evt->params.adv_report;
The p_adv_report contains all the received advertisement data. You will find the rssi at p_adv_report->rssi.
See the documentation on the type ble_gap_evt_adv_report_t
See the scanning section of the BLE Central Tutorial.
In most SDK examples you will have the following function handling BLE events:
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
uint32_t err_code;
const ble_gap_evt_t * p_gap_evt = &p_ble_evt->evt.gap_evt;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_ADV_REPORT:
{
const ble_gap_evt_adv_report_t *p_adv_report = &p_gap_evt->params.adv_report;
The p_adv_report contains all the received advertisement data. You will find the rssi at p_adv_report->rssi.
See the documentation on the type ble_gap_evt_adv_report_t
Thanks!
When does the RSSI is updated? Everytime on_ble_evt is called?
Every time you get a new BLE_GAP_EVT_ADV_REPORT event