Class SendableBuilderImpl
java.lang.Object
edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl
- All Implemented Interfaces:
NTSendableBuilder,SendableBuilder,AutoCloseable
Implementation detail for SendableBuilder.
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.wpi.first.util.sendable.SendableBuilder
SendableBuilder.BackendKind -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBooleanArrayProperty(String key, Supplier<boolean[]> getter, Consumer<boolean[]> setter) Add a boolean array property.voidaddBooleanProperty(String key, BooleanSupplier getter, BooleanConsumer setter) Add a boolean property.voidaddCloseable(AutoCloseable closeable) Adds a closeable.voidaddDoubleArrayProperty(String key, Supplier<double[]> getter, Consumer<double[]> setter) Add a double array property.voidaddDoubleProperty(String key, DoubleSupplier getter, DoubleConsumer setter) Add a double property.voidaddFloatArrayProperty(String key, Supplier<float[]> getter, Consumer<float[]> setter) Add a float array property.voidaddFloatProperty(String key, FloatSupplier getter, FloatConsumer setter) Add a float property.voidaddIntegerArrayProperty(String key, Supplier<long[]> getter, Consumer<long[]> setter) Add an integer array property.voidaddIntegerProperty(String key, LongSupplier getter, LongConsumer setter) Add an integer property.voidaddRawProperty(String key, String typeString, Supplier<byte[]> getter, Consumer<byte[]> setter) Add a raw property.voidAdd a string array property.voidAdd a string property.voidClear properties.voidclose()getTable()Get the network table.Add a property without getters or setters.booleanReturn whether this sendable should be treated as an actuator.booleanReturn whether this sendable has an associated table.voidpublishConstBoolean(String key, boolean value) Add a constant boolean property.voidpublishConstBooleanArray(String key, boolean[] value) Add a constant boolean array property.voidpublishConstDouble(String key, double value) Add a constant double property.voidpublishConstDoubleArray(String key, double[] value) Add a constant double array property.voidpublishConstFloat(String key, float value) Add a constant float property.voidpublishConstFloatArray(String key, float[] value) Add a constant float array property.voidpublishConstInteger(String key, long value) Add a constant integer property.voidpublishConstIntegerArray(String key, long[] value) Add a constant integer property.voidpublishConstRaw(String key, String typestring, byte[] value) Add a constant raw property.voidpublishConstString(String key, String value) Add a constant string property.voidpublishConstStringArray(String key, String[] value) Add a constant string array property.voidsetActuator(boolean value) Set a flag indicating if this sendable should be treated as an actuator.voidsetSafeState(Runnable func) Set the function that should be called to set the Sendable into a safe state.voidsetSmartDashboardType(String type) Set the string representation of the named data type that will be used by the smart dashboard for this sendable.voidsetTable(NetworkTable table) Set the network table.voidsetUpdateTable(Runnable func) Set the function that should be called to update the network table for things other than properties.voidHook setters for all properties.voidStart LiveWindow mode by hooking the setters for all properties.voidUnhook setters for all properties.voidStop LiveWindow mode by unhooking the setters for all properties.voidupdate()Update the network table values by calling the getters for all properties.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.networktables.NTSendableBuilder
getBackendKind
-
Constructor Details
-
SendableBuilderImpl
public SendableBuilderImpl()Default constructor.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
setTable
Set the network table. Must be called prior to any Add* functions being called.- Parameters:
table- Network table
-
getTable
Get the network table.- Specified by:
getTablein interfaceNTSendableBuilder- Returns:
- The network table
-
isPublished
Return whether this sendable has an associated table.- Specified by:
isPublishedin interfaceSendableBuilder- Returns:
- True if it has a table, false if not.
-
isActuator
Return whether this sendable should be treated as an actuator.- Returns:
- True if actuator, false if not.
-
update
Update the network table values by calling the getters for all properties.- Specified by:
updatein interfaceSendableBuilder
-
startListeners
Hook setters for all properties. -
stopListeners
Unhook setters for all properties. -
startLiveWindowMode
Start LiveWindow mode by hooking the setters for all properties. Also calls the safeState function if one was provided. -
stopLiveWindowMode
Stop LiveWindow mode by unhooking the setters for all properties. Also calls the safeState function if one was provided. -
clearProperties
Clear properties.- Specified by:
clearPropertiesin interfaceSendableBuilder
-
addCloseable
Description copied from interface:SendableBuilderAdds a closeable. The closeable.close() will be called when close() is called.- Specified by:
addCloseablein interfaceSendableBuilder- Parameters:
closeable- closeable object
-
setSmartDashboardType
Set the string representation of the named data type that will be used by the smart dashboard for this sendable.- Specified by:
setSmartDashboardTypein interfaceSendableBuilder- Parameters:
type- data type
-
setActuator
Set a flag indicating if this sendable should be treated as an actuator. By default, this flag is false.- Specified by:
setActuatorin interfaceSendableBuilder- 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.- Specified by:
setSafeStatein interfaceSendableBuilder- Parameters:
func- function
-
setUpdateTable
Set the function that should be called to update the network table for things other than properties. Note this function is not passed the network table object; instead it should use the topics returned by getTopic().- Specified by:
setUpdateTablein interfaceNTSendableBuilder- Parameters:
func- function
-
getTopic
Add a property without getters or setters. This can be used to get entry handles for the function called by setUpdateTable().- Specified by:
getTopicin interfaceNTSendableBuilder- Parameters:
key- property name- Returns:
- Network table entry
-
addBooleanProperty
Add a boolean property.- Specified by:
addBooleanPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstBoolean
Description copied from interface:SendableBuilderAdd a constant boolean property.- Specified by:
publishConstBooleanin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addIntegerProperty
Add an integer property.- Specified by:
addIntegerPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstInteger
Description copied from interface:SendableBuilderAdd a constant integer property.- Specified by:
publishConstIntegerin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addFloatProperty
Add a float property.- Specified by:
addFloatPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstFloat
Description copied from interface:SendableBuilderAdd a constant float property.- Specified by:
publishConstFloatin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addDoubleProperty
Add a double property.- Specified by:
addDoublePropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstDouble
Description copied from interface:SendableBuilderAdd a constant double property.- Specified by:
publishConstDoublein interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addStringProperty
Add a string property.- Specified by:
addStringPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstString
Description copied from interface:SendableBuilderAdd a constant string property.- Specified by:
publishConstStringin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addBooleanArrayProperty
public void addBooleanArrayProperty(String key, Supplier<boolean[]> getter, Consumer<boolean[]> setter) Add a boolean array property.- Specified by:
addBooleanArrayPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstBooleanArray
Description copied from interface:SendableBuilderAdd a constant boolean array property.- Specified by:
publishConstBooleanArrayin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addIntegerArrayProperty
Add an integer array property.- Specified by:
addIntegerArrayPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstIntegerArray
Description copied from interface:SendableBuilderAdd a constant integer property.- Specified by:
publishConstIntegerArrayin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addFloatArrayProperty
Add a float array property.- Specified by:
addFloatArrayPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstFloatArray
Description copied from interface:SendableBuilderAdd a constant float array property.- Specified by:
publishConstFloatArrayin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addDoubleArrayProperty
public void addDoubleArrayProperty(String key, Supplier<double[]> getter, Consumer<double[]> setter) Add a double array property.- Specified by:
addDoubleArrayPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstDoubleArray
Description copied from interface:SendableBuilderAdd a constant double array property.- Specified by:
publishConstDoubleArrayin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addStringArrayProperty
public void addStringArrayProperty(String key, Supplier<String[]> getter, Consumer<String[]> setter) Add a string array property.- Specified by:
addStringArrayPropertyin interfaceSendableBuilder- Parameters:
key- property namegetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstStringArray
Description copied from interface:SendableBuilderAdd a constant string array property.- Specified by:
publishConstStringArrayin interfaceSendableBuilder- Parameters:
key- property namevalue- the value
-
addRawProperty
public void addRawProperty(String key, String typeString, Supplier<byte[]> getter, Consumer<byte[]> setter) Add a raw property.- Specified by:
addRawPropertyin interfaceSendableBuilder- Parameters:
key- property nametypeString- type stringgetter- getter function (returns current value)setter- setter function (sets new value)
-
publishConstRaw
Description copied from interface:SendableBuilderAdd a constant raw property.- Specified by:
publishConstRawin interfaceSendableBuilder- Parameters:
key- property nametypestring- type stringvalue- the value
-