WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
nt Namespace Reference

NetworkTables (ntcore) namespace. More...

Namespaces

 EntryListenerFlags
 Entry listener flags.
 

Classes

struct  ConnectionInfo
 NetworkTables Connection Information. More...
 
class  ConnectionNotification
 NetworkTables Connection Notification. More...
 
struct  EntryInfo
 NetworkTables Entry Information. More...
 
class  EntryNotification
 NetworkTables Entry Notification. More...
 
class  LogMessage
 NetworkTables log message. More...
 
class  NetworkTable
 A network table that knows its subtable path. More...
 
class  NetworkTableEntry
 NetworkTables Entry. More...
 
class  NetworkTableInstance
 NetworkTables Instance. More...
 
class  RpcAnswer
 NetworkTables Remote Procedure Call (Server Side) More...
 
class  RpcCall
 NetworkTables Remote Procedure Call. More...
 
struct  RpcDefinition
 NetworkTables RPC Version 1 Definition. More...
 
struct  RpcParamDef
 NetworkTables RPC Version 1 Definition Parameter. More...
 
struct  RpcResultDef
 NetworkTables RPC Version 1 Definition Result. More...
 
class  Value
 A network table entry value. More...
 

Typedefs

typedef std::function< void(NT_EntryListener
entry_listener, StringRef name,
std::shared_ptr< Value > value,
unsigned int flags)> 
EntryListenerCallback
 Entry listener callback function. More...
 
typedef std::function< void(NT_ConnectionListener
conn_listener, bool connected,
const ConnectionInfo &conn)> 
ConnectionListenerCallback
 Connection listener callback function. More...
 
typedef std::function< void(unsigned
int level, const char *file,
unsigned int line, const char
*msg)> 
LogFunc
 Log function. More...
 
typedef Value NetworkTableValue
 NetworkTable Value alias for similarity with Java.
 
typedef std::function< void(NetworkTable
*parent, StringRef name,
std::shared_ptr< NetworkTable >
table)> 
TableListener
 A listener that listens to new sub-tables in a NetworkTable. More...
 
typedef std::function< void(NetworkTable
*table, StringRef name,
NetworkTableEntry entry,
std::shared_ptr< Value > value,
int flags)> 
TableEntryListener
 A listener that listens to changes in values in a NetworkTable. More...
 

Enumerations

enum  NetworkTableType {
  kUnassigned = NT_UNASSIGNED, kBoolean = NT_BOOLEAN, kDouble = NT_DOUBLE, kString = NT_STRING,
  kRaw = NT_RAW, kBooleanArray = NT_BOOLEAN_ARRAY, kDoubleArray = NT_DOUBLE_ARRAY, kStringArray = NT_STRING_ARRAY,
  kRpc = NT_RPC
}
 NetworkTable entry type.
 

Functions

NT_Inst GetDefaultInstance ()
 Get default instance. More...
 
NT_Inst CreateInstance ()
 Create an instance. More...
 
void DestroyInstance (NT_Inst inst)
 Destroy an instance. More...
 
NT_Inst GetInstanceFromHandle (NT_Handle handle)
 Get instance handle from another handle. More...
 
NT_Entry GetEntry (NT_Inst inst, const Twine &name)
 Get Entry Handle. More...
 
std::vector< NT_Entry > GetEntries (NT_Inst inst, const Twine &prefix, unsigned int types)
 Get Entry Handles. More...
 
std::string GetEntryName (NT_Entry entry)
 Gets the name of the specified entry. More...
 
NT_Type GetEntryType (NT_Entry entry)
 Gets the type for the specified entry, or unassigned if non existent. More...
 
uint64_t GetEntryLastChange (NT_Entry entry)
 Gets the last time the entry was changed. More...
 
std::shared_ptr< ValueGetEntryValue (StringRef name)
 Get Entry Value. More...
 
std::shared_ptr< ValueGetEntryValue (NT_Entry entry)
 Get Entry Value. More...
 
bool SetDefaultEntryValue (StringRef name, std::shared_ptr< Value > value)
 Set Default Entry Value. More...
 
bool SetDefaultEntryValue (NT_Entry entry, std::shared_ptr< Value > value)
 Set Default Entry Value. More...
 
bool SetEntryValue (StringRef name, std::shared_ptr< Value > value)
 Set Entry Value. More...
 
