[diag] add diag send async command support (#11111)

The original `diag send` command is an asynchronous command. Users
must wait for a certain period of time and then run the `diag stats`
command to query how many packets have been sent to know whether all
packets have been sent. This is very inefficient, and it is not
convenient for scripts to process this command.

This commit changes the command `diag send` from an asynchronous
command to a synchronous command, and add the asynchronous command
`diag send async`.
This commit is contained in:
Zhanglong Xia
2025-01-08 11:21:13 -08:00
committed by GitHub
parent 9942b98a4a
commit 70d315af23
5 changed files with 64 additions and 14 deletions
+19 -3
View File
@@ -57,8 +57,6 @@ expect_line "Done"
send "diag send 10 100\n"
expect_line "Done"
sleep 2
send "diag stats\n"
expect "received packets: 0"
expect "sent success packets: 10"
@@ -69,10 +67,25 @@ expect "first received packet: rssi=0, lqi=0"
expect "last received packet: rssi=0, lqi=0"
expect_line "Done"
send "diag send async 10 100\n"
expect_line "Done"
sleep 2
send "diag stats\n"
expect "received packets: 0"
expect "sent success packets: 20"
expect "sent error cca packets: 0"
expect "sent error abort packets: 0"
expect "sent error others packets: 0"
expect "first received packet: rssi=0, lqi=0"
expect "last received packet: rssi=0, lqi=0"
expect_line "Done"
switch_node 1
send "diag stats\n"
expect "received packets: 10"
expect "received packets: 20"
expect "sent success packets: 0"
expect "sent error cca packets: 0"
expect "sent error abort packets: 0"
@@ -139,6 +152,9 @@ expect "Done"
send "diag repeat 1\n"
expect "Done"
send "diag repeat stop\n"
expect "Done"
send_user "send frame with security processed\n"
send "diag frame -s 112233\n"
expect "Done"