Package edu.wpi.first.networktables
Interface GenericSubscriber
- All Superinterfaces:
AutoCloseable
,PubSub
,Subscriber
,Supplier<NetworkTableValue>
- All Known Subinterfaces:
GenericEntry
public interface GenericSubscriber extends Subscriber, Supplier<NetworkTableValue>
NetworkTables generic subscriber.
-
Method Summary
Modifier and Type Method Description NetworkTableValue
get()
Get the last published value.boolean
getBoolean(boolean defaultValue)
Gets the entry's value as a boolean.boolean[]
getBooleanArray(boolean[] defaultValue)
Gets the entry's value as a boolean[].Boolean[]
getBooleanArray(Boolean[] defaultValue)
Gets the entry's value as a boolean array.double
getDouble(double defaultValue)
Gets the entry's value as a double.double[]
getDoubleArray(double[] defaultValue)
Gets the entry's value as a double[].Double[]
getDoubleArray(Double[] defaultValue)
Gets the entry's value as a boolean array.float
getFloat(float defaultValue)
Gets the entry's value as a float.float[]
getFloatArray(float[] defaultValue)
Gets the entry's value as a float[].Float[]
getFloatArray(Float[] defaultValue)
Gets the entry's value as a boolean array.long
getInteger(long defaultValue)
Gets the entry's value as a long.long[]
getIntegerArray(long[] defaultValue)
Gets the entry's value as a long[].Long[]
getIntegerArray(Long[] defaultValue)
Gets the entry's value as a boolean array.byte[]
getRaw(byte[] defaultValue)
Gets the entry's value as a byte[].String
getString(String defaultValue)
Gets the entry's value as a String.String[]
getStringArray(String[] defaultValue)
Gets the entry's value as a String[].Topic
getTopic()
Get the corresponding topic.NetworkTableValue[]
readQueue()
Get an array of all value changes since the last call to readQueue.
-
Method Details
-
getTopic
Get the corresponding topic. -
get
Get the last published value. If no value has been published, returns a value with type NetworkTableType.kUnassigned.- Specified by:
get
in interfaceSupplier<NetworkTableValue>
- Returns:
- value
-
getBoolean
Gets the entry's value as a boolean. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getInteger
Gets the entry's value as a long. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getFloat
Gets the entry's value as a float. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getDouble
Gets the entry's value as a double. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getString
Gets the entry's value as a String. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getRaw
Gets the entry's value as a byte[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getBooleanArray
Gets the entry's value as a boolean[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getBooleanArray
Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getIntegerArray
Gets the entry's value as a long[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getIntegerArray
Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getFloatArray
Gets the entry's value as a float[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getFloatArray
Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getDoubleArray
Gets the entry's value as a double[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getDoubleArray
Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getStringArray
Gets the entry's value as a String[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue
- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
readQueue
Get an array of all value changes since the last call to readQueue. Also provides a timestamp for each value.The "poll storage" subscribe option can be used to set the queue depth.
- Returns:
- Array of timestamped values; empty array if no new changes have been published since the previous call.
-