Class NetworkTablesJNI

java.lang.Object
edu.wpi.first.networktables.NetworkTablesJNI

public final class NetworkTablesJNI
extends Object
NetworkTables JNI.
  • Method Details

    • forceLoad

      public static void forceLoad() throws IOException
      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

      public static int getEntry​(int inst, String key)
      Returns NT entry handle.
      Parameters:
      inst - NT instance handle.
      key - NT entry key.
      Returns:
      NT entry handle.
    • getEntry

      public static int getEntry​(int topic, int type, String typeStr, PubSubOptions options)
      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

      public static int getEntry​(int topic, int type, String typeStr, PubSubOption... options)
      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

      public static String getEntryName​(int entry)
      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 microseconds.
      Parameters:
      entry - NT entry handle.
      Returns:
      NT entry last change time in microseconds.
    • getType

      public static int getType​(int entry)
      Returns NT entry type.
      Parameters:
      entry - NT entry handle.
      Returns:
      NT entry type.
    • getTopics

      public static int[] getTopics​(int inst, String prefix, int types)
      Returns list of topic handles.
      Parameters:
      inst - NT instance handle.
      prefix - Topic prefix.
      types - Topic types.
      Returns:
      List of topic handles.
    • getTopicsStr

      public static int[] getTopicsStr​(int inst, String prefix, String[] types)
      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

      public static int getTopic​(int inst, String name)
      Returns Topic handle.
      Parameters:
      inst - NT instance handle.
      name - Topic name.
      Returns:
      Topic handle.
    • getTopicName

      public static String getTopicName​(int topic)
      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

      public static String getTopicTypeString​(int topic)
      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

      public static String getTopicProperty​(int topic, String name)
      Returns topic property.
      Parameters:
      topic - Topic handle.
      name - Property name.
      Returns:
      Topic property.
    • setTopicProperty

      public static void setTopicProperty​(int topic, String name, String value)
      Sets topic property.
      Parameters:
      topic - Topic handle.
      name - Property name.
      value - Property value.
    • deleteTopicProperty

      public static void deleteTopicProperty​(int topic, String name)
      Deletes topic property.
      Parameters:
      topic - Topic handle.
      name - Property name.
    • getTopicProperties

      public static String getTopicProperties​(int topic)
      Returns topic properties.
      Parameters:
      topic - Topic handle.
      Returns:
      Topic properties.
    • setTopicProperties

      public static void setTopicProperties​(int topic, String properties)
      Sets topic properties.
      Parameters:
      topic - Topic handle.
      properties - Topic properties.
    • subscribe

      public static int subscribe​(int topic, int type, String typeStr, PubSubOptions options)
      Subscribes to topic.
      Parameters:
      topic - Topic handle.
      type - Topic type.
      typeStr - Topic type as a string.
      options - Pubsub options.
      Returns:
      Subscriber handle.
    • subscribe

      public static int subscribe​(int topic, int type, String typeStr, PubSubOption... options)
      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

      public static int publish​(int topic, int type, String typeStr, PubSubOptions options)
      Publishes topic.
      Parameters:
      topic - Topic handle.
      type - Topic type.
      typeStr - Topic type as a string.
      options - Pubsub options.
      Returns:
      Publish handle.
    • publish

      public static int publish​(int topic, int type, String typeStr, PubSubOption... options)
      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)
      Relesaes 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

      public static int subscribeMultiple​(int inst, String[] prefixes, PubSubOptions options)
      Subscribes to multiple topics.
      Parameters:
      inst - NT instance handle.
      prefixes - List of topic prefixes.
      options - Pubsub options.
      Returns:
      Subscribe handle.
    • subscribeMultiple

      public static int subscribeMultiple​(int inst, String[] prefixes, PubSubOption... options)
      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

      public static TimestampedBoolean getAtomicBoolean​(int subentry, boolean defaultValue)
      Returns timestamped topic value as an atomic Boolean.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueBoolean

      public static TimestampedBoolean[] readQueueBoolean​(int subentry)
      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicInteger

      public static TimestampedInteger getAtomicInteger​(int subentry, long defaultValue)
      Returns timestamped topic value as an atomic Integer.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueInteger

      public static TimestampedInteger[] readQueueInteger​(int subentry)
      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicFloat

      public static TimestampedFloat getAtomicFloat​(int subentry, float defaultValue)
      Returns timestamped topic value as an atomic Float.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueFloat

      public static TimestampedFloat[] readQueueFloat​(int subentry)
      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicDouble

      public static TimestampedDouble getAtomicDouble​(int subentry, double defaultValue)
      Returns timestamped topic value as an atomic Double.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueDouble

      public static TimestampedDouble[] readQueueDouble​(int subentry)
      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicString

      public static TimestampedString getAtomicString​(int subentry, String defaultValue)
      Returns timestamped topic value as an atomic String.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueString

      public static TimestampedString[] readQueueString​(int subentry)
      Returns queued timestamped topic values.
      Parameters:
      subentry - Subentry handle.
      Returns:
      List of timestamped topic values.
    • readQueueValuesString

      public static String[] readQueueValuesString​(int subentry)
      Returns queued topic values.
      Parameters:
      subentry - Subentry handle.
      Returns:
      List of topic values.
    • setString

      public static boolean setString​(int entry, long time, String value)
      Sets topic value.
      Parameters:
      entry - Entry handle.
      time - Time in microseconds.
      value - Topic value.
      Returns:
      True if set succeeded.
    • getString

      public static String getString​(int entry, String defaultValue)
      Returns topic value.
      Parameters:
      entry - Entry handle.
      defaultValue - Default value.
      Returns:
      Topic value.
    • setDefaultString

      public static boolean setDefaultString​(int entry, long time, String defaultValue)
      Sets default topic value.
      Parameters:
      entry - Entry handle.
      time - Time in microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicRaw

      public static TimestampedRaw getAtomicRaw​(int subentry, byte[] defaultValue)
      Returns timestamped topic value as an atomic Raw.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueRaw

      public static TimestampedRaw[] readQueueRaw​(int subentry)
      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 microseconds.
      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 microseconds.
      value - Raw value buffer.
      start - Value's offset into buffer.
      len - Length of value in buffer.
      Returns:
      True if set succeeded.
    • setRaw

      public static boolean setRaw​(int entry, long time, ByteBuffer value)
      Sets raw topic value.
      Parameters:
      entry - Entry handle.
      time - Time in microseconds.
      value - Raw value buffer.
      Returns:
      True if set succeeded.
    • setRaw

      public static boolean setRaw​(int entry, long time, ByteBuffer value, int start, int len)
      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

      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      start - Value's offset into buffer.
      len - Length of value in buffer.
      Returns:
      True if set succeeded.
    • setDefaultRaw

      public static boolean setDefaultRaw​(int entry, long time, ByteBuffer defaultValue)
      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

      public static TimestampedBooleanArray getAtomicBooleanArray​(int subentry, boolean[] defaultValue)
      Returns timestamped topic value as an atomic BooleanArray.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueBooleanArray

      public static TimestampedBooleanArray[] readQueueBooleanArray​(int subentry)
      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicIntegerArray

      public static TimestampedIntegerArray getAtomicIntegerArray​(int subentry, long[] defaultValue)
      Returns timestamped topic value as an atomic IntegerArray.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueIntegerArray

      public static TimestampedIntegerArray[] readQueueIntegerArray​(int subentry)
      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicFloatArray

      public static TimestampedFloatArray getAtomicFloatArray​(int subentry, float[] defaultValue)
      Returns timestamped topic value as an atomic FloatArray.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueFloatArray

      public static TimestampedFloatArray[] readQueueFloatArray​(int subentry)
      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicDoubleArray

      public static TimestampedDoubleArray getAtomicDoubleArray​(int subentry, double[] defaultValue)
      Returns timestamped topic value as an atomic DoubleArray.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueDoubleArray

      public static TimestampedDoubleArray[] readQueueDoubleArray​(int subentry)
      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 microseconds.
      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 microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • getAtomicStringArray

      public static TimestampedStringArray getAtomicStringArray​(int subentry, String[] defaultValue)
      Returns timestamped topic value as an atomic StringArray.
      Parameters:
      subentry - Subentry handle.
      defaultValue - Default value.
      Returns:
      Timestamped topic value.
    • readQueueStringArray

      public static TimestampedStringArray[] readQueueStringArray​(int subentry)
      Returns queued timestamped topic values.
      Parameters:
      subentry - Subentry handle.
      Returns:
      List of timestamped topic values.
    • readQueueValuesStringArray

      public static String[][] readQueueValuesStringArray​(int subentry)
      Returns queued topic values.
      Parameters:
      subentry - Subentry handle.
      Returns:
      List of topic values.
    • setStringArray

      public static boolean setStringArray​(int entry, long time, String[] value)
      Sets topic value.
      Parameters:
      entry - Entry handle.
      time - Time in microseconds.
      value - Topic value.
      Returns:
      True if set succeeded.
    • getStringArray

      public static String[] getStringArray​(int entry, String[] defaultValue)
      Returns topic value.
      Parameters:
      entry - Entry handle.
      defaultValue - Default value.
      Returns:
      Topic value.
    • setDefaultStringArray

      public static boolean setDefaultStringArray​(int entry, long time, String[] defaultValue)
      Sets default topic value.
      Parameters:
      entry - Entry handle.
      time - Time in microseconds.
      defaultValue - Default value.
      Returns:
      True if set succeeded.
    • readQueueValue

      public static NetworkTableValue[] readQueueValue​(int subentry)
      Returns queued subentry values.
      Parameters:
      subentry - Subentry handle.
      Returns:
      List of queued subentry values.
    • getValue

      public static NetworkTableValue getValue​(int entry)
      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

      public static TopicInfo getTopicInfo​(NetworkTableInstance inst, int topic)
      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

      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

      public static int addListener​(int poller, int handle, EnumSet<NetworkTableEvent.Kind> kinds)
      Adds listener.
      Parameters:
      poller - Listener poller handle.
      handle - Topic handle.
      kinds - Enum set of NT event kinds.
      Returns:
      Listener handle.
    • addListener

      public static int addListener​(int poller, String[] prefixes, int mask)
      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

      public static NetworkTableEvent[] readListenerQueue​(NetworkTableInstance inst, int poller)
      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, 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 use
      listenAddress - the address to listen on, or empty to listen on any address
      port3 - port to communicate over (NT3)
      port4 - port to communicate over (NT4)
    • stopServer

      public static void stopServer​(int inst)
      Stops the server if it is running.
      Parameters:
      inst - NT instance handle.
    • startClient3

      public static void startClient3​(int inst, String identity)
      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

      public static void startClient4​(int inst, String identity)
      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

      public static void stopClient​(int inst)
      Stops the client if it is running.
      Parameters:
      inst - NT instance handle.
    • setServer

      public static void setServer​(int inst, String serverName, int port)
      Sets server address and port for client (without restarting client).
      Parameters:
      inst - NT instance handle.
      serverName - server name
      port - port to communicate over
    • setServer

      public static void setServer​(int inst, String[] serverNames, int[] ports)
      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 names
      ports - array of port numbers (0=default)
    • setServerTeam

      public static void setServerTeam​(int inst, int team, int port)
      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 number
      port - 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

      public static ConnectionInfo[] getConnections​(int inst)
      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

      public static OptionalLong getServerTimeOffset​(int inst)
      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

      public static long now()
      Returns the current timestamp in microseconds.
      Returns:
      The current timestsamp in microseconds.
    • startEntryDataLog

      public static int startEntryDataLog​(int inst, DataLog log, String prefix, String logPrefix)
      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 destroyed
      prefix - only store entries with names that start with this prefix; the prefix is not included in the data log entry name
      logPrefix - 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

      public static int startConnectionDataLog​(int inst, DataLog log, String name)
      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 destroyed
      name - 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 level
      maxLevel - maximum log level
      Returns:
      Listener handle