mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[ntcore] Commit generated files (#5962)
This commit is contained in:
43
.github/workflows/pregenerate.yml
vendored
Normal file
43
.github/workflows/pregenerate.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Check Pregenerated Files
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
update:
|
||||
name: "Update"
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Fetch all history and metadata
|
||||
run: |
|
||||
git fetch --prune --unshallow
|
||||
git checkout -b pr
|
||||
git branch -f main origin/main
|
||||
- name: Set up Python 3.9
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.9
|
||||
- name: Install jinja
|
||||
run: python -m pip install jinja2
|
||||
- name: Run ntcore
|
||||
run: ./ntcore/generate_topics.py
|
||||
- name: Add untracked files to index so they count as changes
|
||||
run: git add -A
|
||||
- name: Check output
|
||||
run: git --no-pager diff --exit-code HEAD
|
||||
- name: Generate diff
|
||||
run: git diff HEAD > pregenerated-files-fixes.patch
|
||||
if: ${{ failure() }}
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: pregenerated-files-fixes
|
||||
path: pregenerated-files-fixes.patch
|
||||
if: ${{ failure() }}
|
||||
@@ -227,7 +227,6 @@ task generateJavaDocs(type: Javadoc) {
|
||||
options.addBooleanOption('html5', true)
|
||||
options.linkSource(true)
|
||||
dependsOn project(':hal').generateUsageReporting
|
||||
dependsOn project(':ntcore').ntcoreGenerateJavaTypes
|
||||
dependsOn project(':wpilibj').generateJavaVersion
|
||||
dependsOn project(':wpimath').generateNat
|
||||
source project(':apriltag').sourceSets.main.java
|
||||
|
||||
@@ -14,6 +14,8 @@ cppSrcFileInclude {
|
||||
|
||||
generatedFileExclude {
|
||||
ntcore/doc/
|
||||
ntcore/src/generated
|
||||
.*\.jinja
|
||||
}
|
||||
|
||||
repoRootNameOverride {
|
||||
|
||||
@@ -3,25 +3,10 @@ project(ntcore)
|
||||
include(CompileWarnings)
|
||||
include(AddTest)
|
||||
|
||||
execute_process(
|
||||
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/generate_topics.py ${WPILIB_BINARY_DIR}/ntcore
|
||||
RESULT_VARIABLE generateResult
|
||||
)
|
||||
if(NOT (generateResult EQUAL "0"))
|
||||
# Try python
|
||||
execute_process(
|
||||
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/generate_topics.py ${WPILIB_BINARY_DIR}/ntcore
|
||||
RESULT_VARIABLE generateResult
|
||||
)
|
||||
if(NOT (generateResult EQUAL "0"))
|
||||
message(FATAL_ERROR "python and python3 generate_topics.py failed")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(
|
||||
GLOB ntcore_native_src
|
||||
src/main/native/cpp/*.cpp
|
||||
${WPILIB_BINARY_DIR}/ntcore/generated/main/native/cpp/*.cpp
|
||||
src/generated/main/native/cpp/*.cpp
|
||||
src/main/native/cpp/net/*.cpp
|
||||
src/main/native/cpp/net3/*.cpp
|
||||
src/main/native/cpp/networktables/*.cpp
|
||||
@@ -34,7 +19,7 @@ target_include_directories(
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/cpp
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
|
||||
$<BUILD_INTERFACE:${WPILIB_BINARY_DIR}/ntcore/generated/main/native/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/generated/main/native/include>
|
||||
$<INSTALL_INTERFACE:${include_dest}/ntcore>
|
||||
)
|
||||
wpilib_target_warnings(ntcore)
|
||||
@@ -45,10 +30,7 @@ set_property(TARGET ntcore PROPERTY FOLDER "libraries")
|
||||
|
||||
install(TARGETS ntcore EXPORT ntcore)
|
||||
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/ntcore")
|
||||
install(
|
||||
DIRECTORY ${WPILIB_BINARY_DIR}/ntcore/generated/main/native/include/
|
||||
DESTINATION "${include_dest}/ntcore"
|
||||
)
|
||||
install(DIRECTORY src/generated/main/native/include DESTINATION "${include_dest}/ntcore")
|
||||
|
||||
configure_file(ntcore-config.cmake.in ${WPILIB_BINARY_DIR}/ntcore-config.cmake)
|
||||
install(FILES ${WPILIB_BINARY_DIR}/ntcore-config.cmake DESTINATION share/ntcore)
|
||||
@@ -65,17 +47,9 @@ if(WITH_JAVA)
|
||||
|
||||
set(CMAKE_JAVA_INCLUDE_PATH wpimath.jar ${QUICKBUF_JAR})
|
||||
|
||||
file(
|
||||
GLOB ntcore_jni_src
|
||||
src/main/native/cpp/jni/*.cpp
|
||||
${WPILIB_BINARY_DIR}/ntcore/generated/main/native/cpp/jni/*.cpp
|
||||
)
|
||||
file(GLOB ntcore_jni_src src/main/native/cpp/jni/*.cpp src/generated/main/native/cpp/jni/*.cpp)
|
||||
|
||||
file(
|
||||
GLOB_RECURSE JAVA_SOURCES
|
||||
src/main/java/*.java
|
||||
${WPILIB_BINARY_DIR}/ntcore/generated/*.java
|
||||
)
|
||||
file(GLOB_RECURSE JAVA_SOURCES src/main/java/*.java src/generated/main/java/*.java)
|
||||
set(CMAKE_JNI_TARGET true)
|
||||
|
||||
add_jar(
|
||||
@@ -113,7 +87,7 @@ if(WITH_JAVA_SOURCE)
|
||||
file(
|
||||
GLOB NTCORE_SOURCES
|
||||
src/main/java/edu/wpi/first/networktables/*.java
|
||||
${WPILIB_BINARY_DIR}/ntcore/generated/*.java
|
||||
src/generated/main/java/*.java
|
||||
)
|
||||
add_jar(
|
||||
ntcore_src_jar
|
||||
|
||||
@@ -1,290 +1,24 @@
|
||||
import groovy.json.JsonSlurper;
|
||||
import com.hubspot.jinjava.Jinjava;
|
||||
import com.hubspot.jinjava.JinjavaConfig;
|
||||
|
||||
def ntcoreTypesInputFile = file("src/generate/types.json")
|
||||
def ntcoreJavaTypesInputDir = file("src/generate/java")
|
||||
def ntcoreJavaTypesOutputDir = file("$buildDir/generated/main/java/edu/wpi/first/networktables")
|
||||
|
||||
task ntcoreGenerateJavaTypes() {
|
||||
description = "Generates ntcore Java type classes"
|
||||
group = "WPILib"
|
||||
|
||||
inputs.file ntcoreTypesInputFile
|
||||
inputs.dir ntcoreJavaTypesInputDir
|
||||
outputs.dir ntcoreJavaTypesOutputDir
|
||||
|
||||
doLast {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def jsonTypes = jsonSlurper.parse(ntcoreTypesInputFile)
|
||||
|
||||
ntcoreJavaTypesOutputDir.deleteDir()
|
||||
ntcoreJavaTypesOutputDir.mkdirs()
|
||||
|
||||
def config = new JinjavaConfig()
|
||||
def jinjava = new Jinjava(config)
|
||||
|
||||
ntcoreJavaTypesInputDir.listFiles().each { File file ->
|
||||
def template = file.text
|
||||
def outfn = file.name.substring(0, file.name.length() - 6)
|
||||
if (file.name.startsWith("NetworkTable") || file.name.startsWith("Generic")) {
|
||||
def replacements = new HashMap<String,?>()
|
||||
replacements.put("types", jsonTypes)
|
||||
def output = jinjava.render(template, replacements)
|
||||
new File(ntcoreJavaTypesOutputDir, outfn).write(output)
|
||||
} else {
|
||||
jsonTypes.each { Map<String,?> replacements ->
|
||||
def output = jinjava.render(template, replacements)
|
||||
def typename = replacements.get("TypeName")
|
||||
File outfile
|
||||
if (outfn == "Timestamped.java") {
|
||||
outfile = new File(ntcoreJavaTypesOutputDir, "Timestamped${typename}.java")
|
||||
} else {
|
||||
outfile = new File(ntcoreJavaTypesOutputDir, "${typename}${outfn}")
|
||||
}
|
||||
outfile.write(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def ntcoreCppTypesInputDir = file("src/generate/include/networktables")
|
||||
def ntcoreCppTypesOutputDir = file("$buildDir/generated/main/native/include/networktables")
|
||||
|
||||
task ntcoreGenerateCppTypes() {
|
||||
description = "Generates ntcore C++ type classes"
|
||||
group = "WPILib"
|
||||
|
||||
inputs.file ntcoreTypesInputFile
|
||||
inputs.dir ntcoreCppTypesInputDir
|
||||
outputs.dir ntcoreCppTypesOutputDir
|
||||
|
||||
doLast {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def jsonTypes = jsonSlurper.parse(ntcoreTypesInputFile)
|
||||
|
||||
ntcoreCppTypesOutputDir.deleteDir()
|
||||
ntcoreCppTypesOutputDir.mkdirs()
|
||||
|
||||
def config = new JinjavaConfig()
|
||||
def jinjava = new Jinjava(config)
|
||||
|
||||
ntcoreCppTypesInputDir.listFiles().each { File file ->
|
||||
def template = file.text
|
||||
def outfn = file.name.substring(0, file.name.length() - 6)
|
||||
jsonTypes.each { Map<String,?> replacements ->
|
||||
def output = jinjava.render(template, replacements)
|
||||
def typename = replacements.get("TypeName")
|
||||
def outfile = new File(ntcoreCppTypesOutputDir, "${typename}${outfn}")
|
||||
outfile.write(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def ntcoreCppHandleSourceInputFile = file("src/generate/cpp/ntcore_cpp_types.cpp.jinja")
|
||||
def ntcoreCppHandleSourceOutputFile = file("$buildDir/generated/main/native/cpp/ntcore_cpp_types.cpp")
|
||||
|
||||
task ntcoreGenerateCppHandleSource() {
|
||||
description = "Generates ntcore C++ handle source"
|
||||
group = "WPILib"
|
||||
|
||||
inputs.files([
|
||||
ntcoreTypesInputFile,
|
||||
ntcoreCppHandleSourceInputFile
|
||||
])
|
||||
outputs.file ntcoreCppHandleSourceOutputFile
|
||||
|
||||
doLast {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def jsonTypes = jsonSlurper.parse(ntcoreTypesInputFile)
|
||||
|
||||
ntcoreCppHandleSourceOutputFile.delete()
|
||||
|
||||
def config = new JinjavaConfig()
|
||||
def jinjava = new Jinjava(config)
|
||||
|
||||
def template = ntcoreCppHandleSourceInputFile.text
|
||||
def replacements = new HashMap<String,?>()
|
||||
replacements.put("types", jsonTypes)
|
||||
def output = jinjava.render(template, replacements)
|
||||
ntcoreCppHandleSourceOutputFile.write(output)
|
||||
}
|
||||
}
|
||||
|
||||
def ntcoreCppHandleHeaderInputFile = file("src/generate/include/ntcore_cpp_types.h.jinja")
|
||||
def ntcoreCppHandleHeaderOutputFile = file("$buildDir/generated/main/native/include/ntcore_cpp_types.h")
|
||||
|
||||
task ntcoreGenerateCppHandleHeader() {
|
||||
description = "Generates ntcore C++ handle header"
|
||||
group = "WPILib"
|
||||
|
||||
inputs.files([
|
||||
ntcoreTypesInputFile,
|
||||
ntcoreCppHandleHeaderInputFile
|
||||
])
|
||||
outputs.file ntcoreCppHandleHeaderOutputFile
|
||||
|
||||
doLast {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def jsonTypes = jsonSlurper.parse(ntcoreTypesInputFile)
|
||||
|
||||
ntcoreCppHandleHeaderOutputFile.delete()
|
||||
|
||||
def config = new JinjavaConfig()
|
||||
def jinjava = new Jinjava(config)
|
||||
|
||||
def template = ntcoreCppHandleHeaderInputFile.text
|
||||
def replacements = new HashMap<String,?>()
|
||||
replacements.put("types", jsonTypes)
|
||||
def output = jinjava.render(template, replacements)
|
||||
ntcoreCppHandleHeaderOutputFile.write(output)
|
||||
}
|
||||
}
|
||||
|
||||
def ntcoreCHandleSourceInputFile = file("src/generate/cpp/ntcore_c_types.cpp.jinja")
|
||||
def ntcoreCHandleSourceOutputFile = file("$buildDir/generated/main/native/cpp/ntcore_c_types.cpp")
|
||||
|
||||
task ntcoreGenerateCHandleSource() {
|
||||
description = "Generates ntcore C handle source"
|
||||
group = "WPILib"
|
||||
|
||||
inputs.files([
|
||||
ntcoreTypesInputFile,
|
||||
ntcoreCHandleSourceInputFile
|
||||
])
|
||||
outputs.file ntcoreCHandleSourceOutputFile
|
||||
|
||||
doLast {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def jsonTypes = jsonSlurper.parse(ntcoreTypesInputFile)
|
||||
|
||||
ntcoreCHandleSourceOutputFile.delete()
|
||||
|
||||
def config = new JinjavaConfig()
|
||||
def jinjava = new Jinjava(config)
|
||||
|
||||
def template = ntcoreCHandleSourceInputFile.text
|
||||
def replacements = new HashMap<String,?>()
|
||||
replacements.put("types", jsonTypes)
|
||||
def output = jinjava.render(template, replacements)
|
||||
ntcoreCHandleSourceOutputFile.write(output)
|
||||
}
|
||||
}
|
||||
|
||||
def ntcoreCHandleHeaderInputFile = file("src/generate/include/ntcore_c_types.h.jinja")
|
||||
def ntcoreCHandleHeaderOutputFile = file("$buildDir/generated/main/native/include/ntcore_c_types.h")
|
||||
|
||||
task ntcoreGenerateCHandleHeader() {
|
||||
description = "Generates ntcore C handle header"
|
||||
group = "WPILib"
|
||||
|
||||
inputs.files([
|
||||
ntcoreTypesInputFile,
|
||||
ntcoreCHandleHeaderInputFile
|
||||
])
|
||||
outputs.file ntcoreCHandleHeaderOutputFile
|
||||
|
||||
doLast {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def jsonTypes = jsonSlurper.parse(ntcoreTypesInputFile)
|
||||
|
||||
ntcoreCHandleHeaderOutputFile.delete()
|
||||
|
||||
def config = new JinjavaConfig()
|
||||
def jinjava = new Jinjava(config)
|
||||
|
||||
def template = ntcoreCHandleHeaderInputFile.text
|
||||
def replacements = new HashMap<String,?>()
|
||||
replacements.put("types", jsonTypes)
|
||||
def output = jinjava.render(template, replacements)
|
||||
ntcoreCHandleHeaderOutputFile.write(output)
|
||||
}
|
||||
}
|
||||
|
||||
def ntcoreJniSourceInputFile = file("src/generate/cpp/jni/types_jni.cpp.jinja")
|
||||
def ntcoreJniSourceOutputFile = file("$buildDir/generated/main/native/cpp/jni/types_jni.cpp")
|
||||
|
||||
task ntcoreGenerateJniSource() {
|
||||
description = "Generates ntcore JNI types source"
|
||||
group = "WPILib"
|
||||
|
||||
inputs.files([
|
||||
ntcoreTypesInputFile,
|
||||
ntcoreJniSourceInputFile
|
||||
])
|
||||
outputs.file ntcoreJniSourceOutputFile
|
||||
|
||||
doLast {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
def jsonTypes = jsonSlurper.parse(ntcoreTypesInputFile)
|
||||
|
||||
ntcoreJniSourceOutputFile.delete()
|
||||
|
||||
def config = new JinjavaConfig()
|
||||
def jinjava = new Jinjava(config)
|
||||
|
||||
def template = ntcoreJniSourceInputFile.text
|
||||
def replacements = new HashMap<String,?>()
|
||||
replacements.put("types", jsonTypes)
|
||||
def output = jinjava.render(template, replacements)
|
||||
ntcoreJniSourceOutputFile.write(output)
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
addNtcoreDependency = { binary, shared->
|
||||
binary.tasks.withType(AbstractNativeSourceCompileTask) {
|
||||
it.dependsOn ntcoreGenerateCppTypes
|
||||
it.dependsOn ntcoreGenerateCppHandleHeader
|
||||
it.dependsOn ntcoreGenerateCHandleHeader
|
||||
}
|
||||
binary.lib project: ':ntcore', library: 'ntcore', linkage: shared
|
||||
}
|
||||
|
||||
addNtcoreJniDependency = { binary->
|
||||
binary.tasks.withType(AbstractNativeSourceCompileTask) {
|
||||
it.dependsOn ntcoreGenerateCppTypes
|
||||
it.dependsOn ntcoreGenerateCppHandleHeader
|
||||
it.dependsOn ntcoreGenerateCHandleHeader
|
||||
}
|
||||
binary.lib project: ':ntcore', library: 'ntcoreJNIShared', linkage: 'shared'
|
||||
}
|
||||
|
||||
nativeName = 'ntcore'
|
||||
devMain = 'edu.wpi.first.ntcore.DevMain'
|
||||
generatedSources = "$buildDir/generated/main/native/cpp"
|
||||
generatedHeaders = "$buildDir/generated/main/native/include"
|
||||
generatedSources = "$projectDir/src/generated/main/native/cpp"
|
||||
generatedHeaders = "$projectDir/src/generated/main/native/include"
|
||||
jniSplitSetup = {
|
||||
it.tasks.withType(CppCompile) {
|
||||
it.dependsOn ntcoreGenerateCppTypes
|
||||
it.dependsOn ntcoreGenerateCppHandleSource
|
||||
it.dependsOn ntcoreGenerateCppHandleHeader
|
||||
it.dependsOn ntcoreGenerateCHandleSource
|
||||
it.dependsOn ntcoreGenerateCHandleHeader
|
||||
it.dependsOn ntcoreGenerateJniSource
|
||||
}
|
||||
}
|
||||
splitSetup = {
|
||||
it.tasks.withType(CppCompile) {
|
||||
it.dependsOn ntcoreGenerateCppTypes
|
||||
it.dependsOn ntcoreGenerateCppHandleSource
|
||||
it.dependsOn ntcoreGenerateCppHandleHeader
|
||||
it.dependsOn ntcoreGenerateCHandleSource
|
||||
it.dependsOn ntcoreGenerateCHandleHeader
|
||||
it.dependsOn ntcoreGenerateJniSource
|
||||
it.includes 'src/main/native/cpp'
|
||||
}
|
||||
}
|
||||
exeSplitSetup = {
|
||||
it.tasks.withType(CppCompile) {
|
||||
it.dependsOn ntcoreGenerateCppTypes
|
||||
it.dependsOn ntcoreGenerateCppHandleSource
|
||||
it.dependsOn ntcoreGenerateCppHandleHeader
|
||||
it.dependsOn ntcoreGenerateCHandleSource
|
||||
it.dependsOn ntcoreGenerateCHandleHeader
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,13 +42,9 @@ model {
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.java.srcDir "${buildDir}/generated/main/java"
|
||||
compileJava.dependsOn ntcoreGenerateJavaTypes
|
||||
sourceSets.main.java.srcDir "${projectDir}/src/generated/main/java"
|
||||
|
||||
cppHeadersZip {
|
||||
dependsOn ntcoreGenerateCppTypes
|
||||
dependsOn ntcoreGenerateCppHandleHeader
|
||||
dependsOn ntcoreGenerateCHandleHeader
|
||||
from(generatedHeaders) {
|
||||
into '/'
|
||||
}
|
||||
|
||||
50
ntcore/generate_topics.py
Normal file → Executable file
50
ntcore/generate_topics.py
Normal file → Executable file
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
@@ -17,23 +19,22 @@ def Output(outPath, outfn, contents):
|
||||
return
|
||||
|
||||
# File either doesn't exist or has different contents
|
||||
with open(outpathname, "w") as f:
|
||||
with open(outpathname, "w", newline="\n") as f:
|
||||
f.write(contents)
|
||||
|
||||
|
||||
def main():
|
||||
dirname, _ = os.path.split(os.path.abspath(__file__))
|
||||
cmake_binary_dir = sys.argv[1]
|
||||
|
||||
with open(f"{dirname}/src/generate/types.json") as f:
|
||||
types = json.load(f)
|
||||
|
||||
# Java files
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/java"), autoescape=False
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/main/java"), autoescape=False
|
||||
)
|
||||
rootPath = f"{cmake_binary_dir}/generated/main/java/edu/wpi/first/networktables"
|
||||
for fn in glob.glob(f"{dirname}/src/generate/java/*.jinja"):
|
||||
rootPath = f"{dirname}/src/generated/main/java/edu/wpi/first/networktables"
|
||||
for fn in glob.glob(f"{dirname}/src/generate/main/java/*.jinja"):
|
||||
template = env.get_template(os.path.basename(fn))
|
||||
outfn = os.path.basename(fn)[:-6] # drop ".jinja"
|
||||
if os.path.basename(fn).startswith("NetworkTable") or os.path.basename(
|
||||
@@ -52,11 +53,15 @@ def main():
|
||||
|
||||
# C++ classes
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/include/networktables"),
|
||||
loader=FileSystemLoader(
|
||||
f"{dirname}/src/generate/main/native/include/networktables"
|
||||
),
|
||||
autoescape=False,
|
||||
)
|
||||
rootPath = f"{cmake_binary_dir}/generated/main/native/include/networktables"
|
||||
for fn in glob.glob(f"{dirname}/src/generate/include/networktables/*.jinja"):
|
||||
rootPath = f"{dirname}/src/generated/main/native/include/networktables"
|
||||
for fn in glob.glob(
|
||||
f"{dirname}/src/generate/main/native/include/networktables/*.jinja"
|
||||
):
|
||||
template = env.get_template(os.path.basename(fn))
|
||||
outfn = os.path.basename(fn)[:-6] # drop ".jinja"
|
||||
for replacements in types:
|
||||
@@ -66,55 +71,56 @@ def main():
|
||||
|
||||
# C++ handle API (header)
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/include"), autoescape=False
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/main/native/include"),
|
||||
autoescape=False,
|
||||
)
|
||||
template = env.get_template("ntcore_cpp_types.h.jinja")
|
||||
output = template.render(types=types)
|
||||
Output(
|
||||
f"{cmake_binary_dir}/generated/main/native/include",
|
||||
f"{dirname}/src/generated/main/native/include",
|
||||
"ntcore_cpp_types.h",
|
||||
output,
|
||||
)
|
||||
|
||||
# C++ handle API (source)
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/cpp"), autoescape=False
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/main/native/cpp"),
|
||||
autoescape=False,
|
||||
)
|
||||
template = env.get_template("ntcore_cpp_types.cpp.jinja")
|
||||
output = template.render(types=types)
|
||||
Output(
|
||||
f"{cmake_binary_dir}/generated/main/native/cpp", "ntcore_cpp_types.cpp", output
|
||||
)
|
||||
Output(f"{dirname}/src/generated/main/native/cpp", "ntcore_cpp_types.cpp", output)
|
||||
|
||||
# C handle API (header)
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/include"), autoescape=False
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/main/native/include"),
|
||||
autoescape=False,
|
||||
)
|
||||
template = env.get_template("ntcore_c_types.h.jinja")
|
||||
output = template.render(types=types)
|
||||
Output(
|
||||
f"{cmake_binary_dir}/generated/main/native/include",
|
||||
f"{dirname}/src/generated/main/native/include",
|
||||
"ntcore_c_types.h",
|
||||
output,
|
||||
)
|
||||
|
||||
# C handle API (source)
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/cpp"), autoescape=False
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/main/native/cpp"),
|
||||
autoescape=False,
|
||||
)
|
||||
template = env.get_template("ntcore_c_types.cpp.jinja")
|
||||
output = template.render(types=types)
|
||||
Output(
|
||||
f"{cmake_binary_dir}/generated/main/native/cpp", "ntcore_c_types.cpp", output
|
||||
)
|
||||
Output(f"{dirname}/src/generated/main/native/cpp", "ntcore_c_types.cpp", output)
|
||||
|
||||
# JNI
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/cpp/jni"), autoescape=False
|
||||
loader=FileSystemLoader(f"{dirname}/src/generate/main/native/cpp/jni"),
|
||||
autoescape=False,
|
||||
)
|
||||
template = env.get_template("types_jni.cpp.jinja")
|
||||
output = template.render(types=types)
|
||||
Output(f"{cmake_binary_dir}/generated/main/native/cpp/jni", "types_jni.cpp", output)
|
||||
Output(f"{dirname}/src/generated/main/native/cpp/jni", "types_jni.cpp", output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
@@ -13,3 +15,4 @@ public interface {{ TypeName }}Entry extends {{ TypeName }}Subscriber, {{ TypeNa
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
{% if TypeName == "Raw" %}
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -95,3 +97,4 @@ final class {{ TypeName }}EntryImpl extends EntryBase implements {{ TypeName }}E
|
||||
private final {{ TypeName }}Topic m_topic;
|
||||
private final {{ java.ValueType }} m_defaultValue;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -373,3 +375,4 @@ final class GenericEntryImpl extends EntryBase implements GenericEntry {
|
||||
|
||||
private final Topic m_topic;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -242,3 +244,4 @@ public interface GenericPublisher extends Publisher, Consumer<NetworkTableValue>
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
@@ -56,3 +58,4 @@ public interface GenericSubscriber extends Subscriber, Supplier<NetworkTableValu
|
||||
*/
|
||||
NetworkTableValue[] readQueue();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -608,3 +610,4 @@ public final class NetworkTableEntry implements Publisher, Subscriber {
|
||||
private final Topic m_topic;
|
||||
protected int m_handle;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import edu.wpi.first.util.WPIUtilJNI;
|
||||
@@ -1269,3 +1271,4 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
private int m_handle;
|
||||
private final ConcurrentMap<String, RawPublisher> m_schemas = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -246,3 +248,4 @@ public final class NetworkTableValue {
|
||||
private long m_time;
|
||||
private long m_serverTime;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import edu.wpi.first.util.RuntimeLoader;
|
||||
@@ -353,3 +355,4 @@ public final class NetworkTablesJNI {
|
||||
|
||||
public static native int addLogger(int poller, int minLevel, int maxLevel);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
{% if TypeName == "Raw" %}
|
||||
@@ -168,3 +170,4 @@ public interface {{ TypeName }}Publisher extends Publisher, {{ java.FunctionType
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import {{ java.SupplierFunctionPackage|default('java.util.function') }}.{{ java.FunctionTypePrefix }}Supplier;
|
||||
@@ -81,3 +83,4 @@ public interface {{ TypeName }}Subscriber extends Subscriber, {{ java.FunctionTy
|
||||
*/
|
||||
{{ java.ValueType }}[] readQueueValues();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped {{ TypeName }}. */
|
||||
@@ -38,3 +40,4 @@ public final class Timestamped{{ TypeName }} {
|
||||
@SuppressWarnings("MemberName")
|
||||
public final {{ java.ValueType }} value;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables {{ TypeName }} topic. */
|
||||
@@ -221,3 +223,4 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <wpi/jni_util.h>
|
||||
@@ -367,3 +369,4 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_setDefault{{ t.TypeName }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
} // extern "C"
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
#include "ntcore_c_types.h"
|
||||
|
||||
#include "Value_internal.h"
|
||||
@@ -104,3 +106,4 @@ void NT_FreeQueue{{ t.TypeName }}(struct NT_Timestamped{{ t.TypeName }}* arr, si
|
||||
|
||||
{% endfor %}
|
||||
} // extern "C"
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
#include "ntcore_cpp_types.h"
|
||||
|
||||
#include "Handle.h"
|
||||
@@ -129,3 +131,4 @@ Timestamped{{ t.TypeName }}View GetAtomic{{ t.TypeName }}(
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
} // namespace nt
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -435,3 +437,4 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
} // namespace nt
|
||||
|
||||
#include "networktables/{{ TypeName }}Topic.inc"
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "networktables/{{ TypeName }}Topic.h"
|
||||
#include "networktables/NetworkTableType.h"
|
||||
#include "ntcore_cpp.h"
|
||||
@@ -133,3 +137,4 @@ inline {{ TypeName }}Entry {{ TypeName }}Topic::GetEntryEx(
|
||||
}
|
||||
{% endif %}
|
||||
} // namespace nt
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -149,3 +151,4 @@ void NT_FreeQueue{{ t.TypeName }}(struct NT_Timestamped{{ t.TypeName }}* arr, si
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -139,3 +141,4 @@ Timestamped{{ t.TypeName }}View GetAtomic{{ t.TypeName }}(
|
||||
/** @} */
|
||||
{% endfor %}
|
||||
} // namespace nt
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables BooleanArray entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface BooleanArrayEntry extends BooleanArraySubscriber, BooleanArrayPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables BooleanArray implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class BooleanArrayEntryImpl extends EntryBase implements BooleanArrayEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
BooleanArrayEntryImpl(BooleanArrayTopic topic, int handle, boolean[] defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BooleanArrayTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] get() {
|
||||
return NetworkTablesJNI.getBooleanArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] get(boolean[] defaultValue) {
|
||||
return NetworkTablesJNI.getBooleanArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedBooleanArray getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicBooleanArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedBooleanArray getAtomic(boolean[] defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicBooleanArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedBooleanArray[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueBooleanArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[][] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesBooleanArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(boolean[] value, long time) {
|
||||
NetworkTablesJNI.setBooleanArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(boolean[] value) {
|
||||
NetworkTablesJNI.setDefaultBooleanArray(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final BooleanArrayTopic m_topic;
|
||||
private final boolean[] m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** NetworkTables BooleanArray publisher. */
|
||||
public interface BooleanArrayPublisher extends Publisher, Consumer<boolean[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
BooleanArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(boolean[] value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(boolean[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(boolean[] value);
|
||||
|
||||
@Override
|
||||
default void accept(boolean[] value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** NetworkTables BooleanArray subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface BooleanArraySubscriber extends Subscriber, Supplier<boolean[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
BooleanArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
boolean[] get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
boolean[] get(boolean[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedBooleanArray getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedBooleanArray getAtomic(boolean[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedBooleanArray[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
boolean[][] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables BooleanArray topic. */
|
||||
public final class BooleanArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "boolean[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public BooleanArrayTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getBooleanArrayTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public BooleanArrayTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public BooleanArraySubscriber subscribe(
|
||||
boolean[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
"boolean[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public BooleanArraySubscriber subscribeEx(
|
||||
String typeString,
|
||||
boolean[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public BooleanArrayPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
"boolean[]", options),
|
||||
new boolean[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public BooleanArrayPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
typeString, properties, options),
|
||||
new boolean[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public BooleanArrayEntry getEntry(
|
||||
boolean[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
"boolean[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public BooleanArrayEntry getEntryEx(
|
||||
String typeString,
|
||||
boolean[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables Boolean entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface BooleanEntry extends BooleanSubscriber, BooleanPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Boolean implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class BooleanEntryImpl extends EntryBase implements BooleanEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
BooleanEntryImpl(BooleanTopic topic, int handle, boolean defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BooleanTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean get() {
|
||||
return NetworkTablesJNI.getBoolean(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean get(boolean defaultValue) {
|
||||
return NetworkTablesJNI.getBoolean(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedBoolean getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicBoolean(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedBoolean getAtomic(boolean defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicBoolean(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedBoolean[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueBoolean(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesBoolean(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(boolean value, long time) {
|
||||
NetworkTablesJNI.setBoolean(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(boolean value) {
|
||||
NetworkTablesJNI.setDefaultBoolean(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final BooleanTopic m_topic;
|
||||
private final boolean m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import edu.wpi.first.util.function.BooleanConsumer;
|
||||
|
||||
/** NetworkTables Boolean publisher. */
|
||||
public interface BooleanPublisher extends Publisher, BooleanConsumer {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
BooleanTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(boolean value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(boolean value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(boolean value);
|
||||
|
||||
@Override
|
||||
default void accept(boolean value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
/** NetworkTables Boolean subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface BooleanSubscriber extends Subscriber, BooleanSupplier {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
BooleanTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
boolean get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
boolean get(boolean defaultValue);
|
||||
|
||||
@Override
|
||||
default boolean getAsBoolean() {
|
||||
return get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedBoolean getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedBoolean getAtomic(boolean defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedBoolean[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
boolean[] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Boolean topic. */
|
||||
public final class BooleanTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "boolean";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public BooleanTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getBooleanTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public BooleanTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public BooleanSubscriber subscribe(
|
||||
boolean defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
"boolean", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public BooleanSubscriber subscribeEx(
|
||||
String typeString,
|
||||
boolean defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public BooleanPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
"boolean", options),
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public BooleanPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
typeString, properties, options),
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public BooleanEntry getEntry(
|
||||
boolean defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
"boolean", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public BooleanEntry getEntryEx(
|
||||
String typeString,
|
||||
boolean defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables DoubleArray entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface DoubleArrayEntry extends DoubleArraySubscriber, DoubleArrayPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables DoubleArray implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class DoubleArrayEntryImpl extends EntryBase implements DoubleArrayEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
DoubleArrayEntryImpl(DoubleArrayTopic topic, int handle, double[] defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleArrayTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] get() {
|
||||
return NetworkTablesJNI.getDoubleArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] get(double[] defaultValue) {
|
||||
return NetworkTablesJNI.getDoubleArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedDoubleArray getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicDoubleArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedDoubleArray getAtomic(double[] defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicDoubleArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedDoubleArray[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueDoubleArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[][] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesDoubleArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(double[] value, long time) {
|
||||
NetworkTablesJNI.setDoubleArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(double[] value) {
|
||||
NetworkTablesJNI.setDefaultDoubleArray(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final DoubleArrayTopic m_topic;
|
||||
private final double[] m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** NetworkTables DoubleArray publisher. */
|
||||
public interface DoubleArrayPublisher extends Publisher, Consumer<double[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
DoubleArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(double[] value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(double[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(double[] value);
|
||||
|
||||
@Override
|
||||
default void accept(double[] value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** NetworkTables DoubleArray subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface DoubleArraySubscriber extends Subscriber, Supplier<double[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
DoubleArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
double[] get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
double[] get(double[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedDoubleArray getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedDoubleArray getAtomic(double[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedDoubleArray[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
double[][] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables DoubleArray topic. */
|
||||
public final class DoubleArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "double[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public DoubleArrayTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getDoubleArrayTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public DoubleArrayTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public DoubleArraySubscriber subscribe(
|
||||
double[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
"double[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public DoubleArraySubscriber subscribeEx(
|
||||
String typeString,
|
||||
double[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public DoubleArrayPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
"double[]", options),
|
||||
new double[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public DoubleArrayPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
typeString, properties, options),
|
||||
new double[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public DoubleArrayEntry getEntry(
|
||||
double[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
"double[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public DoubleArrayEntry getEntryEx(
|
||||
String typeString,
|
||||
double[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables Double entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface DoubleEntry extends DoubleSubscriber, DoublePublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Double implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class DoubleEntryImpl extends EntryBase implements DoubleEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
DoubleEntryImpl(DoubleTopic topic, int handle, double defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double get() {
|
||||
return NetworkTablesJNI.getDouble(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double get(double defaultValue) {
|
||||
return NetworkTablesJNI.getDouble(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedDouble getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicDouble(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedDouble getAtomic(double defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicDouble(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedDouble[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueDouble(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesDouble(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(double value, long time) {
|
||||
NetworkTablesJNI.setDouble(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(double value) {
|
||||
NetworkTablesJNI.setDefaultDouble(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final DoubleTopic m_topic;
|
||||
private final double m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.DoubleConsumer;
|
||||
|
||||
/** NetworkTables Double publisher. */
|
||||
public interface DoublePublisher extends Publisher, DoubleConsumer {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
DoubleTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(double value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(double value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(double value);
|
||||
|
||||
@Override
|
||||
default void accept(double value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
/** NetworkTables Double subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface DoubleSubscriber extends Subscriber, DoubleSupplier {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
DoubleTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
double get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
double get(double defaultValue);
|
||||
|
||||
@Override
|
||||
default double getAsDouble() {
|
||||
return get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedDouble getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedDouble getAtomic(double defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedDouble[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
double[] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Double topic. */
|
||||
public final class DoubleTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "double";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public DoubleTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getDoubleTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public DoubleTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public DoubleSubscriber subscribe(
|
||||
double defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
"double", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public DoubleSubscriber subscribeEx(
|
||||
String typeString,
|
||||
double defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public DoublePublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
"double", options),
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public DoublePublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
typeString, properties, options),
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public DoubleEntry getEntry(
|
||||
double defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
"double", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public DoubleEntry getEntryEx(
|
||||
String typeString,
|
||||
double defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables FloatArray entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface FloatArrayEntry extends FloatArraySubscriber, FloatArrayPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables FloatArray implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class FloatArrayEntryImpl extends EntryBase implements FloatArrayEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
FloatArrayEntryImpl(FloatArrayTopic topic, int handle, float[] defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatArrayTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] get() {
|
||||
return NetworkTablesJNI.getFloatArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] get(float[] defaultValue) {
|
||||
return NetworkTablesJNI.getFloatArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedFloatArray getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicFloatArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedFloatArray getAtomic(float[] defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicFloatArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedFloatArray[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueFloatArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[][] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesFloatArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(float[] value, long time) {
|
||||
NetworkTablesJNI.setFloatArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(float[] value) {
|
||||
NetworkTablesJNI.setDefaultFloatArray(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final FloatArrayTopic m_topic;
|
||||
private final float[] m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** NetworkTables FloatArray publisher. */
|
||||
public interface FloatArrayPublisher extends Publisher, Consumer<float[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
FloatArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(float[] value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(float[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(float[] value);
|
||||
|
||||
@Override
|
||||
default void accept(float[] value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** NetworkTables FloatArray subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface FloatArraySubscriber extends Subscriber, Supplier<float[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
FloatArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
float[] get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
float[] get(float[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedFloatArray getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedFloatArray getAtomic(float[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedFloatArray[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
float[][] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables FloatArray topic. */
|
||||
public final class FloatArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "float[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public FloatArrayTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getFloatArrayTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public FloatArrayTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public FloatArraySubscriber subscribe(
|
||||
float[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
"float[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public FloatArraySubscriber subscribeEx(
|
||||
String typeString,
|
||||
float[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public FloatArrayPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
"float[]", options),
|
||||
new float[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public FloatArrayPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
typeString, properties, options),
|
||||
new float[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public FloatArrayEntry getEntry(
|
||||
float[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
"float[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public FloatArrayEntry getEntryEx(
|
||||
String typeString,
|
||||
float[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables Float entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface FloatEntry extends FloatSubscriber, FloatPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Float implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class FloatEntryImpl extends EntryBase implements FloatEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
FloatEntryImpl(FloatTopic topic, int handle, float defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float get() {
|
||||
return NetworkTablesJNI.getFloat(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float get(float defaultValue) {
|
||||
return NetworkTablesJNI.getFloat(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedFloat getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicFloat(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedFloat getAtomic(float defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicFloat(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedFloat[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueFloat(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesFloat(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(float value, long time) {
|
||||
NetworkTablesJNI.setFloat(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(float value) {
|
||||
NetworkTablesJNI.setDefaultFloat(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final FloatTopic m_topic;
|
||||
private final float m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import edu.wpi.first.util.function.FloatConsumer;
|
||||
|
||||
/** NetworkTables Float publisher. */
|
||||
public interface FloatPublisher extends Publisher, FloatConsumer {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
FloatTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(float value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(float value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(float value);
|
||||
|
||||
@Override
|
||||
default void accept(float value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import edu.wpi.first.util.function.FloatSupplier;
|
||||
|
||||
/** NetworkTables Float subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface FloatSubscriber extends Subscriber, FloatSupplier {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
FloatTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
float get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
float get(float defaultValue);
|
||||
|
||||
@Override
|
||||
default float getAsFloat() {
|
||||
return get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedFloat getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedFloat getAtomic(float defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedFloat[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
float[] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Float topic. */
|
||||
public final class FloatTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "float";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public FloatTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getFloatTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public FloatTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public FloatSubscriber subscribe(
|
||||
float defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
"float", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public FloatSubscriber subscribeEx(
|
||||
String typeString,
|
||||
float defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public FloatPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
"float", options),
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public FloatPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
typeString, properties, options),
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public FloatEntry getEntry(
|
||||
float defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
"float", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public FloatEntry getEntryEx(
|
||||
String typeString,
|
||||
float defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,815 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/** NetworkTables generic implementation. */
|
||||
final class GenericEntryImpl extends EntryBase implements GenericEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
*/
|
||||
GenericEntryImpl(Topic topic, int handle) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Topic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkTableValue get() {
|
||||
return NetworkTablesJNI.getValue(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public boolean getBoolean(boolean defaultValue) {
|
||||
return NetworkTablesJNI.getBoolean(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a long. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public long getInteger(long defaultValue) {
|
||||
return NetworkTablesJNI.getInteger(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a float. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public float getFloat(float defaultValue) {
|
||||
return NetworkTablesJNI.getFloat(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a double. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public double getDouble(double defaultValue) {
|
||||
return NetworkTablesJNI.getDouble(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a String. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public String getString(String defaultValue) {
|
||||
return NetworkTablesJNI.getString(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a byte[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public byte[] getRaw(byte[] defaultValue) {
|
||||
return NetworkTablesJNI.getRaw(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public boolean[] getBooleanArray(boolean[] defaultValue) {
|
||||
return NetworkTablesJNI.getBooleanArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
|
||||
* it will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public Boolean[] getBooleanArray(Boolean[] defaultValue) {
|
||||
return NetworkTableValue.fromNativeBooleanArray(
|
||||
getBooleanArray(NetworkTableValue.toNativeBooleanArray(defaultValue)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a long[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public long[] getIntegerArray(long[] defaultValue) {
|
||||
return NetworkTablesJNI.getIntegerArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
|
||||
* it will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public Long[] getIntegerArray(Long[] defaultValue) {
|
||||
return NetworkTableValue.fromNativeIntegerArray(
|
||||
getIntegerArray(NetworkTableValue.toNativeIntegerArray(defaultValue)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a float[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public float[] getFloatArray(float[] defaultValue) {
|
||||
return NetworkTablesJNI.getFloatArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
|
||||
* it will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public Float[] getFloatArray(Float[] defaultValue) {
|
||||
return NetworkTableValue.fromNativeFloatArray(
|
||||
getFloatArray(NetworkTableValue.toNativeFloatArray(defaultValue)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a double[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public double[] getDoubleArray(double[] defaultValue) {
|
||||
return NetworkTablesJNI.getDoubleArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
|
||||
* it will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public Double[] getDoubleArray(Double[] defaultValue) {
|
||||
return NetworkTableValue.fromNativeDoubleArray(
|
||||
getDoubleArray(NetworkTableValue.toNativeDoubleArray(defaultValue)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a String[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
@Override
|
||||
public String[] getStringArray(String[] defaultValue) {
|
||||
return NetworkTablesJNI.getStringArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkTableValue[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueValue(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean set(NetworkTableValue value) {
|
||||
long time = value.getTime();
|
||||
Object otherValue = value.getValue();
|
||||
switch (value.getType()) {
|
||||
case kBoolean:
|
||||
return NetworkTablesJNI.setBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
return NetworkTablesJNI.setInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
return NetworkTablesJNI.setFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
return NetworkTablesJNI.setDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
return NetworkTablesJNI.setString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
return NetworkTablesJNI.setBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
return NetworkTablesJNI.setIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
return NetworkTablesJNI.setFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
return NetworkTablesJNI.setDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
return NetworkTablesJNI.setStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value that will be assigned
|
||||
* @return False if the table key already exists with a different type
|
||||
* @throws IllegalArgumentException if the value is not a known type
|
||||
*/
|
||||
@Override
|
||||
public boolean setValue(Object value, long time) {
|
||||
if (value instanceof NetworkTableValue) {
|
||||
return set((NetworkTableValue) value);
|
||||
} else if (value instanceof Boolean) {
|
||||
return setBoolean((Boolean) value, time);
|
||||
} else if (value instanceof Long) {
|
||||
return setInteger((Long) value, time);
|
||||
} else if (value instanceof Float) {
|
||||
return setFloat((Float) value, time);
|
||||
} else if (value instanceof Number) {
|
||||
return setNumber((Number) value, time);
|
||||
} else if (value instanceof String) {
|
||||
return setString((String) value, time);
|
||||
} else if (value instanceof byte[]) {
|
||||
return setRaw((byte[]) value, time);
|
||||
} else if (value instanceof boolean[]) {
|
||||
return setBooleanArray((boolean[]) value, time);
|
||||
} else if (value instanceof long[]) {
|
||||
return setIntegerArray((long[]) value, time);
|
||||
} else if (value instanceof float[]) {
|
||||
return setFloatArray((float[]) value, time);
|
||||
} else if (value instanceof double[]) {
|
||||
return setDoubleArray((double[]) value, time);
|
||||
} else if (value instanceof Boolean[]) {
|
||||
return setBooleanArray((Boolean[]) value, time);
|
||||
} else if (value instanceof Long[]) {
|
||||
return setIntegerArray((Long[]) value, time);
|
||||
} else if (value instanceof Float[]) {
|
||||
return setFloatArray((Float[]) value, time);
|
||||
} else if (value instanceof Number[]) {
|
||||
return setNumberArray((Number[]) value, time);
|
||||
} else if (value instanceof String[]) {
|
||||
return setStringArray((String[]) value, time);
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Value of type " + value.getClass().getName() + " cannot be put into a table");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setBoolean(boolean value, long time) {
|
||||
return NetworkTablesJNI.setBoolean(m_handle, time, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setInteger(long value, long time) {
|
||||
return NetworkTablesJNI.setInteger(m_handle, time, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setFloat(float value, long time) {
|
||||
return NetworkTablesJNI.setFloat(m_handle, time, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDouble(double value, long time) {
|
||||
return NetworkTablesJNI.setDouble(m_handle, time, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setString(String value, long time) {
|
||||
return NetworkTablesJNI.setString(m_handle, time, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.length - start)
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setRaw(byte[] value, int start, int len, long time) {
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, value, start, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.capacity() - start)
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setRaw(ByteBuffer value, int start, int len, long time) {
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, value, start, len);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setBooleanArray(boolean[] value, long time) {
|
||||
return NetworkTablesJNI.setBooleanArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setBooleanArray(Boolean[] value, long time) {
|
||||
return setBooleanArray(NetworkTableValue.toNativeBooleanArray(value), time);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setIntegerArray(long[] value, long time) {
|
||||
return NetworkTablesJNI.setIntegerArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setIntegerArray(Long[] value, long time) {
|
||||
return setIntegerArray(NetworkTableValue.toNativeIntegerArray(value), time);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setFloatArray(float[] value, long time) {
|
||||
return NetworkTablesJNI.setFloatArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setFloatArray(Float[] value, long time) {
|
||||
return setFloatArray(NetworkTableValue.toNativeFloatArray(value), time);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDoubleArray(double[] value, long time) {
|
||||
return NetworkTablesJNI.setDoubleArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDoubleArray(Double[] value, long time) {
|
||||
return setDoubleArray(NetworkTableValue.toNativeDoubleArray(value), time);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setStringArray(String[] value, long time) {
|
||||
return NetworkTablesJNI.setStringArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
public boolean setNumber(Number value, long time) {
|
||||
return setDouble(value.doubleValue(), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
*
|
||||
* @param value the value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
public boolean setNumberArray(Number[] value, long time) {
|
||||
return setDoubleArray(NetworkTableValue.toNativeDoubleArray(value), time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setDefault(NetworkTableValue defaultValue) {
|
||||
long time = defaultValue.getTime();
|
||||
Object otherValue = defaultValue.getValue();
|
||||
switch (defaultValue.getType()) {
|
||||
case kBoolean:
|
||||
return NetworkTablesJNI.setDefaultBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
return NetworkTablesJNI.setDefaultInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
return NetworkTablesJNI.setDefaultFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
return NetworkTablesJNI.setDefaultDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
return NetworkTablesJNI.setDefaultString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
return NetworkTablesJNI.setDefaultBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
return NetworkTablesJNI.setDefaultIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
return NetworkTablesJNI.setDefaultFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
return NetworkTablesJNI.setDefaultDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
return NetworkTablesJNI.setDefaultStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @throws IllegalArgumentException if the value is not a known type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultValue(Object defaultValue) {
|
||||
if (defaultValue instanceof NetworkTableValue) {
|
||||
return setDefault((NetworkTableValue) defaultValue);
|
||||
} else if (defaultValue instanceof Boolean) {
|
||||
return setDefaultBoolean((Boolean) defaultValue);
|
||||
} else if (defaultValue instanceof Integer) {
|
||||
return setDefaultInteger((Integer) defaultValue);
|
||||
} else if (defaultValue instanceof Float) {
|
||||
return setDefaultFloat((Float) defaultValue);
|
||||
} else if (defaultValue instanceof Number) {
|
||||
return setDefaultNumber((Number) defaultValue);
|
||||
} else if (defaultValue instanceof String) {
|
||||
return setDefaultString((String) defaultValue);
|
||||
} else if (defaultValue instanceof byte[]) {
|
||||
return setDefaultRaw((byte[]) defaultValue);
|
||||
} else if (defaultValue instanceof boolean[]) {
|
||||
return setDefaultBooleanArray((boolean[]) defaultValue);
|
||||
} else if (defaultValue instanceof long[]) {
|
||||
return setDefaultIntegerArray((long[]) defaultValue);
|
||||
} else if (defaultValue instanceof float[]) {
|
||||
return setDefaultFloatArray((float[]) defaultValue);
|
||||
} else if (defaultValue instanceof double[]) {
|
||||
return setDefaultDoubleArray((double[]) defaultValue);
|
||||
} else if (defaultValue instanceof Boolean[]) {
|
||||
return setDefaultBooleanArray((Boolean[]) defaultValue);
|
||||
} else if (defaultValue instanceof Long[]) {
|
||||
return setDefaultIntegerArray((Long[]) defaultValue);
|
||||
} else if (defaultValue instanceof Float[]) {
|
||||
return setDefaultFloatArray((Float[]) defaultValue);
|
||||
} else if (defaultValue instanceof Number[]) {
|
||||
return setDefaultNumberArray((Number[]) defaultValue);
|
||||
} else if (defaultValue instanceof String[]) {
|
||||
return setDefaultStringArray((String[]) defaultValue);
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Value of type " + defaultValue.getClass().getName() + " cannot be put into a table");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultBoolean(boolean defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultBoolean(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultInteger(long defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultInteger(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultFloat(float defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultFloat(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultDouble(double defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultDouble(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultString(String defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultString(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.length - start)
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultRaw(byte[] defaultValue, int start, int len) {
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, 0, defaultValue, start, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.capacity() - start)
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultRaw(ByteBuffer defaultValue, int start, int len) {
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, 0, defaultValue, start, len);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultBooleanArray(boolean[] defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultBooleanArray(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultBooleanArray(Boolean[] defaultValue) {
|
||||
return setDefaultBooleanArray(NetworkTableValue.toNativeBooleanArray(defaultValue));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultIntegerArray(long[] defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultIntegerArray(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultIntegerArray(Long[] defaultValue) {
|
||||
return setDefaultIntegerArray(NetworkTableValue.toNativeIntegerArray(defaultValue));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultFloatArray(float[] defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultFloatArray(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultFloatArray(Float[] defaultValue) {
|
||||
return setDefaultFloatArray(NetworkTableValue.toNativeFloatArray(defaultValue));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultDoubleArray(double[] defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultDoubleArray(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultDoubleArray(Double[] defaultValue) {
|
||||
return setDefaultDoubleArray(NetworkTableValue.toNativeDoubleArray(defaultValue));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
@Override
|
||||
public boolean setDefaultStringArray(String[] defaultValue) {
|
||||
return NetworkTablesJNI.setDefaultStringArray(m_handle, 0, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
public boolean setDefaultNumber(Number defaultValue) {
|
||||
return setDefaultDouble(defaultValue.doubleValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
public boolean setDefaultNumberArray(Number[] defaultValue) {
|
||||
return setDefaultDoubleArray(NetworkTableValue.toNativeDoubleArray(defaultValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final Topic m_topic;
|
||||
}
|
||||
@@ -0,0 +1,568 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** NetworkTables generic publisher. */
|
||||
public interface GenericPublisher extends Publisher, Consumer<NetworkTableValue> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
Topic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean set(NetworkTableValue value);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
* @throws IllegalArgumentException if the value is not a known type
|
||||
*/
|
||||
default boolean setValue(Object value) {
|
||||
return setValue(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
* @throws IllegalArgumentException if the value is not a known type
|
||||
*/
|
||||
boolean setValue(Object value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setBoolean(boolean value) {
|
||||
return setBoolean(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setBoolean(boolean value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setInteger(long value) {
|
||||
return setInteger(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setInteger(long value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setFloat(float value) {
|
||||
return setFloat(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setFloat(float value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setDouble(double value) {
|
||||
return setDouble(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setDouble(double value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setString(String value) {
|
||||
return setString(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setString(String value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setRaw(byte[] value) {
|
||||
return setRaw(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setRaw(ByteBuffer value) {
|
||||
return setRaw(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setRaw(byte[] value, long time) {
|
||||
return setRaw(value, 0, value.length, time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish; will send from value.position() to value.limit()
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setRaw(ByteBuffer value, long time) {
|
||||
int pos = value.position();
|
||||
return setRaw(value, pos, value.limit() - pos, time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.length - start)
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setRaw(byte[] value, int start, int len) {
|
||||
return setRaw(value, start, len, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.length - start)
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setRaw(byte[] value, int start, int len, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.capacity() - start)
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setRaw(ByteBuffer value, int start, int len) {
|
||||
return setRaw(value, start, len, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.capacity() - start)
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setRaw(ByteBuffer value, int start, int len, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setBooleanArray(boolean[] value) {
|
||||
return setBooleanArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setBooleanArray(boolean[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setBooleanArray(Boolean[] value) {
|
||||
return setBooleanArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setBooleanArray(Boolean[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setIntegerArray(long[] value) {
|
||||
return setIntegerArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setIntegerArray(long[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setIntegerArray(Long[] value) {
|
||||
return setIntegerArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setIntegerArray(Long[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setFloatArray(float[] value) {
|
||||
return setFloatArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setFloatArray(float[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setFloatArray(Float[] value) {
|
||||
return setFloatArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setFloatArray(Float[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setDoubleArray(double[] value) {
|
||||
return setDoubleArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setDoubleArray(double[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setDoubleArray(Double[] value) {
|
||||
return setDoubleArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setDoubleArray(Double[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
default boolean setStringArray(String[] value) {
|
||||
return setStringArray(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
* @return False if the topic already exists with a different type
|
||||
*/
|
||||
boolean setStringArray(String[] value, long time);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefault(NetworkTableValue defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @throws IllegalArgumentException if the value is not a known type
|
||||
*/
|
||||
boolean setDefaultValue(Object defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultBoolean(boolean defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultInteger(long defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultFloat(float defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultDouble(double defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultString(String defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
default boolean setDefaultRaw(byte[] defaultValue) {
|
||||
return setDefaultRaw(defaultValue, 0, defaultValue.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set; will send from defaultValue.position() to
|
||||
* defaultValue.limit()
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
default boolean setDefaultRaw(ByteBuffer defaultValue) {
|
||||
int pos = defaultValue.position();
|
||||
return setDefaultRaw(defaultValue, pos, defaultValue.limit() - pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.length - start)
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultRaw(byte[] defaultValue, int start, int len);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.capacity() - start)
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultRaw(ByteBuffer defaultValue, int start, int len);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultBooleanArray(boolean[] defaultValue);
|
||||
|
||||
boolean setDefaultBooleanArray(Boolean[] defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultIntegerArray(long[] defaultValue);
|
||||
|
||||
boolean setDefaultIntegerArray(Long[] defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultFloatArray(float[] defaultValue);
|
||||
|
||||
boolean setDefaultFloatArray(Float[] defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultDoubleArray(double[] defaultValue);
|
||||
|
||||
boolean setDefaultDoubleArray(Double[] defaultValue);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
boolean setDefaultStringArray(String[] defaultValue);
|
||||
|
||||
@Override
|
||||
default void accept(NetworkTableValue value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** NetworkTables generic subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface GenericSubscriber extends Subscriber, Supplier<NetworkTableValue> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
Topic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns a value with type NetworkTableType.kUnassigned.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
NetworkTableValue get();
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
boolean getBoolean(boolean defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a long. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
long getInteger(long defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a float. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
float getFloat(float defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a double. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
double getDouble(double defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a String. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
String getString(String defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a byte[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
byte[] getRaw(byte[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
boolean[] getBooleanArray(boolean[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
|
||||
* it will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
Boolean[] getBooleanArray(Boolean[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a long[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
long[] getIntegerArray(long[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
|
||||
* it will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
Long[] getIntegerArray(Long[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a float[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
float[] getFloatArray(float[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
|
||||
* it will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
Float[] getFloatArray(Float[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a double[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
double[] getDoubleArray(double[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist or is of different type,
|
||||
* it will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
Double[] getDoubleArray(Double[] defaultValue);
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a String[]. If the entry does not exist or is of different type, it
|
||||
* will return the default value.
|
||||
*
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
String[] getStringArray(String[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
NetworkTableValue[] readQueue();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables IntegerArray entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface IntegerArrayEntry extends IntegerArraySubscriber, IntegerArrayPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables IntegerArray implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class IntegerArrayEntryImpl extends EntryBase implements IntegerArrayEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
IntegerArrayEntryImpl(IntegerArrayTopic topic, int handle, long[] defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegerArrayTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long[] get() {
|
||||
return NetworkTablesJNI.getIntegerArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long[] get(long[] defaultValue) {
|
||||
return NetworkTablesJNI.getIntegerArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedIntegerArray getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicIntegerArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedIntegerArray getAtomic(long[] defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicIntegerArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedIntegerArray[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueIntegerArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long[][] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesIntegerArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(long[] value, long time) {
|
||||
NetworkTablesJNI.setIntegerArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(long[] value) {
|
||||
NetworkTablesJNI.setDefaultIntegerArray(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final IntegerArrayTopic m_topic;
|
||||
private final long[] m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** NetworkTables IntegerArray publisher. */
|
||||
public interface IntegerArrayPublisher extends Publisher, Consumer<long[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
IntegerArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(long[] value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(long[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(long[] value);
|
||||
|
||||
@Override
|
||||
default void accept(long[] value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** NetworkTables IntegerArray subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface IntegerArraySubscriber extends Subscriber, Supplier<long[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
IntegerArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
long[] get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
long[] get(long[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedIntegerArray getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedIntegerArray getAtomic(long[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedIntegerArray[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
long[][] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables IntegerArray topic. */
|
||||
public final class IntegerArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "int[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public IntegerArrayTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getIntegerArrayTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public IntegerArrayTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public IntegerArraySubscriber subscribe(
|
||||
long[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
"int[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public IntegerArraySubscriber subscribeEx(
|
||||
String typeString,
|
||||
long[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public IntegerArrayPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
"int[]", options),
|
||||
new long[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public IntegerArrayPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
typeString, properties, options),
|
||||
new long[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public IntegerArrayEntry getEntry(
|
||||
long[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
"int[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public IntegerArrayEntry getEntryEx(
|
||||
String typeString,
|
||||
long[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables Integer entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface IntegerEntry extends IntegerSubscriber, IntegerPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Integer implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class IntegerEntryImpl extends EntryBase implements IntegerEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
IntegerEntryImpl(IntegerTopic topic, int handle, long defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegerTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long get() {
|
||||
return NetworkTablesJNI.getInteger(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long get(long defaultValue) {
|
||||
return NetworkTablesJNI.getInteger(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedInteger getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicInteger(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedInteger getAtomic(long defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicInteger(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedInteger[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueInteger(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long[] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesInteger(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(long value, long time) {
|
||||
NetworkTablesJNI.setInteger(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(long value) {
|
||||
NetworkTablesJNI.setDefaultInteger(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final IntegerTopic m_topic;
|
||||
private final long m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.LongConsumer;
|
||||
|
||||
/** NetworkTables Integer publisher. */
|
||||
public interface IntegerPublisher extends Publisher, LongConsumer {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
IntegerTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(long value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(long value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(long value);
|
||||
|
||||
@Override
|
||||
default void accept(long value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
/** NetworkTables Integer subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface IntegerSubscriber extends Subscriber, LongSupplier {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
IntegerTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
long get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
long get(long defaultValue);
|
||||
|
||||
@Override
|
||||
default long getAsLong() {
|
||||
return get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedInteger getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedInteger getAtomic(long defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedInteger[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
long[] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Integer topic. */
|
||||
public final class IntegerTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "int";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public IntegerTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getIntegerTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public IntegerTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public IntegerSubscriber subscribe(
|
||||
long defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
"int", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public IntegerSubscriber subscribeEx(
|
||||
String typeString,
|
||||
long defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public IntegerPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
"int", options),
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public IntegerPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
typeString, properties, options),
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public IntegerEntry getEntry(
|
||||
long defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
"int", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public IntegerEntry getEntryEx(
|
||||
String typeString,
|
||||
long defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,742 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/** A network table entry value. */
|
||||
@SuppressWarnings({"UnnecessaryParentheses", "PMD.MethodReturnsInternalArray"})
|
||||
public final class NetworkTableValue {
|
||||
NetworkTableValue(NetworkTableType type, Object value, long time, long serverTime) {
|
||||
m_type = type;
|
||||
m_value = value;
|
||||
m_time = time;
|
||||
m_serverTime = serverTime;
|
||||
}
|
||||
|
||||
NetworkTableValue(NetworkTableType type, Object value, long time) {
|
||||
this(type, value, time, time == 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
NetworkTableValue(NetworkTableType type, Object value) {
|
||||
this(type, value, NetworkTablesJNI.now(), 1);
|
||||
}
|
||||
|
||||
NetworkTableValue(int type, Object value, long time, long serverTime) {
|
||||
this(NetworkTableType.getFromInt(type), value, time, serverTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data type.
|
||||
*
|
||||
* @return The type.
|
||||
*/
|
||||
public NetworkTableType getType() {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data value stored.
|
||||
*
|
||||
* @return The type.
|
||||
*/
|
||||
public Object getValue() {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the creation time of the value in local time.
|
||||
*
|
||||
* @return The time, in the units returned by NetworkTablesJNI.now().
|
||||
*/
|
||||
public long getTime() {
|
||||
return m_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the creation time of the value in server time.
|
||||
*
|
||||
* @return The server time.
|
||||
*/
|
||||
public long getServerTime() {
|
||||
return m_serverTime;
|
||||
}
|
||||
|
||||
/*
|
||||
* Type Checkers
|
||||
*/
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a value or is unassigned.
|
||||
*
|
||||
* @return True if the entry value contains a value.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return m_type != NetworkTableType.kUnassigned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a boolean.
|
||||
*
|
||||
* @return True if the entry value is of boolean type.
|
||||
*/
|
||||
public boolean isBoolean() {
|
||||
return m_type == NetworkTableType.kBoolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a long.
|
||||
*
|
||||
* @return True if the entry value is of long type.
|
||||
*/
|
||||
public boolean isInteger() {
|
||||
return m_type == NetworkTableType.kInteger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a float.
|
||||
*
|
||||
* @return True if the entry value is of float type.
|
||||
*/
|
||||
public boolean isFloat() {
|
||||
return m_type == NetworkTableType.kFloat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a double.
|
||||
*
|
||||
* @return True if the entry value is of double type.
|
||||
*/
|
||||
public boolean isDouble() {
|
||||
return m_type == NetworkTableType.kDouble;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a String.
|
||||
*
|
||||
* @return True if the entry value is of String type.
|
||||
*/
|
||||
public boolean isString() {
|
||||
return m_type == NetworkTableType.kString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a byte[].
|
||||
*
|
||||
* @return True if the entry value is of byte[] type.
|
||||
*/
|
||||
public boolean isRaw() {
|
||||
return m_type == NetworkTableType.kRaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a boolean[].
|
||||
*
|
||||
* @return True if the entry value is of boolean[] type.
|
||||
*/
|
||||
public boolean isBooleanArray() {
|
||||
return m_type == NetworkTableType.kBooleanArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a long[].
|
||||
*
|
||||
* @return True if the entry value is of long[] type.
|
||||
*/
|
||||
public boolean isIntegerArray() {
|
||||
return m_type == NetworkTableType.kIntegerArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a float[].
|
||||
*
|
||||
* @return True if the entry value is of float[] type.
|
||||
*/
|
||||
public boolean isFloatArray() {
|
||||
return m_type == NetworkTableType.kFloatArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a double[].
|
||||
*
|
||||
* @return True if the entry value is of double[] type.
|
||||
*/
|
||||
public boolean isDoubleArray() {
|
||||
return m_type == NetworkTableType.kDoubleArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if entry value contains a String[].
|
||||
*
|
||||
* @return True if the entry value is of String[] type.
|
||||
*/
|
||||
public boolean isStringArray() {
|
||||
return m_type == NetworkTableType.kStringArray;
|
||||
}
|
||||
|
||||
/*
|
||||
* Type-Safe Getters
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the boolean value.
|
||||
*
|
||||
* @return The boolean value.
|
||||
* @throws ClassCastException if the entry value is not of boolean type.
|
||||
*/
|
||||
public boolean getBoolean() {
|
||||
if (m_type != NetworkTableType.kBoolean) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to boolean");
|
||||
}
|
||||
return (Boolean) m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the long value.
|
||||
*
|
||||
* @return The long value.
|
||||
* @throws ClassCastException if the entry value is not of long type.
|
||||
*/
|
||||
public long getInteger() {
|
||||
if (m_type != NetworkTableType.kInteger) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to long");
|
||||
}
|
||||
return ((Number) m_value).longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the float value.
|
||||
*
|
||||
* @return The float value.
|
||||
* @throws ClassCastException if the entry value is not of float type.
|
||||
*/
|
||||
public float getFloat() {
|
||||
if (m_type != NetworkTableType.kFloat) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to float");
|
||||
}
|
||||
return ((Number) m_value).floatValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the double value.
|
||||
*
|
||||
* @return The double value.
|
||||
* @throws ClassCastException if the entry value is not of double type.
|
||||
*/
|
||||
public double getDouble() {
|
||||
if (m_type != NetworkTableType.kDouble) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to double");
|
||||
}
|
||||
return ((Number) m_value).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String value.
|
||||
*
|
||||
* @return The String value.
|
||||
* @throws ClassCastException if the entry value is not of String type.
|
||||
*/
|
||||
public String getString() {
|
||||
if (m_type != NetworkTableType.kString) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to String");
|
||||
}
|
||||
return (String) m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the byte[] value.
|
||||
*
|
||||
* @return The byte[] value.
|
||||
* @throws ClassCastException if the entry value is not of byte[] type.
|
||||
*/
|
||||
public byte[] getRaw() {
|
||||
if (m_type != NetworkTableType.kRaw) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to byte[]");
|
||||
}
|
||||
return (byte[]) m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the boolean[] value.
|
||||
*
|
||||
* @return The boolean[] value.
|
||||
* @throws ClassCastException if the entry value is not of boolean[] type.
|
||||
*/
|
||||
public boolean[] getBooleanArray() {
|
||||
if (m_type != NetworkTableType.kBooleanArray) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to boolean[]");
|
||||
}
|
||||
return (boolean[]) m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the long[] value.
|
||||
*
|
||||
* @return The long[] value.
|
||||
* @throws ClassCastException if the entry value is not of long[] type.
|
||||
*/
|
||||
public long[] getIntegerArray() {
|
||||
if (m_type != NetworkTableType.kIntegerArray) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to long[]");
|
||||
}
|
||||
return (long[]) m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the float[] value.
|
||||
*
|
||||
* @return The float[] value.
|
||||
* @throws ClassCastException if the entry value is not of float[] type.
|
||||
*/
|
||||
public float[] getFloatArray() {
|
||||
if (m_type != NetworkTableType.kFloatArray) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to float[]");
|
||||
}
|
||||
return (float[]) m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the double[] value.
|
||||
*
|
||||
* @return The double[] value.
|
||||
* @throws ClassCastException if the entry value is not of double[] type.
|
||||
*/
|
||||
public double[] getDoubleArray() {
|
||||
if (m_type != NetworkTableType.kDoubleArray) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to double[]");
|
||||
}
|
||||
return (double[]) m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the String[] value.
|
||||
*
|
||||
* @return The String[] value.
|
||||
* @throws ClassCastException if the entry value is not of String[] type.
|
||||
*/
|
||||
public String[] getStringArray() {
|
||||
if (m_type != NetworkTableType.kStringArray) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to String[]");
|
||||
}
|
||||
return (String[]) m_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Factory functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a boolean value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBoolean(boolean value) {
|
||||
return new NetworkTableValue(NetworkTableType.kBoolean, Boolean.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a boolean value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBoolean(boolean value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kBoolean, Boolean.valueOf(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a long value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeInteger(long value) {
|
||||
return new NetworkTableValue(NetworkTableType.kInteger, Long.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a long value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeInteger(long value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kInteger, Long.valueOf(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a float value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloat(float value) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloat, Float.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a float value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloat(float value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloat, Float.valueOf(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDouble(double value) {
|
||||
return new NetworkTableValue(NetworkTableType.kDouble, Double.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDouble(double value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kDouble, Double.valueOf(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a String value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeString(String value) {
|
||||
return new NetworkTableValue(NetworkTableType.kString, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a String value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeString(String value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kString, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a byte[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeRaw(byte[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kRaw, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a byte[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeRaw(byte[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kRaw, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a boolean[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBooleanArray(boolean[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kBooleanArray, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a boolean[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBooleanArray(boolean[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kBooleanArray, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a boolean[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBooleanArray(Boolean[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kBooleanArray, toNativeBooleanArray(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a boolean[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBooleanArray(Boolean[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kBooleanArray, toNativeBooleanArray(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a long[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeIntegerArray(long[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kIntegerArray, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a long[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeIntegerArray(long[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kIntegerArray, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a long[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeIntegerArray(Long[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kIntegerArray, toNativeIntegerArray(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a long[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeIntegerArray(Long[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kIntegerArray, toNativeIntegerArray(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a float[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloatArray(float[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloatArray, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a float[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloatArray(float[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloatArray, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a float[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloatArray(Float[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloatArray, toNativeFloatArray(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a float[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloatArray(Float[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloatArray, toNativeFloatArray(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDoubleArray(double[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kDoubleArray, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDoubleArray(double[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kDoubleArray, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDoubleArray(Double[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kDoubleArray, toNativeDoubleArray(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDoubleArray(Double[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kDoubleArray, toNativeDoubleArray(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a String[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeStringArray(String[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kStringArray, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a String[] value.
|
||||
*
|
||||
* @param value the value
|
||||
* @param time the creation time to use (instead of the current time)
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeStringArray(String[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kStringArray, (value), time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof NetworkTableValue)) {
|
||||
return false;
|
||||
}
|
||||
NetworkTableValue ntOther = (NetworkTableValue) other;
|
||||
return m_type == ntOther.m_type && m_value.equals(ntOther.m_value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(m_type, m_value);
|
||||
}
|
||||
|
||||
// arraycopy() doesn't know how to unwrap boxed values; this is a false positive in PMD
|
||||
// (see https://sourceforge.net/p/pmd/bugs/804/)
|
||||
@SuppressWarnings("PMD.AvoidArrayLoops")
|
||||
static boolean[] toNativeBooleanArray(Boolean[] arr) {
|
||||
boolean[] out = new boolean[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
out[i] = arr[i];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidArrayLoops")
|
||||
static double[] toNativeDoubleArray(Number[] arr) {
|
||||
double[] out = new double[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
out[i] = arr[i].doubleValue();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidArrayLoops")
|
||||
static long[] toNativeIntegerArray(Number[] arr) {
|
||||
long[] out = new long[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
out[i] = arr[i].longValue();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidArrayLoops")
|
||||
static float[] toNativeFloatArray(Number[] arr) {
|
||||
float[] out = new float[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
out[i] = arr[i].floatValue();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidArrayLoops")
|
||||
static Boolean[] fromNativeBooleanArray(boolean[] arr) {
|
||||
Boolean[] out = new Boolean[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
out[i] = arr[i];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidArrayLoops")
|
||||
static Long[] fromNativeIntegerArray(long[] arr) {
|
||||
Long[] out = new Long[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
out[i] = arr[i];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidArrayLoops")
|
||||
static Float[] fromNativeFloatArray(float[] arr) {
|
||||
Float[] out = new Float[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
out[i] = arr[i];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PMD.AvoidArrayLoops")
|
||||
static Double[] fromNativeDoubleArray(double[] arr) {
|
||||
Double[] out = new Double[arr.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
out[i] = arr[i];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private NetworkTableType m_type;
|
||||
private Object m_value;
|
||||
private long m_time;
|
||||
private long m_serverTime;
|
||||
}
|
||||
@@ -0,0 +1,493 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import edu.wpi.first.util.RuntimeLoader;
|
||||
import edu.wpi.first.util.datalog.DataLog;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.EnumSet;
|
||||
import java.util.OptionalLong;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public final class NetworkTablesJNI {
|
||||
static boolean libraryLoaded = false;
|
||||
static RuntimeLoader<NetworkTablesJNI> loader = null;
|
||||
|
||||
public static class Helper {
|
||||
private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true);
|
||||
|
||||
public static boolean getExtractOnStaticLoad() {
|
||||
return extractOnStaticLoad.get();
|
||||
}
|
||||
|
||||
public static void setExtractOnStaticLoad(boolean load) {
|
||||
extractOnStaticLoad.set(load);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
if (Helper.getExtractOnStaticLoad()) {
|
||||
try {
|
||||
loader =
|
||||
new RuntimeLoader<>(
|
||||
"ntcorejni", RuntimeLoader.getDefaultExtractionRoot(), NetworkTablesJNI.class);
|
||||
loader.loadLibrary();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
libraryLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Force load the library.
|
||||
*
|
||||
* @throws IOException if the library fails to load
|
||||
*/
|
||||
public static synchronized void forceLoad() throws IOException {
|
||||
if (libraryLoaded) {
|
||||
return;
|
||||
}
|
||||
loader =
|
||||
new RuntimeLoader<>(
|
||||
"ntcorejni", RuntimeLoader.getDefaultExtractionRoot(), NetworkTablesJNI.class);
|
||||
loader.loadLibrary();
|
||||
libraryLoaded = true;
|
||||
}
|
||||
|
||||
private static PubSubOptions buildOptions(PubSubOption... options) {
|
||||
if (options.length == 0) {
|
||||
return null; // optimize common case (JNI checks for null)
|
||||
}
|
||||
return new PubSubOptions(options);
|
||||
}
|
||||
|
||||
public static native int getDefaultInstance();
|
||||
|
||||
public static native int createInstance();
|
||||
|
||||
public static native void destroyInstance(int inst);
|
||||
|
||||
public static native int getInstanceFromHandle(int handle);
|
||||
|
||||
private static native int getEntryImpl(
|
||||
int topic, int type, String typeStr, PubSubOptions options);
|
||||
|
||||
public static native int getEntry(int inst, String key);
|
||||
|
||||
public static int getEntry(
|
||||
int topic, int type, String typeStr, PubSubOptions options) {
|
||||
return getEntryImpl(topic, type, typeStr, options);
|
||||
}
|
||||
|
||||
public static int getEntry(
|
||||
int topic, int type, String typeStr, PubSubOption... options) {
|
||||
return getEntryImpl(topic, type, typeStr, buildOptions(options));
|
||||
}
|
||||
|
||||
public static native String getEntryName(int entry);
|
||||
|
||||
public static native long getEntryLastChange(int entry);
|
||||
|
||||
public static native int getType(int entry);
|
||||
|
||||
/* Topic functions */
|
||||
|
||||
public static native int[] getTopics(int inst, String prefix, int types);
|
||||
|
||||
public static native int[] getTopicsStr(int inst, String prefix, String[] types);
|
||||
|
||||
public static native TopicInfo[] getTopicInfos(
|
||||
NetworkTableInstance instObject, int inst, String prefix, int types);
|
||||
|
||||
public static native TopicInfo[] getTopicInfosStr(
|
||||
NetworkTableInstance instObject, int inst, String prefix, String[] types);
|
||||
|
||||
public static native int getTopic(int inst, String name);
|
||||
|
||||
public static native String getTopicName(int topic);
|
||||
|
||||
public static native int getTopicType(int topic);
|
||||
|
||||
public static native void setTopicPersistent(int topic, boolean value);
|
||||
|
||||
public static native boolean getTopicPersistent(int topic);
|
||||
|
||||
public static native void setTopicRetained(int topic, boolean value);
|
||||
|
||||
public static native boolean getTopicRetained(int topic);
|
||||
|
||||
public static native String getTopicTypeString(int topic);
|
||||
|
||||
public static native boolean getTopicExists(int topic);
|
||||
|
||||
public static native String getTopicProperty(int topic, String name);
|
||||
|
||||
public static native void setTopicProperty(int topic, String name, String value);
|
||||
|
||||
public static native void deleteTopicProperty(int topic, String name);
|
||||
|
||||
public static native String getTopicProperties(int topic);
|
||||
|
||||
public static native void setTopicProperties(int topic, String properties);
|
||||
|
||||
public static native int subscribe(
|
||||
int topic, int type, String typeStr, PubSubOptions options);
|
||||
|
||||
public static int subscribe(
|
||||
int topic, int type, String typeStr, PubSubOption... options) {
|
||||
return subscribe(topic, type, typeStr, buildOptions(options));
|
||||
}
|
||||
|
||||
public static native void unsubscribe(int sub);
|
||||
|
||||
public static native int publish(
|
||||
int topic, int type, String typeStr, PubSubOptions options);
|
||||
|
||||
public static int publish(
|
||||
int topic, int type, String typeStr, PubSubOption... options) {
|
||||
return publish(topic, type, typeStr, buildOptions(options));
|
||||
}
|
||||
|
||||
public static native int publishEx(
|
||||
int topic, int type, String typeStr, String properties, PubSubOptions options);
|
||||
|
||||
public static int publishEx(
|
||||
int topic, int type, String typeStr, String properties, PubSubOption... options) {
|
||||
return publishEx(topic, type, typeStr, properties, buildOptions(options));
|
||||
}
|
||||
|
||||
public static native void unpublish(int pubentry);
|
||||
|
||||
public static native void releaseEntry(int entry);
|
||||
|
||||
public static native void release(int pubsubentry);
|
||||
|
||||
public static native int getTopicFromHandle(int pubsubentry);
|
||||
|
||||
public static native int subscribeMultiple(int inst, String[] prefixes, PubSubOptions options);
|
||||
|
||||
public static int subscribeMultiple(int inst, String[] prefixes, PubSubOption... options) {
|
||||
return subscribeMultiple(inst, prefixes, buildOptions(options));
|
||||
}
|
||||
|
||||
public static native void unsubscribeMultiple(int sub);
|
||||
|
||||
public static native TimestampedBoolean getAtomicBoolean(
|
||||
int subentry, boolean defaultValue);
|
||||
|
||||
public static native TimestampedBoolean[] readQueueBoolean(int subentry);
|
||||
|
||||
public static native boolean[] readQueueValuesBoolean(int subentry);
|
||||
|
||||
public static native boolean setBoolean(int entry, long time, boolean value);
|
||||
|
||||
public static native boolean getBoolean(int entry, boolean defaultValue);
|
||||
|
||||
public static native boolean setDefaultBoolean(int entry, long time, boolean defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedInteger getAtomicInteger(
|
||||
int subentry, long defaultValue);
|
||||
|
||||
public static native TimestampedInteger[] readQueueInteger(int subentry);
|
||||
|
||||
public static native long[] readQueueValuesInteger(int subentry);
|
||||
|
||||
public static native boolean setInteger(int entry, long time, long value);
|
||||
|
||||
public static native long getInteger(int entry, long defaultValue);
|
||||
|
||||
public static native boolean setDefaultInteger(int entry, long time, long defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedFloat getAtomicFloat(
|
||||
int subentry, float defaultValue);
|
||||
|
||||
public static native TimestampedFloat[] readQueueFloat(int subentry);
|
||||
|
||||
public static native float[] readQueueValuesFloat(int subentry);
|
||||
|
||||
public static native boolean setFloat(int entry, long time, float value);
|
||||
|
||||
public static native float getFloat(int entry, float defaultValue);
|
||||
|
||||
public static native boolean setDefaultFloat(int entry, long time, float defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedDouble getAtomicDouble(
|
||||
int subentry, double defaultValue);
|
||||
|
||||
public static native TimestampedDouble[] readQueueDouble(int subentry);
|
||||
|
||||
public static native double[] readQueueValuesDouble(int subentry);
|
||||
|
||||
public static native boolean setDouble(int entry, long time, double value);
|
||||
|
||||
public static native double getDouble(int entry, double defaultValue);
|
||||
|
||||
public static native boolean setDefaultDouble(int entry, long time, double defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedString getAtomicString(
|
||||
int subentry, String defaultValue);
|
||||
|
||||
public static native TimestampedString[] readQueueString(int subentry);
|
||||
|
||||
public static native String[] readQueueValuesString(int subentry);
|
||||
|
||||
public static native boolean setString(int entry, long time, String value);
|
||||
|
||||
public static native String getString(int entry, String defaultValue);
|
||||
|
||||
public static native boolean setDefaultString(int entry, long time, String defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedRaw getAtomicRaw(
|
||||
int subentry, byte[] defaultValue);
|
||||
|
||||
public static native TimestampedRaw[] readQueueRaw(int subentry);
|
||||
|
||||
public static native byte[][] readQueueValuesRaw(int subentry);
|
||||
|
||||
public static boolean setRaw(int entry, long time, byte[] value) {
|
||||
return setRaw(entry, time, value, 0, value.length);
|
||||
}
|
||||
|
||||
public static native boolean setRaw(int entry, long time, byte[] value, int start, int len);
|
||||
|
||||
public static boolean setRaw(int entry, long time, ByteBuffer value) {
|
||||
int pos = value.position();
|
||||
return setRaw(entry, time, value, pos, value.capacity() - pos);
|
||||
}
|
||||
|
||||
public static boolean setRaw(int entry, long time, ByteBuffer value, int start, int len) {
|
||||
if (value.isDirect()) {
|
||||
if (start < 0) {
|
||||
throw new IndexOutOfBoundsException("start must be >= 0");
|
||||
}
|
||||
if (len < 0) {
|
||||
throw new IndexOutOfBoundsException("len must be >= 0");
|
||||
}
|
||||
if ((start + len) > value.capacity()) {
|
||||
throw new IndexOutOfBoundsException("start + len must be smaller than buffer capacity");
|
||||
}
|
||||
return setRawBuffer(entry, time, value, start, len);
|
||||
} else if (value.hasArray()) {
|
||||
return setRaw(entry, time, value.array(), value.arrayOffset() + start, len);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("ByteBuffer must be direct or have a backing array");
|
||||
}
|
||||
}
|
||||
|
||||
private static native boolean setRawBuffer(int entry, long time, ByteBuffer value, int start, int len);
|
||||
|
||||
public static native byte[] getRaw(int entry, byte[] defaultValue);
|
||||
|
||||
public static boolean setDefaultRaw(int entry, long time, byte[] defaultValue) {
|
||||
return setDefaultRaw(entry, time, defaultValue, 0, defaultValue.length);
|
||||
}
|
||||
|
||||
public static native boolean setDefaultRaw(int entry, long time, byte[] defaultValue, int start, int len);
|
||||
|
||||
public static boolean setDefaultRaw(int entry, long time, ByteBuffer defaultValue) {
|
||||
int pos = defaultValue.position();
|
||||
return setDefaultRaw(entry, time, defaultValue, pos, defaultValue.limit() - pos);
|
||||
}
|
||||
|
||||
public static boolean setDefaultRaw(int entry, long time, ByteBuffer defaultValue, int start, int len) {
|
||||
if (defaultValue.isDirect()) {
|
||||
if (start < 0) {
|
||||
throw new IndexOutOfBoundsException("start must be >= 0");
|
||||
}
|
||||
if (len < 0) {
|
||||
throw new IndexOutOfBoundsException("len must be >= 0");
|
||||
}
|
||||
if ((start + len) > defaultValue.capacity()) {
|
||||
throw new IndexOutOfBoundsException("start + len must be smaller than buffer capacity");
|
||||
}
|
||||
return setDefaultRawBuffer(entry, time, defaultValue, start, len);
|
||||
} else if (defaultValue.hasArray()) {
|
||||
return setDefaultRaw(entry, time, defaultValue.array(), defaultValue.arrayOffset() + start, len);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("ByteBuffer must be direct or have a backing array");
|
||||
}
|
||||
}
|
||||
|
||||
private static native boolean setDefaultRawBuffer(int entry, long time, ByteBuffer defaultValue, int start, int len);
|
||||
|
||||
|
||||
public static native TimestampedBooleanArray getAtomicBooleanArray(
|
||||
int subentry, boolean[] defaultValue);
|
||||
|
||||
public static native TimestampedBooleanArray[] readQueueBooleanArray(int subentry);
|
||||
|
||||
public static native boolean[][] readQueueValuesBooleanArray(int subentry);
|
||||
|
||||
public static native boolean setBooleanArray(int entry, long time, boolean[] value);
|
||||
|
||||
public static native boolean[] getBooleanArray(int entry, boolean[] defaultValue);
|
||||
|
||||
public static native boolean setDefaultBooleanArray(int entry, long time, boolean[] defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedIntegerArray getAtomicIntegerArray(
|
||||
int subentry, long[] defaultValue);
|
||||
|
||||
public static native TimestampedIntegerArray[] readQueueIntegerArray(int subentry);
|
||||
|
||||
public static native long[][] readQueueValuesIntegerArray(int subentry);
|
||||
|
||||
public static native boolean setIntegerArray(int entry, long time, long[] value);
|
||||
|
||||
public static native long[] getIntegerArray(int entry, long[] defaultValue);
|
||||
|
||||
public static native boolean setDefaultIntegerArray(int entry, long time, long[] defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedFloatArray getAtomicFloatArray(
|
||||
int subentry, float[] defaultValue);
|
||||
|
||||
public static native TimestampedFloatArray[] readQueueFloatArray(int subentry);
|
||||
|
||||
public static native float[][] readQueueValuesFloatArray(int subentry);
|
||||
|
||||
public static native boolean setFloatArray(int entry, long time, float[] value);
|
||||
|
||||
public static native float[] getFloatArray(int entry, float[] defaultValue);
|
||||
|
||||
public static native boolean setDefaultFloatArray(int entry, long time, float[] defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedDoubleArray getAtomicDoubleArray(
|
||||
int subentry, double[] defaultValue);
|
||||
|
||||
public static native TimestampedDoubleArray[] readQueueDoubleArray(int subentry);
|
||||
|
||||
public static native double[][] readQueueValuesDoubleArray(int subentry);
|
||||
|
||||
public static native boolean setDoubleArray(int entry, long time, double[] value);
|
||||
|
||||
public static native double[] getDoubleArray(int entry, double[] defaultValue);
|
||||
|
||||
public static native boolean setDefaultDoubleArray(int entry, long time, double[] defaultValue);
|
||||
|
||||
|
||||
public static native TimestampedStringArray getAtomicStringArray(
|
||||
int subentry, String[] defaultValue);
|
||||
|
||||
public static native TimestampedStringArray[] readQueueStringArray(int subentry);
|
||||
|
||||
public static native String[][] readQueueValuesStringArray(int subentry);
|
||||
|
||||
public static native boolean setStringArray(int entry, long time, String[] value);
|
||||
|
||||
public static native String[] getStringArray(int entry, String[] defaultValue);
|
||||
|
||||
public static native boolean setDefaultStringArray(int entry, long time, String[] defaultValue);
|
||||
|
||||
|
||||
public static native NetworkTableValue[] readQueueValue(int subentry);
|
||||
|
||||
public static native NetworkTableValue getValue(int entry);
|
||||
|
||||
public static native void setEntryFlags(int entry, int flags);
|
||||
|
||||
public static native int getEntryFlags(int entry);
|
||||
|
||||
public static native TopicInfo getTopicInfo(NetworkTableInstance inst, int topic);
|
||||
|
||||
public static native int createListenerPoller(int inst);
|
||||
|
||||
public static native void destroyListenerPoller(int poller);
|
||||
|
||||
private static int kindsToMask(EnumSet<NetworkTableEvent.Kind> kinds) {
|
||||
int mask = 0;
|
||||
for (NetworkTableEvent.Kind kind : kinds) {
|
||||
mask |= kind.getValue();
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
public static int addListener(int poller, String[] prefixes, EnumSet<NetworkTableEvent.Kind> kinds) {
|
||||
return addListener(poller, prefixes, kindsToMask(kinds));
|
||||
}
|
||||
|
||||
public static int addListener(int poller, int handle, EnumSet<NetworkTableEvent.Kind> kinds) {
|
||||
return addListener(poller, handle, kindsToMask(kinds));
|
||||
}
|
||||
|
||||
public static native int addListener(int poller, String[] prefixes, int mask);
|
||||
|
||||
public static native int addListener(int poller, int handle, int mask);
|
||||
|
||||
public static native NetworkTableEvent[] readListenerQueue(
|
||||
NetworkTableInstance inst, int poller);
|
||||
|
||||
public static native void removeListener(int listener);
|
||||
|
||||
public static native int getNetworkMode(int inst);
|
||||
|
||||
public static native void startLocal(int inst);
|
||||
|
||||
public static native void stopLocal(int inst);
|
||||
|
||||
public static native void startServer(
|
||||
int inst, String persistFilename, String listenAddress, int port3, int port4);
|
||||
|
||||
public static native void stopServer(int inst);
|
||||
|
||||
public static native void startClient3(int inst, String identity);
|
||||
|
||||
public static native void startClient4(int inst, String identity);
|
||||
|
||||
public static native void stopClient(int inst);
|
||||
|
||||
public static native void setServer(int inst, String serverName, int port);
|
||||
|
||||
public static native void setServer(int inst, String[] serverNames, int[] ports);
|
||||
|
||||
public static native void setServerTeam(int inst, int team, int port);
|
||||
|
||||
public static native void disconnect(int inst);
|
||||
|
||||
public static native void startDSClient(int inst, int port);
|
||||
|
||||
public static native void stopDSClient(int inst);
|
||||
|
||||
public static native void flushLocal(int inst);
|
||||
|
||||
public static native void flush(int inst);
|
||||
|
||||
public static native ConnectionInfo[] getConnections(int inst);
|
||||
|
||||
public static native boolean isConnected(int inst);
|
||||
|
||||
public static native OptionalLong getServerTimeOffset(int inst);
|
||||
|
||||
public static native long now();
|
||||
|
||||
private static native int startEntryDataLog(int inst, long log, String prefix, String logPrefix);
|
||||
|
||||
public static int startEntryDataLog(int inst, DataLog log, String prefix, String logPrefix) {
|
||||
return startEntryDataLog(inst, log.getImpl(), prefix, logPrefix);
|
||||
}
|
||||
|
||||
public static native void stopEntryDataLog(int logger);
|
||||
|
||||
private static native int startConnectionDataLog(int inst, long log, String name);
|
||||
|
||||
public static int startConnectionDataLog(int inst, DataLog log, String name) {
|
||||
return startConnectionDataLog(inst, log.getImpl(), name);
|
||||
}
|
||||
|
||||
public static native void stopConnectionDataLog(int logger);
|
||||
|
||||
public static native int addLogger(int poller, int minLevel, int maxLevel);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables Raw entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface RawEntry extends RawSubscriber, RawPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/** NetworkTables Raw implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class RawEntryImpl extends EntryBase implements RawEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
RawEntryImpl(RawTopic topic, int handle, byte[] defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RawTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] get() {
|
||||
return NetworkTablesJNI.getRaw(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] get(byte[] defaultValue) {
|
||||
return NetworkTablesJNI.getRaw(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedRaw getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicRaw(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedRaw getAtomic(byte[] defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicRaw(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedRaw[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueRaw(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[][] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesRaw(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(byte[] value, int start, int len, long time) {
|
||||
NetworkTablesJNI.setRaw(m_handle, time, value, start, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(ByteBuffer value, int start, int len, long time) {
|
||||
NetworkTablesJNI.setRaw(m_handle, time, value, start, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(byte[] value, int start, int len) {
|
||||
NetworkTablesJNI.setDefaultRaw(m_handle, 0, value, start, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(ByteBuffer value, int start, int len) {
|
||||
NetworkTablesJNI.setDefaultRaw(m_handle, 0, value, start, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final RawTopic m_topic;
|
||||
private final byte[] m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** NetworkTables Raw publisher. */
|
||||
public interface RawPublisher extends Publisher, Consumer<byte[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
RawTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(byte[] value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
default void set(byte[] value, long time) {
|
||||
set(value, 0, value.length, time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.length - start)
|
||||
*/
|
||||
default void set(byte[] value, int start, int len) {
|
||||
set(value, start, len, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.length - start)
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(byte[] value, int start, int len, long time);
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish; will send from value.position() to value.limit()
|
||||
*/
|
||||
default void set(ByteBuffer value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish; will send from value.position() to value.limit()
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
default void set(ByteBuffer value, long time) {
|
||||
int pos = value.position();
|
||||
set(value, pos, value.limit() - pos, time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.capacity() - start)
|
||||
*/
|
||||
default void set(ByteBuffer value, int start, int len) {
|
||||
set(value, start, len, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.capacity() - start)
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(ByteBuffer value, int start, int len, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
default void setDefault(byte[] value) {
|
||||
setDefault(value, 0, value.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.length - start)
|
||||
*/
|
||||
void setDefault(byte[] value, int start, int len);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value; will send from value.position() to value.limit()
|
||||
*/
|
||||
default void setDefault(ByteBuffer value) {
|
||||
int pos = value.position();
|
||||
setDefault(value, pos, value.limit() - pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
* @param start Start position of data (in buffer)
|
||||
* @param len Length of data (must be less than or equal to value.capacity() - start)
|
||||
*/
|
||||
void setDefault(ByteBuffer value, int start, int len);
|
||||
|
||||
@Override
|
||||
default void accept(byte[] value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** NetworkTables Raw subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface RawSubscriber extends Subscriber, Supplier<byte[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
RawTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
byte[] get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
byte[] get(byte[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedRaw getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedRaw getAtomic(byte[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedRaw[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
byte[][] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables Raw topic. */
|
||||
public final class RawTopic extends Topic {
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public RawTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getRawTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public RawTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public RawSubscriber subscribe(
|
||||
String typeString,
|
||||
|
||||
byte[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new RawEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kRaw.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public RawPublisher publish(
|
||||
String typeString,
|
||||
|
||||
PubSubOption... options) {
|
||||
return new RawEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kRaw.getValue(),
|
||||
typeString, options),
|
||||
new byte[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public RawPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new RawEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kRaw.getValue(),
|
||||
typeString, properties, options),
|
||||
new byte[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public RawEntry getEntry(
|
||||
String typeString,
|
||||
|
||||
byte[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new RawEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kRaw.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables StringArray entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface StringArrayEntry extends StringArraySubscriber, StringArrayPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables StringArray implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class StringArrayEntryImpl extends EntryBase implements StringArrayEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
StringArrayEntryImpl(StringArrayTopic topic, int handle, String[] defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringArrayTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] get() {
|
||||
return NetworkTablesJNI.getStringArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] get(String[] defaultValue) {
|
||||
return NetworkTablesJNI.getStringArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedStringArray getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicStringArray(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedStringArray getAtomic(String[] defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicStringArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedStringArray[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueStringArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[][] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesStringArray(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(String[] value, long time) {
|
||||
NetworkTablesJNI.setStringArray(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(String[] value) {
|
||||
NetworkTablesJNI.setDefaultStringArray(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final StringArrayTopic m_topic;
|
||||
private final String[] m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** NetworkTables StringArray publisher. */
|
||||
public interface StringArrayPublisher extends Publisher, Consumer<String[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
StringArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(String[] value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(String[] value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(String[] value);
|
||||
|
||||
@Override
|
||||
default void accept(String[] value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** NetworkTables StringArray subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface StringArraySubscriber extends Subscriber, Supplier<String[]> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
StringArrayTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
String[] get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
String[] get(String[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedStringArray getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedStringArray getAtomic(String[] defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedStringArray[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
String[][] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables StringArray topic. */
|
||||
public final class StringArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "string[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public StringArrayTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getStringArrayTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public StringArrayTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public StringArraySubscriber subscribe(
|
||||
String[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
"string[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public StringArraySubscriber subscribeEx(
|
||||
String typeString,
|
||||
String[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public StringArrayPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
"string[]", options),
|
||||
new String[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public StringArrayPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
typeString, properties, options),
|
||||
new String[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public StringArrayEntry getEntry(
|
||||
String[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
"string[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public StringArrayEntry getEntryEx(
|
||||
String typeString,
|
||||
String[] defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/**
|
||||
* NetworkTables String entry.
|
||||
*
|
||||
* <p>Unlike NetworkTableEntry, the entry goes away when close() is called.
|
||||
*/
|
||||
public interface StringEntry extends StringSubscriber, StringPublisher {
|
||||
/** Stops publishing the entry if it's published. */
|
||||
void unpublish();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables String implementation. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
final class StringEntryImpl extends EntryBase implements StringEntry {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param topic Topic
|
||||
* @param handle Native handle
|
||||
* @param defaultValue Default value for get()
|
||||
*/
|
||||
StringEntryImpl(StringTopic topic, int handle, String defaultValue) {
|
||||
super(handle);
|
||||
m_topic = topic;
|
||||
m_defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringTopic getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get() {
|
||||
return NetworkTablesJNI.getString(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(String defaultValue) {
|
||||
return NetworkTablesJNI.getString(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedString getAtomic() {
|
||||
return NetworkTablesJNI.getAtomicString(m_handle, m_defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedString getAtomic(String defaultValue) {
|
||||
return NetworkTablesJNI.getAtomicString(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampedString[] readQueue() {
|
||||
return NetworkTablesJNI.readQueueString(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] readQueueValues() {
|
||||
return NetworkTablesJNI.readQueueValuesString(m_handle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(String value, long time) {
|
||||
NetworkTablesJNI.setString(m_handle, time, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefault(String value) {
|
||||
NetworkTablesJNI.setDefaultString(m_handle, 0, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unpublish() {
|
||||
NetworkTablesJNI.unpublish(m_handle);
|
||||
}
|
||||
|
||||
private final StringTopic m_topic;
|
||||
private final String m_defaultValue;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** NetworkTables String publisher. */
|
||||
public interface StringPublisher extends Publisher, Consumer<String> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
StringTopic getTopic();
|
||||
|
||||
/**
|
||||
* Publish a new value using current NT time.
|
||||
*
|
||||
* @param value value to publish
|
||||
*/
|
||||
default void set(String value) {
|
||||
set(value, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a new value.
|
||||
*
|
||||
* @param value value to publish
|
||||
* @param time timestamp; 0 indicates current NT time should be used
|
||||
*/
|
||||
void set(String value, long time);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
* On reconnect, a default value will never be used in preference to a
|
||||
* published value.
|
||||
*
|
||||
* @param value value
|
||||
*/
|
||||
void setDefault(String value);
|
||||
|
||||
@Override
|
||||
default void accept(String value) {
|
||||
set(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** NetworkTables String subscriber. */
|
||||
@SuppressWarnings("PMD.MissingOverride")
|
||||
public interface StringSubscriber extends Subscriber, Supplier<String> {
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
*
|
||||
* @return Topic
|
||||
*/
|
||||
@Override
|
||||
StringTopic getTopic();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the stored default value.
|
||||
*
|
||||
* @return value
|
||||
*/
|
||||
String get();
|
||||
|
||||
/**
|
||||
* Get the last published value.
|
||||
* If no value has been published, returns the passed defaultValue.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return value
|
||||
*/
|
||||
String get(String defaultValue);
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the stored default value and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedString getAtomic();
|
||||
|
||||
/**
|
||||
* Get the last published value along with its timestamp
|
||||
* If no value has been published, returns the passed defaultValue and a
|
||||
* timestamp of 0.
|
||||
*
|
||||
* @param defaultValue default value to return if no value has been published
|
||||
* @return timestamped value
|
||||
*/
|
||||
TimestampedString getAtomic(String defaultValue);
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
* Also provides a timestamp for each value.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of timestamped values; empty array if no new changes have
|
||||
* been published since the previous call.
|
||||
*/
|
||||
TimestampedString[] readQueue();
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to readQueue.
|
||||
*
|
||||
* <p>The "poll storage" subscribe option can be used to set the queue
|
||||
* depth.
|
||||
*
|
||||
* @return Array of values; empty array if no new changes have been
|
||||
* published since the previous call.
|
||||
*/
|
||||
String[] readQueueValues();
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables String topic. */
|
||||
public final class StringTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "string";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
*
|
||||
* @param topic Topic
|
||||
*/
|
||||
public StringTopic(Topic topic) {
|
||||
super(topic.m_inst, topic.m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor; use NetworkTableInstance.getStringTopic() instead.
|
||||
*
|
||||
* @param inst Instance
|
||||
* @param handle Native handle
|
||||
*/
|
||||
public StringTopic(NetworkTableInstance inst, int handle) {
|
||||
super(inst, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public StringSubscriber subscribe(
|
||||
String defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
"string", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic, with specified type string.
|
||||
*
|
||||
* <p>The subscriber is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>Subscribers that do not match the published data type do not return
|
||||
* any values. To determine if the data type matches, use the appropriate
|
||||
* Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options subscribe options
|
||||
* @return subscriber
|
||||
*/
|
||||
public StringSubscriber subscribeEx(
|
||||
String typeString,
|
||||
String defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
*/
|
||||
public StringPublisher publish(
|
||||
PubSubOption... options) {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
"string", options),
|
||||
"");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial properties.
|
||||
*
|
||||
* <p>The publisher is only active as long as the returned object
|
||||
* is not closed.
|
||||
*
|
||||
* <p>It is not possible to publish two different data types to the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored). To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param properties JSON properties
|
||||
* @param options publish options
|
||||
* @return publisher
|
||||
* @throws IllegalArgumentException if properties is not a JSON object
|
||||
*/
|
||||
public StringPublisher publishEx(
|
||||
String typeString,
|
||||
String properties,
|
||||
PubSubOption... options) {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
typeString, properties, options),
|
||||
"");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public StringEntry getEntry(
|
||||
String defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
"string", options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new entry for the topic, with specified type string.
|
||||
*
|
||||
* <p>Entries act as a combination of a subscriber and a weak publisher. The
|
||||
* subscriber is active as long as the entry is not closed. The publisher is
|
||||
* created when the entry is first written to, and remains active until either
|
||||
* unpublish() is called or the entry is closed.
|
||||
*
|
||||
* <p>It is not possible to use two different data types with the same
|
||||
* topic. Conflicts between publishers are typically resolved by the server on
|
||||
* a first-come, first-served basis. Any published values that do not match
|
||||
* the topic's data type are dropped (ignored), and the entry will show no new
|
||||
* values if the data type does not match. To determine if the data type
|
||||
* matches, use the appropriate Topic functions.
|
||||
*
|
||||
* @param typeString type string
|
||||
* @param defaultValue default value used when a default is not provided to a
|
||||
* getter function
|
||||
* @param options publish and/or subscribe options
|
||||
* @return entry
|
||||
*/
|
||||
public StringEntry getEntryEx(
|
||||
String typeString,
|
||||
String defaultValue,
|
||||
PubSubOption... options) {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped Boolean. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedBoolean {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedBoolean(long timestamp, long serverTime, boolean value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped BooleanArray. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedBooleanArray {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedBooleanArray(long timestamp, long serverTime, boolean[] value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean[] value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped Double. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedDouble {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedDouble(long timestamp, long serverTime, double value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final double value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped DoubleArray. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedDoubleArray {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedDoubleArray(long timestamp, long serverTime, double[] value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final double[] value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped Float. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedFloat {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedFloat(long timestamp, long serverTime, float value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final float value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped FloatArray. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedFloatArray {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedFloatArray(long timestamp, long serverTime, float[] value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final float[] value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped Integer. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedInteger {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedInteger(long timestamp, long serverTime, long value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped IntegerArray. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedIntegerArray {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedIntegerArray(long timestamp, long serverTime, long[] value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long[] value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped Raw. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedRaw {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedRaw(long timestamp, long serverTime, byte[] value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final byte[] value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped String. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedString {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedString(long timestamp, long serverTime, String value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final String value;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.networktables;
|
||||
|
||||
/** NetworkTables timestamped StringArray. */
|
||||
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
|
||||
public final class TimestampedStringArray {
|
||||
/**
|
||||
* Create a timestamped value.
|
||||
*
|
||||
* @param timestamp timestamp in local time base
|
||||
* @param serverTime timestamp in server time base
|
||||
* @param value value
|
||||
*/
|
||||
public TimestampedStringArray(long timestamp, long serverTime, String[] value) {
|
||||
this.timestamp = timestamp;
|
||||
this.serverTime = serverTime;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp in local time base.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long timestamp;
|
||||
|
||||
/**
|
||||
* Timestamp in server time base. May be 0 or 1 for locally set values.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final long serverTime;
|
||||
|
||||
/**
|
||||
* Value.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final String[] value;
|
||||
}
|
||||
1436
ntcore/src/generated/main/native/cpp/jni/types_jni.cpp
Normal file
1436
ntcore/src/generated/main/native/cpp/jni/types_jni.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user