bool SetEntryValue (NT_Entry entry, std::shared_ptr< Value > value)
 Set Entry Value. More...
 
void SetEntryTypeValue (StringRef name, std::shared_ptr< Value > value)
 Set Entry Type and Value. More...
 
void SetEntryTypeValue (NT_Entry entry, std::shared_ptr< Value > value)
 Set Entry Type and Value. More...
 
void SetEntryFlags (StringRef name, unsigned int flags)
 Set Entry Flags. More...
 
void SetEntryFlags (NT_Entry entry, unsigned int flags)
 Set Entry Flags. More...
 
unsigned int GetEntryFlags (StringRef name)
 Get Entry Flags. More...
 
unsigned int GetEntryFlags (NT_Entry entry)
 Get Entry Flags. More...
 
void DeleteEntry (StringRef name)
 Delete Entry. More...
 
void DeleteEntry (NT_Entry entry)
 Delete Entry. More...
 
void DeleteAllEntries ()
 Delete All Entries. More...
 
void DeleteAllEntries (NT_Inst inst)
 Delete All Entries. More...
 
std::vector< EntryInfoGetEntryInfo (StringRef prefix, unsigned int types)
 Get Entry Information. More...
 
std::vector< EntryInfoGetEntryInfo (NT_Inst inst, const Twine &prefix, unsigned int types)
 Get Entry Information. More...
 
EntryInfo GetEntryInfo (NT_Entry entry)
 Get Entry Information. More...
 
NT_EntryListener AddEntryListener (StringRef prefix, EntryListenerCallback callback, unsigned int flags)
 Add a listener for all entries starting with a certain prefix. More...
 
NT_EntryListener AddEntryListener (NT_Inst inst, const Twine &prefix, std::function< void(const EntryNotification &event)> callback, unsigned int flags)
 Add a listener for all entries starting with a certain prefix. More...
 
NT_EntryListener AddEntryListener (NT_Entry entry, std::function< void(const EntryNotification &event)> callback, unsigned int flags)
 Add a listener for a single entry. More...
 
NT_EntryListenerPoller CreateEntryListenerPoller (NT_Inst inst)
 Create a entry listener poller. More...
 
void DestroyEntryListenerPoller (NT_EntryListenerPoller poller)
 Destroy a entry listener poller. More...
 
NT_EntryListener AddPolledEntryListener (NT_EntryListenerPoller poller, const Twine &prefix, unsigned int flags)
 Create a polled entry listener. More...
 
NT_EntryListener AddPolledEntryListener (NT_EntryListenerPoller poller, NT_Entry entry, unsigned int flags)
 Create a polled entry listener. More...
 
std::vector< EntryNotificationPollEntryListener (NT_EntryListenerPoller poller)
 Get the next entry listener event. More...
 
std::vector< EntryNotificationPollEntryListener (NT_EntryListenerPoller poller, double timeout, bool *timed_out)
 Get the next entry listener event. More...
 
void CancelPollEntryListener (NT_EntryListenerPoller poller)
 Cancel a PollEntryListener call. More...
 
void RemoveEntryListener (NT_EntryListener entry_listener)
 Remove an entry listener. More...
 
bool WaitForEntryListenerQueue (NT_Inst inst, double timeout)
 Wait for the entry listener queue to be empty. More...
 
NT_ConnectionListener AddConnectionListener (ConnectionListenerCallback callback, bool immediate_notify)
 Add a connection listener. More...
 
NT_ConnectionListener AddConnectionListener (NT_Inst inst, std::function< void(const ConnectionNotification &event)> callback, bool immediate_notify)
 Add a connection listener. More...
 
NT_ConnectionListenerPoller CreateConnectionListenerPoller (NT_Inst inst)
 Create a connection listener poller. More...
 
void DestroyConnectionListenerPoller (NT_ConnectionListenerPoller poller)
 Destroy a connection listener poller. More...
 
NT_ConnectionListener AddPolledConnectionListener (NT_ConnectionListenerPoller poller, bool immediate_notify)
 Create a polled connection listener. More...
 
std::vector
< ConnectionNotification
PollConnectionListener (NT_ConnectionListenerPoller poller)
 Get the next connection event. More...
 
std::vector
< ConnectionNotification
PollConnectionListener (NT_ConnectionListenerPoller poller, double timeout, bool *timed_out)
 Get the next connection event. More...
 
