Is there a way to create a command that gets throughput information from a device in the ble_app_interactive example? I want to get the throughput of a peripheral device once it is connected.
Is there a way to create a command that gets throughput information from a device in the ble_app_interactive example? I want to get the throughput of a peripheral device once it is connected.
Hello Ella;
Could you please tell me how can you measure the throughput and rssi at the same time, I have tried for sereval days to do this but failed,
I just use the SEGGER open the project as below, this project can do throughput test
then I put the code below (I find them on the Internet) in to the main.c
bu it doesn't work, no rssi data was printed
Maybe you've done it already but the on_ble_evt() function needs to be registered as an observer like nrf_ble_amtc_on_ble_evt and nrf_ble_amts_on_ble_evt in order for it to receive events from the Softdevice Another alternative is to use the existing BLE event handler in amts.c.
E.g., A simple approach. Print RSSI every time it changes with more than 10dB:
diff --git a/examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/amts.c b/examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/amts.c index 3810e21..bb3b250 100644 --- a/examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/amts.c +++ b/examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/amts.c @@ -66,7 +66,12 @@ static void char_notification_send(nrf_ble_amts_t * p_ctx); */ static void on_connect(nrf_ble_amts_t * p_ctx, ble_evt_t const * p_ble_evt) { + uint32_t err_code; + + err_code = sd_ble_gap_rssi_start(p_ble_evt->evt.gap_evt.conn_handle, 10, 0); + APP_ERROR_CHECK(err_code); p_ctx->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + } @@ -145,6 +150,10 @@ void nrf_ble_amts_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context) on_tx_complete(p_ctx); break; + case BLE_GAP_EVT_RSSI_CHANGED: + NRF_LOG_INFO("RSSI: %d", p_ble_evt->evt.gap_evt.params.rssi_changed.rssi); + break; + default: break; }
Thanks very much, I finally get the RSSI successfully .