Package edu.wpi.first.networktables
Class NetworkTablesJNI
java.lang.Object
edu.wpi.first.networktables.NetworkTablesJNI
public final class NetworkTablesJNI extends Object
NetworkTables JNI.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NetworkTablesJNI.Helper
Sets whether JNI should be loaded in the static block. -
Method Summary
Modifier and Type Method Description static int
addListener(int poller, int handle, int mask)
Adds listener.static int
addListener(int poller, int handle, EnumSet<NetworkTableEvent.Kind> kinds)
Adds listener.static int
addListener(int poller, String[] prefixes, int mask)
Adds listener.static int
addListener(int poller, String[] prefixes, EnumSet<NetworkTableEvent.Kind> kinds)
Adds listener.static int
addLogger(int poller, int minLevel, int maxLevel)
Add logger callback function.static int
createInstance()
Creates an NT instance.static int
createListenerPoller(int inst)
Creates a listener poller.static void
deleteTopicProperty(int topic, String name)
Deletes topic property.static void
destroyInstance(int inst)
Destroys an NT instance.static void
destroyListenerPoller(int poller)
Destroys listener poller.static void
disconnect(int inst)
Disconnects the client if it's running and connected.static void
flush(int inst)
Flushes all updated values immediately to the network.static void
flushLocal(int inst)
Flushes all updated values immediately to the local client/server.static void
forceLoad()
Force load the library.static TimestampedBoolean
getAtomicBoolean(int subentry, boolean defaultValue)
Returns timestamped topic value as an atomic Boolean.static TimestampedBooleanArray
getAtomicBooleanArray(int subentry, boolean[] defaultValue)
Returns timestamped topic value as an atomic BooleanArray.static TimestampedDouble
getAtomicDouble(int subentry, double defaultValue)
Returns timestamped topic value as an atomic Double.static TimestampedDoubleArray
getAtomicDoubleArray(int subentry, double[] defaultValue)
Returns timestamped topic value as an atomic DoubleArray.static TimestampedFloat
getAtomicFloat(int subentry, float defaultValue)
Returns timestamped topic value as an atomic Float.static TimestampedFloatArray
getAtomicFloatArray(int subentry, float[] defaultValue)
Returns timestamped topic value as an atomic FloatArray.static TimestampedInteger
getAtomicInteger(int subentry, long defaultValue)
Returns timestamped topic value as an atomic Integer.static TimestampedIntegerArray
getAtomicIntegerArray(int subentry, long[] defaultValue)
Returns timestamped topic value as an atomic IntegerArray.static TimestampedRaw
getAtomicRaw(int subentry, byte[] defaultValue)
Returns timestamped topic value as an atomic Raw.static TimestampedString
getAtomicString(int subentry, String defaultValue)
Returns timestamped topic value as an atomic String.static TimestampedStringArray
getAtomicStringArray(int subentry, String[] defaultValue)
Returns timestamped topic value as an atomic StringArray.static boolean
getBoolean(int entry, boolean defaultValue)
Returns topic value.static boolean[]
getBooleanArray(int entry, boolean[] defaultValue)
Returns topic value.static ConnectionInfo[]
getConnections(int inst)
Gets information on the currently established network connections.static int
getDefaultInstance()
Returns default instance handle.static double
getDouble(int entry, double defaultValue)
Returns topic value.static double[]
getDoubleArray(int entry, double[] defaultValue)
Returns topic value.static int
getEntry(int topic, int type, String typeStr, PubSubOption... options)
Returns NT entry handle.static int
getEntry(int topic, int type, String typeStr, PubSubOptions options)
Returns NT entry handle.static int
getEntry(int inst, String key)
Returns NT entry handle.static int
getEntryFlags(int entry)
Returns entry flags.static long
getEntryLastChange(int entry)
Returns NT entry last change time in microseconds.static String
getEntryName(int entry)
Returns NT entry name.static float
getFloat(int entry, float defaultValue)
Returns topic value.static float[]
getFloatArray(int entry, float[] defaultValue)
Returns topic value.static int
getInstanceFromHandle(int handle)
Returns NT instance from handle.static long
getInteger(int entry, long defaultValue)
Returns topic value.static long[]
getIntegerArray(int entry, long[] defaultValue)
Returns topic value.static int
getNetworkMode(int inst)
Returns network mode.static byte[]
getRaw(int entry, byte[] defaultValue)
Returns topic value.static OptionalLong
getServerTimeOffset(int inst)
Get the time offset between server time and local time.static String
getString(int entry, String defaultValue)
Returns topic value.static String[]
getStringArray(int entry, String[] defaultValue)
Returns topic value.static int
getTopic(int inst, String name)
Returns Topic handle.static boolean
getTopicCached(int topic)
Returns true if topic is cached.static boolean
getTopicExists(int topic)
Returns true if topic exists.static int
getTopicFromHandle(int pubsubentry)
Returns topic from pubsub entry handle.static TopicInfo
getTopicInfo(NetworkTableInstance inst, int topic)
Returns topic info.static TopicInfo[]
getTopicInfos(NetworkTableInstance instObject, int inst, String prefix, int types)
Returns list of topic infos.static TopicInfo[]
getTopicInfosStr(NetworkTableInstance instObject, int inst, String prefix, String[] types)
Returns list of topic infos.static String
getTopicName(int topic)
Returns topic name.static boolean
getTopicPersistent(int topic)
Returns true if topic is persistent.static String
getTopicProperties(int topic)
Returns topic properties.static String
getTopicProperty(int topic, String name)
Returns topic property.static boolean
getTopicRetained(int topic)
Returns true if topic is retained.static int[]
getTopics(int inst, String prefix, int types)
Returns list of topic handles.static int[]
getTopicsStr(int inst, String prefix, String[] types)
Returns list of topic handles.static int
getTopicType(int topic)
Returns topic type.static String
getTopicTypeString(int topic)
Returns topic type as string.static int
getType(int entry)
Returns NT entry type.static NetworkTableValue
getValue(int entry)
Returns entry's NT value.static boolean
isConnected(int inst)
Return whether or not the instance is connected to another node.static long
now()
Returns the current timestamp in microseconds.static int
publish(int topic, int type, String typeStr, PubSubOption... options)
Publishes topic.static int
publish(int topic, int type, String typeStr, PubSubOptions options)
Publishes topic.static int
publishEx(int topic, int type, String typeStr, String properties, PubSubOption... options)
Publishes topic.static int
publishEx(int topic, int type, String typeStr, String properties, PubSubOptions options)
Publishes topic.static NetworkTableEvent[]
readListenerQueue(NetworkTableInstance inst, int poller)
Returns NT events from listener queue.static TimestampedBoolean[]
readQueueBoolean(int subentry)
Returns queued timestamped topic values.static TimestampedBooleanArray[]
readQueueBooleanArray(int subentry)
Returns queued timestamped topic values.static TimestampedDouble[]
readQueueDouble(int subentry)
Returns queued timestamped topic values.static TimestampedDoubleArray[]
readQueueDoubleArray(int subentry)
Returns queued timestamped topic values.static TimestampedFloat[]
readQueueFloat(int subentry)
Returns queued timestamped topic values.static TimestampedFloatArray[]
readQueueFloatArray(int subentry)
Returns queued timestamped topic values.static TimestampedInteger[]
readQueueInteger(int subentry)
Returns queued timestamped topic values.static TimestampedIntegerArray[]
readQueueIntegerArray(int subentry)
Returns queued timestamped topic values.static TimestampedRaw[]
readQueueRaw(int subentry)
Returns queued timestamped topic values.static TimestampedString[]
readQueueString(int subentry)
Returns queued timestamped topic values.static TimestampedStringArray[]
readQueueStringArray(int subentry)
Returns queued timestamped topic values.static NetworkTableValue[]
readQueueValue(int subentry)
Returns queued subentry values.static boolean[]
readQueueValuesBoolean(int subentry)
Returns queued topic values.static boolean[][]
readQueueValuesBooleanArray(int subentry)
Returns queued topic values.static double[]
readQueueValuesDouble(int subentry)
Returns queued topic values.static double[][]
readQueueValuesDoubleArray(int subentry)
Returns queued topic values.static float[]
readQueueValuesFloat(int subentry)
Returns queued topic values.static float[][]
readQueueValuesFloatArray(int subentry)
Returns queued topic values.static long[]
readQueueValuesInteger(int subentry)
Returns queued topic values.static long[][]
readQueueValuesIntegerArray(int subentry)
Returns queued topic values.static byte[][]
readQueueValuesRaw(int subentry)
Returns queued topic values.static String[]
readQueueValuesString(int subentry)
Returns queued topic values.static String[][]
readQueueValuesStringArray(int subentry)
Returns queued topic values.static void
release(int pubsubentry)
Relesaes pubsub entry.static void
releaseEntry(int entry)
Releases NT entry.static void
removeListener(int listener)
Removes listener.static boolean
setBoolean(int entry, long time, boolean value)
Sets topic value.static boolean
setBooleanArray(int entry, long time, boolean[] value)
Sets topic value.static boolean
setDefaultBoolean(int entry, long time, boolean defaultValue)
Sets default topic value.static boolean
setDefaultBooleanArray(int entry, long time, boolean[] defaultValue)
Sets default topic value.static boolean
setDefaultDouble(int entry, long time, double defaultValue)
Sets default topic value.static boolean
setDefaultDoubleArray(int entry, long time, double[] defaultValue)
Sets default topic value.static boolean
setDefaultFloat(int entry, long time, float defaultValue)
Sets default topic value.static boolean
setDefaultFloatArray(int entry, long time, float[] defaultValue)
Sets default topic value.static boolean
setDefaultInteger(int entry, long time, long defaultValue)
Sets default topic value.static boolean
setDefaultIntegerArray(int entry, long time, long[] defaultValue)
Sets default topic value.static boolean
setDefaultRaw(int entry, long time, byte[] defaultValue)
Sets default raw topic value.static boolean
setDefaultRaw(int entry, long time, byte[] defaultValue, int start, int len)
Sets default raw topic value.static boolean
setDefaultRaw(int entry, long time, ByteBuffer defaultValue)
Sets default raw topic value.static boolean
setDefaultRaw(int entry, long time, ByteBuffer defaultValue, int start, int len)
Sets default raw topic value.static boolean
setDefaultString(int entry, long time, String defaultValue)
Sets default topic value.static boolean
setDefaultStringArray(int entry, long time, String[] defaultValue)
Sets default topic value.static boolean
setDouble(int entry, long time, double value)
Sets topic value.static boolean
setDoubleArray(int entry, long time, double[] value)
Sets topic value.static void
setEntryFlags(int entry, int flags)
Sets entry flags.static boolean
setFloat(int entry, long time, float value)
Sets topic value.static boolean
setFloatArray(int entry, long time, float[] value)
Sets topic value.static boolean
setInteger(int entry, long time, long value)
Sets topic value.static boolean
setIntegerArray(int entry, long time, long[] value)
Sets topic value.static boolean
setRaw(int entry, long time, byte[] value)
Sets raw topic value.static boolean
setRaw(int entry, long time, byte[] value, int start, int len)
Sets raw topic value.static boolean
setRaw(int entry, long time, ByteBuffer value)
Sets raw topic value.static boolean
setRaw(int entry, long time, ByteBuffer value, int start, int len)
Sets raw topic value.static void
setServer(int inst, String[] serverNames, int[] ports)
Sets server addresses and ports for client (without restarting client).static void
setServer(int inst, String serverName, int port)
Sets server address and port for client (without restarting client).static void
setServerTeam(int inst, int team, int port)
Sets server addresses and port for client (without restarting client).static boolean
setString(int entry, long time, String value)
Sets topic value.static boolean
setStringArray(int entry, long time, String[] value)
Sets topic value.static void
setTopicCached(int topic, boolean value)
Sets topic caching.static void
setTopicPersistent(int topic, boolean value)
Sets topic persistency.static void
setTopicProperties(int topic, String properties)
Sets topic properties.static void
setTopicProperty(int topic, String name, String value)
Sets topic property.static void
setTopicRetained(int topic, boolean value)
Sets whether topic is retained.static void
startClient3(int inst, String identity)
Starts a NT3 client.static void
startClient4(int inst, String identity)
Starts a NT4 client.static int
startConnectionDataLog(int inst, DataLog log, String name)
Starts logging connection changes to a DataLog.static void
startDSClient(int inst, int port)
Starts requesting server address from Driver Station.static int
startEntryDataLog(int inst, DataLog log, String prefix, String logPrefix)
Starts logging entry changes to a DataLog.static void
startLocal(int inst)
Starts local-only operation.static void
startServer(int inst, String persistFilename, String listenAddress, int port3, int port4)
Starts a server using the specified filename, listening address, and port.static void
stopClient(int inst)
Stops the client if it is running.static void
stopConnectionDataLog(int logger)
Stops logging connection changes to a DataLog.static void
stopDSClient(int inst)
Stops requesting server address from Driver Station.static void
stopEntryDataLog(int logger)
Stops logging entry changes to a DataLog.static void
stopLocal(int inst)
Stops local-only operation.static void
stopServer(int inst)
Stops the server if it is running.static int
subscribe(int topic, int type, String typeStr, PubSubOption... options)
Subscribes to topic.static int
subscribe(int topic, int type, String typeStr, PubSubOptions options)
Subscribes to topic.static int
subscribeMultiple(int inst, String[] prefixes, PubSubOption... options)
Subscribes to multiple topics.static int
subscribeMultiple(int inst, String[] prefixes, PubSubOptions options)
Subscribes to multiple topics.static void
unpublish(int pubentry)
Unpublishes topic.static void
unsubscribe(int sub)
Unsubscribes from topic.static void
unsubscribeMultiple(int sub)
Unsubscribes from multiple topics.
-
Method Details
-
forceLoad
Force load the library.- Throws:
IOException
- if the library fails to load
-
getDefaultInstance
Returns default instance handle.- Returns:
- Default instance handle.
-
createInstance
Creates an NT instance.- Returns:
- NT instance handle.
-
destroyInstance
Destroys an NT instance.- Parameters:
inst
- NT instance handle.
-
getInstanceFromHandle
Returns NT instance from handle.- Parameters:
handle
- NT instance handle.- Returns:
- NT instance.
-
getEntry
Returns NT entry handle.- Parameters:
inst
- NT instance handle.key
- NT entry key.- Returns:
- NT entry handle.
-
getEntry
Returns NT entry handle.- Parameters:
topic
- NT entry topic.type
- NT entry type.typeStr
- NT entry type as a string.options
- NT entry pubsub options.- Returns:
- NT entry handle.
-
getEntry
Returns NT entry handle.- Parameters:
topic
- NT entry topic.type
- NT entry type.typeStr
- NT entry type as a string.options
- NT entry pubsub options.- Returns:
- NT entry handle.
-
getEntryName
Returns NT entry name.- Parameters:
entry
- NT entry handle.- Returns:
- NT entry name.
-
getEntryLastChange
Returns NT entry last change time in microseconds.- Parameters:
entry
- NT entry handle.- Returns:
- NT entry last change time in microseconds.
-
getType
Returns NT entry type.- Parameters:
entry
- NT entry handle.- Returns:
- NT entry type.
-
getTopics
Returns list of topic handles.- Parameters:
inst
- NT instance handle.prefix
- Topic prefix.types
- Topic types.- Returns:
- List of topic handles.
-
getTopicsStr
Returns list of topic handles.- Parameters:
inst
- NT instance handle.prefix
- Topic prefix.types
- Topic types as strings.- Returns:
- List of topic handles.
-
getTopicInfos
public static TopicInfo[] getTopicInfos(NetworkTableInstance instObject, int inst, String prefix, int types)Returns list of topic infos.- Parameters:
instObject
- NT instance.inst
- NT instance handle.prefix
- Topic prefix.types
- Topic types.- Returns:
- List of topic infos.
-
getTopicInfosStr
public static TopicInfo[] getTopicInfosStr(NetworkTableInstance instObject, int inst, String prefix, String[] types)Returns list of topic infos.- Parameters:
instObject
- NT instance.inst
- NT instance handle.prefix
- Topic prefix.types
- Topic types as strings.- Returns:
- List of topic infos.
-
getTopic
Returns Topic handle.- Parameters:
inst
- NT instance handle.name
- Topic name.- Returns:
- Topic handle.
-
getTopicName
Returns topic name.- Parameters:
topic
- Topic handle.- Returns:
- Topic name.
-
getTopicType
Returns topic type.- Parameters:
topic
- Topic handle.- Returns:
- Topic type.
-
setTopicPersistent
Sets topic persistency.- Parameters:
topic
- Topic handle.value
- True if topic should be persistent.
-
getTopicPersistent
Returns true if topic is persistent.- Parameters:
topic
- Topic handle.- Returns:
- True if topic is persistent.
-
setTopicRetained
Sets whether topic is retained.- Parameters:
topic
- Topic handle.value
- True if topic should be retained.
-
getTopicRetained
Returns true if topic is retained.- Parameters:
topic
- Topic handle.- Returns:
- True if topic is retained.
-
setTopicCached
Sets topic caching.- Parameters:
topic
- Topic handle.value
- True if topic should be cached.
-
getTopicCached
Returns true if topic is cached.- Parameters:
topic
- Topic handle.- Returns:
- True if topic is cached.
-
getTopicTypeString
Returns topic type as string.- Parameters:
topic
- Topic handle.- Returns:
- Topic type as string.
-
getTopicExists
Returns true if topic exists.- Parameters:
topic
- Topic handle.- Returns:
- True if topic exists.
-
getTopicProperty
Returns topic property.- Parameters:
topic
- Topic handle.name
- Property name.- Returns:
- Topic property.
-
setTopicProperty
Sets topic property.- Parameters:
topic
- Topic handle.name
- Property name.value
- Property value.
-
deleteTopicProperty
Deletes topic property.- Parameters:
topic
- Topic handle.name
- Property name.
-
getTopicProperties
Returns topic properties.- Parameters:
topic
- Topic handle.- Returns:
- Topic properties.
-
setTopicProperties
Sets topic properties.- Parameters:
topic
- Topic handle.properties
- Topic properties.
-
subscribe
Subscribes to topic.- Parameters:
topic
- Topic handle.type
- Topic type.typeStr
- Topic type as a string.options
- Pubsub options.- Returns:
- Subscriber handle.
-
subscribe
Subscribes to topic.- Parameters:
topic
- Topic handle.type
- Topic type.typeStr
- Topic type as a string.options
- Pubsub options.- Returns:
- Subscriber handle.
-
unsubscribe
Unsubscribes from topic.- Parameters:
sub
- Subscriber handle.
-
publish
Publishes topic.- Parameters:
topic
- Topic handle.type
- Topic type.typeStr
- Topic type as a string.options
- Pubsub options.- Returns:
- Publish handle.
-
publish
Publishes topic.- Parameters:
topic
- Topic handle.type
- Topic type.typeStr
- Topic type as a string.options
- Pubsub options.- Returns:
- Publish handle.
-
publishEx
public static int publishEx(int topic, int type, String typeStr, String properties, PubSubOptions options)Publishes topic.- Parameters:
topic
- Topic handle.type
- Topic type.typeStr
- Topic type as a string.properties
- Topic properties.options
- Pubsub options.- Returns:
- Publish handle.
-
publishEx
public static int publishEx(int topic, int type, String typeStr, String properties, PubSubOption... options)Publishes topic.- Parameters:
topic
- Topic handle.type
- Topic type.typeStr
- Topic type as a string.properties
- Topic properties.options
- Pubsub options.- Returns:
- Publish handle.
-
unpublish
Unpublishes topic.- Parameters:
pubentry
- Publish entry handle.
-
releaseEntry
Releases NT entry.- Parameters:
entry
- NT entry handle.
-
release
Relesaes pubsub entry.- Parameters:
pubsubentry
- Pubsub entry handle.
-
getTopicFromHandle
Returns topic from pubsub entry handle.- Parameters:
pubsubentry
- Pubsub entry handle.- Returns:
- Topic handle.
-
subscribeMultiple
Subscribes to multiple topics.- Parameters:
inst
- NT instance handle.prefixes
- List of topic prefixes.options
- Pubsub options.- Returns:
- Subscribe handle.
-
subscribeMultiple
Subscribes to multiple topics.- Parameters:
inst
- NT instance handle.prefixes
- List of topic prefixes.options
- Pubsub options.- Returns:
- Subscribe handle.
-
unsubscribeMultiple
Unsubscribes from multiple topics.- Parameters:
sub
- Subscribe handle.
-
getAtomicBoolean
Returns timestamped topic value as an atomic Boolean.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueBoolean
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesBoolean
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setBoolean
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getBoolean
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultBoolean
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicInteger
Returns timestamped topic value as an atomic Integer.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueInteger
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesInteger
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setInteger
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getInteger
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultInteger
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicFloat
Returns timestamped topic value as an atomic Float.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueFloat
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesFloat
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setFloat
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getFloat
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultFloat
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicDouble
Returns timestamped topic value as an atomic Double.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueDouble
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesDouble
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setDouble
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getDouble
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultDouble
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicString
Returns timestamped topic value as an atomic String.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueString
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesString
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setString
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getString
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultString
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicRaw
Returns timestamped topic value as an atomic Raw.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueRaw
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesRaw
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setRaw
Sets raw topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Raw value buffer.- Returns:
- True if set succeeded.
-
setRaw
Sets raw topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Raw value buffer.start
- Value's offset into buffer.len
- Length of value in buffer.- Returns:
- True if set succeeded.
-
setRaw
Sets raw topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Raw value buffer.- Returns:
- True if set succeeded.
-
setRaw
Sets raw topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Raw value buffer.start
- Value's offset into buffer.len
- Length of value in buffer.- Returns:
- True if set succeeded.
-
getRaw
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultRaw
Sets default raw topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
setDefaultRaw
Sets default raw topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.start
- Value's offset into buffer.len
- Length of value in buffer.- Returns:
- True if set succeeded.
-
setDefaultRaw
Sets default raw topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
setDefaultRaw
public static boolean setDefaultRaw(int entry, long time, ByteBuffer defaultValue, int start, int len)Sets default raw topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.start
- Value's offset into buffer.len
- Length of value in buffer.- Returns:
- True if set succeeded.
-
getAtomicBooleanArray
Returns timestamped topic value as an atomic BooleanArray.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueBooleanArray
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesBooleanArray
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setBooleanArray
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getBooleanArray
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultBooleanArray
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicIntegerArray
Returns timestamped topic value as an atomic IntegerArray.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueIntegerArray
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesIntegerArray
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setIntegerArray
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getIntegerArray
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultIntegerArray
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicFloatArray
Returns timestamped topic value as an atomic FloatArray.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueFloatArray
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesFloatArray
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setFloatArray
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getFloatArray
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultFloatArray
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicDoubleArray
Returns timestamped topic value as an atomic DoubleArray.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueDoubleArray
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesDoubleArray
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setDoubleArray
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getDoubleArray
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultDoubleArray
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
getAtomicStringArray
Returns timestamped topic value as an atomic StringArray.- Parameters:
subentry
- Subentry handle.defaultValue
- Default value.- Returns:
- Timestamped topic value.
-
readQueueStringArray
Returns queued timestamped topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of timestamped topic values.
-
readQueueValuesStringArray
Returns queued topic values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of topic values.
-
setStringArray
Sets topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.value
- Topic value.- Returns:
- True if set succeeded.
-
getStringArray
Returns topic value.- Parameters:
entry
- Entry handle.defaultValue
- Default value.- Returns:
- Topic value.
-
setDefaultStringArray
Sets default topic value.- Parameters:
entry
- Entry handle.time
- Time in microseconds.defaultValue
- Default value.- Returns:
- True if set succeeded.
-
readQueueValue
Returns queued subentry values.- Parameters:
subentry
- Subentry handle.- Returns:
- List of queued subentry values.
-
getValue
Returns entry's NT value.- Parameters:
entry
- Entry handle.- Returns:
- Entry's NT value.
-
setEntryFlags
Sets entry flags.- Parameters:
entry
- Entry handle.flags
- Entry flags.
-
getEntryFlags
Returns entry flags.- Parameters:
entry
- Entry handle.- Returns:
- Entry flags.
-
getTopicInfo
Returns topic info.- Parameters:
inst
- NT instance handle.topic
- Topic handle.- Returns:
- Topic info.
-
createListenerPoller
Creates a listener poller.- Parameters:
inst
- NT instance handle.- Returns:
- Listener poller handle.
-
destroyListenerPoller
Destroys listener poller.- Parameters:
poller
- Listener poller handle.
-
addListener
public static int addListener(int poller, String[] prefixes, EnumSet<NetworkTableEvent.Kind> kinds)Adds listener.- Parameters:
poller
- Listener poller handle.prefixes
- Topic prefixes.kinds
- Enum set of NT event kinds.- Returns:
- Listener handle.
-
addListener
Adds listener.- Parameters:
poller
- Listener poller handle.handle
- Topic handle.kinds
- Enum set of NT event kinds.- Returns:
- Listener handle.
-
addListener
Adds listener.- Parameters:
poller
- Listener poller handle.prefixes
- Topic prefixes.mask
- NT event mask.- Returns:
- Listener handle.
-
addListener
Adds listener.- Parameters:
poller
- Listener poller handle.handle
- Topic handle.mask
- NT event mask.- Returns:
- Listener handle.
-
readListenerQueue
Returns NT events from listener queue.- Parameters:
inst
- NT instance handle.poller
- Listener poller handle.- Returns:
- List of NT events.
-
removeListener
Removes listener.- Parameters:
listener
- Listener handle.
-
getNetworkMode
Returns network mode.- Parameters:
inst
- NT instance handle.- Returns:
- Network mode.
-
startLocal
Starts local-only operation. Prevents calls to startServer or startClient from taking effect. Has no effect if startServer or startClient has already been called.- Parameters:
inst
- NT instance handle.
-
stopLocal
Stops local-only operation. startServer or startClient can be called after this call to start a server or client.- Parameters:
inst
- NT instance handle.
-
startServer
public static void startServer(int inst, String persistFilename, String listenAddress, int port3, int port4)Starts a server using the specified filename, listening address, and port.- Parameters:
inst
- NT instance handle.persistFilename
- the name of the persist file to uselistenAddress
- the address to listen on, or empty to listen on any addressport3
- port to communicate over (NT3)port4
- port to communicate over (NT4)
-
stopServer
Stops the server if it is running.- Parameters:
inst
- NT instance handle.
-
startClient3
Starts a NT3 client. Use SetServer or SetServerTeam to set the server name and port.- Parameters:
inst
- NT instance handle.identity
- network identity to advertise (cannot be empty string)
-
startClient4
Starts a NT4 client. Use SetServer or SetServerTeam to set the server name and port.- Parameters:
inst
- NT instance handle.identity
- network identity to advertise (cannot be empty string)
-
stopClient
Stops the client if it is running.- Parameters:
inst
- NT instance handle.
-
setServer
Sets server address and port for client (without restarting client).- Parameters:
inst
- NT instance handle.serverName
- server nameport
- port to communicate over
-
setServer
Sets server addresses and ports for client (without restarting client). The client will attempt to connect to each server in round robin fashion.- Parameters:
inst
- NT instance handle.serverNames
- array of server namesports
- array of port numbers (0=default)
-
setServerTeam
Sets server addresses and port for client (without restarting client). Connects using commonly known robot addresses for the specified team.- Parameters:
inst
- NT instance handle.team
- team numberport
- port to communicate over
-
disconnect
Disconnects the client if it's running and connected. This will automatically start reconnection attempts to the current server list.- Parameters:
inst
- NT instance handle.
-
startDSClient
Starts requesting server address from Driver Station. This connects to the Driver Station running on localhost to obtain the server IP address.- Parameters:
inst
- NT instance handle.port
- server port to use in combination with IP from DS
-
stopDSClient
Stops requesting server address from Driver Station.- Parameters:
inst
- NT instance handle.
-
flushLocal
Flushes all updated values immediately to the local client/server. This does not flush to the network.- Parameters:
inst
- NT instance handle.
-
flush
Flushes all updated values immediately to the network. Note: This is rate-limited to protect the network from flooding. This is primarily useful for synchronizing network updates with user code.- Parameters:
inst
- NT instance handle.
-
getConnections
Gets information on the currently established network connections. If operating as a client, this will return either zero or one values.- Parameters:
inst
- NT instance handle.- Returns:
- array of connection information
-
isConnected
Return whether or not the instance is connected to another node.- Parameters:
inst
- NT instance handle.- Returns:
- True if connected.
-
getServerTimeOffset
Get the time offset between server time and local time. Add this value to local time to get the estimated equivalent server time. In server mode, this always returns 0. In client mode, this returns the time offset only if the client and server are connected and have exchanged synchronization messages. Note the time offset may change over time as it is periodically updated; to receive updates as events, add a listener to the "time sync" event.- Parameters:
inst
- NT instance handle.- Returns:
- Time offset in microseconds (optional)
-
now
Returns the current timestamp in microseconds.- Returns:
- The current timestsamp in microseconds.
-
startEntryDataLog
Starts logging entry changes to a DataLog.- Parameters:
inst
- NT instance handle.log
- data log object; lifetime must extend until StopEntryDataLog is called or the instance is destroyedprefix
- only store entries with names that start with this prefix; the prefix is not included in the data log entry namelogPrefix
- prefix to add to data log entry names- Returns:
- Data logger handle
-
stopEntryDataLog
Stops logging entry changes to a DataLog.- Parameters:
logger
- data logger handle
-
startConnectionDataLog
Starts logging connection changes to a DataLog.- Parameters:
inst
- NT instance handle.log
- data log object; lifetime must extend until StopConnectionDataLog is called or the instance is destroyedname
- data log entry name- Returns:
- Data logger handle
-
stopConnectionDataLog
Stops logging connection changes to a DataLog.- Parameters:
logger
- data logger handle
-
addLogger
Add logger callback function. By default, log messages are sent to stderr; this function sends log messages with the specified levels to the provided callback function instead. The callback function will only be called for log messages with level greater than or equal to minLevel and less than or equal to maxLevel; messages outside this range will be silently ignored.- Parameters:
poller
- Listener poller handle.minLevel
- minimum log levelmaxLevel
- maximum log level- Returns:
- Listener handle
-