mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[ntcore] Rename constants to all caps style (#8676)
This commit is contained in:
@@ -122,9 +122,9 @@ NTField2DModel::NTField2DModel(wpi::nt::NetworkTableInstance inst,
|
||||
m_tableSub{inst, {{m_path}}, {.periodic = 0.05, .sendAll = true}},
|
||||
m_nameTopic{inst.GetTopic(fmt::format("{}/.name", path))},
|
||||
m_poller{inst} {
|
||||
m_poller.AddListener(m_tableSub, wpi::nt::EventFlags::kTopic |
|
||||
wpi::nt::EventFlags::kValueAll |
|
||||
wpi::nt::EventFlags::kImmediate);
|
||||
m_poller.AddListener(m_tableSub, wpi::nt::EventFlags::TOPIC |
|
||||
wpi::nt::EventFlags::VALUE_ALL |
|
||||
wpi::nt::EventFlags::IMMEDIATE);
|
||||
}
|
||||
|
||||
NTField2DModel::~NTField2DModel() = default;
|
||||
@@ -138,12 +138,12 @@ void NTField2DModel::Update() {
|
||||
continue;
|
||||
}
|
||||
auto [it, match] = Find(info->name);
|
||||
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
|
||||
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
|
||||
if (match) {
|
||||
m_objects.erase(it);
|
||||
}
|
||||
continue;
|
||||
} else if (event.flags & wpi::nt::EventFlags::kPublish) {
|
||||
} else if (event.flags & wpi::nt::EventFlags::PUBLISH) {
|
||||
if (!match) {
|
||||
it = m_objects.emplace(
|
||||
it, std::make_unique<ObjectModel>(
|
||||
|
||||
@@ -54,7 +54,7 @@ void NTMechanism2DModel::NTMechanismGroupImpl::NTUpdate(
|
||||
bool match = it != m_objects.end() && (*it)->GetName() == name;
|
||||
|
||||
if (event.GetTopicInfo()) {
|
||||
if (event.flags & wpi::nt::EventFlags::kPublish) {
|
||||
if (event.flags & wpi::nt::EventFlags::PUBLISH) {
|
||||
if (!match) {
|
||||
it = m_objects.emplace(
|
||||
it, std::make_unique<NTMechanismObjectModel>(
|
||||
@@ -79,7 +79,7 @@ bool NTMechanism2DModel::NTMechanismObjectModel::NTUpdate(
|
||||
const wpi::nt::Event& event, std::string_view childName) {
|
||||
if (auto info = event.GetTopicInfo()) {
|
||||
if (info->topic == m_typeTopic.GetHandle()) {
|
||||
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
|
||||
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
|
||||
return true;
|
||||
}
|
||||
} else if (info->topic != m_colorTopic.GetHandle() &&
|
||||
@@ -121,7 +121,7 @@ bool NTMechanism2DModel::RootModel::NTUpdate(const wpi::nt::Event& event,
|
||||
if (auto info = event.GetTopicInfo()) {
|
||||
if (info->topic == m_xTopic.GetHandle() ||
|
||||
info->topic == m_yTopic.GetHandle()) {
|
||||
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
|
||||
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@@ -158,9 +158,9 @@ NTMechanism2DModel::NTMechanism2DModel(wpi::nt::NetworkTableInstance inst,
|
||||
m_bgColorTopic{m_inst.GetTopic(fmt::format("{}/backgroundColor", path))},
|
||||
m_poller{m_inst},
|
||||
m_dimensionsValue{1_m, 1_m} {
|
||||
m_poller.AddListener(m_tableSub, wpi::nt::EventFlags::kTopic |
|
||||
wpi::nt::EventFlags::kValueAll |
|
||||
wpi::nt::EventFlags::kImmediate);
|
||||
m_poller.AddListener(m_tableSub, wpi::nt::EventFlags::TOPIC |
|
||||
wpi::nt::EventFlags::VALUE_ALL |
|
||||
wpi::nt::EventFlags::IMMEDIATE);
|
||||
}
|
||||
|
||||
NTMechanism2DModel::~NTMechanism2DModel() = default;
|
||||
@@ -184,7 +184,7 @@ void NTMechanism2DModel::Update() {
|
||||
});
|
||||
bool match = it != m_roots.end() && (*it)->GetName() == name;
|
||||
|
||||
if (event.flags & wpi::nt::EventFlags::kPublish) {
|
||||
if (event.flags & wpi::nt::EventFlags::PUBLISH) {
|
||||
if (!match) {
|
||||
it = m_roots.emplace(
|
||||
it, std::make_unique<RootModel>(
|
||||
|
||||
@@ -23,7 +23,7 @@ NTStringChooserModel::NTStringChooserModel(wpi::nt::NetworkTableInstance inst,
|
||||
m_selected{m_inst.GetStringTopic(fmt::format("{}/selected", path))
|
||||
.Subscribe("")},
|
||||
m_selectedPub{m_inst.GetStringTopic(fmt::format("{}/selected", path))
|
||||
.PublishEx(wpi::nt::StringTopic::kTypeString,
|
||||
.PublishEx(wpi::nt::StringTopic::TYPE_STRING,
|
||||
{{"retained", true}})},
|
||||
m_active{
|
||||
m_inst.GetStringTopic(fmt::format("{}/active", path)).Subscribe("")},
|
||||
|
||||
@@ -94,9 +94,9 @@ NetworkTablesModel::NetworkTablesModel()
|
||||
|
||||
NetworkTablesModel::NetworkTablesModel(wpi::nt::NetworkTableInstance inst)
|
||||
: m_inst{inst}, m_poller{inst} {
|
||||
m_poller.AddListener({{"", "$"}}, wpi::nt::EventFlags::kTopic |
|
||||
wpi::nt::EventFlags::kValueAll |
|
||||
wpi::nt::EventFlags::kImmediate);
|
||||
m_poller.AddListener({{"", "$"}}, wpi::nt::EventFlags::TOPIC |
|
||||
wpi::nt::EventFlags::VALUE_ALL |
|
||||
wpi::nt::EventFlags::IMMEDIATE);
|
||||
}
|
||||
|
||||
NetworkTablesModel::Entry::~Entry() {
|
||||
@@ -979,14 +979,14 @@ void NetworkTablesModel::Update() {
|
||||
for (auto&& event : m_poller.ReadQueue()) {
|
||||
if (auto info = event.GetTopicInfo()) {
|
||||
auto& entry = m_entries[info->topic];
|
||||
if (event.flags & wpi::nt::EventFlags::kPublish) {
|
||||
if (event.flags & wpi::nt::EventFlags::PUBLISH) {
|
||||
if (!entry) {
|
||||
entry = std::make_unique<Entry>();
|
||||
m_sortedEntries.emplace_back(entry.get());
|
||||
updateTree = true;
|
||||
}
|
||||
}
|
||||
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
|
||||
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
|
||||
// meta topic handling
|
||||
if (wpi::util::starts_with(info->name, '$')) {
|
||||
// meta topic handling
|
||||
@@ -1020,7 +1020,7 @@ void NetworkTablesModel::Update() {
|
||||
updateTree = true;
|
||||
continue;
|
||||
}
|
||||
if (event.flags & wpi::nt::EventFlags::kProperties) {
|
||||
if (event.flags & wpi::nt::EventFlags::PROPERTIES) {
|
||||
updateTree = true;
|
||||
}
|
||||
if (entry) {
|
||||
|
||||
@@ -30,7 +30,7 @@ NetworkTablesProvider::NetworkTablesProvider(Storage& storage,
|
||||
m_typeCache{storage.GetChild("types")} {
|
||||
storage.SetCustomApply([this] {
|
||||
m_listener = m_poller.AddListener(
|
||||
{{""}}, wpi::nt::EventFlags::kImmediate | wpi::nt::EventFlags::kTopic);
|
||||
{{""}}, wpi::nt::EventFlags::IMMEDIATE | wpi::nt::EventFlags::TOPIC);
|
||||
for (auto&& childIt : m_storage.GetChildren()) {
|
||||
auto id = childIt.key();
|
||||
auto typePtr = m_typeCache.FindValue(id);
|
||||
@@ -125,7 +125,7 @@ void NetworkTablesProvider::Update() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
|
||||
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
|
||||
auto it = m_topicMap.find(info->topic);
|
||||
if (it != m_topicMap.end()) {
|
||||
m_poller.RemoveListener(it->second.listener);
|
||||
@@ -140,14 +140,14 @@ void NetworkTablesProvider::Update() {
|
||||
if (it2 != m_viewEntries.end()) {
|
||||
m_viewEntries.erase(it2);
|
||||
}
|
||||
} else if (event.flags & wpi::nt::EventFlags::kPublish) {
|
||||
} else if (event.flags & wpi::nt::EventFlags::PUBLISH) {
|
||||
// subscribe to it; use a subscriber so we only get string values
|
||||
SubListener sublistener;
|
||||
sublistener.subscriber =
|
||||
wpi::nt::StringTopic{info->topic}.Subscribe("");
|
||||
sublistener.listener = m_poller.AddListener(
|
||||
sublistener.subscriber,
|
||||
wpi::nt::EventFlags::kValueAll | wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::VALUE_ALL | wpi::nt::EventFlags::IMMEDIATE);
|
||||
m_topicMap.try_emplace(info->topic, std::move(sublistener));
|
||||
}
|
||||
} else if (auto valueData = event.GetValueEventData()) {
|
||||
|
||||
@@ -67,30 +67,30 @@ final class GenericEntryImpl extends EntryBase implements GenericEntry {
|
||||
long time = value.getTime();
|
||||
Object otherValue = value.getValue();
|
||||
switch (value.getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
@@ -220,30 +220,30 @@ final class GenericEntryImpl extends EntryBase implements GenericEntry {
|
||||
long time = defaultValue.getTime();
|
||||
Object otherValue = defaultValue.getValue();
|
||||
switch (defaultValue.getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setDefaultBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setDefaultInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setDefaultFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDefaultDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setDefaultString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -222,30 +222,30 @@ public final class NetworkTableEntry implements Publisher, Subscriber {
|
||||
long time = ((NetworkTableValue) defaultValue).getTime();
|
||||
Object otherValue = ((NetworkTableValue) defaultValue).getValue();
|
||||
switch (((NetworkTableValue) defaultValue).getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setDefaultBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setDefaultInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setDefaultFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDefaultDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setDefaultString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
@@ -375,30 +375,30 @@ public final class NetworkTableEntry implements Publisher, Subscriber {
|
||||
long time = ((NetworkTableValue) value).getTime();
|
||||
Object otherValue = ((NetworkTableValue) value).getValue();
|
||||
switch (((NetworkTableValue) value).getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -47,16 +47,16 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
/** Client/server mode flag values (as returned by {@link #getNetworkMode()}). */
|
||||
public enum NetworkMode {
|
||||
/** Running in server mode. */
|
||||
kServer(0x01),
|
||||
SERVER(0x01),
|
||||
|
||||
/** Running in client mode. */
|
||||
kClient(0x04),
|
||||
CLIENT(0x04),
|
||||
|
||||
/** Currently starting up (either client or server). */
|
||||
kStarting(0x08),
|
||||
STARTING(0x08),
|
||||
|
||||
/** Running in local-only mode. */
|
||||
kLocal(0x10);
|
||||
LOCAL(0x10);
|
||||
|
||||
private final int value;
|
||||
|
||||
@@ -75,7 +75,7 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
}
|
||||
|
||||
/** The default port that network tables operates on. */
|
||||
public static final int kDefaultPort = 5810;
|
||||
public static final int DEFAULT_PORT = 5810;
|
||||
|
||||
/**
|
||||
* Construct from native handle.
|
||||
@@ -709,9 +709,9 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
*/
|
||||
public int addConnectionListener(
|
||||
boolean immediateNotify, Consumer<NetworkTableEvent> listener) {
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.kConnection);
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.CONNECTION);
|
||||
if (immediateNotify) {
|
||||
eventKinds.add(NetworkTableEvent.Kind.kImmediate);
|
||||
eventKinds.add(NetworkTableEvent.Kind.IMMEDIATE);
|
||||
}
|
||||
return m_listeners.add(m_handle, eventKinds, listener);
|
||||
}
|
||||
@@ -727,9 +727,9 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
*/
|
||||
public int addTimeSyncListener(
|
||||
boolean immediateNotify, Consumer<NetworkTableEvent> listener) {
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.kTimeSync);
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.TIME_SYNC);
|
||||
if (immediateNotify) {
|
||||
eventKinds.add(NetworkTableEvent.Kind.kImmediate);
|
||||
eventKinds.add(NetworkTableEvent.Kind.IMMEDIATE);
|
||||
}
|
||||
return m_listeners.add(m_handle, eventKinds, listener);
|
||||
}
|
||||
@@ -913,7 +913,7 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
* @param mdnsService the mDNS service name to advertise, or empty to not advertise
|
||||
*/
|
||||
public void startServer(String persistFilename, String listenAddress, String mdnsService) {
|
||||
startServer(persistFilename, listenAddress, mdnsService, kDefaultPort);
|
||||
startServer(persistFilename, listenAddress, mdnsService, DEFAULT_PORT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value contains a value.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return m_type != NetworkTableType.kUnassigned;
|
||||
return m_type != NetworkTableType.UNASSIGNED;
|
||||
}
|
||||
{% for t in types %}
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of {{ t.java.ValueType }} type.
|
||||
*/
|
||||
public boolean is{{ t.TypeName }}() {
|
||||
return m_type == NetworkTableType.k{{ t.TypeName }};
|
||||
return m_type == NetworkTableType.{{ t.TYPE_NAME }};
|
||||
}
|
||||
{% endfor %}
|
||||
/*
|
||||
@@ -99,7 +99,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of {{ t.java.ValueType }} type.
|
||||
*/
|
||||
public {{ t.java.ValueType }} get{{ t.TypeName }}() {
|
||||
if (m_type != NetworkTableType.k{{ t.TypeName }}) {
|
||||
if (m_type != NetworkTableType.{{ t.TYPE_NAME }}) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to {{ t.java.ValueType }}");
|
||||
}
|
||||
return {{ t.java.FromStorageBegin }}m_value{{ t.java.FromStorageEnd }};
|
||||
@@ -116,7 +116,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue make{{ t.TypeName }}({{ t.java.ValueType }} value) {
|
||||
return new NetworkTableValue(NetworkTableType.k{{ t.TypeName }}, {{ t.java.ToWrapObject }}(value));
|
||||
return new NetworkTableValue(NetworkTableType.{{ t.TYPE_NAME }}, {{ t.java.ToWrapObject }}(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue make{{ t.TypeName }}({{ t.java.ValueType }} value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.k{{ t.TypeName }}, {{ t.java.ToWrapObject }}(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.{{ t.TYPE_NAME }}, {{ t.java.ToWrapObject }}(value), time);
|
||||
}
|
||||
{% if t.java.WrapValueType %}
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue make{{ t.TypeName }}({{ t.java.WrapValueType }} value) {
|
||||
return new NetworkTableValue(NetworkTableType.k{{ t.TypeName }}, toNative{{ t.TypeName }}(value));
|
||||
return new NetworkTableValue(NetworkTableType.{{ t.TYPE_NAME }}, toNative{{ t.TypeName }}(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,7 +148,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue make{{ t.TypeName }}({{ t.java.WrapValueType }} value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.k{{ t.TypeName }}, toNative{{ t.TypeName }}(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.{{ t.TYPE_NAME }}, toNative{{ t.TypeName }}(value), time);
|
||||
}
|
||||
{% endif -%}
|
||||
{% endfor %}
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.wpilib.networktables;
|
||||
public final class {{ TypeName }}Topic extends Topic {
|
||||
{%- if TypeString %}
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = {{ TypeString }};
|
||||
public static final String TYPE_STRING = {{ TypeString }};
|
||||
{% endif %}
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -58,7 +58,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
{{ TypeString|default('typeString') }}, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
{{ TypeString|default('typeString') }}, options),
|
||||
{{ java.EmptyValue }});
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
typeString, properties, options),
|
||||
{{ java.EmptyValue }});
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
{{ TypeString|default('typeString') }}, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public final class {{ TypeName }}Topic extends Topic {
|
||||
return new {{ TypeName }}EntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.k{{ TypeName }}.getValue(),
|
||||
m_handle, NetworkTableType.{{ TYPE_NAME }}.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
using TimestampedValueType = Timestamped{{ TypeName }};
|
||||
{%- if TypeString %}
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = {{ TypeString }};
|
||||
static constexpr std::string_view TYPE_STRING = {{ TypeString }};
|
||||
{%- endif %}
|
||||
|
||||
{{ TypeName }}Topic() = default;
|
||||
@@ -344,9 +344,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
{% if not TypeString %}std::string_view typeString, {% endif %}ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Subscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
|
||||
::wpi::nt::Subscribe(m_handle, NT_{{ TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
|
||||
defaultValue};
|
||||
}
|
||||
{%- if TypeString %}
|
||||
@@ -369,9 +369,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Subscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, options),
|
||||
::wpi::nt::Subscribe(m_handle, NT_{{ TYPE_NAME }}, typeString, options),
|
||||
defaultValue};
|
||||
}
|
||||
{% endif %}
|
||||
@@ -394,9 +394,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish({% if not TypeString %}std::string_view typeString, {% endif %}const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish({% if not TypeString %}std::string_view typeString, {% endif %}const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Publisher{
|
||||
::wpi::nt::Publish(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options)};
|
||||
::wpi::nt::Publish(m_handle, NT_{{ TYPE_NAME }}, {{ TypeString|default('typeString') }}, options)};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,9 +419,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Publisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, properties, options)};
|
||||
::wpi::nt::PublishEx(m_handle, NT_{{ TYPE_NAME }}, typeString, properties, options)};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -449,9 +449,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry({% if not TypeString %}std::string_view typeString, {% endif %}ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Entry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_{{ cpp.TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
|
||||
::wpi::nt::GetEntry(m_handle, NT_{{ TYPE_NAME }}, {{ TypeString|default('typeString') }}, options),
|
||||
defaultValue};
|
||||
}
|
||||
{%- if TypeString %}
|
||||
@@ -478,9 +478,9 @@ class {{ TypeName }}Topic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return {{ TypeName }}Entry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_{{ cpp.TYPE_NAME }}, typeString, options),
|
||||
::wpi::nt::GetEntry(m_handle, NT_{{ TYPE_NAME }}, typeString, options),
|
||||
defaultValue};
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[
|
||||
{
|
||||
"TypeName": "Boolean",
|
||||
"TYPE_NAME": "BOOLEAN",
|
||||
"TypeString": "\"boolean\"",
|
||||
"c": {
|
||||
"ValueType": "NT_Bool",
|
||||
@@ -9,8 +10,7 @@
|
||||
"cpp": {
|
||||
"ValueType": "bool",
|
||||
"ParamType": "bool",
|
||||
"TemplateType": "bool",
|
||||
"TYPE_NAME": "BOOLEAN"
|
||||
"TemplateType": "bool"
|
||||
},
|
||||
"java": {
|
||||
"ValueType": "boolean",
|
||||
@@ -33,6 +33,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "Integer",
|
||||
"TYPE_NAME": "INTEGER",
|
||||
"TypeString": "\"int\"",
|
||||
"c": {
|
||||
"ValueType": "int64_t",
|
||||
@@ -41,8 +42,7 @@
|
||||
"cpp": {
|
||||
"ValueType": "int64_t",
|
||||
"ParamType": "int64_t",
|
||||
"TemplateType": "int64_t",
|
||||
"TYPE_NAME": "INTEGER"
|
||||
"TemplateType": "int64_t"
|
||||
},
|
||||
"java": {
|
||||
"ValueType": "long",
|
||||
@@ -65,6 +65,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "Float",
|
||||
"TYPE_NAME": "FLOAT",
|
||||
"TypeString": "\"float\"",
|
||||
"c": {
|
||||
"ValueType": "float",
|
||||
@@ -73,8 +74,7 @@
|
||||
"cpp": {
|
||||
"ValueType": "float",
|
||||
"ParamType": "float",
|
||||
"TemplateType": "float",
|
||||
"TYPE_NAME": "FLOAT"
|
||||
"TemplateType": "float"
|
||||
},
|
||||
"java": {
|
||||
"ValueType": "float",
|
||||
@@ -99,6 +99,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "Double",
|
||||
"TYPE_NAME": "DOUBLE",
|
||||
"TypeString": "\"double\"",
|
||||
"c": {
|
||||
"ValueType": "double",
|
||||
@@ -107,8 +108,7 @@
|
||||
"cpp": {
|
||||
"ValueType": "double",
|
||||
"ParamType": "double",
|
||||
"TemplateType": "double",
|
||||
"TYPE_NAME": "DOUBLE"
|
||||
"TemplateType": "double"
|
||||
},
|
||||
"java": {
|
||||
"ValueType": "double",
|
||||
@@ -131,6 +131,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "String",
|
||||
"TYPE_NAME": "STRING",
|
||||
"TypeString": "\"string\"",
|
||||
"c": {
|
||||
"ValueType": "struct WPI_String*",
|
||||
@@ -141,7 +142,6 @@
|
||||
"ValueType": "std::string",
|
||||
"ParamType": "std::string_view",
|
||||
"TemplateType": "std::string",
|
||||
"TYPE_NAME": "STRING",
|
||||
"INCLUDES": "#include <string>\n#include <string_view>\n#include <utility>",
|
||||
"SmallRetType": "std::string_view",
|
||||
"SmallElemType": "char"
|
||||
@@ -165,6 +165,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "Raw",
|
||||
"TYPE_NAME": "RAW",
|
||||
"c": {
|
||||
"ValueType": "uint8_t*",
|
||||
"ParamType": "const uint8_t*",
|
||||
@@ -175,7 +176,6 @@
|
||||
"ParamType": "std::span<const uint8_t>",
|
||||
"TemplateType": "uint8_t[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "RAW",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<uint8_t>",
|
||||
"SmallElemType": "uint8_t"
|
||||
@@ -199,6 +199,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "BooleanArray",
|
||||
"TYPE_NAME": "BOOLEAN_ARRAY",
|
||||
"TypeString": "\"boolean[]\"",
|
||||
"c": {
|
||||
"ValueType": "NT_Bool*",
|
||||
@@ -210,7 +211,6 @@
|
||||
"ParamType": "std::span<const int>",
|
||||
"TemplateType": "bool[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "BOOLEAN_ARRAY",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<int>",
|
||||
"SmallElemType": "int"
|
||||
@@ -235,6 +235,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "IntegerArray",
|
||||
"TYPE_NAME": "INTEGER_ARRAY",
|
||||
"TypeString": "\"int[]\"",
|
||||
"c": {
|
||||
"ValueType": "int64_t*",
|
||||
@@ -246,7 +247,6 @@
|
||||
"ParamType": "std::span<const int64_t>",
|
||||
"TemplateType": "int64_t[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "INTEGER_ARRAY",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<int64_t>",
|
||||
"SmallElemType": "int64_t"
|
||||
@@ -271,6 +271,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "FloatArray",
|
||||
"TYPE_NAME": "FLOAT_ARRAY",
|
||||
"TypeString": "\"float[]\"",
|
||||
"c": {
|
||||
"ValueType": "float*",
|
||||
@@ -282,7 +283,6 @@
|
||||
"ParamType": "std::span<const float>",
|
||||
"TemplateType": "float[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "FLOAT_ARRAY",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<float>",
|
||||
"SmallElemType": "float"
|
||||
@@ -307,6 +307,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "DoubleArray",
|
||||
"TYPE_NAME": "DOUBLE_ARRAY",
|
||||
"TypeString": "\"double[]\"",
|
||||
"c": {
|
||||
"ValueType": "double*",
|
||||
@@ -318,7 +319,6 @@
|
||||
"ParamType": "std::span<const double>",
|
||||
"TemplateType": "double[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "DOUBLE_ARRAY",
|
||||
"INCLUDES": "#include <utility>",
|
||||
"SmallRetType": "std::span<double>",
|
||||
"SmallElemType": "double"
|
||||
@@ -343,6 +343,7 @@
|
||||
},
|
||||
{
|
||||
"TypeName": "StringArray",
|
||||
"TYPE_NAME": "STRING_ARRAY",
|
||||
"TypeString": "\"string[]\"",
|
||||
"c": {
|
||||
"ValueType": "struct WPI_String*",
|
||||
@@ -354,7 +355,6 @@
|
||||
"ParamType": "std::span<const std::string>",
|
||||
"TemplateType": "std::string[]",
|
||||
"DefaultValueCopy": "defaultValue.begin(), defaultValue.end()",
|
||||
"TYPE_NAME": "STRING_ARRAY",
|
||||
"INCLUDES": "#include <utility>"
|
||||
},
|
||||
"java": {
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables BooleanArray topic. */
|
||||
public final class BooleanArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "boolean[]";
|
||||
public static final String TYPE_STRING = "boolean[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class BooleanArrayTopic extends Topic {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN_ARRAY.getValue(),
|
||||
"boolean[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class BooleanArrayTopic extends Topic {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class BooleanArrayTopic extends Topic {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN_ARRAY.getValue(),
|
||||
"boolean[]", options),
|
||||
new boolean[] {});
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class BooleanArrayTopic extends Topic {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN_ARRAY.getValue(),
|
||||
typeString, properties, options),
|
||||
new boolean[] {});
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class BooleanArrayTopic extends Topic {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN_ARRAY.getValue(),
|
||||
"boolean[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class BooleanArrayTopic extends Topic {
|
||||
return new BooleanArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kBooleanArray.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables Boolean topic. */
|
||||
public final class BooleanTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "boolean";
|
||||
public static final String TYPE_STRING = "boolean";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class BooleanTopic extends Topic {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN.getValue(),
|
||||
"boolean", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class BooleanTopic extends Topic {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class BooleanTopic extends Topic {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN.getValue(),
|
||||
"boolean", options),
|
||||
false);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class BooleanTopic extends Topic {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN.getValue(),
|
||||
typeString, properties, options),
|
||||
false);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class BooleanTopic extends Topic {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN.getValue(),
|
||||
"boolean", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class BooleanTopic extends Topic {
|
||||
return new BooleanEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kBoolean.getValue(),
|
||||
m_handle, NetworkTableType.BOOLEAN.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables DoubleArray topic. */
|
||||
public final class DoubleArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "double[]";
|
||||
public static final String TYPE_STRING = "double[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class DoubleArrayTopic extends Topic {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE_ARRAY.getValue(),
|
||||
"double[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class DoubleArrayTopic extends Topic {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class DoubleArrayTopic extends Topic {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE_ARRAY.getValue(),
|
||||
"double[]", options),
|
||||
new double[] {});
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class DoubleArrayTopic extends Topic {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE_ARRAY.getValue(),
|
||||
typeString, properties, options),
|
||||
new double[] {});
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class DoubleArrayTopic extends Topic {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE_ARRAY.getValue(),
|
||||
"double[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class DoubleArrayTopic extends Topic {
|
||||
return new DoubleArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kDoubleArray.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables Double topic. */
|
||||
public final class DoubleTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "double";
|
||||
public static final String TYPE_STRING = "double";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class DoubleTopic extends Topic {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE.getValue(),
|
||||
"double", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class DoubleTopic extends Topic {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class DoubleTopic extends Topic {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE.getValue(),
|
||||
"double", options),
|
||||
0);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class DoubleTopic extends Topic {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE.getValue(),
|
||||
typeString, properties, options),
|
||||
0);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class DoubleTopic extends Topic {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE.getValue(),
|
||||
"double", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class DoubleTopic extends Topic {
|
||||
return new DoubleEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kDouble.getValue(),
|
||||
m_handle, NetworkTableType.DOUBLE.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables FloatArray topic. */
|
||||
public final class FloatArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "float[]";
|
||||
public static final String TYPE_STRING = "float[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class FloatArrayTopic extends Topic {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT_ARRAY.getValue(),
|
||||
"float[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class FloatArrayTopic extends Topic {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class FloatArrayTopic extends Topic {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT_ARRAY.getValue(),
|
||||
"float[]", options),
|
||||
new float[] {});
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class FloatArrayTopic extends Topic {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT_ARRAY.getValue(),
|
||||
typeString, properties, options),
|
||||
new float[] {});
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class FloatArrayTopic extends Topic {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT_ARRAY.getValue(),
|
||||
"float[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class FloatArrayTopic extends Topic {
|
||||
return new FloatArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kFloatArray.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables Float topic. */
|
||||
public final class FloatTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "float";
|
||||
public static final String TYPE_STRING = "float";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class FloatTopic extends Topic {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT.getValue(),
|
||||
"float", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class FloatTopic extends Topic {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class FloatTopic extends Topic {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT.getValue(),
|
||||
"float", options),
|
||||
0);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class FloatTopic extends Topic {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT.getValue(),
|
||||
typeString, properties, options),
|
||||
0);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class FloatTopic extends Topic {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT.getValue(),
|
||||
"float", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class FloatTopic extends Topic {
|
||||
return new FloatEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kFloat.getValue(),
|
||||
m_handle, NetworkTableType.FLOAT.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -225,30 +225,30 @@ final class GenericEntryImpl extends EntryBase implements GenericEntry {
|
||||
long time = value.getTime();
|
||||
Object otherValue = value.getValue();
|
||||
switch (value.getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
@@ -518,30 +518,30 @@ final class GenericEntryImpl extends EntryBase implements GenericEntry {
|
||||
long time = defaultValue.getTime();
|
||||
Object otherValue = defaultValue.getValue();
|
||||
switch (defaultValue.getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setDefaultBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setDefaultInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setDefaultFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDefaultDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setDefaultString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables IntegerArray topic. */
|
||||
public final class IntegerArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "int[]";
|
||||
public static final String TYPE_STRING = "int[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class IntegerArrayTopic extends Topic {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER_ARRAY.getValue(),
|
||||
"int[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class IntegerArrayTopic extends Topic {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class IntegerArrayTopic extends Topic {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER_ARRAY.getValue(),
|
||||
"int[]", options),
|
||||
new long[] {});
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class IntegerArrayTopic extends Topic {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER_ARRAY.getValue(),
|
||||
typeString, properties, options),
|
||||
new long[] {});
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class IntegerArrayTopic extends Topic {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER_ARRAY.getValue(),
|
||||
"int[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class IntegerArrayTopic extends Topic {
|
||||
return new IntegerArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kIntegerArray.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables Integer topic. */
|
||||
public final class IntegerTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "int";
|
||||
public static final String TYPE_STRING = "int";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class IntegerTopic extends Topic {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER.getValue(),
|
||||
"int", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class IntegerTopic extends Topic {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class IntegerTopic extends Topic {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER.getValue(),
|
||||
"int", options),
|
||||
0);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class IntegerTopic extends Topic {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER.getValue(),
|
||||
typeString, properties, options),
|
||||
0);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class IntegerTopic extends Topic {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER.getValue(),
|
||||
"int", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class IntegerTopic extends Topic {
|
||||
return new IntegerEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kInteger.getValue(),
|
||||
m_handle, NetworkTableType.INTEGER.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -367,30 +367,30 @@ public final class NetworkTableEntry implements Publisher, Subscriber {
|
||||
long time = ((NetworkTableValue) defaultValue).getTime();
|
||||
Object otherValue = ((NetworkTableValue) defaultValue).getValue();
|
||||
switch (((NetworkTableValue) defaultValue).getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setDefaultBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setDefaultInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setDefaultFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDefaultDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setDefaultString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setDefaultRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setDefaultStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
@@ -648,30 +648,30 @@ public final class NetworkTableEntry implements Publisher, Subscriber {
|
||||
long time = ((NetworkTableValue) value).getTime();
|
||||
Object otherValue = ((NetworkTableValue) value).getValue();
|
||||
switch (((NetworkTableValue) value).getType()) {
|
||||
case kBoolean:
|
||||
case BOOLEAN:
|
||||
return NetworkTablesJNI.setBoolean(m_handle, time, (Boolean) otherValue);
|
||||
case kInteger:
|
||||
case INTEGER:
|
||||
return NetworkTablesJNI.setInteger(
|
||||
m_handle, time, ((Number) otherValue).longValue());
|
||||
case kFloat:
|
||||
case FLOAT:
|
||||
return NetworkTablesJNI.setFloat(
|
||||
m_handle, time, ((Number) otherValue).floatValue());
|
||||
case kDouble:
|
||||
case DOUBLE:
|
||||
return NetworkTablesJNI.setDouble(
|
||||
m_handle, time, ((Number) otherValue).doubleValue());
|
||||
case kString:
|
||||
case STRING:
|
||||
return NetworkTablesJNI.setString(m_handle, time, (String) otherValue);
|
||||
case kRaw:
|
||||
case RAW:
|
||||
return NetworkTablesJNI.setRaw(m_handle, time, (byte[]) otherValue);
|
||||
case kBooleanArray:
|
||||
case BOOLEAN_ARRAY:
|
||||
return NetworkTablesJNI.setBooleanArray(m_handle, time, (boolean[]) otherValue);
|
||||
case kIntegerArray:
|
||||
case INTEGER_ARRAY:
|
||||
return NetworkTablesJNI.setIntegerArray(m_handle, time, (long[]) otherValue);
|
||||
case kFloatArray:
|
||||
case FLOAT_ARRAY:
|
||||
return NetworkTablesJNI.setFloatArray(m_handle, time, (float[]) otherValue);
|
||||
case kDoubleArray:
|
||||
case DOUBLE_ARRAY:
|
||||
return NetworkTablesJNI.setDoubleArray(m_handle, time, (double[]) otherValue);
|
||||
case kStringArray:
|
||||
case STRING_ARRAY:
|
||||
return NetworkTablesJNI.setStringArray(m_handle, time, (String[]) otherValue);
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -47,16 +47,16 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
/** Client/server mode flag values (as returned by {@link #getNetworkMode()}). */
|
||||
public enum NetworkMode {
|
||||
/** Running in server mode. */
|
||||
kServer(0x01),
|
||||
SERVER(0x01),
|
||||
|
||||
/** Running in client mode. */
|
||||
kClient(0x04),
|
||||
CLIENT(0x04),
|
||||
|
||||
/** Currently starting up (either client or server). */
|
||||
kStarting(0x08),
|
||||
STARTING(0x08),
|
||||
|
||||
/** Running in local-only mode. */
|
||||
kLocal(0x10);
|
||||
LOCAL(0x10);
|
||||
|
||||
private final int value;
|
||||
|
||||
@@ -75,7 +75,7 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
}
|
||||
|
||||
/** The default port that network tables operates on. */
|
||||
public static final int kDefaultPort = 5810;
|
||||
public static final int DEFAULT_PORT = 5810;
|
||||
|
||||
/**
|
||||
* Construct from native handle.
|
||||
@@ -989,9 +989,9 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
*/
|
||||
public int addConnectionListener(
|
||||
boolean immediateNotify, Consumer<NetworkTableEvent> listener) {
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.kConnection);
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.CONNECTION);
|
||||
if (immediateNotify) {
|
||||
eventKinds.add(NetworkTableEvent.Kind.kImmediate);
|
||||
eventKinds.add(NetworkTableEvent.Kind.IMMEDIATE);
|
||||
}
|
||||
return m_listeners.add(m_handle, eventKinds, listener);
|
||||
}
|
||||
@@ -1007,9 +1007,9 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
*/
|
||||
public int addTimeSyncListener(
|
||||
boolean immediateNotify, Consumer<NetworkTableEvent> listener) {
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.kTimeSync);
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.TIME_SYNC);
|
||||
if (immediateNotify) {
|
||||
eventKinds.add(NetworkTableEvent.Kind.kImmediate);
|
||||
eventKinds.add(NetworkTableEvent.Kind.IMMEDIATE);
|
||||
}
|
||||
return m_listeners.add(m_handle, eventKinds, listener);
|
||||
}
|
||||
@@ -1193,7 +1193,7 @@ public final class NetworkTableInstance implements AutoCloseable {
|
||||
* @param mdnsService the mDNS service name to advertise, or empty to not advertise
|
||||
*/
|
||||
public void startServer(String persistFilename, String listenAddress, String mdnsService) {
|
||||
startServer(persistFilename, listenAddress, mdnsService, kDefaultPort);
|
||||
startServer(persistFilename, listenAddress, mdnsService, DEFAULT_PORT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value contains a value.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return m_type != NetworkTableType.kUnassigned;
|
||||
return m_type != NetworkTableType.UNASSIGNED;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of boolean type.
|
||||
*/
|
||||
public boolean isBoolean() {
|
||||
return m_type == NetworkTableType.kBoolean;
|
||||
return m_type == NetworkTableType.BOOLEAN;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +94,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of long type.
|
||||
*/
|
||||
public boolean isInteger() {
|
||||
return m_type == NetworkTableType.kInteger;
|
||||
return m_type == NetworkTableType.INTEGER;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of float type.
|
||||
*/
|
||||
public boolean isFloat() {
|
||||
return m_type == NetworkTableType.kFloat;
|
||||
return m_type == NetworkTableType.FLOAT;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of double type.
|
||||
*/
|
||||
public boolean isDouble() {
|
||||
return m_type == NetworkTableType.kDouble;
|
||||
return m_type == NetworkTableType.DOUBLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of String type.
|
||||
*/
|
||||
public boolean isString() {
|
||||
return m_type == NetworkTableType.kString;
|
||||
return m_type == NetworkTableType.STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +130,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of byte[] type.
|
||||
*/
|
||||
public boolean isRaw() {
|
||||
return m_type == NetworkTableType.kRaw;
|
||||
return m_type == NetworkTableType.RAW;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +139,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of boolean[] type.
|
||||
*/
|
||||
public boolean isBooleanArray() {
|
||||
return m_type == NetworkTableType.kBooleanArray;
|
||||
return m_type == NetworkTableType.BOOLEAN_ARRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,7 +148,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of long[] type.
|
||||
*/
|
||||
public boolean isIntegerArray() {
|
||||
return m_type == NetworkTableType.kIntegerArray;
|
||||
return m_type == NetworkTableType.INTEGER_ARRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of float[] type.
|
||||
*/
|
||||
public boolean isFloatArray() {
|
||||
return m_type == NetworkTableType.kFloatArray;
|
||||
return m_type == NetworkTableType.FLOAT_ARRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +166,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of double[] type.
|
||||
*/
|
||||
public boolean isDoubleArray() {
|
||||
return m_type == NetworkTableType.kDoubleArray;
|
||||
return m_type == NetworkTableType.DOUBLE_ARRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,7 +175,7 @@ public final class NetworkTableValue {
|
||||
* @return True if the entry value is of String[] type.
|
||||
*/
|
||||
public boolean isStringArray() {
|
||||
return m_type == NetworkTableType.kStringArray;
|
||||
return m_type == NetworkTableType.STRING_ARRAY;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -189,7 +189,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of boolean type.
|
||||
*/
|
||||
public boolean getBoolean() {
|
||||
if (m_type != NetworkTableType.kBoolean) {
|
||||
if (m_type != NetworkTableType.BOOLEAN) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to boolean");
|
||||
}
|
||||
return (Boolean) m_value;
|
||||
@@ -202,7 +202,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of long type.
|
||||
*/
|
||||
public long getInteger() {
|
||||
if (m_type != NetworkTableType.kInteger) {
|
||||
if (m_type != NetworkTableType.INTEGER) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to long");
|
||||
}
|
||||
return ((Number) m_value).longValue();
|
||||
@@ -215,7 +215,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of float type.
|
||||
*/
|
||||
public float getFloat() {
|
||||
if (m_type != NetworkTableType.kFloat) {
|
||||
if (m_type != NetworkTableType.FLOAT) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to float");
|
||||
}
|
||||
return ((Number) m_value).floatValue();
|
||||
@@ -228,7 +228,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of double type.
|
||||
*/
|
||||
public double getDouble() {
|
||||
if (m_type != NetworkTableType.kDouble) {
|
||||
if (m_type != NetworkTableType.DOUBLE) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to double");
|
||||
}
|
||||
return ((Number) m_value).doubleValue();
|
||||
@@ -241,7 +241,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of String type.
|
||||
*/
|
||||
public String getString() {
|
||||
if (m_type != NetworkTableType.kString) {
|
||||
if (m_type != NetworkTableType.STRING) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to String");
|
||||
}
|
||||
return (String) m_value;
|
||||
@@ -254,7 +254,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of byte[] type.
|
||||
*/
|
||||
public byte[] getRaw() {
|
||||
if (m_type != NetworkTableType.kRaw) {
|
||||
if (m_type != NetworkTableType.RAW) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to byte[]");
|
||||
}
|
||||
return (byte[]) m_value;
|
||||
@@ -267,7 +267,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of boolean[] type.
|
||||
*/
|
||||
public boolean[] getBooleanArray() {
|
||||
if (m_type != NetworkTableType.kBooleanArray) {
|
||||
if (m_type != NetworkTableType.BOOLEAN_ARRAY) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to boolean[]");
|
||||
}
|
||||
return (boolean[]) m_value;
|
||||
@@ -280,7 +280,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of long[] type.
|
||||
*/
|
||||
public long[] getIntegerArray() {
|
||||
if (m_type != NetworkTableType.kIntegerArray) {
|
||||
if (m_type != NetworkTableType.INTEGER_ARRAY) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to long[]");
|
||||
}
|
||||
return (long[]) m_value;
|
||||
@@ -293,7 +293,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of float[] type.
|
||||
*/
|
||||
public float[] getFloatArray() {
|
||||
if (m_type != NetworkTableType.kFloatArray) {
|
||||
if (m_type != NetworkTableType.FLOAT_ARRAY) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to float[]");
|
||||
}
|
||||
return (float[]) m_value;
|
||||
@@ -306,7 +306,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of double[] type.
|
||||
*/
|
||||
public double[] getDoubleArray() {
|
||||
if (m_type != NetworkTableType.kDoubleArray) {
|
||||
if (m_type != NetworkTableType.DOUBLE_ARRAY) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to double[]");
|
||||
}
|
||||
return (double[]) m_value;
|
||||
@@ -319,7 +319,7 @@ public final class NetworkTableValue {
|
||||
* @throws ClassCastException if the entry value is not of String[] type.
|
||||
*/
|
||||
public String[] getStringArray() {
|
||||
if (m_type != NetworkTableType.kStringArray) {
|
||||
if (m_type != NetworkTableType.STRING_ARRAY) {
|
||||
throw new ClassCastException("cannot convert " + m_type + " to String[]");
|
||||
}
|
||||
return (String[]) m_value;
|
||||
@@ -336,7 +336,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBoolean(boolean value) {
|
||||
return new NetworkTableValue(NetworkTableType.kBoolean, Boolean.valueOf(value));
|
||||
return new NetworkTableValue(NetworkTableType.BOOLEAN, Boolean.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -347,7 +347,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBoolean(boolean value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kBoolean, Boolean.valueOf(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.BOOLEAN, Boolean.valueOf(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,7 +357,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeInteger(long value) {
|
||||
return new NetworkTableValue(NetworkTableType.kInteger, Long.valueOf(value));
|
||||
return new NetworkTableValue(NetworkTableType.INTEGER, Long.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -368,7 +368,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeInteger(long value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kInteger, Long.valueOf(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.INTEGER, Long.valueOf(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,7 +378,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloat(float value) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloat, Float.valueOf(value));
|
||||
return new NetworkTableValue(NetworkTableType.FLOAT, Float.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -389,7 +389,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloat(float value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloat, Float.valueOf(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.FLOAT, Float.valueOf(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -399,7 +399,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDouble(double value) {
|
||||
return new NetworkTableValue(NetworkTableType.kDouble, Double.valueOf(value));
|
||||
return new NetworkTableValue(NetworkTableType.DOUBLE, Double.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -410,7 +410,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDouble(double value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kDouble, Double.valueOf(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.DOUBLE, Double.valueOf(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -420,7 +420,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeString(String value) {
|
||||
return new NetworkTableValue(NetworkTableType.kString, (value));
|
||||
return new NetworkTableValue(NetworkTableType.STRING, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,7 +431,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeString(String value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kString, (value), time);
|
||||
return new NetworkTableValue(NetworkTableType.STRING, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -441,7 +441,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeRaw(byte[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kRaw, (value));
|
||||
return new NetworkTableValue(NetworkTableType.RAW, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -452,7 +452,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeRaw(byte[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kRaw, (value), time);
|
||||
return new NetworkTableValue(NetworkTableType.RAW, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,7 +462,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBooleanArray(boolean[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kBooleanArray, (value));
|
||||
return new NetworkTableValue(NetworkTableType.BOOLEAN_ARRAY, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -473,7 +473,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBooleanArray(boolean[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kBooleanArray, (value), time);
|
||||
return new NetworkTableValue(NetworkTableType.BOOLEAN_ARRAY, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -483,7 +483,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBooleanArray(Boolean[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kBooleanArray, toNativeBooleanArray(value));
|
||||
return new NetworkTableValue(NetworkTableType.BOOLEAN_ARRAY, toNativeBooleanArray(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -494,7 +494,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeBooleanArray(Boolean[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kBooleanArray, toNativeBooleanArray(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.BOOLEAN_ARRAY, toNativeBooleanArray(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -504,7 +504,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeIntegerArray(long[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kIntegerArray, (value));
|
||||
return new NetworkTableValue(NetworkTableType.INTEGER_ARRAY, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,7 +515,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeIntegerArray(long[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kIntegerArray, (value), time);
|
||||
return new NetworkTableValue(NetworkTableType.INTEGER_ARRAY, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -525,7 +525,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeIntegerArray(Long[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kIntegerArray, toNativeIntegerArray(value));
|
||||
return new NetworkTableValue(NetworkTableType.INTEGER_ARRAY, toNativeIntegerArray(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -536,7 +536,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeIntegerArray(Long[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kIntegerArray, toNativeIntegerArray(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.INTEGER_ARRAY, toNativeIntegerArray(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -546,7 +546,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloatArray(float[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloatArray, (value));
|
||||
return new NetworkTableValue(NetworkTableType.FLOAT_ARRAY, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -557,7 +557,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloatArray(float[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloatArray, (value), time);
|
||||
return new NetworkTableValue(NetworkTableType.FLOAT_ARRAY, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -567,7 +567,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloatArray(Float[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloatArray, toNativeFloatArray(value));
|
||||
return new NetworkTableValue(NetworkTableType.FLOAT_ARRAY, toNativeFloatArray(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -578,7 +578,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeFloatArray(Float[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kFloatArray, toNativeFloatArray(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.FLOAT_ARRAY, toNativeFloatArray(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -588,7 +588,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDoubleArray(double[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kDoubleArray, (value));
|
||||
return new NetworkTableValue(NetworkTableType.DOUBLE_ARRAY, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -599,7 +599,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDoubleArray(double[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kDoubleArray, (value), time);
|
||||
return new NetworkTableValue(NetworkTableType.DOUBLE_ARRAY, (value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -609,7 +609,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDoubleArray(Double[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kDoubleArray, toNativeDoubleArray(value));
|
||||
return new NetworkTableValue(NetworkTableType.DOUBLE_ARRAY, toNativeDoubleArray(value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -620,7 +620,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeDoubleArray(Double[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kDoubleArray, toNativeDoubleArray(value), time);
|
||||
return new NetworkTableValue(NetworkTableType.DOUBLE_ARRAY, toNativeDoubleArray(value), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -630,7 +630,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeStringArray(String[] value) {
|
||||
return new NetworkTableValue(NetworkTableType.kStringArray, (value));
|
||||
return new NetworkTableValue(NetworkTableType.STRING_ARRAY, (value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -641,7 +641,7 @@ public final class NetworkTableValue {
|
||||
* @return The entry value
|
||||
*/
|
||||
public static NetworkTableValue makeStringArray(String[] value, long time) {
|
||||
return new NetworkTableValue(NetworkTableType.kStringArray, (value), time);
|
||||
return new NetworkTableValue(NetworkTableType.STRING_ARRAY, (value), time);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class RawTopic extends Topic {
|
||||
return new RawEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kRaw.getValue(),
|
||||
m_handle, NetworkTableType.RAW.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public final class RawTopic extends Topic {
|
||||
return new RawEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kRaw.getValue(),
|
||||
m_handle, NetworkTableType.RAW.getValue(),
|
||||
typeString, options),
|
||||
new byte[] {});
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public final class RawTopic extends Topic {
|
||||
return new RawEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kRaw.getValue(),
|
||||
m_handle, NetworkTableType.RAW.getValue(),
|
||||
typeString, properties, options),
|
||||
new byte[] {});
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public final class RawTopic extends Topic {
|
||||
return new RawEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kRaw.getValue(),
|
||||
m_handle, NetworkTableType.RAW.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables StringArray topic. */
|
||||
public final class StringArrayTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "string[]";
|
||||
public static final String TYPE_STRING = "string[]";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class StringArrayTopic extends Topic {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
m_handle, NetworkTableType.STRING_ARRAY.getValue(),
|
||||
"string[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class StringArrayTopic extends Topic {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
m_handle, NetworkTableType.STRING_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class StringArrayTopic extends Topic {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
m_handle, NetworkTableType.STRING_ARRAY.getValue(),
|
||||
"string[]", options),
|
||||
new String[] {});
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class StringArrayTopic extends Topic {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
m_handle, NetworkTableType.STRING_ARRAY.getValue(),
|
||||
typeString, properties, options),
|
||||
new String[] {});
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class StringArrayTopic extends Topic {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
m_handle, NetworkTableType.STRING_ARRAY.getValue(),
|
||||
"string[]", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class StringArrayTopic extends Topic {
|
||||
return new StringArrayEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kStringArray.getValue(),
|
||||
m_handle, NetworkTableType.STRING_ARRAY.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.wpilib.networktables;
|
||||
/** NetworkTables String topic. */
|
||||
public final class StringTopic extends Topic {
|
||||
/** The default type string for this topic type. */
|
||||
public static final String kTypeString = "string";
|
||||
public static final String TYPE_STRING = "string";
|
||||
|
||||
/**
|
||||
* Construct from a generic topic.
|
||||
@@ -51,7 +51,7 @@ public final class StringTopic extends Topic {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
m_handle, NetworkTableType.STRING.getValue(),
|
||||
"string", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class StringTopic extends Topic {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
m_handle, NetworkTableType.STRING.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public final class StringTopic extends Topic {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
m_handle, NetworkTableType.STRING.getValue(),
|
||||
"string", options),
|
||||
"");
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public final class StringTopic extends Topic {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
m_handle, NetworkTableType.STRING.getValue(),
|
||||
typeString, properties, options),
|
||||
"");
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public final class StringTopic extends Topic {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
m_handle, NetworkTableType.STRING.getValue(),
|
||||
"string", options),
|
||||
defaultValue);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public final class StringTopic extends Topic {
|
||||
return new StringEntryImpl(
|
||||
this,
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kString.getValue(),
|
||||
m_handle, NetworkTableType.STRING.getValue(),
|
||||
typeString, options),
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ class BooleanArrayTopic final : public Topic {
|
||||
using ParamType = std::span<const int>;
|
||||
using TimestampedValueType = TimestampedBooleanArray;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "boolean[]";
|
||||
static constexpr std::string_view TYPE_STRING = "boolean[]";
|
||||
|
||||
BooleanArrayTopic() = default;
|
||||
|
||||
@@ -339,7 +339,7 @@ class BooleanArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_BOOLEAN_ARRAY, "boolean[]", options),
|
||||
defaultValue};
|
||||
@@ -363,7 +363,7 @@ class BooleanArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_BOOLEAN_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
@@ -385,7 +385,7 @@ class BooleanArrayTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanArrayPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_BOOLEAN_ARRAY, "boolean[]", options)};
|
||||
}
|
||||
@@ -410,7 +410,7 @@ class BooleanArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanArrayPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_BOOLEAN_ARRAY, typeString, properties, options)};
|
||||
}
|
||||
@@ -437,7 +437,7 @@ class BooleanArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_BOOLEAN_ARRAY, "boolean[]", options),
|
||||
defaultValue};
|
||||
@@ -465,7 +465,7 @@ class BooleanArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_BOOLEAN_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -241,7 +241,7 @@ class BooleanTopic final : public Topic {
|
||||
using ParamType = bool;
|
||||
using TimestampedValueType = TimestampedBoolean;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "boolean";
|
||||
static constexpr std::string_view TYPE_STRING = "boolean";
|
||||
|
||||
BooleanTopic() = default;
|
||||
|
||||
@@ -278,7 +278,7 @@ class BooleanTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_BOOLEAN, "boolean", options),
|
||||
defaultValue};
|
||||
@@ -302,7 +302,7 @@ class BooleanTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_BOOLEAN, typeString, options),
|
||||
defaultValue};
|
||||
@@ -324,7 +324,7 @@ class BooleanTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_BOOLEAN, "boolean", options)};
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class BooleanTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_BOOLEAN, typeString, properties, options)};
|
||||
}
|
||||
@@ -376,7 +376,7 @@ class BooleanTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_BOOLEAN, "boolean", options),
|
||||
defaultValue};
|
||||
@@ -404,7 +404,7 @@ class BooleanTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return BooleanEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_BOOLEAN, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -302,7 +302,7 @@ class DoubleArrayTopic final : public Topic {
|
||||
using ParamType = std::span<const double>;
|
||||
using TimestampedValueType = TimestampedDoubleArray;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "double[]";
|
||||
static constexpr std::string_view TYPE_STRING = "double[]";
|
||||
|
||||
DoubleArrayTopic() = default;
|
||||
|
||||
@@ -339,7 +339,7 @@ class DoubleArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_DOUBLE_ARRAY, "double[]", options),
|
||||
defaultValue};
|
||||
@@ -363,7 +363,7 @@ class DoubleArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_DOUBLE_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
@@ -385,7 +385,7 @@ class DoubleArrayTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleArrayPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_DOUBLE_ARRAY, "double[]", options)};
|
||||
}
|
||||
@@ -410,7 +410,7 @@ class DoubleArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleArrayPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_DOUBLE_ARRAY, typeString, properties, options)};
|
||||
}
|
||||
@@ -437,7 +437,7 @@ class DoubleArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_DOUBLE_ARRAY, "double[]", options),
|
||||
defaultValue};
|
||||
@@ -465,7 +465,7 @@ class DoubleArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_DOUBLE_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -241,7 +241,7 @@ class DoubleTopic final : public Topic {
|
||||
using ParamType = double;
|
||||
using TimestampedValueType = TimestampedDouble;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "double";
|
||||
static constexpr std::string_view TYPE_STRING = "double";
|
||||
|
||||
DoubleTopic() = default;
|
||||
|
||||
@@ -278,7 +278,7 @@ class DoubleTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_DOUBLE, "double", options),
|
||||
defaultValue};
|
||||
@@ -302,7 +302,7 @@ class DoubleTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_DOUBLE, typeString, options),
|
||||
defaultValue};
|
||||
@@ -324,7 +324,7 @@ class DoubleTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoublePublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_DOUBLE, "double", options)};
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class DoubleTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoublePublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_DOUBLE, typeString, properties, options)};
|
||||
}
|
||||
@@ -376,7 +376,7 @@ class DoubleTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_DOUBLE, "double", options),
|
||||
defaultValue};
|
||||
@@ -404,7 +404,7 @@ class DoubleTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return DoubleEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_DOUBLE, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -302,7 +302,7 @@ class FloatArrayTopic final : public Topic {
|
||||
using ParamType = std::span<const float>;
|
||||
using TimestampedValueType = TimestampedFloatArray;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "float[]";
|
||||
static constexpr std::string_view TYPE_STRING = "float[]";
|
||||
|
||||
FloatArrayTopic() = default;
|
||||
|
||||
@@ -339,7 +339,7 @@ class FloatArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_FLOAT_ARRAY, "float[]", options),
|
||||
defaultValue};
|
||||
@@ -363,7 +363,7 @@ class FloatArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_FLOAT_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
@@ -385,7 +385,7 @@ class FloatArrayTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatArrayPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_FLOAT_ARRAY, "float[]", options)};
|
||||
}
|
||||
@@ -410,7 +410,7 @@ class FloatArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatArrayPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_FLOAT_ARRAY, typeString, properties, options)};
|
||||
}
|
||||
@@ -437,7 +437,7 @@ class FloatArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_FLOAT_ARRAY, "float[]", options),
|
||||
defaultValue};
|
||||
@@ -465,7 +465,7 @@ class FloatArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_FLOAT_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -241,7 +241,7 @@ class FloatTopic final : public Topic {
|
||||
using ParamType = float;
|
||||
using TimestampedValueType = TimestampedFloat;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "float";
|
||||
static constexpr std::string_view TYPE_STRING = "float";
|
||||
|
||||
FloatTopic() = default;
|
||||
|
||||
@@ -278,7 +278,7 @@ class FloatTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_FLOAT, "float", options),
|
||||
defaultValue};
|
||||
@@ -302,7 +302,7 @@ class FloatTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_FLOAT, typeString, options),
|
||||
defaultValue};
|
||||
@@ -324,7 +324,7 @@ class FloatTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_FLOAT, "float", options)};
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class FloatTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_FLOAT, typeString, properties, options)};
|
||||
}
|
||||
@@ -376,7 +376,7 @@ class FloatTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_FLOAT, "float", options),
|
||||
defaultValue};
|
||||
@@ -404,7 +404,7 @@ class FloatTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return FloatEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_FLOAT, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -302,7 +302,7 @@ class IntegerArrayTopic final : public Topic {
|
||||
using ParamType = std::span<const int64_t>;
|
||||
using TimestampedValueType = TimestampedIntegerArray;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "int[]";
|
||||
static constexpr std::string_view TYPE_STRING = "int[]";
|
||||
|
||||
IntegerArrayTopic() = default;
|
||||
|
||||
@@ -339,7 +339,7 @@ class IntegerArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_INTEGER_ARRAY, "int[]", options),
|
||||
defaultValue};
|
||||
@@ -363,7 +363,7 @@ class IntegerArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_INTEGER_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
@@ -385,7 +385,7 @@ class IntegerArrayTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerArrayPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_INTEGER_ARRAY, "int[]", options)};
|
||||
}
|
||||
@@ -410,7 +410,7 @@ class IntegerArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerArrayPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_INTEGER_ARRAY, typeString, properties, options)};
|
||||
}
|
||||
@@ -437,7 +437,7 @@ class IntegerArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_INTEGER_ARRAY, "int[]", options),
|
||||
defaultValue};
|
||||
@@ -465,7 +465,7 @@ class IntegerArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_INTEGER_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -241,7 +241,7 @@ class IntegerTopic final : public Topic {
|
||||
using ParamType = int64_t;
|
||||
using TimestampedValueType = TimestampedInteger;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "int";
|
||||
static constexpr std::string_view TYPE_STRING = "int";
|
||||
|
||||
IntegerTopic() = default;
|
||||
|
||||
@@ -278,7 +278,7 @@ class IntegerTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_INTEGER, "int", options),
|
||||
defaultValue};
|
||||
@@ -302,7 +302,7 @@ class IntegerTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_INTEGER, typeString, options),
|
||||
defaultValue};
|
||||
@@ -324,7 +324,7 @@ class IntegerTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_INTEGER, "int", options)};
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class IntegerTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_INTEGER, typeString, properties, options)};
|
||||
}
|
||||
@@ -376,7 +376,7 @@ class IntegerTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_INTEGER, "int", options),
|
||||
defaultValue};
|
||||
@@ -404,7 +404,7 @@ class IntegerTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return IntegerEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_INTEGER, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -339,7 +339,7 @@ class RawTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return RawSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_RAW, typeString, options),
|
||||
defaultValue};
|
||||
@@ -362,7 +362,7 @@ class RawTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(std::string_view typeString, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(std::string_view typeString, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return RawPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_RAW, typeString, options)};
|
||||
}
|
||||
@@ -387,7 +387,7 @@ class RawTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return RawPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_RAW, typeString, properties, options)};
|
||||
}
|
||||
@@ -416,7 +416,7 @@ class RawTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return RawEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_RAW, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -241,7 +241,7 @@ class StringArrayTopic final : public Topic {
|
||||
using ParamType = std::span<const std::string>;
|
||||
using TimestampedValueType = TimestampedStringArray;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "string[]";
|
||||
static constexpr std::string_view TYPE_STRING = "string[]";
|
||||
|
||||
StringArrayTopic() = default;
|
||||
|
||||
@@ -278,7 +278,7 @@ class StringArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_STRING_ARRAY, "string[]", options),
|
||||
defaultValue};
|
||||
@@ -302,7 +302,7 @@ class StringArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringArraySubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_STRING_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
@@ -324,7 +324,7 @@ class StringArrayTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringArrayPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_STRING_ARRAY, "string[]", options)};
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class StringArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringArrayPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_STRING_ARRAY, typeString, properties, options)};
|
||||
}
|
||||
@@ -376,7 +376,7 @@ class StringArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_STRING_ARRAY, "string[]", options),
|
||||
defaultValue};
|
||||
@@ -404,7 +404,7 @@ class StringArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringArrayEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_STRING_ARRAY, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -304,7 +304,7 @@ class StringTopic final : public Topic {
|
||||
using ParamType = std::string_view;
|
||||
using TimestampedValueType = TimestampedString;
|
||||
/** The default type string for this topic type. */
|
||||
static constexpr std::string_view kTypeString = "string";
|
||||
static constexpr std::string_view TYPE_STRING = "string";
|
||||
|
||||
StringTopic() = default;
|
||||
|
||||
@@ -341,7 +341,7 @@ class StringTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_STRING, "string", options),
|
||||
defaultValue};
|
||||
@@ -365,7 +365,7 @@ class StringTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringSubscriber{
|
||||
::wpi::nt::Subscribe(m_handle, NT_STRING, typeString, options),
|
||||
defaultValue};
|
||||
@@ -387,7 +387,7 @@ class StringTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringPublisher{
|
||||
::wpi::nt::Publish(m_handle, NT_STRING, "string", options)};
|
||||
}
|
||||
@@ -412,7 +412,7 @@ class StringTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(std::string_view typeString,
|
||||
const wpi::util::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const wpi::util::json& properties, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringPublisher{
|
||||
::wpi::nt::PublishEx(m_handle, NT_STRING, typeString, properties, options)};
|
||||
}
|
||||
@@ -439,7 +439,7 @@ class StringTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_STRING, "string", options),
|
||||
defaultValue};
|
||||
@@ -467,7 +467,7 @@ class StringTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return StringEntry{
|
||||
::wpi::nt::GetEntry(m_handle, NT_STRING, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -8,31 +8,31 @@ package org.wpilib.networktables;
|
||||
@SuppressWarnings("MemberName")
|
||||
public final class LogMessage {
|
||||
/** Critical logging level. */
|
||||
public static final int kCritical = 50;
|
||||
public static final int CRITICAL = 50;
|
||||
|
||||
/** Error logging level. */
|
||||
public static final int kError = 40;
|
||||
public static final int ERR = 40;
|
||||
|
||||
/** Warning log level. */
|
||||
public static final int kWarning = 30;
|
||||
public static final int WARNING = 30;
|
||||
|
||||
/** Info log level. */
|
||||
public static final int kInfo = 20;
|
||||
public static final int INFO = 20;
|
||||
|
||||
/** Debug log level. */
|
||||
public static final int kDebug = 10;
|
||||
public static final int DEBUG = 10;
|
||||
|
||||
/** Debug log level 1. */
|
||||
public static final int kDebug1 = 9;
|
||||
public static final int DEBUG_1 = 9;
|
||||
|
||||
/** Debug log level 2. */
|
||||
public static final int kDebug2 = 8;
|
||||
public static final int DEBUG_2 = 8;
|
||||
|
||||
/** Debug log level 3. */
|
||||
public static final int kDebug3 = 7;
|
||||
public static final int DEBUG_3 = 7;
|
||||
|
||||
/** Debug log level 4. */
|
||||
public static final int kDebug4 = 6;
|
||||
public static final int DEBUG_4 = 6;
|
||||
|
||||
/** Log level of the message. */
|
||||
public final int level;
|
||||
|
||||
@@ -572,7 +572,7 @@ public final class NetworkTable {
|
||||
|
||||
return m_inst.addListener(
|
||||
new String[] {m_pathWithSep},
|
||||
EnumSet.of(NetworkTableEvent.Kind.kPublish, NetworkTableEvent.Kind.kImmediate),
|
||||
EnumSet.of(NetworkTableEvent.Kind.PUBLISH, NetworkTableEvent.Kind.IMMEDIATE),
|
||||
new Consumer<>() {
|
||||
final Set<String> m_notifiedTables = new HashSet<>();
|
||||
|
||||
|
||||
@@ -18,43 +18,43 @@ public final class NetworkTableEvent {
|
||||
* Initial listener addition. Set this to receive immediate notification of matches to other
|
||||
* criteria.
|
||||
*/
|
||||
kImmediate(0x0001),
|
||||
IMMEDIATE(0x0001),
|
||||
|
||||
/** Client connected (on server, any client connected). */
|
||||
kConnected(0x0002),
|
||||
CONNECTED(0x0002),
|
||||
|
||||
/** Client disconnected (on server, any client disconnected). */
|
||||
kDisconnected(0x0004),
|
||||
DISCONNECTED(0x0004),
|
||||
|
||||
/** Any connection event (connect or disconnect). */
|
||||
kConnection(0x0004 | 0x0002),
|
||||
CONNECTION(0x0004 | 0x0002),
|
||||
|
||||
/** New topic published. */
|
||||
kPublish(0x0008),
|
||||
PUBLISH(0x0008),
|
||||
|
||||
/** Topic unpublished. */
|
||||
kUnpublish(0x0010),
|
||||
UNPUBLISH(0x0010),
|
||||
|
||||
/** Topic properties changed. */
|
||||
kProperties(0x0020),
|
||||
PROPERTIES(0x0020),
|
||||
|
||||
/** Any topic event (publish, unpublish, or properties changed). */
|
||||
kTopic(0x0020 | 0x0010 | 0x0008),
|
||||
TOPIC(0x0020 | 0x0010 | 0x0008),
|
||||
|
||||
/** Topic value updated (via network). */
|
||||
kValueRemote(0x0040),
|
||||
VALUE_REMOTE(0x0040),
|
||||
|
||||
/** Topic value updated (local). */
|
||||
kValueLocal(0x0080),
|
||||
VALUE_LOCAL(0x0080),
|
||||
|
||||
/** Topic value updated (network or local). */
|
||||
kValueAll(0x0080 | 0x0040),
|
||||
VALUE_ALL(0x0080 | 0x0040),
|
||||
|
||||
/** Log message. */
|
||||
kLogMessage(0x0100),
|
||||
LOG_MESSAGE(0x0100),
|
||||
|
||||
/** Time synchronized with server. */
|
||||
kTimeSync(0x0200);
|
||||
TIME_SYNC(0x0200);
|
||||
|
||||
private final int value;
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ public final class NetworkTableListenerPoller implements AutoCloseable {
|
||||
* @return Listener handle
|
||||
*/
|
||||
public int addConnectionListener(boolean immediateNotify) {
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.kConnection);
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.CONNECTION);
|
||||
if (immediateNotify) {
|
||||
eventKinds.add(NetworkTableEvent.Kind.kImmediate);
|
||||
eventKinds.add(NetworkTableEvent.Kind.IMMEDIATE);
|
||||
}
|
||||
return NetworkTablesJNI.addListener(m_handle, m_inst.getHandle(), eventKinds);
|
||||
}
|
||||
@@ -103,9 +103,9 @@ public final class NetworkTableListenerPoller implements AutoCloseable {
|
||||
* @return Listener handle
|
||||
*/
|
||||
public int addTimeSyncListener(boolean immediateNotify) {
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.kTimeSync);
|
||||
EnumSet<NetworkTableEvent.Kind> eventKinds = EnumSet.of(NetworkTableEvent.Kind.TIME_SYNC);
|
||||
if (immediateNotify) {
|
||||
eventKinds.add(NetworkTableEvent.Kind.kImmediate);
|
||||
eventKinds.add(NetworkTableEvent.Kind.IMMEDIATE);
|
||||
}
|
||||
return NetworkTablesJNI.addListener(m_handle, m_inst.getHandle(), eventKinds);
|
||||
}
|
||||
|
||||
@@ -7,29 +7,29 @@ package org.wpilib.networktables;
|
||||
/** Network table data types. */
|
||||
public enum NetworkTableType {
|
||||
/** Unassigned data type. */
|
||||
kUnassigned(0, ""),
|
||||
UNASSIGNED(0, ""),
|
||||
/** Boolean data type. */
|
||||
kBoolean(0x01, "boolean"),
|
||||
BOOLEAN(0x01, "boolean"),
|
||||
/** Double precision floating-point data type. */
|
||||
kDouble(0x02, "double"),
|
||||
DOUBLE(0x02, "double"),
|
||||
/** String data type. */
|
||||
kString(0x04, "string"),
|
||||
STRING(0x04, "string"),
|
||||
/** Raw data type. */
|
||||
kRaw(0x08, "raw"),
|
||||
RAW(0x08, "raw"),
|
||||
/** Boolean array data type. */
|
||||
kBooleanArray(0x10, "boolean[]"),
|
||||
BOOLEAN_ARRAY(0x10, "boolean[]"),
|
||||
/** Double precision floating-point array data type. */
|
||||
kDoubleArray(0x20, "double[]"),
|
||||
DOUBLE_ARRAY(0x20, "double[]"),
|
||||
/** String array data type. */
|
||||
kStringArray(0x40, "string[]"),
|
||||
STRING_ARRAY(0x40, "string[]"),
|
||||
/** Integer data type. */
|
||||
kInteger(0x100, "int"),
|
||||
INTEGER(0x100, "int"),
|
||||
/** Single precision floating-point data type. */
|
||||
kFloat(0x200, "float"),
|
||||
FLOAT(0x200, "float"),
|
||||
/** Integer array data type. */
|
||||
kIntegerArray(0x400, "int[]"),
|
||||
INTEGER_ARRAY(0x400, "int[]"),
|
||||
/** Single precision floating-point array data type. */
|
||||
kFloatArray(0x800, "float[]");
|
||||
FLOAT_ARRAY(0x800, "float[]");
|
||||
|
||||
private final int m_value;
|
||||
private final String m_valueStr;
|
||||
@@ -65,18 +65,18 @@ public enum NetworkTableType {
|
||||
*/
|
||||
public static NetworkTableType getFromInt(int value) {
|
||||
return switch (value) {
|
||||
case 0x01 -> kBoolean;
|
||||
case 0x02 -> kDouble;
|
||||
case 0x04 -> kString;
|
||||
case 0x08 -> kRaw;
|
||||
case 0x10 -> kBooleanArray;
|
||||
case 0x20 -> kDoubleArray;
|
||||
case 0x40 -> kStringArray;
|
||||
case 0x100 -> kInteger;
|
||||
case 0x200 -> kFloat;
|
||||
case 0x400 -> kIntegerArray;
|
||||
case 0x800 -> kFloatArray;
|
||||
default -> kUnassigned;
|
||||
case 0x01 -> BOOLEAN;
|
||||
case 0x02 -> DOUBLE;
|
||||
case 0x04 -> STRING;
|
||||
case 0x08 -> RAW;
|
||||
case 0x10 -> BOOLEAN_ARRAY;
|
||||
case 0x20 -> DOUBLE_ARRAY;
|
||||
case 0x40 -> STRING_ARRAY;
|
||||
case 0x100 -> INTEGER;
|
||||
case 0x200 -> FLOAT;
|
||||
case 0x400 -> INTEGER_ARRAY;
|
||||
case 0x800 -> FLOAT_ARRAY;
|
||||
default -> UNASSIGNED;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -88,18 +88,18 @@ public enum NetworkTableType {
|
||||
*/
|
||||
public static NetworkTableType getFromString(String typeString) {
|
||||
return switch (typeString) {
|
||||
case "boolean" -> kBoolean;
|
||||
case "double" -> kDouble;
|
||||
case "float" -> kFloat;
|
||||
case "int" -> kInteger;
|
||||
case "string", "json" -> kString;
|
||||
case "boolean[]" -> kBooleanArray;
|
||||
case "double[]" -> kDoubleArray;
|
||||
case "float[]" -> kFloatArray;
|
||||
case "int[]" -> kIntegerArray;
|
||||
case "string[]" -> kStringArray;
|
||||
case "" -> kUnassigned;
|
||||
default -> kRaw;
|
||||
case "boolean" -> BOOLEAN;
|
||||
case "double" -> DOUBLE;
|
||||
case "float" -> FLOAT;
|
||||
case "int" -> INTEGER;
|
||||
case "string", "json" -> STRING;
|
||||
case "boolean[]" -> BOOLEAN_ARRAY;
|
||||
case "double[]" -> DOUBLE_ARRAY;
|
||||
case "float[]" -> FLOAT_ARRAY;
|
||||
case "int[]" -> INTEGER_ARRAY;
|
||||
case "string[]" -> STRING_ARRAY;
|
||||
case "" -> UNASSIGNED;
|
||||
default -> RAW;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class ProtobufTopic<T> extends Topic {
|
||||
this,
|
||||
ProtobufBuffer.create(m_proto),
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_proto.getTypeString(), options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_proto.getTypeString(), options),
|
||||
defaultValue,
|
||||
false);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public final class ProtobufTopic<T> extends Topic {
|
||||
this,
|
||||
ProtobufBuffer.create(m_proto),
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_proto.getTypeString(), options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_proto.getTypeString(), options),
|
||||
null,
|
||||
true);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public final class ProtobufTopic<T> extends Topic {
|
||||
ProtobufBuffer.create(m_proto),
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle,
|
||||
NetworkTableType.kRaw.getValue(),
|
||||
NetworkTableType.RAW.getValue(),
|
||||
m_proto.getTypeString(),
|
||||
properties,
|
||||
options),
|
||||
@@ -148,7 +148,7 @@ public final class ProtobufTopic<T> extends Topic {
|
||||
this,
|
||||
ProtobufBuffer.create(m_proto),
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_proto.getTypeString(), options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_proto.getTypeString(), options),
|
||||
defaultValue,
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class StructArrayTopic<T> extends Topic {
|
||||
this,
|
||||
StructBuffer.create(m_struct),
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_struct.getTypeString() + "[]", options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_struct.getTypeString() + "[]", options),
|
||||
defaultValue,
|
||||
false);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public final class StructArrayTopic<T> extends Topic {
|
||||
this,
|
||||
StructBuffer.create(m_struct),
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_struct.getTypeString() + "[]", options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_struct.getTypeString() + "[]", options),
|
||||
null,
|
||||
true);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public final class StructArrayTopic<T> extends Topic {
|
||||
StructBuffer.create(m_struct),
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle,
|
||||
NetworkTableType.kRaw.getValue(),
|
||||
NetworkTableType.RAW.getValue(),
|
||||
m_struct.getTypeString() + "[]",
|
||||
properties,
|
||||
options),
|
||||
@@ -148,7 +148,7 @@ public final class StructArrayTopic<T> extends Topic {
|
||||
this,
|
||||
StructBuffer.create(m_struct),
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_struct.getTypeString() + "[]", options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_struct.getTypeString() + "[]", options),
|
||||
defaultValue,
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public final class StructTopic<T> extends Topic {
|
||||
this,
|
||||
StructBuffer.create(m_struct),
|
||||
NetworkTablesJNI.subscribe(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_struct.getTypeString(), options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_struct.getTypeString(), options),
|
||||
defaultValue,
|
||||
false);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public final class StructTopic<T> extends Topic {
|
||||
this,
|
||||
StructBuffer.create(m_struct),
|
||||
NetworkTablesJNI.publish(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_struct.getTypeString(), options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_struct.getTypeString(), options),
|
||||
null,
|
||||
true);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public final class StructTopic<T> extends Topic {
|
||||
StructBuffer.create(m_struct),
|
||||
NetworkTablesJNI.publishEx(
|
||||
m_handle,
|
||||
NetworkTableType.kRaw.getValue(),
|
||||
NetworkTableType.RAW.getValue(),
|
||||
m_struct.getTypeString(),
|
||||
properties,
|
||||
options),
|
||||
@@ -147,7 +147,7 @@ public final class StructTopic<T> extends Topic {
|
||||
this,
|
||||
StructBuffer.create(m_struct),
|
||||
NetworkTablesJNI.getEntry(
|
||||
m_handle, NetworkTableType.kRaw.getValue(), m_struct.getTypeString(), options),
|
||||
m_handle, NetworkTableType.RAW.getValue(), m_struct.getTypeString(), options),
|
||||
defaultValue,
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ void InstanceImpl::StartServer(std::string_view persistFilename,
|
||||
}
|
||||
});
|
||||
networkMode = NT_NET_MODE_SERVER | NT_NET_MODE_STARTING;
|
||||
listenerStorage.NotifyTimeSync({}, NT_EVENT_TIMESYNC, 0, 0, true);
|
||||
listenerStorage.NotifyTimeSync({}, NT_EVENT_TIME_SYNC, 0, 0, true);
|
||||
m_serverTimeOffset = 0;
|
||||
m_rtt2 = 0;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void InstanceImpl::StopServer() {
|
||||
}
|
||||
server = std::move(m_networkServer);
|
||||
networkMode = NT_NET_MODE_NONE;
|
||||
listenerStorage.NotifyTimeSync({}, NT_EVENT_TIMESYNC, 0, 0, false);
|
||||
listenerStorage.NotifyTimeSync({}, NT_EVENT_TIME_SYNC, 0, 0, false);
|
||||
m_serverTimeOffset.reset();
|
||||
m_rtt2 = 0;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ void InstanceImpl::StartClient(std::string_view identity) {
|
||||
m_inst, identity, localStorage, connectionList, logger,
|
||||
[this](int64_t serverTimeOffset, int64_t rtt2, bool valid) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
listenerStorage.NotifyTimeSync({}, NT_EVENT_TIMESYNC, serverTimeOffset,
|
||||
listenerStorage.NotifyTimeSync({}, NT_EVENT_TIME_SYNC, serverTimeOffset,
|
||||
rtt2, valid);
|
||||
if (valid) {
|
||||
m_serverTimeOffset = serverTimeOffset;
|
||||
@@ -177,7 +177,7 @@ void InstanceImpl::StopClient() {
|
||||
client.reset();
|
||||
{
|
||||
std::scoped_lock lock{m_mutex};
|
||||
listenerStorage.NotifyTimeSync({}, NT_EVENT_TIMESYNC, 0, 0, false);
|
||||
listenerStorage.NotifyTimeSync({}, NT_EVENT_TIME_SYNC, 0, 0, false);
|
||||
m_serverTimeOffset.reset();
|
||||
m_rtt2 = 0;
|
||||
}
|
||||
@@ -210,13 +210,13 @@ std::optional<int64_t> InstanceImpl::GetServerTimeOffset() {
|
||||
void InstanceImpl::AddTimeSyncListener(NT_Listener listener,
|
||||
unsigned int eventMask) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
eventMask &= (NT_EVENT_TIMESYNC | NT_EVENT_IMMEDIATE);
|
||||
eventMask &= (NT_EVENT_TIME_SYNC | NT_EVENT_IMMEDIATE);
|
||||
listenerStorage.Activate(listener, eventMask);
|
||||
if ((eventMask & (NT_EVENT_TIMESYNC | NT_EVENT_IMMEDIATE)) ==
|
||||
(NT_EVENT_TIMESYNC | NT_EVENT_IMMEDIATE) &&
|
||||
if ((eventMask & (NT_EVENT_TIME_SYNC | NT_EVENT_IMMEDIATE)) ==
|
||||
(NT_EVENT_TIME_SYNC | NT_EVENT_IMMEDIATE) &&
|
||||
m_serverTimeOffset) {
|
||||
listenerStorage.NotifyTimeSync({&listener, 1},
|
||||
NT_EVENT_TIMESYNC | NT_EVENT_IMMEDIATE,
|
||||
NT_EVENT_TIME_SYNC | NT_EVENT_IMMEDIATE,
|
||||
*m_serverTimeOffset, m_rtt2, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,11 +61,11 @@ void ListenerStorage::Activate(NT_Listener listenerHandle, unsigned int mask,
|
||||
m_valueListeners.Add(listener);
|
||||
}
|
||||
// detect the higher log bits too; see LoggerImpl
|
||||
if ((deltaMask & NT_EVENT_LOGMESSAGE) != 0 ||
|
||||
if ((deltaMask & NT_EVENT_LOG_MESSAGE) != 0 ||
|
||||
(deltaMask & 0x1ff0000) != 0) {
|
||||
m_logListeners.Add(listener);
|
||||
}
|
||||
if ((deltaMask & NT_EVENT_TIMESYNC) != 0) {
|
||||
if ((deltaMask & NT_EVENT_TIME_SYNC) != 0) {
|
||||
m_timeSyncListeners.Add(listener);
|
||||
}
|
||||
}
|
||||
@@ -380,11 +380,11 @@ ListenerStorage::DoRemoveListeners(std::span<const NT_Listener> handles) {
|
||||
if ((listener->eventMask & NT_EVENT_VALUE_ALL) != 0) {
|
||||
m_valueListeners.Remove(listener.get());
|
||||
}
|
||||
if ((listener->eventMask & NT_EVENT_LOGMESSAGE) != 0 ||
|
||||
if ((listener->eventMask & NT_EVENT_LOG_MESSAGE) != 0 ||
|
||||
(listener->eventMask & 0x1ff0000) != 0) {
|
||||
m_logListeners.Remove(listener.get());
|
||||
}
|
||||
if ((listener->eventMask & NT_EVENT_TIMESYNC) != 0) {
|
||||
if ((listener->eventMask & NT_EVENT_TIME_SYNC) != 0) {
|
||||
m_timeSyncListeners.Remove(listener.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,25 +46,25 @@ static constexpr unsigned int kFlagDebug4 = 1u << 24;
|
||||
|
||||
static unsigned int LevelToFlag(unsigned int level) {
|
||||
if (level >= wpi::util::WPI_LOG_CRITICAL) {
|
||||
return EventFlags::kLogMessage | kFlagCritical;
|
||||
return EventFlags::LOG_MESSAGE | kFlagCritical;
|
||||
} else if (level >= wpi::util::WPI_LOG_ERROR) {
|
||||
return EventFlags::kLogMessage | kFlagError;
|
||||
return EventFlags::LOG_MESSAGE | kFlagError;
|
||||
} else if (level >= wpi::util::WPI_LOG_WARNING) {
|
||||
return EventFlags::kLogMessage | kFlagWarning;
|
||||
return EventFlags::LOG_MESSAGE | kFlagWarning;
|
||||
} else if (level >= wpi::util::WPI_LOG_INFO) {
|
||||
return EventFlags::kLogMessage | kFlagInfo;
|
||||
return EventFlags::LOG_MESSAGE | kFlagInfo;
|
||||
} else if (level >= wpi::util::WPI_LOG_DEBUG) {
|
||||
return EventFlags::kLogMessage | kFlagDebug;
|
||||
return EventFlags::LOG_MESSAGE | kFlagDebug;
|
||||
} else if (level >= wpi::util::WPI_LOG_DEBUG1) {
|
||||
return EventFlags::kLogMessage | kFlagDebug1;
|
||||
return EventFlags::LOG_MESSAGE | kFlagDebug1;
|
||||
} else if (level >= wpi::util::WPI_LOG_DEBUG2) {
|
||||
return EventFlags::kLogMessage | kFlagDebug2;
|
||||
return EventFlags::LOG_MESSAGE | kFlagDebug2;
|
||||
} else if (level >= wpi::util::WPI_LOG_DEBUG3) {
|
||||
return EventFlags::kLogMessage | kFlagDebug3;
|
||||
return EventFlags::LOG_MESSAGE | kFlagDebug3;
|
||||
} else if (level >= wpi::util::WPI_LOG_DEBUG4) {
|
||||
return EventFlags::kLogMessage | kFlagDebug4;
|
||||
return EventFlags::LOG_MESSAGE | kFlagDebug4;
|
||||
} else {
|
||||
return EventFlags::kLogMessage;
|
||||
return EventFlags::LOG_MESSAGE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ static unsigned int LevelsToEventMask(unsigned int minLevel,
|
||||
mask |= kFlagDebug4;
|
||||
}
|
||||
if (mask == 0) {
|
||||
mask = EventFlags::kLogMessage;
|
||||
mask = EventFlags::LOG_MESSAGE;
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ void LoggerImpl::AddListener(NT_Listener listener, unsigned int minLevel,
|
||||
m_listenerLevels.emplace_back(listener, minLevel, maxLevel);
|
||||
m_listenerStorage.Activate(listener, LevelsToEventMask(minLevel, maxLevel),
|
||||
[](unsigned int mask, Event* event) {
|
||||
event->flags = NT_EVENT_LOGMESSAGE;
|
||||
event->flags = NT_EVENT_LOG_MESSAGE;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ namespace wpi::nt {
|
||||
// internal helper class for PubSubOptions
|
||||
class PubSubOptionsImpl : public PubSubOptions {
|
||||
public:
|
||||
constexpr PubSubOptionsImpl() : PubSubOptionsImpl{kDefaultPubSubOptions} {}
|
||||
constexpr PubSubOptionsImpl() : PubSubOptionsImpl{DEFAULT_PUB_SUB_OPTIONS} {}
|
||||
|
||||
/*implicit*/ constexpr PubSubOptionsImpl( // NOLINT
|
||||
const PubSubOptions& options)
|
||||
: PubSubOptions{options} {
|
||||
if (periodic == 0) {
|
||||
periodic = kDefaultPeriodic;
|
||||
periodic = DEFAULT_PERIODIC;
|
||||
}
|
||||
periodicMs = static_cast<unsigned int>(periodic * 1000);
|
||||
if (pollStorage == 0) {
|
||||
|
||||
@@ -73,11 +73,11 @@ static void ConvertToC(const Event& in, NT_Event* out) {
|
||||
if (auto v = in.GetConnectionInfo()) {
|
||||
return ConvertToC(*v, &out->data.connInfo);
|
||||
}
|
||||
} else if ((in.flags & NT_EVENT_LOGMESSAGE) != 0) {
|
||||
} else if ((in.flags & NT_EVENT_LOG_MESSAGE) != 0) {
|
||||
if (auto v = in.GetLogMessage()) {
|
||||
return ConvertToC(*v, &out->data.logMessage);
|
||||
}
|
||||
} else if ((in.flags & NT_EVENT_TIMESYNC) != 0) {
|
||||
} else if ((in.flags & NT_EVENT_TIME_SYNC) != 0) {
|
||||
if (auto v = in.GetTimeSyncEventData()) {
|
||||
return ConvertToC(*v, &out->data.timeSyncData);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ static void DisposeEvent(NT_Event* event) {
|
||||
DisposeTopicInfo(&event->data.topicInfo);
|
||||
} else if ((event->flags & NT_EVENT_CONNECTION) != 0) {
|
||||
DisposeConnectionInfo(&event->data.connInfo);
|
||||
} else if ((event->flags & NT_EVENT_LOGMESSAGE) != 0) {
|
||||
} else if ((event->flags & NT_EVENT_LOG_MESSAGE) != 0) {
|
||||
DisposeLogMessage(&event->data.logMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ static void CleanupListeners(
|
||||
if ((mask & (NT_EVENT_TOPIC | NT_EVENT_VALUE_ALL)) != 0) {
|
||||
ii.localStorage.RemoveListener(listener, mask);
|
||||
}
|
||||
if ((mask & NT_EVENT_LOGMESSAGE) != 0) {
|
||||
if ((mask & NT_EVENT_LOG_MESSAGE) != 0) {
|
||||
ii.logger_impl.RemoveListener(listener);
|
||||
updateMinLevel = true;
|
||||
}
|
||||
@@ -442,10 +442,10 @@ static void DoAddListener(InstanceImpl& ii, NT_Listener listener,
|
||||
if ((mask & NT_EVENT_CONNECTION) != 0) {
|
||||
ii.connectionList.AddListener(listener, mask);
|
||||
}
|
||||
if ((mask & NT_EVENT_LOGMESSAGE) != 0) {
|
||||
if ((mask & NT_EVENT_LOG_MESSAGE) != 0) {
|
||||
ii.logger_impl.AddListener(listener, NT_LOG_INFO, UINT_MAX);
|
||||
}
|
||||
if ((mask & NT_EVENT_TIMESYNC) != 0) {
|
||||
if ((mask & NT_EVENT_TIME_SYNC) != 0) {
|
||||
ii.AddTimeSyncListener(listener, mask);
|
||||
}
|
||||
} else if ((mask & (NT_EVENT_TOPIC | NT_EVENT_VALUE_ALL)) != 0) {
|
||||
|
||||
@@ -30,7 +30,7 @@ class MultiSubscriber final {
|
||||
*/
|
||||
MultiSubscriber(NetworkTableInstance inst,
|
||||
std::span<const std::string_view> prefixes,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions)
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS)
|
||||
: m_handle{::wpi::nt::SubscribeMultiple(inst.GetHandle(), prefixes,
|
||||
options)} {}
|
||||
|
||||
|
||||
@@ -70,32 +70,32 @@ class NetworkTableInstance final {
|
||||
* Client/server mode flag values (as returned by GetNetworkMode()).
|
||||
* This is a bitmask.
|
||||
*/
|
||||
enum NetworkMode {
|
||||
kNetModeNone = NT_NET_MODE_NONE,
|
||||
kNetModeServer = NT_NET_MODE_SERVER,
|
||||
kNetModeClient = NT_NET_MODE_CLIENT,
|
||||
kNetModeLocal = NT_NET_MODE_LOCAL
|
||||
enum class NetworkMode {
|
||||
NONE = NT_NET_MODE_NONE,
|
||||
SERVER = NT_NET_MODE_SERVER,
|
||||
CLIENT = NT_NET_MODE_CLIENT,
|
||||
LOCAL = NT_NET_MODE_LOCAL
|
||||
};
|
||||
|
||||
/**
|
||||
* Logging levels (as used by SetLogger()).
|
||||
*/
|
||||
enum LogLevel {
|
||||
kLogCritical = NT_LOG_CRITICAL,
|
||||
kLogError = NT_LOG_ERROR,
|
||||
kLogWarning = NT_LOG_WARNING,
|
||||
kLogInfo = NT_LOG_INFO,
|
||||
kLogDebug = NT_LOG_DEBUG,
|
||||
kLogDebug1 = NT_LOG_DEBUG1,
|
||||
kLogDebug2 = NT_LOG_DEBUG2,
|
||||
kLogDebug3 = NT_LOG_DEBUG3,
|
||||
kLogDebug4 = NT_LOG_DEBUG4
|
||||
enum class LogLevel {
|
||||
CRITICAL = NT_LOG_CRITICAL,
|
||||
ERR = NT_LOG_ERROR,
|
||||
WARNING = NT_LOG_WARNING,
|
||||
INFO = NT_LOG_INFO,
|
||||
DEBUG = NT_LOG_DEBUG,
|
||||
DEBUG_1 = NT_LOG_DEBUG1,
|
||||
DEBUG_2 = NT_LOG_DEBUG2,
|
||||
DEBUG_3 = NT_LOG_DEBUG3,
|
||||
DEBUG_4 = NT_LOG_DEBUG4
|
||||
};
|
||||
|
||||
/**
|
||||
* The default port that network tables operates on.
|
||||
*/
|
||||
static constexpr unsigned int kDefaultPort = NT_DEFAULT_PORT;
|
||||
static constexpr unsigned int DEFAULT_PORT = NT_DEFAULT_PORT;
|
||||
|
||||
/**
|
||||
* Construct invalid instance.
|
||||
@@ -487,7 +487,7 @@ class NetworkTableInstance final {
|
||||
ListenerCallback callback) const {
|
||||
return ::wpi::nt::AddListener(
|
||||
m_handle,
|
||||
NT_EVENT_TIMESYNC | (immediate_notify ? NT_EVENT_IMMEDIATE : 0),
|
||||
NT_EVENT_TIME_SYNC | (immediate_notify ? NT_EVENT_IMMEDIATE : 0),
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ class NetworkTableInstance final {
|
||||
void StartServer(std::string_view persist_filename = "networktables.json",
|
||||
std::string_view listen_address = "",
|
||||
std::string_view mdns_service = "",
|
||||
unsigned int port = kDefaultPort) {
|
||||
unsigned int port = DEFAULT_PORT) {
|
||||
::wpi::nt::StartServer(m_handle, persist_filename, listen_address,
|
||||
mdns_service, port);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class NetworkTableListener final {
|
||||
ListenerCallback listener) {
|
||||
return NetworkTableListener{::wpi::nt::AddListener(
|
||||
inst.GetHandle(),
|
||||
NT_EVENT_TIMESYNC | (immediate_notify ? NT_EVENT_IMMEDIATE : 0),
|
||||
NT_EVENT_TIME_SYNC | (immediate_notify ? NT_EVENT_IMMEDIATE : 0),
|
||||
std::move(listener))};
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ class NetworkTableListenerPoller final {
|
||||
NT_Listener AddTimeSyncListener(bool immediate_notify) {
|
||||
return ::wpi::nt::AddPolledListener(
|
||||
m_handle, ::wpi::nt::GetInstanceFromHandle(m_handle),
|
||||
NT_EVENT_TIMESYNC | (immediate_notify ? NT_EVENT_IMMEDIATE : 0));
|
||||
NT_EVENT_TIME_SYNC | (immediate_notify ? NT_EVENT_IMMEDIATE : 0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,29 +14,29 @@ namespace wpi::nt {
|
||||
*/
|
||||
enum class NetworkTableType {
|
||||
/// Unassigned data type.
|
||||
kUnassigned = NT_UNASSIGNED,
|
||||
UNASSIGNED = NT_UNASSIGNED,
|
||||
/// Boolean data type.
|
||||
kBoolean = NT_BOOLEAN,
|
||||
BOOLEAN = NT_BOOLEAN,
|
||||
/// Double precision floating-point data type.
|
||||
kDouble = NT_DOUBLE,
|
||||
DOUBLE = NT_DOUBLE,
|
||||
/// String data type.
|
||||
kString = NT_STRING,
|
||||
STRING = NT_STRING,
|
||||
/// Raw data type.
|
||||
kRaw = NT_RAW,
|
||||
RAW = NT_RAW,
|
||||
/// Boolean array data type.
|
||||
kBooleanArray = NT_BOOLEAN_ARRAY,
|
||||
BOOLEAN_ARRAY = NT_BOOLEAN_ARRAY,
|
||||
/// Double precision floating-point array data type.
|
||||
kDoubleArray = NT_DOUBLE_ARRAY,
|
||||
DOUBLE_ARRAY = NT_DOUBLE_ARRAY,
|
||||
/// String array data type.
|
||||
kStringArray = NT_STRING_ARRAY,
|
||||
STRING_ARRAY = NT_STRING_ARRAY,
|
||||
/// Integer data type.
|
||||
kInteger = NT_INTEGER,
|
||||
INTEGER = NT_INTEGER,
|
||||
/// Single precision floating-point data type.
|
||||
kFloat = NT_FLOAT,
|
||||
FLOAT = NT_FLOAT,
|
||||
/// Integer array data type.
|
||||
kIntegerArray = NT_INTEGER_ARRAY,
|
||||
INTEGER_ARRAY = NT_INTEGER_ARRAY,
|
||||
/// Single precision floating-point array data type.
|
||||
kFloatArray = NT_FLOAT_ARRAY
|
||||
FLOAT_ARRAY = NT_FLOAT_ARRAY
|
||||
};
|
||||
|
||||
} // namespace wpi::nt
|
||||
|
||||
@@ -376,7 +376,7 @@ class ProtobufTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
T defaultValue, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
T defaultValue, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
wpi::util::ProtobufMessage<T> msg;
|
||||
auto typeString = msg.GetTypeString();
|
||||
return ProtobufSubscriber<T>{
|
||||
@@ -400,7 +400,8 @@ class ProtobufTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
wpi::util::ProtobufMessage<T> msg;
|
||||
auto typeString = msg.GetTypeString();
|
||||
return ProtobufPublisher<T>{
|
||||
@@ -428,7 +429,7 @@ class ProtobufTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(
|
||||
const wpi::util::json& properties,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
wpi::util::ProtobufMessage<T> msg;
|
||||
auto typeString = msg.GetTypeString();
|
||||
return ProtobufPublisher<T>{
|
||||
@@ -458,7 +459,7 @@ class ProtobufTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(T defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
wpi::util::ProtobufMessage<T> msg;
|
||||
auto typeString = msg.GetTypeString();
|
||||
return ProtobufEntry<T>{
|
||||
|
||||
@@ -514,8 +514,8 @@ class StructArrayTopic final : public Topic {
|
||||
std::convertible_to<std::ranges::range_value_t<U>, T>
|
||||
#endif
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
U&& defaultValue, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
SubscriberType Subscribe(U&& defaultValue, const PubSubOptions& options =
|
||||
DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructArraySubscriber<T, I...>{
|
||||
@@ -547,7 +547,7 @@ class StructArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
std::span<const T> defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructArraySubscriber<T, I...>{
|
||||
@@ -577,7 +577,8 @@ class StructArrayTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructArrayPublisher<T, I...>{
|
||||
@@ -611,7 +612,7 @@ class StructArrayTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(
|
||||
const wpi::util::json& properties,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructArrayPublisher<T, I...>{
|
||||
@@ -652,7 +653,7 @@ class StructArrayTopic final : public Topic {
|
||||
#endif
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(U&& defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructArrayEntry<T, I...>{
|
||||
@@ -688,7 +689,7 @@ class StructArrayTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(std::span<const T> defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructArrayEntry<T, I...>{
|
||||
|
||||
@@ -416,7 +416,7 @@ class StructTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
T defaultValue, const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
T defaultValue, const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructSubscriber<T, I...>{
|
||||
@@ -444,7 +444,8 @@ class StructTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructPublisher<T, I...>{
|
||||
@@ -476,7 +477,7 @@ class StructTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(
|
||||
const wpi::util::json& properties,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructPublisher<T, I...>{
|
||||
@@ -511,7 +512,7 @@ class StructTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(T defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return std::apply(
|
||||
[&](const I&... info) {
|
||||
return StructEntry<T, I...>{
|
||||
|
||||
@@ -195,7 +195,7 @@ class Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
GenericSubscriber GenericSubscribe(
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
@@ -214,7 +214,7 @@ class Topic {
|
||||
[[nodiscard]]
|
||||
GenericSubscriber GenericSubscribe(
|
||||
std::string_view typeString,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
@@ -235,7 +235,7 @@ class Topic {
|
||||
[[nodiscard]]
|
||||
GenericPublisher GenericPublish(
|
||||
std::string_view typeString,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial
|
||||
@@ -258,7 +258,7 @@ class Topic {
|
||||
[[nodiscard]]
|
||||
GenericPublisher GenericPublishEx(
|
||||
std::string_view typeString, const wpi::util::json& properties,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Create a new generic entry for the topic.
|
||||
@@ -280,7 +280,7 @@ class Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
GenericEntry GetGenericEntry(
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Create a new generic entry for the topic.
|
||||
@@ -304,7 +304,7 @@ class Topic {
|
||||
[[nodiscard]]
|
||||
GenericEntry GetGenericEntry(
|
||||
std::string_view typeString,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Equality operator. Returns true if both instances refer to the same
|
||||
|
||||
@@ -319,7 +319,7 @@ class UnitTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType Subscribe(
|
||||
ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return UnitSubscriber<T>{
|
||||
::wpi::nt::Subscribe(m_handle, NT_DOUBLE, "double", options),
|
||||
defaultValue};
|
||||
@@ -344,7 +344,7 @@ class UnitTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
SubscriberType SubscribeEx(
|
||||
std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return UnitSubscriber<T>{
|
||||
::wpi::nt::Subscribe(m_handle, NT_DOUBLE, typeString, options),
|
||||
defaultValue};
|
||||
@@ -366,7 +366,8 @@ class UnitTopic final : public Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]]
|
||||
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
PublisherType Publish(
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return UnitPublisher<T>{::wpi::nt::PublishEx(
|
||||
m_handle, NT_DOUBLE, "double", {{"unit", T{}.name()}}, options)};
|
||||
}
|
||||
@@ -392,7 +393,7 @@ class UnitTopic final : public Topic {
|
||||
[[nodiscard]]
|
||||
PublisherType PublishEx(
|
||||
std::string_view typeString, const wpi::util::json& properties,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
wpi::util::json props = properties;
|
||||
props["unit"] = T{}.name();
|
||||
return UnitPublisher<T>{
|
||||
@@ -421,7 +422,7 @@ class UnitTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntry(ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return UnitEntry<T>{
|
||||
::wpi::nt::GetEntry(m_handle, NT_DOUBLE, "double", options),
|
||||
defaultValue};
|
||||
@@ -450,7 +451,7 @@ class UnitTopic final : public Topic {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions) {
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS) {
|
||||
return UnitEntry<T>{
|
||||
::wpi::nt::GetEntry(m_handle, NT_DOUBLE, typeString, options),
|
||||
defaultValue};
|
||||
|
||||
@@ -119,9 +119,9 @@ enum NT_EventFlags {
|
||||
/** Topic value updated (network or local). */
|
||||
NT_EVENT_VALUE_ALL = NT_EVENT_VALUE_REMOTE | NT_EVENT_VALUE_LOCAL,
|
||||
/** Log message. */
|
||||
NT_EVENT_LOGMESSAGE = 0x100,
|
||||
NT_EVENT_LOG_MESSAGE = 0x100,
|
||||
/** Time synchronized with server. */
|
||||
NT_EVENT_TIMESYNC = 0x200,
|
||||
NT_EVENT_TIME_SYNC = 0x200,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -266,8 +266,8 @@ struct NT_Event {
|
||||
* - NT_EVENT_CONNECTED or NT_EVENT_DISCONNECTED: connInfo
|
||||
* - NT_EVENT_PUBLISH, NT_EVENT_UNPUBLISH, or NT_EVENT_PROPERTIES: topicInfo
|
||||
* - NT_EVENT_VALUE_REMOTE, NT_NOTIFY_VALUE_LOCAL: valueData
|
||||
* - NT_EVENT_LOGMESSAGE: logMessage
|
||||
* - NT_EVENT_TIMESYNC: timeSyncData
|
||||
* - NT_EVENT_LOG_MESSAGE: logMessage
|
||||
* - NT_EVENT_TIME_SYNC: timeSyncData
|
||||
*/
|
||||
unsigned int flags;
|
||||
|
||||
|
||||
@@ -51,37 +51,37 @@ namespace wpi::nt {
|
||||
struct EventFlags {
|
||||
EventFlags() = delete;
|
||||
|
||||
static constexpr unsigned int kNone = NT_EVENT_NONE;
|
||||
static constexpr unsigned int NONE = NT_EVENT_NONE;
|
||||
/**
|
||||
* Initial listener addition.
|
||||
* Set this flag to receive immediate notification of matches to the
|
||||
* flag criteria.
|
||||
*/
|
||||
static constexpr unsigned int kImmediate = NT_EVENT_IMMEDIATE;
|
||||
static constexpr unsigned int IMMEDIATE = NT_EVENT_IMMEDIATE;
|
||||
/** Client connected (on server, any client connected). */
|
||||
static constexpr unsigned int kConnected = NT_EVENT_CONNECTED;
|
||||
static constexpr unsigned int CONNECTED = NT_EVENT_CONNECTED;
|
||||
/** Client disconnected (on server, any client disconnected). */
|
||||
static constexpr unsigned int kDisconnected = NT_EVENT_DISCONNECTED;
|
||||
static constexpr unsigned int DISCONNECTED = NT_EVENT_DISCONNECTED;
|
||||
/** Any connection event (connect or disconnect). */
|
||||
static constexpr unsigned int kConnection = kConnected | kDisconnected;
|
||||
static constexpr unsigned int CONNECTION = CONNECTED | DISCONNECTED;
|
||||
/** New topic published. */
|
||||
static constexpr unsigned int kPublish = NT_EVENT_PUBLISH;
|
||||
static constexpr unsigned int PUBLISH = NT_EVENT_PUBLISH;
|
||||
/** Topic unpublished. */
|
||||
static constexpr unsigned int kUnpublish = NT_EVENT_UNPUBLISH;
|
||||
static constexpr unsigned int UNPUBLISH = NT_EVENT_UNPUBLISH;
|
||||
/** Topic properties changed. */
|
||||
static constexpr unsigned int kProperties = NT_EVENT_PROPERTIES;
|
||||
static constexpr unsigned int PROPERTIES = NT_EVENT_PROPERTIES;
|
||||
/** Any topic event (publish, unpublish, or properties changed). */
|
||||
static constexpr unsigned int kTopic = kPublish | kUnpublish | kProperties;
|
||||
static constexpr unsigned int TOPIC = PUBLISH | UNPUBLISH | PROPERTIES;
|
||||
/** Topic value updated (via network). */
|
||||
static constexpr unsigned int kValueRemote = NT_EVENT_VALUE_REMOTE;
|
||||
static constexpr unsigned int VALUE_REMOTE = NT_EVENT_VALUE_REMOTE;
|
||||
/** Topic value updated (local). */
|
||||
static constexpr unsigned int kValueLocal = NT_EVENT_VALUE_LOCAL;
|
||||
static constexpr unsigned int VALUE_LOCAL = NT_EVENT_VALUE_LOCAL;
|
||||
/** Topic value updated (network or local). */
|
||||
static constexpr unsigned int kValueAll = kValueRemote | kValueLocal;
|
||||
static constexpr unsigned int VALUE_ALL = VALUE_REMOTE | VALUE_LOCAL;
|
||||
/** Log message. */
|
||||
static constexpr unsigned int kLogMessage = NT_EVENT_LOGMESSAGE;
|
||||
static constexpr unsigned int LOG_MESSAGE = NT_EVENT_LOG_MESSAGE;
|
||||
/** Time synchronized with server. */
|
||||
static constexpr unsigned int kTimeSync = NT_EVENT_TIMESYNC;
|
||||
static constexpr unsigned int TIME_SYNC = NT_EVENT_TIME_SYNC;
|
||||
};
|
||||
|
||||
/** NetworkTables Topic Information */
|
||||
@@ -249,8 +249,8 @@ class Event {
|
||||
* - NT_EVENT_PUBLISH, NT_EVENT_UNPUBLISH, or NT_EVENT_PROPERTIES:
|
||||
* GetTopicInfo()
|
||||
* - NT_EVENT_VALUE, NT_EVENT_VALUE_LOCAL: GetValueData()
|
||||
* - NT_EVENT_LOGMESSAGE: GetLogMessage()
|
||||
* - NT_EVENT_TIMESYNC: GetTimeSyncEventData()
|
||||
* - NT_EVENT_LOG_MESSAGE: GetLogMessage()
|
||||
* - NT_EVENT_TIME_SYNC: GetTimeSyncEventData()
|
||||
*/
|
||||
unsigned int flags{0};
|
||||
|
||||
@@ -304,7 +304,7 @@ struct PubSubOptions {
|
||||
/**
|
||||
* Default value of periodic.
|
||||
*/
|
||||
static constexpr double kDefaultPeriodic = 0.1;
|
||||
static constexpr double DEFAULT_PERIODIC = 0.1;
|
||||
|
||||
/**
|
||||
* Structure size. Must be set to sizeof(PubSubOptions).
|
||||
@@ -325,7 +325,7 @@ struct PubSubOptions {
|
||||
* minimum period for all values) or apply a restricted range to this value.
|
||||
* The default is 100 ms.
|
||||
*/
|
||||
double periodic = kDefaultPeriodic;
|
||||
double periodic = DEFAULT_PERIODIC;
|
||||
|
||||
/**
|
||||
* For subscriptions, if non-zero, value updates for ReadQueue() are not
|
||||
@@ -385,7 +385,7 @@ struct PubSubOptions {
|
||||
/**
|
||||
* Default publish/subscribe options.
|
||||
*/
|
||||
constexpr PubSubOptions kDefaultPubSubOptions;
|
||||
constexpr PubSubOptions DEFAULT_PUB_SUB_OPTIONS;
|
||||
|
||||
/**
|
||||
* @defgroup ntcore_instance_func Instance Functions
|
||||
@@ -783,7 +783,7 @@ bool SetTopicProperties(NT_Topic topic, const wpi::util::json& update);
|
||||
* @return Subscriber handle
|
||||
*/
|
||||
NT_Subscriber Subscribe(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Stops subscriber.
|
||||
@@ -802,7 +802,7 @@ void Unsubscribe(NT_Subscriber sub);
|
||||
* @return Publisher handle
|
||||
*/
|
||||
NT_Publisher Publish(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Creates a new publisher to a topic.
|
||||
@@ -816,7 +816,7 @@ NT_Publisher Publish(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
*/
|
||||
NT_Publisher PublishEx(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
const wpi::util::json& properties,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Stops publisher.
|
||||
@@ -835,7 +835,7 @@ void Unpublish(NT_Handle pubentry);
|
||||
* @return Entry handle
|
||||
*/
|
||||
NT_Entry GetEntry(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Stops entry subscriber/publisher.
|
||||
@@ -878,7 +878,7 @@ NT_Topic GetTopicFromHandle(NT_Handle pubsubentry);
|
||||
*/
|
||||
NT_MultiSubscriber SubscribeMultiple(
|
||||
NT_Inst inst, std::span<const std::string_view> prefixes,
|
||||
const PubSubOptions& options = kDefaultPubSubOptions);
|
||||
const PubSubOptions& options = DEFAULT_PUB_SUB_OPTIONS);
|
||||
|
||||
/**
|
||||
* Unsubscribes a multi-subscriber.
|
||||
|
||||
@@ -45,8 +45,8 @@ class NtLogForwarder:
|
||||
return
|
||||
|
||||
default_cfg = (
|
||||
_ntcore.NetworkTableInstance.LogLevel.kLogInfo,
|
||||
_ntcore.NetworkTableInstance.LogLevel.kLogCritical,
|
||||
_ntcore.NetworkTableInstance.LogLevel.INFO,
|
||||
_ntcore.NetworkTableInstance.LogLevel.CRITICAL,
|
||||
"nt",
|
||||
)
|
||||
minLevel, maxLevel, logName = cls._instcfg.get(handle, default_cfg)
|
||||
|
||||
@@ -73,7 +73,7 @@ py::object ntvalue2py(const wpi::nt::Value &ntvalue) {
|
||||
}
|
||||
return std::move(l);
|
||||
}
|
||||
|
||||
|
||||
case NT_STRING_ARRAY: {
|
||||
return py::cast(ntvalue.GetStringArray());
|
||||
}
|
||||
@@ -150,27 +150,27 @@ wpi::nt::Value py2ntvalue(py::handle h) {
|
||||
py::function valueFactoryByType(wpi::nt::NetworkTableType type) {
|
||||
py::object PyNtValue = py::module::import("ntcore").attr("Value");
|
||||
switch (type) {
|
||||
case wpi::nt::NetworkTableType::kBoolean:
|
||||
case wpi::nt::NetworkTableType::BOOLEAN:
|
||||
return PyNtValue.attr("makeBoolean");
|
||||
case wpi::nt::NetworkTableType::kDouble:
|
||||
case wpi::nt::NetworkTableType::DOUBLE:
|
||||
return PyNtValue.attr("makeDouble");
|
||||
case wpi::nt::NetworkTableType::kString:
|
||||
case wpi::nt::NetworkTableType::STRING:
|
||||
return PyNtValue.attr("makeString");
|
||||
case wpi::nt::NetworkTableType::kRaw:
|
||||
case wpi::nt::NetworkTableType::RAW:
|
||||
return PyNtValue.attr("makeRaw");
|
||||
case wpi::nt::NetworkTableType::kBooleanArray:
|
||||
case wpi::nt::NetworkTableType::BOOLEAN_ARRAY:
|
||||
return PyNtValue.attr("makeBooleanArray");
|
||||
case wpi::nt::NetworkTableType::kDoubleArray:
|
||||
case wpi::nt::NetworkTableType::DOUBLE_ARRAY:
|
||||
return PyNtValue.attr("makeDoubleArray");
|
||||
case wpi::nt::NetworkTableType::kStringArray:
|
||||
case wpi::nt::NetworkTableType::STRING_ARRAY:
|
||||
return PyNtValue.attr("makeStringArray");
|
||||
case wpi::nt::NetworkTableType::kInteger:
|
||||
case wpi::nt::NetworkTableType::INTEGER:
|
||||
return PyNtValue.attr("makeInteger");
|
||||
case wpi::nt::NetworkTableType::kFloat:
|
||||
case wpi::nt::NetworkTableType::FLOAT:
|
||||
return PyNtValue.attr("makeFloat");
|
||||
case wpi::nt::NetworkTableType::kIntegerArray:
|
||||
case wpi::nt::NetworkTableType::INTEGER_ARRAY:
|
||||
return PyNtValue.attr("makeIntegerArray");
|
||||
case wpi::nt::NetworkTableType::kFloatArray:
|
||||
case wpi::nt::NetworkTableType::FLOAT_ARRAY:
|
||||
return PyNtValue.attr("makeFloatArray");
|
||||
default:
|
||||
throw py::type_error("empty nt value");
|
||||
|
||||
@@ -86,7 +86,7 @@ classes:
|
||||
})
|
||||
wpi::nt::BooleanArrayTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
BooleanArrayTopic:
|
||||
overloads:
|
||||
|
||||
@@ -78,7 +78,7 @@ classes:
|
||||
})
|
||||
wpi::nt::BooleanTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
BooleanTopic:
|
||||
overloads:
|
||||
|
||||
@@ -86,7 +86,7 @@ classes:
|
||||
})
|
||||
wpi::nt::DoubleArrayTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
DoubleArrayTopic:
|
||||
overloads:
|
||||
|
||||
@@ -78,7 +78,7 @@ classes:
|
||||
})
|
||||
wpi::nt::DoubleTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
DoubleTopic:
|
||||
overloads:
|
||||
|
||||
@@ -86,7 +86,7 @@ classes:
|
||||
})
|
||||
wpi::nt::FloatArrayTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
FloatArrayTopic:
|
||||
overloads:
|
||||
|
||||
@@ -78,7 +78,7 @@ classes:
|
||||
})
|
||||
wpi::nt::FloatTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
FloatTopic:
|
||||
overloads:
|
||||
|
||||
@@ -86,7 +86,7 @@ classes:
|
||||
})
|
||||
wpi::nt::IntegerArrayTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
IntegerArrayTopic:
|
||||
overloads:
|
||||
|
||||
@@ -78,7 +78,7 @@ classes:
|
||||
})
|
||||
wpi::nt::IntegerTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
IntegerTopic:
|
||||
overloads:
|
||||
|
||||
@@ -24,7 +24,7 @@ classes:
|
||||
force_type_casters:
|
||||
- std::function
|
||||
attributes:
|
||||
kDefaultPort:
|
||||
DEFAULT_PORT:
|
||||
enums:
|
||||
NetworkMode:
|
||||
arithmetic: true
|
||||
@@ -160,8 +160,8 @@ classes:
|
||||
NetworkTableInstance::LogLevel minLevel, NetworkTableInstance::LogLevel maxLevel, py::str logName) {
|
||||
py::module::import("ntcore._logutil").attr("_config_logging")(self, minLevel, maxLevel, logName);
|
||||
}, py::kw_only(),
|
||||
py::arg("min") = NetworkTableInstance::LogLevel::kLogInfo,
|
||||
py::arg("max") = NetworkTableInstance::LogLevel::kLogCritical,
|
||||
py::arg("min") = NetworkTableInstance::LogLevel::INFO,
|
||||
py::arg("max") = NetworkTableInstance::LogLevel::CRITICAL,
|
||||
py::arg("name") = "nt",
|
||||
py::doc("Configure python logging for this instance.\n"
|
||||
"\n"
|
||||
|
||||
@@ -78,7 +78,7 @@ classes:
|
||||
})
|
||||
wpi::nt::StringArrayTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
StringArrayTopic:
|
||||
overloads:
|
||||
|
||||
@@ -86,7 +86,7 @@ classes:
|
||||
})
|
||||
wpi::nt::StringTopic:
|
||||
attributes:
|
||||
kTypeString:
|
||||
TYPE_STRING:
|
||||
methods:
|
||||
StringTopic:
|
||||
overloads:
|
||||
|
||||
@@ -30,20 +30,20 @@ functions:
|
||||
classes:
|
||||
wpi::nt::EventFlags:
|
||||
attributes:
|
||||
kNone:
|
||||
kImmediate:
|
||||
kConnected:
|
||||
kDisconnected:
|
||||
kConnection:
|
||||
kPublish:
|
||||
kUnpublish:
|
||||
kProperties:
|
||||
kTopic:
|
||||
kValueRemote:
|
||||
kValueLocal:
|
||||
kValueAll:
|
||||
kLogMessage:
|
||||
kTimeSync:
|
||||
NONE:
|
||||
IMMEDIATE:
|
||||
CONNECTED:
|
||||
DISCONNECTED:
|
||||
CONNECTION:
|
||||
PUBLISH:
|
||||
UNPUBLISH:
|
||||
PROPERTIES:
|
||||
TOPIC:
|
||||
VALUE_REMOTE:
|
||||
VALUE_LOCAL:
|
||||
VALUE_ALL:
|
||||
LOG_MESSAGE:
|
||||
TIME_SYNC:
|
||||
wpi::nt::TopicInfo:
|
||||
attributes:
|
||||
name:
|
||||
@@ -76,7 +76,7 @@ classes:
|
||||
inline_code: |
|
||||
.def("__repr__", [](const ConnectionInfo &self) -> py::str {
|
||||
return py::str("<ConnectionInfo id={} addr={}:{} last_update={} protocol={}>")
|
||||
.format(self.remote_id, self.remote_ip, self.remote_port,
|
||||
.format(self.remote_id, self.remote_ip, self.remote_port,
|
||||
self.last_update, self.protocol_version);
|
||||
})
|
||||
wpi::nt::ValueEventData:
|
||||
@@ -194,7 +194,7 @@ classes:
|
||||
wpi::nt::PubSubOptions:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
kDefaultPeriodic:
|
||||
DEFAULT_PERIODIC:
|
||||
structSize:
|
||||
ignore: true
|
||||
pollStorage:
|
||||
@@ -239,7 +239,7 @@ classes:
|
||||
}),
|
||||
py::kw_only(),
|
||||
py::arg("pollStorage") = 0,
|
||||
py::arg("periodic") = wpi::nt::PubSubOptions::kDefaultPeriodic,
|
||||
py::arg("periodic") = wpi::nt::PubSubOptions::DEFAULT_PERIODIC,
|
||||
py::arg("excludePublisher") = std::nullopt,
|
||||
py::arg("sendAll") = false,
|
||||
py::arg("topicsOnly") = false,
|
||||
@@ -250,8 +250,8 @@ classes:
|
||||
py::arg("excludeSelf") = false,
|
||||
py::arg("hidden") = false,
|
||||
R"(
|
||||
|
||||
|
||||
|
||||
|
||||
:param pollStorage: Polling storage size for a subscription. Specifies the maximum number of
|
||||
updates NetworkTables should store between calls to the subscriber's
|
||||
ReadQueue() function. If zero, defaults to 1 if sendAll is false, 20 if
|
||||
|
||||
@@ -66,7 +66,7 @@ class ConnectionListenerTest {
|
||||
assertNotSame(poller, 0, "bad poller handle");
|
||||
int handle =
|
||||
NetworkTablesJNI.addListener(
|
||||
poller, m_serverInst.getHandle(), EnumSet.of(NetworkTableEvent.Kind.kConnection));
|
||||
poller, m_serverInst.getHandle(), EnumSet.of(NetworkTableEvent.Kind.CONNECTION));
|
||||
assertNotSame(handle, 0, "bad listener handle");
|
||||
|
||||
// trigger a connect event
|
||||
@@ -84,7 +84,7 @@ class ConnectionListenerTest {
|
||||
assertEquals(1, events.length);
|
||||
assertEquals(handle, events[0].listener);
|
||||
assertNotNull(events[0].connInfo);
|
||||
assertTrue(events[0].is(NetworkTableEvent.Kind.kConnected));
|
||||
assertTrue(events[0].is(NetworkTableEvent.Kind.CONNECTED));
|
||||
|
||||
// trigger a disconnect event
|
||||
m_clientInst.stopClient();
|
||||
@@ -105,7 +105,7 @@ class ConnectionListenerTest {
|
||||
assertNotNull(events);
|
||||
assertEquals(1, events.length);
|
||||
assertEquals(handle, events[0].listener);
|
||||
assertTrue(events[0].is(NetworkTableEvent.Kind.kDisconnected));
|
||||
assertTrue(events[0].is(NetworkTableEvent.Kind.DISCONNECTED));
|
||||
}
|
||||
|
||||
private static int threadedPort = 10001;
|
||||
@@ -157,7 +157,7 @@ class ConnectionListenerTest {
|
||||
assertEquals(1, events.size());
|
||||
assertEquals(handle, events.get(0).listener);
|
||||
assertNotNull(events.get(0).connInfo);
|
||||
assertTrue(events.get(0).is(NetworkTableEvent.Kind.kConnected));
|
||||
assertTrue(events.get(0).is(NetworkTableEvent.Kind.CONNECTED));
|
||||
events.clear();
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ class ConnectionListenerTest {
|
||||
assertEquals(1, events.size());
|
||||
assertEquals(handle, events.get(0).listener);
|
||||
assertNotNull(events.get(0).connInfo);
|
||||
assertTrue(events.get(0).is(NetworkTableEvent.Kind.kDisconnected));
|
||||
assertTrue(events.get(0).is(NetworkTableEvent.Kind.DISCONNECTED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class LoggerTest {
|
||||
@Test
|
||||
void addMessageTest() {
|
||||
List<NetworkTableEvent> msgs = new ArrayList<>();
|
||||
m_clientInst.addLogger(LogMessage.kInfo, 100, msgs::add);
|
||||
m_clientInst.addLogger(LogMessage.INFO, 100, msgs::add);
|
||||
|
||||
m_clientInst.startClient("client");
|
||||
m_clientInst.setServer("127.0.0.1", 10000);
|
||||
@@ -37,7 +37,7 @@ class LoggerTest {
|
||||
// wait for client to report it's started, then wait another 0.1 sec
|
||||
try {
|
||||
int count = 0;
|
||||
while (!m_clientInst.getNetworkMode().contains(NetworkTableInstance.NetworkMode.kClient)) {
|
||||
while (!m_clientInst.getNetworkMode().contains(NetworkTableInstance.NetworkMode.CLIENT)) {
|
||||
Thread.sleep(100);
|
||||
count++;
|
||||
if (count > 30) {
|
||||
|
||||
@@ -37,7 +37,7 @@ class TableListenerTest {
|
||||
NetworkTable table = m_inst.getTable("/foo");
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
table.addListener(
|
||||
EnumSet.of(NetworkTableEvent.Kind.kTopic),
|
||||
EnumSet.of(NetworkTableEvent.Kind.TOPIC),
|
||||
(atable, key, event) -> {
|
||||
count.incrementAndGet();
|
||||
assertEquals(atable, table);
|
||||
|
||||
@@ -40,7 +40,7 @@ class TopicListenerTest {
|
||||
// Use connection listener to ensure we've connected
|
||||
int poller = NetworkTablesJNI.createListenerPoller(m_clientInst.getHandle());
|
||||
NetworkTablesJNI.addListener(
|
||||
poller, m_clientInst.getHandle(), EnumSet.of(NetworkTableEvent.Kind.kConnected));
|
||||
poller, m_clientInst.getHandle(), EnumSet.of(NetworkTableEvent.Kind.CONNECTED));
|
||||
try {
|
||||
if (WPIUtilJNI.waitForObjectTimeout(poller, 1.0)) {
|
||||
fail("client didn't connect to server");
|
||||
@@ -59,7 +59,7 @@ class TopicListenerTest {
|
||||
final int poller = NetworkTablesJNI.createListenerPoller(m_serverInst.getHandle());
|
||||
final int handle =
|
||||
NetworkTablesJNI.addListener(
|
||||
poller, new String[] {"/foo"}, EnumSet.of(NetworkTableEvent.Kind.kPublish));
|
||||
poller, new String[] {"/foo"}, EnumSet.of(NetworkTableEvent.Kind.PUBLISH));
|
||||
|
||||
// Trigger an event
|
||||
m_clientInst.getEntry("/foo/bar").setDouble(1.0);
|
||||
@@ -87,6 +87,6 @@ class TopicListenerTest {
|
||||
assertNotNull(events[0].topicInfo);
|
||||
assertEquals(m_serverInst.getTopic("/foo/bar"), events[0].topicInfo.getTopic());
|
||||
assertEquals("/foo/bar", events[0].topicInfo.name);
|
||||
assertTrue(events[0].is(NetworkTableEvent.Kind.kPublish));
|
||||
assertTrue(events[0].is(NetworkTableEvent.Kind.PUBLISH));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ TEST_F(ConnectionListenerTest, Polled) {
|
||||
NT_ListenerPoller poller = wpi::nt::CreateListenerPoller(server_inst);
|
||||
ASSERT_NE(poller, 0u);
|
||||
NT_Listener handle = wpi::nt::AddPolledListener(
|
||||
poller, server_inst, wpi::nt::EventFlags::kConnection);
|
||||
poller, server_inst, wpi::nt::EventFlags::CONNECTION);
|
||||
ASSERT_NE(handle, 0u);
|
||||
|
||||
// trigger a connect event
|
||||
@@ -67,7 +67,7 @@ TEST_F(ConnectionListenerTest, Polled) {
|
||||
ASSERT_EQ(result.size(), 1u);
|
||||
EXPECT_EQ(handle, result[0].listener);
|
||||
EXPECT_TRUE(result[0].GetConnectionInfo());
|
||||
EXPECT_EQ(result[0].flags, wpi::nt::EventFlags::kConnected);
|
||||
EXPECT_EQ(result[0].flags, wpi::nt::EventFlags::CONNECTED);
|
||||
|
||||
// trigger a disconnect event
|
||||
wpi::nt::StopClient(client_inst);
|
||||
@@ -81,7 +81,7 @@ TEST_F(ConnectionListenerTest, Polled) {
|
||||
ASSERT_EQ(result.size(), 1u);
|
||||
EXPECT_EQ(handle, result[0].listener);
|
||||
EXPECT_TRUE(result[0].GetConnectionInfo());
|
||||
EXPECT_EQ(result[0].flags, wpi::nt::EventFlags::kDisconnected);
|
||||
EXPECT_EQ(result[0].flags, wpi::nt::EventFlags::DISCONNECTED);
|
||||
}
|
||||
|
||||
class ConnectionListenerVariantTest
|
||||
@@ -92,7 +92,7 @@ TEST_P(ConnectionListenerVariantTest, Threaded) {
|
||||
wpi::util::mutex m;
|
||||
std::vector<wpi::nt::Event> result;
|
||||
auto handle = wpi::nt::AddListener(
|
||||
server_inst, wpi::nt::EventFlags::kConnection, [&](auto& event) {
|
||||
server_inst, wpi::nt::EventFlags::CONNECTION, [&](auto& event) {
|
||||
std::scoped_lock lock{m};
|
||||
result.push_back(event);
|
||||
});
|
||||
@@ -110,7 +110,7 @@ TEST_P(ConnectionListenerVariantTest, Threaded) {
|
||||
ASSERT_EQ(result.size(), 1u);
|
||||
EXPECT_EQ(handle, result[0].listener);
|
||||
EXPECT_TRUE(result[0].GetConnectionInfo());
|
||||
EXPECT_EQ(result[0].flags, wpi::nt::EventFlags::kConnected);
|
||||
EXPECT_EQ(result[0].flags, wpi::nt::EventFlags::CONNECTED);
|
||||
result.clear();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ TEST_P(ConnectionListenerVariantTest, Threaded) {
|
||||
ASSERT_EQ(result.size(), 1u);
|
||||
EXPECT_EQ(handle, result[0].listener);
|
||||
EXPECT_TRUE(result[0].GetConnectionInfo());
|
||||
EXPECT_EQ(result[0].flags, wpi::nt::EventFlags::kDisconnected);
|
||||
EXPECT_EQ(result[0].flags, wpi::nt::EventFlags::DISCONNECTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -979,7 +979,7 @@ TEST_F(LocalStorageTest, ReadQueueLocalRemote) {
|
||||
EXPECT_CALL(network, ClientPublish(_, _, _, _, _)).Times(1);
|
||||
|
||||
auto subBoth =
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", kDefaultPubSubOptions);
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", DEFAULT_PUB_SUB_OPTIONS);
|
||||
auto subLocal =
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", {.disableRemote = true});
|
||||
auto subRemote =
|
||||
@@ -1061,7 +1061,7 @@ TEST_F(LocalStorageTest, ReadQueueInitialLocal) {
|
||||
storage.SetEntryValue(pub, Value::MakeDouble(1.0, 50));
|
||||
|
||||
auto subBoth =
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", kDefaultPubSubOptions);
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", DEFAULT_PUB_SUB_OPTIONS);
|
||||
auto subLocal =
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", {.disableRemote = true});
|
||||
auto subRemote =
|
||||
@@ -1082,7 +1082,7 @@ TEST_F(LocalStorageTest, ReadQueueInitialRemote) {
|
||||
storage.ServerSetValue(remoteTopic, Value::MakeDouble(2.0, 60));
|
||||
|
||||
auto subBoth =
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", kDefaultPubSubOptions);
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", DEFAULT_PUB_SUB_OPTIONS);
|
||||
auto subLocal =
|
||||
storage.Subscribe(fooTopic, NT_DOUBLE, "double", {.disableRemote = true});
|
||||
auto subRemote =
|
||||
|
||||
@@ -41,8 +41,8 @@ void LoggerTest::Check(const std::vector<wpi::nt::Event>& events,
|
||||
ASSERT_EQ(events.size(), count);
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
ASSERT_EQ(events[i].listener, handle);
|
||||
ASSERT_EQ(events[i].flags & wpi::nt::EventFlags::kLogMessage,
|
||||
wpi::nt::EventFlags::kLogMessage);
|
||||
ASSERT_EQ(events[i].flags & wpi::nt::EventFlags::LOG_MESSAGE,
|
||||
wpi::nt::EventFlags::LOG_MESSAGE);
|
||||
auto log = events[i].GetLogMessage();
|
||||
ASSERT_TRUE(log);
|
||||
if (infoMsg) {
|
||||
@@ -61,7 +61,7 @@ void LoggerTest::Check(const std::vector<wpi::nt::Event>& events,
|
||||
TEST_F(LoggerTest, DefaultLogRange) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto handle = wpi::nt::AddPolledListener(poller, m_inst,
|
||||
wpi::nt::EventFlags::kLogMessage);
|
||||
wpi::nt::EventFlags::LOG_MESSAGE);
|
||||
|
||||
Generate();
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ void TopicListenerTest::Connect(unsigned int port) {
|
||||
// Use connection listener to ensure we've connected
|
||||
NT_ListenerPoller poller = wpi::nt::CreateListenerPoller(m_clientInst);
|
||||
wpi::nt::AddPolledListener(poller, m_clientInst,
|
||||
wpi::nt::EventFlags::kConnected);
|
||||
wpi::nt::EventFlags::CONNECTED);
|
||||
bool timedOut = false;
|
||||
if (!wpi::util::WaitForObject(poller, 1.0, &timedOut)) {
|
||||
FAIL() << "client didn't connect to server";
|
||||
@@ -88,14 +88,14 @@ TEST_F(TopicListenerTest, TopicNewLocal) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(
|
||||
poller, wpi::nt::GetTopic(m_serverInst, "/foo"),
|
||||
wpi::nt::EventFlags::kPublish);
|
||||
wpi::nt::EventFlags::PUBLISH);
|
||||
|
||||
PublishTopics(m_serverInst);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::kPublish, "/foo");
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::PUBLISH, "/foo");
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, DISABLED_TopicNewRemote) {
|
||||
@@ -106,7 +106,7 @@ TEST_F(TopicListenerTest, DISABLED_TopicNewRemote) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(
|
||||
poller, wpi::nt::GetTopic(m_serverInst, "/foo"),
|
||||
wpi::nt::EventFlags::kPublish);
|
||||
wpi::nt::EventFlags::PUBLISH);
|
||||
|
||||
PublishTopics(m_clientInst);
|
||||
|
||||
@@ -116,7 +116,7 @@ TEST_F(TopicListenerTest, DISABLED_TopicNewRemote) {
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::kPublish, "/foo");
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::PUBLISH, "/foo");
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, TopicPublishImm) {
|
||||
@@ -125,13 +125,13 @@ TEST_F(TopicListenerTest, TopicPublishImm) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(
|
||||
poller, wpi::nt::GetTopic(m_serverInst, "/foo"),
|
||||
wpi::nt::EventFlags::kPublish | wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::PUBLISH | wpi::nt::EventFlags::IMMEDIATE);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle,
|
||||
wpi::nt::EventFlags::kPublish | wpi::nt::EventFlags::kImmediate,
|
||||
wpi::nt::EventFlags::PUBLISH | wpi::nt::EventFlags::IMMEDIATE,
|
||||
"/foo");
|
||||
}
|
||||
|
||||
@@ -140,9 +140,9 @@ TEST_F(TopicListenerTest, TopicUnpublishPropsImm) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
wpi::nt::AddPolledListener(poller, wpi::nt::GetTopic(m_serverInst, "/foo"),
|
||||
wpi::nt::EventFlags::kUnpublish |
|
||||
wpi::nt::EventFlags::kProperties |
|
||||
wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::UNPUBLISH |
|
||||
wpi::nt::EventFlags::PROPERTIES |
|
||||
wpi::nt::EventFlags::IMMEDIATE);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_FALSE(wpi::util::WaitForObject(poller, 0.02, &timedOut));
|
||||
@@ -154,8 +154,8 @@ TEST_F(TopicListenerTest, TopicUnpublishLocal) {
|
||||
auto topic = wpi::nt::GetTopic(m_serverInst, "/foo");
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(poller, topic,
|
||||
wpi::nt::EventFlags::kUnpublish);
|
||||
auto handle =
|
||||
wpi::nt::AddPolledListener(poller, topic, wpi::nt::EventFlags::UNPUBLISH);
|
||||
|
||||
auto pub = wpi::nt::Publish(topic, NT_DOUBLE, "double");
|
||||
wpi::nt::Unpublish(pub);
|
||||
@@ -163,7 +163,7 @@ TEST_F(TopicListenerTest, TopicUnpublishLocal) {
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::kUnpublish, "/foo");
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::UNPUBLISH, "/foo");
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, DISABLED_TopicUnpublishRemote) {
|
||||
@@ -174,7 +174,7 @@ TEST_F(TopicListenerTest, DISABLED_TopicUnpublishRemote) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(
|
||||
poller, wpi::nt::GetTopic(m_serverInst, "/foo"),
|
||||
wpi::nt::EventFlags::kUnpublish);
|
||||
wpi::nt::EventFlags::UNPUBLISH);
|
||||
|
||||
auto pub = wpi::nt::Publish(wpi::nt::GetTopic(m_clientInst, "/foo"),
|
||||
NT_DOUBLE, "double");
|
||||
@@ -189,7 +189,7 @@ TEST_F(TopicListenerTest, DISABLED_TopicUnpublishRemote) {
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::kUnpublish, "/foo");
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::UNPUBLISH, "/foo");
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, TopicPropertiesLocal) {
|
||||
@@ -197,14 +197,14 @@ TEST_F(TopicListenerTest, TopicPropertiesLocal) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(poller, topic,
|
||||
wpi::nt::EventFlags::kProperties);
|
||||
wpi::nt::EventFlags::PROPERTIES);
|
||||
|
||||
wpi::nt::SetTopicProperty(topic, "foo", 5);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::kProperties, "/foo");
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::PROPERTIES, "/foo");
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, DISABLED_TopicPropertiesRemote) {
|
||||
@@ -219,7 +219,7 @@ TEST_F(TopicListenerTest, DISABLED_TopicPropertiesRemote) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(
|
||||
poller, wpi::nt::GetTopic(m_serverInst, "/foo"),
|
||||
wpi::nt::EventFlags::kProperties);
|
||||
wpi::nt::EventFlags::PROPERTIES);
|
||||
wpi::nt::FlushLocal(m_serverInst);
|
||||
|
||||
wpi::nt::SetTopicProperty(wpi::nt::GetTopic(m_clientInst, "/foo"), "foo", 5);
|
||||
@@ -229,20 +229,20 @@ TEST_F(TopicListenerTest, DISABLED_TopicPropertiesRemote) {
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::kProperties, "/foo");
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::PROPERTIES, "/foo");
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, PrefixPublishLocal) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(poller, {{"/foo/"}},
|
||||
wpi::nt::EventFlags::kPublish);
|
||||
wpi::nt::EventFlags::PUBLISH);
|
||||
|
||||
PublishTopics(m_serverInst);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::kPublish);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::PUBLISH);
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, DISABLED_PrefixPublishRemote) {
|
||||
@@ -252,7 +252,7 @@ TEST_F(TopicListenerTest, DISABLED_PrefixPublishRemote) {
|
||||
}
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(poller, {{"/foo/"}},
|
||||
wpi::nt::EventFlags::kPublish);
|
||||
wpi::nt::EventFlags::PUBLISH);
|
||||
|
||||
PublishTopics(m_clientInst);
|
||||
|
||||
@@ -262,7 +262,7 @@ TEST_F(TopicListenerTest, DISABLED_PrefixPublishRemote) {
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::kPublish);
|
||||
CheckEvents(events, handle, wpi::nt::EventFlags::PUBLISH);
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, PrefixPublishImm) {
|
||||
@@ -271,13 +271,13 @@ TEST_F(TopicListenerTest, PrefixPublishImm) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
auto handle = wpi::nt::AddPolledListener(
|
||||
poller, {{"/foo/"}},
|
||||
wpi::nt::EventFlags::kPublish | wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::PUBLISH | wpi::nt::EventFlags::IMMEDIATE);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
auto events = wpi::nt::ReadListenerQueue(poller);
|
||||
CheckEvents(events, handle,
|
||||
wpi::nt::EventFlags::kPublish | wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::PUBLISH | wpi::nt::EventFlags::IMMEDIATE);
|
||||
}
|
||||
|
||||
TEST_F(TopicListenerTest, PrefixUnpublishPropsImm) {
|
||||
@@ -285,9 +285,9 @@ TEST_F(TopicListenerTest, PrefixUnpublishPropsImm) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_serverInst);
|
||||
wpi::nt::AddPolledListener(poller, {{"/foo/"}},
|
||||
wpi::nt::EventFlags::kUnpublish |
|
||||
wpi::nt::EventFlags::kProperties |
|
||||
wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::UNPUBLISH |
|
||||
wpi::nt::EventFlags::PROPERTIES |
|
||||
wpi::nt::EventFlags::IMMEDIATE);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_FALSE(wpi::util::WaitForObject(poller, 0.02, &timedOut));
|
||||
|
||||
@@ -37,11 +37,11 @@ TEST_F(ValueListenerTest, MultiPollSub) {
|
||||
auto poller2 = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto poller3 = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h1 = wpi::nt::AddPolledListener(poller1, sub,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
auto h2 = wpi::nt::AddPolledListener(poller2, sub,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
auto h3 = wpi::nt::AddPolledListener(poller3, sub,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
|
||||
wpi::nt::SetDouble(pub, 0);
|
||||
|
||||
@@ -57,7 +57,7 @@ TEST_F(ValueListenerTest, MultiPollSub) {
|
||||
auto results3 = wpi::nt::ReadListenerQueue(poller3);
|
||||
|
||||
ASSERT_EQ(results1.size(), 1u);
|
||||
EXPECT_EQ(results1[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results1[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results1[0].listener, h1);
|
||||
auto valueData = results1[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -66,7 +66,7 @@ TEST_F(ValueListenerTest, MultiPollSub) {
|
||||
EXPECT_EQ(valueData->value, wpi::nt::Value::MakeDouble(0.0));
|
||||
|
||||
ASSERT_EQ(results2.size(), 1u);
|
||||
EXPECT_EQ(results2[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results2[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results2[0].listener, h2);
|
||||
valueData = results2[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -75,7 +75,7 @@ TEST_F(ValueListenerTest, MultiPollSub) {
|
||||
EXPECT_EQ(valueData->value, wpi::nt::Value::MakeDouble(0.0));
|
||||
|
||||
ASSERT_EQ(results3.size(), 1u);
|
||||
EXPECT_EQ(results3[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results3[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results3[0].listener, h3);
|
||||
valueData = results3[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -92,9 +92,9 @@ TEST_F(ValueListenerTest, PollMultiSub) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h1 = wpi::nt::AddPolledListener(poller, sub1,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
auto h2 = wpi::nt::AddPolledListener(poller, sub2,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
|
||||
wpi::nt::SetDouble(pub, 0);
|
||||
|
||||
@@ -104,7 +104,7 @@ TEST_F(ValueListenerTest, PollMultiSub) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 2u);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[0].listener, h1);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -112,7 +112,7 @@ TEST_F(ValueListenerTest, PollMultiSub) {
|
||||
EXPECT_EQ(valueData->topic, topic);
|
||||
EXPECT_EQ(valueData->value, wpi::nt::Value::MakeDouble(0.0));
|
||||
|
||||
EXPECT_EQ(results[1].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[1].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[1].listener, h2);
|
||||
valueData = results[1].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -131,9 +131,9 @@ TEST_F(ValueListenerTest, PollMultiSubTopic) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h1 = wpi::nt::AddPolledListener(poller, sub1,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
auto h2 = wpi::nt::AddPolledListener(poller, sub2,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
|
||||
wpi::nt::SetDouble(pub1, 0);
|
||||
wpi::nt::SetDouble(pub2, 1);
|
||||
@@ -144,7 +144,7 @@ TEST_F(ValueListenerTest, PollMultiSubTopic) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 2u);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[0].listener, h1);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -152,7 +152,7 @@ TEST_F(ValueListenerTest, PollMultiSubTopic) {
|
||||
EXPECT_EQ(valueData->topic, topic1);
|
||||
EXPECT_EQ(valueData->value, wpi::nt::Value::MakeDouble(0.0));
|
||||
|
||||
EXPECT_EQ(results[1].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[1].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[1].listener, h2);
|
||||
valueData = results[1].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -170,7 +170,7 @@ TEST_F(ValueListenerTest, PollSubMultiple) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h =
|
||||
wpi::nt::AddPolledListener(poller, sub, wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::AddPolledListener(poller, sub, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
|
||||
wpi::nt::SetDouble(pub1, 0);
|
||||
wpi::nt::SetDouble(pub2, 1);
|
||||
@@ -181,7 +181,7 @@ TEST_F(ValueListenerTest, PollSubMultiple) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 2u);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[0].listener, h);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -189,7 +189,7 @@ TEST_F(ValueListenerTest, PollSubMultiple) {
|
||||
EXPECT_EQ(valueData->topic, topic1);
|
||||
EXPECT_EQ(valueData->value, wpi::nt::Value::MakeDouble(0.0));
|
||||
|
||||
EXPECT_EQ(results[1].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[1].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[1].listener, h);
|
||||
valueData = results[1].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -201,7 +201,7 @@ TEST_F(ValueListenerTest, PollSubMultiple) {
|
||||
TEST_F(ValueListenerTest, PollSubPrefixCreated) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h = wpi::nt::AddPolledListener(poller, {{"foo"}},
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
|
||||
auto topic1 = wpi::nt::GetTopic(m_inst, "foo/1");
|
||||
auto topic2 = wpi::nt::GetTopic(m_inst, "foo/2");
|
||||
@@ -220,14 +220,14 @@ TEST_F(ValueListenerTest, PollSubPrefixCreated) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 2u);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[0].listener, h);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
EXPECT_EQ(valueData->topic, topic1);
|
||||
EXPECT_EQ(valueData->value, wpi::nt::Value::MakeDouble(0.0));
|
||||
|
||||
EXPECT_EQ(results[1].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[1].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[1].listener, h);
|
||||
valueData = results[1].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -240,7 +240,7 @@ TEST_F(ValueListenerTest, PollEntry) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h = wpi::nt::AddPolledListener(poller, entry,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
|
||||
ASSERT_TRUE(wpi::nt::SetDouble(entry, 0));
|
||||
|
||||
@@ -250,7 +250,7 @@ TEST_F(ValueListenerTest, PollEntry) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 1u);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[0].listener, h);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -266,7 +266,7 @@ TEST_F(ValueListenerTest, PollImmediate) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h = wpi::nt::AddPolledListener(
|
||||
poller, entry,
|
||||
wpi::nt::EventFlags::kValueLocal | wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL | wpi::nt::EventFlags::IMMEDIATE);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
@@ -274,9 +274,9 @@ TEST_F(ValueListenerTest, PollImmediate) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 1u);
|
||||
EXPECT_EQ(results[0].flags & (wpi::nt::EventFlags::kValueLocal |
|
||||
wpi::nt::EventFlags::kImmediate),
|
||||
wpi::nt::EventFlags::kValueLocal | wpi::nt::EventFlags::kImmediate);
|
||||
EXPECT_EQ(results[0].flags & (wpi::nt::EventFlags::VALUE_LOCAL |
|
||||
wpi::nt::EventFlags::IMMEDIATE),
|
||||
wpi::nt::EventFlags::VALUE_LOCAL | wpi::nt::EventFlags::IMMEDIATE);
|
||||
EXPECT_EQ(results[0].listener, h);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -291,7 +291,7 @@ TEST_F(ValueListenerTest, PollImmediateNoValue) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h = wpi::nt::AddPolledListener(
|
||||
poller, entry,
|
||||
wpi::nt::EventFlags::kValueLocal | wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL | wpi::nt::EventFlags::IMMEDIATE);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_FALSE(wpi::util::WaitForObject(poller, 0.02, &timedOut));
|
||||
@@ -307,7 +307,7 @@ TEST_F(ValueListenerTest, PollImmediateNoValue) {
|
||||
ASSERT_FALSE(timedOut);
|
||||
|
||||
ASSERT_EQ(results.size(), 1u);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[0].flags, wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[0].listener, h);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -328,7 +328,7 @@ TEST_F(ValueListenerTest, PollImmediateSubMultiple) {
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h = wpi::nt::AddPolledListener(
|
||||
poller, sub,
|
||||
wpi::nt::EventFlags::kValueLocal | wpi::nt::EventFlags::kImmediate);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL | wpi::nt::EventFlags::IMMEDIATE);
|
||||
|
||||
bool timedOut = false;
|
||||
ASSERT_TRUE(wpi::util::WaitForObject(poller, 1.0, &timedOut));
|
||||
@@ -336,9 +336,9 @@ TEST_F(ValueListenerTest, PollImmediateSubMultiple) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 2u);
|
||||
EXPECT_EQ(results[0].flags & (wpi::nt::EventFlags::kValueLocal |
|
||||
wpi::nt::EventFlags::kImmediate),
|
||||
wpi::nt::EventFlags::kValueLocal | wpi::nt::EventFlags::kImmediate);
|
||||
EXPECT_EQ(results[0].flags & (wpi::nt::EventFlags::VALUE_LOCAL |
|
||||
wpi::nt::EventFlags::IMMEDIATE),
|
||||
wpi::nt::EventFlags::VALUE_LOCAL | wpi::nt::EventFlags::IMMEDIATE);
|
||||
EXPECT_EQ(results[0].listener, h);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -346,9 +346,9 @@ TEST_F(ValueListenerTest, PollImmediateSubMultiple) {
|
||||
EXPECT_EQ(valueData->topic, topic1);
|
||||
EXPECT_EQ(valueData->value, wpi::nt::Value::MakeDouble(0.0));
|
||||
|
||||
EXPECT_EQ(results[1].flags & (wpi::nt::EventFlags::kValueLocal |
|
||||
wpi::nt::EventFlags::kImmediate),
|
||||
wpi::nt::EventFlags::kValueLocal | wpi::nt::EventFlags::kImmediate);
|
||||
EXPECT_EQ(results[1].flags & (wpi::nt::EventFlags::VALUE_LOCAL |
|
||||
wpi::nt::EventFlags::IMMEDIATE),
|
||||
wpi::nt::EventFlags::VALUE_LOCAL | wpi::nt::EventFlags::IMMEDIATE);
|
||||
EXPECT_EQ(results[1].listener, h);
|
||||
valueData = results[1].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -366,7 +366,7 @@ TEST_F(ValueListenerTest, TwoSubOneListener) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h = wpi::nt::AddPolledListener(poller, sub1,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
(void)sub2;
|
||||
(void)sub3;
|
||||
|
||||
@@ -378,8 +378,8 @@ TEST_F(ValueListenerTest, TwoSubOneListener) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 1u);
|
||||
EXPECT_EQ(results[0].flags & wpi::nt::EventFlags::kValueLocal,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[0].flags & wpi::nt::EventFlags::VALUE_LOCAL,
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[0].listener, h);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
@@ -397,7 +397,7 @@ TEST_F(ValueListenerTest, TwoSubOneMultiListener) {
|
||||
|
||||
auto poller = wpi::nt::CreateListenerPoller(m_inst);
|
||||
auto h = wpi::nt::AddPolledListener(poller, sub3,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
(void)sub1;
|
||||
(void)sub2;
|
||||
|
||||
@@ -409,8 +409,8 @@ TEST_F(ValueListenerTest, TwoSubOneMultiListener) {
|
||||
auto results = wpi::nt::ReadListenerQueue(poller);
|
||||
|
||||
ASSERT_EQ(results.size(), 1u);
|
||||
EXPECT_EQ(results[0].flags & wpi::nt::EventFlags::kValueLocal,
|
||||
wpi::nt::EventFlags::kValueLocal);
|
||||
EXPECT_EQ(results[0].flags & wpi::nt::EventFlags::VALUE_LOCAL,
|
||||
wpi::nt::EventFlags::VALUE_LOCAL);
|
||||
EXPECT_EQ(results[0].listener, h);
|
||||
auto valueData = results[0].GetValueEventData();
|
||||
ASSERT_TRUE(valueData);
|
||||
|
||||
@@ -43,7 +43,7 @@ def test_ntproperty(nt: NetworkTableInstance):
|
||||
"/SmartDashboard/testFloatArray",
|
||||
[1.1, 1.2, 1.3],
|
||||
writeDefault=True,
|
||||
type=NetworkTableType.kFloatArray,
|
||||
type=NetworkTableType.FLOAT_ARRAY,
|
||||
inst=nt,
|
||||
)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ def test_mkvalue_bool():
|
||||
|
||||
|
||||
def test_bool_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kBoolean)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.BOOLEAN)
|
||||
v = f(True)
|
||||
assert v.getBoolean() == True
|
||||
|
||||
@@ -33,7 +33,7 @@ def test_mkvalue_int():
|
||||
|
||||
|
||||
def test_int_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kInteger)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.INTEGER)
|
||||
v = f(2)
|
||||
assert v.getInteger() == 2
|
||||
|
||||
@@ -51,7 +51,7 @@ def test_mkvalue_double():
|
||||
|
||||
|
||||
def test_double_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kDouble)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.DOUBLE)
|
||||
v = f(2.2)
|
||||
assert v.getDouble() == pytest.approx(2.2)
|
||||
|
||||
@@ -67,7 +67,7 @@ def test_mkvalue_float():
|
||||
|
||||
|
||||
def test_float_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kFloat)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.FLOAT)
|
||||
v = f(2.2)
|
||||
assert v.getFloat() == pytest.approx(2.2)
|
||||
|
||||
@@ -85,7 +85,7 @@ def test_mkvalue_str():
|
||||
|
||||
|
||||
def test_str_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kString)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.STRING)
|
||||
v = f("abc")
|
||||
assert v.getString() == "abc"
|
||||
|
||||
@@ -103,7 +103,7 @@ def test_mkvalue_raw():
|
||||
|
||||
|
||||
def test_raw_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kRaw)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.RAW)
|
||||
v = f(b"raw")
|
||||
assert v.getRaw() == b"raw"
|
||||
|
||||
@@ -121,7 +121,7 @@ def test_mkvalue_bool_list():
|
||||
|
||||
|
||||
def test_bool_list_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kBooleanArray)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.BOOLEAN_ARRAY)
|
||||
v = f([True, False])
|
||||
assert v.getBooleanArray() == [True, False]
|
||||
|
||||
@@ -139,7 +139,7 @@ def test_mkvalue_int_list():
|
||||
|
||||
|
||||
def test_int_list_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kIntegerArray)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.INTEGER_ARRAY)
|
||||
v = f([1, 2])
|
||||
assert v.getIntegerArray() == [1, 2]
|
||||
|
||||
@@ -157,7 +157,7 @@ def test_mkvalue_double_list():
|
||||
|
||||
|
||||
def test_double_list_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kDoubleArray)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.DOUBLE_ARRAY)
|
||||
v = f([1.1, 2.2])
|
||||
assert v.getDoubleArray() == [pytest.approx(1.1), pytest.approx(2.2)]
|
||||
|
||||
@@ -173,7 +173,7 @@ def test_mkvalue_float_list():
|
||||
|
||||
|
||||
def test_float_list_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kFloatArray)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.FLOAT_ARRAY)
|
||||
v = f([1.1, 2.2])
|
||||
assert v.getFloatArray() == [pytest.approx(1.1), pytest.approx(2.2)]
|
||||
|
||||
@@ -191,6 +191,6 @@ def test_mkvalue_str_list():
|
||||
|
||||
|
||||
def test_str_list_factory():
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.kStringArray)
|
||||
f = ntcore.Value.getFactoryByType(ntcore.NetworkTableType.STRING_ARRAY)
|
||||
v = f(["a", "b"])
|
||||
assert v.getStringArray() == ["a", "b"]
|
||||
|
||||
@@ -55,7 +55,7 @@ class MatchDataSenderEntry {
|
||||
const std::shared_ptr<wpi::nt::NetworkTable>& table, std::string_view key,
|
||||
typename Topic::ParamType initialVal,
|
||||
wpi::util::json topicProperties = wpi::util::json::object())
|
||||
: publisher{Topic{table->GetTopic(key)}.PublishEx(Topic::kTypeString,
|
||||
: publisher{Topic{table->GetTopic(key)}.PublishEx(Topic::TYPE_STRING,
|
||||
topicProperties)},
|
||||
prevVal{initialVal} {
|
||||
publisher.Set(initialVal);
|
||||
|
||||
@@ -28,7 +28,7 @@ MechanismLigament2d::MechanismLigament2d(std::string_view name, double length,
|
||||
void MechanismLigament2d::UpdateEntries(
|
||||
std::shared_ptr<wpi::nt::NetworkTable> table) {
|
||||
m_typePub = table->GetStringTopic(".type").PublishEx(
|
||||
wpi::nt::StringTopic::kTypeString,
|
||||
wpi::nt::StringTopic::TYPE_STRING,
|
||||
{{"SmartDashboard", kSmartDashboardType}});
|
||||
m_typePub.Set(kSmartDashboardType);
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ void SendableBuilderImpl::ClearProperties() {
|
||||
void SendableBuilderImpl::SetSmartDashboardType(std::string_view type) {
|
||||
if (!m_typePublisher) {
|
||||
m_typePublisher = m_table->GetStringTopic(".type").PublishEx(
|
||||
wpi::nt::StringTopic::kTypeString, {{"SmartDashboard", type}});
|
||||
wpi::nt::StringTopic::TYPE_STRING, {{"SmartDashboard", type}});
|
||||
}
|
||||
m_typePublisher.Set(type);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ struct Instance {
|
||||
wpi::nt::NetworkTableInstance::GetDefault().GetTable(kTableName)};
|
||||
wpi::nt::StringPublisher typePublisher{
|
||||
table->GetStringTopic(".type").PublishEx(
|
||||
wpi::nt::StringTopic::kTypeString,
|
||||
wpi::nt::StringTopic::TYPE_STRING,
|
||||
{{"SmartDashboard", kSmartDashboardType}})};
|
||||
wpi::nt::MultiSubscriber tableSubscriber{
|
||||
wpi::nt::NetworkTableInstance::GetDefault(),
|
||||
|
||||
@@ -220,7 +220,7 @@ RobotBase::RobotBase() {
|
||||
|
||||
connListenerHandle =
|
||||
inst.AddConnectionListener(false, [&](const wpi::nt::Event& event) {
|
||||
if (event.Is(wpi::nt::EventFlags::kConnected)) {
|
||||
if (event.Is(wpi::nt::EventFlags::CONNECTED)) {
|
||||
auto connInfo = event.GetConnectionInfo();
|
||||
HAL_ReportUsage(fmt::format("NT/{}", connInfo->remote_id), "");
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ public final class DriverStation {
|
||||
table
|
||||
.getStringTopic(".type")
|
||||
.publishEx(
|
||||
StringTopic.kTypeString, "{\"SmartDashboard\":\"" + kSmartDashboardType + "\"}")
|
||||
StringTopic.TYPE_STRING, "{\"SmartDashboard\":\"" + kSmartDashboardType + "\"}")
|
||||
.set(kSmartDashboardType);
|
||||
gameData = table.getStringTopic("GameData").publish();
|
||||
gameData.set("");
|
||||
|
||||
@@ -111,7 +111,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
// wait for the NT server to actually start
|
||||
try {
|
||||
int count = 0;
|
||||
while (inst.getNetworkMode().contains(NetworkTableInstance.NetworkMode.kStarting)) {
|
||||
while (inst.getNetworkMode().contains(NetworkTableInstance.NetworkMode.STARTING)) {
|
||||
Thread.sleep(10);
|
||||
count++;
|
||||
if (count > 100) {
|
||||
@@ -126,7 +126,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
inst.addConnectionListener(
|
||||
false,
|
||||
event -> {
|
||||
if (event.is(NetworkTableEvent.Kind.kConnected)) {
|
||||
if (event.is(NetworkTableEvent.Kind.CONNECTED)) {
|
||||
HAL.reportUsage("NT/" + event.connInfo.remote_id, "");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -208,7 +208,7 @@ public class MechanismLigament2d extends MechanismObject2d {
|
||||
table
|
||||
.getStringTopic(".type")
|
||||
.publishEx(
|
||||
StringTopic.kTypeString, "{\"SmartDashboard\":\"" + kSmartDashboardType + "\"}");
|
||||
StringTopic.TYPE_STRING, "{\"SmartDashboard\":\"" + kSmartDashboardType + "\"}");
|
||||
m_typePub.set(kSmartDashboardType);
|
||||
|
||||
if (m_angleEntry != null) {
|
||||
|
||||
@@ -230,7 +230,7 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_typePub =
|
||||
m_table
|
||||
.getStringTopic(".type")
|
||||
.publishEx(StringTopic.kTypeString, "{\"SmartDashboard\":\"" + type + "\"}");
|
||||
.publishEx(StringTopic.TYPE_STRING, "{\"SmartDashboard\":\"" + type + "\"}");
|
||||
}
|
||||
m_typePub.set(type);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class Preferences {
|
||||
m_table
|
||||
.getStringTopic(".type")
|
||||
.publishEx(
|
||||
StringTopic.kTypeString, "{\"SmartDashboard\":\"" + kSmartDashboardType + "\"}");
|
||||
StringTopic.TYPE_STRING, "{\"SmartDashboard\":\"" + kSmartDashboardType + "\"}");
|
||||
m_typePublisher.set(kSmartDashboardType);
|
||||
|
||||
// Subscribe to all Preferences; this ensures we get the latest values
|
||||
@@ -87,7 +87,7 @@ public final class Preferences {
|
||||
m_listener =
|
||||
NetworkTableListener.createListener(
|
||||
m_tableSubscriber,
|
||||
EnumSet.of(NetworkTableEvent.Kind.kImmediate, NetworkTableEvent.Kind.kPublish),
|
||||
EnumSet.of(NetworkTableEvent.Kind.IMMEDIATE, NetworkTableEvent.Kind.PUBLISH),
|
||||
event -> {
|
||||
if (event.topicInfo != null) {
|
||||
Topic topic = event.topicInfo.getTopic();
|
||||
|
||||
@@ -55,7 +55,7 @@ class PreferencesTest {
|
||||
m_inst.startServer(filepath.toString(), "", "", 0);
|
||||
try {
|
||||
int count = 0;
|
||||
while (m_inst.getNetworkMode().contains(NetworkTableInstance.NetworkMode.kStarting)) {
|
||||
while (m_inst.getNetworkMode().contains(NetworkTableInstance.NetworkMode.STARTING)) {
|
||||
Thread.sleep(100);
|
||||
count++;
|
||||
if (count > 30) {
|
||||
|
||||
Reference in New Issue
Block a user