|
TuyaOS
|
rcp relate 更多...
#include <stdint.h>#include "tuya_cloud_com_defs.h"#include "tuya_slist.h"#include "rpc_base.h"#include "json_rpc.h"#include "tal_thread.h"

结构体 | |
| struct | tuya_rpc_t |
类型定义 | |
| typedef void(* | rpc_async_cb) (jrpc_msg_t *result, void *arg) |
| rpc async callback 更多... | |
| typedef int(* | rpc_crypt_cb) (uint8_t **data, uint32_t *len, uint8_t key[16], tuya_rpc_crypt_mode_t mode) |
| typedef void(* | rpc_method_cb) (jrpc_msg_t *request, void *arg, jrpc_msg_t *reply) |
| rpc method callback 更多... | |
| typedef void(* | rpc_subscribe_cb) (jrpc_msg_t *request, void *arg) |
| rpc subscribe callback 更多... | |
枚举 | |
| enum | tuya_rpc_cmd_t { RPC_BUFSIZE_SET_CMD } |
| enum | tuya_rpc_crypt_mode_t { TUYA_RPC_ENCRYPT , TUYA_RPC_DECRYPT , TUYA_RPC_FREECRYPT } |
函数 | |
| int | tuya_rpc_call_async (tuya_rpc_t *rpc, char *id, jrpc_msg_t *requset, rpc_async_cb cb, void *arg, uint32_t sec) |
| rpc asynchronous call 更多... | |
| int | tuya_rpc_call_notify (tuya_rpc_t *rpc, char *id, jrpc_msg_t *requset) |
| rpc call notify 更多... | |
| int | tuya_rpc_call_sync (tuya_rpc_t *rpc, char *id, jrpc_msg_t *requset, jrpc_msg_t *reply, uint32_t sec) |
| rpc synchronous call 更多... | |
| int | tuya_rpc_control (tuya_rpc_t *rpc, uint8_t cmd, void *arg) |
| rpc control 更多... | |
| int | tuya_rpc_declare (tuya_rpc_t *rpc, char *name, rpc_method_cb cb, void *arg) |
| declare one rpc according name 更多... | |
| int | tuya_rpc_init (tuya_rpc_t *rpc, char *id, char *addr) |
| rpc function init 更多... | |
| int | tuya_rpc_publish (tuya_rpc_t *rpc, char *name, jrpc_msg_t *msg) |
| publish one rpc 更多... | |
| int | tuya_rpc_run (tuya_rpc_t *rpc, uint32_t stack_size, uint32_t prio) |
| create rpc task 更多... | |
| int | tuya_rpc_set_crypt (tuya_rpc_t *rpc, rpc_crypt_cb crypt_cb, uint8_t key[(LOCAL_KEY_LEN)]) |
| set encryption key and callback 更多... | |
| int | tuya_rpc_set_crypt_cb (tuya_rpc_t *rpc, rpc_crypt_cb crypt_cb) |
| set encryption callback 更多... | |
| int | tuya_rpc_set_crypt_key (tuya_rpc_t *rpc, uint8_t key[(LOCAL_KEY_LEN)]) |
| set encryption key 更多... | |
| int | tuya_rpc_subscribe (tuya_rpc_t *rpc, char *id, char *name, rpc_subscribe_cb cb, void *arg) |
| subscribe one rpc 更多... | |
| int | tuya_rpc_undeclare (tuya_rpc_t *rpc, char *name) |
| undeclare one rpc according name 更多... | |
| int | tuya_rpc_unsubscribe (tuya_rpc_t *rpc, char *id, char *name) |
| unsubscribe one rpc 更多... | |
rcp relate
| typedef void(* rpc_async_cb) (jrpc_msg_t *result, void *arg) |
rpc async callback
| [in] | result | msg |
| [in] | arg | request argument |
| typedef void(* rpc_method_cb) (jrpc_msg_t *request, void *arg, jrpc_msg_t *reply) |
rpc method callback
| [in] | request | msg |
| [in] | arg | request argument |
| [in] | reply | reply |
| typedef void(* rpc_subscribe_cb) (jrpc_msg_t *request, void *arg) |
rpc subscribe callback
| [in] | request | msg |
| [in] | arg | request argument |
| int tuya_rpc_call_async | ( | tuya_rpc_t * | rpc, |
| char * | id, | ||
| jrpc_msg_t * | requset, | ||
| rpc_async_cb | cb, | ||
| void * | arg, | ||
| uint32_t | sec | ||
| ) |
rpc asynchronous call
| [in] | rpc | rpc handle |
| [in] | id | rpc id |
| [in] | requset | request message |
| [in] | cb | asynchronous call back |
| [in] | arg | call parameter |
| [in] | sec | timeout seconds |
| int tuya_rpc_call_notify | ( | tuya_rpc_t * | rpc, |
| char * | id, | ||
| jrpc_msg_t * | requset | ||
| ) |
rpc call notify
| [in] | rpc | rpc handle |
| [in] | id | rpc id |
| [in] | requset | request message |
| int tuya_rpc_call_sync | ( | tuya_rpc_t * | rpc, |
| char * | id, | ||
| jrpc_msg_t * | requset, | ||
| jrpc_msg_t * | reply, | ||
| uint32_t | sec | ||
| ) |
rpc synchronous call
| [in] | rpc | rpc handle |
| [in] | id | rpc id |
| [in] | requset | request message |
| [in] | reply | asynchronous reply message |
| [in] | sec | timeout seconds |
| int tuya_rpc_control | ( | tuya_rpc_t * | rpc, |
| uint8_t | cmd, | ||
| void * | arg | ||
| ) |
rpc control
| [in] | rpc | rpc handle |
| [in] | cmd | control command |
| [in] | arg | control parameter |
| int tuya_rpc_declare | ( | tuya_rpc_t * | rpc, |
| char * | name, | ||
| rpc_method_cb | cb, | ||
| void * | arg | ||
| ) |
declare one rpc according name
| [in] | rpc | rpc handle |
| [in] | name | declare name |
| [in] | cb | call back |
| [in] | arg | call back parameter |
| int tuya_rpc_init | ( | tuya_rpc_t * | rpc, |
| char * | id, | ||
| char * | addr | ||
| ) |
rpc function init
| [in] | rpc | rpc handle |
| [in] | id | rpc id |
| [in] | addr | remote ip address |
| int tuya_rpc_publish | ( | tuya_rpc_t * | rpc, |
| char * | name, | ||
| jrpc_msg_t * | msg | ||
| ) |
publish one rpc
| [in] | rpc | rpc handle |
| [in] | name | the key name want to publish |
| [in] | msg | msg |
| int tuya_rpc_run | ( | tuya_rpc_t * | rpc, |
| uint32_t | stack_size, | ||
| uint32_t | prio | ||
| ) |
create rpc task
| [in] | rpc | rpc handle |
| [in] | stack_size | task stack size |
| [in] | prio | task prio |
| int tuya_rpc_set_crypt | ( | tuya_rpc_t * | rpc, |
| rpc_crypt_cb | crypt_cb, | ||
| uint8_t | key[(LOCAL_KEY_LEN)] | ||
| ) |
set encryption key and callback
| [in] | rpc | rpc handle |
| [in] | crypt_cb | encryption callback function |
| [in] | key | encryption key |
| int tuya_rpc_set_crypt_cb | ( | tuya_rpc_t * | rpc, |
| rpc_crypt_cb | crypt_cb | ||
| ) |
set encryption callback
| [in] | rpc | rpc handle |
| [in] | crypt_cb | callback |
| int tuya_rpc_set_crypt_key | ( | tuya_rpc_t * | rpc, |
| uint8_t | key[(LOCAL_KEY_LEN)] | ||
| ) |
set encryption key
| [in] | rpc | rpc handle |
| [in] | key | encryption key |
| int tuya_rpc_subscribe | ( | tuya_rpc_t * | rpc, |
| char * | id, | ||
| char * | name, | ||
| rpc_subscribe_cb | cb, | ||
| void * | arg | ||
| ) |
subscribe one rpc
| [in] | rpc | rpc handle |
| [in] | id | rpc id |
| [in] | name | the key name want to subscribe |
| [in] | cb | callback |
| [in] | arg | callback paremater |
| int tuya_rpc_undeclare | ( | tuya_rpc_t * | rpc, |
| char * | name | ||
| ) |
undeclare one rpc according name
| [in] | rpc | rpc handle |
| [in] | name | undeclare name |
| int tuya_rpc_unsubscribe | ( | tuya_rpc_t * | rpc, |
| char * | id, | ||
| char * | name | ||
| ) |
unsubscribe one rpc
| [in] | rpc | rpc handle |
| [in] | id | rpc id |
| [in] | name | the key name want to subscribe |