WPILib 2012
WPILibRoboticsLibraryforFRC
Public Types | Public Member Functions
Dashboard Class Reference

#include <Dashboard.h>

Inheritance diagram for Dashboard:
DashboardBase ErrorBase

List of all members.

Public Types

enum  Type {
  kI8, kI16, kI32, kU8,
  kU16, kU32, kFloat, kDouble,
  kBoolean, kString, kOther
}
enum  ComplexType { kArray, kCluster }

Public Member Functions

 Dashboard (SEM_ID statusDataSemaphore)
virtual ~Dashboard ()
void AddI8 (INT8 value)
void AddI16 (INT16 value)
void AddI32 (INT32 value)
void AddU8 (UINT8 value)
void AddU16 (UINT16 value)
void AddU32 (UINT32 value)
void AddFloat (float value)
void AddDouble (double value)
void AddBoolean (bool value)
void AddString (char *value)
void AddString (char *value, INT32 length)
void AddArray ()
void FinalizeArray ()
void AddCluster ()
void FinalizeCluster ()
void Printf (const char *writeFmt,...)
INT32 Finalize ()
void GetStatusBuffer (char **userStatusData, INT32 *userStatusDataSize)
void Flush ()

Detailed Description

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


Constructor & Destructor Documentation

Dashboard::Dashboard ( SEM_ID  statusDataSem) [explicit]

Dashboard contructor.

This is only called once when the DriverStation constructor is called.

Dashboard::~Dashboard ( ) [virtual]

Dashboard destructor.

Called only when the DriverStation class is destroyed.


Member Function Documentation

void Dashboard::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().

void Dashboard::AddBoolean ( bool  value)

Pack a boolean into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::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().

void Dashboard::AddDouble ( double  value)

Pack a 64-bit floating point number into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::AddFloat ( float  value)

Pack a 32-bit floating point number into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::AddI16 ( INT16  value)

Pack a signed 16-bit int into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::AddI32 ( INT32  value)

Pack a signed 32-bit int into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::AddI8 ( INT8  value)

Pack a signed 8-bit int into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::AddString ( char *  value)

Pack a NULL-terminated string of 8-bit characters into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::AddString ( char *  value,
INT32  length 
)

Pack a string of 8-bit characters of specified length into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
lengthThe number of bytes in the string to pack.
void Dashboard::AddU16 ( UINT16  value)

Pack an unsigned 16-bit int into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::AddU32 ( UINT32  value)

Pack an unsigned 32-bit int into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
void Dashboard::AddU8 ( UINT8  value)

Pack an unsigned 8-bit int into the dashboard data structure.

Parameters:
valueData to be packed into the structure.
INT32 Dashboard::Finalize ( )

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 Finalize() 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...

Returns:
The total size of the data packed into the userData field of the status packet.
void Dashboard::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().

void Dashboard::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().

void Dashboard::GetStatusBuffer ( char **  userStatusData,
INT32 *  userStatusDataSize 
) [virtual]

Called by the DriverStation class to retrieve buffers, sizes, etc. for writing to the NetworkCommunication task. This function is called while holding the m_statusDataSemaphore.

Implements DashboardBase.

void Dashboard::Printf ( const char *  writeFmt,
  ... 
)

Print a string to the UserData text on the Dashboard.

This will add text to the buffer to send to the dashboard. You must call Finalize() periodically to actually send the buffer to the dashboard if you are not using the packed dashboard data.


The documentation for this class was generated from the following files:
 All Classes Functions Variables