TuyaOS
结构体 | 宏定义 | 类型定义 | 枚举 | 函数
lan_rpc.h 文件参考

Common process - json rpc 更多...

#include "tuya_cloud_com_defs.h"
#include "tuya_cloud_types.h"
#include "tal_network.h"
#include "svc_rpc.h"
lan_rpc.h 的引用(Include)关系图:

浏览源代码.

结构体

struct  LAN_RPC_CFG_S
 

宏定义

#define LAN_RPC_ID_LEN   (GW_ID_LEN)
 
#define LAN_RPC_KEY_LEN   (LOCAL_KEY_LEN)
 
#define LAN_RPC_NODE_ADD   0
 
#define LAN_RPC_NODE_DEL   1
 
#define LAN_RPC_NODE_REJOIN   2
 
#define LAN_RPC_NODE_TIMEOUT   20
 

类型定义

typedef OPERATE_RET(* LAN_RPC_MASTER_GET_CB) (LAN_RPC_MASTER_S *master)
 
typedef VOID(* LAN_RPC_NODE_OUTPUT_CB) (LAN_RPC_NODE_S *node, UINT16_T num, VOID *arg)
 
typedef OPERATE_RET(* LAN_RPC_NODE_STAT_CB) (UINT8_T stat, LAN_RPC_NODE_S *node)
 
typedef rpc_method_cb RPC_METHOD_CB
 
typedef rpc_async_cb RPC_RET_CB
 

枚举

enum  LAN_RPC_TYPE { LAN_RPC_SLAVER , LAN_RPC_MASTER }
 

函数

OPERATE_RET lan_rpc_call_async (UINT8_T *id, JRPC_MSG_S *requset, RPC_RET_CB cb, VOID *cb_param, UINT_T timeout)
 rpc sync 更多...
 
INT_T lan_rpc_fd_get (VOID)
 get fd 更多...
 
OPERATE_RET lan_rpc_get_peer_ip (OUT TUYA_IP_ADDR_T *peer_ip)
 lan rpc get peer ip 更多...
 
OPERATE_RET lan_rpc_init (LAN_RPC_CFG_S *cfg)
 rpc init 更多...
 
OPERATE_RET lan_rpc_method_register (CHAR_T *name, RPC_METHOD_CB cb, VOID *arg)
 lan rpc method register 更多...
 
OPERATE_RET lan_rpc_node_add (LAN_RPC_NODE_S *node)
 node add 更多...
 
BOOL_T lan_rpc_node_find_by_ip (UINT_T ip, LAN_RPC_NODE_S *node)
 found node by ip 更多...
 
BOOL_T lan_rpc_node_find_ip_by_id (UINT8_T *id, UINT_T *ip)
 found ip by id 更多...
 
VOID lan_rpc_node_fresh (CHAR_T *dev_id)
 
OPERATE_RET lan_rpc_node_key_set (UINT8_T *id, UINT8_T *key)
 node key set 更多...
 
OPERATE_RET lan_rpc_node_output (LAN_RPC_NODE_OUTPUT_CB node_output_cb, VOID *arg)
 node output 更多...
 
VOID lan_rpc_node_timeout_check (VOID)
 check timeout
 
VOID lan_rpc_node_timeout_set (UINT_T timeout_s)
 
OPERATE_RET lan_rpc_recv (VOID)
 rpc receive 更多...
 
OPERATE_RET lan_rpc_session_key_set (UINT8_T *session_key)
 set session key 更多...
 
OPERATE_RET lan_rpc_slave_call_sync (JRPC_MSG_S *requset, JRPC_MSG_S *result, UINT_T timeout)
 slave rpc sync 更多...
 

详细描述

Common process - json rpc

Common process - lan rpc

版本
0.1
日期
2020-03-16

函数说明

◆ lan_rpc_call_async()

OPERATE_RET lan_rpc_call_async ( UINT8_T *  id,
JRPC_MSG_S requset,
RPC_RET_CB  cb,
VOID *  cb_param,
UINT_T  timeout 
)

rpc sync

参数
[in]idnode id
[in]requsetrefer to JRPC_MSG_S
[in]cbcallback function
[in]cb_paramcallback argument
[in]timeouttimeout
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_fd_get()

INT_T lan_rpc_fd_get ( VOID  )

get fd

返回
fd value

◆ lan_rpc_get_peer_ip()

OPERATE_RET lan_rpc_get_peer_ip ( OUT TUYA_IP_ADDR_T *  peer_ip)

lan rpc get peer ip

参数
[out]peer_ipget last recv ip
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_init()

OPERATE_RET lan_rpc_init ( LAN_RPC_CFG_S cfg)

rpc init

参数
[in]cfgrefer to LAN_RPC_CFG_S
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_method_register()

OPERATE_RET lan_rpc_method_register ( CHAR_T *  name,
RPC_METHOD_CB  cb,
VOID *  arg 
)

lan rpc method register

参数
[in]namekey name
[in]cbcallback function
[in]argcallback argument
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_node_add()

OPERATE_RET lan_rpc_node_add ( LAN_RPC_NODE_S node)

node add

参数
[in]nodenode value
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_node_find_by_ip()

BOOL_T lan_rpc_node_find_by_ip ( UINT_T  ip,
LAN_RPC_NODE_S node 
)

found node by ip

参数
[in]ipkey ip
[out]noderesult node
返回
found TRUE,else false

◆ lan_rpc_node_find_ip_by_id()

BOOL_T lan_rpc_node_find_ip_by_id ( UINT8_T *  id,
UINT_T *  ip 
)

found ip by id

参数
[in]idnode id
[out]ipresult ip
返回
found TRUE,else false

◆ lan_rpc_node_key_set()

OPERATE_RET lan_rpc_node_key_set ( UINT8_T *  id,
UINT8_T *  key 
)

node key set

参数
[in]idnode id
[in]keykey value
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_node_output()

OPERATE_RET lan_rpc_node_output ( LAN_RPC_NODE_OUTPUT_CB  node_output_cb,
VOID *  arg 
)

node output

参数
[in]node_output_cbrefer to LAN_RPC_NODE_OUTPUT_CB
[in]argargument
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_recv()

OPERATE_RET lan_rpc_recv ( VOID  )

rpc receive

返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_session_key_set()

OPERATE_RET lan_rpc_session_key_set ( UINT8_T *  session_key)

set session key

参数
[in]session_keykey value
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ lan_rpc_slave_call_sync()

OPERATE_RET lan_rpc_slave_call_sync ( JRPC_MSG_S requset,
JRPC_MSG_S result,
UINT_T  timeout 
)

slave rpc sync

参数
[in]requsetrefer to JRPC_MSG_S
[in]resultrefer to JRPC_MSG_S
[in]timeouttimeout
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h