void IndoorLocalizationService::on_ble_event(ble_evt_t * p_ble_evt) {

	Service::on_ble_event(p_ble_evt);

	switch (p_ble_evt->header.evt_id) {
#if CHAR_RSSI==1
	case BLE_GAP_EVT_CONNECTED: {

#if (NORDIC_SDK_VERSION >= 11) || \
	(SOFTDEVICE_SERIES == 130 && SOFTDEVICE_MAJOR == 1 && SOFTDEVICE_MINOR == 0) || \
	(SOFTDEVICE_SERIES == 110 && SOFTDEVICE_MAJOR == 8)
		sd_ble_gap_rssi_start(p_ble_evt->evt.gap_evt.conn_handle, 0, 0);
#else
		sd_ble_gap_rssi_start(p_ble_evt->evt.gap_evt.conn_handle);
#endif
		break;
	}
	case BLE_GAP_EVT_DISCONNECTED: {
		sd_ble_gap_rssi_stop(p_ble_evt->evt.gap_evt.conn_handle);
		break;
	}
	case BLE_GAP_EVT_RSSI_CHANGED: {
		onRSSIChanged(p_ble_evt->evt.gap_evt.params.rssi_changed.rssi);
		break;
	}
#endif

	default: {
	}
	}
}
Ejemplo n.º 2
0
/*
uint32_t Get_Rssi(int8_t *p_rssi)
{
	return sd_ble_gap_rssi_get(m_conn_handle,p_rssi);
}
*/
void Get_Rssi_stop(void)
{
		  if(disp_str_rssi.LCD_disp_Rssi_flag==1)
		  {
       sd_ble_gap_rssi_stop(m_conn_handle);
			disp_str_rssi.LCD_disp_Rssi_flag=0;
#if (DEBUG_UART_EN)
			//DbgPrintf("Get_Rssi_stop\r\n");
#endif						 
      }
}
Ejemplo n.º 3
0
void StatusReporterModule::StopConnectionRSSIMeasurement(Connection* connection){
	u32 err = 0;

	if (connection->isConnected())
	{
		err = sd_ble_gap_rssi_stop(connection->connectionHandle);
		if(err == NRF_ERROR_INVALID_STATE || err == BLE_ERROR_INVALID_CONN_HANDLE){
			//Both errors are due to a disconnect and we can simply ignore them
		} else {
			APP_ERROR_CHECK(err); //OK
		}

		logt("STATUSMOD", "RSSI measurement stopped for connection %u with code %u", connection->connectionId, err);
	}
}
Ejemplo n.º 4
0
uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf,
                                  uint32_t              rx_buf_len,
                                  uint8_t * const       p_tx_buf,
                                  uint32_t * const      p_tx_buf_len)
{
   SER_ASSERT_NOT_NULL(p_rx_buf);
   SER_ASSERT_NOT_NULL(p_tx_buf);
   SER_ASSERT_NOT_NULL(p_tx_buf_len);

   uint32_t err_code = NRF_SUCCESS;
   uint32_t sd_err_code;

   uint16_t conn_handle;

   err_code = ble_gap_rssi_stop_req_dec(p_rx_buf, rx_buf_len, &conn_handle);
   SER_ASSERT(err_code == NRF_SUCCESS, err_code);

   sd_err_code = sd_ble_gap_rssi_stop(conn_handle);

   err_code = ble_gap_rssi_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
   SER_ASSERT(err_code == NRF_SUCCESS, err_code);

   return err_code;
}
void BLETransceiver::stopRSSIMeasure(void)
{
	sd_ble_gap_rssi_stop(u16_connHandle);
}