Class MessageBus

java.lang.Object
com.reduxrobotics.canand.MessageBus

public class MessageBus extends Object
Class representing CAN buses that may exist on a robot. Currently, only the Rio's onboard CAN bus is supported.
  • Method Details

    • getRioBus

      public static MessageBus getRioBus()
      Returns an object representing the roboRIO's onboard bus.
      Returns:
      an object representing the Rio's bus (descriptor = 0)
    • getSystemCoreBus

      public static MessageBus getSystemCoreBus(int idx)
      Returns an object representing the specified SystemCore bus index. Do not use this on a roboRIO.
      Parameters:
      idx - bus index.
      Returns:
      object
    • byDescriptor

      public static MessageBus byDescriptor(int busDescriptor)
      Returns an object corresponding to a specific bus descriptor value. It is generally preferable to use this function instead of the constructor to avoid object creation churn.
      Parameters:
      busDescriptor - the descriptor value
      Returns:
      a new bus object associated with that bus descriptor. Equality can be checked between two bus objects with equals(java.lang.Object)
    • byBusString

      public static MessageBus byBusString(String busString)
      Gets a MessageBus instance from a bus string.
      Parameters:
      busString - bus string.
      Returns:
      bus object
    • getDescriptor

      public int getDescriptor()
      Returns the descriptor ID associated with the CAN bus object. Generally not needed to be used directly.
      Returns:
      the descriptor ID.
    • equals

      public boolean equals(Object other)
      Returns whether two bus objects refer to the same bus.
      Overrides:
      equals in class Object
      Parameters:
      other - other bus object to compare against
      Returns:
      whether or not they refer to the same bus