CanFFI class

The CAN interface, backed by the native SocketCAN library on Linux.

Note that CanMessages are natively allocated and need to be manually disposed of. Since this class sends them through the incomingMessages stream, you are responsible for disposing them if you listen to it. The stream gives you pointers so you can call CanMessage.dispose.

Inheritance

Constructors

CanFFI()

Properties

hasError bool
Whether there was an error and CAN is not functioning.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
incomingMessages Stream<CanMessage>
A stream of incoming CAN messages. Use Stream.listen to handle them.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Closes the connection to the device.
override
init() Future<bool>
Initializes the connection to the device.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDisconnect() Future<void>
A callback to run when the program has disconnected from the Dashboard.
inherited
reset() Future<void>
Resets the CAN bus.
override
sendMessage({required int id, required List<int> data}) → void
Sends a CAN message with the given ID and data.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

readInterval → const Duration
How often to poll CAN messages.