Skip to main content

Module can_bus

Module can_bus 

Source
Expand description

The C ABI for a node on a CAN bus.

A node is a SocketCAN socket on a kernel interface such as can0, on a Linux board, or a node on a bus simulated inside the program. pamoja_can_bus_join puts another node on the same bus, and a node hears every frame the others send and none of its own. Frames cross as the PamojaCanFrame handles of the framing calls; a filter is only scalars, so it crosses by value as PamojaCanFilter.

A receive on a simulated bus never waits: with nothing there it returns at once and counts its timeout in pamoja_can_bus_waited_micros.

Structs§

PamojaCanBus
A node on a CAN bus. Opaque; release it with pamoja_can_bus_free.
PamojaCanFilter
A frame a node keeps: one whose identifier, masked, equals id, masked, and whose format is the filter’s.

Constants§

PAMOJA_CAN_BUS_DEVICE
A bus kind: a kernel CAN interface reached through SocketCAN.
PAMOJA_CAN_BUS_SIMULATED
A bus kind: a bus inside the program.

Functions§

pamoja_can_bus_clear_filters⚠
Keeps every frame again, as a node does when it joins.
pamoja_can_bus_free⚠
Releases a node; it leaves the bus. A null pointer is ignored.
pamoja_can_bus_join⚠
Puts another node on the same bus: another socket on the same interface, or another node on the same simulated bus.
pamoja_can_bus_kind⚠
Returns what a node’s bus is: PAMOJA_CAN_BUS_DEVICE or PAMOJA_CAN_BUS_SIMULATED, which a null handle also reports.
pamoja_can_bus_open⚠
Opens a kernel CAN interface through SocketCAN, as one node on its bus.
pamoja_can_bus_receive⚠
Takes the next frame the node keeps, waiting up to a timeout for one.
pamoja_can_bus_received⚠
Returns how many frames a node has received, or 0 for a null handle.
pamoja_can_bus_send⚠
Sends a frame to every other node on the bus.
pamoja_can_bus_sent⚠
Returns how many frames a node has sent, or 0 for a null handle.
pamoja_can_bus_set_filters⚠
Keeps only the frames that pass at least one of the filters, from now on. An empty list keeps nothing.
pamoja_can_bus_simulated
Makes a new bus inside the program, with the returned node the first on it.
pamoja_can_bus_waited_micros⚠
Returns how long receives on a node have waited without a frame, in microseconds, whether or not the process slept through it, or 0 for a null handle.
pamoja_can_filter_exact
A filter that passes one identifier and nothing else.
pamoja_can_filter_matches
Reports whether a frame with an identifier passes a filter.
pamoja_can_filter_pgn
A filter that passes one J1939 parameter group at any priority, from any source, and for an addressed group, to any destination.