canreceive: Receive CAN message

This canreceive command can be used to periodically query one or more CAN messages.

Note

In order to receive specific CAN messages the filter must be set using systemset.

Synopsis

Usage: ./canreceive [options] id
Client app connecting to ‘Black-Box’ device for test purposes.
-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.

-c, --changes-only

Output payload on changes only.

Arguments:

id CAN identifier(s) of the message.

Examples

../_images/can100kbaud_666_676.png

In this example two messages with the id 0x666 and 0x676 are send periodically.

In the example, two messages are sent with a period of 500ms (0x676) and 1000ms (0x666) respectively.

Periodically Read CAN Messages

Using ./canreceive -a blackbox2 -s info 1638 1654 the messages are polled with a period of 1s.

2024-06-09 20:57:32.221 NONE  Press Ctrl-C to abort application.
2024-06-09 20:57:32.263 INFO  Client is connected...
2024-06-09 20:57:32.269 INFO  Session identifier 17, protocol version 0
2024-06-09 20:57:32.278 INFO  Client is connected...
2024-06-09 20:57:32.286 INFO  Session identifier 18, protocol version 0
2024-06-09 20:57:32.286 INFO  CAN-Receive with 2 id(s) every 1000 ms
2024-06-09 20:57:32.298 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=8556
2024-06-09 20:57:32.299 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=17113
2024-06-09 20:57:33.298 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=8557
2024-06-09 20:57:33.298 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=17115
2024-06-09 20:57:34.300 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=8558
2024-06-09 20:57:34.300 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=17117
2024-06-09 20:57:35.294 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=8559
2024-06-09 20:57:35.294 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=17119
2024-06-09 20:57:36.296 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=8560
2024-06-09 20:57:36.297 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=17121
2024-06-09 20:57:37.295 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=8561
2024-06-09 20:57:37.296 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=17123
2024-06-09 20:57:38.294 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=8562
2024-06-09 20:57:38.296 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=17125
2024-06-09 20:57:39.300 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=8563
2024-06-09 20:57:39.300 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=17127

In addition to the content of the message, a counter value is output to the console. This indicates how many (identical as well as different) messages with a specific identifier were received by The-Black-Box. This makes it possible to determine whether messages have not been read and overwritten on the server side. The parameter -f|--frequency can be used to adjust the polling frequency accordingly.

In the second example ./canreceive -a blackbox2 -s info --changes-only 1638 1654 273, the message with the identifier 273 is also sent periodically. By specifying the parameter --changes-only, the content of the message is only output if it has changed.

2024-06-09 21:12:04.977 NONE  Press Ctrl-C to abort application.
2024-06-09 21:12:04.992 INFO  Client is connected...
2024-06-09 21:12:04.998 INFO  Session identifier 36, protocol version 0
2024-06-09 21:12:05.005 INFO  Client is connected...
2024-06-09 21:12:05.011 INFO  Session identifier 37, protocol version 0
2024-06-09 21:12:05.016 INFO  Client is connected...
2024-06-09 21:12:05.020 INFO  Session identifier 38, protocol version 0
2024-06-09 21:12:05.020 INFO  CAN-Receive with 3 id(s) every 1000 ms
2024-06-09 21:12:05.020 INFO  Output only on changes of the message payload!
2024-06-09 21:12:05.027 INFO  273|0x0111 0xff , count=108
2024-06-09 21:12:05.027 INFO  1638|0x0666 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 , count=98
2024-06-09 21:12:05.028 INFO  1654|0x0676 0xde 0xad 0xbe 0xef , count=196
2024-06-09 21:12:36.031 INFO  273|0x0111 0xaa , count=129