I use nrf51822 sdk130 (central device) and nrf51822 sdk110(peripheral device). I want to get rssi value of the peripheral device using the central device without connection. Is it possible to read rssi value of peripheral device without connection?
I use nrf51822 sdk130 (central device) and nrf51822 sdk110(peripheral device). I want to get rssi value of the peripheral device using the central device without connection. Is it possible to read rssi value of peripheral device without connection?
Sure, each scanning event (when you receive ADV_xxx packet) has RSSI value in the event data structure.
It automatically connects to the peripheral device when it enters the on_ble_evt function. But I do not want that. I want to read rssi value without entering the peripheral device.Normally, when I press the button, it enters "button_handler" function. Then it use "sd_ble_gap_scan_start(&m_scan_params);" function. After that ,Function for handling the Application's BLE Stack events start automatically(on_ble_evt). Finally connection establihes. But I just want to learn rssi value of peripheral device,nothing else. Can you write some method or function to do that?
You probably deal with some specific FW code or example which I won't help you with but the procedure you are describing is scanning. See following chapter in Infocenter, there is sd_ble_gap_scan_start() function which should cause BLE_GAP_EVT_ADV_REPORT events coming and as you can see in event data you can locate RSSI measured.
I try to read rssi like adc_value. I want to keep watching. I have two buttons. I just want to use first button manually. So try to connect every time I press it. When I press the second button(I only pressed the second button once), Central device always search peripheral device and it always try to connect automatically if the rssi value is at a certain level. (Connect to the peripheral device without pressing the button.)
scan_start function ;
static void scan_start(void)
{
uint32_t err_code;
err_code = sd_ble_gap_scan_start(&m_scan_params);
APP_ERROR_CHECK(err_code);
err_code = bsp_indication_set(BSP_INDICATE_SCANNING);
APP_ERROR_CHECK(err_code);
}
Yes, this will start the scanning, now you just need to handle incoming events. Good luck!