cansend: Send CAN Message

This command cansend can be used to send CAN messages via the device.

Synopsis

Usage: ./cansend [options] id
Client app connecting to ‘Black-Box’ device for test purposes.
Options:
-h, --help

Displays help on commandline options.

--help-all

Displays help, including generic Qt options.

-v, --version

Displays version information.

-a, --address <host>

Host address of the gateway [localhost].

-p, --port <port>

Port of the gateway [51955].

--debug

Report additional debug info in log.

-f, --frequency <period>

Frequency (period) of sending in ms [1000]

-s, --severity <level>

Max severity (fatal|error|warning|info|debug|verbose) of log message.

-e, --extended

Use extended format of CAN messages.

--value <value>

Single payload value(s) (8 bit)

Arguments:

id CAN identifier of the message.

Examples

Single Payload Mode

In this mode, a message with the corresponding content is sent via the connected CAN bus by specifying the parameter --value once or several times. Using ./cansend -a blackbox2 -s info --value 190 --value 239 1600 a single CAN message with identifier 1600 and a payload of two bytes 190, 239 is sent out.

../_images/can100kbaud_send_1600.png

In this example the message with the id 0x640 is sent once.

2024-06-10 13:22:33.110 NONE  Press Ctrl-C to abort application.
2024-06-10 13:22:33.110 INFO  CAN-Send with id '0x640' non-interactive mode
2024-06-10 13:22:33.330 INFO  Client is connected...
2024-06-10 13:22:33.332 INFO  Session identifier 3, protocol version 0

Interactive Mode

If the parameter --value is not specified, the application switches to interactive mode, e.g. using ./cansend -a blackbox2 -s info 1600. The user can enter up to 8 individual 8-bit values, separated by spaces, via the console. After entering the return key, a single CAN message with identifier 1600 is generated and sent.

../_images/can100kbaud_send_manual.png

A messages with the payload 11 22 33 44 (0x0b 0x16 0x21 0x2c) was sent.

2024-06-10 13:23:56.671 NONE  Press Ctrl-C to abort application.
2024-06-10 13:23:56.672 INFO  CAN-Send with id '0x640' interactive mode
2024-06-10 13:23:56.755 INFO  Client is connected...
2024-06-10 13:23:56.757 INFO  Session identifier 4, protocol version 0
11 22 33 44