Package edu.wpi.first.epilogue.logging
Class LogBackedSendableBuilder
java.lang.Object
edu.wpi.first.epilogue.logging.LogBackedSendableBuilder
- All Implemented Interfaces:
SendableBuilder
,AutoCloseable
A sendable builder implementation that sends data to a
EpilogueBackend
.-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.wpi.first.util.sendable.SendableBuilder
SendableBuilder.BackendKind
-
Constructor Summary
ConstructorDescriptionLogBackedSendableBuilder
(EpilogueBackend backend) Creates a new sendable builder that delegates writes to an underlying backend. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Add a string array property.void
Add a string property.void
Clear properties.void
close()
Gets the kind of backend being used.boolean
Return whether this sendable has been published.void
publishConstBoolean
(String key, boolean value) Add a constant boolean property.void
publishConstBooleanArray
(String key, boolean[] value) Add a constant boolean array property.void
publishConstDouble
(String key, double value) Add a constant double property.void
publishConstDoubleArray
(String key, double[] value) Add a constant double array property.void
publishConstFloat
(String key, float value) Add a constant float property.void
publishConstFloatArray
(String key, float[] value) Add a constant float array property.void
publishConstInteger
(String key, long value) Add a constant integer property.void
publishConstIntegerArray
(String key, long[] value) Add a constant integer property.void
publishConstRaw
(String key, String typeString, byte[] value) Add a constant raw property.void
publishConstString
(String key, String value) Add a constant string property.void
publishConstStringArray
(String key, String[] value) Add a constant string array property.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.
-
Constructor Details
-
LogBackedSendableBuilder
Creates a new sendable builder that delegates writes to an underlying backend.- Parameters:
backend
- the backend to write the sendable data to
-
-
Method Details
-
setSmartDashboardType
Description copied from interface:SendableBuilder
Set the string representation of the named data type that will be used by the smart dashboard for this sendable.- Specified by:
setSmartDashboardType
in interfaceSendableBuilder
- Parameters:
type
- data type
-
setActuator
Description copied from interface:SendableBuilder
Set a flag indicating if this Sendable should be treated as an actuator. By default, this flag is false.- Specified by:
setActuator
in interfaceSendableBuilder
- Parameters:
value
- true if actuator, false if not
-
setSafeState
Description copied from interface:SendableBuilder
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:
setSafeState
in interfaceSendableBuilder
- Parameters:
func
- function
-
addBooleanProperty
Description copied from interface:SendableBuilder
Add a boolean property.- Specified by:
addBooleanProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstBoolean
Description copied from interface:SendableBuilder
Add a constant boolean property.- Specified by:
publishConstBoolean
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addIntegerProperty
Description copied from interface:SendableBuilder
Add an integer property.- Specified by:
addIntegerProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstInteger
Description copied from interface:SendableBuilder
Add a constant integer property.- Specified by:
publishConstInteger
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addFloatProperty
Description copied from interface:SendableBuilder
Add a float property.- Specified by:
addFloatProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstFloat
Description copied from interface:SendableBuilder
Add a constant float property.- Specified by:
publishConstFloat
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addDoubleProperty
Description copied from interface:SendableBuilder
Add a double property.- Specified by:
addDoubleProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstDouble
Description copied from interface:SendableBuilder
Add a constant double property.- Specified by:
publishConstDouble
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addStringProperty
Description copied from interface:SendableBuilder
Add a string property.- Specified by:
addStringProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstString
Description copied from interface:SendableBuilder
Add a constant string property.- Specified by:
publishConstString
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addBooleanArrayProperty
public void addBooleanArrayProperty(String key, Supplier<boolean[]> getter, Consumer<boolean[]> setter) Description copied from interface:SendableBuilder
Add a boolean array property.- Specified by:
addBooleanArrayProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstBooleanArray
Description copied from interface:SendableBuilder
Add a constant boolean array property.- Specified by:
publishConstBooleanArray
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addIntegerArrayProperty
Description copied from interface:SendableBuilder
Add an integer array property.- Specified by:
addIntegerArrayProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstIntegerArray
Description copied from interface:SendableBuilder
Add a constant integer property.- Specified by:
publishConstIntegerArray
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addFloatArrayProperty
Description copied from interface:SendableBuilder
Add a float array property.- Specified by:
addFloatArrayProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstFloatArray
Description copied from interface:SendableBuilder
Add a constant float array property.- Specified by:
publishConstFloatArray
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addDoubleArrayProperty
public void addDoubleArrayProperty(String key, Supplier<double[]> getter, Consumer<double[]> setter) Description copied from interface:SendableBuilder
Add a double array property.- Specified by:
addDoubleArrayProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstDoubleArray
Description copied from interface:SendableBuilder
Add a constant double array property.- Specified by:
publishConstDoubleArray
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addStringArrayProperty
public void addStringArrayProperty(String key, Supplier<String[]> getter, Consumer<String[]> setter) Description copied from interface:SendableBuilder
Add a string array property.- Specified by:
addStringArrayProperty
in interfaceSendableBuilder
- Parameters:
key
- property namegetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstStringArray
Description copied from interface:SendableBuilder
Add a constant string array property.- Specified by:
publishConstStringArray
in interfaceSendableBuilder
- Parameters:
key
- property namevalue
- the value
-
addRawProperty
public void addRawProperty(String key, String typeString, Supplier<byte[]> getter, Consumer<byte[]> setter) Description copied from interface:SendableBuilder
Add a raw property.- Specified by:
addRawProperty
in interfaceSendableBuilder
- Parameters:
key
- property nametypeString
- type stringgetter
- getter function (returns current value)setter
- setter function (sets new value)
-
publishConstRaw
Description copied from interface:SendableBuilder
Add a constant raw property.- Specified by:
publishConstRaw
in interfaceSendableBuilder
- Parameters:
key
- property nametypeString
- type stringvalue
- the value
-
getBackendKind
Description copied from interface:SendableBuilder
Gets the kind of backend being used.- Specified by:
getBackendKind
in interfaceSendableBuilder
- Returns:
- Backend kind
-
isPublished
Description copied from interface:SendableBuilder
Return whether this sendable has been published.- Specified by:
isPublished
in interfaceSendableBuilder
- Returns:
- True if it has been published, false if not.
-
update
Description copied from interface:SendableBuilder
Update the published values by calling the getters for all properties.- Specified by:
update
in interfaceSendableBuilder
-
clearProperties
Description copied from interface:SendableBuilder
Clear properties.- Specified by:
clearProperties
in interfaceSendableBuilder
-
addCloseable
Description copied from interface:SendableBuilder
Adds a closeable. The closeable.close() will be called when close() is called.- Specified by:
addCloseable
in interfaceSendableBuilder
- Parameters:
closeable
- closeable object
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-