#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.
Definition at line 20 of file Dashboard.h.
|
explicit |
Dashboard contructor.
This is only called once when the DriverStation constructor is called.
Definition at line 21 of file Dashboard.cpp.
|
virtual |
Dashboard destructor.
Called only when the DriverStation class is destroyed.
Definition at line 43 of file Dashboard.cpp.
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().
Definition at line 196 of file Dashboard.cpp.
void Dashboard::AddBoolean | ( | bool | value | ) |
Pack a boolean into the dashboard data structure.
value | Data to be packed into the structure. |
Definition at line 155 of file Dashboard.cpp.
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().
Definition at line 236 of file Dashboard.cpp.
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. |
Definition at line 143 of file Dashboard.cpp.
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. |
Definition at line 131 of file Dashboard.cpp.
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. |
Definition at line 71 of file Dashboard.cpp.
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. |
Definition at line 83 of file Dashboard.cpp.
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. |
Definition at line 59 of file Dashboard.cpp.
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. |
Definition at line 167 of file Dashboard.cpp.
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. |
Definition at line 177 of file Dashboard.cpp.
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. |
Definition at line 107 of file Dashboard.cpp.
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. |
Definition at line 119 of file Dashboard.cpp.
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. |
Definition at line 95 of file Dashboard.cpp.
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...
Definition at line 298 of file Dashboard.cpp.
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().
Definition at line 211 of file Dashboard.cpp.
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().
Definition at line 247 of file Dashboard.cpp.
|
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.
Definition at line 331 of file Dashboard.cpp.
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.
Definition at line 264 of file Dashboard.cpp.