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§
- Pamoja
CanBus - A node on a CAN bus. Opaque; release it with
pamoja_can_bus_free. - Pamoja
CanFilter - 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_DEVICEorPAMOJA_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.