[diag] count the number of packets that are sent succeed and failed (#11108)

When using the `diag frame -c xxxx` command to enable the CSMA-CA when
transmitting the frame, the command `diag send` won't output any message
the CCA failure happens. It is difficult for users to know whether
the CSMA-CA is actually effective via diag commands.

This commit counts the number of packets that are sent succeed and failed,
outputs the transmision failure reason and do not re-transmit the frame
after it fails to send.
This commit is contained in:
Zhanglong Xia
2025-01-03 16:44:02 -08:00
committed by GitHub
parent 0e7039599c
commit 173cb61379
7 changed files with 80 additions and 37 deletions
+12 -3
View File
@@ -68,7 +68,10 @@ sleep 2
send "diag stats\n"
expect "received packets: 0"
expect "sent packets: 10"
expect "sent success packets: 10"
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"
@@ -77,7 +80,10 @@ switch_node 1
send "diag stats\n"
expect "received packets: 10"
expect "sent packets: 0"
expect "sent success packets: 0"
expect "sent error cca packets: 0"
expect "sent error abort packets: 0"
expect "sent error others packets: 0"
expect "first received packet: rssi=-20, lqi=0"
expect "last received packet: rssi=-20, lqi=0"
expect_line "Done"
@@ -100,7 +106,10 @@ switch_node 1
send "diag stats\n"
expect -r {received packets: \d+}
expect "sent packets: 0"
expect "sent success packets: 0"
expect "sent error cca packets: 0"
expect "sent error abort packets: 0"
expect "sent error others packets: 0"
expect "first received packet: rssi=-20, lqi=0"
expect "last received packet: rssi=-20, lqi=0"
expect_line "Done"