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 005package edu.wpi.first.networktables; 006 007import java.util.function.Supplier; 008 009/** NetworkTables BooleanArray subscriber. */ 010@SuppressWarnings("PMD.MissingOverride") 011public interface BooleanArraySubscriber extends Subscriber, Supplier<boolean[]> { 012 /** 013 * Get the corresponding topic. 014 * 015 * @return Topic 016 */ 017 @Override 018 BooleanArrayTopic getTopic(); 019 020 /** 021 * Get the last published value. 022 * If no value has been published, returns the stored default value. 023 * 024 * @return value 025 */ 026 boolean[] get(); 027 028 /** 029 * Get the last published value. 030 * If no value has been published, returns the passed defaultValue. 031 * 032 * @param defaultValue default value to return if no value has been published 033 * @return value 034 */ 035 boolean[] get(boolean[] defaultValue); 036 037 /** 038 * Get the last published value along with its timestamp 039 * If no value has been published, returns the stored default value and a 040 * timestamp of 0. 041 * 042 * @return timestamped value 043 */ 044 TimestampedBooleanArray getAtomic(); 045 046 /** 047 * Get the last published value along with its timestamp 048 * If no value has been published, returns the passed defaultValue and a 049 * timestamp of 0. 050 * 051 * @param defaultValue default value to return if no value has been published 052 * @return timestamped value 053 */ 054 TimestampedBooleanArray getAtomic(boolean[] defaultValue); 055 056 /** 057 * Get an array of all value changes since the last call to readQueue. 058 * Also provides a timestamp for each value. 059 * 060 * <p>The "poll storage" subscribe option can be used to set the queue 061 * depth. 062 * 063 * @return Array of timestamped values; empty array if no new changes have 064 * been published since the previous call. 065 */ 066 TimestampedBooleanArray[] readQueue(); 067 068 /** 069 * Get an array of all value changes since the last call to readQueue. 070 * 071 * <p>The "poll storage" subscribe option can be used to set the queue 072 * depth. 073 * 074 * @return Array of values; empty array if no new changes have been 075 * published since the previous call. 076 */ 077 boolean[][] readQueueValues(); 078}