Package com.reduxrobotics.jni
Class ReduxJNI
java.lang.Object
com.reduxrobotics.jni.ReduxJNI
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 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Supported driver major versionstatic final int
Supported driver minor versionstatic final int
Supported driver year -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Force load the library.static int
init()
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.
-
Field Details
-
DRIVER_YEAR
public static final int DRIVER_YEARSupported driver year- See Also:
-
DRIVER_MAJOR_VERSION
public static final int DRIVER_MAJOR_VERSIONSupported driver major version- See Also:
-
DRIVER_MINOR_VERSION
public static final int DRIVER_MINOR_VERSIONSupported driver minor version- See Also:
-
-
Constructor Details
-
ReduxJNI
public ReduxJNI()
-
-
Method Details
-
forceLoad
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
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 onmessageID
- 29-bit full CAN message iddata
- payload of up to 8 bytes.- Returns:
- success
-
waitForCANMessage
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
-