Class ReduxJNI

java.lang.Object
com.reduxrobotics.jni.ReduxJNI

public class ReduxJNI extends Object
Java side of the Redux device driver JNI wrapper. It is generally not necessary to directly interact with this class.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Internal use class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Supported driver major version
    static final int
    Supported driver minor version
    static final int
    Supported driver year
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Force load the library.
    static int
    Starts the Redux CANlink server -- not usually needed to be called manually.
    static boolean
    sendCANMessage(CANBus bus, int messageID, byte[] data)
    Sends a CAN message.
    static int
    Don't use this function directly -- use CanandDevice with CanandEventLoop instead!!! Blocks until a new CAN message is returned.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DRIVER_YEAR

      public static final int DRIVER_YEAR
      Supported driver year
      See Also:
    • DRIVER_MAJOR_VERSION

      public static final int DRIVER_MAJOR_VERSION
      Supported driver major version
      See Also:
    • DRIVER_MINOR_VERSION

      public static final int DRIVER_MINOR_VERSION
      Supported driver minor version
      See Also:
  • Constructor Details

    • ReduxJNI

      public ReduxJNI()
  • Method Details

    • forceLoad

      public static void forceLoad() throws IOException
      Force load the library.
      Throws:
      IOException - thrown if the native library cannot be found
    • init

      public static int init()
      Starts the Redux CANlink server -- not usually needed to be called manually.
      Returns:
      0 on success, nonzero otherwise
    • sendCANMessage

      public static boolean sendCANMessage(CANBus bus, int messageID, byte[] data)
      Sends a CAN message. (At the moment, this more or less calls HAL_CAN_SendMessage under the hood, and does not support sending to non-Rio buses.)
      Parameters:
      bus - the bus to send on
      messageID - 29-bit full CAN message id
      data - payload of up to 8 bytes.
      Returns:
      success
    • waitForCANMessage

      public static int waitForCANMessage(ByteBuffer buf)
      Don't use this function directly -- use CanandDevice with CanandEventLoop instead!!! Blocks until a new CAN message is returned.

      Receives a CAN message direct into a byte buffer. All CAN messages returned will be those under the Redux vendor id. Messages returned will not be repeated elsewhere -- do not directly use this function unless you have good reasons for doing so!!!!

      Parameters:
      buf - Buffer to fill in
      Returns:
      success or failure