Package edu.wpi.first.util.sendable
Class SendableRegistry
java.lang.Object
edu.wpi.first.util.sendable.SendableRegistry
The SendableRegistry class is the public interface for registering sensors and actuators for use
on dashboards and LiveWindow.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Data passed to foreachLiveWindow() callback function. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds an object to the registry.static void
Adds an object to the registry.static void
Adds an object to the registry.static void
Adds an object to the registry.static void
Adds a child object to an object.static void
Adds an object to the registry and LiveWindow.static void
Adds an object to the registry and LiveWindow.static void
Adds an object to the registry and LiveWindow.static void
Adds an object to the registry and LiveWindow.static boolean
Determines if an object is in the registry.static void
disableLiveWindow
(Sendable sendable) Disables LiveWindow for an object.static void
enableLiveWindow
(Sendable sendable) Enables LiveWindow for an object.static void
foreachLiveWindow
(int dataHandle, Consumer<SendableRegistry.CallbackData> callback) Iterates over LiveWindow-enabled objects in the registry.static Object
Gets arbitrary data associated with an object in the registry.static int
Gets a unique handle for setting/getting data with setData() and getData().static String
Gets the name of an object.static String
getSubsystem
(Sendable sendable) Gets the subsystem name of an object.static void
publish
(Sendable sendable, SendableBuilder builder) Publishes an object in the registry to a builder.static boolean
Removes an object from the registry.static AutoCloseable
setData
(Sendable sendable, int handle, AutoCloseable data) Associates arbitrary data with an object in the registry.static void
Sets the factory for LiveWindow builders.static void
Sets the name of an object.static void
Sets the name of an object with a channel number.static void
Sets the name of an object with a module and channel number.static void
Sets both the subsystem name and device name of an object.static void
setSubsystem
(Sendable sendable, String subsystem) Sets the subsystem name of an object.static void
Updates network table information from an object.
-
Method Details
-
setLiveWindowBuilderFactory
Sets the factory for LiveWindow builders.- Parameters:
factory
- factory function
-
add
Adds an object to the registry.- Parameters:
sendable
- object to addname
- component name
-
add
Adds an object to the registry.- Parameters:
sendable
- object to addmoduleType
- A string that defines the module name in the label for the valuechannel
- The channel number the device is plugged into
-
add
Adds an object to the registry.- Parameters:
sendable
- object to addmoduleType
- A string that defines the module name in the label for the valuemoduleNumber
- The number of the particular module typechannel
- The channel number the device is plugged into
-
add
Adds an object to the registry.- Parameters:
sendable
- object to addsubsystem
- subsystem namename
- component name
-
addLW
Adds an object to the registry and LiveWindow.- Parameters:
sendable
- object to addname
- component name
-
addLW
Adds an object to the registry and LiveWindow.- Parameters:
sendable
- object to addmoduleType
- A string that defines the module name in the label for the valuechannel
- The channel number the device is plugged into
-
addLW
Adds an object to the registry and LiveWindow.- Parameters:
sendable
- object to addmoduleType
- A string that defines the module name in the label for the valuemoduleNumber
- The number of the particular module typechannel
- The channel number the device is plugged into
-
addLW
Adds an object to the registry and LiveWindow.- Parameters:
sendable
- object to addsubsystem
- subsystem namename
- component name
-
addChild
Adds a child object to an object. Adds the child object to the registry if it's not already present.- Parameters:
parent
- parent objectchild
- child object
-
remove
Removes an object from the registry.- Parameters:
sendable
- object to remove- Returns:
- true if the object was removed; false if it was not present
-
contains
Determines if an object is in the registry.- Parameters:
sendable
- object to check- Returns:
- True if in registry, false if not.
-
getName
Gets the name of an object.- Parameters:
sendable
- object- Returns:
- Name (empty if object is not in registry)
-
setName
Sets the name of an object.- Parameters:
sendable
- objectname
- name
-
setName
Sets the name of an object with a channel number.- Parameters:
sendable
- objectmoduleType
- A string that defines the module name in the label for the valuechannel
- The channel number the device is plugged into
-
setName
Sets the name of an object with a module and channel number.- Parameters:
sendable
- objectmoduleType
- A string that defines the module name in the label for the valuemoduleNumber
- The number of the particular module typechannel
- The channel number the device is plugged into
-
setName
Sets both the subsystem name and device name of an object.- Parameters:
sendable
- objectsubsystem
- subsystem namename
- device name
-
getSubsystem
Gets the subsystem name of an object.- Parameters:
sendable
- object- Returns:
- Subsystem name (empty if object is not in registry)
-
setSubsystem
Sets the subsystem name of an object.- Parameters:
sendable
- objectsubsystem
- subsystem name
-
getDataHandle
Gets a unique handle for setting/getting data with setData() and getData().- Returns:
- Handle
-
setData
Associates arbitrary data with an object in the registry.- Parameters:
sendable
- objecthandle
- data handle returned by getDataHandle()data
- data to set- Returns:
- Previous data (may be null). If non-null, caller is responsible for calling close().
-
getData
Gets arbitrary data associated with an object in the registry.- Parameters:
sendable
- objecthandle
- data handle returned by getDataHandle()- Returns:
- data (may be null if none associated)
-
enableLiveWindow
Enables LiveWindow for an object.- Parameters:
sendable
- object
-
disableLiveWindow
Disables LiveWindow for an object.- Parameters:
sendable
- object
-
publish
Publishes an object in the registry to a builder.- Parameters:
sendable
- objectbuilder
- sendable builder
-
update
Updates network table information from an object.- Parameters:
sendable
- object
-
foreachLiveWindow
public static void foreachLiveWindow(int dataHandle, Consumer<SendableRegistry.CallbackData> callback) Iterates over LiveWindow-enabled objects in the registry. It is *not* safe to call other SendableRegistry functions from the callback.- Parameters:
dataHandle
- data handle to get data object passed to callbackcallback
- function to call for each object
-