ntcore_sys/lib.rs
1#![allow(non_camel_case_types, non_snake_case)]
2
3use bitflags::bitflags;
4use std::{ffi::CStr, fmt::Debug};
5
6#[repr(C)]
7#[derive(Debug, Copy, Clone, Hash)]
8pub struct WPI_String {
9 pub str: *const std::ffi::c_char,
10 pub len: usize,
11}
12
13impl From<&CStr> for WPI_String {
14 fn from(s: &CStr) -> Self {
15 Self {
16 str: s.as_ptr() as *const std::ffi::c_char,
17 len: s.count_bytes(),
18 }
19 }
20}
21
22pub type WPI_DataLog = std::ffi::c_void;
23
24pub type NT_Bool = i32;
25pub type NT_Handle = u32;
26pub type NT_ConnectionDataLogger = NT_Handle;
27pub type NT_DataLogger = NT_Handle;
28pub type NT_Entry = NT_Handle;
29pub type NT_Inst = NT_Handle;
30pub type NT_Listener = NT_Handle;
31pub type NT_ListenerPoller = NT_Handle;
32pub type NT_MultiSubscriber = NT_Handle;
33pub type NT_Topic = NT_Handle;
34pub type NT_Subscriber = NT_Handle;
35pub type NT_Publisher = NT_Handle;
36
37/// Event listener callback function.
38///
39/// # Parameters
40///
41/// - `data`: data pointer provided to callback creation function
42/// - `event`: event info
43pub type NT_ListenerCallback = unsafe extern "C" fn(*mut std::ffi::c_void, *const NT_Event);
44
45macro_rules! c_enum {
46 {$(
47 $(#[$meta:meta])*
48 $vis:vis enum $name:ident: $type:ty {
49 $($(#[$memmeta:meta])* $var:ident = $val:expr),+ $(,)?
50 })+} => {
51 $(
52 #[repr(transparent)]
53 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
54 $(#[$meta])*
55 $vis struct $name($type);
56 impl $name {
57 pub fn bits(&self) -> $type {
58 self.0
59 }
60
61 $(
62 $(#[$memmeta])*
63 pub const $var: $name = $name($val);
64 )+
65 }
66 )+
67 };
68}
69
70c_enum! {
71 /// NetworkTables data types.
72 pub enum NT_Type: u32 {
73 NT_UNASSIGNED = 0,
74 NT_BOOLEAN = 0x01,
75 NT_DOUBLE = 0x02,
76 NT_STRING = 0x04,
77 NT_RAW = 0x08,
78 NT_BOOLEAN_ARRAY = 0x10,
79 NT_DOUBLE_ARRAY = 0x20,
80 NT_STRING_ARRAY = 0x40,
81 NT_RPC = 0x80,
82 NT_INTEGER = 0x100,
83 NT_FLOAT = 0x200,
84 NT_INTEGER_ARRAY = 0x400,
85 NT_FLOAT_ARRAY = 0x800
86 }
87
88 /// NetworkTables logging levels.
89 pub enum NT_LogLevel: u32 {
90 NT_LOG_CRITICAL = 50,
91 NT_LOG_ERROR = 40,
92 NT_LOG_WARNING = 30,
93 NT_LOG_INFO = 20,
94 NT_LOG_DEBUG = 10,
95 NT_LOG_DEBUG1 = 9,
96 NT_LOG_DEBUG2 = 8,
97 NT_LOG_DEBUG3 = 7,
98 NT_LOG_DEBUG4 = 6
99 }
100
101 /// Client/server modes
102 pub enum NT_NetworkMode: u32 {
103 /// Not running
104 NT_NET_MODE_NONE = 0x00,
105 /// Running in server mode
106 NT_NET_MODE_SERVER = 0x01,
107 /// Running in NT3 client mode
108 NT_NET_MODE_CLIENT3 = 0x02,
109 /// Running in NT4 client mode
110 NT_NET_MODE_CLIENT4 = 0x04,
111 /// Starting (either client or server)
112 NT_NET_MODE_STARTING = 0x08,
113 /// Running in local-only mode
114 NT_NET_MODE_LOCAL = 0x10,
115 }
116}
117
118bitflags! {
119 /// Event notification flags.
120 #[repr(transparent)]
121 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
122 pub struct NT_EventFlags: u32 {
123 const NT_EVENT_NONE = 0;
124 /// Initial listener addition.
125 const NT_EVENT_IMMEDIATE = 0x01;
126 /// Client connected (on server, any client connected).
127 const NT_EVENT_CONNECTED = 0x02;
128 /// Client disconnected (on server, any client disconnected).
129 const NT_EVENT_DISCONNECTED = 0x04;
130 /// Any connection event (connect or disconnect).
131 const NT_EVENT_CONNECTION = 0x02| 0x04;
132 /// New topic published.
133 const NT_EVENT_PUBLISH = 0x08;
134 /// Topic unpublished.
135 const NT_EVENT_UNPUBLISH = 0x10;
136 /// Topic properties changed.
137 const NT_EVENT_PROPERTIES = 0x20;
138 /// Any topic event (publish, unpublish, or properties changed).
139 const NT_EVENT_TOPIC = 0x08| 0x10 | 0x20;
140 /// Topic value updated (via network).
141 const NT_EVENT_VALUE_REMOTE = 0x40;
142 /// Topic value updated (local).
143 const NT_EVENT_VALUE_LOCAL = 0x80;
144 /// Topic value updated (network or local).
145 const NT_EVENT_VALUE_ALL = 0x40 | 0x80;
146 /// Log message.
147 const NT_EVENT_LOGMESSAGE = 0x100;
148 /// Time synchronized with server.
149 const NT_EVENT_TIMESYNC = 0x200;
150 }
151
152 /// NetworkTables entry flags.
153 #[repr(transparent)]
154 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
155 pub struct NT_EntryFlags: u32 {
156 const NT_PERSISTENT = 0x01;
157 const NT_RETAINED = 0x02;
158 const NT_UNCACHED = 0x04;
159 }
160}
161
162/// Not included in the original ntcore header file, but required because of rust union limitations.
163#[repr(C)]
164#[derive(Copy, Clone, Debug)]
165pub struct NT_ValueDataArray<T> {
166 pub arr: *const T,
167 pub size: usize,
168}
169
170#[repr(C)]
171#[derive(Copy, Clone)]
172pub union NT_ValueData {
173 pub v_boolean: NT_Bool,
174 pub v_int: i64,
175 pub v_float: f32,
176 pub v_double: f64,
177 pub v_string: WPI_String,
178 pub v_raw: NT_ValueDataArray<u8>,
179 pub arr_boolean: NT_ValueDataArray<NT_Bool>,
180 pub arr_double: NT_ValueDataArray<f64>,
181 pub arr_float: NT_ValueDataArray<f32>,
182 pub arr_int: NT_ValueDataArray<i64>,
183 pub arr_string: NT_ValueDataArray<WPI_String>,
184}
185
186/// NetworkTables Entry Value. Note this is a typed union.
187#[repr(C)]
188#[derive(Copy, Clone)]
189pub struct NT_Value {
190 pub r#type: NT_Type,
191 pub last_change: i64,
192 pub server_time: i64,
193 pub data: NT_ValueData,
194}
195
196/// NetworkTables Topic Information
197#[repr(C)]
198#[derive(Copy, Clone, Debug, Hash)]
199pub struct NT_TopicInfo {
200 /// Topic handle
201 pub topic: NT_Topic,
202 /// Topic name
203 pub name: WPI_String,
204 /// Topic type
205 pub r#type: NT_Type,
206 /// Topic type string
207 pub type_str: WPI_String,
208 /// Topic properties JSON string
209 pub properties: WPI_String,
210}
211
212/// NetworkTables Connection Information
213#[repr(C)]
214#[derive(Copy, Clone, Debug, Hash)]
215pub struct NT_ConnectionInfo {
216 /// The remote identifier (as set on the remote node by NT_StartClient4().
217 pub remote_id: WPI_String,
218
219 /// The IP address of the remote node.
220 pub remote_ip: WPI_String,
221
222 /// The port number of the remote node.
223 pub remote_port: u32,
224
225 /// The last time any update was received from the remote node (same scale as
226 /// returned by nt::Now()).
227 pub last_update: u64,
228
229 /// The protocol version being used for this connection. This in protocol
230 /// layer format, so 0x0200 = 2.0, 0x0300 = 3.0).
231 pub protocol_version: u32,
232}
233
234/// NetworkTables value event data.
235#[repr(C)]
236#[derive(Copy, Clone)]
237pub struct NT_ValueEventData {
238 /// Topic handle.
239 pub topic: NT_Topic,
240
241 /// Subscriber/entry handle.
242 pub subentry: NT_Handle,
243
244 /// The new value.
245 pub value: NT_Value,
246}
247
248/// NetworkTables log message.
249#[repr(C)]
250#[derive(Copy, Clone, Debug, Hash)]
251pub struct NT_LogMessage {
252 /// Log level of the message. See NT_LogLevel.
253 pub level: u32,
254
255 /// The filename of the source file that generated the message.
256 pub filename: WPI_String,
257
258 /// The line number in the source file that generated the message.
259 pub line: u32,
260
261 /// The message.
262 pub message: WPI_String,
263}
264
265/// NetworkTables time sync event data.
266#[repr(C)]
267#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
268pub struct NT_TimeSyncEventData {
269 /// Offset between local time and server time, in microseconds. Add this value
270 /// to local time to get the estimated equivalent server time.
271 pub serverTimeOffset: i64,
272
273 /// Measured round trip time divided by 2, in microseconds.
274 pub rtt2: i64,
275
276 /// If serverTimeOffset and RTT are valid. An event with this set to false is
277 /// sent when the client disconnects.
278 pub valid: NT_Bool,
279}
280
281#[repr(C)]
282#[derive(Copy, Clone)]
283pub union NT_EventData {
284 pub connInfo: NT_ConnectionInfo,
285 pub topicInfo: NT_TopicInfo,
286 pub valueData: NT_ValueEventData,
287 pub logMessage: NT_LogMessage,
288 pub timeSyncData: NT_TimeSyncEventData,
289}
290
291/// NetworkTables event
292#[repr(C)]
293#[derive(Copy, Clone)]
294pub struct NT_Event {
295 /// Listener that triggered this event.
296 pub listener: NT_Handle,
297
298 /// Event flags (NT_EventFlags). Also indicates the data included with the
299 /// event:
300 /// - NT_EVENT_CONNECTED or NT_EVENT_DISCONNECTED: connInfo
301 /// - NT_EVENT_PUBLISH, NT_EVENT_UNPUBLISH, or NT_EVENT_PROPERTIES: topicInfo
302 /// - NT_EVENT_VALUE_REMOTE, NT_NOTIFY_VALUE_LOCAL: valueData
303 /// - NT_EVENT_LOGMESSAGE: logMessage
304 /// - NT_EVENT_TIMESYNC: timeSyncData
305 pub flags: u32,
306
307 /// Event data; content depends on flags.
308 pub data: NT_EventData,
309}
310
311/// NetworkTables publish/subscribe options.
312#[repr(C)]
313#[derive(Debug, Copy, Clone, PartialEq)]
314pub struct NT_PubSubOptions {
315 /// Structure size. Must be set to sizeof(NT_PubSubOptions).
316 pub structSize: u32,
317
318 /// Polling storage size for a subscription. Specifies the maximum number of
319 /// updates NetworkTables should store between calls to the subscriber's
320 /// ReadQueue() function. If zero, defaults to 1 if sendAll is false, 20 if
321 /// sendAll is true.
322 pub pollStorage: u32,
323
324 /// How frequently changes will be sent over the network, in seconds.
325 /// NetworkTables may send more frequently than this (e.g. use a combined
326 /// minimum period for all values) or apply a restricted range to this value.
327 /// The default is 100 ms.
328 pub periodic: f64,
329
330 /// For subscriptions, if non-zero, value updates for ReadQueue() are not
331 /// queued for this publisher.
332 pub excludePublisher: NT_Publisher,
333
334 /// Send all value changes over the network.
335 pub sendAll: NT_Bool,
336
337 /// For subscriptions, don't ask for value changes (only topic announcements).
338 pub topicsOnly: NT_Bool,
339
340 /// Perform prefix match on subscriber topic names. Is ignored/overridden by
341 /// Subscribe() functions; only present in struct for the purposes of getting
342 /// information about subscriptions.
343 pub prefixMatch: NT_Bool,
344
345 /// Preserve duplicate value changes (rather than ignoring them).
346 pub keepDuplicates: NT_Bool,
347
348 /// For subscriptions, if remote value updates should not be queued for
349 /// ReadQueue(). See also disableLocal.
350 pub disableRemote: NT_Bool,
351
352 /// For subscriptions, if local value updates should not be queued for
353 /// ReadQueue(). See also disableRemote.
354 pub disableLocal: NT_Bool,
355
356 /// For entries, don't queue (for ReadQueue) value updates for the entry's
357 /// internal publisher.
358 pub excludeSelf: NT_Bool,
359
360 /// For subscriptions, don't share the existence of the subscription with the
361 /// network. Note this means updates will not be received from the network
362 /// unless another subscription overlaps with this one, and the subscription
363 /// will not appear in metatopics.
364 pub hidden: NT_Bool,
365}
366
367/// Timestamped Boolean.
368#[repr(C)]
369#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
370pub struct NT_TimestampedBoolean {
371 /// Time in local time base
372 time: i64,
373 /// Time in server time base. May be 0 or 1 for locally set values.
374 serverTime: i64,
375 /// Value.
376 value: NT_Bool,
377}
378
379/// Timestamped Integer.
380#[repr(C)]
381#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
382pub struct NT_TimestampedInteger {
383 /// Time in local time base
384 time: i64,
385 /// Time in server time base. May be 0 or 1 for locally set values.
386 serverTime: i64,
387 /// Value.
388 value: i64,
389}
390
391/// Timestamped Float.
392#[repr(C)]
393#[derive(Debug, Copy, Clone, PartialEq)]
394pub struct NT_TimestampedFloat {
395 /// Time in local time base
396 time: i64,
397 /// Time in server time base. May be 0 or 1 for locally set values.
398 serverTime: i64,
399 /// Value.
400 value: f32,
401}
402
403/// Timestamped Double.
404#[repr(C)]
405#[derive(Debug, Copy, Clone, PartialEq)]
406pub struct NT_TimestampedDouble {
407 /// Time in local time base
408 time: i64,
409 /// Time in server time base. May be 0 or 1 for locally set values.
410 serverTime: i64,
411 /// Value.
412 value: f32,
413}
414
415/// Timestamped String.
416#[repr(C)]
417#[derive(Debug, Copy, Clone, Hash)]
418pub struct NT_TimestampedString {
419 /// Time in local time base
420 time: i64,
421 /// Time in server time base. May be 0 or 1 for locally set values.
422 serverTime: i64,
423 /// Value.
424 value: WPI_String,
425}
426
427
428/// Timestamped Raw.
429#[repr(C)]
430#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
431pub struct NT_TimestampedRaw {
432 /// Time in local time base
433 time: i64,
434 /// Time in server time base. May be 0 or 1 for locally set values.
435 serverTime: i64,
436 /// Value.
437 value: *mut u8,
438 /// Value length.
439 len: usize,
440}
441
442/// Timestamped Boolean Array.
443#[repr(C)]
444#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
445pub struct NT_TimestampedBooleanArray {
446 /// Time in local time base
447 time: i64,
448 /// Time in server time base. May be 0 or 1 for locally set values.
449 serverTime: i64,
450 /// Value.
451 value: *mut NT_Bool,
452 /// Value length.
453 len: usize,
454}
455
456/// Timestamped Integer Array.
457#[repr(C)]
458#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
459pub struct NT_TimestampedIntegerArray {
460 /// Time in local time base
461 time: i64,
462 /// Time in server time base. May be 0 or 1 for locally set values.
463 serverTime: i64,
464 /// Value.
465 value: *mut i64,
466 /// Value length.
467 len: usize,
468}
469
470
471/// Timestamped Float Array.
472#[repr(C)]
473#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
474pub struct NT_TimestampedFloatArray {
475 /// Time in local time base
476 time: i64,
477 /// Time in server time base. May be 0 or 1 for locally set values.
478 serverTime: i64,
479 /// Value.
480 value: *mut f32,
481 /// Value length.
482 len: usize,
483}
484
485
486/// Timestamped Double Array.
487#[repr(C)]
488#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
489pub struct NT_TimestampedDoubleArray {
490 /// Time in local time base
491 time: i64,
492 /// Time in server time base. May be 0 or 1 for locally set values.
493 serverTime: i64,
494 /// Value.
495 value: *mut f64,
496 /// Value length.
497 len: usize,
498}
499
500
501/// Timestamped String Array.
502#[repr(C)]
503#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
504pub struct NT_TimestampedStringArray {
505 /// Time in local time base
506 time: i64,
507 /// Time in server time base. May be 0 or 1 for locally set values.
508 serverTime: i64,
509 /// Value.
510 value: *mut WPI_String,
511 /// Value length.
512 len: usize,
513}
514
515extern "C" {
516 /// Get default instance.
517 /// This is the instance used by non-handle-taking functions.
518 ///
519 /// # Returns
520 ///
521 /// Instance handle
522 pub fn NT_GetDefaultInstance() -> NT_Inst;
523
524 /// Create an instance.
525 ///
526 /// # Returns
527 ///
528 /// Instance handle
529 pub fn NT_CreateInstance() -> NT_Inst;
530
531 /// Destroy an instance.
532 /// The default instance cannot be destroyed.
533 ///
534 /// # Parameters
535 ///
536 /// - inst: Instance handle
537 pub fn NT_DestroyInstance(inst: NT_Inst);
538
539 /// Get instance handle from another handle.
540 pub fn NT_GetInstanceFromHandle(handle: NT_Handle) -> NT_Inst;
541
542 /// Get Entry Handle.
543 ///
544 /// # Parameters
545 ///
546 /// - `inst`: Instance handle.
547 /// - `name`: Entry name (UTF-8 string).
548 ///
549 /// # Returns
550 ///
551 /// Entry handle.
552 pub fn NT_GetEntry(inst: NT_Inst, name: *const WPI_String) -> NT_Entry;
553
554 /// Gets the name of the specified entry.
555 /// Returns an empty string if the handle is invalid.
556 ///
557 /// # Parameters
558 ///
559 /// - `entry`: Entry handle.
560 /// - `name`: Entry name (output parameter).
561 pub fn NT_GetEntryName(entry: NT_Entry, name: *mut WPI_String);
562
563 /// Gets the type for the specified key, or unassigned if non-existent.
564 ///
565 /// # Parameters
566 ///
567 /// - `entry`: Entry handle.
568 ///
569 /// # Returns
570 ///
571 /// Entry type.
572 pub fn NT_GetEntryType(entry: NT_Entry) -> NT_Type;
573
574 /// Gets the last time the entry was changed.
575 /// Returns 0 if the handle is invalid.
576 ///
577 /// # Parameters
578 ///
579 /// - entry: entry handle
580 ///
581 /// # Returns
582 ///
583 /// Entry last change time
584 pub fn NT_GetEntryLastChange(entry: NT_Entry) -> u64;
585
586 /// Get Entry Value.
587 ///
588 /// Returns copy of current entry value.
589 /// Note that one of the type options is "unassigned".
590 ///
591 /// # Parameters
592 ///
593 /// - entry: entry handle
594 /// - value: storage for returned entry value
595 ///
596 /// # Note
597 ///
598 /// It is the caller's responsibility to free value once it's no longer
599 /// needed (the utility function NT_DisposeValue() is useful for this
600 /// purpose).
601 pub fn NT_GetEntryValue(entry: NT_Entry, value: *mut NT_Value);
602
603 /// Get Entry Value.
604 ///
605 /// Returns copy of current entry value.
606 /// Note that one of the type options is "unassigned".
607 ///
608 /// # Parameters
609 ///
610 /// - entry: entry handle
611 /// - types: bitmask of NT_Type values; 0 is treated specially
612 /// as a "don't care"
613 /// - value: storage for returned entry value
614 ///
615 /// # Note
616 ///
617 /// It is the caller's responsibility to free value once it's no longer
618 /// needed (the utility function NT_DisposeValue() is useful for this
619 /// purpose).
620 pub fn NT_GetEntryValueType(entry: NT_Entry, types: NT_Type, value: *mut NT_Value);
621
622 /// Set Default Entry Value.
623 ///
624 /// Returns copy of current entry value if it exists.
625 /// Otherwise, sets passed in value, and returns set value.
626 /// Note that one of the type options is "unassigned".
627 ///
628 /// # Parameters
629 ///
630 /// - entry: entry handle
631 /// - default_value: value to be set if name does not exist
632 ///
633 /// # Returns
634 ///
635 /// 0 on error (value not set), 1 on success
636 pub fn NT_SetDefaultEntryValue(entry: NT_Entry, default_value: *const NT_Value) -> NT_Bool;
637
638 /// Set Entry Value.
639 ///
640 /// Sets new entry value. If type of new value differs from the type of the
641 /// currently stored entry, returns error and does not update value.
642 ///
643 /// # Parameters
644 ///
645 /// - entry: entry handle
646 /// - value: new entry value
647 ///
648 /// # Returns
649 ///
650 /// 0 on error (type mismatch), 1 on success
651 pub fn NT_SetEntryValue(entry: NT_Entry, value: *const NT_Value) -> NT_Bool;
652
653 /// Set Entry Flags.
654 ///
655 /// # Parameters
656 ///
657 /// - entry: entry handle
658 /// - flags: flags value (bitmask of NT_EntryFlags)
659 pub fn NT_SetEntryFlags(entry: NT_Entry, flags: NT_EntryFlags);
660
661 /// Get Entry Flags.
662 ///
663 /// # Parameters
664 ///
665 /// - entry: entry handle
666 ///
667 /// # Returns
668 ///
669 /// Flags value (bitmask of NT_EntryFlags)
670 pub fn NT_GetEntryFlags(entry: NT_Entry) -> NT_EntryFlags;
671
672 /// Read Entry Queue.
673 ///
674 /// Returns new entry values since last call. The returned array must be freed
675 /// using NT_DisposeValueArray().
676 ///
677 /// # Parameters
678 ///
679 /// - subentry: subscriber or entry handle
680 /// - count: count of items in returned array (output)
681 ///
682 /// # Returns
683 ///
684 /// entry value array; returns NULL and count=0 if no new values
685 pub fn NT_ReadQueueValue(subentry: NT_Handle, count: *mut usize) -> *mut NT_Value;
686
687 /// Read Entry Queue.
688 ///
689 /// Returns new entry values since last call. The returned array must be freed
690 /// using NT_DisposeValueArray().
691 ///
692 /// # Parameters
693 ///
694 /// - subentry: subscriber or entry handle
695 /// - types: bitmask of NT_Type values; 0 is treated specially
696 /// as a "don't care"
697 /// - count: count of items in returned array (output)
698 ///
699 /// # Returns
700 ///
701 /// entry value array; returns NULL and count=0 if no new values
702 pub fn NT_ReadQueueValueType(
703 subentry: NT_Handle,
704 types: u32,
705 count: *mut usize,
706 ) -> *mut NT_Value;
707
708 /// Get Published Topic Handles.
709 ///
710 /// Returns an array of topic handles. The results are optionally
711 /// filtered by string prefix and type to only return a subset of all
712 /// topics.
713 ///
714 /// # Parameters
715 ///
716 /// - inst: instance handle
717 /// - prefix: name required prefix; only topics whose name
718 /// starts with this string are returned
719 /// - types: bitmask of NT_Type values; 0 is treated specially
720 /// as a "don't care"
721 /// - count: output parameter; set to length of returned array
722 ///
723 /// # Returns
724 ///
725 /// Array of topic handles.
726 pub fn NT_GetTopics(
727 inst: NT_Inst,
728 prefix: *const WPI_String,
729 types: u32,
730 count: *mut usize,
731 ) -> *mut NT_Topic;
732
733 /// Get Published Topic Handles.
734 ///
735 /// Returns an array of topic handles. The results are optionally
736 /// filtered by string prefix and type to only return a subset of all
737 /// topics.
738 ///
739 /// # Parameters
740 ///
741 /// - inst: instance handle
742 /// - prefix: name required prefix; only topics whose name
743 /// starts with this string are returned
744 /// - types: array of type strings
745 /// - types_len: number of elements in types array
746 /// - count: output parameter; set to length of returned array
747 ///
748 /// # Returns
749 ///
750 /// Array of topic handles.
751 pub fn NT_GetTopicsStr(
752 inst: NT_Inst,
753 prefix: *const WPI_String,
754 types: *const WPI_String,
755 types_len: usize,
756 count: *mut usize,
757 ) -> *mut NT_Topic;
758
759 /// Get Topics.
760 ///
761 /// Returns an array of topic information (handle, name, type). The results are
762 /// optionally filtered by string prefix and type to only return a subset
763 /// of all topics.
764 ///
765 /// # Parameters
766 ///
767 /// - inst: instance handle
768 /// - prefix: name required prefix; only topics whose name
769 /// starts with this string are returned
770 /// - types: bitmask of NT_Type values; 0 is treated specially
771 /// as a "don't care"
772 /// - count: output parameter; set to length of returned array
773 ///
774 /// # Returns
775 ///
776 /// Array of topic information.
777 pub fn NT_GetTopicInfos(
778 inst: NT_Inst,
779 prefix: *const WPI_String,
780 types: u32,
781 count: *mut usize,
782 ) -> *mut NT_TopicInfo;
783
784 /// Get Topics.
785 ///
786 /// Returns an array of topic information (handle, name, type). The results are
787 /// optionally filtered by string prefix and type to only return a subset
788 /// of all topics.
789 ///
790 /// # Parameters
791 ///
792 /// - inst: instance handle
793 /// - prefix: name required prefix; only topics whose name
794 /// starts with this string are returned
795 /// - types: array of type strings
796 /// - types_len: number of elements in types array
797 /// - count: output parameter; set to length of returned array
798 ///
799 /// # Returns
800 ///
801 /// Array of topic information.
802 pub fn NT_GetTopicInfosStr(
803 inst: NT_Inst,
804 prefix: *const WPI_String,
805 types: *const WPI_String,
806 types_len: usize,
807 count: *mut usize,
808 ) -> *mut NT_TopicInfo;
809
810 /// Gets Topic Information.
811 ///
812 /// Returns information about a topic (name and type).
813 ///
814 /// - topic: handle
815 /// - info: information (output)
816 ///
817 /// # Returns
818 ///
819 /// True if successful, false on error.
820 pub fn NT_GetTopicInfo(topic: NT_Topic, info: *mut NT_TopicInfo) -> NT_Bool;
821
822 /// Gets Topic Handle.
823 ///
824 /// Returns topic handle.
825 ///
826 /// # Parameters
827 ///
828 /// - inst: instance handle
829 /// - name: topic name
830 ///
831 /// # Returns
832 ///
833 /// Topic handle.
834 pub fn NT_GetTopic(inst: NT_Inst, name: *const WPI_String) -> NT_Topic;
835
836 /// Gets the name of the specified topic.
837 ///
838 /// # Parameters
839 ///
840 /// - topic: topic handle
841 /// - name: topic name (output); return length of 0 and nullptr if
842 /// handle is invalid.
843 pub fn NT_GetTopicName(topic: NT_Topic, name: *mut WPI_String);
844
845 /// Gets the type for the specified topic, or unassigned if non existent.
846 ///
847 /// # Parameters
848 ///
849 /// - topic: topic handle
850 ///
851 /// # Returns
852 ///
853 /// Topic type
854 pub fn NT_GetTopicType(topic: NT_Topic) -> NT_Type;
855
856 /// Gets the type string for the specified topic. This may have more information
857 /// than the numeric type (especially for raw values).
858 ///
859 /// # Parameters
860 ///
861 /// - topic: topic handle
862 /// - type: topic type string (output)
863 pub fn NT_GetTopicTypeString(topic: NT_Topic, r#type: *mut WPI_String);
864
865 /// Sets the persistent property of a topic. If true, the stored value is
866 /// persistent through server restarts.
867 ///
868 /// # Parameters
869 ///
870 /// - topic: topic handle
871 /// - value: True for persistent, false for not persistent.
872 pub fn NT_SetTopicPersistent(topic: NT_Topic, value: NT_Bool);
873
874 /// Gets the persistent property of a topic.
875 ///
876 /// # Parameters
877 ///
878 /// - topic: topic handle
879 ///
880 /// # Returns
881 ///
882 /// persistent property value
883 pub fn NT_GetTopicPersistent(topic: NT_Topic) -> NT_Bool;
884
885 /// Sets the retained property of a topic. If true, the server retains the
886 /// topic even when there are no publishers.
887 ///
888 /// # Parameters
889 ///
890 /// - topic: topic handle
891 /// - value: new retained property value
892 pub fn NT_SetTopicRetained(topic: NT_Topic, value: NT_Bool);
893
894 /// Gets the retained property of a topic.
895 ///
896 /// # Parameters
897 ///
898 /// - topic: topic handle
899 ///
900 /// # Returns
901 ///
902 /// retained property value
903 pub fn NT_GetTopicRetained(topic: NT_Topic) -> NT_Bool;
904
905 /// Sets the cached property of a topic. If true, the server and clients will
906 /// store the latest value, allowing the value to be read (and not just accessed
907 /// through event queues and listeners).
908 ///
909 /// # Parameters
910 ///
911 /// - topic: topic handle
912 /// - value: True for cached, false for not cached
913 pub fn NT_SetTopicCached(topic: NT_Topic, value: NT_Bool);
914
915 /// Gets the cached property of a topic.
916 ///
917 /// # Parameters
918 ///
919 /// - topic: topic handle
920 ///
921 /// # Return
922 ///
923 /// cached property value
924 pub fn NT_GetTopicCached(topic: NT_Topic) -> NT_Bool;
925
926 /// Determine if topic exists (e.g. has at least one publisher).
927 ///
928 /// # Parameters
929 ///
930 /// - handle: Topic, entry, or subscriber handle.
931 ///
932 /// # Returns
933 ///
934 /// True if topic exists.
935 pub fn NT_GetTopicExists(handle: NT_Handle) -> NT_Bool;
936
937 /// Gets the current value of a property (as a JSON string).
938 ///
939 /// # Parameters
940 ///
941 /// - topic: topic handle
942 /// - name: property name
943 /// - property: JSON string (output)
944 pub fn NT_GetTopicProperty(topic: NT_Topic, name: *const WPI_String, property: *mut WPI_String);
945
946 /// Sets a property value.
947 ///
948 /// # Parameters
949 ///
950 /// - topic: topic handle
951 /// - name: property name
952 /// - value: property value (JSON string)
953 pub fn NT_SetTopicProperty(
954 topic: NT_Topic,
955 name: *const WPI_String,
956 value: *const WPI_String,
957 ) -> NT_Bool;
958
959 /// Deletes a property. Has no effect if the property does not exist.
960 ///
961 /// # Parameters
962 ///
963 /// - topic: topic handle
964 /// - name: property name
965 pub fn NT_DeleteTopicProperty(topic: NT_Topic, name: *const WPI_String);
966
967 /// Gets all topic properties as a JSON string. Each key in the object
968 /// is the property name, and the corresponding value is the property value.
969 ///
970 /// # Parameters
971 ///
972 /// - topic: topic handle
973 /// - properties: JSON string (output)
974 pub fn NT_GetTopicProperties(topic: NT_Topic, properties: *mut WPI_String);
975
976 /// Updates multiple topic properties. Each key in the passed-in JSON object is
977 /// the name of the property to add/update, and the corresponding value is the
978 /// property value to set for that property. Null values result in deletion
979 /// of the corresponding property.
980 ///
981 /// # Parameters
982 ///
983 /// - topic: topic handle
984 /// - properties: JSON object string with keys to add/update/delete
985 ///
986 /// # Returns
987 ///
988 /// False if properties are not a valid JSON object
989 pub fn NT_SetTopicProperties(topic: NT_Topic, properties: *const WPI_String) -> NT_Bool;
990
991 /// Creates a new subscriber to value changes on a topic.
992 ///
993 /// # Parameters
994 ///
995 /// - topic: topic handle
996 /// - type: expected type
997 /// - typeStr: expected type string
998 /// - options: subscription options
999 ///
1000 /// # Returns
1001 ///
1002 /// Subscriber handle
1003 pub fn NT_Subscribe(
1004 topic: NT_Topic,
1005 r#type: NT_Type,
1006 typeStr: *const WPI_String,
1007 options: *const NT_PubSubOptions,
1008 ) -> NT_Subscriber;
1009
1010 /// Stops subscriber.
1011 ///
1012 /// # Returns
1013 ///
1014 /// sub subscriber handle
1015 pub fn NT_Unsubscribe(sub: NT_Subscriber);
1016
1017 /// Creates a new publisher to a topic.
1018 ///
1019 /// # Parameters
1020 ///
1021 /// - topic: topic handle
1022 /// - type: type
1023 /// - typeStr: type string
1024 /// - options: publish options
1025 ///
1026 /// # Returns
1027 ///
1028 /// Publisher handle
1029 pub fn NT_Publish(
1030 topic: NT_Topic,
1031 r#type: NT_Type,
1032 typeStr: *const WPI_String,
1033 options: *const NT_PubSubOptions,
1034 ) -> NT_Publisher;
1035
1036 /// Creates a new publisher to a topic.
1037 ///
1038 /// # Parameters
1039 ///
1040 /// - topic: topic handle
1041 /// - type: type
1042 /// - typeStr: type string
1043 /// - properties: initial properties (JSON object)
1044 /// - options: publish options
1045 ///
1046 /// # Returns
1047 ///
1048 /// Publisher handle
1049 pub fn NT_PublishEx(
1050 topic: NT_Topic,
1051 r#type: NT_Type,
1052 typeStr: *const WPI_String,
1053 properties: *const WPI_String,
1054 options: *const NT_PubSubOptions,
1055 ) -> NT_Publisher;
1056
1057 /// Stops publisher.
1058 ///
1059 /// # Parameters
1060 ///
1061 /// pubentry publisher/entry handle
1062 pub fn NT_Unpublish(pubentry: NT_Handle);
1063
1064 /// Creates a new entry (subscriber and weak publisher) to a topic.
1065 ///
1066 /// # Parameters
1067 ///
1068 /// - topic: topic handle
1069 /// - type: type
1070 /// - typeStr: type string
1071 /// - options: publish options
1072 ///
1073 /// # Returns
1074 ///
1075 /// Entry handle
1076 pub fn NT_GetEntryEx(
1077 topic: NT_Topic,
1078 r#type: NT_Type,
1079 typeStr: *const WPI_String,
1080 options: *const NT_PubSubOptions,
1081 ) -> NT_Entry;
1082
1083 /// Stops entry subscriber/publisher.
1084 ///
1085 /// # Parameters
1086 ///
1087 /// - entry: entry handle
1088 pub fn NT_ReleaseEntry(entry: NT_Entry);
1089
1090 /// Stops entry/subscriber/publisher.
1091 ///
1092 /// # Parameters
1093 ///
1094 /// - pubsubentry: entry/subscriber/publisher handle
1095 pub fn NT_Release(pubsubentry: NT_Handle);
1096
1097 /// Gets the topic handle from an entry/subscriber/publisher handle.
1098 ///
1099 /// # Parameters
1100 ///
1101 /// - pubsubentry: entry/subscriber/publisher handle
1102 ///
1103 /// # Returns
1104 ///
1105 /// Topic handle
1106 pub fn NT_GetTopicFromHandle(pubsubentry: NT_Handle) -> NT_Topic;
1107
1108 /// Subscribes to multiple topics based on one or more topic name prefixes. Can
1109 /// be used in combination with a Value Listener or ReadQueueValue() to get value
1110 /// changes across all matching topics.
1111 ///
1112 /// # Parameters
1113 ///
1114 /// - inst: instance handle
1115 /// - prefixes: topic name prefixes
1116 /// - prefixes_len: number of elements in prefixes array
1117 /// - options: subscriber options
1118 ///
1119 /// # Returns
1120 ///
1121 /// subscriber handle
1122 pub fn NT_SubscribeMultiple(
1123 inst: NT_Inst,
1124 prefixes: *const WPI_String,
1125 prefixes_len: usize,
1126 options: *const NT_PubSubOptions,
1127 ) -> NT_MultiSubscriber;
1128
1129 /// Unsubscribes a multi-subscriber.
1130 ///
1131 /// # Parameters
1132 ///
1133 /// sub multi-subscriber handle
1134 pub fn NT_UnsubscribeMultiple(sub: NT_MultiSubscriber);
1135
1136 /// Creates a listener poller.
1137 ///
1138 /// A poller provides a single queue of poll events. Events linked to this
1139 /// poller (using NT_AddPolledXListener()) will be stored in the queue and
1140 /// must be collected by calling NT_ReadListenerQueue().
1141 /// The returned handle must be destroyed with NT_DestroyListenerPoller().
1142 ///
1143 /// # Parameters
1144 ///
1145 /// - inst: instance handle
1146 ///
1147 /// # Returns
1148 ///
1149 /// poller handle
1150 pub fn NT_CreateListenerPoller(inst: NT_Inst) -> NT_ListenerPoller;
1151
1152 /// Destroys a listener poller. This will abort any blocked polling
1153 /// call and prevent additional events from being generated for this poller.
1154 ///
1155 /// # Parameters
1156 ///
1157 /// - poller: poller handle
1158 pub fn NT_DestroyListenerPoller(poller: NT_ListenerPoller);
1159
1160 /// Read notifications.
1161 ///
1162 /// # Parameters
1163 ///
1164 /// - poller: poller handle
1165 /// - len: length of returned array (output)
1166 ///
1167 /// # Returns
1168 ///
1169 /// Array of events. Returns NULL and len=0 if no events since last call.
1170 pub fn NT_ReadListenerQueue(poller: NT_ListenerPoller, len: *mut usize) -> *mut NT_Event;
1171
1172 /// Removes a listener.
1173 ///
1174 /// # Parameters
1175 ///
1176 /// - listener: Listener handle to remove
1177 pub fn NT_RemoveListener(listener: NT_Listener);
1178
1179 /// Wait for the listener queue to be empty. This is primarily useful
1180 /// for deterministic testing. This blocks until either the listener
1181 /// queue is empty (e.g. there are no more events that need to be passed along to
1182 /// callbacks or poll queues) or the timeout expires.
1183 ///
1184 /// # Parameters
1185 ///
1186 /// - handle: handle
1187 /// - timeout: timeout, in seconds. Set to 0 for non-blocking behavior, or a
1188 /// negative value to block indefinitely
1189 ///
1190 /// # Returns
1191 ///
1192 /// False if timed out, otherwise true.
1193 pub fn NT_WaitForListenerQueue(handle: NT_Handle, timeout: f64) -> NT_Bool;
1194
1195 /// Create a listener for changes to topics with names that start with
1196 /// the given prefix. This creates a corresponding internal subscriber with the
1197 /// lifetime of the listener.
1198 ///
1199 /// # Parameters
1200 ///
1201 /// - inst: Instance handle
1202 /// - prefix: Topic name string prefix
1203 /// - mask: Bitmask of NT_EventFlags values (only topic and value events will
1204 /// be generated)
1205 /// - data: Data passed to callback function
1206 /// - callback: Listener function
1207 ///
1208 /// # Returns
1209 ///
1210 /// Listener handle
1211 pub fn NT_AddListenerSingle(
1212 inst: NT_Inst,
1213 prefix: *const WPI_String,
1214 mask: u32,
1215 data: *mut std::ffi::c_void,
1216 callback: NT_ListenerCallback,
1217 ) -> NT_Listener;
1218
1219 /// Create a listener for changes to topics with names that start with any of
1220 /// the given prefixes. This creates a corresponding internal subscriber with the
1221 /// lifetime of the listener.
1222 ///
1223 /// # Parameters
1224 ///
1225 /// - inst: Instance handle
1226 /// - prefixes: Topic name string prefixes
1227 /// - prefixes_len: Number of elements in prefixes array
1228 /// - mask: Bitmask of NT_EventFlags values (only topic and value events will
1229 /// be generated)
1230 /// - data: Data passed to callback function
1231 /// - callback: Listener function
1232 ///
1233 /// # Returns
1234 ///
1235 /// Listener handle
1236 pub fn NT_AddListenerMultiple(
1237 inst: NT_Inst,
1238 prefixes: *const WPI_String,
1239 prefixes_len: usize,
1240 mask: u32,
1241 data: *mut std::ffi::c_void,
1242 callback: NT_ListenerCallback,
1243 ) -> NT_Listener;
1244
1245 /// Create a listener.
1246 ///
1247 /// Some combinations of handle and mask have no effect:
1248 /// - connection and log message events are only generated on instances
1249 /// - topic and value events are only generated on non-instances
1250 ///
1251 /// Adding value and topic events on a topic will create a corresponding internal
1252 /// subscriber with the lifetime of the listener.
1253 ///
1254 /// Adding a log message listener through this function will only result in
1255 /// events at NT_LOG_INFO or higher; for more customized settings, use
1256 /// NT_AddLogger().
1257 ///
1258 /// # Parameters
1259 ///
1260 /// - handle: Handle
1261 /// - mask: Bitmask of NT_EventFlags values
1262 /// - data: Data passed to callback function
1263 /// - callback: Listener function
1264 ///
1265 /// # Returns
1266 ///
1267 /// Listener handle
1268 pub fn NT_AddListener(
1269 handle: NT_Handle,
1270 mask: u32,
1271 data: *mut std::ffi::c_void,
1272 callback: NT_ListenerCallback,
1273 ) -> NT_Listener;
1274
1275 /// Creates a polled topic listener. This creates a corresponding internal
1276 /// subscriber with the lifetime of the listener.
1277 /// The caller is responsible for calling NT_ReadListenerQueue() to poll.
1278 ///
1279 /// # Parameters
1280 ///
1281 /// - poller: poller handle
1282 /// - prefix: UTF-8 string prefix
1283 /// - mask: NT_EventFlags bitmask (only topic and value events
1284 /// will be generated)
1285 ///
1286 /// # Returns
1287 ///
1288 /// Listener handle
1289 pub fn NT_AddPolledListenerSingle(
1290 poller: NT_ListenerPoller,
1291 prefix: *const WPI_String,
1292 mask: u32,
1293 ) -> NT_Listener;
1294
1295 /// Creates a polled topic listener. This creates a corresponding internal
1296 /// subscriber with the lifetime of the listener.
1297 /// The caller is responsible for calling NT_ReadListenerQueue() to poll.
1298 ///
1299 /// # Parameters
1300 ///
1301 /// - `poller`: Poller handle.
1302 /// - `prefixes`: Array of UTF-8 string prefixes.
1303 /// - `prefixes_len`: Length of prefixes array.
1304 /// - `mask`: NT_EventFlags bitmask (only topic and value events will be generated).
1305 ///
1306 /// # Returns
1307 ///
1308 /// Listener handle.
1309 pub fn NT_AddPolledListenerMultiple(
1310 poller: NT_ListenerPoller,
1311 prefixes: *const WPI_String,
1312 prefixes_len: usize,
1313 mask: u32,
1314 ) -> NT_Listener;
1315
1316 /// Creates a polled listener.
1317 /// The caller is responsible for calling NT_ReadListenerQueue() to poll.
1318 ///
1319 /// Some combinations of handle and mask have no effect:
1320 ///
1321 /// - connection and log message events are only generated on instances
1322 /// - topic and value events are only generated on non-instances
1323 ///
1324 /// Adding value and topic events on a topic will create a corresponding internal
1325 /// subscriber with the lifetime of the listener.
1326 ///
1327 /// Adding a log message listener through this function will only result in
1328 /// events at NT_LOG_INFO or higher; for more customized settings, use
1329 /// NT_AddPolledLogger.
1330 ///
1331 /// # Parameters
1332 ///
1333 /// - `poller`: Poller handle.
1334 /// - `handle`: Handle.
1335 /// - `mask`: NT_NotifyKind bitmask.
1336 ///
1337 /// # Returns
1338 ///
1339 /// Listener handle.
1340 pub fn NT_AddPolledListener(
1341 poller: NT_ListenerPoller,
1342 handle: NT_Handle,
1343 mask: u32,
1344 ) -> NT_Listener;
1345
1346 /// Starts local-only operation. Prevents calls to NT_StartServer or
1347 /// NT_StartClient from taking effect. Has no effect if NT_StartServer or
1348 /// NT_StartClient has already been called.
1349 ///
1350 /// # Parameters
1351 ///
1352 /// - `inst`: Instance handle.
1353 pub fn NT_StartLocal(inst: NT_Inst);
1354
1355 /// Stops local-only operation. NT_StartServer or NT_StartClient can be called
1356 /// after this call to start a server or client.
1357 ///
1358 /// # Parameters
1359 ///
1360 /// - `inst`: Instance handle.
1361 pub fn NT_StopLocal(inst: NT_Inst);
1362
1363 /// Starts a server using the specified filename, listening address, and port.
1364 ///
1365 /// # Parameters
1366 ///
1367 /// - `inst`: Instance handle.
1368 /// - `persist_filename`: The name of the persist file to use (UTF-8 string, null-terminated).
1369 /// - `listen_address`: The address to listen on, or null to listen on any address (UTF-8 string, null-terminated).
1370 /// - `port3`: Port to communicate over (NT3).
1371 /// - `port4`: Port to communicate over (NT4).
1372 pub fn NT_StartServer(
1373 inst: NT_Inst,
1374 persist_filename: *const WPI_String,
1375 listen_address: *const WPI_String,
1376 port3: u32,
1377 port4: u32,
1378 );
1379
1380 /// Stops the server if it is running.
1381 ///
1382 /// # Parameters
1383 ///
1384 /// inst: instance handle
1385 pub fn NT_StopServer(inst: NT_Inst);
1386
1387 /// Starts a NT3 client. Use NT_SetServer or NT_SetServerTeam to set the server
1388 /// name and port.
1389 ///
1390 /// # Parameters
1391 ///
1392 /// - `inst`: Instance handle.
1393 /// - `identity`: Network identity to advertise (cannot be empty string).
1394 pub fn NT_StartClient3(inst: NT_Inst, identity: *const WPI_String);
1395
1396 /// Starts a NT4 client. Use NT_SetServer or NT_SetServerTeam to set the server
1397 /// name and port.
1398 ///
1399 /// # Parameters
1400 ///
1401 /// - `inst`: Instance handle.
1402 /// - `identity`: Network identity to advertise (cannot be empty string).
1403 pub fn NT_StartClient4(inst: NT_Inst, identity: *const WPI_String);
1404
1405 /// Stops the client if it is running.
1406 ///
1407 /// # Parameters
1408 ///
1409 /// - inst: instance handle
1410 pub fn NT_StopClient(inst: NT_Inst);
1411
1412 /// Sets server address and port for client (without restarting client).
1413 ///
1414 /// # Parameters
1415 ///
1416 /// - `inst`: Instance handle.
1417 /// - `server_name`: Server name (UTF-8 string, null-terminated).
1418 /// - `port`: Port to communicate over.
1419 pub fn NT_SetServer(inst: NT_Inst, server_name: *const WPI_String, port: u32);
1420
1421 /// Sets server addresses for client (without restarting client).
1422 /// The client will attempt to connect to each server in round-robin fashion.
1423 ///
1424 /// # Parameters
1425 ///
1426 /// - `inst`: Instance handle.
1427 /// - `count`: Length of the `server_names` and `ports` arrays.
1428 /// - `server_names`: Array of server names (each a UTF-8 string, null-terminated).
1429 /// - `ports`: Array of ports to communicate over (one for each server).
1430 pub fn NT_SetServerMulti(
1431 inst: NT_Inst,
1432 count: usize,
1433 server_names: *const WPI_String,
1434 ports: *const u32,
1435 );
1436
1437 /// Sets server addresses and port for client (without restarting client).
1438 /// Connects using commonly known robot addresses for the specified team.
1439 ///
1440 /// # Parameters
1441 ///
1442 /// - `inst`: Instance handle.
1443 /// - `team`: Team number.
1444 /// - `port`: Port to communicate over.
1445 pub fn NT_SetServerTeam(inst: NT_Inst, team: u32, port: u32);
1446
1447 /// Disconnects the client if it's running and connected. This will automatically
1448 /// start reconnection attempts to the current server list.
1449 ///
1450 /// # Parameters
1451 ///
1452 /// - inst: instance handle
1453 pub fn NT_Disconnect(inst: NT_Inst);
1454
1455 /// Starts requesting server address from Driver Station.
1456 /// This connects to the Driver Station running on localhost to obtain the
1457 /// server IP address.
1458 ///
1459 /// # Parameters
1460 ///
1461 /// - `inst`: Instance handle.
1462 /// - `port`: Server port to use in combination with IP from DS.
1463 pub fn NT_StartDSClient(inst: NT_Inst, port: u32);
1464
1465 /// Stops requesting server address from Driver Station.
1466 ///
1467 /// # Parameters
1468 ///
1469 /// - inst: instance handle
1470 pub fn NT_StopDSClient(inst: NT_Inst);
1471
1472 /// Flush local updates.
1473 ///
1474 /// Forces an immediate flush of all local changes to the client/server.
1475 /// This does not flush to the network.
1476 ///
1477 /// Normally this is done on a regularly scheduled interval.
1478 ///
1479 /// # Parameters
1480 ///
1481 /// - inst: instance handle
1482 pub fn NT_FlushLocal(inst: NT_Inst);
1483
1484 /// Flush to network.
1485 ///
1486 /// Forces an immediate flush of all local entry changes to network.
1487 /// Normally this is done on a regularly scheduled interval (set
1488 /// by update rates on individual publishers).
1489 ///
1490 /// Note: flushes are rate limited to avoid excessive network traffic. If
1491 /// the time between calls is too short, the flush will occur after the minimum
1492 /// time elapses (rather than immediately).
1493 ///
1494 /// # Parameters
1495 ///
1496 /// - inst: instance handle
1497 pub fn NT_Flush(inst: NT_Inst);
1498
1499 /// Get information on the currently established network connections.
1500 /// If operating as a client, this will return either zero or one values.
1501 ///
1502 /// # Parameters
1503 ///
1504 /// - `inst`: Instance handle.
1505 /// - `count`: Returns the number of elements in the array.
1506 ///
1507 /// # Returns
1508 ///
1509 /// Array of connection information.
1510 ///
1511 /// It is the caller's responsibility to free the array. The
1512 /// `NT_DisposeConnectionInfoArray` function is useful for this purpose.
1513 pub fn NT_GetConnections(inst: NT_Inst, count: *mut usize) -> *mut NT_ConnectionInfo;
1514
1515 /// Return whether or not the instance is connected to another node.
1516 ///
1517 /// # Parameters
1518 ///
1519 /// - `inst`: instance handle
1520 ///
1521 /// # Returns
1522 ///
1523 /// True if connected.
1524 pub fn NT_IsConnected(inst: NT_Inst) -> NT_Bool;
1525
1526 /// Get the time offset between server time and local time. Add this value to
1527 /// local time to get the estimated equivalent server time. In server mode, this
1528 /// always returns a valid value of 0. In client mode, this returns the time
1529 /// offset only if the client and server are connected and have exchanged
1530 /// synchronization messages. Note the time offset may change over time as it is
1531 /// periodically updated; to receive updates as events, add a listener to the
1532 /// "time sync" event.
1533 ///
1534 /// # Parameters
1535 ///
1536 /// - `inst`: Instance handle.
1537 /// - `valid`: Set to true if the return value is valid, false otherwise (output).
1538 ///
1539 /// # Returns
1540 /// Time offset in microseconds (if valid is set to true).
1541 pub fn NT_GetServerTimeOffset(inst: NT_Inst, valid: *mut NT_Bool) -> i64;
1542
1543 /// Frees value memory.
1544 ///
1545 /// # Parameters
1546 ///
1547 /// - `value`: Value to free.
1548 pub fn NT_DisposeValue(value: *mut NT_Value);
1549
1550 /// Initializes an NT_Value.
1551 /// Sets type to NT_UNASSIGNED and clears the rest of the struct.
1552 ///
1553 /// # Parameters
1554 ///
1555 /// - `value`: Value to initialize.
1556 pub fn NT_InitValue(value: *mut NT_Value);
1557
1558 /// Frees an array of NT_Values.
1559 ///
1560 /// # Parameters
1561 ///
1562 /// - `arr`: Pointer to the value array to free.
1563 /// - `count`: Number of elements in the array.
1564 ///
1565 /// Note that the individual NT_Values in the array should NOT be
1566 /// freed before calling this. This function will free all the values
1567 /// individually.
1568 pub fn NT_DisposeValueArray(arr: *mut NT_Value, count: usize);
1569
1570 /// Disposes a connection info array.
1571 ///
1572 /// # Parameters
1573 ///
1574 /// - `arr`: Pointer to the array to dispose.
1575 /// - `count`: Number of elements in the array.
1576 pub fn NT_DisposeConnectionInfoArray(arr: *mut NT_ConnectionInfo, count: usize);
1577
1578 /// Disposes a topic info array.
1579 ///
1580 /// # Parameters
1581 ///
1582 /// - `arr`: Pointer to the array to dispose.
1583 /// - `count`: Number of elements in the array.
1584 pub fn NT_DisposeTopicInfoArray(arr: *mut NT_TopicInfo, count: usize);
1585
1586 /// Disposes a single topic info (as returned by NT_GetTopicInfo).
1587 ///
1588 /// # Parameters
1589 ///
1590 /// - `info`: Pointer to the info to dispose.
1591 pub fn NT_DisposeTopicInfo(info: *mut NT_TopicInfo);
1592
1593 /// Disposes an event array.
1594 ///
1595 /// # Parameters
1596 ///
1597 /// - `arr`: Pointer to the array to dispose.
1598 /// - `count`: Number of elements in the array.
1599 pub fn NT_DisposeEventArray(arr: *mut NT_Event, count: usize);
1600
1601 /// Disposes a single event.
1602 ///
1603 /// # Parameters
1604 ///
1605 /// - `event`: Pointer to the event to dispose.
1606 pub fn NT_DisposeEvent(event: *mut NT_Event);
1607
1608 /// Returns monotonic current time in 1 us increments.
1609 /// This is the same time base used for entry and connection timestamps.
1610 /// This function by default simply wraps WPI_Now(), but if NT_SetNow() is
1611 /// called, this function instead returns the value passed to NT_SetNow();
1612 /// this can be used to reduce overhead.
1613 ///
1614 /// # Returns
1615 ///
1616 /// Timestamp
1617 pub fn NT_Now() -> i64;
1618
1619 /// Sets the current timestamp used for timestamping values that do not
1620 /// provide a timestamp (e.g. a value of 0 is passed). For consistency,
1621 /// it also results in NT_Now() returning the set value. This should generally
1622 /// be used only if the overhead of calling WPI_Now() is a concern.
1623 /// If used, it should be called periodically with the value of WPI_Now().
1624 ///
1625 /// # Parameters
1626 ///
1627 /// - timestamp: timestamp (1 us increments)
1628 pub fn NT_SetNow(timestamp: i64);
1629
1630 /// Starts logging entry changes to a DataLog.
1631 ///
1632 /// # Parameters
1633 ///
1634 /// - `inst`: Instance handle.
1635 /// - `log`: Data log object; lifetime must extend until `StopEntryDataLog` is
1636 /// called or the instance is destroyed.
1637 /// - `prefix`: Only store entries with names that start with this prefix;
1638 /// the prefix is not included in the data log entry name.
1639 /// - `logPrefix`: Prefix to add to data log entry names.
1640 ///
1641 /// # Returns
1642 ///
1643 /// Data logger handle.
1644 pub fn NT_StartEntryDataLog(
1645 inst: NT_Inst,
1646 log: *mut WPI_DataLog,
1647 prefix: *const WPI_String,
1648 logPrefix: *const WPI_String,
1649 ) -> NT_DataLogger;
1650
1651 /// Stops logging entry changes to a DataLog.
1652 ///
1653 /// # Parameters
1654 ///
1655 /// - logger: data logger handle
1656 pub fn NT_StopEntryDataLog(logger: NT_DataLogger);
1657
1658 /// Starts logging connection changes to a DataLog.
1659 ///
1660 /// # Parameters
1661 ///
1662 /// - `inst`: Instance handle.
1663 /// - `log`: Data log object; lifetime must extend until `StopConnectionDataLog`
1664 /// is called or the instance is destroyed.
1665 /// - `name`: Data log entry name.
1666 ///
1667 /// # Returns
1668 ///
1669 /// Data logger handle.
1670 pub fn NT_StartConnectionDataLog(
1671 inst: NT_Inst,
1672 log: *mut WPI_DataLog,
1673 name: *const WPI_String,
1674 ) -> NT_ConnectionDataLogger;
1675
1676 /// Stops logging connection changes to a DataLog.
1677 ///
1678 /// # Parameters
1679 ///
1680 /// - logger: data logger handle
1681 pub fn NT_StopConnectionDataLog(logger: NT_ConnectionDataLogger);
1682
1683 /// Add logger callback function. By default, log messages are sent to stderr;
1684 /// this function sends log messages to the provided callback function instead.
1685 /// The callback function will only be called for log messages with level
1686 /// greater than or equal to `min_level` and less than or equal to `max_level`;
1687 /// messages outside this range will be silently ignored.
1688 ///
1689 /// # Parameters
1690 ///
1691 /// - `inst`: Instance handle.
1692 /// - `min_level`: Minimum log level.
1693 /// - `max_level`: Maximum log level.
1694 /// - `data`: Data pointer to pass to `func`.
1695 /// - `func`: Listener callback function.
1696 ///
1697 /// # Returns
1698 ///
1699 /// Listener handle.
1700 pub fn NT_AddLogger(
1701 inst: NT_Inst,
1702 min_level: u32,
1703 max_level: u32,
1704 data: *mut std::ffi::c_void,
1705 func: NT_ListenerCallback,
1706 ) -> NT_Listener;
1707
1708 /// Set the log level for a listener poller. Events will only be generated for
1709 /// log messages with level greater than or equal to `min_level` and less than or
1710 /// equal to `max_level`; messages outside this range will be silently ignored.
1711 ///
1712 /// # Parameters
1713 ///
1714 /// - `poller`: Poller handle.
1715 /// - `min_level`: Minimum log level.
1716 /// - `max_level`: Maximum log level.
1717 ///
1718 /// # Returns
1719 ///
1720 /// Listener handle.
1721 pub fn NT_AddPolledLogger(
1722 poller: NT_ListenerPoller,
1723 min_level: u32,
1724 max_level: u32,
1725 ) -> NT_Listener;
1726
1727 /// Returns whether there is a data schema already registered with the given
1728 /// name. This does NOT perform a check as to whether the schema has already
1729 /// been published by another node on the network.
1730 ///
1731 /// # Parameters
1732 ///
1733 /// - `inst`: Instance handle.
1734 /// - `name`: Name (the string passed as the data type for topics using this schema).
1735 ///
1736 /// # Returns
1737 ///
1738 /// True if schema already registered.
1739 pub fn NT_HasSchema(inst: NT_Inst, name: *const WPI_String) -> NT_Bool;
1740
1741 /// Registers a data schema. Data schemas provide information for how a
1742 /// certain data type string can be decoded. The type string of a data schema
1743 /// indicates the type of the schema itself (e.g. "protobuf" for protobuf
1744 /// schemas, "struct" for struct schemas, etc). In NetworkTables, schemas are
1745 /// published just like normal topics, with the name being generated from the
1746 /// provided name: "/.schema/<name>". Duplicate calls to this function with
1747 /// the same name are silently ignored.
1748 ///
1749 /// # Parameters
1750 ///
1751 /// - `inst`: Instance handle.
1752 /// - `name`: Name (the string passed as the data type for topics using this schema).
1753 /// - `type`: Type of schema (e.g. "protobuf", "struct", etc).
1754 /// - `schema`: Schema data.
1755 /// - `schema_size`: Size of schema data.
1756 pub fn NT_AddSchema(
1757 inst: NT_Inst,
1758 name: *const WPI_String,
1759 type_: *const WPI_String,
1760 schema: *const u8,
1761 schema_size: usize,
1762 );
1763
1764 /// Allocates an array of chars.
1765 /// Note that the size is the number of elements, and not the
1766 /// specific number of bytes to allocate. That is calculated internally.
1767 ///
1768 /// # Parameters
1769 ///
1770 /// - `size`: The number of elements the array will contain.
1771 ///
1772 /// # Returns
1773 /// The allocated char array.
1774 ///
1775 /// After use, the array should be freed using the `NT_FreeCharArray()` function.
1776 pub fn NT_AllocateCharArray(size: usize) -> *mut std::ffi::c_char;
1777
1778 /// Allocates an array of booleans.
1779 /// Note that the size is the number of elements, and not the
1780 /// specific number of bytes to allocate. That is calculated internally.
1781 ///
1782 /// # Parameters
1783 ///
1784 /// - `size`: The number of elements the array will contain.
1785 ///
1786 /// # Returns
1787 /// The allocated boolean array.
1788 ///
1789 /// After use, the array should be freed using the `NT_FreeBooleanArray()` function.
1790 pub fn NT_AllocateBooleanArray(size: usize) -> *mut bool;
1791
1792 /// Allocates an array of integers.
1793 /// Note that the size is the number of elements, and not the
1794 /// specific number of bytes to allocate. That is calculated internally.
1795 ///
1796 /// # Parameters
1797 ///
1798 /// - `size`: The number of elements the array will contain.
1799 ///
1800 /// # Returns
1801 /// The allocated integer array.
1802 ///
1803 /// After use, the array should be freed using the `NT_FreeIntegerArray()` function.
1804 pub fn NT_AllocateIntegerArray(size: usize) -> *mut i64;
1805
1806 /// Allocates an array of floats.
1807 /// Note that the size is the number of elements, and not the
1808 /// specific number of bytes to allocate. That is calculated internally.
1809 ///
1810 /// # Parameters
1811 ///
1812 /// - `size`: The number of elements the array will contain.
1813 ///
1814 /// # Returns
1815 /// The allocated float array.
1816 ///
1817 /// After use, the array should be freed using the `NT_FreeFloatArray()` function.
1818 pub fn NT_AllocateFloatArray(size: usize) -> *mut f32;
1819
1820 /// Allocates an array of doubles.
1821 /// Note that the size is the number of elements, and not the
1822 /// specific number of bytes to allocate. That is calculated internally.
1823 ///
1824 /// # Parameters
1825 ///
1826 /// - `size`: The number of elements the array will contain.
1827 ///
1828 /// # Returns
1829 ///
1830 /// The allocated double array.
1831 ///
1832 /// After use, the array should be freed using the `NT_FreeDoubleArray()` function.
1833 pub fn NT_AllocateDoubleArray(size: usize) -> *mut f64;
1834
1835 /// Frees an array of chars.
1836 ///
1837 /// # Parameters
1838 ///
1839 /// - `v_char`: Pointer to the char array to free.
1840 pub fn NT_FreeCharArray(v_char: *mut std::ffi::c_char);
1841
1842 /// Frees an array of booleans.
1843 ///
1844 /// # Parameters
1845 ///
1846 /// - `v_boolean`: Pointer to the boolean array to free.
1847 pub fn NT_FreeBooleanArray(v_boolean: *mut bool);
1848
1849 /// Frees an array of integers.
1850 ///
1851 /// # Parameters
1852 ///
1853 /// - `v_int`: Pointer to the integer array to free.
1854 pub fn NT_FreeIntegerArray(v_int: *mut i64);
1855
1856 /// Frees an array of floats.
1857 ///
1858 /// # Parameters
1859 ///
1860 /// - `v_float`: Pointer to the float array to free.
1861 pub fn NT_FreeFloatArray(v_float: *mut f32);
1862
1863 /// Frees an array of doubles.
1864 ///
1865 /// # Parameters
1866 ///
1867 /// - `v_double`: Pointer to the double array to free.
1868 pub fn NT_FreeDoubleArray(v_double: *mut f64);
1869
1870 /// Returns the type of an NT_Value struct.
1871 /// Note that one of the type options is "unassigned".
1872 ///
1873 /// # Parameters
1874 ///
1875 /// - `value`: The NT_Value struct to get the type from.
1876 ///
1877 /// # Returns
1878 ///
1879 /// The type of the value, or unassigned if null.
1880 pub fn NT_GetValueType(value: *const NT_Value) -> NT_Type;
1881
1882 /// Returns the boolean from the NT_Value.
1883 /// If the NT_Value is null, or is assigned to a different type, returns 0.
1884 ///
1885 /// # Parameters
1886 ///
1887 /// - `value`: NT_Value struct to get the boolean from.
1888 /// - `last_change`: Returns time in ms since the last change in the value.
1889 /// - `v_boolean`: Returns the boolean assigned to the name.
1890 ///
1891 /// # Returns
1892 ///
1893 /// 1 if successful, or 0 if value is null or not a boolean.
1894 pub fn NT_GetValueBoolean(
1895 value: *const NT_Value,
1896 last_change: *mut u64,
1897 v_boolean: *mut bool,
1898 ) -> NT_Bool;
1899
1900 /// Returns the int from the NT_Value.
1901 /// If the NT_Value is null, or is assigned to a different type, returns 0.
1902 ///
1903 /// # Parameters
1904 ///
1905 /// - `value`: NT_Value struct to get the int from.
1906 /// - `last_change`: Returns time in ms since the last change in the value.
1907 /// - `v_int`: Returns the int assigned to the name.
1908 ///
1909 /// # Returns
1910 ///
1911 /// 1 if successful, or 0 if value is null or not an int.
1912 pub fn NT_GetValueInteger(
1913 value: *const NT_Value,
1914 last_change: *mut u64,
1915 v_int: *mut i64,
1916 ) -> NT_Bool;
1917
1918 /// Returns the float from the NT_Value.
1919 /// If the NT_Value is null, or is assigned to a different type, returns 0.
1920 ///
1921 /// # Parameters
1922 ///
1923 /// - `value`: NT_Value struct to get the float from.
1924 /// - `last_change`: Returns time in ms since the last change in the value.
1925 /// - `v_float`: Returns the float assigned to the name.
1926 ///
1927 /// # Returns
1928 ///
1929 /// 1 if successful, or 0 if value is null or not a float.
1930 pub fn NT_GetValueFloat(
1931 value: *const NT_Value,
1932 last_change: *mut u64,
1933 v_float: *mut f32,
1934 ) -> NT_Bool;
1935
1936 /// Returns the double from the NT_Value.
1937 /// If the NT_Value is null, or is assigned to a different type, returns 0.
1938 ///
1939 /// # Parameters
1940 ///
1941 /// - `value`: NT_Value struct to get the double from.
1942 /// - `last_change`: Returns time in ms since the last change in the value.
1943 /// - `v_double`: Returns the double assigned to the name.
1944 ///
1945 /// # Returns
1946 ///
1947 /// 1 if successful, or 0 if value is null or not a double.
1948 pub fn NT_GetValueDouble(
1949 value: *const NT_Value,
1950 last_change: *mut u64,
1951 v_double: *mut f64,
1952 ) -> NT_Bool;
1953
1954 /// Returns a copy of the string from the NT_Value.
1955 /// If the NT_Value is null, or is assigned to a different type, returns 0.
1956 ///
1957 /// # Parameters
1958 ///
1959 /// - `value`: NT_Value struct to get the string from.
1960 /// - `last_change`: Returns time in ms since the last change in the value.
1961 /// - `str_len`: Returns the length of the string.
1962 ///
1963 /// # Returns
1964 ///
1965 /// Pointer to the string (UTF-8), or null if error.
1966 ///
1967 /// It is the caller's responsibility to free the string once it's no longer
1968 /// needed. The `NT_FreeCharArray()` function is useful for this purpose. The
1969 /// returned string is a copy of the string in the value, and must be freed
1970 /// separately.
1971 pub fn NT_GetValueString(
1972 value: *const NT_Value,
1973 last_change: *mut u64,
1974 str_len: *mut usize,
1975 ) -> *mut std::ffi::c_char;
1976
1977 /// Returns a copy of the raw value from the NT_Value.
1978 /// If the NT_Value is null, or is assigned to a different type, returns null.
1979 ///
1980 /// # Parameters
1981 ///
1982 /// - `value`: NT_Value struct to get the string from.
1983 /// - `last_change`: Returns time in ms since the last change in the value.
1984 /// - `raw_len`: Returns the length of the string.
1985 ///
1986 /// # Returns
1987 /// Pointer to the raw value (UTF-8), or null if error.
1988 ///
1989 /// It is the caller's responsibility to free the raw value once it's no longer
1990 /// needed. The `NT_FreeCharArray()` function is useful for this purpose. The
1991 /// returned string is a copy of the string in the value, and must be freed
1992 /// separately.
1993 pub fn NT_GetValueRaw(
1994 value: *const NT_Value,
1995 last_change: *mut u64,
1996 raw_len: *mut usize,
1997 ) -> *mut u8;
1998
1999 /// Returns a copy of the boolean array from the NT_Value.
2000 /// If the NT_Value is null, or is assigned to a different type, returns null.
2001 ///
2002 /// # Parameters
2003 ///
2004 /// - `value`: NT_Value struct to get the boolean array from.
2005 /// - `last_change`: Returns time in ms since the last change in the value.
2006 /// - `arr_size`: Returns the number of elements in the array.
2007 ///
2008 /// # Returns
2009 /// Pointer to the boolean array, or null if error.
2010 ///
2011 /// It is the caller's responsibility to free the array once it's no longer
2012 /// needed. The `NT_FreeBooleanArray()` function is useful for this purpose.
2013 /// The returned array is a copy of the array in the value, and must be
2014 /// freed separately.
2015 pub fn NT_GetValueBooleanArray(
2016 value: *const NT_Value,
2017 last_change: *mut u64,
2018 arr_size: *mut usize,
2019 ) -> *mut bool;
2020
2021 /// Returns a copy of the int array from the NT_Value.
2022 /// If the NT_Value is null, or is assigned to a different type, returns null.
2023 ///
2024 /// # Parameters
2025 ///
2026 /// - `value`: NT_Value struct to get the int array from.
2027 /// - `last_change`: Returns time in ms since the last change in the value.
2028 /// - `arr_size`: Returns the number of elements in the array.
2029 ///
2030 /// # Returns
2031 /// Pointer to the int array, or null if error.
2032 ///
2033 /// It is the caller's responsibility to free the array once it's no longer
2034 /// needed. The `NT_FreeIntegerArray()` function is useful for this purpose.
2035 /// The returned array is a copy of the array in the value, and must be
2036 /// freed separately.
2037 pub fn NT_GetValueIntegerArray(
2038 value: *const NT_Value,
2039 last_change: *mut u64,
2040 arr_size: *mut usize,
2041 ) -> *mut i64;
2042
2043 /// Returns a copy of the float array from the NT_Value.
2044 /// If the NT_Value is null, or is assigned to a different type, returns null.
2045 ///
2046 /// # Parameters
2047 ///
2048 /// - `value`: NT_Value struct to get the float array from.
2049 /// - `last_change`: Returns time in ms since the last change in the value.
2050 /// - `arr_size`: Returns the number of elements in the array.
2051 ///
2052 /// # Returns
2053 /// Pointer to the float array, or null if error.
2054 ///
2055 /// It is the caller's responsibility to free the array once it's no longer
2056 /// needed. The `NT_FreeFloatArray()` function is useful for this purpose.
2057 /// The returned array is a copy of the array in the value, and must be
2058 /// freed separately.
2059 pub fn NT_GetValueFloatArray(
2060 value: *const NT_Value,
2061 last_change: *mut u64,
2062 arr_size: *mut usize,
2063 ) -> *mut f32;
2064
2065 /// Returns a copy of the double array from the NT_Value.
2066 /// If the NT_Value is null, or is assigned to a different type, returns null.
2067 ///
2068 /// # Parameters
2069 ///
2070 /// - `value`: NT_Value struct to get the double array from.
2071 /// - `last_change`: Returns time in ms since the last change in the value.
2072 /// - `arr_size`: Returns the number of elements in the array.
2073 ///
2074 /// # Returns
2075 /// Pointer to the double array, or null if error.
2076 ///
2077 /// It is the caller's responsibility to free the array once it's no longer
2078 /// needed. The `NT_FreeDoubleArray()` function is useful for this purpose.
2079 /// The returned array is a copy of the array in the value, and must be
2080 /// freed separately.
2081 pub fn NT_GetValueDoubleArray(
2082 value: *const NT_Value,
2083 last_change: *mut u64,
2084 arr_size: *mut usize,
2085 ) -> *mut f64;
2086
2087 /// Returns a copy of the struct WPI_String array from the NT_Value.
2088 /// If the NT_Value is null, or is assigned to a different type, returns null.
2089 ///
2090 /// # Parameters
2091 ///
2092 /// - `value`: NT_Value struct to get the struct WPI_String array from.
2093 /// - `last_change`: Returns time in ms since the last change in the value.
2094 /// - `arr_size`: Returns the number of elements in the array.
2095 ///
2096 /// # Returns
2097 /// Pointer to the struct WPI_String array, or null if error.
2098 ///
2099 /// It is the caller's responsibility to free the array once it's no longer
2100 /// needed. The `WPI_FreeStringArray()` function is useful for this purpose.
2101 /// The returned array is a copy of the array in the value, and must be
2102 /// freed separately. Note that the individual struct WPI_Strings should not be
2103 /// freed, but the entire array should be freed at once. The
2104 /// `WPI_FreeStringArray()` function will free all the struct WPI_Strings.
2105 pub fn NT_GetValueStringArray(
2106 value: *const NT_Value,
2107 last_change: *mut u64,
2108 arr_size: *mut usize,
2109 ) -> *mut WPI_String;
2110
2111 /// Publish a new value.
2112 ///
2113 /// # Parameters
2114 ///
2115 /// - `pubentry`: publisher or entry handle
2116 /// - `time`: timestamp; 0 indicates current NT time should be used
2117 /// - `value`: value to publish
2118 pub fn NT_SetBoolean(pubentry: NT_Handle, time: i64, value: NT_Bool) -> NT_Bool;
2119 /// Publish a default value.
2120 /// On reconnect, a default value will never be used in preference to a
2121 /// published value.
2122 ///
2123 /// # Parameters
2124 ///
2125 /// - `pubentry`: publisher or entry handle
2126 /// - `defaultValue`: default value
2127 pub fn NT_SetDefaultBoolean(pubentry: NT_Handle, defaultValue: NT_Bool) -> NT_Bool;
2128 /// Get the last published value.
2129 /// If no value has been published, returns the passed defaultValue.
2130 ///
2131 /// # Parameters
2132 ///
2133 /// - `subentry`: subscriber or entry handle
2134 /// - `defaultValue`: default value to return if no value has been published
2135 ///
2136 /// # Returns
2137 ///
2138 /// value
2139 pub fn NT_GetBoolean(subentry: NT_Handle, defaultValue: NT_Bool) -> NT_Bool;
2140 /// Get the last published value along with its timestamp.
2141 /// If no value has been published, returns the passed defaultValue and a
2142 /// timestamp of 0.
2143 ///
2144 /// # Parameters
2145 ///
2146 /// - `subentry`: subscriber or entry handle
2147 /// - `defaultValue`: default value to return if no value has been published
2148 /// - `value`: timestamped value (output)
2149 pub fn NT_GetAtomicBoolean(
2150 subentry: NT_Handle,
2151 defaultValue: NT_Bool,
2152 value: *mut NT_TimestampedBoolean,
2153 );
2154 /// Disposes a timestamped value (as returned by NT_GetAtomicBoolean).
2155 ///
2156 /// # Parameters
2157 ///
2158 /// - `value`: timestamped value
2159 pub fn NT_DisposeTimestampedBoolean(value: *mut NT_TimestampedBoolean);
2160 /// Get an array of all value changes since the last call to ReadQueue.
2161 /// Also provides a timestamp for each value.
2162 ///
2163 /// # Note
2164 ///
2165 /// The \"poll storage\" subscribe option can be used to set the queue
2166 /// depth.
2167 ///
2168 /// # Parameters
2169 ///
2170 /// - `subentry`: subscriber or entry handle
2171 /// - `len`: length of returned array (output)
2172 ///
2173 /// # Returns
2174 ///
2175 /// Array of timestamped values; NULL if no new changes have
2176 /// been published since the previous call.
2177 pub fn NT_ReadQueueBoolean(subentry: NT_Handle, len: *mut usize) -> *mut NT_TimestampedBoolean;
2178 /// Frees a timestamped array of values (as returned by NT_ReadQueueBoolean).
2179 ///
2180 /// # Parameters
2181 ///
2182 /// - `arr`: array
2183 /// - `len`: length of array
2184 pub fn NT_FreeQueueBoolean(arr: *mut NT_TimestampedBoolean, len: usize);
2185 /// Get an array of all value changes since the last call to ReadQueue.
2186 ///
2187 /// # Note
2188 ///
2189 /// The \"poll storage\" subscribe option can be used to set the queue
2190 /// depth.
2191 ///
2192 /// # Parameters
2193 ///
2194 /// - `subentry`: subscriber or entry handle
2195 /// - `len`: length of returned array (output)
2196 ///
2197 /// # Returns
2198 ///
2199 /// Array of values; NULL if no new changes have
2200 /// been published since the previous call.
2201 pub fn NT_ReadQueueValuesBoolean(subentry: NT_Handle, len: *mut usize) -> *mut NT_Bool;
2202 /// Publish a new value.
2203 ///
2204 /// # Parameters
2205 ///
2206 /// - `pubentry`: publisher or entry handle
2207 /// - `time`: timestamp; 0 indicates current NT time should be used
2208 /// - `value`: value to publish
2209 pub fn NT_SetInteger(pubentry: NT_Handle, time: i64, value: i64) -> NT_Bool;
2210 /// Publish a default value.
2211 /// On reconnect, a default value will never be used in preference to a
2212 /// published value.
2213 ///
2214 /// # Parameters
2215 ///
2216 /// - `pubentry`: publisher or entry handle
2217 /// - `defaultValue`: default value
2218 pub fn NT_SetDefaultInteger(pubentry: NT_Handle, defaultValue: i64) -> NT_Bool;
2219 /// Get the last published value.
2220 /// If no value has been published, returns the passed defaultValue.
2221 ///
2222 /// # Parameters
2223 ///
2224 /// - `subentry`: subscriber or entry handle
2225 /// - `defaultValue`: default value to return if no value has been published
2226 ///
2227 /// # Returns
2228 ///
2229 /// value
2230 pub fn NT_GetInteger(subentry: NT_Handle, defaultValue: i64) -> i64;
2231 /// Get the last published value along with its timestamp.
2232 /// If no value has been published, returns the passed defaultValue and a
2233 /// timestamp of 0.
2234 ///
2235 /// # Parameters
2236 ///
2237 /// - `subentry`: subscriber or entry handle
2238 /// - `defaultValue`: default value to return if no value has been published
2239 /// - `value`: timestamped value (output)
2240 pub fn NT_GetAtomicInteger(
2241 subentry: NT_Handle,
2242 defaultValue: i64,
2243 value: *mut NT_TimestampedInteger,
2244 );
2245 /// Disposes a timestamped value (as returned by NT_GetAtomicInteger).
2246 ///
2247 /// # Parameters
2248 ///
2249 /// - `value`: timestamped value
2250 pub fn NT_DisposeTimestampedInteger(value: *mut NT_TimestampedInteger);
2251 /// Get an array of all value changes since the last call to ReadQueue.
2252 /// Also provides a timestamp for each value.
2253 ///
2254 /// # Note
2255 ///
2256 /// The \"poll storage\" subscribe option can be used to set the queue
2257 /// depth.
2258 ///
2259 /// # Parameters
2260 ///
2261 /// - `subentry`: subscriber or entry handle
2262 /// - `len`: length of returned array (output)
2263 ///
2264 /// # Returns
2265 ///
2266 /// Array of timestamped values; NULL if no new changes have
2267 /// been published since the previous call.
2268 pub fn NT_ReadQueueInteger(subentry: NT_Handle, len: *mut usize) -> *mut NT_TimestampedInteger;
2269 /// Frees a timestamped array of values (as returned by NT_ReadQueueInteger).
2270 ///
2271 /// # Parameters
2272 ///
2273 /// - `arr`: array
2274 /// - `len`: length of array
2275 pub fn NT_FreeQueueInteger(arr: *mut NT_TimestampedInteger, len: usize);
2276 /// Get an array of all value changes since the last call to ReadQueue.
2277 ///
2278 /// # Note
2279 ///
2280 /// The \"poll storage\" subscribe option can be used to set the queue
2281 /// depth.
2282 ///
2283 /// # Parameters
2284 ///
2285 /// - `subentry`: subscriber or entry handle
2286 /// - `len`: length of returned array (output)
2287 ///
2288 /// # Returns
2289 ///
2290 /// Array of values; NULL if no new changes have
2291 /// been published since the previous call.
2292 pub fn NT_ReadQueueValuesInteger(subentry: NT_Handle, len: *mut usize) -> *mut i64;
2293 /// Publish a new value.
2294 ///
2295 /// # Parameters
2296 ///
2297 /// - `pubentry`: publisher or entry handle
2298 /// - `time`: timestamp; 0 indicates current NT time should be used
2299 /// - `value`: value to publish
2300 pub fn NT_SetFloat(pubentry: NT_Handle, time: i64, value: f32) -> NT_Bool;
2301 /// Publish a default value.
2302 /// On reconnect, a default value will never be used in preference to a
2303 /// published value.
2304 ///
2305 /// # Parameters
2306 ///
2307 /// - `pubentry`: publisher or entry handle
2308 /// - `defaultValue`: default value
2309 pub fn NT_SetDefaultFloat(pubentry: NT_Handle, defaultValue: f32) -> NT_Bool;
2310 /// Get the last published value.
2311 /// If no value has been published, returns the passed defaultValue.
2312 ///
2313 /// # Parameters
2314 ///
2315 /// - `subentry`: subscriber or entry handle
2316 /// - `defaultValue`: default value to return if no value has been published
2317 ///
2318 /// # Returns
2319 ///
2320 /// value
2321 pub fn NT_GetFloat(subentry: NT_Handle, defaultValue: f32) -> f32;
2322 /// Get the last published value along with its timestamp.
2323 /// If no value has been published, returns the passed defaultValue and a
2324 /// timestamp of 0.
2325 ///
2326 /// # Parameters
2327 ///
2328 /// - `subentry`: subscriber or entry handle
2329 /// - `defaultValue`: default value to return if no value has been published
2330 /// - `value`: timestamped value (output)
2331 pub fn NT_GetAtomicFloat(
2332 subentry: NT_Handle,
2333 defaultValue: f32,
2334 value: *mut NT_TimestampedFloat,
2335 );
2336 /// Disposes a timestamped value (as returned by NT_GetAtomicFloat).
2337 ///
2338 /// # Parameters
2339 ///
2340 /// - `value`: timestamped value
2341 pub fn NT_DisposeTimestampedFloat(value: *mut NT_TimestampedFloat);
2342 /// Get an array of all value changes since the last call to ReadQueue.
2343 /// Also provides a timestamp for each value.
2344 ///
2345 /// # Note
2346 ///
2347 /// The \"poll storage\" subscribe option can be used to set the queue
2348 /// depth.
2349 ///
2350 /// # Parameters
2351 ///
2352 /// - `subentry`: subscriber or entry handle
2353 /// - `len`: length of returned array (output)
2354 ///
2355 /// # Returns
2356 ///
2357 /// Array of timestamped values; NULL if no new changes have
2358 /// been published since the previous call.
2359 pub fn NT_ReadQueueFloat(subentry: NT_Handle, len: *mut usize) -> *mut NT_TimestampedFloat;
2360 /// Frees a timestamped array of values (as returned by NT_ReadQueueFloat).
2361 ///
2362 /// # Parameters
2363 ///
2364 /// - `arr`: array
2365 /// - `len`: length of array
2366 pub fn NT_FreeQueueFloat(arr: *mut NT_TimestampedFloat, len: usize);
2367 /// Get an array of all value changes since the last call to ReadQueue.
2368 ///
2369 /// # Note
2370 ///
2371 /// The \"poll storage\" subscribe option can be used to set the queue
2372 /// depth.
2373 ///
2374 /// # Parameters
2375 ///
2376 /// - `subentry`: subscriber or entry handle
2377 /// - `len`: length of returned array (output)
2378 ///
2379 /// # Returns
2380 ///
2381 /// Array of values; NULL if no new changes have
2382 /// been published since the previous call.
2383 pub fn NT_ReadQueueValuesFloat(subentry: NT_Handle, len: *mut usize) -> *mut f32;
2384 /// Publish a new value.
2385 ///
2386 /// # Parameters
2387 ///
2388 /// - `pubentry`: publisher or entry handle
2389 /// - `time`: timestamp; 0 indicates current NT time should be used
2390 /// - `value`: value to publish
2391 pub fn NT_SetDouble(pubentry: NT_Handle, time: i64, value: f64) -> NT_Bool;
2392 /// Publish a default value.
2393 /// On reconnect, a default value will never be used in preference to a
2394 /// published value.
2395 ///
2396 /// # Parameters
2397 ///
2398 /// - `pubentry`: publisher or entry handle
2399 /// - `defaultValue`: default value
2400 pub fn NT_SetDefaultDouble(pubentry: NT_Handle, defaultValue: f64) -> NT_Bool;
2401 /// Get the last published value.
2402 /// If no value has been published, returns the passed defaultValue.
2403 ///
2404 /// # Parameters
2405 ///
2406 /// - `subentry`: subscriber or entry handle
2407 /// - `defaultValue`: default value to return if no value has been published
2408 ///
2409 /// # Returns
2410 ///
2411 /// value
2412 pub fn NT_GetDouble(subentry: NT_Handle, defaultValue: f64) -> f64;
2413 /// Get the last published value along with its timestamp.
2414 /// If no value has been published, returns the passed defaultValue and a
2415 /// timestamp of 0.
2416 ///
2417 /// # Parameters
2418 ///
2419 /// - `subentry`: subscriber or entry handle
2420 /// - `defaultValue`: default value to return if no value has been published
2421 /// - `value`: timestamped value (output)
2422 pub fn NT_GetAtomicDouble(
2423 subentry: NT_Handle,
2424 defaultValue: f64,
2425 value: *mut NT_TimestampedDouble,
2426 );
2427 /// Disposes a timestamped value (as returned by NT_GetAtomicDouble).
2428 ///
2429 /// # Parameters
2430 ///
2431 /// - `value`: timestamped value
2432 pub fn NT_DisposeTimestampedDouble(value: *mut NT_TimestampedDouble);
2433 /// Get an array of all value changes since the last call to ReadQueue.
2434 /// Also provides a timestamp for each value.
2435 ///
2436 /// # Note
2437 ///
2438 /// The \"poll storage\" subscribe option can be used to set the queue
2439 /// depth.
2440 ///
2441 /// # Parameters
2442 ///
2443 /// - `subentry`: subscriber or entry handle
2444 /// - `len`: length of returned array (output)
2445 ///
2446 /// # Returns
2447 ///
2448 /// Array of timestamped values; NULL if no new changes have
2449 /// been published since the previous call.
2450 pub fn NT_ReadQueueDouble(subentry: NT_Handle, len: *mut usize) -> *mut NT_TimestampedDouble;
2451 /// Frees a timestamped array of values (as returned by NT_ReadQueueDouble).
2452 ///
2453 /// # Parameters
2454 ///
2455 /// - `arr`: array
2456 /// - `len`: length of array
2457 pub fn NT_FreeQueueDouble(arr: *mut NT_TimestampedDouble, len: usize);
2458 /// Get an array of all value changes since the last call to ReadQueue.
2459 ///
2460 /// # Note
2461 ///
2462 /// The \"poll storage\" subscribe option can be used to set the queue
2463 /// depth.
2464 ///
2465 /// # Parameters
2466 ///
2467 /// - `subentry`: subscriber or entry handle
2468 /// - `len`: length of returned array (output)
2469 ///
2470 /// # Returns
2471 ///
2472 /// Array of values; NULL if no new changes have
2473 /// been published since the previous call.
2474 pub fn NT_ReadQueueValuesDouble(subentry: NT_Handle, len: *mut usize) -> *mut f64;
2475 /// Publish a new value.
2476 ///
2477 /// # Parameters
2478 ///
2479 /// - `pubentry`: publisher or entry handle
2480 /// - `time`: timestamp; 0 indicates current NT time should be used
2481 /// - `value`: value to publish
2482 pub fn NT_SetString(pubentry: NT_Handle, time: i64, value: *const WPI_String) -> NT_Bool;
2483 /// Publish a default value.
2484 /// On reconnect, a default value will never be used in preference to a
2485 /// published value.
2486 ///
2487 /// # Parameters
2488 ///
2489 /// - `pubentry`: publisher or entry handle
2490 /// - `defaultValue`: default value
2491 pub fn NT_SetDefaultString(pubentry: NT_Handle, defaultValue: *const WPI_String) -> NT_Bool;
2492 /// Get the last published value.
2493 /// If no value has been published, returns the passed defaultValue.
2494 ///
2495 /// # Parameters
2496 ///
2497 /// - `subentry`: subscriber or entry handle
2498 /// - `defaultValue`: default value to return if no value has been published
2499 /// - `value`: returned value (output)
2500 ///
2501 pub fn NT_GetString(
2502 subentry: NT_Handle,
2503 defaultValue: *const WPI_String,
2504 value: *mut WPI_String,
2505 );
2506 /// Get the last published value along with its timestamp.
2507 /// If no value has been published, returns the passed defaultValue and a
2508 /// timestamp of 0.
2509 ///
2510 /// # Parameters
2511 ///
2512 /// - `subentry`: subscriber or entry handle
2513 /// - `defaultValue`: default value to return if no value has been published
2514 /// - `value`: timestamped value (output)
2515 pub fn NT_GetAtomicString(
2516 subentry: NT_Handle,
2517 defaultValue: *const WPI_String,
2518 value: *mut NT_TimestampedString,
2519 );
2520 /// Disposes a timestamped value (as returned by NT_GetAtomicString).
2521 ///
2522 /// # Parameters
2523 ///
2524 /// - `value`: timestamped value
2525 pub fn NT_DisposeTimestampedString(value: *mut NT_TimestampedString);
2526 /// Get an array of all value changes since the last call to ReadQueue.
2527 /// Also provides a timestamp for each value.
2528 ///
2529 /// # Note
2530 ///
2531 /// The \"poll storage\" subscribe option can be used to set the queue
2532 /// depth.
2533 ///
2534 /// # Parameters
2535 ///
2536 /// - `subentry`: subscriber or entry handle
2537 /// - `len`: length of returned array (output)
2538 ///
2539 /// # Returns
2540 ///
2541 /// Array of timestamped values; NULL if no new changes have
2542 /// been published since the previous call.
2543 pub fn NT_ReadQueueString(subentry: NT_Handle, len: *mut usize) -> *mut NT_TimestampedString;
2544 /// Frees a timestamped array of values (as returned by NT_ReadQueueString).
2545 ///
2546 /// # Parameters
2547 ///
2548 /// - `arr`: array
2549 /// - `len`: length of array
2550 pub fn NT_FreeQueueString(arr: *mut NT_TimestampedString, len: usize);
2551 /// Publish a new value.
2552 ///
2553 /// # Parameters
2554 ///
2555 /// - `pubentry`: publisher or entry handle
2556 /// - `time`: timestamp; 0 indicates current NT time should be used
2557 /// - `value`: value to publish
2558 /// - `len`: length of value
2559 ///
2560 pub fn NT_SetRaw(pubentry: NT_Handle, time: i64, value: *const u8, len: usize) -> NT_Bool;
2561 /// Publish a default value.
2562 /// On reconnect, a default value will never be used in preference to a
2563 /// published value.
2564 ///
2565 /// # Parameters
2566 ///
2567 /// - `pubentry`: publisher or entry handle
2568 /// - `defaultValue`: default value
2569 /// - `defaultValueLen`: length of default value
2570 ///
2571 pub fn NT_SetDefaultRaw(
2572 pubentry: NT_Handle,
2573 defaultValue: *const u8,
2574 defaultValueLen: usize,
2575 ) -> NT_Bool;
2576 /// Get the last published value.
2577 /// If no value has been published, returns the passed defaultValue.
2578 ///
2579 /// # Parameters
2580 ///
2581 /// - `subentry`: subscriber or entry handle
2582 /// - `defaultValue`: default value to return if no value has been published
2583 /// - `defaultValueLen`: length of default value
2584 /// - `len`: length of returned value (output)
2585 ///
2586 ///
2587 /// # Returns
2588 ///
2589 /// value
2590 pub fn NT_GetRaw(
2591 subentry: NT_Handle,
2592 defaultValue: *const u8,
2593 defaultValueLen: usize,
2594 len: *mut usize,
2595 ) -> *mut u8;
2596 /// Get the last published value along with its timestamp.
2597 /// If no value has been published, returns the passed defaultValue and a
2598 /// timestamp of 0.
2599 ///
2600 /// # Parameters
2601 ///
2602 /// - `subentry`: subscriber or entry handle
2603 /// - `defaultValue`: default value to return if no value has been published
2604 /// - `defaultValueLen`: length of default value
2605 ///
2606 /// # Parameters
2607 ///
2608 /// - `value`: timestamped value (output)
2609 pub fn NT_GetAtomicRaw(
2610 subentry: NT_Handle,
2611 defaultValue: *const u8,
2612 defaultValueLen: usize,
2613 value: *mut NT_TimestampedRaw,
2614 );
2615 /// Disposes a timestamped value (as returned by NT_GetAtomicRaw).
2616 ///
2617 /// # Parameters
2618 ///
2619 /// - `value`: timestamped value
2620 pub fn NT_DisposeTimestampedRaw(value: *mut NT_TimestampedRaw);
2621 /// Get an array of all value changes since the last call to ReadQueue.
2622 /// Also provides a timestamp for each value.
2623 ///
2624 /// # Note
2625 ///
2626 /// The \"poll storage\" subscribe option can be used to set the queue
2627 /// depth.
2628 ///
2629 /// # Parameters
2630 ///
2631 /// - `subentry`: subscriber or entry handle
2632 /// - `len`: length of returned array (output)
2633 ///
2634 /// # Returns
2635 ///
2636 /// Array of timestamped values; NULL if no new changes have
2637 /// been published since the previous call.
2638 pub fn NT_ReadQueueRaw(subentry: NT_Handle, len: *mut usize) -> *mut NT_TimestampedRaw;
2639 /// Frees a timestamped array of values (as returned by NT_ReadQueueRaw).
2640 ///
2641 /// # Parameters
2642 ///
2643 /// - `arr`: array
2644 /// - `len`: length of array
2645 pub fn NT_FreeQueueRaw(arr: *mut NT_TimestampedRaw, len: usize);
2646 /// Publish a new value.
2647 ///
2648 /// # Parameters
2649 ///
2650 /// - `pubentry`: publisher or entry handle
2651 /// - `time`: timestamp; 0 indicates current NT time should be used
2652 /// - `value`: value to publish
2653 /// - `len`: length of value
2654 ///
2655 pub fn NT_SetBooleanArray(
2656 pubentry: NT_Handle,
2657 time: i64,
2658 value: *const NT_Bool,
2659 len: usize,
2660 ) -> NT_Bool;
2661 /// Publish a default value.
2662 /// On reconnect, a default value will never be used in preference to a
2663 /// published value.
2664 ///
2665 /// # Parameters
2666 ///
2667 /// - `pubentry`: publisher or entry handle
2668 /// - `defaultValue`: default value
2669 /// - `defaultValueLen`: length of default value
2670 ///
2671 pub fn NT_SetDefaultBooleanArray(
2672 pubentry: NT_Handle,
2673 defaultValue: *const NT_Bool,
2674 defaultValueLen: usize,
2675 ) -> NT_Bool;
2676 /// Get the last published value.
2677 /// If no value has been published, returns the passed defaultValue.
2678 ///
2679 /// # Parameters
2680 ///
2681 /// - `subentry`: subscriber or entry handle
2682 /// - `defaultValue`: default value to return if no value has been published
2683 /// - `defaultValueLen`: length of default value
2684 /// - `len`: length of returned value (output)
2685 ///
2686 ///
2687 /// # Returns
2688 ///
2689 /// value
2690 pub fn NT_GetBooleanArray(
2691 subentry: NT_Handle,
2692 defaultValue: *const NT_Bool,
2693 defaultValueLen: usize,
2694 len: *mut usize,
2695 ) -> *mut NT_Bool;
2696 /// Get the last published value along with its timestamp.
2697 /// If no value has been published, returns the passed defaultValue and a
2698 /// timestamp of 0.
2699 ///
2700 /// # Parameters
2701 ///
2702 /// - `subentry`: subscriber or entry handle
2703 /// - `defaultValue`: default value to return if no value has been published
2704 /// - `defaultValueLen`: length of default value
2705 ///
2706 /// # Parameters
2707 ///
2708 /// - `value`: timestamped value (output)
2709 pub fn NT_GetAtomicBooleanArray(
2710 subentry: NT_Handle,
2711 defaultValue: *const NT_Bool,
2712 defaultValueLen: usize,
2713 value: *mut NT_TimestampedBooleanArray,
2714 );
2715 /// Disposes a timestamped value (as returned by NT_GetAtomicBooleanArray).
2716 ///
2717 /// # Parameters
2718 ///
2719 /// - `value`: timestamped value
2720 pub fn NT_DisposeTimestampedBooleanArray(value: *mut NT_TimestampedBooleanArray);
2721 /// Get an array of all value changes since the last call to ReadQueue.
2722 /// Also provides a timestamp for each value.
2723 ///
2724 /// # Note
2725 ///
2726 /// The \"poll storage\" subscribe option can be used to set the queue
2727 /// depth.
2728 ///
2729 /// # Parameters
2730 ///
2731 /// - `subentry`: subscriber or entry handle
2732 /// - `len`: length of returned array (output)
2733 ///
2734 /// # Returns
2735 ///
2736 /// Array of timestamped values; NULL if no new changes have
2737 /// been published since the previous call.
2738 pub fn NT_ReadQueueBooleanArray(
2739 subentry: NT_Handle,
2740 len: *mut usize,
2741 ) -> *mut NT_TimestampedBooleanArray;
2742 /// Frees a timestamped array of values (as returned by NT_ReadQueueBooleanArray).
2743 ///
2744 /// # Parameters
2745 ///
2746 /// - `arr`: array
2747 /// - `len`: length of array
2748 pub fn NT_FreeQueueBooleanArray(arr: *mut NT_TimestampedBooleanArray, len: usize);
2749 /// Publish a new value.
2750 ///
2751 /// # Parameters
2752 ///
2753 /// - `pubentry`: publisher or entry handle
2754 /// - `time`: timestamp; 0 indicates current NT time should be used
2755 /// - `value`: value to publish
2756 /// - `len`: length of value
2757 ///
2758 pub fn NT_SetIntegerArray(
2759 pubentry: NT_Handle,
2760 time: i64,
2761 value: *const i64,
2762 len: usize,
2763 ) -> NT_Bool;
2764 /// Publish a default value.
2765 /// On reconnect, a default value will never be used in preference to a
2766 /// published value.
2767 ///
2768 /// # Parameters
2769 ///
2770 /// - `pubentry`: publisher or entry handle
2771 /// - `defaultValue`: default value
2772 /// - `defaultValueLen`: length of default value
2773 ///
2774 pub fn NT_SetDefaultIntegerArray(
2775 pubentry: NT_Handle,
2776 defaultValue: *const i64,
2777 defaultValueLen: usize,
2778 ) -> NT_Bool;
2779 /// Get the last published value.
2780 /// If no value has been published, returns the passed defaultValue.
2781 ///
2782 /// # Parameters
2783 ///
2784 /// - `subentry`: subscriber or entry handle
2785 /// - `defaultValue`: default value to return if no value has been published
2786 /// - `defaultValueLen`: length of default value
2787 /// - `len`: length of returned value (output)
2788 ///
2789 ///
2790 /// # Returns
2791 ///
2792 /// value
2793 pub fn NT_GetIntegerArray(
2794 subentry: NT_Handle,
2795 defaultValue: *const i64,
2796 defaultValueLen: usize,
2797 len: *mut usize,
2798 ) -> *mut i64;
2799 /// Get the last published value along with its timestamp.
2800 /// If no value has been published, returns the passed defaultValue and a
2801 /// timestamp of 0.
2802 ///
2803 /// # Parameters
2804 ///
2805 /// - `subentry`: subscriber or entry handle
2806 /// - `defaultValue`: default value to return if no value has been published
2807 /// - `defaultValueLen`: length of default value
2808 ///
2809 /// # Parameters
2810 ///
2811 /// - `value`: timestamped value (output)
2812 pub fn NT_GetAtomicIntegerArray(
2813 subentry: NT_Handle,
2814 defaultValue: *const i64,
2815 defaultValueLen: usize,
2816 value: *mut NT_TimestampedIntegerArray,
2817 );
2818 /// Disposes a timestamped value (as returned by NT_GetAtomicIntegerArray).
2819 ///
2820 /// # Parameters
2821 ///
2822 /// - `value`: timestamped value
2823 pub fn NT_DisposeTimestampedIntegerArray(value: *mut NT_TimestampedIntegerArray);
2824 /// Get an array of all value changes since the last call to ReadQueue.
2825 /// Also provides a timestamp for each value.
2826 ///
2827 /// # Note
2828 ///
2829 /// The \"poll storage\" subscribe option can be used to set the queue
2830 /// depth.
2831 ///
2832 /// # Parameters
2833 ///
2834 /// - `subentry`: subscriber or entry handle
2835 /// - `len`: length of returned array (output)
2836 ///
2837 /// # Returns
2838 ///
2839 /// Array of timestamped values; NULL if no new changes have
2840 /// been published since the previous call.
2841 pub fn NT_ReadQueueIntegerArray(
2842 subentry: NT_Handle,
2843 len: *mut usize,
2844 ) -> *mut NT_TimestampedIntegerArray;
2845 /// Frees a timestamped array of values (as returned by NT_ReadQueueIntegerArray).
2846 ///
2847 /// # Parameters
2848 ///
2849 /// - `arr`: array
2850 /// - `len`: length of array
2851 pub fn NT_FreeQueueIntegerArray(arr: *mut NT_TimestampedIntegerArray, len: usize);
2852 /// Publish a new value.
2853 ///
2854 /// # Parameters
2855 ///
2856 /// - `pubentry`: publisher or entry handle
2857 /// - `time`: timestamp; 0 indicates current NT time should be used
2858 /// - `value`: value to publish
2859 /// - `len`: length of value
2860 ///
2861 pub fn NT_SetFloatArray(
2862 pubentry: NT_Handle,
2863 time: i64,
2864 value: *const f32,
2865 len: usize,
2866 ) -> NT_Bool;
2867 /// Publish a default value.
2868 /// On reconnect, a default value will never be used in preference to a
2869 /// published value.
2870 ///
2871 /// # Parameters
2872 ///
2873 /// - `pubentry`: publisher or entry handle
2874 /// - `defaultValue`: default value
2875 /// - `defaultValueLen`: length of default value
2876 ///
2877 pub fn NT_SetDefaultFloatArray(
2878 pubentry: NT_Handle,
2879 defaultValue: *const f32,
2880 defaultValueLen: usize,
2881 ) -> NT_Bool;
2882 /// Get the last published value.
2883 /// If no value has been published, returns the passed defaultValue.
2884 ///
2885 /// # Parameters
2886 ///
2887 /// - `subentry`: subscriber or entry handle
2888 /// - `defaultValue`: default value to return if no value has been published
2889 /// - `defaultValueLen`: length of default value
2890 /// - `len`: length of returned value (output)
2891 ///
2892 ///
2893 /// # Returns
2894 ///
2895 /// value
2896 pub fn NT_GetFloatArray(
2897 subentry: NT_Handle,
2898 defaultValue: *const f32,
2899 defaultValueLen: usize,
2900 len: *mut usize,
2901 ) -> *mut f32;
2902 /// Get the last published value along with its timestamp.
2903 /// If no value has been published, returns the passed defaultValue and a
2904 /// timestamp of 0.
2905 ///
2906 /// # Parameters
2907 ///
2908 /// - `subentry`: subscriber or entry handle
2909 /// - `defaultValue`: default value to return if no value has been published
2910 /// - `defaultValueLen`: length of default value
2911 /// - `value`: timestamped value (output)
2912 pub fn NT_GetAtomicFloatArray(
2913 subentry: NT_Handle,
2914 defaultValue: *const f32,
2915 defaultValueLen: usize,
2916 value: *mut NT_TimestampedFloatArray,
2917 );
2918 /// Disposes a timestamped value (as returned by NT_GetAtomicFloatArray).
2919 ///
2920 /// # Parameters
2921 ///
2922 /// - `value`: timestamped value
2923 pub fn NT_DisposeTimestampedFloatArray(value: *mut NT_TimestampedFloatArray);
2924 /// Get an array of all value changes since the last call to ReadQueue.
2925 /// Also provides a timestamp for each value.
2926 ///
2927 /// # Note
2928 ///
2929 /// The \"poll storage\" subscribe option can be used to set the queue
2930 /// depth.
2931 ///
2932 /// # Parameters
2933 ///
2934 /// - `subentry`: subscriber or entry handle
2935 /// - `len`: length of returned array (output)
2936 ///
2937 /// # Returns
2938 ///
2939 /// Array of timestamped values; NULL if no new changes have
2940 /// been published since the previous call.
2941 pub fn NT_ReadQueueFloatArray(
2942 subentry: NT_Handle,
2943 len: *mut usize,
2944 ) -> *mut NT_TimestampedFloatArray;
2945 /// Frees a timestamped array of values (as returned by NT_ReadQueueFloatArray).
2946 ///
2947 /// # Parameters
2948 ///
2949 /// - `arr`: array
2950 /// - `len`: length of array
2951 pub fn NT_FreeQueueFloatArray(arr: *mut NT_TimestampedFloatArray, len: usize);
2952 /// Publish a new value.
2953 ///
2954 /// # Parameters
2955 ///
2956 /// - `pubentry`: publisher or entry handle
2957 /// - `time`: timestamp; 0 indicates current NT time should be used
2958 /// - `value`: value to publish
2959 /// - `len`: length of value
2960 ///
2961 pub fn NT_SetDoubleArray(
2962 pubentry: NT_Handle,
2963 time: i64,
2964 value: *const f64,
2965 len: usize,
2966 ) -> NT_Bool;
2967 /// Publish a default value.
2968 /// On reconnect, a default value will never be used in preference to a
2969 /// published value.
2970 ///
2971 /// # Parameters
2972 ///
2973 /// - `pubentry`: publisher or entry handle
2974 /// - `defaultValue`: default value
2975 /// - `defaultValueLen`: length of default value
2976 ///
2977 pub fn NT_SetDefaultDoubleArray(
2978 pubentry: NT_Handle,
2979 defaultValue: *const f64,
2980 defaultValueLen: usize,
2981 ) -> NT_Bool;
2982 /// Get the last published value.
2983 /// If no value has been published, returns the passed defaultValue.
2984 ///
2985 /// # Parameters
2986 ///
2987 /// - `subentry`: subscriber or entry handle
2988 /// - `defaultValue`: default value to return if no value has been published
2989 /// - `defaultValueLen`: length of default value
2990 /// - `len`: length of returned value (output)
2991 ///
2992 ///
2993 /// # Returns
2994 ///
2995 /// value
2996 pub fn NT_GetDoubleArray(
2997 subentry: NT_Handle,
2998 defaultValue: *const f64,
2999 defaultValueLen: usize,
3000 len: *mut usize,
3001 ) -> *mut f64;
3002 /// Get the last published value along with its timestamp.
3003 /// If no value has been published, returns the passed defaultValue and a
3004 /// timestamp of 0.
3005 ///
3006 /// # Parameters
3007 ///
3008 /// - `subentry`: subscriber or entry handle
3009 /// - `defaultValue`: default value to return if no value has been published
3010 /// - `defaultValueLen`: length of default value
3011 ///
3012 /// # Parameters
3013 ///
3014 /// - `value`: timestamped value (output)
3015 pub fn NT_GetAtomicDoubleArray(
3016 subentry: NT_Handle,
3017 defaultValue: *const f64,
3018 defaultValueLen: usize,
3019 value: *mut NT_TimestampedDoubleArray,
3020 );
3021 /// Disposes a timestamped value (as returned by NT_GetAtomicDoubleArray).
3022 ///
3023 /// # Parameters
3024 ///
3025 /// - `value`: timestamped value
3026 pub fn NT_DisposeTimestampedDoubleArray(value: *mut NT_TimestampedDoubleArray);
3027 /// Get an array of all value changes since the last call to ReadQueue.
3028 /// Also provides a timestamp for each value.
3029 ///
3030 /// # Note
3031 ///
3032 /// The \"poll storage\" subscribe option can be used to set the queue
3033 /// depth.
3034 ///
3035 /// # Parameters
3036 ///
3037 /// - `subentry`: subscriber or entry handle
3038 /// - `len`: length of returned array (output)
3039 ///
3040 /// # Returns
3041 ///
3042 /// Array of timestamped values; NULL if no new changes have
3043 /// been published since the previous call.
3044 pub fn NT_ReadQueueDoubleArray(
3045 subentry: NT_Handle,
3046 len: *mut usize,
3047 ) -> *mut NT_TimestampedDoubleArray;
3048 /// Frees a timestamped array of values (as returned by NT_ReadQueueDoubleArray).
3049 ///
3050 /// # Parameters
3051 ///
3052 /// - `arr`: array
3053 /// - `len`: length of array
3054 pub fn NT_FreeQueueDoubleArray(arr: *mut NT_TimestampedDoubleArray, len: usize);
3055 /// Publish a new value.
3056 ///
3057 /// # Parameters
3058 ///
3059 /// - `pubentry`: publisher or entry handle
3060 /// - `time`: timestamp; 0 indicates current NT time should be used
3061 /// - `value`: value to publish
3062 /// - `len`: length of value
3063 ///
3064 pub fn NT_SetStringArray(
3065 pubentry: NT_Handle,
3066 time: i64,
3067 value: *const WPI_String,
3068 len: usize,
3069 ) -> NT_Bool;
3070 /// Publish a default value.
3071 /// On reconnect, a default value will never be used in preference to a
3072 /// published value.
3073 ///
3074 /// # Parameters
3075 ///
3076 /// - `pubentry`: publisher or entry handle
3077 /// - `defaultValue`: default value
3078 /// - `defaultValueLen`: length of default value
3079 ///
3080 pub fn NT_SetDefaultStringArray(
3081 pubentry: NT_Handle,
3082 defaultValue: *const WPI_String,
3083 defaultValueLen: usize,
3084 ) -> NT_Bool;
3085 /// Get the last published value.
3086 /// If no value has been published, returns the passed defaultValue.
3087 ///
3088 /// # Parameters
3089 ///
3090 /// - `subentry`: subscriber or entry handle
3091 /// - `defaultValue`: default value to return if no value has been published
3092 /// - `defaultValueLen`: length of default value
3093 /// - `len`: length of returned value (output)
3094 ///
3095 ///
3096 /// # Returns
3097 ///
3098 /// value
3099 pub fn NT_GetStringArray(
3100 subentry: NT_Handle,
3101 defaultValue: *const WPI_String,
3102 defaultValueLen: usize,
3103 len: *mut usize,
3104 ) -> *mut WPI_String;
3105 /// Get the last published value along with its timestamp.
3106 /// If no value has been published, returns the passed defaultValue and a
3107 /// timestamp of 0.
3108 ///
3109 /// # Parameters
3110 ///
3111 /// - `subentry`: subscriber or entry handle
3112 /// - `defaultValue`: default value to return if no value has been published
3113 /// - `defaultValueLen`: length of default value
3114 ///
3115 /// # Parameters
3116 ///
3117 /// - `value`: timestamped value (output)
3118 pub fn NT_GetAtomicStringArray(
3119 subentry: NT_Handle,
3120 defaultValue: *const WPI_String,
3121 defaultValueLen: usize,
3122 value: *mut NT_TimestampedStringArray,
3123 );
3124 /// Disposes a timestamped value (as returned by NT_GetAtomicStringArray).
3125 ///
3126 /// # Parameters
3127 ///
3128 /// - `value`: timestamped value
3129 pub fn NT_DisposeTimestampedStringArray(value: *mut NT_TimestampedStringArray);
3130 /// Get an array of all value changes since the last call to ReadQueue.
3131 /// Also provides a timestamp for each value.
3132 ///
3133 /// # Note
3134 ///
3135 /// The \"poll storage\" subscribe option can be used to set the queue
3136 /// depth.
3137 ///
3138 /// # Parameters
3139 ///
3140 /// - `subentry`: subscriber or entry handle
3141 /// - `len`: length of returned array (output)
3142 ///
3143 /// # Returns
3144 ///
3145 /// Array of timestamped values; NULL if no new changes have
3146 /// been published since the previous call.
3147 pub fn NT_ReadQueueStringArray(
3148 subentry: NT_Handle,
3149 len: *mut usize,
3150 ) -> *mut NT_TimestampedStringArray;
3151 /// Frees a timestamped array of values (as returned by NT_ReadQueueStringArray).
3152 ///
3153 /// # Parameters
3154 ///
3155 /// - `arr`: array
3156 /// - `len`: length of array
3157 pub fn NT_FreeQueueStringArray(arr: *mut NT_TimestampedStringArray, len: usize);
3158}