This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can I get rssi before I make a connection?

Hello ,

I can read the rssi value after the connection is established.

case BLE_GAP_EVT_CONNECTED:
            APPL_LOG("Connected to target\r\n");
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            
            m_ble_nus_c.conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
						
            // start discovery of services. The NUS Client waits for a discovery result
            err_code = ble_db_discovery_start(&m_ble_db_discovery, p_ble_evt->evt.gap_evt.conn_handle);
            APP_ERROR_CHECK(err_code);	

			sd_ble_gap_rssi_start(p_ble_evt->evt.gap_evt.conn_handle, 0 , 0);

            break;

Then I toggle LEDs according rssi value;

case BLE_GAP_EVT_RSSI_CHANGED:						 
						rssi_value = p_ble_evt->evt.gap_evt.params.rssi_changed.rssi;
						nrf_gpio_pin_clear(LED1);
						nrf_gpio_pin_clear(LED0);
				
						if(rssi_value<-64)
							nrf_gpio_pin_toggle(LED1);
						else if(rssi_value<-48)
							nrf_gpio_pin_toggle(LED0);
						
					break;

But I want to read the rssi value as in the NRFToolbox application before establishing a connection.

nrf_rssi.jpg

Parents Reply Children
No Data
Related