void CancelPollConnectionListener (NT_ConnectionListenerPoller poller)
 Cancel a PollConnectionListener call. More...
 
void RemoveConnectionListener (NT_ConnectionListener conn_listener)
 Remove a connection listener. More...
 
bool WaitForConnectionListenerQueue (NT_Inst inst, double timeout)
 Wait for the connection listener queue to be empty. More...
 
void CreateRpc (NT_Entry entry, StringRef def, std::function< void(const RpcAnswer &answer)> callback)
 Create a callback-based RPC entry point. More...
 
NT_RpcCallPoller CreateRpcCallPoller (NT_Inst inst)
 Create a RPC call poller. More...
 
void DestroyRpcCallPoller (NT_RpcCallPoller poller)
 Destroy a RPC call poller. More...
 
void CreatePolledRpc (NT_Entry entry, StringRef def, NT_RpcCallPoller poller)
 Create a polled RPC entry point. More...
 
std::vector< RpcAnswerPollRpc (NT_RpcCallPoller poller)
 Get the next incoming RPC call. More...
 
std::vector< RpcAnswerPollRpc (NT_RpcCallPoller poller, double timeout, bool *timed_out)
 Get the next incoming RPC call. More...
 
void CancelPollRpc (NT_RpcCallPoller poller)
 Cancel a PollRpc call. More...
 
bool WaitForRpcCallQueue (NT_Inst inst, double timeout)
 Wait for the incoming RPC call queue to be empty. More...
 
bool PostRpcResponse (NT_Entry entry, NT_RpcCall call, StringRef result)
 Post RPC response (return value) for a polled RPC. More...
 
NT_RpcCall CallRpc (NT_Entry entry, StringRef params)
 Call a RPC function. More...
 
bool GetRpcResult (NT_Entry entry, NT_RpcCall call, std::string *result)
 Get the result (return value) of a RPC call. More...
 
bool GetRpcResult (NT_Entry entry, NT_RpcCall call, std::string *result, double timeout, bool *timed_out)
 Get the result (return value) of a RPC call. More...
 
void CancelRpcResult (NT_Entry entry, NT_RpcCall call)
 Ignore the result of a RPC call. More...
 
std::string PackRpcDefinition (const RpcDefinition &def)
 Pack a RPC version 1 definition. More...
 
bool UnpackRpcDefinition (StringRef packed, RpcDefinition *def)
 Unpack a RPC version 1 definition. More...
 
std::string PackRpcValues (ArrayRef< std::shared_ptr< Value >> values)
 Pack RPC values as required for RPC version 1 definition messages. More...
 
std::vector< std::shared_ptr
< Value > > 
UnpackRpcValues (StringRef packed, ArrayRef< NT_Type > types)
 Unpack RPC values as required for RPC version 1 definition messages. More...
 
void SetNetworkIdentity (StringRef name)
 Set the network identity of this node. More...
 
void SetNetworkIdentity (NT_Inst inst, const Twine &name)
 Set the network identity of this node. More...
 
unsigned int GetNetworkMode ()
 Get the current network mode. More...
 
unsigned int GetNetworkMode (NT_Inst inst)
 Get the current network mode. More...
 
void StartServer (StringRef persist_filename, const char *listen_address, unsigned int port)
 Starts a server using the specified filename, listening address, and port. More...
 
void StartServer (NT_Inst inst, const Twine &persist_filename, const char *listen_address, unsigned int port)
 Starts a server using the specified filename, listening address, and port. More...
 
void StopServer ()
 Stops the server if it is running.
 
void StopServer (NT_Inst inst)
 Stops the server if it is running. More...
 
void StartClient ()
 Starts a client. More...
 
void StartClient (const char *server_name, unsigned int port)
 Starts a client using the specified server and port. More...
 
void StartClient (ArrayRef< std::pair< StringRef, unsigned int >> servers)
 Starts a client using the specified (server, port) combinations. More...
 
void StartClient (NT_Inst inst)
 Starts a client. More...
 
void StartClient (NT_Inst inst, const char *server_name, unsigned int port)
 Starts a client using the specified server and port. More...
 
void StartClient (NT_Inst inst, ArrayRef< std::pair< StringRef, unsigned int >> servers)
 Starts a client using the specified (server, port) combinations. More...
 
