#include <Dashboard.h>
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_t value) |
void | AddI16 (int16_t value) |
void | AddI32 (int32_t value) |
void | AddU8 (uint8_t value) |
void | AddU16 (uint16_t value) |
void | AddU32 (uint32_t value) |
void | AddFloat (float value) |
void | AddDouble (double value) |
void | AddBoolean (bool value) |
void | AddString (char *value) |
void | AddString (char *value, int32_t length) |
void | AddArray () |
void | FinalizeArray () |
void | AddCluster () |
void | FinalizeCluster () |
void | Printf (const char *writeFmt,...) |
int32_t | Finalize () |
void | GetStatusBuffer (char **userStatusData, int32_t *userStatusDataSize) |
void | Flush () |
Public Member Functions inherited from ErrorBase | |
virtual Error & | GetError () |
Retrieve the current error. Get the current error information associated with this sensor. | |
virtual const Error & | GetError () const |
virtual void | SetErrnoError (const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set error information associated with a C library call that set an error to the "errno" global variable. More... | |
virtual void | SetImaqError (int success, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated from the nivision Imaq API. More... | |
virtual void | SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | CloneError (ErrorBase *rhs) const |
virtual void | ClearError () const |
Clear the current error information associated with this sensor. | |
virtual bool | StatusIsFatal () const |
Check if the current error code represents a fatal error. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from ErrorBase | |
static void | SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) |
static void | SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) |
static Error & | GetGlobalError () |
Protected Member Functions inherited from ErrorBase | |
ErrorBase () | |
Initialize the instance status to 0 for now. | |
Protected Attributes inherited from ErrorBase | |
Error | m_error |
Static Protected Attributes inherited from ErrorBase | |
static SEM_ID | _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE) |
static Error | _globalError |
Pack data into the "user data" field that gets sent to the dashboard laptop via the driver station.
|
explicit |
Dashboard contructor.
This is only called once when the DriverStation constructor is called.
|
virtual |
Dashboard destructor.
Called only when the DriverStation class is destroyed.
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.
value | Data 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.
value | Data to be packed into the structure. |
void Dashboard::AddFloat | ( | float | value | ) |
Pack a 32-bit floating point number into the dashboard data structure.
value | Data to be packed into the structure. |
void Dashboard::AddI16 | ( | int16_t | value | ) |
Pack a signed 16-bit int into the dashboard data structure.
value | Data to be packed into the structure. |
void Dashboard::AddI32 | ( | int32_t | value | ) |
Pack a signed 32-bit int into the dashboard data structure.
value | Data to be packed into the structure. |
void Dashboard::AddI8 | ( | int8_t | value | ) |
Pack a signed 8-bit int into the dashboard data structure.
value | Data 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.
value | Data to be packed into the structure. |
void Dashboard::AddString | ( | char * | value, |
int32_t | length | ||
) |
Pack a string of 8-bit characters of specified length into the dashboard data structure.
value | Data to be packed into the structure. |
length | The number of bytes in the string to pack. |
void Dashboard::AddU16 | ( | uint16_t | value | ) |
Pack an unsigned 16-bit int into the dashboard data structure.
value | Data to be packed into the structure. |
void Dashboard::AddU32 | ( | uint32_t | value | ) |
Pack an unsigned 32-bit int into the dashboard data structure.
value | Data to be packed into the structure. |
void Dashboard::AddU8 | ( | uint8_t | value | ) |
Pack an unsigned 8-bit int into the dashboard data structure.
value | Data to be packed into the structure. |
int32_t 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...
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().
|
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.