CanSocket class abstract

A CAN socket that supports reading and writing CAN messages.

This class uses the CAN bus protocol to interface with other devices on the CAN bus. Each message should have an ID and a payload. The ID is used to identify the purpose of the message, and the receiving device can filter incoming messages based on its ID. The payload is limited to 8 bytes, or 64 bytes if using CAN FD.

  • Use sendMessage to send a message to all devices on the bus
  • Listen to incomingMessages to receive messages from other devices on the bus
Inheritance
Implementers

Constructors

CanSocket()
A default constructor for a CanSocket.
CanSocket.forPlatform()
Chooses the right implementation for the platform. Uses a stub on non-Linux platforms.
factory

Properties

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 setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Closes the connection to the device.
inherited
init() Future<bool>
Initializes the connection to the device.
inherited
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.
sendMessage({required int id, required List<int> data}) → void
Sends a CAN message with the given ID and data.
toString() String
A string representation of this object.
inherited

Operators

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