Class TelemetryRegistry
java.lang.Object
org.wpilib.telemetry.TelemetryRegistry
Global registry for telemetry handlers (type handlers and telemetry backends).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceHandler for logging objects of specific type. -
Method Summary
Modifier and TypeMethodDescriptionstatic TelemetryBackendgetBackend(String path) Gets the backend for logging an object.static BiConsumer<String, String> Get function used for reporting warning messages.static TelemetryTableGet a telemetry table for a particular name.static <T> TelemetryRegistry.TypeHandler<T> getTypeHandler(T value) Gets the handler for logging an object.static voidregisterBackend(String prefix, TelemetryBackend backend) Registers a backend for creating telemetry entries.static <T> voidregisterTypeHandler(Class<T> cls, TelemetryRegistry.TypeHandler<T> handler) Registers a handler for logging objects of a particular type.static voidreportWarning(String path, String msg) Report a warning message (e.g.static voidreset()Clear all registered types and backends and closes all entries.static voidsetReportWarning(BiConsumer<String, String> func) Set function used for reporting warning messages (e.g.
-
Method Details
-
setReportWarning
Set function used for reporting warning messages (e.g. type mismatches).The reporting function may be called concurrently and must not throw.
- Parameters:
func- reporting function; parameters are path and message; pass null to use default
-
getReportWarning
Get function used for reporting warning messages.- Returns:
- reporting function
-
reportWarning
-
registerTypeHandler
Registers a handler for logging objects of a particular type. The handler should populate the provided TelemetryTable name as appropriate for the object's data.- Type Parameters:
T- class- Parameters:
cls- class objecthandler- handler (accepts TelemetryTable, entry name, and object)
-
registerBackend
Registers a backend for creating telemetry entries. When calling getEntry(), the longest prefix match is used.- Parameters:
prefix- prefix for entries covered by this backendbackend- backend
-
getTypeHandler
Gets the handler for logging an object. Should generally only be used by TelemetryTable.- Type Parameters:
T- class- Parameters:
value- value- Returns:
- handler or null if no match
-
getBackend
Gets the backend for logging an object. Should generally only be used internally or by custom backends.- Parameters:
path- full name- Returns:
- telemetry backend, or a discard backend if no match
-
getTable
Get a telemetry table for a particular name.- Parameters:
path- full name- Returns:
- telemetry table
-
reset
public static void reset()Clear all registered types and backends and closes all entries. Should typically only be used by unit test code.
-