Crate can_socket

Source
Expand description

CAN socket

This library exposes a CanSocket and related types, allowing you to communicate over a Controller Area Network (CAN) bus.

The is a standard blocking or non-blocking CanSocket, and an asynchronous tokio::CanSocket.

This library uses the SocketCAN interface and only works on Linux.

Supported features:

  • Bind sockets to specific interfaces by name or index.
  • Bind sockets to all CAN interfaces at the same time.
  • Send and receive data frames and RTR frames.
  • Send and receive standard frames and extended frames.
  • Setting per-socket filters.
  • Control over the loopback and recv_own_msgs options.
  • Constructing compile-time checked CAN IDs.

Modules§

error
Error types.
tokiotokio
Support for tokio.

Macros§

can_id
Construct an CanId (standard or extended) that is checked at compile time.
extended_id
Construct an ExtendedId that is checked at compile time.
standard_id
Construct a StandardId that is checked at compile time.

Structs§

CanData
The data payload of a CAN frame.
CanFilter
A CAN filter.
CanFrame
A CAN frame as transmitted over a CAN socket.
CanInterface
A CAN interface identified by its index.
CanSocket
A synchronous CAN socket.
ExtendedId
An extended 29 bit CAN ID.
StandardId
A standard 11 bit CAN ID.

Enums§

CanId
A CAN ID, either standard (11 bit) or extended (29 bits).

Constants§

MAX_EXTENDED_ID
The highest valid value for an extended CAN ID.
MAX_STANDARD_ID
The highest valid value for a standard CAN ID.

Traits§

Deadline
Trait for types that can be used as a timeout or deadline.