Update to the v13 headers and libraries

Add all of the most recent headers and .SOs

Also make DriverStation work with the new FRC comm protocol, using the new
functions for getting status data

Change-Id: I1c7fc5f90e72c5fbebf87d9923ce0967ed0ef3bc

Initial HAL support for v13 ds

Change-Id: I9a7f37ef8e24241598fa3981cb3df30c07c52e0f

New ds stuff in the HAL

Change-Id: I025910625453baf63f79f49bbc70ba8b2f093f50

New ds stuff in C++

Joysticks are still todo

Driver station IO is pulled out

Change-Id: I1bb59037c097713bd943e7bef00e12f67f13c3ac

New ds works in C++ and Java.  Joysticks still todo

Change-Id: Ic93f8686856761badc592eceaf05964f52355578

Make joysticks work again with the v13 image protocol

Change-Id: Ief7ee95d3398c2262ca07ab7d60499af3c8f60f7
This commit is contained in:
Thomas Clark
2014-08-06 11:29:15 -04:00
parent b8eeeabbb5
commit 8abbcf53f4
106 changed files with 2928 additions and 3479 deletions

View File

@@ -10,8 +10,8 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary;
import edu.wpi.first.wpilibj.communication.FRCCommonControlData;
import edu.wpi.first.wpilibj.communication.FRCCommonControlMasks;
import edu.wpi.first.wpilibj.communication.HALControlWord;
import edu.wpi.first.wpilibj.communication.HALAllianceStationID;
import edu.wpi.first.wpilibj.hal.HALUtil;
import edu.wpi.first.wpilibj.Timer;
@@ -24,14 +24,6 @@ public class DriverStation implements RobotState.Interface {
* The size of the user status data
*/
public static final int USER_STATUS_DATA_SIZE = FRCNetworkCommunicationsLibrary.USER_STATUS_DATA_SIZE;
/**
* Slot for the analog module to read the battery
*/
public static final int kBatterySlot = 1;
/**
* Analog channel to read the battery
*/
public static final int kBatteryChannel = 7;
/**
* Number of Joystick Ports
*/
@@ -48,28 +40,7 @@ public class DriverStation implements RobotState.Interface {
/**
* The robot alliance that the robot is a part of
*/
public static class Alliance {
/** The integer value representing this enumeration. */
public final int value;
/** The Alliance name. */
public final String name;
public static final int kRed_val = 0;
public static final int kBlue_val = 1;
public static final int kInvalid_val = 2;
/** alliance: Red */
public static final Alliance kRed = new Alliance(kRed_val, "Red");
/** alliance: Blue */
public static final Alliance kBlue = new Alliance(kBlue_val, "Blue");
/** alliance: Invalid */
public static final Alliance kInvalid = new Alliance(kInvalid_val, "invalid");
private Alliance(int value, String name) {
this.value = value;
this.name = name;
}
} /* Alliance */
public enum Alliance { Red, Blue, Invalid }
private static class DriverStationTask implements Runnable {
@@ -85,8 +56,12 @@ public class DriverStation implements RobotState.Interface {
} /* DriverStationTask */
private static DriverStation instance = new DriverStation();
private FRCCommonControlData m_controlData;
private AnalogInput m_batteryChannel;
private HALControlWord m_controlWord;
private HALAllianceStationID m_allianceStationID;
private short[][] m_joystickAxes = new short[kJoystickAxes][kJoystickPorts];
private int[] m_joystickButtons = new int[kJoystickPorts];
private Thread m_thread;
private final Object m_semaphore;
private final Object m_dataSem;
@@ -121,18 +96,12 @@ public class DriverStation implements RobotState.Interface {
* instance static member variable.
*/
protected DriverStation() {
m_controlData = new FRCCommonControlData();
m_semaphore = new Object();
m_dataSem = new Object();
m_dashboardInUseHigh = m_dashboardDefaultHigh = new Dashboard(m_semaphore);
m_dashboardInUseLow = m_dashboardDefaultLow = new Dashboard(m_semaphore);
// m_controlData is initialized in constructor FRCCommonControlData.
// XXX: Uncomment when analogChannel is fixed
//m_batteryChannel = new AnalogChannel(kBatterySlot, kBatteryChannel);
m_packetDataAvailableSem = HALUtil.initializeMutexNormal();
// set the byte order
@@ -216,7 +185,17 @@ public class DriverStation implements RobotState.Interface {
* the data will be copied from the DS polling loop.
*/
protected synchronized void getData() {
FRCNetworkCommunicationsLibrary.getCommonControlData(m_controlData);
// Get the status data
m_controlWord = FRCNetworkCommunicationsLibrary.HALGetControlWord();
// Get the location/alliance data
m_allianceStationID = FRCNetworkCommunicationsLibrary.HALGetAllianceStation();
// Get the status of all of the joysticks
for(byte stick = 0; stick < kJoystickPorts; stick++) {
m_joystickButtons[stick] = FRCNetworkCommunicationsLibrary.HALGetJoystickButtons(stick);
m_joystickAxes[stick] = FRCNetworkCommunicationsLibrary.HALGetJoystickAxes(stick);
}
if (!lastEnabled && isEnabled()) {
// If starting teleop, assume that autonomous just took up 15 seconds
@@ -239,7 +218,8 @@ public class DriverStation implements RobotState.Interface {
*/
protected void setData() {
synchronized (m_semaphore) {
FRCNetworkCommunicationsLibrary.setStatusData((float) getBatteryVoltage(),
// TODO ???
/*FRCNetworkCommunicationsLibrary.setStatusData((float) getBatteryVoltage(),
(byte) m_digitalOut,
(byte) m_updateNumber,
new String(m_dashboardInUseHigh.getBytes()),
@@ -247,25 +227,17 @@ public class DriverStation implements RobotState.Interface {
new String(m_dashboardInUseLow.getBytes()),
m_dashboardInUseLow.getBytesLength());
m_dashboardInUseHigh.flush();
m_dashboardInUseLow.flush();
m_dashboardInUseLow.flush();*/
}
}
/**
* Read the battery voltage from the specified AnalogChannel.
*
* This accessor assumes that the battery voltage is being measured
* through the voltage divider on an analog breakout.
* Read the battery voltage.
*
* @return The battery voltage.
*/
public double getBatteryVoltage() {
// The Analog bumper has a voltage divider on the battery source.
// Vbatt *--/\/\/\--* Vsample *--/\/\/\--* Gnd
// 680 Ohms 1000 Ohms
// XXX: Uncomment this when analog channel is fixed
//return m_batteryChannel.getAverageVoltage() * (1680.0 / 1000.0);
return 12.0;
return 0.0; // TODO
}
/**
@@ -277,42 +249,21 @@ public class DriverStation implements RobotState.Interface {
* @return The value of the axis on the joystick.
*/
public double getStickAxis(int stick, int axis) {
if(stick < 1 || stick > kJoystickPorts) {
throw new RuntimeException("Joystick index is out of range, should be 1-4");
}
if (axis < 1 || axis > kJoystickAxes) {
return 0.0;
throw new RuntimeException("Joystick axis is out of range");
}
int value;
switch (stick) {
case 1:
value = m_controlData.stick0Axes[axis - 1];
break;
case 2:
value = m_controlData.stick1Axes[axis - 1];
break;
case 3:
value = m_controlData.stick2Axes[axis - 1];
break;
case 4:
value = m_controlData.stick3Axes[axis - 1];
break;
default:
return 0.0;
}
byte value = (byte)m_joystickAxes[stick - 1][axis - 1];
double result;
if (value < 0) {
result = ((double) value) / 128.0;
if(value < 0) {
return value / 128.0;
} else {
result = ((double) value) / 127.0;
return value / 127.0;
}
// wpi_assert(result <= 1.0 && result >= -1.0);
if (result > 1.0) {
result = 1.0;
} else if (result < -1.0) {
result = -1.0;
}
return result;
}
/**
@@ -323,76 +274,11 @@ public class DriverStation implements RobotState.Interface {
* @return The state of the buttons on the joystick.
*/
public int getStickButtons(final int stick) {
switch (stick) {
case 1:
return m_controlData.stick0Buttons;
case 2:
return m_controlData.stick1Buttons;
case 3:
return m_controlData.stick2Buttons;
case 4:
return m_controlData.stick3Buttons;
default:
return 0;
if(stick < 1 || stick > kJoystickPorts) {
throw new RuntimeException("Joystick index is out of range, should be 1-4");
}
}
/**
* Get an analog voltage from the Driver Station.
* The analog values are returned as voltage values for the Driver Station analog inputs.
* These inputs are typically used for advanced operator interfaces consisting of potentiometers
* or resistor networks representing values on a rotary switch.
*
* @param channel The analog input channel on the driver station to read from. Valid range is 1 - 4.
* @return The analog voltage on the input.
*/
public double getAnalogIn(final int channel) {
switch (channel) {
case 1:
return kDSAnalogInScaling * m_controlData.analog1;
case 2:
return kDSAnalogInScaling * m_controlData.analog2;
case 3:
return kDSAnalogInScaling * m_controlData.analog3;
case 4:
return kDSAnalogInScaling * m_controlData.analog4;
default:
return 0.0;
}
}
/**
* Get values from the digital inputs on the Driver Station.
* Return digital values from the Drivers Station. These values are typically used for buttons
* and switches on advanced operator interfaces.
* @param channel The digital input to get. Valid range is 1 - 8.
* @return The value of the digital input
*/
public boolean getDigitalIn(final int channel) {
return ((m_controlData.dsDigitalIn >> (channel - 1)) & 0x1) == 0x1;
}
/**
* Set a value for the digital outputs on the Driver Station.
*
* Control digital outputs on the Drivers Station. These values are typically used for
* giving feedback on a custom operator station such as LEDs.
*
* @param channel The digital output to set. Valid range is 1 - 8.
* @param value The state to set the digital output.
*/
public void setDigitalOut(final int channel, final boolean value) {
m_digitalOut &= ~(0x1 << (channel - 1));
m_digitalOut |= ((value ? 1 : 0) << (channel - 1));
}
/**
* Get a value that was set for the digital outputs on the Driver Station.
* @param channel The digital ouput to monitor. Valid range is 1 through 8.
* @return A digital value being output on the Drivers Station.
*/
public boolean getDigitalOut(final int channel) {
return ((m_digitalOut >> (channel - 1)) & 0x1) == 0x1;
return (int)m_joystickButtons[stick - 1];
}
/**
@@ -402,7 +288,7 @@ public class DriverStation implements RobotState.Interface {
* @return True if the robot is enabled, false otherwise.
*/
public boolean isEnabled() {
return (m_controlData.control & FRCCommonControlMasks.ENABLED) != 0;
return m_controlWord.getEnabled();
}
/**
@@ -422,7 +308,7 @@ public class DriverStation implements RobotState.Interface {
* @return True if autonomous mode should be enabled, false otherwise.
*/
public boolean isAutonomous() {
return (m_controlData.control & FRCCommonControlMasks.AUTONOMOUS) != 0;
return m_controlWord.getAutonomous();
}
/**
@@ -431,7 +317,7 @@ public class DriverStation implements RobotState.Interface {
* @return True if test mode should be enabled, false otherwise.
*/
public boolean isTest() {
return (m_controlData.control & FRCCommonControlMasks.TEST) != 0;
return m_controlWord.getTest();
}
/**
@@ -454,29 +340,24 @@ public class DriverStation implements RobotState.Interface {
return result;
}
/**
* Return the DS packet number.
* The packet number is the index of this set of data returned by the driver station.
* Each time new data is received, the packet number (included with the sent data) is returned.
*
* @return The DS packet number.
*/
public int getPacketNumber() {
return m_controlData.packetIndex;
}
/**
* Get the current alliance from the FMS
* @return the current alliance
*/
public Alliance getAlliance() {
switch (m_controlData.dsID_Alliance) {
case 'R':
return Alliance.kRed;
case 'B':
return Alliance.kBlue;
default:
return Alliance.kInvalid;
switch (m_allianceStationID) {
case Red1:
case Red2:
case Red3:
return Alliance.Red;
case Blue1:
case Blue2:
case Blue3:
return Alliance.Blue;
default:
return Alliance.Invalid;
}
}
@@ -486,15 +367,22 @@ public class DriverStation implements RobotState.Interface {
* @return the location of the team's driver station controls: 1, 2, or 3
*/
public int getLocation() {
return m_controlData.dsID_Position - '0';
}
switch (m_allianceStationID) {
case Red1:
case Blue1:
return 1;
/**
* Return the team number that the Driver Station is configured for
* @return The team number
*/
public int getTeamNumber() {
return m_controlData.teamID;
case Red2:
case Blue2:
return 2;
case Blue3:
case Red3:
return 3;
default:
return 0;
}
}
/**
@@ -590,7 +478,7 @@ public class DriverStation implements RobotState.Interface {
* @return True if the robot is competing on a field being controlled by a Field Management System
*/
public boolean isFMSAttached() {
return (m_controlData.control & FRCCommonControlMasks.FMS_ATTATCHED) > 0;
return m_controlWord.getFMSAttached();
}
/**

View File

@@ -1,197 +0,0 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2012. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary;
import edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary.tResourceType;
import edu.wpi.first.wpilibj.communication.UsageReporting;
/**
* Provide access to "LCD" on the Driver Station.
* This is the Messages box on the DS Operation tab.
*
* Buffer the printed data locally and then send it
* when UpdateLCD is called.
*/
public class DriverStationLCD extends SensorBase {
private static DriverStationLCD m_instance;
/**
* Driver station timeout in milliseconds
*/
public static final int kSyncTimeout_ms = 20;
/**
* Command to display text
*/
public static final int kFullDisplayTextCommand = 0x9FFF;
/**
* Maximum line length for Driver Station display
*/
public static final int kLineLength = 21;
/**
* Total number of lines available
*/
public static final int kNumLines = 6;
/**
* The line number on the Driver Station LCD
*/
public static class Line {
/**
* The integer value representing this enumeration
*/
public final int value;
static final int kMain6_val = 0;
static final int kUser1_val = 0;
static final int kUser2_val = 1;
static final int kUser3_val = 2;
static final int kUser4_val = 3;
static final int kUser5_val = 4;
static final int kUser6_val = 5;
/**
* @deprecated Use kUser1
* Line at the Top of the screen
*/
public static final Line kMain6 = new Line(kMain6_val);
/**
* Line at the Top of the screen
*/
public static final Line kUser1 = new Line(kUser1_val);
/**
* Line on the user screen
*/
public static final Line kUser2 = new Line(kUser2_val);
/**
* Line on the user screen
*/
public static final Line kUser3 = new Line(kUser3_val);
/**
* Line on the user screen
*/
public static final Line kUser4 = new Line(kUser4_val);
/**
* Line on the user screen
*/
public static final Line kUser5 = new Line(kUser5_val);
/**
* Bottom line on the user screen
*/
public static final Line kUser6 = new Line(kUser6_val);
private Line(int value) {
this.value = value;
}
}
byte[] m_textBuffer;
/**
* Get an instance of the DriverStationLCD
* @return an instance of the DriverStationLCD
*/
public static synchronized DriverStationLCD getInstance() {
if (m_instance == null)
m_instance = new DriverStationLCD();
return m_instance;
}
/**
* DriverStationLCD constructor.
*
* This is only called once the first time GetInstance() is called
*/
private DriverStationLCD() {
m_textBuffer = new byte[FRCNetworkCommunicationsLibrary.USER_DS_LCD_DATA_SIZE];
for (int i = 0; i < FRCNetworkCommunicationsLibrary.USER_DS_LCD_DATA_SIZE; i++) {
m_textBuffer[i] = ' ';
}
m_textBuffer[0] = (byte) (kFullDisplayTextCommand >> 8);
m_textBuffer[1] = (byte) kFullDisplayTextCommand;
UsageReporting.report(tResourceType.kResourceType_DriverStationLCD, 0);
}
/**
* Send the text data to the Driver Station.
*/
public synchronized void updateLCD() {
FRCNetworkCommunicationsLibrary.setUserDsLcdData(new String(m_textBuffer), FRCNetworkCommunicationsLibrary.USER_DS_LCD_DATA_SIZE, kSyncTimeout_ms);
}
/**
* Print formatted text to the Driver Station LCD text buffer.
*
* Use UpdateLCD() periodically to actually send the test to the Driver Station.
*
* @param line The line on the LCD to print to.
* @param startingColumn The column to start printing to. This is a 1-based number.
* @param text the text to print
*/
public void println(Line line, int startingColumn, String text) {
int start = startingColumn - 1;
int maxLength = kLineLength - start;
if (startingColumn < 1 || startingColumn > kLineLength) {
throw new IndexOutOfBoundsException("Column must be between 1 and " + kLineLength + ", inclusive");
}
int length = text.length();
int finalLength = (length < maxLength ? length : maxLength);
synchronized (this) {
for (int i = 0; i < finalLength; i++) {
m_textBuffer[i + start + line.value * kLineLength + 2] = (byte)text.charAt(i);
}
}
}
/**
* Print formatted text to the Driver Station LCD text buffer.
*
* Use UpdateLCD() periodically to actually send the test to the Driver Station.
*
* @param line The line on the LCD to print to.
* @param startingColumn The column to start printing to. This is a 1-based number.
* @param text the text to print
*/
public void println(Line line, int startingColumn, StringBuffer text) {
int start = startingColumn - 1;
int maxLength = kLineLength - start;
if (startingColumn < 1 || startingColumn > kLineLength) {
throw new IndexOutOfBoundsException("Column must be between 1 and " + kLineLength + ", inclusive");
}
int length = text.length();
int finalLength = (length < maxLength ? length : maxLength);
synchronized (this) {
for (int i = 0; i < finalLength; i++) {
m_textBuffer[i + start + line.value * kLineLength + 2] = (byte) text.charAt(i);
}
}
}
/**
* Clear User Messages box on DS Operations Tab
*
* This method will clear all text currently displayed in the message box
*/
public void clear() {
synchronized (this) {
for (int i=0; i < kLineLength*kNumLines; i++) {
m_textBuffer[i+2] = ' ';
}
}
updateLCD();
}
}

View File

@@ -1,440 +0,0 @@
package edu.wpi.first.wpilibj.communication;
//import com.ochafik.lang.jnaerator.runtime.Structure;
//import com.ochafik.lang.jnaerator.runtime.Union;
//import com.sun.jna.Pointer;
import java.util.Arrays;
import java.util.List;
/**
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:11</i><br>
* This file was autogenerated by <a href="http://jnaerator.googlecode.com/">JNAerator</a>,<br>
* a tool written by <a href="http://ochafik.com/">Olivier Chafik</a> that <a href="http://code.google.com/p/jnaerator/wiki/CreditsAndLicense">uses a few opensource projects.</a>.<br>
* For help, please visit <a href="http://nativelibs4java.googlecode.com/">NativeLibs4Java</a> , <a href="http://rococoa.dev.java.net/">Rococoa</a>, or <a href="http://jna.dev.java.net/">JNA</a>.
*/
public class FRCCommonControlData /*extends Structure<FRCCommonControlData, FRCCommonControlData.ByValue, FRCCommonControlData.ByReference >*/ {
public short packetIndex;
/** C type : field1_union */
public byte control;
public byte dsDigitalIn;
public short teamID;
public byte dsID_Alliance;
public byte dsID_Position;
public byte[] stick0Axes = new byte[6];
/** Left-most 4 bits are unused */
public short stick0Buttons;
public byte[] stick1Axes = new byte[6];
/** Left-most 4 bits are unused */
public short stick1Buttons;
public byte[] stick2Axes = new byte[6];
/** Left-most 4 bits are unused */
public short stick2Buttons;
public byte[] stick3Axes = new byte[6];
/** Left-most 4 bits are unused */
public short stick3Buttons;
/** Analog inputs are 10 bit right-justified */
public short analog1;
public short analog2;
public short analog3;
public short analog4;
public long cRIOChecksum;
public int FPGAChecksum0;
public int FPGAChecksum1;
public int FPGAChecksum2;
public int FPGAChecksum3;
/** C type : char[8] */
public byte[] versionData = new byte[8];
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:13</i> */
public static class field1_union /*extends Union<field1_union, field1_union.ByValue, field1_union.ByReference >*/ {
public byte control;
/** C type : field1_struct */
public field1_struct field1;
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:16</i> */
public static abstract class field1_struct /*extends Structure<field1_struct, field1_struct.ByValue, field1_struct.ByReference >*/ {
/** Conversion Error : checkVersions:1 (This runtime does not support bit fields : JNAerator (based on JNA) (please use BridJ instead)) */
/** Conversion Error : test:1 (This runtime does not support bit fields : JNAerator (based on JNA) (please use BridJ instead)) */
/** Conversion Error : resync:1 (This runtime does not support bit fields : JNAerator (based on JNA) (please use BridJ instead)) */
/** Conversion Error : fmsAttached:1 (This runtime does not support bit fields : JNAerator (based on JNA) (please use BridJ instead)) */
/** Conversion Error : autonomous:1 (This runtime does not support bit fields : JNAerator (based on JNA) (please use BridJ instead)) */
/** Conversion Error : enabled:1 (This runtime does not support bit fields : JNAerator (based on JNA) (please use BridJ instead)) */
/** Conversion Error : notEStop:1 (This runtime does not support bit fields : JNAerator (based on JNA) (please use BridJ instead)) */
/** Conversion Error : reset:1 (This runtime does not support bit fields : JNAerator (based on JNA) (please use BridJ instead)) */
public field1_struct() {
super();
}
protected List<? > getFieldOrder() {
return Arrays.asList();
}
//public field1_struct(Pointer peer) {
// super(peer);
//}
//public static abstract class ByReference extends field1_struct implements Structure.ByReference {
//};
//public static abstract class ByValue extends field1_struct implements Structure.ByValue {
//};
};
public field1_union() {
super();
}
/** @param field1 C type : field1_struct */
public field1_union(field1_struct field1) {
super();
this.field1 = field1;
//setType(field1_struct.class);
}
public field1_union(byte control) {
super();
this.control = control;
//setType(Byte.TYPE);
}
//public field1_union(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field1_union newInstance() { return new field1_union(); }
//public static field1_union[] newArray(int arrayLength) {
// return Union.newArray(field1_union.class, arrayLength);
//}
//public static class ByReference extends field1_union implements Structure.ByReference {
//};
//public static class ByValue extends field1_union implements Structure.ByValue {
//};
};
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:45</i> */
public static class field2_union /*extends Union<field2_union, field2_union.ByValue, field2_union.ByReference >*/ {
/** C type : int8_t[6] */
public byte[] stick0Axes = new byte[6];
/** C type : field1_struct */
public field1_struct field1;
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:47</i> */
public static class field1_struct /*extends Structure<field1_struct, field1_struct.ByValue, field1_struct.ByReference >*/ {
public byte stick0Axis1;
public byte stick0Axis2;
public byte stick0Axis3;
public byte stick0Axis4;
public byte stick0Axis5;
public byte stick0Axis6;
public field1_struct() {
super();
}
protected List<? > getFieldOrder() {
return Arrays.asList("stick0Axis1", "stick0Axis2", "stick0Axis3", "stick0Axis4", "stick0Axis5", "stick0Axis6");
}
public field1_struct(byte stick0Axis1, byte stick0Axis2, byte stick0Axis3, byte stick0Axis4, byte stick0Axis5, byte stick0Axis6) {
super();
this.stick0Axis1 = stick0Axis1;
this.stick0Axis2 = stick0Axis2;
this.stick0Axis3 = stick0Axis3;
this.stick0Axis4 = stick0Axis4;
this.stick0Axis5 = stick0Axis5;
this.stick0Axis6 = stick0Axis6;
}
//public field1_struct(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field1_struct newInstance() { return new field1_struct(); }
//public static field1_struct[] newArray(int arrayLength) {
// return Structure.newArray(field1_struct.class, arrayLength);
//}
//public static class ByReference extends field1_struct implements Structure.ByReference {
//};
//public static class ByValue extends field1_struct implements Structure.ByValue {
//};
};
public field2_union() {
super();
}
/** @param field1 C type : field1_struct */
public field2_union(field1_struct field1) {
super();
this.field1 = field1;
//setType(field1_struct.class);
}
/** @param stick0Axes C type : int8_t[6] */
public field2_union(byte stick0Axes[]) {
super();
if ((stick0Axes.length != this.stick0Axes.length))
throw new IllegalArgumentException("Wrong array size !");
this.stick0Axes = stick0Axes;
//setType(byte[].class);
}
//public field2_union(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field2_union newInstance() { return new field2_union(); }
//public static field2_union[] newArray(int arrayLength) {
// return Union.newArray(field2_union.class, arrayLength);
//}
//public static class ByReference extends field2_union implements Structure.ByReference {
//};
//public static class ByValue extends field2_union implements Structure.ByValue {
//};
};
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:58</i> */
public static class field3_union /*extends Union<field3_union, field3_union.ByValue, field3_union.ByReference >*/ {
/** C type : int8_t[6] */
public byte[] stick1Axes = new byte[6];
/** C type : field1_struct */
public field1_struct field1;
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:60</i> */
public static class field1_struct /* extends Structure<field1_struct, field1_struct.ByValue, field1_struct.ByReference >*/ {
public byte stick1Axis1;
public byte stick1Axis2;
public byte stick1Axis3;
public byte stick1Axis4;
public byte stick1Axis5;
public byte stick1Axis6;
public field1_struct() {
super();
}
protected List<? > getFieldOrder() {
return Arrays.asList("stick1Axis1", "stick1Axis2", "stick1Axis3", "stick1Axis4", "stick1Axis5", "stick1Axis6");
}
public field1_struct(byte stick1Axis1, byte stick1Axis2, byte stick1Axis3, byte stick1Axis4, byte stick1Axis5, byte stick1Axis6) {
super();
this.stick1Axis1 = stick1Axis1;
this.stick1Axis2 = stick1Axis2;
this.stick1Axis3 = stick1Axis3;
this.stick1Axis4 = stick1Axis4;
this.stick1Axis5 = stick1Axis5;
this.stick1Axis6 = stick1Axis6;
}
//public field1_struct(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field1_struct newInstance() { return new field1_struct(); }
//public static field1_struct[] newArray(int arrayLength) {
// return Structure.newArray(field1_struct.class, arrayLength);
//}
//public static class ByReference extends field1_struct implements Structure.ByReference {
//
//};
//public static class ByValue extends field1_struct implements Structure.ByValue {
//
//};
};
public field3_union() {
super();
}
/** @param field1 C type : field1_struct */
public field3_union(field1_struct field1) {
super();
this.field1 = field1;
//setType(field1_struct.class);
}
/** @param stick1Axes C type : int8_t[6] */
public field3_union(byte stick1Axes[]) {
super();
if ((stick1Axes.length != this.stick1Axes.length))
throw new IllegalArgumentException("Wrong array size !");
this.stick1Axes = stick1Axes;
//setType(byte[].class);
}
//public field3_union(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field3_union newInstance() { return new field3_union(); }
//public static field3_union[] newArray(int arrayLength) {
// return Union.newArray(field3_union.class, arrayLength);
//}
//public static class ByReference extends field3_union implements Structure.ByReference {
//
//};
//public static class ByValue extends field3_union implements Structure.ByValue {
//};
};
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:71</i> */
public static class field4_union /*extends Union<field4_union, field4_union.ByValue, field4_union.ByReference >*/ {
/** C type : int8_t[6] */
public byte[] stick2Axes = new byte[6];
/** C type : field1_struct */
public field1_struct field1;
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:73</i> */
public static class field1_struct /* extends Structure<field1_struct, field1_struct.ByValue, field1_struct.ByReference >*/ {
public byte stick2Axis1;
public byte stick2Axis2;
public byte stick2Axis3;
public byte stick2Axis4;
public byte stick2Axis5;
public byte stick2Axis6;
public field1_struct() {
super();
}
protected List<? > getFieldOrder() {
return Arrays.asList("stick2Axis1", "stick2Axis2", "stick2Axis3", "stick2Axis4", "stick2Axis5", "stick2Axis6");
}
public field1_struct(byte stick2Axis1, byte stick2Axis2, byte stick2Axis3, byte stick2Axis4, byte stick2Axis5, byte stick2Axis6) {
super();
this.stick2Axis1 = stick2Axis1;
this.stick2Axis2 = stick2Axis2;
this.stick2Axis3 = stick2Axis3;
this.stick2Axis4 = stick2Axis4;
this.stick2Axis5 = stick2Axis5;
this.stick2Axis6 = stick2Axis6;
}
//public field1_struct(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field1_struct newInstance() { return new field1_struct(); }
//public static field1_struct[] newArray(int arrayLength) {
// return Structure.newArray(field1_struct.class, arrayLength);
//}
//public static class ByReference extends field1_struct implements Structure.ByReference {
//};
//public static class ByValue extends field1_struct implements Structure.ByValue {
//};
};
public field4_union() {
super();
}
/** @param field1 C type : field1_struct */
public field4_union(field1_struct field1) {
super();
this.field1 = field1;
//setType(field1_struct.class);
}
/** @param stick2Axes C type : int8_t[6] */
public field4_union(byte stick2Axes[]) {
super();
if ((stick2Axes.length != this.stick2Axes.length))
throw new IllegalArgumentException("Wrong array size !");
this.stick2Axes = stick2Axes;
//setType(byte[].class);
}
//public field4_union(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field4_union newInstance() { return new field4_union(); }
//public static field4_union[] newArray(int arrayLength) {
// return Union.newArray(field4_union.class, arrayLength);
//}
//public static class ByReference extends field4_union implements Structure.ByReference {
//};
//public static class ByValue extends field4_union implements Structure.ByValue {
//};
};
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:84</i> */
public static class field5_union /* extends Union<field5_union, field5_union.ByValue, field5_union.ByReference >*/ {
/** C type : int8_t[6] */
public byte[] stick3Axes = new byte[6];
/** C type : field1_struct */
public field1_struct field1;
/** <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:86</i> */
public static class field1_struct /*extends Structure<field1_struct, field1_struct.ByValue, field1_struct.ByReference >*/ {
public byte stick3Axis1;
public byte stick3Axis2;
public byte stick3Axis3;
public byte stick3Axis4;
public byte stick3Axis5;
public byte stick3Axis6;
public field1_struct() {
super();
}
protected List<? > getFieldOrder() {
return Arrays.asList("stick3Axis1", "stick3Axis2", "stick3Axis3", "stick3Axis4", "stick3Axis5", "stick3Axis6");
}
public field1_struct(byte stick3Axis1, byte stick3Axis2, byte stick3Axis3, byte stick3Axis4, byte stick3Axis5, byte stick3Axis6) {
super();
this.stick3Axis1 = stick3Axis1;
this.stick3Axis2 = stick3Axis2;
this.stick3Axis3 = stick3Axis3;
this.stick3Axis4 = stick3Axis4;
this.stick3Axis5 = stick3Axis5;
this.stick3Axis6 = stick3Axis6;
}
//public field1_struct(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field1_struct newInstance() { return new field1_struct(); }
//public static field1_struct[] newArray(int arrayLength) {
// return Structure.newArray(field1_struct.class, arrayLength);
//}
//public static class ByReference extends field1_struct implements Structure.ByReference {
//};
//public static class ByValue extends field1_struct implements Structure.ByValue {
//};
};
public field5_union() {
super();
}
/** @param field1 C type : field1_struct */
public field5_union(field1_struct field1) {
super();
this.field1 = field1;
//setType(field1_struct.class);
}
/** @param stick3Axes C type : int8_t[6] */
public field5_union(byte stick3Axes[]) {
super();
if ((stick3Axes.length != this.stick3Axes.length))
throw new IllegalArgumentException("Wrong array size !");
this.stick3Axes = stick3Axes;
//setType(byte[].class);
}
//public field5_union(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected field5_union newInstance() { return new field5_union(); }
//public static field5_union[] newArray(int arrayLength) {
// return Union.newArray(field5_union.class, arrayLength);
//}
//public static class ByReference extends field5_union implements Structure.ByReference {
//};
//public static class ByValue extends field5_union implements Structure.ByValue {
//};
};
public FRCCommonControlData() {
super();
}
protected List<? > getFieldOrder() {
return Arrays.asList("packetIndex", "field1", "dsDigitalIn", "teamID", "dsID_Alliance", "dsID_Position", "field2", "stick0Buttons", "field3", "stick1Buttons", "field4", "stick2Buttons", "field5", "stick3Buttons", "analog1", "analog2", "analog3", "analog4", "cRIOChecksum", "FPGAChecksum0", "FPGAChecksum1", "FPGAChecksum2", "FPGAChecksum3", "versionData");
}
//public FRCCommonControlData(Pointer peer) {
// super(peer);
//}
//protected ByReference newByReference() { return new ByReference(); }
//protected ByValue newByValue() { return new ByValue(); }
protected FRCCommonControlData newInstance() { return new FRCCommonControlData(); }
//public static FRCCommonControlData[] newArray(int arrayLength) {
// return Structure.newArray(FRCCommonControlData.class, arrayLength);
//}
//public static class ByReference extends FRCCommonControlData implements Structure.ByReference {
//
//};
//public static class ByValue extends FRCCommonControlData implements Structure.ByValue {
//};
}

View File

@@ -1,12 +0,0 @@
package edu.wpi.first.wpilibj.communication;
public class FRCCommonControlMasks {
public static byte CHECK_VERSIONS = 1 << 0;
public static byte TEST = 1 << 1;
public static byte RESYNC = 1 << 2;
public static byte FMS_ATTATCHED = 1 << 3;
public static byte AUTONOMOUS = 1 << 4;
public static byte ENABLED = 1 << 5;
public static byte NOT_ESTOP = 1 << 6;
public static byte RESET = (byte) (1 << 7);
}

View File

@@ -263,7 +263,7 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
* <i>native declaration : src\main\include\NetworkCommunication\AICalibration.h:7</i><br>
* @deprecated use the safer methods {@link #FRC_NetworkCommunication_nAICalibration_getLSBWeight(int, int, java.nio.IntBuffer)} and {@link #FRC_NetworkCommunication_nAICalibration_getLSBWeight(int, int, com.sun.jna.ptr.IntByReference)} instead
*/
//@Deprecated
//@Deprecated
//public static native int FRC_NetworkCommunication_nAICalibration_getLSBWeight(int aiSystemIndex, int channel, Integer status);
/**
* Original signature : <code>uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t, const uint32_t, int32_t*)</code><br>
@@ -275,18 +275,13 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
* <i>native declaration : src\main\include\NetworkCommunication\AICalibration.h:8</i><br>
* @deprecated use the safer methods {@link #FRC_NetworkCommunication_nAICalibration_getOffset(int, int, java.nio.IntBuffer)} and {@link #FRC_NetworkCommunication_nAICalibration_getOffset(int, int, com.sun.jna.ptr.IntByReference)} instead
*/
//@Deprecated
//@Deprecated
//public static native int FRC_NetworkCommunication_nAICalibration_getOffset(int aiSystemIndex, int channel, Integer status);
/**
* Original signature : <code>int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t, const uint32_t, int32_t*)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\AICalibration.h:8</i>
*/
public static native int FRCNetworkCommunicationAICalibrationGetOffset(int aiSystemIndex, int channel, Integer status);
/**
* Original signature : <code>bool getModulePresence(tModuleType, uint8_t)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\LoadOut.h:14</i>
*/
public static native byte getModulePresence(int moduleType, byte moduleNumber);
/**
* Original signature : <code>tTargetClass getTargetClass()</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\LoadOut.h:25</i>
@@ -309,7 +304,7 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
* <i>native declaration : src\main\include\NetworkCommunication\symModuleLink.h:6</i><br>
* @deprecated use the safer methods {@link #moduleNameFindBySymbolName(java.lang.String, java.nio.ByteBuffer)} and {@link #moduleNameFindBySymbolName(com.sun.jna.Pointer, com.sun.jna.Pointer)} instead
*/
//@Deprecated
//@Deprecated
//public static native FRC_NetworkCommunicationsLibrary.STATUS moduleNameFindBySymbolName(Pointer symbol, Pointer module);
/**
* Original signature : <code>STATUS moduleNameFindBySymbolName(const char*, char*)</code><br>
@@ -320,7 +315,7 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
//public static native FRC_NetworkCommunicationsLibrary.STATUS moduleNameFindBySymbolName(String symbol, ByteBuffer module);
/**
* Report the usage of a resource of interest.
<br>
<br>
*
<br>
* @param resource one of the values in the tResourceType above (max value 51).
@@ -329,11 +324,11 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
<br>
* @param context an optional additional context number for some cases (such as module number). Set to 0 to omit.
<br>
* @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string.<br>
* @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string.<br>
* Original signature : <code>uint32_t report(tResourceType, uint8_t, uint8_t, const char*)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\UsageReporting.h:113</i><br>
* @deprecated use the safer methods {@link #report(int, byte, byte, java.lang.String)} and {@link #report(int, byte, byte, com.sun.jna.Pointer)} instead
*/
*/
//@Deprecated
//public static native int report(int resource, byte instanceNumber, byte context, Pointer feature);
/**
@@ -347,7 +342,7 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
<br>
* @param context an optional additional context number for some cases (such as module number). Set to 0 to omit.
<br>
* @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string.<br>
* @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string.<br>
* Original signature : <code>uint32_t report(tResourceType, uint8_t, uint8_t, const char*)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\UsageReporting.h:113</i>
*/
@@ -359,101 +354,55 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
*/
//@Deprecated
//public static native int FRC_NetworkCommunication_nUsageReporting_report(byte resource, byte instanceNumber, byte context, Pointer feature);
/**
/**
* Original signature : <code>uint32_t FRC_NetworkCommunication_nUsageReporting_report(uint8_t, uint8_t, uint8_t, const char*)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\UsageReporting.h:120</i>
*/
public static native int FRCNetworkCommunicationUsageReportingReport(byte resource, byte instanceNumber, byte context, String feature);
/**
* Original signature : <code>void getFPGAHardwareVersion(uint16_t*, uint32_t*)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:124</i><br>
* @deprecated use the safer methods {@link #getFPGAHardwareVersion(java.nio.ShortBuffer, java.nio.IntBuffer)} and {@link #getFPGAHardwareVersion(com.sun.jna.ptr.ShortByReference, com.sun.jna.ptr.IntByReference)} instead
*/
//@Deprecated
//public static native void getFPGAHardwareVersion(ShortByReference fpgaVersion, IntByReference fpgaRevision);
/**
* Original signature : <code>void getFPGAHardwareVersion(uint16_t*, uint32_t*)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:124</i>
*/
public static native void getFPGAHardwareVersion(ShortBuffer fpgaVersion, IntBuffer fpgaRevision);
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:124</i><br>
* @deprecated use the safer methods {@link #getFPGAHardwareVersion(java.nio.ShortBuffer, java.nio.IntBuffer)} and {@link #getFPGAHardwareVersion(com.sun.jna.ptr.ShortByReference, com.sun.jna.ptr.IntByReference)} instead
*/
//@Deprecated
//public static native void getFPGAHardwareVersion(ShortByReference fpgaVersion, IntByReference fpgaRevision);
/**
/**
* Original signature : <code>void getFPGAHardwareVersion(uint16_t*, uint32_t*)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:124</i>
*/
public static native void getFPGAHardwareVersion(ShortBuffer fpgaVersion, IntBuffer fpgaRevision);
/**
* Original signature : <code>int getRecentStatusData(uint8_t*, uint8_t*, uint8_t*, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:128</i><br>
* @deprecated use the safer methods {@link #getRecentStatusData(java.nio.ByteBuffer, java.nio.ByteBuffer, java.nio.ByteBuffer, int)} and {@link #getRecentStatusData(com.sun.jna.Pointer, com.sun.jna.Pointer, com.sun.jna.Pointer, int)} instead
*/
//@Deprecated
//public static native int getRecentStatusData(Pointer batteryInt, Pointer batteryDec, Pointer dsDigitalOut, int wait_ms);
/**
* Original signature : <code>int getRecentStatusData(uint8_t*, uint8_t*, uint8_t*, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:128</i>
*/
public static native int getRecentStatusData(ByteBuffer batteryInt, ByteBuffer batteryDec, ByteBuffer dsDigitalOut, int wait_ms);
/**
* Original signature : <code>int getDynamicControlData(uint8_t, char*, int32_t, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:128</i><br>
* @deprecated use the safer methods {@link #getRecentStatusData(java.nio.ByteBuffer, java.nio.ByteBuffer, java.nio.ByteBuffer, int)} and {@link #getRecentStatusData(com.sun.jna.Pointer, com.sun.jna.Pointer, com.sun.jna.Pointer, int)} instead
*/
//@Deprecated
//public static native int getRecentStatusData(Pointer batteryInt, Pointer batteryDec, Pointer dsDigitalOut, int wait_ms);
/**
/**
* Original signature : <code>int getRecentStatusData(uint8_t*, uint8_t*, uint8_t*, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:128</i>
*/
public static native int getRecentStatusData(ByteBuffer batteryInt, ByteBuffer batteryDec, ByteBuffer dsDigitalOut, int wait_ms);
/**
* Original signature : <code>int setStatusData(float, uint8_t, uint8_t, const char*, int, const char*, int, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:130</i><br>
* @deprecated use the safer methods {@link #setStatusData(float, byte, byte, java.lang.String, int, java.lang.String, int, int)} and {@link #setStatusData(float, byte, byte, com.sun.jna.Pointer, int, com.sun.jna.Pointer, int, int)} instead
*/
//@Deprecated
//public static native int setStatusData(float battery, byte dsDigitalOut, byte updateNumber, Pointer userDataHigh, int userDataHighLength, Pointer userDataLow, int userDataLowLength, int wait_ms);
/**
* Original signature : <code>int setStatusData(float, uint8_t, uint8_t, const char*, int, const char*, int, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:130</i>
*/
public static native int setStatusData(float battery, byte dsDigitalOut, byte updateNumber, String userDataHigh, int userDataHighLength, String userDataLow, int userDataLowLength);
/**
* Original signature : <code>int setStatusDataFloatAsInt(int, uint8_t, uint8_t, const char*, int, const char*, int, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:130</i><br>
* @deprecated use the safer methods {@link #setStatusData(float, byte, byte, java.lang.String, int, java.lang.String, int, int)} and {@link #setStatusData(float, byte, byte, com.sun.jna.Pointer, int, com.sun.jna.Pointer, int, int)} instead
*/
//@Deprecated
//public static native int setStatusData(float battery, byte dsDigitalOut, byte updateNumber, Pointer userDataHigh, int userDataHighLength, Pointer userDataLow, int userDataLowLength, int wait_ms);
/**
/**
* Original signature : <code>int setStatusData(float, uint8_t, uint8_t, const char*, int, const char*, int, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:130</i>
*/
public static native int setStatusData(float battery, byte dsDigitalOut, byte updateNumber, String userDataHigh, int userDataHighLength, String userDataLow, int userDataLowLength);
/**
* Original signature : <code>int setErrorData(const char*, int, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:136</i><br>
* @deprecated use the safer methods {@link #setErrorData(java.lang.String, int, int)} and {@link #setErrorData(com.sun.jna.Pointer, int, int)} instead
*/
//@Deprecated
//public static native int setErrorData(Pointer errors, int errorsLength, int wait_ms);
/**
* Original signature : <code>int setErrorData(const char*, int, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:136</i>
*/
public static native int setErrorData(String errors, int errorsLength, int wait_ms);
/**
* Original signature : <code>int setUserDsLcdData(const char*, int, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:136</i><br>
* @deprecated use the safer methods {@link #setErrorData(java.lang.String, int, int)} and {@link #setErrorData(com.sun.jna.Pointer, int, int)} instead
*/
//@Deprecated
//public static native int setErrorData(Pointer errors, int errorsLength, int wait_ms);
/**
/**
* Original signature : <code>int setErrorData(const char*, int, int)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:136</i>
*/
@@ -491,7 +440,7 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:154</i>
*/
public static native void setNewDataOccurRef(int refnum);
/**
/**
* Original signature : <code>void setResyncOccurRef(uint32_t)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:156</i>
*/
@@ -504,7 +453,43 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
//@Deprecated
//public static native void FRC_NetworkCommunication_getVersionString(Pointer version);
/**
* Original signature : <code>void FRC_NetworkCommunication_getVersionString(char*)</code><br>
* Original signature : <code>void FRC_NetworkCommunication_getVersionString(char*)</code><br>
* <i>native declaration : src\main\include\NetworkCommunication\FRCComm.h:159</i>
*/
public static native void FRCNetworkCommunicationGetVersionString(ByteBuffer version);
public static native void FRCNetworkCommunicationObserveUserProgramStarting();
public static native void FRCNetworkCommunicationObserveUserProgramDisabled();
public static native void FRCNetworkCommunicationObserveUserProgramAutonomous();
public static native void FRCNetworkCommunicationObserveUserProgramTeleop();
public static native void FRCNetworkCommunicationObserveUserProgramTest();
public static native void FRCNetworkCommunicationReserve();
private static native int NativeHALGetControlWord();
public static HALControlWord HALGetControlWord() {
int word = NativeHALGetControlWord();
return new HALControlWord(
(word & 1) != 0,
((word >> 2) & 1) != 0,
((word >> 3) & 1) != 0,
((word >> 4) & 1) != 0,
((word >> 5) & 1) != 0,
((word >> 6) & 1) != 0
);
}
private static native int NativeHALGetAllianceStation();
public static HALAllianceStationID HALGetAllianceStation() {
switch(NativeHALGetAllianceStation()) {
case 0:
return HALAllianceStationID.Red1;
case 1:
return HALAllianceStationID.Red2;
case 2:
return HALAllianceStationID.Red3;
case 3:
return HALAllianceStationID.Blue1;
case 4:
return HALAllianceStationID.Blue2;
case 5:
return HALAllianceStationID.Blue3;
default:
@@ -522,7 +507,7 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
}
public pthread_mutex_t() {
super();
}
}
};
public static class STATUS extends PointerType {
public STATUS(Pointer address) {
@@ -535,11 +520,11 @@ public class FRCNetworkCommunicationsLibrary extends JNIWrapper {
//
// JNI Testing
//
//
public static native void JNIValueParameterTest(boolean booleanValue, byte byteValue, char charValue, short shortValue, int intValue, long longValue, float floatValue, double doubleValue );
public static native boolean JNIValueReturnBooleanTest(boolean booleanValue);
public static native boolean JNIValueReturnBooleanTest(boolean booleanValue);
public static native byte JNIValueReturnByteTest(byte byteValue);
public static native char JNIValueReturnCharTest(char charValue);
public static native char JNIValueReturnCharTest(char charValue);
public static native short JNIValueReturnShortTest(short shortValue);
public static native int JNIValueReturnIntTest(int intValue);
public static native int JNIValueReturnIntTest(int intValue);
public static native long JNIValueReturnLongTest(long longValue);

View File

@@ -0,0 +1,10 @@
package edu.wpi.first.wpilibj.communication;
public enum HALAllianceStationID {
Red1,
Red2,
Red3,
Blue1,
Blue2,
Blue3
}

View File

@@ -0,0 +1,49 @@
package edu.wpi.first.wpilibj.communication;
/**
* A wrapper for the HALControlWord bitfield
*/
public class HALControlWord {
private boolean m_enabled;
private boolean m_autonomous;
private boolean m_test;
private boolean m_eStop;
private boolean m_fmsAttached;
private boolean m_dsAttached;
protected HALControlWord(boolean enabled, boolean autonomous, boolean test,
boolean eStop, boolean fmsAttached, boolean dsAttached) {
m_enabled = enabled;
m_autonomous = autonomous;
m_test = test;
m_eStop = eStop;
m_fmsAttached = fmsAttached;
m_dsAttached = dsAttached;
}
public boolean getEnabled() {
return m_enabled;
}
public boolean getAutonomous() {
return m_autonomous;
}
public boolean getTest() {
return m_test;
}
public boolean getEStop() {
return m_eStop;
}
public boolean getFMSAttached() {
return m_fmsAttached;
}
public boolean getDSAttached() {
return m_dsAttached;
}
}