Class NetworkTablesJNI
java.lang.Object
org.wpilib.networktables.NetworkTablesJNI
NetworkTables JNI.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSets whether JNI should be loaded in the static block. -
Method Summary
Modifier and TypeMethodDescriptionstatic intaddListener(int poller, int handle, int mask) Adds listener.static intaddListener(int poller, int handle, EnumSet<NetworkTableEvent.Kind> kinds) Adds listener.static intaddListener(int poller, String[] prefixes, int mask) Adds listener.static intaddListener(int poller, String[] prefixes, EnumSet<NetworkTableEvent.Kind> kinds) Adds listener.static intaddLogger(int poller, int minLevel, int maxLevel) Add logger callback function.static intCreates an NT instance.static intcreateListenerPoller(int inst) Creates a listener poller.static voiddeleteTopicProperty(int topic, String name) Deletes topic property.static voiddestroyInstance(int inst) Destroys an NT instance.static voiddestroyListenerPoller(int poller) Destroys listener poller.static voiddisconnect(int inst) Disconnects the client if it's running and connected.static voidflush(int inst) Flushes all updated values immediately to the network.static voidflushLocal(int inst) Flushes all updated values immediately to the local client/server.static voidForce load the library.static TimestampedBooleangetAtomicBoolean(int subentry, boolean defaultValue) Returns timestamped topic value as an atomic Boolean.static TimestampedBooleanArraygetAtomicBooleanArray(int subentry, boolean[] defaultValue) Returns timestamped topic value as an atomic BooleanArray.static TimestampedDoublegetAtomicDouble(int subentry, double defaultValue) Returns timestamped topic value as an atomic Double.static TimestampedDoubleArraygetAtomicDoubleArray(int subentry, double[] defaultValue) Returns timestamped topic value as an atomic DoubleArray.static TimestampedFloatgetAtomicFloat(int subentry, float defaultValue) Returns timestamped topic value as an atomic Float.static TimestampedFloatArraygetAtomicFloatArray(int subentry, float[] defaultValue) Returns timestamped topic value as an atomic FloatArray.static TimestampedIntegergetAtomicInteger(int subentry, long defaultValue) Returns timestamped topic value as an atomic Integer.static TimestampedIntegerArraygetAtomicIntegerArray(int subentry, long[] defaultValue) Returns timestamped topic value as an atomic IntegerArray.static TimestampedRawgetAtomicRaw(int subentry, byte[] defaultValue) Returns timestamped topic value as an atomic Raw.static TimestampedStringgetAtomicString(int subentry, String defaultValue) Returns timestamped topic value as an atomic String.static TimestampedStringArraygetAtomicStringArray(int subentry, String[] defaultValue) Returns timestamped topic value as an atomic StringArray.static booleangetBoolean(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 intReturns default instance handle.static doublegetDouble(int entry, double defaultValue) Returns topic value.static double[]getDoubleArray(int entry, double[] defaultValue) Returns topic value.static intgetEntry(int topic, int type, String typeStr, PubSubOption... options) Returns NT entry handle.static intgetEntry(int topic, int type, String typeStr, PubSubOptions options) Returns NT entry handle.static intReturns NT entry handle.static intgetEntryFlags(int entry) Returns entry flags.static longgetEntryLastChange(int entry) Returns NT entry last change time in nanoseconds.static StringgetEntryName(int entry) Returns NT entry name.static floatgetFloat(int entry, float defaultValue) Returns topic value.static float[]getFloatArray(int entry, float[] defaultValue) Returns topic value.static intgetInstanceFromHandle(int handle) Returns NT instance from handle.static longgetInteger(int entry, long defaultValue) Returns topic value.static long[]getIntegerArray(int entry, long[] defaultValue) Returns topic value.static intgetNetworkMode(int inst) Returns network mode.static byte[]getRaw(int entry, byte[] defaultValue) Returns topic value.static OptionalLonggetServerTimeOffset(int inst) Get the time offset between server time and local time.static StringReturns topic value.static String[]getStringArray(int entry, String[] defaultValue) Returns topic value.static intReturns Topic handle.static booleangetTopicCached(int topic) Returns true if topic is cached.static booleangetTopicExists(int topic) Returns true if topic exists.static intgetTopicFromHandle(int pubsubentry) Returns topic from pubsub entry handle.static TopicInfogetTopicInfo(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 StringgetTopicName(int topic) Returns topic name.static booleangetTopicPersistent(int topic) Returns true if topic is persistent.static StringgetTopicProperties(int topic) Returns topic properties.static StringgetTopicProperty(int topic, String name) Returns topic property.static booleangetTopicRetained(int topic) Returns true if topic is retained.static int[]Returns list of topic handles.static int[]getTopicsStr(int inst, String prefix, String[] types) Returns list of topic handles.static intgetTopicType(int topic) Returns topic type.static StringgetTopicTypeString(int topic) Returns topic type as string.static intgetType(int entry) Returns NT entry type.static NetworkTableValuegetValue(int entry) Returns entry's NT value.static booleanisConnected(int inst) Return whether or not the instance is connected to another node.static longnow()Returns the current timestamp in nanoseconds.static intpublish(int topic, int type, String typeStr, PubSubOption... options) Publishes topic.static intpublish(int topic, int type, String typeStr, PubSubOptions options) Publishes topic.static intpublishEx(int topic, int type, String typeStr, String properties, PubSubOption... options) Publishes topic.static intpublishEx(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 voidrelease(int pubsubentry) Releases pubsub entry.static voidreleaseEntry(int entry) Releases NT entry.static voidremoveListener(int listener) Removes listener.static booleansetBoolean(int entry, long time, boolean value) Sets topic value.static booleansetBooleanArray(int entry, long time, boolean[] value) Sets topic value.static booleansetDefaultBoolean(int entry, long time, boolean defaultValue) Sets default topic value.static booleansetDefaultBooleanArray(int entry, long time, boolean[] defaultValue) Sets default topic value.static booleansetDefaultDouble(int entry, long time, double defaultValue) Sets default topic value.static booleansetDefaultDoubleArray(int entry, long time, double[] defaultValue) Sets default topic value.static booleansetDefaultFloat(int entry, long time, float defaultValue) Sets default topic value.static booleansetDefaultFloatArray(int entry, long time, float[] defaultValue) Sets default topic value.static booleansetDefaultInteger(int entry, long time, long defaultValue) Sets default topic value.static booleansetDefaultIntegerArray(int entry, long time, long[] defaultValue) Sets default topic value.static booleansetDefaultRaw(int entry, long time, byte[] defaultValue) Sets default raw topic value.static booleansetDefaultRaw(int entry, long time, byte[] defaultValue, int start, int len) Sets default raw topic value.static booleansetDefaultRaw(int entry, long time, ByteBuffer defaultValue) Sets default raw topic value.static booleansetDefaultRaw(int entry, long time, ByteBuffer defaultValue, int start, int len) Sets default raw topic value.static booleansetDefaultString(int entry, long time, String defaultValue) Sets default topic value.static booleansetDefaultStringArray(int entry, long time, String[] defaultValue) Sets default topic value.static booleansetDouble(int entry, long time, double value) Sets topic value.static booleansetDoubleArray(int entry, long time, double[] value) Sets topic value.static voidsetEntryFlags(int entry, int flags) Sets entry flags.static booleansetFloat(int entry, long time, float value) Sets topic value.static booleansetFloatArray(int entry, long time, float[] value) Sets topic value.static booleansetInteger(int entry, long time, long value) Sets topic value.static booleansetIntegerArray(int entry, long time, long[] value) Sets topic value.static booleansetRaw(int entry, long time, byte[] value) Sets raw topic value.static booleansetRaw(int entry, long time, byte[] value, int start, int len) Sets raw topic value.static booleansetRaw(int entry, long time, ByteBuffer value) Sets raw topic value.static booleansetRaw(int entry, long time, ByteBuffer value, int start, int len) Sets raw topic value.static voidSets server addresses and ports for client (without restarting client).static voidSets server address and port for client (without restarting client).static voidsetServerFixed(int inst, String team, int port) Sets server addresses and port for client (without restarting client).static voidsetServerMdns(int inst, String serviceName) Sets server address and port for client (without restarting client).static voidsetServerMdns(int inst, String serviceName, int mdnsPort, String[] serverNames, int[] ports) Sets server addresses and ports for client (without restarting client).static voidsetServerMdns(int inst, String serviceName, String[] serverNames, int[] ports) Sets server addresses and ports for client (without restarting client).static voidsetServerMdns(int inst, String serviceName, String serverName, int port) Sets server address and port for client (without restarting client).static voidsetServerTeam(int inst, String team, int port) Sets server addresses and port for client (without restarting client).static booleanSets topic value.static booleansetStringArray(int entry, long time, String[] value) Sets topic value.static voidsetTopicCached(int topic, boolean value) Sets topic caching.static voidsetTopicPersistent(int topic, boolean value) Sets topic persistency.static voidsetTopicProperties(int topic, String properties) Sets topic properties.static voidsetTopicProperty(int topic, String name, String value) Sets topic property.static voidsetTopicRetained(int topic, boolean value) Sets whether topic is retained.static voidstartClient(int inst, String identity) Starts a client.static intstartConnectionDataLog(int inst, DataLog log, String name) Starts logging connection changes to a DataLog.static voidstartDSClient(int inst, int port) Starts requesting server address from Driver Station.static intstartEntryDataLog(int inst, DataLog log, String prefix, String logPrefix) Starts logging entry changes to a DataLog.static voidstartLocal(int inst) Starts local-only operation.static voidstartServer(int inst, String persistFilename, String listenAddress, String mdnsService, int port) Starts a server using the specified filename, listening address, and port.static voidstopClient(int inst) Stops the client if it is running.static voidstopConnectionDataLog(int logger) Stops logging connection changes to a DataLog.static voidstopDSClient(int inst) Stops requesting server address from Driver Station.static voidstopEntryDataLog(int logger) Stops logging entry changes to a DataLog.static voidstopLocal(int inst) Stops local-only operation.static voidstopServer(int inst) Stops the server if it is running.static intsubscribe(int topic, int type, String typeStr, PubSubOption... options) Subscribes to topic.static intsubscribe(int topic, int type, String typeStr, PubSubOptions options) Subscribes to topic.static intsubscribeMultiple(int inst, String[] prefixes, PubSubOption... options) Subscribes to multiple topics.static intsubscribeMultiple(int inst, String[] prefixes, PubSubOptions options) Subscribes to multiple topics.static voidunpublish(int pubentry) Unpublishes topic.static voidunsubscribe(int sub) Unsubscribes from topic.static voidunsubscribeMultiple(int sub) Unsubscribes from multiple topics.
-
Method Details
-
forceLoad
Force load the library.- Throws:
IOException- if the library fails to load
-
getDefaultInstance
public static int getDefaultInstance()Returns default instance handle.- Returns:
- Default instance handle.
-
createInstance
public static int createInstance()Creates an NT instance.- Returns:
- NT instance handle.
-
destroyInstance
public static void destroyInstance(int inst) Destroys an NT instance.- Parameters:
inst- NT instance handle.
-
getInstanceFromHandle
public static int getInstanceFromHandle(int handle) 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
public static long getEntryLastChange(int entry) Returns NT entry last change time in nanoseconds.- Parameters:
entry- NT entry handle.- Returns:
- NT entry last change time in nanoseconds.
-
getType
public static int getType(int entry) 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
-
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
public static int getTopicType(int topic) Returns topic type.- Parameters:
topic- Topic handle.- Returns:
- Topic type.
-
setTopicPersistent
public static void setTopicPersistent(int topic, boolean value) Sets topic persistency.- Parameters:
topic- Topic handle.value- True if topic should be persistent.
-
getTopicPersistent
public static boolean getTopicPersistent(int topic) Returns true if topic is persistent.- Parameters:
topic- Topic handle.- Returns:
- True if topic is persistent.
-
setTopicRetained
public static void setTopicRetained(int topic, boolean value) Sets whether topic is retained.- Parameters:
topic- Topic handle.value- True if topic should be retained.
-
getTopicRetained
public static boolean getTopicRetained(int topic) Returns true if topic is retained.- Parameters:
topic- Topic handle.- Returns:
- True if topic is retained.
-
setTopicCached
public static void setTopicCached(int topic, boolean value) Sets topic caching.- Parameters:
topic- Topic handle.value- True if topic should be cached.
-
getTopicCached
public static boolean getTopicCached(int topic) 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
public static boolean getTopicExists(int topic) Returns true if topic exists.- Parameters:
topic- Topic handle.- Returns:
- True if topic exists.
-
getTopicProperty
-
setTopicProperty
-
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
public static void unsubscribe(int sub) 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
public static void unpublish(int pubentry) Unpublishes topic.- Parameters:
pubentry- Publish entry handle.
-
releaseEntry
public static void releaseEntry(int entry) Releases NT entry.- Parameters:
entry- NT entry handle.
-
release
public static void release(int pubsubentry) Releases pubsub entry.- Parameters:
pubsubentry- Pubsub entry handle.
-
getTopicFromHandle
public static int getTopicFromHandle(int pubsubentry) 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
public static void unsubscribeMultiple(int sub) 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
public static boolean[] readQueueValuesBoolean(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setBoolean
public static boolean setBoolean(int entry, long time, boolean value) Sets topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getBoolean
public static boolean getBoolean(int entry, boolean defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultBoolean
public static boolean setDefaultBoolean(int entry, long time, boolean defaultValue) Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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
public static long[] readQueueValuesInteger(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setInteger
public static boolean setInteger(int entry, long time, long value) Sets topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getInteger
public static long getInteger(int entry, long defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultInteger
public static boolean setDefaultInteger(int entry, long time, long defaultValue) Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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
public static float[] readQueueValuesFloat(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setFloat
public static boolean setFloat(int entry, long time, float value) Sets topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getFloat
public static float getFloat(int entry, float defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultFloat
public static boolean setDefaultFloat(int entry, long time, float defaultValue) Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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
public static double[] readQueueValuesDouble(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setDouble
public static boolean setDouble(int entry, long time, double value) Sets topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getDouble
public static double getDouble(int entry, double defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultDouble
public static boolean setDefaultDouble(int entry, long time, double defaultValue) Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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 nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getString
-
setDefaultString
Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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
public static byte[][] readQueueValuesRaw(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setRaw
public static boolean setRaw(int entry, long time, byte[] value) Sets raw topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Raw value buffer.- Returns:
- True if set succeeded.
-
setRaw
public static boolean setRaw(int entry, long time, byte[] value, int start, int len) Sets raw topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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 nanoseconds.value- Raw value buffer.- Returns:
- True if set succeeded.
-
setRaw
Sets raw topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Raw value buffer.start- Value's offset into buffer.len- Length of value in buffer.- Returns:
- True if set succeeded.
-
getRaw
public static byte[] getRaw(int entry, byte[] defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultRaw
public static boolean setDefaultRaw(int entry, long time, byte[] defaultValue) Sets default raw topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.defaultValue- Default value.- Returns:
- True if set succeeded.
-
setDefaultRaw
public static boolean setDefaultRaw(int entry, long time, byte[] defaultValue, int start, int len) Sets default raw topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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 nanoseconds.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 nanoseconds.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
public static boolean[][] readQueueValuesBooleanArray(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setBooleanArray
public static boolean setBooleanArray(int entry, long time, boolean[] value) Sets topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getBooleanArray
public static boolean[] getBooleanArray(int entry, boolean[] defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultBooleanArray
public static boolean setDefaultBooleanArray(int entry, long time, boolean[] defaultValue) Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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
public static long[][] readQueueValuesIntegerArray(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setIntegerArray
public static boolean setIntegerArray(int entry, long time, long[] value) Sets topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getIntegerArray
public static long[] getIntegerArray(int entry, long[] defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultIntegerArray
public static boolean setDefaultIntegerArray(int entry, long time, long[] defaultValue) Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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
public static float[][] readQueueValuesFloatArray(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setFloatArray
public static boolean setFloatArray(int entry, long time, float[] value) Sets topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getFloatArray
public static float[] getFloatArray(int entry, float[] defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultFloatArray
public static boolean setDefaultFloatArray(int entry, long time, float[] defaultValue) Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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
public static double[][] readQueueValuesDoubleArray(int subentry) Returns queued topic values.- Parameters:
subentry- Subentry handle.- Returns:
- List of topic values.
-
setDoubleArray
public static boolean setDoubleArray(int entry, long time, double[] value) Sets topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getDoubleArray
public static double[] getDoubleArray(int entry, double[] defaultValue) Returns topic value.- Parameters:
entry- Entry handle.defaultValue- Default value.- Returns:
- Topic value.
-
setDefaultDoubleArray
public static boolean setDefaultDoubleArray(int entry, long time, double[] defaultValue) Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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 nanoseconds.value- Topic value.- Returns:
- True if set succeeded.
-
getStringArray
-
setDefaultStringArray
Sets default topic value.- Parameters:
entry- Entry handle.time- Time in nanoseconds.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
public static void setEntryFlags(int entry, int flags) Sets entry flags.- Parameters:
entry- Entry handle.flags- Entry flags.
-
getEntryFlags
public static int getEntryFlags(int entry) 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
public static int createListenerPoller(int inst) Creates a listener poller.- Parameters:
inst- NT instance handle.- Returns:
- Listener poller handle.
-
destroyListenerPoller
public static void destroyListenerPoller(int poller) Destroys listener poller.- Parameters:
poller- Listener poller handle.
-
addListener
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
public static int addListener(int poller, int handle, int mask) 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
public static void removeListener(int listener) Removes listener.- Parameters:
listener- Listener handle.
-
getNetworkMode
public static int getNetworkMode(int inst) Returns network mode.- Parameters:
inst- NT instance handle.- Returns:
- Network mode.
-
startLocal
public static void startLocal(int inst) 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
public static void stopLocal(int inst) 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, String mdnsService, int port) 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 addressmdnsService- the mDNS service name to advertise, or empty to not advertiseport- port to communicate over
-
stopServer
public static void stopServer(int inst) Stops the server if it is running.- Parameters:
inst- NT instance handle.
-
startClient
Starts a client. Use SetServer, SetServerTeam, SetServerFixed, or SetServerMdns to set the server name and port.- Parameters:
inst- NT instance handle.identity- network identity to advertise (cannot be empty string)
-
stopClient
public static void stopClient(int inst) 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)
-
setServerMdns
Sets server address and port for client (without restarting client). Connects using a NetworkTables server announced over mDNS with the specified service name.- Parameters:
inst- NT instance handle.serviceName- mDNS service name
-
setServerMdns
Sets server address and port for client (without restarting client). Connects using the fixed server address and a NetworkTables server announced over mDNS with the specified service name.- Parameters:
inst- NT instance handle.serviceName- mDNS service nameserverName- server nameport- port to communicate over
-
setServerMdns
Sets server addresses and ports for client (without restarting client). Connects using fixed server addresses and a NetworkTables server announced over mDNS with the specified service name.- Parameters:
inst- NT instance handle.serviceName- mDNS service nameserverNames- array of server namesports- array of port numbers (0=default)
-
setServerMdns
public static void setServerMdns(int inst, String serviceName, int mdnsPort, String[] serverNames, int[] ports) Sets server addresses and ports for client (without restarting client). Connects using fixed server addresses and a NetworkTables server announced over mDNS with the specified service name.- Parameters:
inst- NT instance handle.serviceName- mDNS service namemdnsPort- mDNS port to communicate over (0=default)serverNames- array of server namesports- array of port numbers (0=default)
-
setServerTeam
Sets server addresses and port for client (without restarting client).Attempts connections to the following addresses in parallel:
- 10.TE.AM.2
- 172.26.0.1 on Windows, or 172.27.0.1 on other platforms (USB)
- 172.30.0.1 (WiFi)
It also connects using matching Systemcore mDNS announcements. The team-specific 10.TE.AM.2 address is only added if the team string parses as an integer in the range 0 to 25599 inclusive.
- Parameters:
inst- NT instance handle.team- team number stringport- port to communicate over
-
setServerFixed
Sets server addresses and port for client (without restarting client).Attempts connections to the following static addresses and hostnames in parallel:
- 10.TE.AM.2
- 172.26.0.1 on Windows, or 172.27.0.1 on other platforms (USB)
- 172.30.0.1 (WiFi)
- robot.local
It also connects using all Systemcore mDNS announcements. The team-specific 10.TE.AM.2 address is only added if the team string parses as an integer in the range 0 to 25599 inclusive.
- Parameters:
inst- NT instance handle.team- team number stringport- port to communicate over
-
disconnect
public static void disconnect(int inst) 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
public static void startDSClient(int inst, int port) 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
public static void stopDSClient(int inst) Stops requesting server address from Driver Station.- Parameters:
inst- NT instance handle.
-
flushLocal
public static void flushLocal(int inst) Flushes all updated values immediately to the local client/server. This does not flush to the network.- Parameters:
inst- NT instance handle.
-
flush
public static void flush(int inst) 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
public static boolean isConnected(int inst) 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 nanoseconds (optional)
-
now
public static long now()Returns the current timestamp in nanoseconds.- Returns:
- The current timestamp in nanoseconds.
-
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
public static void stopEntryDataLog(int logger) 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
public static void stopConnectionDataLog(int logger) Stops logging connection changes to a DataLog.- Parameters:
logger- data logger handle
-
addLogger
public static int addLogger(int poller, int minLevel, int maxLevel) 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
-