mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
[ntcore] Use int for options instead of double
Periodic time is stored in milliseconds.
This commit is contained in:
@@ -65,8 +65,8 @@ public final class NetworkTablesJNI {
|
||||
return rv;
|
||||
}
|
||||
|
||||
private static double[] pubSubOptionValues(PubSubOption... options) {
|
||||
double[] rv = new double[options.length];
|
||||
private static int[] pubSubOptionValues(PubSubOption... options) {
|
||||
int[] rv = new int[options.length];
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
rv[i] = options[i].m_value;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public final class NetworkTablesJNI {
|
||||
public static native int getEntry(int inst, String key);
|
||||
|
||||
private static native int getEntry(
|
||||
int topic, int type, String typeStr, int[] optionTypes, double[] optionValues);
|
||||
int topic, int type, String typeStr, int[] optionTypes, int[] optionValues);
|
||||
|
||||
public static int getEntry(int topic, int type, String typeStr, PubSubOption... options) {
|
||||
return getEntry(topic, type, typeStr, pubSubOptionTypes(options), pubSubOptionValues(options));
|
||||
@@ -137,7 +137,7 @@ public final class NetworkTablesJNI {
|
||||
public static native void setTopicProperties(int topic, String properties);
|
||||
|
||||
private static native int subscribe(
|
||||
int topic, int type, String typeStr, int[] optionTypes, double[] optionValues);
|
||||
int topic, int type, String typeStr, int[] optionTypes, int[] optionValues);
|
||||
|
||||
public static int subscribe(int topic, int type, String typeStr, PubSubOption... options) {
|
||||
return subscribe(topic, type, typeStr, pubSubOptionTypes(options), pubSubOptionValues(options));
|
||||
@@ -146,14 +146,14 @@ public final class NetworkTablesJNI {
|
||||
public static native void unsubscribe(int sub);
|
||||
|
||||
private static native int publish(
|
||||
int topic, int type, String typeStr, int[] optionTypes, double[] optionValues);
|
||||
int topic, int type, String typeStr, int[] optionTypes, int[] optionValues);
|
||||
|
||||
public static int publish(int topic, int type, String typeStr, PubSubOption... options) {
|
||||
return publish(topic, type, typeStr, pubSubOptionTypes(options), pubSubOptionValues(options));
|
||||
}
|
||||
|
||||
private static native int publishEx(
|
||||
int topic, int type, String typeStr, String properties, int[] optionTypes, double[] optionValues);
|
||||
int topic, int type, String typeStr, String properties, int[] optionTypes, int[] optionValues);
|
||||
|
||||
public static int publishEx(int topic, int type, String typeStr, String properties, PubSubOption... options) {
|
||||
return publishEx(topic, type, typeStr, properties, pubSubOptionTypes(options), pubSubOptionValues(options));
|
||||
@@ -168,7 +168,7 @@ public final class NetworkTablesJNI {
|
||||
public static native int getTopicFromHandle(int pubsubentry);
|
||||
|
||||
private static native int subscribeMultiple(
|
||||
int inst, String[] prefixes, int[] optionTypes, double[] optionValues);
|
||||
int inst, String[] prefixes, int[] optionTypes, int[] optionValues);
|
||||
|
||||
public static int subscribeMultiple(int inst, String[] prefixes, PubSubOption... options) {
|
||||
return subscribeMultiple(
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PubSubOption {
|
||||
private static final int kKeepDuplicates = 5;
|
||||
private static final int kLocalRemote = 6;
|
||||
|
||||
PubSubOption(int type, double value) {
|
||||
PubSubOption(int type, int value) {
|
||||
m_type = type;
|
||||
m_value = value;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
public static PubSubOption periodic(double period) {
|
||||
return new PubSubOption(kPeriodic, period);
|
||||
return new PubSubOption(kPeriodic, (int) (period * 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ public class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
public static PubSubOption sendAll(boolean enabled) {
|
||||
return new PubSubOption(kSendAll, enabled ? 1.0 : 0.0);
|
||||
return new PubSubOption(kSendAll, enabled ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ public class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
public static PubSubOption topicsOnly(boolean enabled) {
|
||||
return new PubSubOption(kTopicsOnly, enabled ? 1.0 : 0.0);
|
||||
return new PubSubOption(kTopicsOnly, enabled ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ public class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
public static PubSubOption keepDuplicates(boolean enabled) {
|
||||
return new PubSubOption(kKeepDuplicates, enabled ? 1.0 : 0.0);
|
||||
return new PubSubOption(kKeepDuplicates, enabled ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ public class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
public static PubSubOption localOnly() {
|
||||
return new PubSubOption(kLocalRemote, 1.0);
|
||||
return new PubSubOption(kLocalRemote, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ public class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
public static PubSubOption remoteOnly() {
|
||||
return new PubSubOption(kLocalRemote, 2.0);
|
||||
return new PubSubOption(kLocalRemote, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,9 +102,9 @@ public class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
public static PubSubOption allUpdates() {
|
||||
return new PubSubOption(kLocalRemote, 0.0);
|
||||
return new PubSubOption(kLocalRemote, 0);
|
||||
}
|
||||
|
||||
final int m_type;
|
||||
final double m_value;
|
||||
final int m_value;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ nt::PubSubOptions::PubSubOptions(std::span<const PubSubOption> options) {
|
||||
for (auto&& option : options) {
|
||||
switch (option.type) {
|
||||
case NT_PUBSUB_PERIODIC:
|
||||
periodic = option.value;
|
||||
periodicMs = option.value;
|
||||
break;
|
||||
case NT_PUBSUB_SENDALL:
|
||||
sendAll = option.value != 0;
|
||||
|
||||
@@ -16,7 +16,9 @@ class PubSubOptions {
|
||||
PubSubOptions() = default;
|
||||
explicit PubSubOptions(std::span<const PubSubOption> options);
|
||||
|
||||
double periodic = 0.1;
|
||||
static constexpr unsigned int kDefaultPeriodicMs = 100;
|
||||
|
||||
unsigned int periodicMs = kDefaultPeriodicMs;
|
||||
size_t pollStorageSize = 1;
|
||||
bool sendAll = false;
|
||||
bool topicsOnly = false;
|
||||
|
||||
@@ -118,10 +118,10 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) {
|
||||
//
|
||||
|
||||
static std::span<const nt::PubSubOption> FromJavaPubSubOptions(
|
||||
JNIEnv* env, jintArray optionTypes, jdoubleArray optionValues,
|
||||
JNIEnv* env, jintArray optionTypes, jintArray optionValues,
|
||||
wpi::SmallVectorImpl<nt::PubSubOption>& arr) {
|
||||
JIntArrayRef types{env, optionTypes};
|
||||
JDoubleArrayRef values{env, optionValues};
|
||||
JIntArrayRef values{env, optionValues};
|
||||
if (types.size() != values.size()) {
|
||||
return {};
|
||||
}
|
||||
@@ -720,12 +720,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_setTopicProperties
|
||||
/*
|
||||
* Class: edu_wpi_first_networktables_NetworkTablesJNI
|
||||
* Method: subscribe
|
||||
* Signature: (IILjava/lang/String;[I[D)I
|
||||
* Signature: (IILjava/lang/String;[I[I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_networktables_NetworkTablesJNI_subscribe
|
||||
(JNIEnv* env, jclass, jint topic, jint type, jstring typeStr,
|
||||
jintArray optionTypes, jdoubleArray optionValues)
|
||||
jintArray optionTypes, jintArray optionValues)
|
||||
{
|
||||
wpi::SmallVector<nt::PubSubOption, 4> options;
|
||||
return nt::Subscribe(
|
||||
@@ -748,12 +748,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_unsubscribe
|
||||
/*
|
||||
* Class: edu_wpi_first_networktables_NetworkTablesJNI
|
||||
* Method: publish
|
||||
* Signature: (IILjava/lang/String;[I[D)I
|
||||
* Signature: (IILjava/lang/String;[I[I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_networktables_NetworkTablesJNI_publish
|
||||
(JNIEnv* env, jclass, jint topic, jint type, jstring typeStr,
|
||||
jintArray optionTypes, jdoubleArray optionValues)
|
||||
jintArray optionTypes, jintArray optionValues)
|
||||
{
|
||||
wpi::SmallVector<nt::PubSubOption, 4> options;
|
||||
return nt::Publish(
|
||||
@@ -764,12 +764,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_publish
|
||||
/*
|
||||
* Class: edu_wpi_first_networktables_NetworkTablesJNI
|
||||
* Method: publishEx
|
||||
* Signature: (IILjava/lang/String;Ljava/lang/String;[I[D)I
|
||||
* Signature: (IILjava/lang/String;Ljava/lang/String;[I[I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_networktables_NetworkTablesJNI_publishEx
|
||||
(JNIEnv* env, jclass, jint topic, jint type, jstring typeStr,
|
||||
jstring properties, jintArray optionTypes, jdoubleArray optionValues)
|
||||
jstring properties, jintArray optionTypes, jintArray optionValues)
|
||||
{
|
||||
wpi::json j;
|
||||
try {
|
||||
@@ -804,12 +804,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_unpublish
|
||||
/*
|
||||
* Class: edu_wpi_first_networktables_NetworkTablesJNI
|
||||
* Method: getEntry
|
||||
* Signature: (IILjava/lang/String;[I[D)I
|
||||
* Signature: (IILjava/lang/String;[I[I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntry__IILjava_lang_String_2_3I_3D
|
||||
Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntry__IILjava_lang_String_2_3I_3I
|
||||
(JNIEnv* env, jclass, jint topic, jint type, jstring typeStr,
|
||||
jintArray optionTypes, jdoubleArray optionValues)
|
||||
jintArray optionTypes, jintArray optionValues)
|
||||
{
|
||||
wpi::SmallVector<nt::PubSubOption, 4> options;
|
||||
return nt::GetEntry(
|
||||
@@ -856,12 +856,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_getTopicFromHandle
|
||||
/*
|
||||
* Class: edu_wpi_first_networktables_NetworkTablesJNI
|
||||
* Method: subscribeMultiple
|
||||
* Signature: (I[Ljava/lang/Object;[I[D)I
|
||||
* Signature: (I[Ljava/lang/Object;[I[I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_networktables_NetworkTablesJNI_subscribeMultiple
|
||||
(JNIEnv* env, jclass, jint inst, jobjectArray prefixes, jintArray optionTypes,
|
||||
jdoubleArray optionValues)
|
||||
jintArray optionValues)
|
||||
{
|
||||
if (!prefixes) {
|
||||
nullPointerEx.Throw(env, "prefixes cannot be null");
|
||||
|
||||
@@ -293,7 +293,7 @@ void CImpl::Publish(NT_Publisher pubHandle, NT_Topic topicHandle,
|
||||
}
|
||||
publisher->handle = pubHandle;
|
||||
publisher->options = options;
|
||||
publisher->periodMs = std::lround(options.periodic * 100) * 10;
|
||||
publisher->periodMs = std::lround(options.periodicMs / 10.0) * 10;
|
||||
if (publisher->periodMs < kMinPeriodMs) {
|
||||
publisher->periodMs = kMinPeriodMs;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ struct SubscriberData {
|
||||
topicNames{topicNames.begin(), topicNames.end()},
|
||||
subuid{subuid},
|
||||
options{options},
|
||||
periodMs(std::lround(options.periodic * 100) * 10) {
|
||||
periodMs(std::lround(options.periodicMs / 10.0) * 10) {
|
||||
if (periodMs < kMinPeriodMs) {
|
||||
periodMs = kMinPeriodMs;
|
||||
}
|
||||
@@ -377,7 +377,7 @@ struct SubscriberData {
|
||||
const PubSubOptions& options_) {
|
||||
topicNames = {topicNames_.begin(), topicNames_.end()};
|
||||
options = options_;
|
||||
periodMs = std::lround(options_.periodic * 100) * 10;
|
||||
periodMs = std::lround(options_.periodicMs / 10.0) * 10;
|
||||
if (periodMs < kMinPeriodMs) {
|
||||
periodMs = kMinPeriodMs;
|
||||
}
|
||||
@@ -465,7 +465,8 @@ struct Writer : public mpack_writer_t {
|
||||
|
||||
static void WriteOptions(mpack_writer_t& w, const PubSubOptions& options) {
|
||||
int size = (options.sendAll ? 1 : 0) + (options.topicsOnly ? 1 : 0) +
|
||||
(options.periodic != 0.1 ? 1 : 0) + (options.prefixMatch ? 1 : 0);
|
||||
(options.periodicMs != PubSubOptions::kDefaultPeriodicMs ? 1 : 0) +
|
||||
(options.prefixMatch ? 1 : 0);
|
||||
mpack_start_map(&w, size);
|
||||
if (options.sendAll) {
|
||||
mpack_write_str(&w, "all");
|
||||
@@ -475,9 +476,9 @@ static void WriteOptions(mpack_writer_t& w, const PubSubOptions& options) {
|
||||
mpack_write_str(&w, "topicsonly");
|
||||
mpack_write_bool(&w, true);
|
||||
}
|
||||
if (options.periodic != 0.1) {
|
||||
if (options.periodicMs != PubSubOptions::kDefaultPeriodicMs) {
|
||||
mpack_write_str(&w, "periodic");
|
||||
mpack_write_float(&w, options.periodic);
|
||||
mpack_write_float(&w, options.periodicMs / 1000.0);
|
||||
}
|
||||
if (options.prefixMatch) {
|
||||
mpack_write_str(&w, "prefix");
|
||||
|
||||
@@ -238,10 +238,12 @@ static void WireDecodeTextImpl(std::string_view in, T& out,
|
||||
// periodic
|
||||
auto periodicIt = joptions->find("periodic");
|
||||
if (periodicIt != joptions->end()) {
|
||||
if (!GetNumber(periodicIt->second, &options.periodic)) {
|
||||
double val;
|
||||
if (!GetNumber(periodicIt->second, &val)) {
|
||||
error = "periodic value must be a number";
|
||||
goto err;
|
||||
}
|
||||
options.periodicMs = val * 1000;
|
||||
}
|
||||
|
||||
// send all changes
|
||||
|
||||
@@ -99,12 +99,12 @@ static void WireEncodeSubscribeImpl(wpi::raw_ostream& os, int64_t subuid,
|
||||
os << "\"prefix\":true";
|
||||
first = false;
|
||||
}
|
||||
if (options.periodic != 0.1) {
|
||||
if (options.periodicMs != PubSubOptions::kDefaultPeriodicMs) {
|
||||
if (!first) {
|
||||
os << ',';
|
||||
}
|
||||
os << "\"periodic\":";
|
||||
s.dump_float(options.periodic);
|
||||
s.dump_float(options.periodicMs / 1000.0);
|
||||
}
|
||||
os << "},\"topics\":";
|
||||
EncodePrefixes(os, topicNames, s);
|
||||
|
||||
@@ -330,7 +330,7 @@ void CImpl::Publish(NT_Publisher pubHandle, NT_Topic topicHandle,
|
||||
}
|
||||
publisher->handle = pubHandle;
|
||||
publisher->options = options;
|
||||
publisher->periodMs = std::lround(options.periodic * 100) * 10;
|
||||
publisher->periodMs = std::lround(options.periodicMs / 10.0) * 10;
|
||||
if (publisher->periodMs < 10) {
|
||||
publisher->periodMs = 10;
|
||||
}
|
||||
|
||||
@@ -288,10 +288,11 @@ struct NT_PubSubOption {
|
||||
|
||||
/**
|
||||
* Option value. 1 (true) or 0 (false) for immediate and logging options,
|
||||
* time between updates, in seconds, for periodic option. For local/remote
|
||||
* option, 1=local only, 2=remote only, 0 or 3=both local and remote.
|
||||
* time between updates, in milliseconds, for periodic option. For
|
||||
* local/remote option, 1=local only, 2=remote only, 0 or 3=both local and
|
||||
* remote.
|
||||
*/
|
||||
double value;
|
||||
unsigned int value;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -262,7 +262,7 @@ class Event {
|
||||
/** NetworkTables publish/subscribe option. */
|
||||
class PubSubOption {
|
||||
public:
|
||||
constexpr PubSubOption(NT_PubSubOptionType type, double value)
|
||||
constexpr PubSubOption(NT_PubSubOptionType type, unsigned int value)
|
||||
: type{type}, value{value} {}
|
||||
|
||||
/**
|
||||
@@ -276,7 +276,8 @@ class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
static constexpr PubSubOption Periodic(double time) {
|
||||
return PubSubOption{NT_PUBSUB_PERIODIC, time};
|
||||
return PubSubOption{NT_PUBSUB_PERIODIC,
|
||||
static_cast<unsigned int>(time * 1000)};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,7 +288,7 @@ class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
static constexpr PubSubOption SendAll(bool enabled) {
|
||||
return PubSubOption{NT_PUBSUB_SENDALL, enabled ? 1.0 : 0.0};
|
||||
return PubSubOption{NT_PUBSUB_SENDALL, enabled ? 1u : 0u};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,7 +299,7 @@ class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
static constexpr PubSubOption TopicsOnly(bool enabled) {
|
||||
return PubSubOption{NT_PUBSUB_TOPICSONLY, enabled ? 1.0 : 0.0};
|
||||
return PubSubOption{NT_PUBSUB_TOPICSONLY, enabled ? 1u : 0u};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -309,7 +310,7 @@ class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
static constexpr PubSubOption KeepDuplicates(bool enabled) {
|
||||
return PubSubOption{NT_PUBSUB_KEEPDUPLICATES, enabled ? 1.0 : 0.0};
|
||||
return PubSubOption{NT_PUBSUB_KEEPDUPLICATES, enabled ? 1u : 0u};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,8 +321,8 @@ class PubSubOption {
|
||||
* @param depth number of entries to save for polling.
|
||||
* @return option
|
||||
*/
|
||||
static constexpr PubSubOption PollStorage(int depth) {
|
||||
return PubSubOption{NT_PUBSUB_POLLSTORAGE, static_cast<double>(depth)};
|
||||
static constexpr PubSubOption PollStorage(unsigned int depth) {
|
||||
return PubSubOption{NT_PUBSUB_POLLSTORAGE, depth};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -332,7 +333,7 @@ class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
static constexpr PubSubOption LocalOnly() {
|
||||
return PubSubOption{NT_PUBSUB_LOCALREMOTE, 1.0};
|
||||
return PubSubOption{NT_PUBSUB_LOCALREMOTE, 1u};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,7 +344,7 @@ class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
static constexpr PubSubOption RemoteOnly() {
|
||||
return PubSubOption{NT_PUBSUB_LOCALREMOTE, 2.0};
|
||||
return PubSubOption{NT_PUBSUB_LOCALREMOTE, 2u};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,11 +355,11 @@ class PubSubOption {
|
||||
* @return option
|
||||
*/
|
||||
static constexpr PubSubOption AllUpdates() {
|
||||
return PubSubOption{NT_PUBSUB_LOCALREMOTE, 0.0};
|
||||
return PubSubOption{NT_PUBSUB_LOCALREMOTE, 0u};
|
||||
}
|
||||
|
||||
NT_PubSubOptionType type;
|
||||
double value;
|
||||
unsigned int value;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace nt {
|
||||
|
||||
::testing::Matcher<const PubSubOptions&> IsPubSubOptions(
|
||||
const PubSubOptions& good) {
|
||||
return AllOf(Field("periodic", &PubSubOptions::periodic, good.periodic),
|
||||
return AllOf(Field("periodic", &PubSubOptions::periodicMs, good.periodicMs),
|
||||
Field("pollStorageSize", &PubSubOptions::pollStorageSize,
|
||||
good.pollStorageSize),
|
||||
Field("logging", &PubSubOptions::sendAll, good.sendAll),
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace nt {
|
||||
bool PubSubOptionsMatcher::MatchAndExplain(
|
||||
const PubSubOptions& val, ::testing::MatchResultListener* listener) const {
|
||||
bool match = true;
|
||||
if (val.periodic != good.periodic) {
|
||||
if (val.periodicMs != good.periodicMs) {
|
||||
*listener << "periodic mismatch ";
|
||||
match = false;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ void PrintTo(const Value& value, std::ostream* os) {
|
||||
}
|
||||
|
||||
void PrintTo(const PubSubOptions& options, std::ostream* os) {
|
||||
*os << "PubSubOptions{periodic=" << options.periodic
|
||||
*os << "PubSubOptions{periodicMs=" << options.periodicMs
|
||||
<< ", pollStorageSize=" << options.pollStorageSize
|
||||
<< ", logging=" << options.sendAll
|
||||
<< ", keepDuplicates=" << options.keepDuplicates << '}';
|
||||
|
||||
@@ -86,7 +86,7 @@ TEST_F(WireEncoderTextTest, SubscribeSendAll) {
|
||||
|
||||
TEST_F(WireEncoderTextTest, SubscribePeriodic) {
|
||||
PubSubOptions options;
|
||||
options.periodic = 0.5;
|
||||
options.periodicMs = 500u;
|
||||
net::WireEncodeSubscribe(os, 5, std::span<const std::string_view>{{"a", "b"}},
|
||||
options);
|
||||
ASSERT_EQ(os.str(),
|
||||
@@ -98,7 +98,7 @@ TEST_F(WireEncoderTextTest, SubscribePeriodic) {
|
||||
TEST_F(WireEncoderTextTest, SubscribeAllOptions) {
|
||||
PubSubOptions options;
|
||||
options.sendAll = true;
|
||||
options.periodic = 0.5;
|
||||
options.periodicMs = 500u;
|
||||
net::WireEncodeSubscribe(os, 5, std::span<const std::string_view>{{"a", "b"}},
|
||||
options);
|
||||
ASSERT_EQ(os.str(),
|
||||
|
||||
Reference in New Issue
Block a user