23class BooleanArrayTopic;
25class DoubleArrayTopic;
29class IntegerArrayTopic;
33class StringArrayTopic;
115 explicit operator
bool()
const {
return m_handle != 0; }
288 std::span<std::string_view> types);
341 std::span<std::string_view> types);
523 const char* listen_address =
"",
559 void SetServer(
const char* server_name,
unsigned int port = 0);
568 std::span<
const std::pair<std::string_view, unsigned int>> servers);
577 void SetServer(std::span<const std::string_view> servers,
578 unsigned int port = 0);
587 void SetServerTeam(
unsigned int team,
unsigned int port = 0);
NetworkTables BooleanArray topic.
Definition: BooleanArrayTopic.h:263
NetworkTables Boolean topic.
Definition: BooleanTopic.h:210
NetworkTables DoubleArray topic.
Definition: DoubleArrayTopic.h:263
NetworkTables Double topic.
Definition: DoubleTopic.h:210
NetworkTables FloatArray topic.
Definition: FloatArrayTopic.h:263
NetworkTables Float topic.
Definition: FloatTopic.h:210
NetworkTables IntegerArray topic.
Definition: IntegerArrayTopic.h:263
NetworkTables Integer topic.
Definition: IntegerTopic.h:210
Subscribe to multiple topics based on one or more topic name prefixes.
Definition: MultiSubscriber.h:20
NetworkTables Entry.
Definition: NetworkTableEntry.h:36
NetworkTables Instance.
Definition: NetworkTableInstance.h:59
void StartClient4(std::string_view identity)
Starts a NT4 client.
Definition: NetworkTableInstance.inc:143
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:65
@ kNetModeClient4
Definition: NetworkTableInstance.h:69
@ kNetModeServer
Definition: NetworkTableInstance.h:67
@ kNetModeLocal
Definition: NetworkTableInstance.h:70
@ kNetModeClient3
Definition: NetworkTableInstance.h:68
@ kNetModeNone
Definition: NetworkTableInstance.h:66
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:191
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:95
void StartLocal()
Starts local-only operation.
Definition: NetworkTableInstance.inc:120
static void StopEntryDataLog(NT_DataLogger logger)
Stops logging entry changes to a DataLog.
Definition: NetworkTableInstance.inc:206
bool WaitForListenerQueue(double timeout)
Wait for the listener queue to be empty.
Definition: NetworkTableInstance.inc:87
DoubleArrayTopic GetDoubleArrayTopic(std::string_view name) const
Gets a double array topic.
NT_Listener AddLogger(unsigned int minLevel, unsigned int maxLevel, ListenerCallback func)
Add logger callback function.
Definition: NetworkTableInstance.inc:220
void StartDSClient(unsigned int port=0)
Starts requesting server address from Driver Station.
Definition: NetworkTableInstance.inc:170
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:178
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:210
unsigned int GetNetworkMode() const
Get the current network mode.
Definition: NetworkTableInstance.inc:116
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:96
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:200
NetworkTableEntry GetEntry(std::string_view name)
Gets the entry for a key.
Definition: NetworkTableInstance.inc:83
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:91
void StopServer()
Stops the server if it is running.
Definition: NetworkTableInstance.inc:135
void SetServer(const char *server_name, unsigned int port=0)
Sets server address and port for client (without restarting client).
Definition: NetworkTableInstance.inc:151
void SetServerTeam(unsigned int team, unsigned int port=0)
Sets server addresses and port for client (without restarting client).
Definition: NetworkTableInstance.inc:161
bool operator==(const NetworkTableInstance &) const =default
Equality operator.
void StopDSClient()
Stops requesting server address from Driver Station.
Definition: NetworkTableInstance.inc:174
LogLevel
Logging levels (as used by SetLogger()).
Definition: NetworkTableInstance.h:76
@ kLogInfo
Definition: NetworkTableInstance.h:80
@ kLogError
Definition: NetworkTableInstance.h:78
@ kLogWarning
Definition: NetworkTableInstance.h:79
@ kLogDebug4
Definition: NetworkTableInstance.h:85
@ kLogDebug3
Definition: NetworkTableInstance.h:84
@ kLogCritical
Definition: NetworkTableInstance.h:77
@ kLogDebug
Definition: NetworkTableInstance.h:81
@ kLogDebug1
Definition: NetworkTableInstance.h:82
@ kLogDebug2
Definition: NetworkTableInstance.h:83
void Disconnect()
Disconnects the client if it's running and connected.
Definition: NetworkTableInstance.inc:166
void Flush() const
Flushes all updated values immediately to the network.
Definition: NetworkTableInstance.inc:182
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:103
static void RemoveListener(NT_Listener listener)
Remove a listener.
Definition: NetworkTableInstance.inc:91
RawTopic GetRawTopic(std::string_view name) const
Gets a raw topic.
std::vector< TopicInfo > GetTopicInfo()
Get Topic Information about multiple topics.
Definition: NetworkTableInstance.inc:64
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:128
void StopLocal()
Stops local-only operation.
Definition: NetworkTableInstance.inc:124
std::vector< ConnectionInfo > GetConnections() const
Get information on the currently established network connections.
Definition: NetworkTableInstance.inc:186
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:147
static void StopConnectionDataLog(NT_ConnectionDataLogger logger)
Stops logging connection changes to a DataLog.
Definition: NetworkTableInstance.inc:215
std::optional< int64_t > GetServerTimeOffset() const
Get the time offset between server time and local time.
Definition: NetworkTableInstance.inc:195
IntegerTopic GetIntegerTopic(std::string_view name) const
Gets an integer topic.
std::vector< Topic > GetTopics()
Get Published Topics.
Definition: NetworkTableInstance.inc:41
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:139
NetworkTables Raw topic.
Definition: RawTopic.h:263
NetworkTables StringArray topic.
Definition: StringArrayTopic.h:210
NetworkTables String topic.
Definition: StringTopic.h:265
NetworkTables subscriber.
Definition: Topic.h:290
NetworkTables Topic.
Definition: Topic.h:30
A data log.
Definition: DataLog.h:66
basic_string_view< char > string_view
Definition: core.h:520
dimensionless::scalar_t log(const ScalarUnit x) noexcept
Compute natural logarithm.
Definition: math.h:349
NT_Handle NT_ConnectionDataLogger
Definition: ntcore_c.h:31
NT_Handle NT_Listener
Definition: ntcore_c.h:35
#define NT_DEFAULT_PORT3
Default network tables port number (NT3)
Definition: ntcore_c.h:43
NT_Handle NT_Inst
Definition: ntcore_c.h:34
#define NT_DEFAULT_PORT4
Default network tables port number (NT4)
Definition: ntcore_c.h:46
NT_Handle NT_DataLogger
Definition: ntcore_c.h:32
@ 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_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
std::function< void(const Event &)> ListenerCallback
Definition: ntcore_cpp.h:860
NetworkTables (ntcore) namespace.
Definition: ntcore_cpp.h:35