Concurrent command execution
Leapscom is designed to run either TLV (Type-Length-Value) commands or shell commands over a selected interface on target devices. This is useful for managing and testing LEAPS subsystem devices concurrently.
TLV commands
- --tlv TLV_COMMAND [TLV_COMMAND ...]
List of TLV commands as hexadecimal string. See list of supported TLV commands.
For example, to execute a following sequence of commands for all devices that are connected on the USB interface:
Configure as TAGs (leaps_cfg_tag_set)
Apply the configuration by resetting the devices (leaps_reset)
Blink all LEDs (leaps_blink_leds)
Use following:
$ python3 -m leapscom --usb --tlv 0503720402 1400 2000
Shell commands
- --shell SHELL_COMMAND [SHELL_COMMAND ...]
List of shell commands. See list of supported Shell commands.
For example, to execute a following sequence of commands for all devices that are connected
on serial port as serial device /dev/ttyACM0
and /dev/ttyACM1
:
use following:
$ python3 -m leapscom --dev /dev/ttyACM0 /dev/ttyACM1 --shell 'nis 1234' 'tcs ble 1 uwb 2 leds 1' reset --verbose
Use verbose output if you want to see the details and the response to the shell command.
Retries on Failure
If a command fails (e.g., due to a timeout or no response), Leapscom can automatically retry the command a specified number of times to increases reliability when working with unstable connections or devices under test.
- -a, --attempts NUMBER
Maximum number of attempts in case of a failed command.
Custom Timeout Support
Users can specify a timeout duration for each command. If the command does not complete or return a response within the timeout window, it will be considered failed, triggering a retry if configured.
- -t, --timeout SECONDS
Timeout in seconds, e.g.: 0.5.
Supported Interfaces
Leapscom is designed to operate concurrently, enabling efficient command execution on multiple devices at the same time. Commands are sent over a user-specified interface (e.g., USB, BLE, serial ports).
- -u, --usb [SERIAL_NUMBER ...]
List of USB serial numbers. If no serial number is given, all available LEAPS devices are used.
- -b, --ble [MAC_ADDRESS ...]
List of BLE MAC addresses. If no address is given, all scanned LEAPS devices are used.
- -d, --dev [SERIAL_DEVICE ...]
List of serial devices. It can be tty device on Linux and MAC or COM port on Windows.
Commands can be executed in two ways:
- Broadcast to all connected devices
The command is sent to every device currently connected to the system or network. This is useful when the same action needs to be performed universally (e.g., syncing time, applying a global configuration).
- Targeted to specific devices
The command is sent only to explicitly specified devices. This allows for granular control, enabling you to apply actions to a subset of devices based on criteria like device ID, group, or type.
Discovering devices
You can list all available LEAPS devices connected to your PC on the USB or serial port or scan for all available devices that are advertising on the BLE interface using the command:
$ python3 -m leapscom --lsusb
Leaps USB devices with ID 1915:e8e3:
1.[630D46F2D51482FC] address 74 on bus 1, Label: "ID0A97"
2.[7E1C5859C2ECF343] address 73 on bus 1, Label: "ID5606"
3.[EACD147C04DD6BA8] address 75 on bus 1, Label: "IDD220"
4.[2FB14F372E0341A6] address 72 on bus 1, Label: "ID4C15"
Make sure that BLE is enabled on the device (see leaps_cfg_get).
$ python3 -m leapscom --lsble
Scanning for BLE devices, please wait...
1.[FE:40:B4:BC:D3:42] - AdvertisementData(local_name='LEAPSDECAECC259555606', service_data={'680c21d9-c946-4c1f-9c11-baa1c21329e7': b'4\x12\x06V\x02A\xff\x00\x00'}, rssi=-56)
2.[E0:05:86:49:A9:40] - AdvertisementData(local_name='LEAPSDECA14D5F2450A97', service_data={'680c21d9-c946-4c1f-9c11-baa1c21329e7': b'\x00\x00\x97\n\x01[\xff\x00\x00'}, rssi=-61)
3.[EF:7E:7A:E3:38:B6] - AdvertisementData(local_name='LEAPSDECA032E37404C15', service_data={'680c21d9-c946-4c1f-9c11-baa1c21329e7': b'4\x12\x15L\x02\xc9\xff\x00\x00'}, rssi=-62)
4.[D3:B6:82:62:5F:06] - AdvertisementData(local_name='LEAPSDECADD047C15D220', service_data={'680c21d9-c946-4c1f-9c11-baa1c21329e7': b'4\x12 \xd2\x02U\xff\x00\x00'}, rssi=-64)
$ python3 -m leapscom --lsdev
Leaps serial ports:
1. ttyACM6 - DAPLink CMSIS-DAP - mbed Serial Port, Label: "ID93A6"
2. ttyACM5 - DAPLink CMSIS-DAP - mbed Serial Port, Label: "IDC485"
3. ttyACM4 - DAPLink CMSIS-DAP - mbed Serial Port, Label: "ID1391"
Configuration file
To run list of commands from configuration file:
- -c, --cfg YAML_FILE
YAML configuration file that contains definition of the command sequence.
Example configuration file: configure-tags.yaml:
# configure device as TAG, set node ID to 0xABCD and reset
tlv:
- cmd: '0503720402' # TLV command - 'cfg_tag_set'
timeout: 2.5
attempts 3
- cmd: '2e02cdab' # TLV command - 'panid_set`
- cmd: '14 00' # TLV command - 'reset'
tlv.cmd: See section TLV commands.
tlv.cmd.timeout: See section Custom Timeout Support.
tlv.cmd.attempts: See section Retries on Failure.
To execute commands defined in the configuration file use for example:
$ python3 -m leapscom --usb --cfg configure-tags.yaml
Possible configuration file using shell commands:
# See information about the device, then configure as TAG and reset
shell:
- cmd: si # SHELL command 'si'
- cmd: ut # SHELL command 'ut'
- cmd: acs leds 1 ble 1 # SHELL command 'tcs' set LEDs ON and BLE ON
timeout: 3.0 # delay 2 seconds after the command
attempts 5
- cmd: reset # SHELL command 'reset'
timeout: 5.0
shell.cmd: See section Shell commands.
shell.cmd.timeout: See section Custom Timeout Support.
shell.cmd.attempts: See section Retries on Failure.
To execute commands defined in the configuration file and see the verbose output:
$ python3 -m leapscom --usb --cfg configure-tags.yaml -v
Verbose output need to be enabled to display output to the shell commands.