WPILibC++ 2023.4.3
ntcore_c.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <stdint.h>
8
9#ifdef __cplusplus
10#include <cstddef>
11#else
12#include <stddef.h>
13#endif
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/**
20 * @defgroup ntcore_c_api ntcore C API
21 *
22 * Handle-based interface for C.
23 *
24 * @{
25 */
26
27/** Typedefs */
28typedef int NT_Bool;
29
30typedef unsigned int NT_Handle;
41
42/** Default network tables port number (NT3) */
43#define NT_DEFAULT_PORT3 1735
44
45/** Default network tables port number (NT4) */
46#define NT_DEFAULT_PORT4 5810
47
48/** NetworkTables data types. */
49enum NT_Type {
51 NT_BOOLEAN = 0x01,
52 NT_DOUBLE = 0x02,
53 NT_STRING = 0x04,
54 NT_RAW = 0x08,
58 NT_RPC = 0x80,
59 NT_INTEGER = 0x100,
60 NT_FLOAT = 0x200,
62 NT_FLOAT_ARRAY = 0x800
63};
64
65/** NetworkTables entry flags. */
66enum NT_EntryFlags { NT_PERSISTENT = 0x01, NT_RETAINED = 0x02 };
67
68/** NetworkTables logging levels. */
79};
80
81/** Client/server modes */
83 NT_NET_MODE_NONE = 0x00, /* not running */
84 NT_NET_MODE_SERVER = 0x01, /* running in server mode */
85 NT_NET_MODE_CLIENT3 = 0x02, /* running in NT3 client mode */
86 NT_NET_MODE_CLIENT4 = 0x04, /* running in NT4 client mode */
87 NT_NET_MODE_STARTING = 0x08, /* flag for starting (either client or server) */
88 NT_NET_MODE_LOCAL = 0x10, /* running in local-only mode */
89};
90
91/** Event notification flags. */
94 /** Initial listener addition. */
96 /** Client connected (on server, any client connected). */
98 /** Client disconnected (on server, any client disconnected). */
100 /** Any connection event (connect or disconnect). */
102 /** New topic published. */
104 /** Topic unpublished. */
106 /** Topic properties changed. */
108 /** Any topic event (publish, unpublish, or properties changed). */
110 /** Topic value updated (via network). */
112 /** Topic value updated (local). */
114 /** Topic value updated (network or local). */
116 /** Log message. */
118 /** Time synchronized with server. */
120};
121
122/*
123 * Structures
124 */
125
126/** A NetworkTables string. */
127struct NT_String {
128 /**
129 * String contents (UTF-8).
130 * The string is NOT required to be zero-terminated.
131 * When returned by the library, this is zero-terminated and allocated with
132 * std::malloc().
133 */
134 char* str;
135
136 /**
137 * Length of the string in bytes. If the string happens to be zero
138 * terminated, this does not include the zero-termination.
139 */
140 size_t len;
141};
142
143/** NetworkTables Entry Value. Note this is a typed union. */
144struct NT_Value {
148 union {
151 float v_float;
152 double v_double;
154 struct {
156 size_t size;
158 struct {
160 size_t size;
162 struct {
163 double* arr;
164 size_t size;
166 struct {
167 float* arr;
168 size_t size;
170 struct {
172 size_t size;
174 struct {
175 struct NT_String* arr;
176 size_t size;
179};
180
181/** NetworkTables Topic Information */
183 /** Topic handle */
185
186 /** Topic name */
188
189 /** Topic type */
191
192 /** Topic type string */
194
195 /** Topic properties JSON string */
197};
198
199/** NetworkTables Connection Information */
201 /**
202 * The remote identifier (as set on the remote node by NT_StartClient4().
203 */
205
206 /** The IP address of the remote node. */
208
209 /** The port number of the remote node. */
210 unsigned int remote_port;
211
212 /**
213 * The last time any update was received from the remote node (same scale as
214 * returned by nt::Now()).
215 */
217
218 /**
219 * The protocol version being used for this connection. This in protocol
220 * layer format, so 0x0200 = 2.0, 0x0300 = 3.0).
221 */
222 unsigned int protocol_version;
223};
224
225/** NetworkTables value event data. */
227 /** Topic handle. */
229
230 /** Subscriber/entry handle. */
232
233 /** The new value. */
235};
236
237/** NetworkTables log message. */
239 /** Log level of the message. See NT_LogLevel. */
240 unsigned int level;
241
242 /** The filename of the source file that generated the message. */
243 char* filename;
244
245 /** The line number in the source file that generated the message. */
246 unsigned int line;
247
248 /** The message. */
249 char* message;
250};
251
252/** NetworkTables time sync event data. */
254 /**
255 * Offset between local time and server time, in microseconds. Add this value
256 * to local time to get the estimated equivalent server time.
257 */
259
260 /** Measured round trip time divided by 2, in microseconds. */
262
263 /**
264 * If serverTimeOffset and RTT are valid. An event with this set to false is
265 * sent when the client disconnects.
266 */
268};
269
270/** NetworkTables event */
271struct NT_Event {
272 /** Listener that triggered this event. */
274
275 /**
276 * Event flags (NT_EventFlags). Also indicates the data included with the
277 * event:
278 * - NT_EVENT_CONNECTED or NT_EVENT_DISCONNECTED: connInfo
279 * - NT_EVENT_PUBLISH, NT_EVENT_UNPUBLISH, or NT_EVENT_PROPERTIES: topicInfo
280 * - NT_EVENT_VALUE_REMOTE, NT_NOTIFY_VALUE_LOCAL: valueData
281 * - NT_EVENT_LOGMESSAGE: logMessage
282 * - NT_EVENT_TIMESYNC: timeSyncData
283 */
284 unsigned int flags;
285
286 /** Event data; content depends on flags. */
287 union {
294};
295
296/** NetworkTables publish/subscribe options. */
298 /**
299 * Structure size. Must be set to sizeof(NT_PubSubOptions).
300 */
301 unsigned int structSize;
302
303 /**
304 * Polling storage size for a subscription. Specifies the maximum number of
305 * updates NetworkTables should store between calls to the subscriber's
306 * ReadQueue() function. If zero, defaults to 1 if sendAll is false, 20 if
307 * sendAll is true.
308 */
309 unsigned int pollStorage;
310
311 /**
312 * How frequently changes will be sent over the network, in seconds.
313 * NetworkTables may send more frequently than this (e.g. use a combined
314 * minimum period for all values) or apply a restricted range to this value.
315 * The default is 100 ms.
316 */
317 double periodic;
318
319 /**
320 * For subscriptions, if non-zero, value updates for ReadQueue() are not
321 * queued for this publisher.
322 */
324
325 /**
326 * Send all value changes over the network.
327 */
329
330 /**
331 * For subscriptions, don't ask for value changes (only topic announcements).
332 */
334
335 /**
336 * Perform prefix match on subscriber topic names. Is ignored/overridden by
337 * Subscribe() functions; only present in struct for the purposes of getting
338 * information about subscriptions.
339 */
341
342 /**
343 * Preserve duplicate value changes (rather than ignoring them).
344 */
346
347 /**
348 * For subscriptions, if remote value updates should not be queued for
349 * ReadQueue(). See also disableLocal.
350 */
352
353 /**
354 * For subscriptions, if local value updates should not be queued for
355 * ReadQueue(). See also disableRemote.
356 */
358
359 /**
360 * For entries, don't queue (for ReadQueue) value updates for the entry's
361 * internal publisher.
362 */
364};
365
366/**
367 * @defgroup ntcore_instance_cfunc Instance Functions
368 * @{
369 */
370
371/**
372 * Get default instance.
373 * This is the instance used by non-handle-taking functions.
374 *
375 * @return Instance handle
376 */
378
379/**
380 * Create an instance.
381 *
382 * @return Instance handle
383 */
385
386/**
387 * Destroy an instance.
388 * The default instance cannot be destroyed.
389 *
390 * @param inst Instance handle
391 */
393
394/**
395 * Get instance handle from another handle.
396 *
397 * @param handle handle
398 * @return Instance handle
399 */
401
402/** @} */
403
404/**
405 * @defgroup ntcore_table_cfunc Table Functions
406 * @{
407 */
408
409/**
410 * Get Entry Handle.
411 *
412 * @param inst instance handle
413 * @param name entry name (UTF-8 string)
414 * @param name_len length of name in bytes
415 * @return entry handle
416 */
417NT_Entry NT_GetEntry(NT_Inst inst, const char* name, size_t name_len);
418
419/**
420 * Gets the name of the specified entry.
421 * Returns an empty string if the handle is invalid.
422 *
423 * @param entry entry handle
424 * @param name_len length of the returned string (output parameter)
425 * @return Entry name
426 */
427char* NT_GetEntryName(NT_Entry entry, size_t* name_len);
428
429/**
430 * Gets the type for the specified key, or unassigned if non existent.
431 *
432 * @param entry entry handle
433 * @return Entry type
434 */
436
437/**
438 * Gets the last time the entry was changed.
439 * Returns 0 if the handle is invalid.
440 *
441 * @param entry entry handle
442 * @return Entry last change time
443 */
445
446/**
447 * Get Entry Value.
448 *
449 * Returns copy of current entry value.
450 * Note that one of the type options is "unassigned".
451 *
452 * @param entry entry handle
453 * @param value storage for returned entry value
454 *
455 * It is the caller's responsibility to free value once it's no longer
456 * needed (the utility function NT_DisposeValue() is useful for this
457 * purpose).
458 */
460
461/**
462 * Set Default Entry Value.
463 *
464 * Returns copy of current entry value if it exists.
465 * Otherwise, sets passed in value, and returns set value.
466 * Note that one of the type options is "unassigned".
467 *
468 * @param entry entry handle
469 * @param default_value value to be set if name does not exist
470 * @return 0 on error (value not set), 1 on success
471 */
473 const struct NT_Value* default_value);
474
475/**
476 * Set Entry Value.
477 *
478 * Sets new entry value. If type of new value differs from the type of the
479 * currently stored entry, returns error and does not update value.
480 *
481 * @param entry entry handle
482 * @param value new entry value
483 * @return 0 on error (type mismatch), 1 on success
484 */
486
487/**
488 * Set Entry Flags.
489 *
490 * @param entry entry handle
491 * @param flags flags value (bitmask of NT_EntryFlags)
492 */
493void NT_SetEntryFlags(NT_Entry entry, unsigned int flags);
494
495/**
496 * Get Entry Flags.
497 *
498 * @param entry entry handle
499 * @return Flags value (bitmask of NT_EntryFlags)
500 */
501unsigned int NT_GetEntryFlags(NT_Entry entry);
502
503/**
504 * Read Entry Queue.
505 *
506 * Returns new entry values since last call. The returned array must be freed
507 * using NT_DisposeValueArray().
508 *
509 * @param subentry subscriber or entry handle
510 * @param count count of items in returned array (output)
511 * @return entry value array; returns NULL and count=0 if no new values
512 */
513struct NT_Value* NT_ReadQueueValue(NT_Handle subentry, size_t* count);
514
515/** @} */
516
517/**
518 * @defgroup ntcore_topic_cfunc Topic Functions
519 * @{
520 */
521
522/**
523 * Get Published Topic Handles.
524 *
525 * Returns an array of topic handles. The results are optionally
526 * filtered by string prefix and type to only return a subset of all
527 * topics.
528 *
529 * @param inst instance handle
530 * @param prefix name required prefix; only topics whose name
531 * starts with this string are returned
532 * @param prefix_len length of prefix in bytes
533 * @param types bitmask of NT_Type values; 0 is treated specially
534 * as a "don't care"
535 * @param count output parameter; set to length of returned array
536 * @return Array of topic handles.
537 */
538NT_Topic* NT_GetTopics(NT_Inst inst, const char* prefix, size_t prefix_len,
539 unsigned int types, size_t* count);
540
541/**
542 * Get Published Topic Handles.
543 *
544 * Returns an array of topic handles. The results are optionally
545 * filtered by string prefix and type to only return a subset of all
546 * topics.
547 *
548 * @param inst instance handle
549 * @param prefix name required prefix; only topics whose name
550 * starts with this string are returned
551 * @param prefix_len length of prefix in bytes
552 * @param types array of type strings
553 * @param types_len number of elements in types array
554 * @param count output parameter; set to length of returned array
555 * @return Array of topic handles.
556 */
557NT_Topic* NT_GetTopicsStr(NT_Inst inst, const char* prefix, size_t prefix_len,
558 const char* const* types, size_t types_len,
559 size_t* count);
560
561/**
562 * Get Topics.
563 *
564 * Returns an array of topic information (handle, name, type). The results are
565 * optionally filtered by string prefix and type to only return a subset
566 * of all topics.
567 *
568 * @param inst instance handle
569 * @param prefix name required prefix; only topics whose name
570 * starts with this string are returned
571 * @param prefix_len length of prefix in bytes
572 * @param types bitmask of NT_Type values; 0 is treated specially
573 * as a "don't care"
574 * @param count output parameter; set to length of returned array
575 * @return Array of topic information.
576 */
577struct NT_TopicInfo* NT_GetTopicInfos(NT_Inst inst, const char* prefix,
578 size_t prefix_len, unsigned int types,
579 size_t* count);
580
581/**
582 * Get Topics.
583 *
584 * Returns an array of topic information (handle, name, type). The results are
585 * optionally filtered by string prefix and type to only return a subset
586 * of all topics.
587 *
588 * @param inst instance handle
589 * @param prefix name required prefix; only topics whose name
590 * starts with this string are returned
591 * @param prefix_len length of prefix in bytes
592 * @param types array of type strings
593 * @param types_len number of elements in types array
594 * @param count output parameter; set to length of returned array
595 * @return Array of topic information.
596 */
597struct NT_TopicInfo* NT_GetTopicInfosStr(NT_Inst inst, const char* prefix,
598 size_t prefix_len,
599 const char* const* types,
600 size_t types_len, size_t* count);
601
602/**
603 * Gets Topic Information.
604 *
605 * Returns information about a topic (name and type).
606 *
607 * @param topic handle
608 * @param info information (output)
609 * @return True if successful, false on error.
610 */
612
613/**
614 * Gets Topic Handle.
615 *
616 * Returns topic handle.
617 *
618 * @param inst instance handle
619 * @param name topic name
620 * @param name_len length of topic name in bytes
621 * @return Topic handle.
622 */
623NT_Topic NT_GetTopic(NT_Inst inst, const char* name, size_t name_len);
624
625/**
626 * Gets the name of the specified topic.
627 *
628 * @param topic topic handle
629 * @param name_len length of topic name (output)
630 * @return Topic name; returns NULL and name_len=0 if the handle is invalid.
631 */
632char* NT_GetTopicName(NT_Topic topic, size_t* name_len);
633
634/**
635 * Gets the type for the specified topic, or unassigned if non existent.
636 *
637 * @param topic topic handle
638 * @return Topic type
639 */
641
642/**
643 * Gets the type string for the specified topic. This may have more information
644 * than the numeric type (especially for raw values).
645 *
646 * @param topic topic handle
647 * @param type_len length of type string (output)
648 * @return Topic type string; returns NULL if non-existent
649 */
650char* NT_GetTopicTypeString(NT_Topic topic, size_t* type_len);
651
652/**
653 * Sets the persistent property of a topic. If true, the stored value is
654 * persistent through server restarts.
655 *
656 * @param topic topic handle
657 * @param value True for persistent, false for not persistent.
658 */
660
661/**
662 * Gets the persistent property of a topic.
663 *
664 * @param topic topic handle
665 * @return persistent property value
666 */
668
669/**
670 * Sets the retained property of a topic. If true, the server retains the
671 * topic even when there are no publishers.
672 *
673 * @param topic topic handle
674 * @param value new retained property value
675 */
677
678/**
679 * Gets the retained property of a topic.
680 *
681 * @param topic topic handle
682 * @return retained property value
683 */
685
686/**
687 * Determine if topic exists (e.g. has at least one publisher).
688 *
689 * @param handle Topic, entry, or subscriber handle.
690 * @return True if topic exists.
691 */
693
694/**
695 * Gets the current value of a property (as a JSON string).
696 *
697 * @param topic topic handle
698 * @param name property name
699 * @param len length of returned string (output)
700 * @return JSON string; empty string if the property does not exist.
701 */
702char* NT_GetTopicProperty(NT_Topic topic, const char* name, size_t* len);
703
704/**
705 * Sets a property value.
706 *
707 * @param topic topic handle
708 * @param name property name
709 * @param value property value (JSON string)
710 */
712 const char* value);
713
714/**
715 * Deletes a property. Has no effect if the property does not exist.
716 *
717 * @param topic topic handle
718 * @param name property name
719 */
721
722/**
723 * Gets all topic properties as a JSON string. Each key in the object
724 * is the property name, and the corresponding value is the property value.
725 *
726 * @param topic topic handle
727 * @param len length of returned string (output)
728 * @return JSON string
729 */
731
732/**
733 * Updates multiple topic properties. Each key in the passed-in JSON object is
734 * the name of the property to add/update, and the corresponding value is the
735 * property value to set for that property. Null values result in deletion
736 * of the corresponding property.
737 *
738 * @param topic topic handle
739 * @param properties JSON object string with keys to add/update/delete
740 * @return False if properties are not a valid JSON object
741 */
743
744/**
745 * Creates a new subscriber to value changes on a topic.
746 *
747 * @param topic topic handle
748 * @param type expected type
749 * @param typeStr expected type string
750 * @param options subscription options
751 * @return Subscriber handle
752 */
754 const char* typeStr,
755 const struct NT_PubSubOptions* options);
756
757/**
758 * Stops subscriber.
759 *
760 * @param sub subscriber handle
761 */
763
764/**
765 * Creates a new publisher to a topic.
766 *
767 * @param topic topic handle
768 * @param type type
769 * @param typeStr type string
770 * @param options publish options
771 * @return Publisher handle
772 */
774 const struct NT_PubSubOptions* options);
775
776/**
777 * Creates a new publisher to a topic.
778 *
779 * @param topic topic handle
780 * @param type type
781 * @param typeStr type string
782 * @param properties initial properties (JSON object)
783 * @param options publish options
784 * @return Publisher handle
785 */
787 const char* typeStr, const char* properties,
788 const struct NT_PubSubOptions* options);
789
790/**
791 * Stops publisher.
792 *
793 * @param pubentry publisher/entry handle
794 */
795void NT_Unpublish(NT_Handle pubentry);
796
797/**
798 * @brief Creates a new entry (subscriber and weak publisher) to a topic.
799 *
800 * @param topic topic handle
801 * @param type type
802 * @param typeStr type string
803 * @param options publish options
804 * @return Entry handle
805 */
806NT_Entry NT_GetEntryEx(NT_Topic topic, enum NT_Type type, const char* typeStr,
807 const struct NT_PubSubOptions* options);
808
809/**
810 * Stops entry subscriber/publisher.
811 *
812 * @param entry entry handle
813 */
815
816/**
817 * Stops entry/subscriber/publisher.
818 *
819 * @param pubsubentry entry/subscriber/publisher handle
820 */
821void NT_Release(NT_Handle pubsubentry);
822
823/**
824 * Gets the topic handle from an entry/subscriber/publisher handle.
825 *
826 * @param pubsubentry entry/subscriber/publisher handle
827 * @return Topic handle
828 */
830
831/** @} */
832
833/**
834 * @defgroup ntcore_advancedsub_cfunc Advanced Subscriber Functions
835 * @{
836 */
837
838/**
839 * Subscribes to multiple topics based on one or more topic name prefixes. Can
840 * be used in combination with a Value Listener or ReadQueueValue() to get value
841 * changes across all matching topics.
842 *
843 * @param inst instance handle
844 * @param prefixes topic name prefixes
845 * @param prefixes_len number of elements in prefixes array
846 * @param options subscriber options
847 * @return subscriber handle
848 */
850 const struct NT_String* prefixes,
851 size_t prefixes_len,
852 const struct NT_PubSubOptions* options);
853
854/**
855 * Unsubscribes a multi-subscriber.
856 *
857 * @param sub multi-subscriber handle
858 */
860
861/** @} */
862
863/**
864 * @defgroup ntcore_listener_cfunc Listener Functions
865 * @{
866 */
867
868/**
869 * Event listener callback function.
870 *
871 * @param data data pointer provided to callback creation function
872 * @param event event info
873 */
874typedef void (*NT_ListenerCallback)(void* data, const struct NT_Event* event);
875
876/**
877 * Creates a listener poller.
878 *
879 * A poller provides a single queue of poll events. Events linked to this
880 * poller (using NT_AddPolledXListener()) will be stored in the queue and
881 * must be collected by calling NT_ReadListenerQueue().
882 * The returned handle must be destroyed with NT_DestroyListenerPoller().
883 *
884 * @param inst instance handle
885 * @return poller handle
886 */
888
889/**
890 * Destroys a listener poller. This will abort any blocked polling
891 * call and prevent additional events from being generated for this poller.
892 *
893 * @param poller poller handle
894 */
896
897/**
898 * Read notifications.
899 *
900 * @param poller poller handle
901 * @param len length of returned array (output)
902 * @return Array of events. Returns NULL and len=0 if no events since last
903 * call.
904 */
906
907/**
908 * Removes a listener.
909 *
910 * @param listener Listener handle to remove
911 */
913
914/**
915 * Wait for the listener queue to be empty. This is primarily useful
916 * for deterministic testing. This blocks until either the listener
917 * queue is empty (e.g. there are no more events that need to be passed along to
918 * callbacks or poll queues) or the timeout expires.
919 *
920 * @param handle handle
921 * @param timeout timeout, in seconds. Set to 0 for non-blocking behavior, or a
922 * negative value to block indefinitely
923 * @return False if timed out, otherwise true.
924 */
926
927/**
928 * Create a listener for changes to topics with names that start with
929 * the given prefix. This creates a corresponding internal subscriber with the
930 * lifetime of the listener.
931 *
932 * @param inst Instance handle
933 * @param prefix Topic name string prefix
934 * @param prefix_len Length of topic name string prefix
935 * @param mask Bitmask of NT_EventFlags values (only topic and value events will
936 * be generated)
937 * @param data Data passed to callback function
938 * @param callback Listener function
939 * @return Listener handle
940 */
941NT_Listener NT_AddListenerSingle(NT_Inst inst, const char* prefix,
942 size_t prefix_len, unsigned int mask,
943 void* data, NT_ListenerCallback callback);
944
945/**
946 * Create a listener for changes to topics with names that start with any of
947 * the given prefixes. This creates a corresponding internal subscriber with the
948 * lifetime of the listener.
949 *
950 * @param inst Instance handle
951 * @param prefixes Topic name string prefixes
952 * @param prefixes_len Number of elements in prefixes array
953 * @param mask Bitmask of NT_EventFlags values (only topic and value events will
954 * be generated)
955 * @param data Data passed to callback function
956 * @param callback Listener function
957 * @return Listener handle
958 */
960 const struct NT_String* prefixes,
961 size_t prefixes_len, unsigned int mask,
962 void* data, NT_ListenerCallback callback);
963
964/**
965 * Create a listener.
966 *
967 * Some combinations of handle and mask have no effect:
968 * - connection and log message events are only generated on instances
969 * - topic and value events are only generated on non-instances
970 *
971 * Adding value and topic events on a topic will create a corresponding internal
972 * subscriber with the lifetime of the listener.
973 *
974 * Adding a log message listener through this function will only result in
975 * events at NT_LOG_INFO or higher; for more customized settings, use
976 * NT_AddLogger().
977 *
978 * @param handle Handle
979 * @param mask Bitmask of NT_EventFlags values
980 * @param data Data passed to callback function
981 * @param callback Listener function
982 * @return Listener handle
983 */
984NT_Listener NT_AddListener(NT_Handle handle, unsigned int mask, void* data,
985 NT_ListenerCallback callback);
986
987/**
988 * Creates a polled topic listener. This creates a corresponding internal
989 * subscriber with the lifetime of the listener.
990 * The caller is responsible for calling NT_ReadListenerQueue() to poll.
991 *
992 * @param poller poller handle
993 * @param prefix UTF-8 string prefix
994 * @param prefix_len Length of UTF-8 string prefix
995 * @param mask NT_EventFlags bitmask (only topic and value events
996 * will be generated)
997 * @return Listener handle
998 */
1000 const char* prefix, size_t prefix_len,
1001 unsigned int mask);
1002
1003/**
1004 * Creates a polled topic listener. This creates a corresponding internal
1005 * subscriber with the lifetime of the listener.
1006 * The caller is responsible for calling NT_ReadListenerQueue() to poll.
1007 *
1008 * @param poller poller handle
1009 * @param prefixes array of UTF-8 string prefixes
1010 * @param prefixes_len Length of prefixes array
1011 * @param mask NT_EventFlags bitmask (only topic and value events
1012 * will be generated)
1013 * @return Listener handle
1014 */
1016 const struct NT_String* prefixes,
1017 size_t prefixes_len,
1018 unsigned int mask);
1019
1020/**
1021 * Creates a polled listener.
1022 * The caller is responsible for calling NT_ReadListenerQueue() to poll.
1023 *
1024 * Some combinations of handle and mask have no effect:
1025 * - connection and log message events are only generated on instances
1026 * - topic and value events are only generated on non-instances
1027 *
1028 * Adding value and topic events on a topic will create a corresponding internal
1029 * subscriber with the lifetime of the listener.
1030 *
1031 * Adding a log message listener through this function will only result in
1032 * events at NT_LOG_INFO or higher; for more customized settings, use
1033 * NT_AddPolledLogger().
1034 *
1035 * @param poller poller handle
1036 * @param handle handle
1037 * @param mask NT_NotifyKind bitmask
1038 * @return Listener handle
1039 */
1041 unsigned int mask);
1042
1043/** @} */
1044
1045/**
1046 * @defgroup ntcore_network_cfunc Client/Server Functions
1047 * @{
1048 */
1049
1050/**
1051 * Get the current network mode.
1052 *
1053 * @param inst instance handle
1054 * @return Bitmask of NT_NetworkMode.
1055 */
1056unsigned int NT_GetNetworkMode(NT_Inst inst);
1057
1058/**
1059 * Starts local-only operation. Prevents calls to NT_StartServer or
1060 * NT_StartClient from taking effect. Has no effect if NT_StartServer or
1061 * NT_StartClient has already been called.
1062 */
1064
1065/**
1066 * Stops local-only operation. NT_StartServer or NT_StartClient can be called
1067 * after this call to start a server or client.
1068 */
1070
1071/**
1072 * Starts a server using the specified filename, listening address, and port.
1073 *
1074 * @param inst instance handle
1075 * @param persist_filename the name of the persist file to use (UTF-8 string,
1076 * null terminated)
1077 * @param listen_address the address to listen on, or null to listen on any
1078 * address. (UTF-8 string, null terminated)
1079 * @param port3 port to communicate over (NT3)
1080 * @param port4 port to communicate over (NT4)
1081 */
1082void NT_StartServer(NT_Inst inst, const char* persist_filename,
1083 const char* listen_address, unsigned int port3,
1084 unsigned int port4);
1085
1086/**
1087 * Stops the server if it is running.
1088 *
1089 * @param inst instance handle
1090 */
1092
1093/**
1094 * Starts a NT3 client. Use NT_SetServer or NT_SetServerTeam to set the server
1095 * name and port.
1096 *
1097 * @param inst instance handle
1098 * @param identity network identity to advertise (cannot be empty string)
1099 */
1100void NT_StartClient3(NT_Inst inst, const char* identity);
1101
1102/**
1103 * Starts a NT4 client. Use NT_SetServer or NT_SetServerTeam to set the server
1104 * name and port.
1105 *
1106 * @param inst instance handle
1107 * @param identity network identity to advertise (cannot be empty string)
1108 */
1109void NT_StartClient4(NT_Inst inst, const char* identity);
1110
1111/**
1112 * Stops the client if it is running.
1113 *
1114 * @param inst instance handle
1115 */
1117
1118/**
1119 * Sets server address and port for client (without restarting client).
1120 *
1121 * @param inst instance handle
1122 * @param server_name server name (UTF-8 string, null terminated)
1123 * @param port port to communicate over
1124 */
1125void NT_SetServer(NT_Inst inst, const char* server_name, unsigned int port);
1126
1127/**
1128 * Sets server addresses for client (without restarting client).
1129 * The client will attempt to connect to each server in round robin fashion.
1130 *
1131 * @param inst instance handle
1132 * @param count length of the server_names and ports arrays
1133 * @param server_names array of server names (each a UTF-8 string, null
1134 * terminated)
1135 * @param ports array of ports to communicate over (one for each server)
1136 */
1137void NT_SetServerMulti(NT_Inst inst, size_t count, const char** server_names,
1138 const unsigned int* ports);
1139
1140/**
1141 * Sets server addresses and port for client (without restarting client).
1142 * Connects using commonly known robot addresses for the specified team.
1143 *
1144 * @param inst instance handle
1145 * @param team team number
1146 * @param port port to communicate over
1147 */
1148void NT_SetServerTeam(NT_Inst inst, unsigned int team, unsigned int port);
1149
1150/**
1151 * Disconnects the client if it's running and connected. This will automatically
1152 * start reconnection attempts to the current server list.
1153 *
1154 * @param inst instance handle
1155 */
1157
1158/**
1159 * Starts requesting server address from Driver Station.
1160 * This connects to the Driver Station running on localhost to obtain the
1161 * server IP address.
1162 *
1163 * @param inst instance handle
1164 * @param port server port to use in combination with IP from DS
1165 */
1166void NT_StartDSClient(NT_Inst inst, unsigned int port);
1167
1168/**
1169 * Stops requesting server address from Driver Station.
1170 *
1171 * @param inst instance handle
1172 */
1174
1175/**
1176 * Flush local updates.
1177 *
1178 * Forces an immediate flush of all local changes to the client/server.
1179 * This does not flush to the network.
1180 *
1181 * Normally this is done on a regularly scheduled interval.
1182 *
1183 * @param inst instance handle
1184 */
1186
1187/**
1188 * Flush to network.
1189 *
1190 * Forces an immediate flush of all local entry changes to network.
1191 * Normally this is done on a regularly scheduled interval (set
1192 * by update rates on individual publishers).
1193 *
1194 * Note: flushes are rate limited to avoid excessive network traffic. If
1195 * the time between calls is too short, the flush will occur after the minimum
1196 * time elapses (rather than immediately).
1197 *
1198 * @param inst instance handle
1199 */
1201
1202/**
1203 * Get information on the currently established network connections.
1204 * If operating as a client, this will return either zero or one values.
1205 *
1206 * @param inst instance handle
1207 * @param count returns the number of elements in the array
1208 * @return array of connection information
1209 *
1210 * It is the caller's responsibility to free the array. The
1211 * NT_DisposeConnectionInfoArray function is useful for this purpose.
1212 */
1214
1215/**
1216 * Return whether or not the instance is connected to another node.
1217 *
1218 * @param inst instance handle
1219 * @return True if connected.
1220 */
1222
1223/**
1224 * Get the time offset between server time and local time. Add this value to
1225 * local time to get the estimated equivalent server time. In server mode, this
1226 * always returns a valid value of 0. In client mode, this returns the time
1227 * offset only if the client and server are connected and have exchanged
1228 * synchronization messages. Note the time offset may change over time as it is
1229 * periodically updated; to receive updates as events, add a listener to the
1230 * "time sync" event.
1231 *
1232 * @param inst instance handle
1233 * @param valid set to true if the return value is valid, false otherwise
1234 * (output)
1235 * @return Time offset in microseconds (if valid is set to true)
1236 */
1238
1239/** @} */
1240
1241/**
1242 * @defgroup ntcore_utility_cfunc Utility Functions
1243 * @{
1244 */
1245
1246/**
1247 * Frees value memory.
1248 *
1249 * @param value value to free
1250 */
1252
1253/**
1254 * Initializes a NT_Value.
1255 * Sets type to NT_UNASSIGNED and clears rest of struct.
1256 *
1257 * @param value value to initialize
1258 */
1260
1261/**
1262 * Frees string memory.
1263 *
1264 * @param str string to free
1265 */
1266void NT_DisposeString(struct NT_String* str);
1267
1268/**
1269 * Initializes a NT_String.
1270 * Sets length to zero and pointer to null.
1271 *
1272 * @param str string to initialize
1273 */
1274void NT_InitString(struct NT_String* str);
1275
1276/**
1277 * Frees an array of NT_Values.
1278 *
1279 * @param arr pointer to the value array to free
1280 * @param count number of elements in the array
1281 *
1282 * Note that the individual NT_Values in the array should NOT be
1283 * freed before calling this. This function will free all the values
1284 * individually.
1285 */
1286void NT_DisposeValueArray(struct NT_Value* arr, size_t count);
1287
1288/**
1289 * Disposes a connection info array.
1290 *
1291 * @param arr pointer to the array to dispose
1292 * @param count number of elements in the array
1293 */
1295
1296/**
1297 * Disposes a topic info array.
1298 *
1299 * @param arr pointer to the array to dispose
1300 * @param count number of elements in the array
1301 */
1303
1304/**
1305 * Disposes a single topic info (as returned by NT_GetTopicInfo).
1306 *
1307 * @param info pointer to the info to dispose
1308 */
1310
1311/**
1312 * Disposes an event array.
1313 *
1314 * @param arr pointer to the array to dispose
1315 * @param count number of elements in the array
1316 */
1317void NT_DisposeEventArray(struct NT_Event* arr, size_t count);
1318
1319/**
1320 * Disposes a single event.
1321 *
1322 * @param event pointer to the event to dispose
1323 */
1324void NT_DisposeEvent(struct NT_Event* event);
1325
1326/**
1327 * Returns monotonic current time in 1 us increments.
1328 * This is the same time base used for entry and connection timestamps.
1329 * This function by default simply wraps WPI_Now(), but if NT_SetNow() is
1330 * called, this function instead returns the value passed to NT_SetNow();
1331 * this can be used to reduce overhead.
1332 *
1333 * @return Timestamp
1334 */
1336
1337/**
1338 * Sets the current timestamp used for timestamping values that do not
1339 * provide a timestamp (e.g. a value of 0 is passed). For consistency,
1340 * it also results in NT_Now() returning the set value. This should generally
1341 * be used only if the overhead of calling WPI_Now() is a concern.
1342 * If used, it should be called periodically with the value of WPI_Now().
1343 *
1344 * @param timestamp timestamp (1 us increments)
1345 */
1346void NT_SetNow(int64_t timestamp);
1347
1348/** @} */
1349
1350/**
1351 * @defgroup ntcore_logger_cfunc Logger Functions
1352 * @{
1353 */
1354
1355/**
1356 * Add logger callback function. By default, log messages are sent to stderr;
1357 * this function sends log messages to the provided callback function instead.
1358 * The callback function will only be called for log messages with level
1359 * greater than or equal to min_level and less than or equal to max_level;
1360 * messages outside this range will be silently ignored.
1361 *
1362 * @param inst instance handle
1363 * @param min_level minimum log level
1364 * @param max_level maximum log level
1365 * @param data data pointer to pass to func
1366 * @param func listener callback function
1367 * @return Listener handle
1368 */
1369NT_Listener NT_AddLogger(NT_Inst inst, unsigned int min_level,
1370 unsigned int max_level, void* data,
1371 NT_ListenerCallback func);
1372
1373/**
1374 * Set the log level for a listener poller. Events will only be generated for
1375 * log messages with level greater than or equal to min_level and less than or
1376 * equal to max_level; messages outside this range will be silently ignored.
1377 *
1378 * @param poller poller handle
1379 * @param min_level minimum log level
1380 * @param max_level maximum log level
1381 * @return Listener handle
1382 */
1383NT_Listener NT_AddPolledLogger(NT_ListenerPoller poller, unsigned int min_level,
1384 unsigned int max_level);
1385
1386/** @} */
1387
1388/**
1389 * @defgroup ntcore_interop_cfunc Interop Utility Functions
1390 * @{
1391 */
1392
1393/**
1394 * @defgroup ntcore_memoryallocators_cfunc Memory Allocators
1395 * @{
1396 */
1397
1398/**
1399 * Allocates an array of chars.
1400 * Note that the size is the number of elements, and not the
1401 * specific number of bytes to allocate. That is calculated internally.
1402 *
1403 * @param size the number of elements the array will contain
1404 * @return the allocated char array
1405 *
1406 * After use, the array should be freed using the NT_FreeCharArray()
1407 * function.
1408 */
1410
1411/**
1412 * Allocates an array of booleans.
1413 * Note that the size is the number of elements, and not the
1414 * specific number of bytes to allocate. That is calculated internally.
1415 *
1416 * @param size the number of elements the array will contain
1417 * @return the allocated boolean array
1418 *
1419 * After use, the array should be freed using the NT_FreeBooleanArray()
1420 * function.
1421 */
1423
1424/**
1425 * Allocates an array of ints.
1426 * Note that the size is the number of elements, and not the
1427 * specific number of bytes to allocate. That is calculated internally.
1428 *
1429 * @param size the number of elements the array will contain
1430 * @return the allocated double array
1431 *
1432 * After use, the array should be freed using the NT_FreeIntArray()
1433 * function.
1434 */
1436
1437/**
1438 * Allocates an array of floats.
1439 * Note that the size is the number of elements, and not the
1440 * specific number of bytes to allocate. That is calculated internally.
1441 *
1442 * @param size the number of elements the array will contain
1443 * @return the allocated double array
1444 *
1445 * After use, the array should be freed using the NT_FreeFloatArray()
1446 * function.
1447 */
1449
1450/**
1451 * Allocates an array of doubles.
1452 * Note that the size is the number of elements, and not the
1453 * specific number of bytes to allocate. That is calculated internally.
1454 *
1455 * @param size the number of elements the array will contain
1456 * @return the allocated double array
1457 *
1458 * After use, the array should be freed using the NT_FreeDoubleArray()
1459 * function.
1460 */
1462
1463/**
1464 * Allocates an array of NT_Strings.
1465 * Note that the size is the number of elements, and not the
1466 * specific number of bytes to allocate. That is calculated internally.
1467 *
1468 * @param size the number of elements the array will contain
1469 * @return the allocated NT_String array
1470 *
1471 * After use, the array should be freed using the NT_FreeStringArray()
1472 * function.
1473 */
1475
1476/**
1477 * Frees an array of chars.
1478 *
1479 * @param v_char pointer to the char array to free
1480 */
1481void NT_FreeCharArray(char* v_char);
1482
1483/**
1484 * Frees an array of booleans.
1485 *
1486 * @param v_boolean pointer to the boolean array to free
1487 */
1489
1490/**
1491 * Frees an array of ints.
1492 *
1493 * @param v_int pointer to the int array to free
1494 */
1496
1497/**
1498 * Frees an array of floats.
1499 *
1500 * @param v_float pointer to the float array to free
1501 */
1502void NT_FreeFloatArray(float* v_float);
1503
1504/**
1505 * Frees an array of doubles.
1506 *
1507 * @param v_double pointer to the double array to free
1508 */
1509void NT_FreeDoubleArray(double* v_double);
1510
1511/**
1512 * Frees an array of NT_Strings.
1513 *
1514 * @param v_string pointer to the string array to free
1515 * @param arr_size size of the string array to free
1516 *
1517 * Note that the individual NT_Strings in the array should NOT be
1518 * freed before calling this. This function will free all the strings
1519 * individually.
1520 */
1521void NT_FreeStringArray(struct NT_String* v_string, size_t arr_size);
1522
1523/** @} */
1524
1525/**
1526 * @defgroup ntcore_typedgetters_cfunc Typed Getters
1527 * @{
1528 */
1529
1530/**
1531 * Returns the type of an NT_Value struct.
1532 * Note that one of the type options is "unassigned".
1533 *
1534 * @param value The NT_Value struct to get the type from.
1535 * @return The type of the value, or unassigned if null.
1536 */
1538
1539/**
1540 * Returns the boolean from the NT_Value.
1541 * If the NT_Value is null, or is assigned to a different type, returns 0.
1542 *
1543 * @param value NT_Value struct to get the boolean from
1544 * @param last_change returns time in ms since the last change in the value
1545 * @param v_boolean returns the boolean assigned to the name
1546 * @return 1 if successful, or 0 if value is null or not a boolean
1547 */
1549 NT_Bool* v_boolean);
1550
1551/**
1552 * Returns the int from the NT_Value.
1553 * If the NT_Value is null, or is assigned to a different type, returns 0.
1554 *
1555 * @param value NT_Value struct to get the int from
1556 * @param last_change returns time in ms since the last change in the value
1557 * @param v_int returns the int assigned to the name
1558 * @return 1 if successful, or 0 if value is null or not an int
1559 */
1561 int64_t* v_int);
1562
1563/**
1564 * Returns the float from the NT_Value.
1565 * If the NT_Value is null, or is assigned to a different type, returns 0.
1566 *
1567 * @param value NT_Value struct to get the float from
1568 * @param last_change returns time in ms since the last change in the value
1569 * @param v_float returns the float assigned to the name
1570 * @return 1 if successful, or 0 if value is null or not a float
1571 */
1572NT_Bool NT_GetValueFloat(const struct NT_Value* value, uint64_t* last_change,
1573 float* v_float);
1574
1575/**
1576 * Returns the double from the NT_Value.
1577 * If the NT_Value is null, or is assigned to a different type, returns 0.
1578 *
1579 * @param value NT_Value struct to get the double from
1580 * @param last_change returns time in ms since the last change in the value
1581 * @param v_double returns the double assigned to the name
1582 * @return 1 if successful, or 0 if value is null or not a double
1583 */
1585 double* v_double);
1586
1587/**
1588 * Returns a copy of the string from the NT_Value.
1589 * If the NT_Value is null, or is assigned to a different type, returns 0.
1590 *
1591 * @param value NT_Value struct to get the string from
1592 * @param last_change returns time in ms since the last change in the value
1593 * @param str_len returns the length of the string
1594 * @return pointer to the string (UTF-8), or null if error
1595 *
1596 * It is the caller's responsibility to free the string once its no longer
1597 * needed. The NT_FreeCharArray() function is useful for this purpose. The
1598 * returned string is a copy of the string in the value, and must be freed
1599 * separately.
1600 */
1601char* NT_GetValueString(const struct NT_Value* value, uint64_t* last_change,
1602 size_t* str_len);
1603
1604/**
1605 * Returns a copy of the raw value from the NT_Value.
1606 * If the NT_Value is null, or is assigned to a different type, returns null.
1607 *
1608 * @param value NT_Value struct to get the string from
1609 * @param last_change returns time in ms since the last change in the value
1610 * @param raw_len returns the length of the string
1611 * @return pointer to the raw value (UTF-8), or null if error
1612 *
1613 * It is the caller's responsibility to free the raw value once its no longer
1614 * needed. The NT_FreeCharArray() function is useful for this purpose. The
1615 * returned string is a copy of the string in the value, and must be freed
1616 * separately.
1617 */
1618uint8_t* NT_GetValueRaw(const struct NT_Value* value, uint64_t* last_change,
1619 size_t* raw_len);
1620
1621/**
1622 * Returns a copy of the boolean array from the NT_Value.
1623 * If the NT_Value is null, or is assigned to a different type, returns null.
1624 *
1625 * @param value NT_Value struct to get the boolean array from
1626 * @param last_change returns time in ms since the last change in the value
1627 * @param arr_size returns the number of elements in the array
1628 * @return pointer to the boolean array, or null if error
1629 *
1630 * It is the caller's responsibility to free the array once its no longer
1631 * needed. The NT_FreeBooleanArray() function is useful for this purpose.
1632 * The returned array is a copy of the array in the value, and must be
1633 * freed separately.
1634 */
1636 uint64_t* last_change, size_t* arr_size);
1637
1638/**
1639 * Returns a copy of the int array from the NT_Value.
1640 * If the NT_Value is null, or is assigned to a different type, returns null.
1641 *
1642 * @param value NT_Value struct to get the int array from
1643 * @param last_change returns time in ms since the last change in the value
1644 * @param arr_size returns the number of elements in the array
1645 * @return pointer to the int array, or null if error
1646 *
1647 * It is the caller's responsibility to free the array once its no longer
1648 * needed. The NT_FreeIntArray() function is useful for this purpose.
1649 * The returned array is a copy of the array in the value, and must be
1650 * freed separately.
1651 */
1653 uint64_t* last_change, size_t* arr_size);
1654
1655/**
1656 * Returns a copy of the float array from the NT_Value.
1657 * If the NT_Value is null, or is assigned to a different type, returns null.
1658 *
1659 * @param value NT_Value struct to get the float array from
1660 * @param last_change returns time in ms since the last change in the value
1661 * @param arr_size returns the number of elements in the array
1662 * @return pointer to the float array, or null if error
1663 *
1664 * It is the caller's responsibility to free the array once its no longer
1665 * needed. The NT_FreeFloatArray() function is useful for this purpose.
1666 * The returned array is a copy of the array in the value, and must be
1667 * freed separately.
1668 */
1670 uint64_t* last_change, size_t* arr_size);
1671
1672/**
1673 * Returns a copy of the double array from the NT_Value.
1674 * If the NT_Value is null, or is assigned to a different type, returns null.
1675 *
1676 * @param value NT_Value struct to get the double array from
1677 * @param last_change returns time in ms since the last change in the value
1678 * @param arr_size returns the number of elements in the array
1679 * @return pointer to the double array, or null if error
1680 *
1681 * It is the caller's responsibility to free the array once its no longer
1682 * needed. The NT_FreeDoubleArray() function is useful for this purpose.
1683 * The returned array is a copy of the array in the value, and must be
1684 * freed separately.
1685 */
1687 uint64_t* last_change, size_t* arr_size);
1688
1689/**
1690 * Returns a copy of the NT_String array from the NT_Value.
1691 * If the NT_Value is null, or is assigned to a different type, returns null.
1692 *
1693 * @param value NT_Value struct to get the NT_String array from
1694 * @param last_change returns time in ms since the last change in the value
1695 * @param arr_size returns the number of elements in the array
1696 * @return pointer to the NT_String array, or null if error
1697 *
1698 * It is the caller's responsibility to free the array once its no longer
1699 * needed. The NT_FreeStringArray() function is useful for this purpose.
1700 * The returned array is a copy of the array in the value, and must be
1701 * freed separately. Note that the individual NT_Strings should not be freed,
1702 * but the entire array should be freed at once. The NT_FreeStringArray()
1703 * function will free all the NT_Strings.
1704 */
1706 uint64_t* last_change,
1707 size_t* arr_size);
1708
1709/** @} */
1710/** @} */
1711/** @} */
1712
1713/**
1714 * @defgroup ntcore_c_meta_api ntcore C meta-topic API
1715 *
1716 * Meta-topic decoders for C.
1717 *
1718 * @{
1719 */
1720
1721/**
1722 * Subscriber options. Different from PubSubOptions in this reflects only
1723 * options that are sent over the network.
1724 */
1726 double periodic;
1730};
1731
1732/**
1733 * Topic publisher (as published via `$pub$<topic>`).
1734 */
1738};
1739
1740/**
1741 * Topic subscriber (as published via `$sub$<topic>`).
1742 */
1747};
1748
1749/**
1750 * Client publisher (as published via `$clientpub$<client>` or `$serverpub`).
1751 */
1755};
1756
1757/**
1758 * Client subscriber (as published via `$clientsub$<client>` or `$serversub`).
1759 */
1765};
1766
1767/**
1768 * Client (as published via `$clients`).
1769 */
1774};
1775
1776/**
1777 * Decodes `$pub$<topic>` meta-topic data.
1778 *
1779 * @param data data contents
1780 * @param size size of data contents
1781 * @param count number of elements in returned array (output)
1782 * @return Array of TopicPublishers, or NULL on decoding error.
1783 */
1785 const uint8_t* data, size_t size, size_t* count);
1786
1787/**
1788 * Decodes `$sub$<topic>` meta-topic data.
1789 *
1790 * @param data data contents
1791 * @param size size of data contents
1792 * @param count number of elements in returned array (output)
1793 * @return Array of TopicSubscribers, or NULL on decoding error.
1794 */
1796 const uint8_t* data, size_t size, size_t* count);
1797
1798/**
1799 * Decodes `$clientpub$<topic>` meta-topic data.
1800 *
1801 * @param data data contents
1802 * @param size size of data contents
1803 * @param count number of elements in returned array (output)
1804 * @return Array of ClientPublishers, or NULL on decoding error.
1805 */
1807 const uint8_t* data, size_t size, size_t* count);
1808
1809/**
1810 * Decodes `$clientsub$<topic>` meta-topic data.
1811 *
1812 * @param data data contents
1813 * @param size size of data contents
1814 * @param count number of elements in returned array (output)
1815 * @return Array of ClientSubscribers, or NULL on decoding error.
1816 */
1818 const uint8_t* data, size_t size, size_t* count);
1819
1820/**
1821 * Decodes `$clients` meta-topic data.
1822 *
1823 * @param data data contents
1824 * @param size size of data contents
1825 * @param count number of elements in returned array (output)
1826 * @return Array of Clients, or NULL on decoding error.
1827 */
1829 size_t* count);
1830
1831/**
1832 * Frees an array of NT_Meta_TopicPublisher.
1833 *
1834 * @param arr pointer to the array to free
1835 * @param count size of the array to free
1836 */
1838 size_t count);
1839
1840/**
1841 * Frees an array of NT_Meta_TopicSubscriber.
1842 *
1843 * @param arr pointer to the array to free
1844 * @param count size of the array to free
1845 */
1847 size_t count);
1848
1849/**
1850 * Frees an array of NT_Meta_ClientPublisher.
1851 *
1852 * @param arr pointer to the array to free
1853 * @param count size of the array to free
1854 */
1856 size_t count);
1857
1858/**
1859 * Frees an array of NT_Meta_ClientSubscriber.
1860 *
1861 * @param arr pointer to the array to free
1862 * @param count size of the array to free
1863 */
1865 size_t count);
1866
1867/**
1868 * Frees an array of NT_Meta_Client.
1869 *
1870 * @param arr pointer to the array to free
1871 * @param count size of the array to free
1872 */
1873void NT_Meta_FreeClients(struct NT_Meta_Client* arr, size_t count);
1874
1875/** @} */
1876
1877#ifdef __cplusplus
1878} // extern "C"
1879#endif
1880
1881#include "ntcore_c_types.h"
Definition: core.h:1240
constexpr auto count() -> size_t
Definition: core.h:1204
type
Definition: core.h:575
void NT_UnsubscribeMultiple(NT_MultiSubscriber sub)
Unsubscribes a multi-subscriber.
NT_MultiSubscriber NT_SubscribeMultiple(NT_Inst inst, const struct NT_String *prefixes, size_t prefixes_len, const struct NT_PubSubOptions *options)
Subscribes to multiple topics based on one or more topic name prefixes.
NT_Handle NT_Topic
Definition: ntcore_c.h:38
NT_Handle NT_ConnectionDataLogger
Definition: ntcore_c.h:31
NT_Handle NT_Listener
Definition: ntcore_c.h:35
NT_EntryFlags
NetworkTables entry flags.
Definition: ntcore_c.h:66
int NT_Bool
Typedefs.
Definition: ntcore_c.h:28
NT_LogLevel
NetworkTables logging levels.
Definition: ntcore_c.h:69
NT_NetworkMode
Client/server modes.
Definition: ntcore_c.h:82
NT_Handle NT_Subscriber
Definition: ntcore_c.h:39
unsigned int NT_Handle
Definition: ntcore_c.h:30
NT_Type
NetworkTables data types.
Definition: ntcore_c.h:49
NT_Handle NT_Inst
Definition: ntcore_c.h:34
NT_Handle NT_Publisher
Definition: ntcore_c.h:40
NT_EventFlags
Event notification flags.
Definition: ntcore_c.h:92
NT_Handle NT_ListenerPoller
Definition: ntcore_c.h:36
NT_Handle NT_MultiSubscriber
Definition: ntcore_c.h:37
NT_Handle NT_Entry
Definition: ntcore_c.h:33
NT_Handle NT_DataLogger
Definition: ntcore_c.h:32
@ NT_RETAINED
Definition: ntcore_c.h:66
@ NT_PERSISTENT
Definition: ntcore_c.h:66
@ NT_LOG_DEBUG4
Definition: ntcore_c.h:78
@ NT_LOG_WARNING
Definition: ntcore_c.h:72
@ NT_LOG_INFO
Definition: ntcore_c.h:73
@ NT_LOG_DEBUG2
Definition: ntcore_c.h:76
@ NT_LOG_DEBUG
Definition: ntcore_c.h:74
@ NT_LOG_CRITICAL
Definition: ntcore_c.h:70
@ NT_LOG_ERROR
Definition: ntcore_c.h:71
@ NT_LOG_DEBUG3
Definition: ntcore_c.h:77
@ NT_LOG_DEBUG1
Definition: ntcore_c.h:75
@ NT_NET_MODE_STARTING
Definition: ntcore_c.h:87
@ NT_NET_MODE_LOCAL
Definition: ntcore_c.h:88
@ NT_NET_MODE_CLIENT4
Definition: ntcore_c.h:86
@ NT_NET_MODE_CLIENT3
Definition: ntcore_c.h:85
@ NT_NET_MODE_SERVER
Definition: ntcore_c.h:84
@ NT_NET_MODE_NONE
Definition: ntcore_c.h:83
@ NT_DOUBLE
Definition: ntcore_c.h:52
@ NT_BOOLEAN
Definition: ntcore_c.h:51
@ NT_DOUBLE_ARRAY
Definition: ntcore_c.h:56
@ NT_STRING
Definition: ntcore_c.h:53
@ NT_FLOAT_ARRAY
Definition: ntcore_c.h:62
@ NT_RPC
Definition: ntcore_c.h:58
@ NT_INTEGER
Definition: ntcore_c.h:59
@ NT_BOOLEAN_ARRAY
Definition: ntcore_c.h:55
@ NT_FLOAT
Definition: ntcore_c.h:60
@ NT_STRING_ARRAY
Definition: ntcore_c.h:57
@ NT_INTEGER_ARRAY
Definition: ntcore_c.h:61
@ NT_UNASSIGNED
Definition: ntcore_c.h:50
@ NT_RAW
Definition: ntcore_c.h:54
@ NT_EVENT_VALUE_ALL
Topic value updated (network or local).
Definition: ntcore_c.h:115
@ NT_EVENT_LOGMESSAGE
Log message.
Definition: ntcore_c.h:117
@ NT_EVENT_NONE
Definition: ntcore_c.h:93
@ NT_EVENT_UNPUBLISH
Topic unpublished.
Definition: ntcore_c.h:105
@ NT_EVENT_PROPERTIES
Topic properties changed.
Definition: ntcore_c.h:107
@ NT_EVENT_CONNECTED
Client connected (on server, any client connected).
Definition: ntcore_c.h:97
@ NT_EVENT_TIMESYNC
Time synchronized with server.
Definition: ntcore_c.h:119
@ NT_EVENT_VALUE_REMOTE
Topic value updated (via network).
Definition: ntcore_c.h:111
@ NT_EVENT_PUBLISH
New topic published.
Definition: ntcore_c.h:103
@ NT_EVENT_TOPIC
Any topic event (publish, unpublish, or properties changed).
Definition: ntcore_c.h:109
@ NT_EVENT_CONNECTION
Any connection event (connect or disconnect).
Definition: ntcore_c.h:101
@ NT_EVENT_DISCONNECTED
Client disconnected (on server, any client disconnected).
Definition: ntcore_c.h:99
@ NT_EVENT_IMMEDIATE
Initial listener addition.
Definition: ntcore_c.h:95
@ NT_EVENT_VALUE_LOCAL
Topic value updated (local).
Definition: ntcore_c.h:113
struct NT_Meta_ClientSubscriber * NT_Meta_DecodeClientSubscribers(const uint8_t *data, size_t size, size_t *count)
Decodes $clientsub$<topic> meta-topic data.
struct NT_Meta_ClientPublisher * NT_Meta_DecodeClientPublishers(const uint8_t *data, size_t size, size_t *count)
Decodes $clientpub$<topic> meta-topic data.
struct NT_Meta_TopicPublisher * NT_Meta_DecodeTopicPublishers(const uint8_t *data, size_t size, size_t *count)
Decodes $pub$<topic> meta-topic data.
void NT_Meta_FreeClientSubscribers(struct NT_Meta_ClientSubscriber *arr, size_t count)
Frees an array of NT_Meta_ClientSubscriber.
void NT_Meta_FreeTopicSubscribers(struct NT_Meta_TopicSubscriber *arr, size_t count)
Frees an array of NT_Meta_TopicSubscriber.
struct NT_Meta_TopicSubscriber * NT_Meta_DecodeTopicSubscribers(const uint8_t *data, size_t size, size_t *count)
Decodes $sub$<topic> meta-topic data.
void NT_Meta_FreeClientPublishers(struct NT_Meta_ClientPublisher *arr, size_t count)
Frees an array of NT_Meta_ClientPublisher.
void NT_Meta_FreeClients(struct NT_Meta_Client *arr, size_t count)
Frees an array of NT_Meta_Client.
void NT_Meta_FreeTopicPublishers(struct NT_Meta_TopicPublisher *arr, size_t count)
Frees an array of NT_Meta_TopicPublisher.
struct NT_Meta_Client * NT_Meta_DecodeClients(const uint8_t *data, size_t size, size_t *count)
Decodes $clients meta-topic data.
void NT_DestroyInstance(NT_Inst inst)
Destroy an instance.
NT_Inst NT_CreateInstance(void)
Create an instance.
NT_Inst NT_GetDefaultInstance(void)
Get default instance.
NT_Inst NT_GetInstanceFromHandle(NT_Handle handle)
Get instance handle from another handle.
NT_Listener NT_AddPolledListenerSingle(NT_ListenerPoller poller, const char *prefix, size_t prefix_len, unsigned int mask)
Creates a polled topic listener.
void NT_RemoveListener(NT_Listener listener)
Removes a listener.
void(* NT_ListenerCallback)(void *data, const struct NT_Event *event)
Event listener callback function.
Definition: ntcore_c.h:874
NT_ListenerPoller NT_CreateListenerPoller(NT_Inst inst)
Creates a listener poller.
NT_Listener NT_AddListenerMultiple(NT_Inst inst, const struct NT_String *prefixes, size_t prefixes_len, unsigned int mask, void *data, NT_ListenerCallback callback)
Create a listener for changes to topics with names that start with any of the given prefixes.
NT_Listener NT_AddListenerSingle(NT_Inst inst, const char *prefix, size_t prefix_len, unsigned int mask, void *data, NT_ListenerCallback callback)
Create a listener for changes to topics with names that start with the given prefix.
struct NT_Event * NT_ReadListenerQueue(NT_ListenerPoller poller, size_t *len)
Read notifications.
NT_Listener NT_AddPolledListener(NT_ListenerPoller poller, NT_Handle handle, unsigned int mask)
Creates a polled listener.
void NT_DestroyListenerPoller(NT_ListenerPoller poller)
Destroys a listener poller.
NT_Listener NT_AddListener(NT_Handle handle, unsigned int mask, void *data, NT_ListenerCallback callback)
Create a listener.
NT_Bool NT_WaitForListenerQueue(NT_Handle handle, double timeout)
Wait for the listener queue to be empty.
NT_Listener NT_AddPolledListenerMultiple(NT_ListenerPoller poller, const struct NT_String *prefixes, size_t prefixes_len, unsigned int mask)
Creates a polled topic listener.
NT_Listener NT_AddPolledLogger(NT_ListenerPoller poller, unsigned int min_level, unsigned int max_level)
Set the log level for a listener poller.
NT_Listener NT_AddLogger(NT_Inst inst, unsigned int min_level, unsigned int max_level, void *data, NT_ListenerCallback func)
Add logger callback function.
float * NT_AllocateFloatArray(size_t size)
Allocates an array of floats.
void NT_FreeIntegerArray(int64_t *v_int)
Frees an array of ints.
void NT_FreeFloatArray(float *v_float)
Frees an array of floats.
void NT_FreeStringArray(struct NT_String *v_string, size_t arr_size)
Frees an array of NT_Strings.
void NT_FreeBooleanArray(NT_Bool *v_boolean)
Frees an array of booleans.
NT_Bool * NT_AllocateBooleanArray(size_t size)
Allocates an array of booleans.
void NT_FreeDoubleArray(double *v_double)
Frees an array of doubles.
struct NT_String * NT_AllocateStringArray(size_t size)
Allocates an array of NT_Strings.
double * NT_AllocateDoubleArray(size_t size)
Allocates an array of doubles.
void NT_FreeCharArray(char *v_char)
Frees an array of chars.
int64_t * NT_AllocateIntegerArray(size_t size)
Allocates an array of ints.
char * NT_AllocateCharArray(size_t size)
Allocates an array of chars.
void NT_Disconnect(NT_Inst inst)
Disconnects the client if it's running and connected.
void NT_StartLocal(NT_Inst inst)
Starts local-only operation.
void NT_StartServer(NT_Inst inst, const char *persist_filename, const char *listen_address, unsigned int port3, unsigned int port4)
Starts a server using the specified filename, listening address, and port.
void NT_StopClient(NT_Inst inst)
Stops the client if it is running.
void NT_StartClient4(NT_Inst inst, const char *identity)
Starts a NT4 client.
void NT_StopServer(NT_Inst inst)
Stops the server if it is running.
unsigned int NT_GetNetworkMode(NT_Inst inst)
Get the current network mode.
void NT_StopLocal(NT_Inst inst)
Stops local-only operation.
void NT_SetServerTeam(NT_Inst inst, unsigned int team, unsigned int port)
Sets server addresses and port for client (without restarting client).
void NT_Flush(NT_Inst inst)
Flush to network.
int64_t NT_GetServerTimeOffset(NT_Inst inst, NT_Bool *valid)
Get the time offset between server time and local time.
void NT_FlushLocal(NT_Inst inst)
Flush local updates.
void NT_SetServer(NT_Inst inst, const char *server_name, unsigned int port)
Sets server address and port for client (without restarting client).
void NT_StartClient3(NT_Inst inst, const char *identity)
Starts a NT3 client.
NT_Bool NT_IsConnected(NT_Inst inst)
Return whether or not the instance is connected to another node.
void NT_StartDSClient(NT_Inst inst, unsigned int port)
Starts requesting server address from Driver Station.
void NT_StopDSClient(NT_Inst inst)
Stops requesting server address from Driver Station.
struct NT_ConnectionInfo * NT_GetConnections(NT_Inst inst, size_t *count)
Get information on the currently established network connections.
void NT_SetServerMulti(NT_Inst inst, size_t count, const char **server_names, const unsigned int *ports)
Sets server addresses for client (without restarting client).
NT_Bool NT_SetEntryValue(NT_Entry entry, const struct NT_Value *value)
Set Entry Value.
void NT_GetEntryValue(NT_Entry entry, struct NT_Value *value)
Get Entry Value.
enum NT_Type NT_GetEntryType(NT_Entry entry)
Gets the type for the specified key, or unassigned if non existent.
struct NT_Value * NT_ReadQueueValue(NT_Handle subentry, size_t *count)
Read Entry Queue.
NT_Bool NT_SetDefaultEntryValue(NT_Entry entry, const struct NT_Value *default_value)
Set Default Entry Value.
unsigned int NT_GetEntryFlags(NT_Entry entry)
Get Entry Flags.
uint64_t NT_GetEntryLastChange(NT_Entry entry)
Gets the last time the entry was changed.
void NT_SetEntryFlags(NT_Entry entry, unsigned int flags)
Set Entry Flags.
char * NT_GetEntryName(NT_Entry entry, size_t *name_len)
Gets the name of the specified entry.
NT_Entry NT_GetEntry(NT_Inst inst, const char *name, size_t name_len)
Get Entry Handle.
NT_Entry NT_GetEntryEx(NT_Topic topic, enum NT_Type type, const char *typeStr, const struct NT_PubSubOptions *options)
Creates a new entry (subscriber and weak publisher) to a topic.
struct NT_TopicInfo * NT_GetTopicInfos(NT_Inst inst, const char *prefix, size_t prefix_len, unsigned int types, size_t *count)
Get Topics.
char * NT_GetTopicProperty(NT_Topic topic, const char *name, size_t *len)
Gets the current value of a property (as a JSON string).
void NT_SetTopicRetained(NT_Topic topic, NT_Bool value)
Sets the retained property of a topic.
NT_Subscriber NT_Subscribe(NT_Topic topic, enum NT_Type type, const char *typeStr, const struct NT_PubSubOptions *options)
Creates a new subscriber to value changes on a topic.
NT_Bool NT_SetTopicProperty(NT_Topic topic, const char *name, const char *value)
Sets a property value.
NT_Bool NT_GetTopicExists(NT_Handle handle)
Determine if topic exists (e.g.
NT_Topic NT_GetTopicFromHandle(NT_Handle pubsubentry)
Gets the topic handle from an entry/subscriber/publisher handle.
void NT_Release(NT_Handle pubsubentry)
Stops entry/subscriber/publisher.
void NT_SetTopicPersistent(NT_Topic topic, NT_Bool value)
Sets the persistent property of a topic.
void NT_ReleaseEntry(NT_Entry entry)
Stops entry subscriber/publisher.
NT_Topic * NT_GetTopicsStr(NT_Inst inst, const char *prefix, size_t prefix_len, const char *const *types, size_t types_len, size_t *count)
Get Published Topic Handles.
NT_Bool NT_GetTopicInfo(NT_Topic topic, struct NT_TopicInfo *info)
Gets Topic Information.
NT_Publisher NT_Publish(NT_Topic topic, enum NT_Type type, const char *typeStr, const struct NT_PubSubOptions *options)
Creates a new publisher to a topic.
NT_Topic * NT_GetTopics(NT_Inst inst, const char *prefix, size_t prefix_len, unsigned int types, size_t *count)
Get Published Topic Handles.
void NT_DeleteTopicProperty(NT_Topic topic, const char *name)
Deletes a property.
char * NT_GetTopicTypeString(NT_Topic topic, size_t *type_len)
Gets the type string for the specified topic.
NT_Publisher NT_PublishEx(NT_Topic topic, enum NT_Type type, const char *typeStr, const char *properties, const struct NT_PubSubOptions *options)
Creates a new publisher to a topic.
struct NT_TopicInfo * NT_GetTopicInfosStr(NT_Inst inst, const char *prefix, size_t prefix_len, const char *const *types, size_t types_len, size_t *count)
Get Topics.
NT_Bool NT_GetTopicPersistent(NT_Topic topic)
Gets the persistent property of a topic.
NT_Topic NT_GetTopic(NT_Inst inst, const char *name, size_t name_len)
Gets Topic Handle.
NT_Bool NT_SetTopicProperties(NT_Topic topic, const char *properties)
Updates multiple topic properties.
NT_Bool NT_GetTopicRetained(NT_Topic topic)
Gets the retained property of a topic.
char * NT_GetTopicProperties(NT_Topic topic, size_t *len)
Gets all topic properties as a JSON string.
void NT_Unpublish(NT_Handle pubentry)
Stops publisher.
enum NT_Type NT_GetTopicType(NT_Topic topic)
Gets the type for the specified topic, or unassigned if non existent.
char * NT_GetTopicName(NT_Topic topic, size_t *name_len)
Gets the name of the specified topic.
void NT_Unsubscribe(NT_Subscriber sub)
Stops subscriber.
int64_t * NT_GetValueIntegerArray(const struct NT_Value *value, uint64_t *last_change, size_t *arr_size)
Returns a copy of the int array from the NT_Value.
enum NT_Type NT_GetValueType(const struct NT_Value *value)
Returns the type of an NT_Value struct.
double * NT_GetValueDoubleArray(const struct NT_Value *value, uint64_t *last_change, size_t *arr_size)
Returns a copy of the double array from the NT_Value.
float * NT_GetValueFloatArray(const struct NT_Value *value, uint64_t *last_change, size_t *arr_size)
Returns a copy of the float array from the NT_Value.
NT_Bool * NT_GetValueBooleanArray(const struct NT_Value *value, uint64_t *last_change, size_t *arr_size)
Returns a copy of the boolean array from the NT_Value.
NT_Bool NT_GetValueFloat(const struct NT_Value *value, uint64_t *last_change, float *v_float)
Returns the float from the NT_Value.
NT_Bool NT_GetValueDouble(const struct NT_Value *value, uint64_t *last_change, double *v_double)
Returns the double from the NT_Value.
char * NT_GetValueString(const struct NT_Value *value, uint64_t *last_change, size_t *str_len)
Returns a copy of the string from the NT_Value.
NT_Bool NT_GetValueBoolean(const struct NT_Value *value, uint64_t *last_change, NT_Bool *v_boolean)
Returns the boolean from the NT_Value.
uint8_t * NT_GetValueRaw(const struct NT_Value *value, uint64_t *last_change, size_t *raw_len)
Returns a copy of the raw value from the NT_Value.
NT_Bool NT_GetValueInteger(const struct NT_Value *value, uint64_t *last_change, int64_t *v_int)
Returns the int from the NT_Value.
struct NT_String * NT_GetValueStringArray(const struct NT_Value *value, uint64_t *last_change, size_t *arr_size)
Returns a copy of the NT_String array from the NT_Value.
void NT_SetNow(int64_t timestamp)
Sets the current timestamp used for timestamping values that do not provide a timestamp (e....
void NT_InitValue(struct NT_Value *value)
Initializes a NT_Value.
void NT_DisposeTopicInfoArray(struct NT_TopicInfo *arr, size_t count)
Disposes a topic info array.
void NT_InitString(struct NT_String *str)
Initializes a NT_String.
void NT_DisposeString(struct NT_String *str)
Frees string memory.
void NT_DisposeTopicInfo(struct NT_TopicInfo *info)
Disposes a single topic info (as returned by NT_GetTopicInfo).
void NT_DisposeConnectionInfoArray(struct NT_ConnectionInfo *arr, size_t count)
Disposes a connection info array.
int64_t NT_Now(void)
Returns monotonic current time in 1 us increments.
void NT_DisposeValue(struct NT_Value *value)
Frees value memory.
void NT_DisposeEventArray(struct NT_Event *arr, size_t count)
Disposes an event array.
void NT_DisposeValueArray(struct NT_Value *arr, size_t count)
Frees an array of NT_Values.
void NT_DisposeEvent(struct NT_Event *event)
Disposes a single event.
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
::uint64_t uint64_t
Definition: Meta.h:58
::uint16_t uint16_t
Definition: Meta.h:54
::int64_t int64_t
Definition: Meta.h:59
::uint8_t uint8_t
Definition: Meta.h:52
flags
Definition: http_parser.h:206
NetworkTables Connection Information.
Definition: ntcore_c.h:200
struct NT_String remote_ip
The IP address of the remote node.
Definition: ntcore_c.h:207
unsigned int remote_port
The port number of the remote node.
Definition: ntcore_c.h:210
uint64_t last_update
The last time any update was received from the remote node (same scale as returned by nt::Now()).
Definition: ntcore_c.h:216
unsigned int protocol_version
The protocol version being used for this connection.
Definition: ntcore_c.h:222
struct NT_String remote_id
The remote identifier (as set on the remote node by NT_StartClient4().
Definition: ntcore_c.h:204
NetworkTables event.
Definition: ntcore_c.h:271
struct NT_LogMessage logMessage
Definition: ntcore_c.h:291
NT_Handle listener
Listener that triggered this event.
Definition: ntcore_c.h:273
unsigned int flags
Event flags (NT_EventFlags).
Definition: ntcore_c.h:284
struct NT_TopicInfo topicInfo
Definition: ntcore_c.h:289
struct NT_ConnectionInfo connInfo
Definition: ntcore_c.h:288
struct NT_TimeSyncEventData timeSyncData
Definition: ntcore_c.h:292
union NT_Event::@8 data
Event data; content depends on flags.
struct NT_ValueEventData valueData
Definition: ntcore_c.h:290
NetworkTables log message.
Definition: ntcore_c.h:238
unsigned int level
Log level of the message.
Definition: ntcore_c.h:240
char * filename
The filename of the source file that generated the message.
Definition: ntcore_c.h:243
char * message
The message.
Definition: ntcore_c.h:249
unsigned int line
The line number in the source file that generated the message.
Definition: ntcore_c.h:246
Client (as published via $clients).
Definition: ntcore_c.h:1770
struct NT_String conn
Definition: ntcore_c.h:1772
struct NT_String id
Definition: ntcore_c.h:1771
uint16_t version
Definition: ntcore_c.h:1773
Client publisher (as published via $clientpub$<client> or $serverpub).
Definition: ntcore_c.h:1752
struct NT_String topic
Definition: ntcore_c.h:1754
int64_t uid
Definition: ntcore_c.h:1753
Client subscriber (as published via $clientsub$<client> or $serversub).
Definition: ntcore_c.h:1760
struct NT_Meta_SubscriberOptions options
Definition: ntcore_c.h:1764
struct NT_String * topics
Definition: ntcore_c.h:1763
int64_t uid
Definition: ntcore_c.h:1761
size_t topicsCount
Definition: ntcore_c.h:1762
Subscriber options.
Definition: ntcore_c.h:1725
NT_Bool prefixMatch
Definition: ntcore_c.h:1729
double periodic
Definition: ntcore_c.h:1726
NT_Bool sendAll
Definition: ntcore_c.h:1728
NT_Bool topicsOnly
Definition: ntcore_c.h:1727
Topic publisher (as published via $pub$<topic>).
Definition: ntcore_c.h:1735
uint64_t pubuid
Definition: ntcore_c.h:1737
struct NT_String client
Definition: ntcore_c.h:1736
Topic subscriber (as published via $sub$<topic>).
Definition: ntcore_c.h:1743
uint64_t subuid
Definition: ntcore_c.h:1745
struct NT_String client
Definition: ntcore_c.h:1744
struct NT_Meta_SubscriberOptions options
Definition: ntcore_c.h:1746
NetworkTables publish/subscribe options.
Definition: ntcore_c.h:297
unsigned int structSize
Structure size.
Definition: ntcore_c.h:301
NT_Bool prefixMatch
Perform prefix match on subscriber topic names.
Definition: ntcore_c.h:340
NT_Bool disableRemote
For subscriptions, if remote value updates should not be queued for ReadQueue().
Definition: ntcore_c.h:351
NT_Bool keepDuplicates
Preserve duplicate value changes (rather than ignoring them).
Definition: ntcore_c.h:345
NT_Bool disableLocal
For subscriptions, if local value updates should not be queued for ReadQueue().
Definition: ntcore_c.h:357
NT_Publisher excludePublisher
For subscriptions, if non-zero, value updates for ReadQueue() are not queued for this publisher.
Definition: ntcore_c.h:323
unsigned int pollStorage
Polling storage size for a subscription.
Definition: ntcore_c.h:309
NT_Bool topicsOnly
For subscriptions, don't ask for value changes (only topic announcements).
Definition: ntcore_c.h:333
NT_Bool sendAll
Send all value changes over the network.
Definition: ntcore_c.h:328
double periodic
How frequently changes will be sent over the network, in seconds.
Definition: ntcore_c.h:317
NT_Bool excludeSelf
For entries, don't queue (for ReadQueue) value updates for the entry's internal publisher.
Definition: ntcore_c.h:363
A NetworkTables string.
Definition: ntcore_c.h:127
size_t len
Length of the string in bytes.
Definition: ntcore_c.h:140
char * str
String contents (UTF-8).
Definition: ntcore_c.h:134
NetworkTables time sync event data.
Definition: ntcore_c.h:253
int64_t rtt2
Measured round trip time divided by 2, in microseconds.
Definition: ntcore_c.h:261
NT_Bool valid
If serverTimeOffset and RTT are valid.
Definition: ntcore_c.h:267
int64_t serverTimeOffset
Offset between local time and server time, in microseconds.
Definition: ntcore_c.h:258
NetworkTables Topic Information.
Definition: ntcore_c.h:182
struct NT_String properties
Topic properties JSON string.
Definition: ntcore_c.h:196
struct NT_String type_str
Topic type string.
Definition: ntcore_c.h:193
NT_Topic topic
Topic handle.
Definition: ntcore_c.h:184
enum NT_Type type
Topic type.
Definition: ntcore_c.h:190
struct NT_String name
Topic name.
Definition: ntcore_c.h:187
NetworkTables value event data.
Definition: ntcore_c.h:226
NT_Handle subentry
Subscriber/entry handle.
Definition: ntcore_c.h:231
NT_Topic topic
Topic handle.
Definition: ntcore_c.h:228
NetworkTables Entry Value.
Definition: ntcore_c.h:144
struct NT_Value::@1::@5 arr_float
enum NT_Type type
Definition: ntcore_c.h:145
float * arr
Definition: ntcore_c.h:167
struct NT_Value::@1::@4 arr_double
struct NT_String * arr
Definition: ntcore_c.h:175
float v_float
Definition: ntcore_c.h:151
double * arr
Definition: ntcore_c.h:163
struct NT_String v_string
Definition: ntcore_c.h:153
struct NT_Value::@1::@2 v_raw
int64_t last_change
Definition: ntcore_c.h:146
int64_t server_time
Definition: ntcore_c.h:147
double v_double
Definition: ntcore_c.h:152
uint8_t * data
Definition: ntcore_c.h:155
struct NT_Value::@1::@3 arr_boolean
struct NT_Value::@1::@6 arr_int
NT_Bool v_boolean
Definition: ntcore_c.h:149
size_t size
Definition: ntcore_c.h:156
NT_Bool * arr
Definition: ntcore_c.h:159
struct NT_Value::@1::@7 arr_string
int64_t v_int
Definition: ntcore_c.h:150
int64_t * arr
Definition: ntcore_c.h:171
Definition: format.h:1544