mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[wpiutil] Add C API for DataLog (#5509)
This commit is contained in:
@@ -588,6 +588,27 @@ void NT_SetNow(int64_t timestamp) {
|
||||
nt::SetNow(timestamp);
|
||||
}
|
||||
|
||||
NT_DataLogger NT_StartEntryDataLog(NT_Inst inst, struct WPI_DataLog* log,
|
||||
const char* prefix, const char* logPrefix) {
|
||||
return nt::StartEntryDataLog(inst, *reinterpret_cast<wpi::log::DataLog*>(log),
|
||||
prefix, logPrefix);
|
||||
}
|
||||
|
||||
void NT_StopEntryDataLog(NT_DataLogger logger) {
|
||||
nt::StopEntryDataLog(logger);
|
||||
}
|
||||
|
||||
NT_ConnectionDataLogger NT_StartConnectionDataLog(NT_Inst inst,
|
||||
struct WPI_DataLog* log,
|
||||
const char* name) {
|
||||
return nt::StartConnectionDataLog(
|
||||
inst, *reinterpret_cast<wpi::log::DataLog*>(log), name);
|
||||
}
|
||||
|
||||
void NT_StopConnectionDataLog(NT_ConnectionDataLogger logger) {
|
||||
nt::StopConnectionDataLog(logger);
|
||||
}
|
||||
|
||||
NT_Listener NT_AddLogger(NT_Inst inst, unsigned int min_level,
|
||||
unsigned int max_level, void* data,
|
||||
NT_ListenerCallback func) {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct WPI_DataLog;
|
||||
|
||||
/**
|
||||
* @defgroup ntcore_c_api ntcore C API
|
||||
*
|
||||
@@ -1347,6 +1349,54 @@ void NT_SetNow(int64_t timestamp);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup ntcore_data_logger_cfunc Data Logger Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Starts logging entry changes to a DataLog.
|
||||
*
|
||||
* @param inst instance handle
|
||||
* @param log data log object; lifetime must extend until StopEntryDataLog is
|
||||
* called or the instance is destroyed
|
||||
* @param prefix only store entries with names that start with this prefix;
|
||||
* the prefix is not included in the data log entry name
|
||||
* @param logPrefix prefix to add to data log entry names
|
||||
* @return Data logger handle
|
||||
*/
|
||||
NT_DataLogger NT_StartEntryDataLog(NT_Inst inst, struct WPI_DataLog* log,
|
||||
const char* prefix, const char* logPrefix);
|
||||
|
||||
/**
|
||||
* Stops logging entry changes to a DataLog.
|
||||
*
|
||||
* @param logger data logger handle
|
||||
*/
|
||||
void NT_StopEntryDataLog(NT_DataLogger logger);
|
||||
|
||||
/**
|
||||
* Starts logging connection changes to a DataLog.
|
||||
*
|
||||
* @param inst instance handle
|
||||
* @param log data log object; lifetime must extend until StopConnectionDataLog
|
||||
* is called or the instance is destroyed
|
||||
* @param name data log entry name
|
||||
* @return Data logger handle
|
||||
*/
|
||||
NT_ConnectionDataLogger NT_StartConnectionDataLog(NT_Inst inst,
|
||||
struct WPI_DataLog* log,
|
||||
const char* name);
|
||||
|
||||
/**
|
||||
* Stops logging connection changes to a DataLog.
|
||||
*
|
||||
* @param logger data logger handle
|
||||
*/
|
||||
void NT_StopConnectionDataLog(NT_ConnectionDataLogger logger);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup ntcore_logger_cfunc Logger Functions
|
||||
* @{
|
||||
|
||||
Reference in New Issue
Block a user