robotpy-native-ntcore 2025.3.2__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- native/ntcore/_init_robotpy_native_ntcore.py +23 -0
- native/ntcore/include/networktables/BooleanArrayTopic.h +488 -0
- native/ntcore/include/networktables/BooleanTopic.h +427 -0
- native/ntcore/include/networktables/DoubleArrayTopic.h +488 -0
- native/ntcore/include/networktables/DoubleTopic.h +427 -0
- native/ntcore/include/networktables/FloatArrayTopic.h +488 -0
- native/ntcore/include/networktables/FloatTopic.h +427 -0
- native/ntcore/include/networktables/GenericEntry.h +560 -0
- native/ntcore/include/networktables/IntegerArrayTopic.h +488 -0
- native/ntcore/include/networktables/IntegerTopic.h +427 -0
- native/ntcore/include/networktables/MultiSubscriber.h +77 -0
- native/ntcore/include/networktables/NTSendable.h +28 -0
- native/ntcore/include/networktables/NTSendableBuilder.h +57 -0
- native/ntcore/include/networktables/NetworkTable.h +678 -0
- native/ntcore/include/networktables/NetworkTableEntry.h +565 -0
- native/ntcore/include/networktables/NetworkTableInstance.h +954 -0
- native/ntcore/include/networktables/NetworkTableListener.h +402 -0
- native/ntcore/include/networktables/NetworkTableType.h +42 -0
- native/ntcore/include/networktables/NetworkTableValue.h +698 -0
- native/ntcore/include/networktables/ProtobufTopic.h +470 -0
- native/ntcore/include/networktables/RawTopic.h +438 -0
- native/ntcore/include/networktables/StringArrayTopic.h +427 -0
- native/ntcore/include/networktables/StringTopic.h +490 -0
- native/ntcore/include/networktables/StructArrayTopic.h +711 -0
- native/ntcore/include/networktables/StructTopic.h +531 -0
- native/ntcore/include/networktables/Topic.h +447 -0
- native/ntcore/include/networktables/UnitTopic.h +457 -0
- native/ntcore/include/ntcore.h +13 -0
- native/ntcore/include/ntcore_c.h +1973 -0
- native/ntcore/include/ntcore_c_types.h +1232 -0
- native/ntcore/include/ntcore_cpp.h +1519 -0
- native/ntcore/include/ntcore_cpp_types.h +998 -0
- native/ntcore/include/ntcore_test.h +64 -0
- native/ntcore/lib/ntcore.dll +0 -0
- native/ntcore/lib/ntcore.lib +0 -0
- native/ntcore/robotpy-native-ntcore.pc +11 -0
- robotpy_native_ntcore-2025.3.2.dist-info/METADATA +7 -0
- robotpy_native_ntcore-2025.3.2.dist-info/RECORD +40 -0
- robotpy_native_ntcore-2025.3.2.dist-info/WHEEL +4 -0
- robotpy_native_ntcore-2025.3.2.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file is automatically generated, DO NOT EDIT
|
|
2
|
+
# fmt: off
|
|
3
|
+
|
|
4
|
+
import native.wpinet._init_robotpy_native_wpinet
|
|
5
|
+
import native.wpiutil._init_robotpy_native_wpiutil
|
|
6
|
+
|
|
7
|
+
def __load_library():
|
|
8
|
+
from os.path import abspath, join, dirname, exists
|
|
9
|
+
from ctypes import cdll
|
|
10
|
+
|
|
11
|
+
root = abspath(dirname(__file__))
|
|
12
|
+
|
|
13
|
+
lib_path = join(root, 'lib', 'ntcore.dll')
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
return cdll.LoadLibrary(lib_path)
|
|
17
|
+
except FileNotFoundError:
|
|
18
|
+
if not exists(lib_path):
|
|
19
|
+
raise FileNotFoundError("ntcore.dll was not found on your system. Is this package correctly installed?")
|
|
20
|
+
raise Exception("ntcore.dll could not be loaded. Do you have Visual Studio C++ Redistributible installed?")
|
|
21
|
+
|
|
22
|
+
__lib = __load_library()
|
|
23
|
+
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
// Copyright (c) FIRST and other WPILib contributors.
|
|
2
|
+
// Open Source Software; you can modify and/or share it under the terms of
|
|
3
|
+
// the WPILib BSD license file in the root directory of this project.
|
|
4
|
+
|
|
5
|
+
// THIS FILE WAS AUTO-GENERATED BY ./ntcore/generate_topics.py. DO NOT MODIFY
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
#include <stdint.h>
|
|
10
|
+
|
|
11
|
+
#include <utility>
|
|
12
|
+
#include <span>
|
|
13
|
+
#include <string_view>
|
|
14
|
+
#include <vector>
|
|
15
|
+
|
|
16
|
+
#include <wpi/json_fwd.h>
|
|
17
|
+
|
|
18
|
+
#include "networktables/NetworkTableType.h"
|
|
19
|
+
#include "networktables/Topic.h"
|
|
20
|
+
#include "ntcore_cpp.h"
|
|
21
|
+
|
|
22
|
+
namespace wpi {
|
|
23
|
+
template <typename T>
|
|
24
|
+
class SmallVectorImpl;
|
|
25
|
+
} // namespace wpi
|
|
26
|
+
|
|
27
|
+
namespace nt {
|
|
28
|
+
|
|
29
|
+
class BooleanArrayTopic;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* NetworkTables BooleanArray subscriber.
|
|
33
|
+
*/
|
|
34
|
+
class BooleanArraySubscriber : public Subscriber {
|
|
35
|
+
public:
|
|
36
|
+
using TopicType = BooleanArrayTopic;
|
|
37
|
+
using ValueType = std::vector<int>;
|
|
38
|
+
using ParamType = std::span<const int>;
|
|
39
|
+
using TimestampedValueType = TimestampedBooleanArray;
|
|
40
|
+
|
|
41
|
+
using SmallRetType = std::span<int>;
|
|
42
|
+
using SmallElemType = int;
|
|
43
|
+
using TimestampedValueViewType = TimestampedBooleanArrayView;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
BooleanArraySubscriber() = default;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Construct from a subscriber handle; recommended to use
|
|
50
|
+
* BooleanArrayTopic::Subscribe() instead.
|
|
51
|
+
*
|
|
52
|
+
* @param handle Native handle
|
|
53
|
+
* @param defaultValue Default value
|
|
54
|
+
*/
|
|
55
|
+
BooleanArraySubscriber(NT_Subscriber handle, ParamType defaultValue)
|
|
56
|
+
: Subscriber{handle},
|
|
57
|
+
m_defaultValue{defaultValue.begin(), defaultValue.end()} {}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get the last published value.
|
|
61
|
+
* If no value has been published, returns the stored default value.
|
|
62
|
+
*
|
|
63
|
+
* @return value
|
|
64
|
+
*/
|
|
65
|
+
ValueType Get() const {
|
|
66
|
+
return Get(m_defaultValue);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get the last published value.
|
|
71
|
+
* If no value has been published, returns the passed defaultValue.
|
|
72
|
+
*
|
|
73
|
+
* @param defaultValue default value to return if no value has been published
|
|
74
|
+
* @return value
|
|
75
|
+
*/
|
|
76
|
+
ValueType Get(ParamType defaultValue) const {
|
|
77
|
+
return ::nt::GetBooleanArray(m_subHandle, defaultValue);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get the last published value.
|
|
82
|
+
* If no value has been published, returns the stored default value.
|
|
83
|
+
*
|
|
84
|
+
* @param buf storage for returned value
|
|
85
|
+
* @return value
|
|
86
|
+
*/
|
|
87
|
+
SmallRetType Get(wpi::SmallVectorImpl<SmallElemType>& buf) const {
|
|
88
|
+
return Get(buf, m_defaultValue);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get the last published value.
|
|
93
|
+
* If no value has been published, returns the passed defaultValue.
|
|
94
|
+
*
|
|
95
|
+
* @param buf storage for returned value
|
|
96
|
+
* @param defaultValue default value to return if no value has been published
|
|
97
|
+
* @return value
|
|
98
|
+
*/
|
|
99
|
+
SmallRetType Get(wpi::SmallVectorImpl<SmallElemType>& buf, ParamType defaultValue) const {
|
|
100
|
+
return nt::GetBooleanArray(m_subHandle, buf, defaultValue);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Get the last published value along with its timestamp
|
|
105
|
+
* If no value has been published, returns the stored default value and a
|
|
106
|
+
* timestamp of 0.
|
|
107
|
+
*
|
|
108
|
+
* @return timestamped value
|
|
109
|
+
*/
|
|
110
|
+
TimestampedValueType GetAtomic() const {
|
|
111
|
+
return GetAtomic(m_defaultValue);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get the last published value along with its timestamp.
|
|
116
|
+
* If no value has been published, returns the passed defaultValue and a
|
|
117
|
+
* timestamp of 0.
|
|
118
|
+
*
|
|
119
|
+
* @param defaultValue default value to return if no value has been published
|
|
120
|
+
* @return timestamped value
|
|
121
|
+
*/
|
|
122
|
+
TimestampedValueType GetAtomic(ParamType defaultValue) const {
|
|
123
|
+
return ::nt::GetAtomicBooleanArray(m_subHandle, defaultValue);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get the last published value along with its timestamp.
|
|
128
|
+
* If no value has been published, returns the stored default value and a
|
|
129
|
+
* timestamp of 0.
|
|
130
|
+
*
|
|
131
|
+
* @param buf storage for returned value
|
|
132
|
+
* @return timestamped value
|
|
133
|
+
*/
|
|
134
|
+
TimestampedValueViewType GetAtomic(
|
|
135
|
+
wpi::SmallVectorImpl<SmallElemType>& buf) const {
|
|
136
|
+
return GetAtomic(buf, m_defaultValue);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Get the last published value along with its timestamp.
|
|
141
|
+
* If no value has been published, returns the passed defaultValue and a
|
|
142
|
+
* timestamp of 0.
|
|
143
|
+
*
|
|
144
|
+
* @param buf storage for returned value
|
|
145
|
+
* @param defaultValue default value to return if no value has been published
|
|
146
|
+
* @return timestamped value
|
|
147
|
+
*/
|
|
148
|
+
TimestampedValueViewType GetAtomic(
|
|
149
|
+
wpi::SmallVectorImpl<SmallElemType>& buf,
|
|
150
|
+
ParamType defaultValue) const {
|
|
151
|
+
return nt::GetAtomicBooleanArray(m_subHandle, buf, defaultValue);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Get an array of all value changes since the last call to ReadQueue.
|
|
156
|
+
* Also provides a timestamp for each value.
|
|
157
|
+
*
|
|
158
|
+
* @note The "poll storage" subscribe option can be used to set the queue
|
|
159
|
+
* depth.
|
|
160
|
+
*
|
|
161
|
+
* @return Array of timestamped values; empty array if no new changes have
|
|
162
|
+
* been published since the previous call.
|
|
163
|
+
*/
|
|
164
|
+
std::vector<TimestampedValueType> ReadQueue() {
|
|
165
|
+
return ::nt::ReadQueueBooleanArray(m_subHandle);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get the corresponding topic.
|
|
170
|
+
*
|
|
171
|
+
* @return Topic
|
|
172
|
+
*/
|
|
173
|
+
TopicType GetTopic() const;
|
|
174
|
+
|
|
175
|
+
private:
|
|
176
|
+
ValueType m_defaultValue;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* NetworkTables BooleanArray publisher.
|
|
181
|
+
*/
|
|
182
|
+
class BooleanArrayPublisher : public Publisher {
|
|
183
|
+
public:
|
|
184
|
+
using TopicType = BooleanArrayTopic;
|
|
185
|
+
using ValueType = std::vector<int>;
|
|
186
|
+
using ParamType = std::span<const int>;
|
|
187
|
+
|
|
188
|
+
using SmallRetType = std::span<int>;
|
|
189
|
+
using SmallElemType = int;
|
|
190
|
+
|
|
191
|
+
using TimestampedValueType = TimestampedBooleanArray;
|
|
192
|
+
|
|
193
|
+
BooleanArrayPublisher() = default;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Construct from a publisher handle; recommended to use
|
|
197
|
+
* BooleanArrayTopic::Publish() instead.
|
|
198
|
+
*
|
|
199
|
+
* @param handle Native handle
|
|
200
|
+
*/
|
|
201
|
+
explicit BooleanArrayPublisher(NT_Publisher handle) : Publisher{handle} {}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Publish a new value.
|
|
205
|
+
*
|
|
206
|
+
* @param value value to publish
|
|
207
|
+
* @param time timestamp; 0 indicates current NT time should be used
|
|
208
|
+
*/
|
|
209
|
+
void Set(ParamType value, int64_t time = 0) {
|
|
210
|
+
::nt::SetBooleanArray(m_pubHandle, value, time);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Publish a default value.
|
|
215
|
+
* On reconnect, a default value will never be used in preference to a
|
|
216
|
+
* published value.
|
|
217
|
+
*
|
|
218
|
+
* @param value value
|
|
219
|
+
*/
|
|
220
|
+
void SetDefault(ParamType value) {
|
|
221
|
+
::nt::SetDefaultBooleanArray(m_pubHandle, value);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Get the corresponding topic.
|
|
226
|
+
*
|
|
227
|
+
* @return Topic
|
|
228
|
+
*/
|
|
229
|
+
TopicType GetTopic() const;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* NetworkTables BooleanArray entry.
|
|
234
|
+
*
|
|
235
|
+
* @note Unlike NetworkTableEntry, the entry goes away when this is destroyed.
|
|
236
|
+
*/
|
|
237
|
+
class BooleanArrayEntry final : public BooleanArraySubscriber,
|
|
238
|
+
public BooleanArrayPublisher {
|
|
239
|
+
public:
|
|
240
|
+
using SubscriberType = BooleanArraySubscriber;
|
|
241
|
+
using PublisherType = BooleanArrayPublisher;
|
|
242
|
+
using TopicType = BooleanArrayTopic;
|
|
243
|
+
using ValueType = std::vector<int>;
|
|
244
|
+
using ParamType = std::span<const int>;
|
|
245
|
+
|
|
246
|
+
using SmallRetType = std::span<int>;
|
|
247
|
+
using SmallElemType = int;
|
|
248
|
+
|
|
249
|
+
using TimestampedValueType = TimestampedBooleanArray;
|
|
250
|
+
|
|
251
|
+
BooleanArrayEntry() = default;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Construct from an entry handle; recommended to use
|
|
255
|
+
* BooleanArrayTopic::GetEntry() instead.
|
|
256
|
+
*
|
|
257
|
+
* @param handle Native handle
|
|
258
|
+
* @param defaultValue Default value
|
|
259
|
+
*/
|
|
260
|
+
BooleanArrayEntry(NT_Entry handle, ParamType defaultValue)
|
|
261
|
+
: BooleanArraySubscriber{handle, defaultValue},
|
|
262
|
+
BooleanArrayPublisher{handle} {}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Determines if the native handle is valid.
|
|
266
|
+
*
|
|
267
|
+
* @return True if the native handle is valid, false otherwise.
|
|
268
|
+
*/
|
|
269
|
+
explicit operator bool() const { return m_subHandle != 0; }
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Gets the native handle for the entry.
|
|
273
|
+
*
|
|
274
|
+
* @return Native handle
|
|
275
|
+
*/
|
|
276
|
+
NT_Entry GetHandle() const { return m_subHandle; }
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Get the corresponding topic.
|
|
280
|
+
*
|
|
281
|
+
* @return Topic
|
|
282
|
+
*/
|
|
283
|
+
TopicType GetTopic() const;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Stops publishing the entry if it's published.
|
|
287
|
+
*/
|
|
288
|
+
void Unpublish() {
|
|
289
|
+
::nt::Unpublish(m_pubHandle);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* NetworkTables BooleanArray topic.
|
|
295
|
+
*/
|
|
296
|
+
class BooleanArrayTopic final : public Topic {
|
|
297
|
+
public:
|
|
298
|
+
using SubscriberType = BooleanArraySubscriber;
|
|
299
|
+
using PublisherType = BooleanArrayPublisher;
|
|
300
|
+
using EntryType = BooleanArrayEntry;
|
|
301
|
+
using ValueType = std::vector<int>;
|
|
302
|
+
using ParamType = std::span<const int>;
|
|
303
|
+
using TimestampedValueType = TimestampedBooleanArray;
|
|
304
|
+
/** The default type string for this topic type. */
|
|
305
|
+
static constexpr std::string_view kTypeString = "boolean[]";
|
|
306
|
+
|
|
307
|
+
BooleanArrayTopic() = default;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Construct from a topic handle; recommended to use
|
|
311
|
+
* NetworkTableInstance::GetBooleanArrayTopic() instead.
|
|
312
|
+
*
|
|
313
|
+
* @param handle Native handle
|
|
314
|
+
*/
|
|
315
|
+
explicit BooleanArrayTopic(NT_Topic handle) : Topic{handle} {}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Construct from a generic topic.
|
|
319
|
+
*
|
|
320
|
+
* @param topic Topic
|
|
321
|
+
*/
|
|
322
|
+
explicit BooleanArrayTopic(Topic topic) : Topic{topic} {}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Create a new subscriber to the topic.
|
|
326
|
+
*
|
|
327
|
+
* <p>The subscriber is only active as long as the returned object
|
|
328
|
+
* is not destroyed.
|
|
329
|
+
*
|
|
330
|
+
* @note Subscribers that do not match the published data type do not return
|
|
331
|
+
* any values. To determine if the data type matches, use the appropriate
|
|
332
|
+
* Topic functions.
|
|
333
|
+
*
|
|
334
|
+
* @param defaultValue default value used when a default is not provided to a
|
|
335
|
+
* getter function
|
|
336
|
+
* @param options subscribe options
|
|
337
|
+
* @return subscriber
|
|
338
|
+
*/
|
|
339
|
+
[[nodiscard]]
|
|
340
|
+
SubscriberType Subscribe(
|
|
341
|
+
ParamType defaultValue,
|
|
342
|
+
const PubSubOptions& options = kDefaultPubSubOptions) {
|
|
343
|
+
return BooleanArraySubscriber{
|
|
344
|
+
::nt::Subscribe(m_handle, NT_BOOLEAN_ARRAY, "boolean[]", options),
|
|
345
|
+
defaultValue};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Create a new subscriber to the topic, with specific type string.
|
|
349
|
+
*
|
|
350
|
+
* <p>The subscriber is only active as long as the returned object
|
|
351
|
+
* is not destroyed.
|
|
352
|
+
*
|
|
353
|
+
* @note Subscribers that do not match the published data type do not return
|
|
354
|
+
* any values. To determine if the data type matches, use the appropriate
|
|
355
|
+
* Topic functions.
|
|
356
|
+
*
|
|
357
|
+
* @param typeString type string
|
|
358
|
+
* @param defaultValue default value used when a default is not provided to a
|
|
359
|
+
* getter function
|
|
360
|
+
* @param options subscribe options
|
|
361
|
+
* @return subscriber
|
|
362
|
+
*/
|
|
363
|
+
[[nodiscard]]
|
|
364
|
+
SubscriberType SubscribeEx(
|
|
365
|
+
std::string_view typeString, ParamType defaultValue,
|
|
366
|
+
const PubSubOptions& options = kDefaultPubSubOptions) {
|
|
367
|
+
return BooleanArraySubscriber{
|
|
368
|
+
::nt::Subscribe(m_handle, NT_BOOLEAN_ARRAY, typeString, options),
|
|
369
|
+
defaultValue};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Create a new publisher to the topic.
|
|
374
|
+
*
|
|
375
|
+
* The publisher is only active as long as the returned object
|
|
376
|
+
* is not destroyed.
|
|
377
|
+
*
|
|
378
|
+
* @note It is not possible to publish two different data types to the same
|
|
379
|
+
* topic. Conflicts between publishers are typically resolved by the
|
|
380
|
+
* server on a first-come, first-served basis. Any published values that
|
|
381
|
+
* do not match the topic's data type are dropped (ignored). To determine
|
|
382
|
+
* if the data type matches, use the appropriate Topic functions.
|
|
383
|
+
*
|
|
384
|
+
* @param options publish options
|
|
385
|
+
* @return publisher
|
|
386
|
+
*/
|
|
387
|
+
[[nodiscard]]
|
|
388
|
+
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions) {
|
|
389
|
+
return BooleanArrayPublisher{
|
|
390
|
+
::nt::Publish(m_handle, NT_BOOLEAN_ARRAY, "boolean[]", options)};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Create a new publisher to the topic, with type string and initial
|
|
395
|
+
* properties.
|
|
396
|
+
*
|
|
397
|
+
* The publisher is only active as long as the returned object
|
|
398
|
+
* is not destroyed.
|
|
399
|
+
*
|
|
400
|
+
* @note It is not possible to publish two different data types to the same
|
|
401
|
+
* topic. Conflicts between publishers are typically resolved by the
|
|
402
|
+
* server on a first-come, first-served basis. Any published values that
|
|
403
|
+
* do not match the topic's data type are dropped (ignored). To determine
|
|
404
|
+
* if the data type matches, use the appropriate Topic functions.
|
|
405
|
+
*
|
|
406
|
+
* @param typeString type string
|
|
407
|
+
* @param properties JSON properties
|
|
408
|
+
* @param options publish options
|
|
409
|
+
* @return publisher
|
|
410
|
+
*/
|
|
411
|
+
[[nodiscard]]
|
|
412
|
+
PublisherType PublishEx(std::string_view typeString,
|
|
413
|
+
const wpi::json& properties, const PubSubOptions& options = kDefaultPubSubOptions) {
|
|
414
|
+
return BooleanArrayPublisher{
|
|
415
|
+
::nt::PublishEx(m_handle, NT_BOOLEAN_ARRAY, typeString, properties, options)};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Create a new entry for the topic.
|
|
420
|
+
*
|
|
421
|
+
* Entries act as a combination of a subscriber and a weak publisher. The
|
|
422
|
+
* subscriber is active as long as the entry is not destroyed. The publisher
|
|
423
|
+
* is created when the entry is first written to, and remains active until
|
|
424
|
+
* either Unpublish() is called or the entry is destroyed.
|
|
425
|
+
*
|
|
426
|
+
* @note It is not possible to use two different data types with the same
|
|
427
|
+
* topic. Conflicts between publishers are typically resolved by the
|
|
428
|
+
* server on a first-come, first-served basis. Any published values that
|
|
429
|
+
* do not match the topic's data type are dropped (ignored), and the entry
|
|
430
|
+
* will show no new values if the data type does not match. To determine
|
|
431
|
+
* if the data type matches, use the appropriate Topic functions.
|
|
432
|
+
*
|
|
433
|
+
* @param defaultValue default value used when a default is not provided to a
|
|
434
|
+
* getter function
|
|
435
|
+
* @param options publish and/or subscribe options
|
|
436
|
+
* @return entry
|
|
437
|
+
*/
|
|
438
|
+
[[nodiscard]]
|
|
439
|
+
EntryType GetEntry(ParamType defaultValue,
|
|
440
|
+
const PubSubOptions& options = kDefaultPubSubOptions) {
|
|
441
|
+
return BooleanArrayEntry{
|
|
442
|
+
::nt::GetEntry(m_handle, NT_BOOLEAN_ARRAY, "boolean[]", options),
|
|
443
|
+
defaultValue};
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Create a new entry for the topic, with specific type string.
|
|
447
|
+
*
|
|
448
|
+
* Entries act as a combination of a subscriber and a weak publisher. The
|
|
449
|
+
* subscriber is active as long as the entry is not destroyed. The publisher
|
|
450
|
+
* is created when the entry is first written to, and remains active until
|
|
451
|
+
* either Unpublish() is called or the entry is destroyed.
|
|
452
|
+
*
|
|
453
|
+
* @note It is not possible to use two different data types with the same
|
|
454
|
+
* topic. Conflicts between publishers are typically resolved by the
|
|
455
|
+
* server on a first-come, first-served basis. Any published values that
|
|
456
|
+
* do not match the topic's data type are dropped (ignored), and the entry
|
|
457
|
+
* will show no new values if the data type does not match. To determine
|
|
458
|
+
* if the data type matches, use the appropriate Topic functions.
|
|
459
|
+
*
|
|
460
|
+
* @param typeString type string
|
|
461
|
+
* @param defaultValue default value used when a default is not provided to a
|
|
462
|
+
* getter function
|
|
463
|
+
* @param options publish and/or subscribe options
|
|
464
|
+
* @return entry
|
|
465
|
+
*/
|
|
466
|
+
[[nodiscard]]
|
|
467
|
+
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
|
|
468
|
+
const PubSubOptions& options = kDefaultPubSubOptions) {
|
|
469
|
+
return BooleanArrayEntry{
|
|
470
|
+
::nt::GetEntry(m_handle, NT_BOOLEAN_ARRAY, typeString, options),
|
|
471
|
+
defaultValue};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
inline BooleanArrayTopic BooleanArraySubscriber::GetTopic() const {
|
|
477
|
+
return BooleanArrayTopic{::nt::GetTopicFromHandle(m_subHandle)};
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
inline BooleanArrayTopic BooleanArrayPublisher::GetTopic() const {
|
|
481
|
+
return BooleanArrayTopic{::nt::GetTopicFromHandle(m_pubHandle)};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
inline BooleanArrayTopic BooleanArrayEntry::GetTopic() const {
|
|
485
|
+
return BooleanArrayTopic{::nt::GetTopicFromHandle(m_subHandle)};
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
} // namespace nt
|