|
TuyaOS
|
Common process - json rpc 更多...
#include "tuya_cloud_com_defs.h"#include "tuya_cloud_types.h"#include "tuya_hal_network.h"#include "svc_rpc.h"
结构体 | |
| 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 UNW_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
| 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] | id | node id |
| [in] | requset | refer to JRPC_MSG_S |
| [in] | cb | callback function |
| [in] | cb_param | callback argument |
| [in] | timeout | timeout |
| INT_T lan_rpc_fd_get | ( | VOID | ) |
get fd
| OPERATE_RET lan_rpc_get_peer_ip | ( | OUT UNW_IP_ADDR_T * | peer_ip | ) |
lan rpc get peer ip
| [out] | peer_ip | get last recv ip |
| OPERATE_RET lan_rpc_init | ( | LAN_RPC_CFG_S * | cfg | ) |
rpc init
| [in] | cfg | refer to LAN_RPC_CFG_S |
| OPERATE_RET lan_rpc_method_register | ( | CHAR_T * | name, |
| RPC_METHOD_CB | cb, | ||
| VOID * | arg | ||
| ) |
lan rpc method register
| [in] | name | key name |
| [in] | cb | callback function |
| [in] | arg | callback argument |
| OPERATE_RET lan_rpc_node_add | ( | LAN_RPC_NODE_S * | node | ) |
node add
| [in] | node | node value |
| BOOL_T lan_rpc_node_find_by_ip | ( | UINT_T | ip, |
| LAN_RPC_NODE_S * | node | ||
| ) |
found node by ip
| [in] | ip | key ip |
| [out] | node | result node |
| BOOL_T lan_rpc_node_find_ip_by_id | ( | UINT8_T * | id, |
| UINT_T * | ip | ||
| ) |
found ip by id
| [in] | id | node id |
| [out] | ip | result ip |
| OPERATE_RET lan_rpc_node_key_set | ( | UINT8_T * | id, |
| UINT8_T * | key | ||
| ) |
node key set
| [in] | id | node id |
| [in] | key | key value |
| OPERATE_RET lan_rpc_node_output | ( | LAN_RPC_NODE_OUTPUT_CB | node_output_cb, |
| VOID * | arg | ||
| ) |
node output
| [in] | node_output_cb | refer to LAN_RPC_NODE_OUTPUT_CB |
| [in] | arg | argument |
| OPERATE_RET lan_rpc_recv | ( | VOID | ) |
rpc receive
| OPERATE_RET lan_rpc_session_key_set | ( | UINT8_T * | session_key | ) |
set session key
| [in] | session_key | key value |
| OPERATE_RET lan_rpc_slave_call_sync | ( | JRPC_MSG_S * | requset, |
| JRPC_MSG_S * | result, | ||
| UINT_T | timeout | ||
| ) |
slave rpc sync
| [in] | requset | refer to JRPC_MSG_S |
| [in] | result | refer to JRPC_MSG_S |
| [in] | timeout | timeout |