Interface ProtobufSubscriber<T>

Type Parameters:
T - value class
All Superinterfaces:
AutoCloseable, PubSub, Subscriber, Supplier<T>
All Known Subinterfaces:
ProtobufEntry<T>

public interface ProtobufSubscriber<T>
extends Subscriber, Supplier<T>
NetworkTables protobuf-encoded value subscriber.
  • Method Details

    • getTopic

      Get the corresponding topic.
      Specified by:
      getTopic in interface PubSub
      Returns:
      Topic
    • get

      T get()
      Get the last published value. If no value has been published or the value cannot be unpacked, returns the stored default value.
      Specified by:
      get in interface Supplier<T>
      Returns:
      value
    • get

      T get​(T defaultValue)
      Get the last published value. If no value has been published or the value cannot be unpacked, returns the passed defaultValue.
      Parameters:
      defaultValue - default value to return if no value has been published
      Returns:
      value
    • getInto

      boolean getInto​(T out)
      Get the last published value, replacing the contents in place of an existing object. If no value has been published or the value cannot be unpacked, does not replace the contents and returns false. This function will not work (will throw UnsupportedOperationException) unless T is mutable (and the implementation of Struct implements unpackInto).

      Note: due to Java language limitations, it's not possible to validate at compile time that the out parameter is mutable.

      Parameters:
      out - object to replace contents of; must be mutable
      Returns:
      true if successful
      Throws:
      UnsupportedOperationException - if T is immutable
    • getAtomic

      Get the last published value along with its timestamp. If no value has been published or the value cannot be unpacked, returns the stored default value and a timestamp of 0.
      Returns:
      timestamped value
    • getAtomic

      TimestampedObject<T> getAtomic​(T defaultValue)
      Get the last published value along with its timestamp. If no value has been published or the value cannot be unpacked, returns the passed defaultValue and a timestamp of 0.
      Parameters:
      defaultValue - default value to return if no value has been published
      Returns:
      timestamped value
    • readQueue

      Get an array of all valid value changes since the last call to readQueue. Also provides a timestamp for each value. Values that cannot be unpacked are dropped.

      The "poll storage" subscribe option can be used to set the queue depth.

      Returns:
      Array of timestamped values; empty array if no valid new changes have been published since the previous call.
    • readQueueValues

      Get an array of all valid value changes since the last call to readQueue. Values that cannot be unpacked are dropped.

      The "poll storage" subscribe option can be used to set the queue depth.

      Returns:
      Array of values; empty array if no valid new changes have been published since the previous call.