Struct CANBus
Class for getting information about an available CAN bus.
public readonly record struct CANBus : IComparable<CANBus>, IEquatable<CANBus>
- Implements
- Inherited Members
Constructors
CANBus()
Creates a new CAN bus using the default for the system:
- "can0" on Linux
- "*" on Windows
public CANBus()
CANBus(string)
Creates a new CAN bus with the given name.
public CANBus(string canbus)
Parameters
canbusstringName of the CAN bus. Possible CAN bus strings are:
<ul><li>CANivore name or serial number</li><li>SocketCAN interface (non-FRC Linux only)</li><li>"*" for any CANivore seen by the program</li><li>empty string (default) to select the default for the system: <ul><li>"can0" on Linux</li><li>"*" on Windows</li></ul></li></ul>
CANBus(string, string)
Creates a new CAN bus with the given name, and loads an associated hoot file for replay (equivalent to LoadFile(string)).
Only one hoot log may be replayed at a time. As a result, only one CAN bus should be constructed with a hoot file.
When using relative paths, the file path is typically relative to the top-level folder of the robot project.
public CANBus(string canbus, string hootFilepath)
Parameters
canbusstringName of the CAN bus. Possible CAN bus strings are:
<ul><li>CANivore name or serial number</li><li>SocketCAN interface (non-FRC Linux only)</li><li>"*" for any CANivore seen by the program</li><li>empty string (default) to select the default for the system: <ul><li>"can0" on Linux</li><li>"*" on Windows</li></ul></li></ul>hootFilepathstringPath and name of the hoot file to load
Properties
Name
The name used to construct this CAN bus.
public string Name { get; }
Property Value
Methods
CompareTo(CANBus)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(CANBus other)
Parameters
otherCANBusAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
GetStatus()
Gets the status of the CAN bus, including the bus utilization and the error counters.
This can block for up to 0.001 seconds (1 ms).
public CANBus.CANBusStatus GetStatus()
Returns
- CANBus.CANBusStatus
Status of the CAN bus
IsNetworkFD()
Gets whether the network is CAN FD.
public bool IsNetworkFD()
Returns
- bool
True if the network is CAN FD
ToString()
Provides the string representation of this object.
public override string ToString()