mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[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:
@@ -2579,12 +2579,13 @@ class OTCI(object):
|
||||
"""Stop transmitting a stream of characters."""
|
||||
self.execute_command('diag stream stop')
|
||||
|
||||
def diag_send(self, packets: int, length: Optional[int] = None):
|
||||
def diag_send(self, packets: int, length: Optional[int] = None, is_async: bool = True):
|
||||
"""Transmit a fixed number of packets."""
|
||||
if length is None:
|
||||
command = f'diag send {packets}'
|
||||
else:
|
||||
command = f'diag send {packets} {length}'
|
||||
command = 'diag send '
|
||||
command += 'async ' if is_async else ''
|
||||
command += f'{packets} '
|
||||
command += f'{length}' if length is not None else ''
|
||||
|
||||
self.execute_command(command)
|
||||
|
||||
def diag_repeat(self, delay: int, length: Optional[int] = None):
|
||||
|
||||
Reference in New Issue
Block a user