void StartClientTeam (NT_Inst inst, unsigned int team, unsigned int port)
 Starts a client using commonly known robot addresses for the specified team. More...
 
void StopClient ()
 Stops the client if it is running.
 
void StopClient (NT_Inst inst)
 Stops the client if it is running. More...
 
void SetServer (const char *server_name, unsigned int port)
 Sets server address and port for client (without restarting client). More...
 
void SetServer (ArrayRef< std::pair< StringRef, unsigned int >> servers)
 Sets server addresses for client (without restarting client). More...
 
void SetServer (NT_Inst inst, const char *server_name, unsigned int port)
 Sets server address and port for client (without restarting client). More...
 
void SetServer (NT_Inst inst, ArrayRef< std::pair< StringRef, unsigned int >> servers)
 Sets server addresses for client (without restarting client). More...
 
void SetServerTeam (NT_Inst inst, unsigned int team, unsigned int port)
 Sets server addresses and port for client (without restarting client). More...
 
void StartDSClient (unsigned int port)
 Starts requesting server address from Driver Station. More...
 
void StartDSClient (NT_Inst inst, unsigned int port)
 Starts requesting server address from Driver Station. More...
 
void StopDSClient ()
 Stops requesting server address from Driver Station. More...
 
void StopDSClient (NT_Inst inst)
 Stops requesting server address from Driver Station. More...
 
void StopRpcServer ()
 Stops the RPC server if it is running. More...
 
void SetUpdateRate (double interval)
 Set the periodic update rate. More...
 
void SetUpdateRate (NT_Inst inst, double interval)
 Set the periodic update rate. More...
 
void Flush ()
 Flush Entries. More...
 
void Flush (NT_Inst inst)
 Flush Entries. More...
 
std::vector< ConnectionInfoGetConnections ()
 Get information on the currently established network connections. More...
 
std::vector< ConnectionInfoGetConnections (NT_Inst inst)
 Get information on the currently established network connections. More...
 
bool IsConnected (NT_Inst inst)
 Return whether or not the instance is connected to another node. More...
 
const char * SavePersistent (StringRef filename)
 Save persistent values to a file. More...
 
const char * SavePersistent (NT_Inst inst, const Twine &filename)
 Save persistent values to a file. More...
 
const char * LoadPersistent (StringRef filename, std::function< void(size_t line, const char *msg)> warn)
 Load persistent values from a file. More...
 
const char * LoadPersistent (NT_Inst inst, const Twine &filename, std::function< void(size_t line, const char *msg)> warn)
 
const char * SaveEntries (NT_Inst inst, const Twine &filename, const Twine &prefix)
 Save table values to a file. More...
 
const char * LoadEntries (NT_Inst inst, const Twine &filename, const Twine &prefix, std::function< void(size_t line, const char *msg)> warn)
 Load table values from a file. More...
 
uint64_t Now ()
 Returns monotonic current time in 1 us increments. More...
 
void SetLogger (LogFunc func, unsigned int min_level)
 Set logger callback function. More...
 
NT_Logger AddLogger (NT_Inst inst, std::function< void(const LogMessage &msg)> func, unsigned int min_level, unsigned int max_level)
 Add logger callback function. More...
 
NT_LoggerPoller CreateLoggerPoller (NT_Inst inst)
 Create a log poller. More...
 
void DestroyLoggerPoller (NT_LoggerPoller poller)
 Destroy a log poller. More...
 
NT_Logger AddPolledLogger (NT_LoggerPoller poller, unsigned int min_level, unsigned int max_level)
 Set the log level for a log poller. More...
 
std::vector< LogMessagePollLogger (NT_LoggerPoller poller)
 Get the next log event. More...
 
std::vector< LogMessagePollLogger (NT_LoggerPoller poller, double timeout, bool *timed_out)
 Get the next log event. More...
 
void CancelPollLogger (NT_LoggerPoller poller)
 Cancel a PollLogger call. More...
 
void RemoveLogger (NT_Logger logger)
 Remove a logger. More...
 
bool WaitForLoggerQueue (NT_Inst inst, double timeout)
 Wait for the incoming log event queue to be empty. More...
 
bool operator== (const Value &lhs, const Value &rhs)
 
bool operator!= (const Value &lhs, const Value &rhs)
 

Detailed Description

NetworkTables (ntcore) namespace.