001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
006
007package edu.wpi.first.networktables;
008
009import java.util.function.BooleanSupplier;
010
011/** NetworkTables Boolean subscriber. */
012@SuppressWarnings("PMD.MissingOverride")
013public interface BooleanSubscriber extends Subscriber, BooleanSupplier {
014  /**
015   * Get the corresponding topic.
016   *
017   * @return Topic
018   */
019  @Override
020  BooleanTopic getTopic();
021
022  /**
023   * Get the last published value.
024   * If no value has been published, returns the stored default value.
025   *
026   * @return value
027   */
028  boolean get();
029
030  /**
031   * Get the last published value.
032   * If no value has been published, returns the passed defaultValue.
033   *
034   * @param defaultValue default value to return if no value has been published
035   * @return value
036   */
037  boolean get(boolean defaultValue);
038
039  @Override
040  default boolean getAsBoolean() {
041    return get();
042  }
043
044  /**
045   * Get the last published value along with its timestamp
046   * If no value has been published, returns the stored default value and a
047   * timestamp of 0.
048   *
049   * @return timestamped value
050   */
051  TimestampedBoolean getAtomic();
052
053  /**
054   * Get the last published value along with its timestamp
055   * If no value has been published, returns the passed defaultValue and a
056   * timestamp of 0.
057   *
058   * @param defaultValue default value to return if no value has been published
059   * @return timestamped value
060   */
061  TimestampedBoolean getAtomic(boolean defaultValue);
062
063  /**
064   * Get an array of all value changes since the last call to readQueue.
065   * Also provides a timestamp for each value.
066   *
067   * <p>The "poll storage" subscribe option can be used to set the queue
068   * depth.
069   *
070   * @return Array of timestamped values; empty array if no new changes have
071   *     been published since the previous call.
072   */
073  TimestampedBoolean[] readQueue();
074
075  /**
076   * Get an array of all value changes since the last call to readQueue.
077   *
078   * <p>The "poll storage" subscribe option can be used to set the queue
079   * depth.
080   *
081   * @return Array of values; empty array if no new changes have been
082   *     published since the previous call.
083   */
084  boolean[] readQueueValues();
085}