edu.wpi.first.wpilibj
Class Dashboard

java.lang.Object
  extended by edu.wpi.first.wpilibj.Dashboard
All Implemented Interfaces:
IDashboard, IDevice, IInputOutput

public class Dashboard
extends java.lang.Object
implements IDashboard, IInputOutput

Pack data into the "user data" field that gets sent to the dashboard laptop via the driver station.


Nested Class Summary
protected  class Dashboard.MemAccess
           
 
Field Summary
protected  Dashboard.MemAccess m_userStatus
           
protected  int m_userStatusSize
           
 
Constructor Summary
protected Dashboard(java.lang.Object statusDataSemaphore)
          Dashboard constructor.
 
Method Summary
 boolean addArray()
          Start an array in the packed dashboard data structure.
 boolean addBoolean(boolean value)
          Pack a boolean into the dashboard data structure.
 boolean addByte(byte value)
          Pack a signed 8-bit int into the dashboard data structure.
 boolean addCluster()
          Start a cluster in the packed dashboard data structure.
 boolean addDouble(double value)
          Pack a 64-bit floating point number into the dashboard data structure.
 boolean addFloat(float value)
          Pack a 32-bit floating point number into the dashboard data structure.
 boolean addInt(int value)
          Pack a signed 32-bit int into the dashboard data structure.
 boolean addShort(short value)
          Pack a signed 16-bit int into the dashboard data structure.
 boolean addString(java.lang.String value)
          Pack a NULL-terminated string of 8-bit characters into the dashboard data structure.
 boolean addString(java.lang.String value, int length)
          Pack a string of 8-bit characters of specified length into the dashboard data structure.
 int commit()
          Indicate that the packing is complete and commit the buffer to the DriverStation.
 boolean finalizeArray()
          Indicate the end of an array packed into the dashboard data structure.
 boolean finalizeCluster()
          Indicate the end of a cluster packed into the dashboard data structure.
 void flush()
          If the dashboard had data buffered to be sent, calling this method will reset the output buffer.
 byte[] getBytes()
          Gets a reference to the current data to be sent to the dashboard.
 int getBytesLength()
          Gets the length of the current data to be sent to the dashboard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_userStatus

protected Dashboard.MemAccess m_userStatus

m_userStatusSize

protected int m_userStatusSize
Constructor Detail

Dashboard

protected Dashboard(java.lang.Object statusDataSemaphore)
Dashboard constructor. This is only called once when the DriverStation constructor is called.

Parameters:
statusDataSemaphore - the object to synchronize on
Method Detail

addByte

public boolean addByte(byte value)
Pack a signed 8-bit int into the dashboard data structure.

Parameters:
value - Data to be packed into the structure.
Returns:
True on success

addShort

public boolean addShort(short value)
Pack a signed 16-bit int into the dashboard data structure.

Parameters:
value - Data to be packed into the structure.
Returns:
True on success

addInt

public boolean addInt(int value)
Pack a signed 32-bit int into the dashboard data structure.

Parameters:
value - Data to be packed into the structure.
Returns:
True on success

addFloat

public boolean addFloat(float value)
Pack a 32-bit floating point number into the dashboard data structure.

Parameters:
value - Data to be packed into the structure.
Returns:
True on success

addDouble

public boolean addDouble(double value)
Pack a 64-bit floating point number into the dashboard data structure.

Parameters:
value - Data to be packed into the structure.
Returns:
True on success

addBoolean

public boolean addBoolean(boolean value)
Pack a boolean into the dashboard data structure.

Parameters:
value - Data to be packed into the structure.
Returns:
True on success

addString

public boolean addString(java.lang.String value)
Pack a NULL-terminated string of 8-bit characters into the dashboard data structure.

Parameters:
value - Data to be packed into the structure.
Returns:
True on success

addString

public boolean addString(java.lang.String value,
                         int length)
Pack a string of 8-bit characters of specified length into the dashboard data structure.

Parameters:
value - Data to be packed into the structure.
length - The number of bytes in the string to pack.
Returns:
True on success

addArray

public boolean addArray()
Start an array in the packed dashboard data structure. After calling addArray(), call the appropriate Add method for each element of the array. Make sure you call the same add each time. An array must contain elements of the same type. You can use clusters inside of arrays to make each element of the array contain a structure of values. You can also nest arrays inside of other arrays. Every call to addArray() must have a matching call to finalizeArray().

Returns:
True on success

finalizeArray

public boolean finalizeArray()
Indicate the end of an array packed into the dashboard data structure. After packing data into the array, call finalizeArray(). Every call to addArray() must have a matching call to finalizeArray().

Returns:
True on success

addCluster

public boolean addCluster()
Start a cluster in the packed dashboard data structure. After calling addCluster(), call the appropriate Add method for each element of the cluster. You can use clusters inside of arrays to make each element of the array contain a structure of values. Every call to addCluster() must have a matching call to finalizeCluster().

Returns:
True on success

finalizeCluster

public boolean finalizeCluster()
Indicate the end of a cluster packed into the dashboard data structure. After packing data into the cluster, call finalizeCluster(). Every call to addCluster() must have a matching call to finalizeCluster

Returns:
True on success

commit

public int commit()
Indicate that the packing is complete and commit the buffer to the DriverStation. The packing of the dashboard packet is complete. If you are not using the packed dashboard data, you can call commit() to commit the Printf() buffer and the error string buffer. In effect, you are packing an empty structure. Prepares a packet to go to the dashboard... Pack the sequence number, Printf() buffer, the errors messages (not implemented yet), and packed dashboard data buffer.

Returns:
The total size of the data packed into the userData field of the status packet.

getBytes

public byte[] getBytes()
Description copied from interface: IDashboard
Gets a reference to the current data to be sent to the dashboard.

Specified by:
getBytes in interface IDashboard
Returns:
Byte array of data.

getBytesLength

public int getBytesLength()
Description copied from interface: IDashboard
Gets the length of the current data to be sent to the dashboard.

Specified by:
getBytesLength in interface IDashboard
Returns:
The length of the data array to be sent to the dashboard.

flush

public void flush()
Description copied from interface: IDashboard
If the dashboard had data buffered to be sent, calling this method will reset the output buffer.

Specified by:
flush in interface IDashboard