Driver for SLCAN-compatible CAN bus adapters, with extension to support CLI commands.
Some info on SLCAN can be found here:
- Linux tree: drivers/net/can/slcan.c (http://lxr.free-electrons.com/source/drivers/net/can/slcan.c)
- https://files.zubax.com/docs/Generic_SLCAN_API.pdf
- http://www.can232.com/docs/canusb_manual.pdf
- http://www.fischl.de/usbtin/
The CLI extension allows to execute arbitrary CLI commands on the adapter. The commands differ from regular SLCAN
exchange in the following ways:
- CLI commands are echoed back.
- Every output line of a CLI command, including echo, is terminated with CR LF (\r\n).
- After the last line follows the ASCII End Of Text character (ETX, ^C, ASCII code 0x03) on a separate
line (terminated with CR LF).
- CLI commands must not begin with whitespace characters.
Example:
Input command "stat\r\n" may produce the following output lines:
- Echo: "stat\r\n"
- Data: "First line\r\n", "Second line\r\n", ...
- End Of Text marker: "\x03\r\n"
Refer to https://kb.zubax.com for more info.
Definition at line 588 of file slcan.py.
| def pyuavcan_v0.driver.slcan.SLCAN.execute_cli_command |
( |
|
self, |
|
|
|
command, |
|
|
|
callback, |
|
|
|
timeout = None |
|
) |
| |
Executes an arbitrary CLI command on the SLCAN adapter, assuming that the adapter supports CLI commands.
The callback will be invoked from the method receive() using same thread.
If the command times out, the callback will be invoked anyway, with 'expired' flag set.
Args:
command: Command as unicode string or bytes
callback: A callable that accepts one argument.
The argument is an instance of IPCCommandLineExecutionResponse
timeout: Timeout in seconds. None to use default timeout.
Definition at line 778 of file slcan.py.