WPILibC++ 2025.1.1
|
Go to the source code of this file.
Functions | |
struct WPI_DataLog * | WPI_DataLog_CreateWriter (const struct WPI_String *filename, int *errorCode, const struct WPI_String *extraHeader) |
Construct a new Data Log. | |
struct WPI_DataLog * | WPI_DataLog_CreateBackgroundWriter (const struct WPI_String *dir, const struct WPI_String *filename, double period, const struct WPI_String *extraHeader) |
Construct a new Data Log background writer. | |
struct WPI_DataLog * | WPI_DataLog_CreateBackgroundWriter_Func (void(*write)(void *ptr, const uint8_t *data, size_t len), void *ptr, double period, const struct WPI_String *extraHeader) |
Construct a new Data Log background writer that passes its output to the provided function rather than a file. | |
void | WPI_DataLog_SetBackgroundWriterFilename (struct WPI_DataLog *datalog, const struct WPI_String *filename) |
Change log filename. | |
void | WPI_DataLog_Release (struct WPI_DataLog *datalog) |
Releases a data log object. | |
void | WPI_DataLog_Flush (struct WPI_DataLog *datalog) |
Explicitly flushes the log data to disk. | |
void | WPI_DataLog_Pause (struct WPI_DataLog *datalog) |
Pauses appending of data records to the log. | |
void | WPI_DataLog_Resume (struct WPI_DataLog *datalog) |
Resumes appending of data records to the log. | |
void | WPI_DataLog_Stop (struct WPI_DataLog *datalog) |
Stops appending all records to the log, and closes the log file. | |
int | WPI_DataLog_Start (struct WPI_DataLog *datalog, const struct WPI_String *name, const struct WPI_String *type, const struct WPI_String *metadata, int64_t timestamp) |
Start an entry. | |
void | WPI_DataLog_Finish (struct WPI_DataLog *datalog, int entry, int64_t timestamp) |
Finish an entry. | |
void | WPI_DataLog_SetMetadata (struct WPI_DataLog *datalog, int entry, const struct WPI_String *metadata, int64_t timestamp) |
Updates the metadata for an entry. | |
void | WPI_DataLog_AppendRaw (struct WPI_DataLog *datalog, int entry, const uint8_t *data, size_t len, int64_t timestamp) |
Appends a raw record to the log. | |
void | WPI_DataLog_AppendBoolean (struct WPI_DataLog *datalog, int entry, int value, int64_t timestamp) |
Appends a boolean record to the log. | |
void | WPI_DataLog_AppendInteger (struct WPI_DataLog *datalog, int entry, int64_t value, int64_t timestamp) |
Appends an integer record to the log. | |
void | WPI_DataLog_AppendFloat (struct WPI_DataLog *datalog, int entry, float value, int64_t timestamp) |
Appends a float record to the log. | |
void | WPI_DataLog_AppendDouble (struct WPI_DataLog *datalog, int entry, double value, int64_t timestamp) |
Appends a double record to the log. | |
void | WPI_DataLog_AppendString (struct WPI_DataLog *datalog, int entry, const struct WPI_String *value, int64_t timestamp) |
Appends a string record to the log. | |
void | WPI_DataLog_AppendBooleanArray (struct WPI_DataLog *datalog, int entry, const int *arr, size_t len, int64_t timestamp) |
Appends a boolean array record to the log. | |
void | WPI_DataLog_AppendBooleanArrayByte (struct WPI_DataLog *datalog, int entry, const uint8_t *arr, size_t len, int64_t timestamp) |
Appends a boolean array record to the log. | |
void | WPI_DataLog_AppendIntegerArray (struct WPI_DataLog *datalog, int entry, const int64_t *arr, size_t len, int64_t timestamp) |
Appends an integer array record to the log. | |
void | WPI_DataLog_AppendFloatArray (struct WPI_DataLog *datalog, int entry, const float *arr, size_t len, int64_t timestamp) |
Appends a float array record to the log. | |
void | WPI_DataLog_AppendDoubleArray (struct WPI_DataLog *datalog, int entry, const double *arr, size_t len, int64_t timestamp) |
Appends a double array record to the log. | |
void | WPI_DataLog_AppendStringArray (struct WPI_DataLog *datalog, int entry, const struct WPI_String *arr, size_t len, int64_t timestamp) |
Appends a string array record to the log. | |
void | WPI_DataLog_AddSchemaString (struct WPI_DataLog *datalog, const struct WPI_String *name, const struct WPI_String *type, const struct WPI_String *schema, int64_t timestamp) |
void | WPI_DataLog_AddSchema (struct WPI_DataLog *datalog, const struct WPI_String *name, const struct WPI_String *type, const uint8_t *schema, size_t schema_len, int64_t timestamp) |
void WPI_DataLog_AddSchema | ( | struct WPI_DataLog * | datalog, |
const struct WPI_String * | name, | ||
const struct WPI_String * | type, | ||
const uint8_t * | schema, | ||
size_t | schema_len, | ||
int64_t | timestamp ) |
void WPI_DataLog_AddSchemaString | ( | struct WPI_DataLog * | datalog, |
const struct WPI_String * | name, | ||
const struct WPI_String * | type, | ||
const struct WPI_String * | schema, | ||
int64_t | timestamp ) |
void WPI_DataLog_AppendBoolean | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
int | value, | ||
int64_t | timestamp ) |
Appends a boolean record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
value | Boolean value to record |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendBooleanArray | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const int * | arr, | ||
size_t | len, | ||
int64_t | timestamp ) |
Appends a boolean array record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
arr | Boolean array to record |
len | Number of elements in array |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendBooleanArrayByte | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const uint8_t * | arr, | ||
size_t | len, | ||
int64_t | timestamp ) |
Appends a boolean array record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
arr | Boolean array to record |
len | Number of elements in array |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendDouble | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
double | value, | ||
int64_t | timestamp ) |
Appends a double record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
value | Double value to record |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendDoubleArray | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const double * | arr, | ||
size_t | len, | ||
int64_t | timestamp ) |
Appends a double array record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
arr | Double array to record |
len | Number of elements in array |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendFloat | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
float | value, | ||
int64_t | timestamp ) |
Appends a float record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
value | Float value to record |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendFloatArray | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const float * | arr, | ||
size_t | len, | ||
int64_t | timestamp ) |
Appends a float array record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
arr | Float array to record |
len | Number of elements in array |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendInteger | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
int64_t | value, | ||
int64_t | timestamp ) |
Appends an integer record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
value | Integer value to record |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendIntegerArray | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const int64_t * | arr, | ||
size_t | len, | ||
int64_t | timestamp ) |
Appends an integer array record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
arr | Integer array to record |
len | Number of elements in array |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendRaw | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const uint8_t * | data, | ||
size_t | len, | ||
int64_t | timestamp ) |
Appends a raw record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
data | Byte array to record |
len | Length of byte array |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendString | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const struct WPI_String * | value, | ||
int64_t | timestamp ) |
Appends a string record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
value | String value to record |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_AppendStringArray | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const struct WPI_String * | arr, | ||
size_t | len, | ||
int64_t | timestamp ) |
Appends a string array record to the log.
datalog | data log |
entry | Entry index, as returned by WPI_DataLog_Start() |
arr | String array to record |
len | Number of elements in array |
timestamp | Time stamp (may be 0 to indicate now) |
struct WPI_DataLog * WPI_DataLog_CreateBackgroundWriter | ( | const struct WPI_String * | dir, |
const struct WPI_String * | filename, | ||
double | period, | ||
const struct WPI_String * | extraHeader ) |
Construct a new Data Log background writer.
The log will be initially created with a temporary filename.
dir | directory to store the log |
filename | filename to use; if none provided, a random filename is generated of the form "wpilog_{}.wpilog" |
period | time between automatic flushes to disk, in seconds; this is a time/storage tradeoff |
extraHeader | extra header data |
struct WPI_DataLog * WPI_DataLog_CreateBackgroundWriter_Func | ( | void(* | write )(void *ptr, const uint8_t *data, size_t len), |
void * | ptr, | ||
double | period, | ||
const struct WPI_String * | extraHeader ) |
Construct a new Data Log background writer that passes its output to the provided function rather than a file.
The write function will be called on a separate background thread and may block. The write function is called with an empty data array (data=NULL, len=0) when the thread is terminating.
write | write function |
ptr | pointer to pass to write function ptr parameter |
period | time between automatic calls to write, in seconds; this is a time/storage tradeoff |
extraHeader | extra header data |
struct WPI_DataLog * WPI_DataLog_CreateWriter | ( | const struct WPI_String * | filename, |
int * | errorCode, | ||
const struct WPI_String * | extraHeader ) |
Construct a new Data Log.
filename | filename to use |
errorCode | error if file failed to open (output) |
extraHeader | extra header data |
void WPI_DataLog_Finish | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
int64_t | timestamp ) |
Finish an entry.
datalog | data log |
entry | Entry index |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_Flush | ( | struct WPI_DataLog * | datalog | ) |
Explicitly flushes the log data to disk.
datalog | data log |
void WPI_DataLog_Pause | ( | struct WPI_DataLog * | datalog | ) |
Pauses appending of data records to the log.
While paused, no data records are saved (e.g. AppendX is a no-op). Has no effect on entry starts / finishes / metadata changes.
datalog | data log |
void WPI_DataLog_Release | ( | struct WPI_DataLog * | datalog | ) |
Releases a data log object.
Closes the file and returns resources to the system.
datalog | data log |
void WPI_DataLog_Resume | ( | struct WPI_DataLog * | datalog | ) |
Resumes appending of data records to the log.
If called after Stop(), opens a new file (with random name if SetFilename was not called after Stop()) and appends Start records and schema data values for all previously started entries and schemas.
datalog | data log |
void WPI_DataLog_SetBackgroundWriterFilename | ( | struct WPI_DataLog * | datalog, |
const struct WPI_String * | filename ) |
Change log filename.
Can only be used on background writer data logs.
datalog | data log |
filename | filename |
void WPI_DataLog_SetMetadata | ( | struct WPI_DataLog * | datalog, |
int | entry, | ||
const struct WPI_String * | metadata, | ||
int64_t | timestamp ) |
Updates the metadata for an entry.
datalog | data log |
entry | Entry index |
metadata | New metadata for the entry |
timestamp | Time stamp (may be 0 to indicate now) |
int WPI_DataLog_Start | ( | struct WPI_DataLog * | datalog, |
const struct WPI_String * | name, | ||
const struct WPI_String * | type, | ||
const struct WPI_String * | metadata, | ||
int64_t | timestamp ) |
Start an entry.
Duplicate names are allowed (with the same type), and result in the same index being returned (Start/Finish are reference counted). A duplicate name with a different type will result in an error message being printed to the console and 0 being returned (which will be ignored by the Append functions).
datalog | data log |
name | Name |
type | Data type |
metadata | Initial metadata (e.g. data properties) |
timestamp | Time stamp (may be 0 to indicate now) |
void WPI_DataLog_Stop | ( | struct WPI_DataLog * | datalog | ) |
Stops appending all records to the log, and closes the log file.
datalog | data log |