Class CanandEventLoop

java.lang.Object
com.reduxrobotics.canand.CanandEventLoop
All Implemented Interfaces:
Runnable

public class CanandEventLoop extends Object implements Runnable
Class that runs the CAN packet ingest loop, and starts the CANLink interface.

In order to start the Redux CANLink server, either instantiate any Redux device in your robot code or call

 CanandEventLoop.getInstance();
 
somewhere in an init function
  • Method Details

    • getInstance

      public static CanandEventLoop getInstance()
      Returns a handle to the event loop. Starts it if not started.
      Returns:
      the singleton instance
    • setGlobalDevicePresenceWarnings

      public void setGlobalDevicePresenceWarnings(boolean enabled)
      Set whether to enable device presence warnings to the driver station globally (defaults to true).
      Parameters:
      enabled - true to enable, false to suppress
    • setDevicePresenceWarnings

      public void setDevicePresenceWarnings(CanandDevice device, boolean enabled)
      Set whether to enable device presence warnings to the driver station for a single device (defaults to true).
      Parameters:
      device - the CanandDevice to consider
      enabled - true to enable, false to suppress
    • setDevicePresenceThreshold

      public void setDevicePresenceThreshold(CanandDevice device, double threshold)
      Sets the device presence threshold of how many seconds must pass without a message for the device checker to consider them disconnected from bus.
      Parameters:
      device - the CanandDevice to act on
      threshold - the new threshold, in seconds.
    • addListener

      public void addListener(CanandDevice listener)
      Adds a listener for CAN messages to the event loop.
      Parameters:
      listener - a CanandDevice
    • removeListener

      public void removeListener(CanandDevice listener)
      Removes a listener for CAN messages, if it is in fact listening.
      Parameters:
      listener - the CanandDevice to remove
    • run

      public void run()
      Specified by:
      run in interface Runnable