26class BooleanArrayTopic;
28class DoubleArrayTopic;
32class IntegerArrayTopic;
35template <wpi::ProtobufSerializable T>
38class StringArrayTopic;
40template <
typename T,
typename... I>
42class StructArrayTopic;
43template <
typename T,
typename... I>
126 explicit operator
bool()
const {
return m_handle != 0; }
258 template <wpi::ProtobufSerializable T>
268 template <
typename T,
typename... I>
279 template <
typename T,
typename... I>
331 std::span<std::string_view> types);
384 std::span<std::string_view> types);
566 const char* listen_address =
"",
602 void SetServer(
const char* server_name,
unsigned int port = 0);
611 std::span<
const std::pair<std::string_view, unsigned int>> servers);
620 void SetServer(std::span<const std::string_view> servers,
621 unsigned int port = 0);
630 void SetServerTeam(
unsigned int team,
unsigned int port = 0);
795 std::span<const uint8_t> schema);
821 template <wpi::ProtobufSerializable T>
831 template <
typename T,
typename... I>
NetworkTables BooleanArray topic.
Definition: BooleanArrayTopic.h:266
NetworkTables Boolean topic.
Definition: BooleanTopic.h:213
NetworkTables DoubleArray topic.
Definition: DoubleArrayTopic.h:266
NetworkTables Double topic.
Definition: DoubleTopic.h:213
NetworkTables FloatArray topic.
Definition: FloatArrayTopic.h:266
NetworkTables Float topic.
Definition: FloatTopic.h:213
NetworkTables IntegerArray topic.
Definition: IntegerArrayTopic.h:266
NetworkTables Integer topic.
Definition: IntegerTopic.h:213
Subscribe to multiple topics based on one or more topic name prefixes.
Definition: MultiSubscriber.h:20
NetworkTables Entry.
Definition: NetworkTableEntry.h:34
NetworkTables Instance.
Definition: NetworkTableInstance.h:70
void StartClient4(std::string_view identity)
Starts a NT4 client.
Definition: NetworkTableInstance.inc:163
static NetworkTableInstance GetDefault()
Get global default instance.
Definition: NetworkTableInstance.inc:22
IntegerArrayTopic GetIntegerArrayTopic(std::string_view name) const
Gets an integer array topic.
NetworkMode
Client/server mode flag values (as returned by GetNetworkMode()).
Definition: NetworkTableInstance.h:76
@ kNetModeClient4
Definition: NetworkTableInstance.h:80
@ kNetModeServer
Definition: NetworkTableInstance.h:78
@ kNetModeLocal
Definition: NetworkTableInstance.h:81
@ kNetModeClient3
Definition: NetworkTableInstance.h:79
@ kNetModeNone
Definition: NetworkTableInstance.h:77
static NetworkTableInstance Create()
Create an instance.
Definition: NetworkTableInstance.inc:26
BooleanTopic GetBooleanTopic(std::string_view name) const
Gets a boolean topic.
FloatTopic GetFloatTopic(std::string_view name) const
Gets a float topic.
bool IsConnected() const
Return whether or not the instance is connected to another node.
Definition: NetworkTableInstance.inc:211
NetworkTableInstance() noexcept
Construct invalid instance.
Definition: NetworkTableInstance.inc:17
NT_Listener AddListener(const NetworkTableEntry &entry, int eventMask, ListenerCallback listener)
Add a listener for changes on an entry.
NT_Listener AddConnectionListener(bool immediate_notify, ListenerCallback callback) const
Add a connection listener.
Definition: NetworkTableInstance.inc:115
void StartLocal()
Starts local-only operation.
Definition: NetworkTableInstance.inc:140
StructTopic< T, I... > GetStructTopic(std::string_view name, I... info) const
Gets a raw struct serialized value topic.
Definition: NetworkTableInstance.inc:49
static void StopEntryDataLog(NT_DataLogger logger)
Stops logging entry changes to a DataLog.
Definition: NetworkTableInstance.inc:226
bool WaitForListenerQueue(double timeout)
Wait for the listener queue to be empty.
Definition: NetworkTableInstance.inc:107
DoubleArrayTopic GetDoubleArrayTopic(std::string_view name) const
Gets a double array topic.
StructArrayTopic< T, I... > GetStructArrayTopic(std::string_view name, I... info) const
Gets a raw struct serialized array topic.
Definition: NetworkTableInstance.inc:56
NT_Listener AddLogger(unsigned int minLevel, unsigned int maxLevel, ListenerCallback func)
Add logger callback function.
Definition: NetworkTableInstance.inc:240
void StartDSClient(unsigned int port=0)
Starts requesting server address from Driver Station.
Definition: NetworkTableInstance.inc:190
NT_Listener AddListener(MultiSubscriber &subscriber, int eventMask, ListenerCallback listener)
Add a listener for changes on a subscriber.
void FlushLocal() const
Flushes all updated values immediately to the local client/server.
Definition: NetworkTableInstance.inc:198
StringArrayTopic GetStringArrayTopic(std::string_view name) const
Gets a string array topic.
FloatArrayTopic GetFloatArrayTopic(std::string_view name) const
Gets a float array topic.
NT_ConnectionDataLogger StartConnectionDataLog(wpi::log::DataLog &log, std::string_view name)
Starts logging connection changes to a DataLog.
Definition: NetworkTableInstance.inc:230
ProtobufTopic< T > GetProtobufTopic(std::string_view name) const
Gets a protobuf serialized value topic.
Definition: NetworkTableInstance.inc:42
unsigned int GetNetworkMode() const
Get the current network mode.
Definition: NetworkTableInstance.inc:136
NT_Inst GetHandle() const
Gets the native handle for the entry.
Definition: NetworkTableInstance.inc:37
static constexpr unsigned int kDefaultPort4
The default port that network tables operates on for NT4.
Definition: NetworkTableInstance.h:107
NT_DataLogger StartEntryDataLog(wpi::log::DataLog &log, std::string_view prefix, std::string_view logPrefix)
Starts logging entry changes to a DataLog.
Definition: NetworkTableInstance.inc:220
bool HasSchema(std::string_view name) const
Returns whether there is a data schema already registered with the given name.
Definition: NetworkTableInstance.inc:246
NetworkTableEntry GetEntry(std::string_view name)
Gets the entry for a key.
Definition: NetworkTableInstance.inc:103
NT_Listener AddListener(Subscriber &subscriber, unsigned int eventMask, ListenerCallback listener)
Add a listener for changes on a subscriber.
BooleanArrayTopic GetBooleanArrayTopic(std::string_view name) const
Gets a boolean array topic.
StringTopic GetStringTopic(std::string_view name) const
Gets a string topic.
static constexpr unsigned int kDefaultPort3
The default port that network tables operates on for NT3.
Definition: NetworkTableInstance.h:102
void StopServer()
Stops the server if it is running.
Definition: NetworkTableInstance.inc:155
void AddStructSchema(const I &... info)
Registers a struct schema.
Definition: NetworkTableInstance.inc:279
void SetServer(const char *server_name, unsigned int port=0)
Sets server address and port for client (without restarting client).
Definition: NetworkTableInstance.inc:171
void SetServerTeam(unsigned int team, unsigned int port=0)
Sets server addresses and port for client (without restarting client).
Definition: NetworkTableInstance.inc:181
bool operator==(const NetworkTableInstance &) const =default
Equality operator.
void StopDSClient()
Stops requesting server address from Driver Station.
Definition: NetworkTableInstance.inc:194
LogLevel
Logging levels (as used by SetLogger()).
Definition: NetworkTableInstance.h:87
@ kLogInfo
Definition: NetworkTableInstance.h:91
@ kLogError
Definition: NetworkTableInstance.h:89
@ kLogWarning
Definition: NetworkTableInstance.h:90
@ kLogDebug4
Definition: NetworkTableInstance.h:96
@ kLogDebug3
Definition: NetworkTableInstance.h:95
@ kLogCritical
Definition: NetworkTableInstance.h:88
@ kLogDebug
Definition: NetworkTableInstance.h:92
@ kLogDebug1
Definition: NetworkTableInstance.h:93
@ kLogDebug2
Definition: NetworkTableInstance.h:94
void AddSchema(std::string_view name, std::string_view type, std::span< const uint8_t > schema)
Registers a data schema.
Definition: NetworkTableInstance.inc:250
void Disconnect()
Disconnects the client if it's running and connected.
Definition: NetworkTableInstance.inc:186
void Flush() const
Flushes all updated values immediately to the network.
Definition: NetworkTableInstance.inc:202
void AddProtobufSchema(wpi::ProtobufMessage< T > &msg)
Registers a protobuf schema.
Definition: NetworkTableInstance.inc:269
NT_Listener AddListener(Topic topic, unsigned int eventMask, ListenerCallback listener)
Add a listener for changes on a particular topic.
std::shared_ptr< NetworkTable > GetTable(std::string_view key) const
Gets the table with the specified key.
NT_Listener AddTimeSyncListener(bool immediate_notify, ListenerCallback callback) const
Add a time synchronization listener.
Definition: NetworkTableInstance.inc:123
static void RemoveListener(NT_Listener listener)
Remove a listener.
Definition: NetworkTableInstance.inc:111
RawTopic GetRawTopic(std::string_view name) const
Gets a raw topic.
std::vector< TopicInfo > GetTopicInfo()
Get Topic Information about multiple topics.
Definition: NetworkTableInstance.inc:84
DoubleTopic GetDoubleTopic(std::string_view name) const
Gets a double topic.
Topic GetTopic(std::string_view name) const
Gets a "generic" (untyped) topic.
void StartServer(std::string_view persist_filename="networktables.json", const char *listen_address="", unsigned int port3=kDefaultPort3, unsigned int port4=kDefaultPort4)
Starts a server using the specified filename, listening address, and port.
Definition: NetworkTableInstance.inc:148
void StopLocal()
Stops local-only operation.
Definition: NetworkTableInstance.inc:144
std::vector< ConnectionInfo > GetConnections() const
Get information on the currently established network connections.
Definition: NetworkTableInstance.inc:206
static void Destroy(NetworkTableInstance &inst)
Destroys an instance (note: this has global effect).
Definition: NetworkTableInstance.inc:30
void StopClient()
Stops the client if it is running.
Definition: NetworkTableInstance.inc:167
static void StopConnectionDataLog(NT_ConnectionDataLogger logger)
Stops logging connection changes to a DataLog.
Definition: NetworkTableInstance.inc:235
std::optional< int64_t > GetServerTimeOffset() const
Get the time offset between server time and local time.
Definition: NetworkTableInstance.inc:215
IntegerTopic GetIntegerTopic(std::string_view name) const
Gets an integer topic.
std::vector< Topic > GetTopics()
Get Published Topics.
Definition: NetworkTableInstance.inc:61
void SetServer(std::span< const std::string_view > servers, unsigned int port=0)
Sets server addresses and port for client (without restarting client).
void StartClient3(std::string_view identity)
Starts a NT3 client.
Definition: NetworkTableInstance.inc:159
NetworkTables protobuf-encoded value topic.
Definition: ProtobufTopic.h:337
NetworkTables Raw topic.
Definition: RawTopic.h:266
NetworkTables StringArray topic.
Definition: StringArrayTopic.h:213
NetworkTables String topic.
Definition: StringTopic.h:268
NetworkTables struct-encoded value array topic.
Definition: StructArrayTopic.h:465
NetworkTables struct-encoded value topic.
Definition: StructTopic.h:371
NetworkTables subscriber.
Definition: Topic.h:309
NetworkTables Topic.
Definition: Topic.h:28
Owning wrapper (ala std::unique_ptr) for google::protobuf::Message* that does not require the protobu...
Definition: Protobuf.h:158
A data log.
Definition: DataLog.h:90
Specifies that a type is capable of raw struct serialization and deserialization.
Definition: Struct.h:68
basic_string_view< char > string_view
Definition: core.h:501
dimensionless::scalar_t log(const ScalarUnit x) noexcept
Compute natural logarithm.
Definition: math.h:349
NT_Handle NT_ConnectionDataLogger
Definition: ntcore_c.h:33
NT_Handle NT_Listener
Definition: ntcore_c.h:37
#define NT_DEFAULT_PORT3
Default network tables port number (NT3)
Definition: ntcore_c.h:45
NT_Handle NT_Inst
Definition: ntcore_c.h:36
#define NT_DEFAULT_PORT4
Default network tables port number (NT4)
Definition: ntcore_c.h:48
NT_Handle NT_DataLogger
Definition: ntcore_c.h:34
@ NT_LOG_DEBUG4
Definition: ntcore_c.h:84
@ NT_LOG_WARNING
Definition: ntcore_c.h:78
@ NT_LOG_INFO
Definition: ntcore_c.h:79
@ NT_LOG_DEBUG2
Definition: ntcore_c.h:82
@ NT_LOG_DEBUG
Definition: ntcore_c.h:80
@ NT_LOG_CRITICAL
Definition: ntcore_c.h:76
@ NT_LOG_ERROR
Definition: ntcore_c.h:77
@ NT_LOG_DEBUG3
Definition: ntcore_c.h:83
@ NT_LOG_DEBUG1
Definition: ntcore_c.h:81
@ NT_NET_MODE_LOCAL
Definition: ntcore_c.h:94
@ NT_NET_MODE_CLIENT4
Definition: ntcore_c.h:92
@ NT_NET_MODE_CLIENT3
Definition: ntcore_c.h:91
@ NT_NET_MODE_SERVER
Definition: ntcore_c.h:90
@ NT_NET_MODE_NONE
Definition: ntcore_c.h:89
std::function< void(const Event &)> ListenerCallback
Definition: ntcore_cpp.h:899
type
Definition: core.h:556
NetworkTables (ntcore) namespace.
Definition: ntcore_cpp.h:36