4#ifndef AGVC_INTERFACE_RPC_H
5#define AGVC_INTERFACE_RPC_H
61 std::function<
void(
int ,
const char * ,
int ,
const std::string & )>
74 int connect(
const std::string &ip =
"",
int port = 0);
99 int login(
const std::string &usrname,
const std::string &passwd);
151#define RpcClient_DECLARES \
152 _FUNC(RpcClient, 1, setLogHandler, handler) \
153 _FUNC(RpcClient, 2, connect, ip, port) \
154 _FUNC(RpcClient, 0, disconnect) \
155 _FUNC(RpcClient, 0, hasConnected) \
156 _FUNC(RpcClient, 2, login, usrname, passwd) \
157 _FUNC(RpcClient, 0, logout) \
158 _FUNC(RpcClient, 0, hasLogined) \
159 _FUNC(RpcClient, 1, setRequestTimeout, timeout) \
160 _FUNC(RpcClient, 1, setExceptionFree, timenableeout) \
161 _FUNC(RpcClient, 0, errorCode)
int setRequestTimeout(int timeout=10)
设置RPC请求超时时间
int setEventHandler(std::function< void(int)> cb)
设置事件处理
int errorCode() const
返回错误代码
void setLogHandler(std::function< void(int, const char *, int, const std::string &)> handler)
设置日志处理器
RpcClient(int mode=0)
RpcClient
bool hasConnected() const
判断是否连接RPC
int login(const std::string &usrname, const std::string &passwd)
登录
int setExceptionFree(bool enable)
是否关闭异常抛出
int connect(const std::string &ip="", int port=0)
连接到RPC服务
std::shared_ptr< RpcClient > RpcClientPtr