Package edu.wpi.first.util.sendable
Interface SendableBuilder
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
NTSendableBuilder
- All Known Implementing Classes:
SendableBuilderImpl
public interface SendableBuilder extends AutoCloseable
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SendableBuilder.BackendKind
The backend kinds used for the sendable builder. -
Method Summary
Modifier and Type Method Description void
addBooleanArrayProperty(String key, Supplier<boolean[]> getter, Consumer<boolean[]> setter)
Add a boolean array property.void
addBooleanProperty(String key, BooleanSupplier getter, BooleanConsumer setter)
Add a boolean property.void
addCloseable(AutoCloseable closeable)
Adds a closeable.void
addDoubleArrayProperty(String key, Supplier<double[]> getter, Consumer<double[]> setter)
Add a double array property.void
addDoubleProperty(String key, DoubleSupplier getter, DoubleConsumer setter)
Add a double property.void
addFloatArrayProperty(String key, Supplier<float[]> getter, Consumer<float[]> setter)
Add a float array property.void
addFloatProperty(String key, FloatSupplier getter, FloatConsumer setter)
Add a float property.void
addIntegerArrayProperty(String key, Supplier<long[]> getter, Consumer<long[]> setter)
Add an integer array property.void
addIntegerProperty(String key, LongSupplier getter, LongConsumer setter)
Add an integer property.void
addRawProperty(String key, String typeString, Supplier<byte[]> getter, Consumer<byte[]> setter)
Add a raw property.void
addStringArrayProperty(String key, Supplier<String[]> getter, Consumer<String[]> setter)
Add a string array property.void
addStringProperty(String key, Supplier<String> getter, Consumer<String> setter)
Add a string property.void
clearProperties()
Clear properties.SendableBuilder.BackendKind
getBackendKind()
Gets the kind of backend being used.boolean
isPublished()
Return whether this sendable has been published.void
setActuator(boolean value)
Set a flag indicating if this Sendable should be treated as an actuator.void
setSafeState(Runnable func)
Set the function that should be called to set the Sendable into a safe state.void
setSmartDashboardType(String type)
Set the string representation of the named data type that will be used by the smart dashboard for this sendable.void
update()
Update the published values by calling the getters for all properties.
-
Method Details
-
setSmartDashboardType
Set the string representation of the named data type that will be used by the smart dashboard for this sendable.- Parameters:
type
- data type
-
setActuator
Set a flag indicating if this Sendable should be treated as an actuator. By default, this flag is false.- Parameters:
value
- true if actuator, false if not
-
setSafeState
Set the function that should be called to set the Sendable into a safe state. This is called when entering and exiting Live Window mode.- Parameters:
func
- function
-
addBooleanProperty
Add a boolean property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addIntegerProperty
Add an integer property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addFloatProperty
Add a float property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addDoubleProperty
Add a double property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addStringProperty
Add a string property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addBooleanArrayProperty
Add a boolean array property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addIntegerArrayProperty
Add an integer array property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addFloatArrayProperty
Add a float array property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addDoubleArrayProperty
Add a double array property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addStringArrayProperty
Add a string array property.- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
addRawProperty
void addRawProperty(String key, String typeString, Supplier<byte[]> getter, Consumer<byte[]> setter)Add a raw property.- Parameters:
key
- property nametypeString
- type stringgetter
- getter function (returns current value)setter
- setter function (sets new value)
-
getBackendKind
Gets the kind of backend being used.- Returns:
- Backend kind
-
isPublished
boolean isPublished()Return whether this sendable has been published.- Returns:
- True if it has been published, false if not.
-
update
void update()Update the published values by calling the getters for all properties. -
clearProperties
void clearProperties()Clear properties. -
addCloseable
Adds a closeable. The closeable.close() will be called when close() is called.- Parameters:
closeable
- closeable object
-