17 #include "llvm/ArrayRef.h"
18 #include "llvm/StringRef.h"
44 std::string remote_id;
45 std::string remote_name;
46 unsigned int remote_port;
47 unsigned long long last_update;
48 unsigned int protocol_version;
55 : name(name_), def_value(def_value_) {}
58 std::shared_ptr<Value> def_value;
74 std::vector<RpcParamDef> params;
75 std::vector<RpcResultDef> results;
81 unsigned int call_uid;
97 std::shared_ptr<Value> GetEntryValue(
StringRef name);
107 bool SetEntryValue(
StringRef name, std::shared_ptr<Value> value);
120 void SetEntryTypeValue(
StringRef name, std::shared_ptr<Value> value);
124 void SetEntryFlags(
StringRef name,
unsigned int flags);
128 unsigned int GetEntryFlags(
StringRef name);
152 void DeleteAllEntries();
166 std::vector<EntryInfo> GetEntryInfo(
StringRef prefix,
unsigned int types);
183 void SetListenerOnStart(std::function<
void()> on_start);
184 void SetListenerOnExit(std::function<
void()> on_exit);
186 typedef std::function<void(
unsigned int uid,
StringRef name,
187 std::shared_ptr<Value> value,
188 unsigned int flags)> EntryListenerCallback;
190 typedef std::function<void(
unsigned int uid,
bool connected,
192 ConnectionListenerCallback;
194 unsigned int AddEntryListener(
StringRef prefix, EntryListenerCallback callback,
196 void RemoveEntryListener(
unsigned int entry_listener_uid);
197 unsigned int AddConnectionListener(ConnectionListenerCallback callback,
198 bool immediate_notify);
199 void RemoveConnectionListener(
unsigned int conn_listener_uid);
201 bool NotifierDestroyed();
207 void SetRpcServerOnStart(std::function<
void()> on_start);
208 void SetRpcServerOnExit(std::function<
void()> on_exit);
210 typedef std::function<std::string(StringRef name, StringRef params)>
216 bool PollRpc(
bool blocking,
RpcCallInfo* call_info);
217 void PostRpcResponse(
unsigned int rpc_id,
unsigned int call_uid,
221 bool GetRpcResult(
bool blocking,
unsigned int call_uid, std::string* result);
225 std::string PackRpcValues(
ArrayRef<std::shared_ptr<Value>> values);
226 std::vector<std::shared_ptr<Value>> UnpackRpcValues(
StringRef packed,
233 void StartServer(
StringRef persist_filename,
const char* listen_address,
236 void StartClient(
const char* server_name,
unsigned int port);
238 void StopRpcServer();
240 void SetUpdateRate(
double interval);
241 std::vector<ConnectionInfo> GetConnections();
247 const char* SavePersistent(
StringRef filename);
248 const char* LoadPersistent(
249 StringRef filename, std::function<
void(
size_t line,
const char* msg)> warn);
256 unsigned long long Now();
259 typedef std::function<void(
unsigned int level,
const char* file,
260 unsigned int line,
const char* msg)> LogFunc;
261 void SetLogger(LogFunc func,
unsigned int min_level);
NetworkTables Connection Information.
Definition: ntcore_cpp.h:43
NetworkTables RPC Call Data.
Definition: ntcore_cpp.h:79
NetworkTables RPC Definition.
Definition: ntcore_cpp.h:71
unsigned long long last_change
Timestamp of last change to entry (type or value).
Definition: ntcore_cpp.h:39
NT_Type type
Entry type.
Definition: ntcore_cpp.h:33
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: ArrayRef.h:54
NetworkTables RPC Parameter Definition.
Definition: ntcore_cpp.h:52
NetworkTables Entry Information.
Definition: ntcore_cpp.h:28
std::string name
Entry name.
Definition: ntcore_cpp.h:30
unsigned int flags
Entry flags.
Definition: ntcore_cpp.h:36
NetworkTables RPC Result Definition.
Definition: ntcore_cpp.h:62
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:39