btshell: Add information to ongoing test-tx and test-tx stop

This commit is contained in:
Łukasz Rymanowski
2019-01-31 17:14:46 +01:00
parent 3d5971076e
commit 4cfe3260ba
3 changed files with 27 additions and 0 deletions
+1
View File
@@ -164,6 +164,7 @@ int btshell_sec_restart(uint16_t conn_handle, uint8_t *ltk, uint16_t ediv,
uint64_t rand_val, int auth);
int btshell_tx_start(uint16_t conn_handle, uint16_t len, uint16_t rate,
uint16_t num);
void btshell_tx_stop(void);
int btshell_rssi(uint16_t conn_handle, int8_t *out_rssi);
int btshell_l2cap_create_srv(uint16_t psm, int accept_response);
int btshell_l2cap_connect(uint16_t conn, uint16_t psm);
+13
View File
@@ -2957,12 +2957,24 @@ cmd_test_tx(int argc, char **argv)
uint16_t len;
uint16_t rate;
uint16_t num;
uint8_t stop;
rc = parse_arg_all(argc - 1, argv + 1);
if (rc != 0) {
return rc;
}
stop = parse_arg_uint8_dflt("stop", 0, &rc);
if (rc != 0) {
console_printf("invalid 'stop' parameter\n");
return rc;
}
if (stop) {
btshell_tx_stop();
return 0;
}
conn = parse_arg_uint16("conn", &rc);
if (rc != 0) {
console_printf("invalid 'conn' parameter\n");
@@ -3000,6 +3012,7 @@ static const struct shell_param test_tx_params[] = {
{"length", "size of packet, usage: =<UINT16>"},
{"rate", "rate of tx, usage: =<UINT16>, default=1"},
{"num", "number of packets, usage: =<UINT16>, default=1"},
{"stop", "stop sending, usage: 1 to stop, default 0"},
{NULL, NULL}
};
+13
View File
@@ -110,6 +110,7 @@ static struct os_callout btshell_tx_timer;
struct btshell_tx_data_s
{
uint16_t tx_num;
uint16_t tx_num_requested;
uint16_t tx_rate;
uint16_t tx_conn_handle;
uint16_t tx_len;
@@ -1240,6 +1241,10 @@ btshell_tx_timer_cb(struct os_event *ev)
return;
}
console_printf("Sending %d/%d len: %d\n",
btshell_tx_data.tx_num_requested - btshell_tx_data.tx_num + 1,
btshell_tx_data.tx_num_requested, btshell_tx_data.tx_len);
len = btshell_tx_data.tx_len;
om = NULL;
@@ -1827,6 +1832,7 @@ btshell_tx_start(uint16_t conn_handle, uint16_t len, uint16_t rate, uint16_t num
}
btshell_tx_data.tx_num = num;
btshell_tx_data.tx_num_requested = num;
btshell_tx_data.tx_rate = rate;
btshell_tx_data.tx_len = len;
btshell_tx_data.tx_conn_handle = conn_handle;
@@ -1846,6 +1852,13 @@ btshell_tx_start(uint16_t conn_handle, uint16_t len, uint16_t rate, uint16_t num
return 0;
}
void
btshell_tx_stop(void)
{
os_callout_stop(&btshell_tx_timer);
btshell_tx_data.tx_num = 0;
}
int
btshell_rssi(uint16_t conn_handle, int8_t *out_rssi)
{