IPC Module - CAN Service

This page contains documentation of the CAN API.

The IPC API controls the physical interfaces. Data is sent using [SocketCAN](https://www.kernel.org/doc/Documentation/networking/can.txt) interfaces (canX).

Messages

message can_request_req
Parameters:
  • user (string) – User identifier, max 15 characters long.

  • index (uint8) – Index of the requested interface

Return message:

can_request_rsp

Request a CAN interface.

The interface will not be turned on if it’s not configured.

message can_request_rsp
Parameters:
  • result (enum can_result) – Result of the operation

  • index (uint8) – Index of the requested interface

CAN interface request result.

message can_release_req
Parameters:
  • user (string) – User identifier, max 15 characters long.

  • index (uint8) – Index of the requested interface

Return message:

can_release_rsp

Release a CAN interface.

message can_release_rsp
Parameters:
  • result (enum can_result) – Result of the operation

  • index (uint8) – Index of the requested interface

CAN interface release result.

message can_configure_req
Parameters:
Return message:

can_configure_rsp

Request to configure a CAN interface.

If any user has requested the interface prior to configuration, this call will also turn it on. The result is received in a can_configure_rsp message.

message can_configure_rsp
Parameters:
  • result (enum can_result) – Result of the operation

  • index (uint8) – Index of the requested interface

Sent in response to can_configure_req message.

message can_status_req
Parameters:

index (uint8) – Index of the requested interface

Return message:

can_status_rsp

Check the state of the CAN interface.

message can_status_rsp
Parameters:

CAN interface state.

message can_set_wakeup_req
Parameters:
  • index (uint8) – Index of the requested interface

  • state (uint8) – 0: Disable, 1: Enable

Return message:

can_set_wakeup_rsp

CAN wakeup configuration.

message can_set_wakeup_rsp
Parameters:
  • index (uint8) – Index of the requested interface

  • result (enum can_result) – Result of the operation

Sent in response to can_set_wakeup_req message.

message can_reset_req
Parameters:

index (uint8) – Index of the requested interface

Return message:

can_reset_rsp

CAN reset request.

Resets the CAN interface from e.g. BUS OFF.

message can_reset_rsp
Parameters:

result (enum can_result) – Result of the operation

Sent in response to can_reset_req message.

message can_set_listen_only_req
Parameters:
  • index (uint8) – Index of the requested interface

  • mode (uint8) – listen mode on or off

Return message:

can_set_listen_only_rsp

CAN listen only request.

Sets the CAN interface to listen only mode e.g for autobaud implementation.

message can_set_listen_only_rsp
Parameters:

result (enum can_result) – Result of the operation

Sent in response to can_set_listen_only_req message.

Enums

enum can_result

Result codes.

Constant

Value

Description

OK

0

No error

INVALID_INTERFACE

1

The specified interface does not exist

UNSUPPORTED_NOMINAL_BITRATE

2

The specified nominal bitrate is not supported

UNSUPPORTED_DATA_BITRATE

3

The specified data bitrate is not supported

UNSUPPORTED_TYPE

4

The specified type is not supported

INTERFACE_NOT_PROCURED

5

The interface was not connected with the supplied user

UNSUPPORTED_WAKEUP_SOURCE

6

The specified interface does not support wakeup

UNKNOWN_ERROR

7

Unknown error

enum can_type

CAN types.

Constant

Value

Description

CAN_2_0_B

0

CAN 2.0B

CAN_FD

1

CAN FD

enum can_nominal_bitrate

CAN nominal bitrates.

Constant

Value

Description

RATE_125000

0

125000

RATE_250000

1

250000

RATE_500000

2

500000

RATE_1000000

3

1000000

enum can_data_bitrate

CAN data bitrates.

Constant

Value

Description

RATE_1000000

0

1000000

RATE_2000000

1

2000000

RATE_3000000

2

3000000

RATE_4000000

3

4000000

RATE_5000000

4

5000000

enum can_state

CAN interface states.

Constant

Value

Description

ERROR_ACTIVE

0

ERROR_WARNING

1

ERROR_PASSIVE

2

BUS_OFF

3

STOPPED

4

SLEEPING

5