mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Adds timeout capabilities to blocking Rpc Calls (#86)
This commit is contained in:
committed by
Peter Johnson
parent
bc99d341fb
commit
0b80bd2b09
@@ -319,12 +319,16 @@ void NT_CreatePolledRpc(const char *name, size_t name_len, const char *def,
|
||||
size_t def_len);
|
||||
|
||||
int NT_PollRpc(int blocking, struct NT_RpcCallInfo* call_info);
|
||||
int NT_PollRpcTimeout(int blocking, double time_out,
|
||||
struct NT_RpcCallInfo* call_info);
|
||||
void NT_PostRpcResponse(unsigned int rpc_id, unsigned int call_uid,
|
||||
const char *result, size_t result_len);
|
||||
|
||||
unsigned int NT_CallRpc(const char *name, size_t name_len, const char *params,
|
||||
size_t params_len);
|
||||
char *NT_GetRpcResult(int blocking, unsigned int call_uid, size_t *result_len);
|
||||
char *NT_GetRpcResultTimeout(int blocking, unsigned int call_uid,
|
||||
double time_out, size_t *result_len);
|
||||
|
||||
char *NT_PackRpcDefinition(const struct NT_RpcDefinition *def,
|
||||
size_t *packed_len);
|
||||
|
||||
@@ -214,6 +214,8 @@ bool NotifierDestroyed();
|
||||
/*
|
||||
* Remote Procedure Call Functions
|
||||
*/
|
||||
|
||||
constexpr double kTimeout_Indefinite = -1;
|
||||
|
||||
void SetRpcServerOnStart(std::function<void()> on_start);
|
||||
void SetRpcServerOnExit(std::function<void()> on_exit);
|
||||
@@ -225,11 +227,14 @@ void CreateRpc(StringRef name, StringRef def, RpcCallback callback);
|
||||
void CreatePolledRpc(StringRef name, StringRef def);
|
||||
|
||||
bool PollRpc(bool blocking, RpcCallInfo* call_info);
|
||||
bool PollRpc(bool blocking, double time_out, RpcCallInfo* call_info);
|
||||
void PostRpcResponse(unsigned int rpc_id, unsigned int call_uid,
|
||||
StringRef result);
|
||||
|
||||
unsigned int CallRpc(StringRef name, StringRef params);
|
||||
bool GetRpcResult(bool blocking, unsigned int call_uid, std::string* result);
|
||||
bool GetRpcResult(bool blocking, unsigned int call_uid, double time_out,
|
||||
std::string* result);
|
||||
|
||||
std::string PackRpcDefinition(const RpcDefinition& def);
|
||||
bool UnpackRpcDefinition(StringRef packed, RpcDefinition *def);
|
||||
|
||||
Reference in New Issue
Block a user