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 009 010import java.nio.ByteBuffer; 011import java.util.function.Consumer; 012 013/** NetworkTables Raw publisher. */ 014public interface RawPublisher extends Publisher, Consumer<byte[]> { 015 /** 016 * Get the corresponding topic. 017 * 018 * @return Topic 019 */ 020 @Override 021 RawTopic getTopic(); 022 023 /** 024 * Publish a new value using current NT time. 025 * 026 * @param value value to publish 027 */ 028 default void set(byte[] value) { 029 set(value, 0); 030 } 031 032 033 /** 034 * Publish a new value. 035 * 036 * @param value value to publish 037 * @param time timestamp; 0 indicates current NT time should be used 038 */ 039 default void set(byte[] value, long time) { 040 set(value, 0, value.length, time); 041 } 042 043 /** 044 * Publish a new value using current NT time. 045 * 046 * @param value value to publish 047 * @param start Start position of data (in buffer) 048 * @param len Length of data (must be less than or equal to value.length - start) 049 */ 050 default void set(byte[] value, int start, int len) { 051 set(value, start, len, 0); 052 } 053 054 /** 055 * Publish a new value. 056 * 057 * @param value value to publish 058 * @param start Start position of data (in buffer) 059 * @param len Length of data (must be less than or equal to value.length - start) 060 * @param time timestamp; 0 indicates current NT time should be used 061 */ 062 void set(byte[] value, int start, int len, long time); 063 064 /** 065 * Publish a new value using current NT time. 066 * 067 * @param value value to publish; will send from value.position() to value.limit() 068 */ 069 default void set(ByteBuffer value) { 070 set(value, 0); 071 } 072 073 /** 074 * Publish a new value. 075 * 076 * @param value value to publish; will send from value.position() to value.limit() 077 * @param time timestamp; 0 indicates current NT time should be used 078 */ 079 default void set(ByteBuffer value, long time) { 080 int pos = value.position(); 081 set(value, pos, value.limit() - pos, time); 082 } 083 084 /** 085 * Publish a new value using current NT time. 086 * 087 * @param value value to publish 088 * @param start Start position of data (in buffer) 089 * @param len Length of data (must be less than or equal to value.capacity() - start) 090 */ 091 default void set(ByteBuffer value, int start, int len) { 092 set(value, start, len, 0); 093 } 094 095 /** 096 * Publish a new value. 097 * 098 * @param value value to publish 099 * @param start Start position of data (in buffer) 100 * @param len Length of data (must be less than or equal to value.capacity() - start) 101 * @param time timestamp; 0 indicates current NT time should be used 102 */ 103 void set(ByteBuffer value, int start, int len, long time); 104 105 /** 106 * Publish a default value. 107 * On reconnect, a default value will never be used in preference to a 108 * published value. 109 * 110 * @param value value 111 */ 112 default void setDefault(byte[] value) { 113 setDefault(value, 0, value.length); 114 } 115 116 /** 117 * Publish a default value. 118 * On reconnect, a default value will never be used in preference to a 119 * published value. 120 * 121 * @param value value 122 * @param start Start position of data (in buffer) 123 * @param len Length of data (must be less than or equal to value.length - start) 124 */ 125 void setDefault(byte[] value, int start, int len); 126 127 /** 128 * Publish a default value. 129 * On reconnect, a default value will never be used in preference to a 130 * published value. 131 * 132 * @param value value; will send from value.position() to value.limit() 133 */ 134 default void setDefault(ByteBuffer value) { 135 int pos = value.position(); 136 setDefault(value, pos, value.limit() - pos); 137 } 138 139 /** 140 * Publish a default value. 141 * On reconnect, a default value will never be used in preference to a 142 * published value. 143 * 144 * @param value value 145 * @param start Start position of data (in buffer) 146 * @param len Length of data (must be less than or equal to value.capacity() - start) 147 */ 148 void setDefault(ByteBuffer value, int start, int len); 149 150 @Override 151 default void accept(byte[] value) { 152 set(value); 153 } 154}