11#ifndef __TUYA_SVC_LAN_H__
12#define __TUYA_SVC_LAN_H__
15#include "tuya_cloud_types.h"
23#define FRM_TP_CFG_WF 0x01
24#define FRM_TP_ACTV 0x02
25#define FRM_TP_BIND_DEV 0x03
26#define FRM_TP_UNBIND_DEV 0x06
27#define FRM_TP_CMD 0x07
28#define FRM_TP_STAT_REPORT 0x08
30#define FRM_QUERY_STAT 0x0a
31#define FRM_SSID_QUERY 0x0b
32#define FRM_USER_BIND_REQ 0x0c
33#define FRM_TP_NEW_CMD 0x0d
34#define FRM_ADD_SUB_DEV_CMD 0x0e
35#define FRM_CFG_WIFI_INFO 0x0f
36#define FRM_QUERY_STAT_NEW 0x10
37#define FRM_SCENE_EXEC 0x11
38#define FRM_LAN_QUERY_DP 0x12
40#define FRM_SECURITY_TYPE3 0x03
41#define FRM_SECURITY_TYPE4 0x04
42#define FRM_SECURITY_TYPE5 0x05
44#define FR_TYPE_AP_ENCRYPTION 0x11
45#define FR_TYPE_ENCRYPTION 0x13
46#define FR_TYPE_BOARDCAST_LPV34 0x23
47#define FRM_AP_CFG_WF_V40 0x14
49#define FRM_AP_CFG_GET_DEV_INFO (0x16)
50#define FRM_AP_CFG_SET_DEV_SCHEMA (0x17)
51#define FRM_AP_CFG_SET_TIME (0x18)
52#define FRM_AP_CFG_SET_ACTIVE_INFO (0x19)
53#define FRM_LAN_OTA_START (0x1A)
54#define FRM_LAN_OTA_DATA (0x1B)
55#define FRM_LAN_OTA_FINISH (0x1C)
56#define FRM_LAN_RESET (0x1D)
58#define FRM_TYPE_REG_CENTER 0x24
59#define FRM_TYPE_APP_UDP_BOARDCAST 0x25
61#define WIFI_ERR_APP_TO_DEV 0x15
62#define FRM_LAN_EXT_STREAM 0x40
63#define FRM_LAN_EXT_BEFORE_ACTIVATE 0x42
101#define LPV35_FRAME_HEAD_SIZE 4
102#define LPV35_FRAME_VERSION_SIZE 1
103#define LPV35_FRAME_RESERVE_SIZE 1
104#define LPV35_FRAME_SEQUENCE_SIZE 4
105#define LPV35_FRAME_TYPE_SIZE 4
106#define LPV35_FRAME_DATALEN_SIZE 4
107#define LPV35_FRAME_NONCE_SIZE 12
108#define LPV35_FRAME_TAG_SIZE 16
109#define LPV35_FRAME_TAIL_SIZE 4
111#define LPV35_FRAME_MINI_SIZE (LPV35_FRAME_HEAD_SIZE + LPV35_FRAME_VERSION_SIZE + LPV35_FRAME_RESERVE_SIZE + \
112 LPV35_FRAME_SEQUENCE_SIZE + LPV35_FRAME_TYPE_SIZE + LPV35_FRAME_DATALEN_SIZE + LPV35_FRAME_NONCE_SIZE + \
113 LPV35_FRAME_TAG_SIZE + LPV35_FRAME_TAIL_SIZE)
143 CFG_UDP_DISCOVERY_FORCE,
147 CFG_UDP_DISCOVERY_INTERVAL,
149 CFG_SET_LAN_CLOSED_CB,
151 CFG_HEART_BEAT_TIMEOUT,
153 CFG_SEQ_ERR_THRESHOLD,
207 IN CONST BYTE_T *data, IN CONST UINT_T len);
273 IN CONST BYTE_T *key, OUT CHAR_T **out_data);
347OPERATE_RET tuya_svc_lan_data_com_send(IN CONST INT_T socket, IN CONST UINT_T fr_num, IN CONST UINT_T fr_type,
348 IN CONST UINT_T ret_code, IN CONST BYTE_T *data, IN CONST UINT_T len);
355#define is_lan_connected() (tuya_svc_lan_get_valid_connections() != 0)
Definition: tuya_svc_lan.h:338
LAN protocol frame head format (from app)
Definition: tuya_svc_lan.h:70
LAN protocol frame head format (from device)
Definition: tuya_svc_lan.h:91
LAN protocol frame tail format (from device)
Definition: tuya_svc_lan.h:83
Definition: tuya_svc_lan.h:115
Definition: tuya_svc_lan.h:132
Definition: tuya_svc_lan.h:126
Definition: ty_cJSON.h:104
OPERATE_RET tuya_svc_lan_ext_proto_data_report(IN CONST VOID *data, IN CONST UINT_T len)
extend lan protocol data report
OPERATE_RET tuya_svc_lan_init(VOID)
Init and start LAN service
OPERATE_RET tuya_svc_lan_ext_proto_reg(CONST CHAR_T *ext_lan_pro, lan_ext_protocol_handler_cb handler)
Register extend lan protocol
UINT_T tuya_svc_lan_get_client_num(VOID)
get lan client number
OPERATE_RET tuya_svc_lan_data_report(IN CONST UINT_T fr_type, IN CONST UINT_T ret_code, IN CONST BYTE_T *data, IN CONST UINT_T len)
distribute data to all connections
OPERATE_RET tuya_svc_lan_decrypt_data(IN BYTE_T *data, IN CONST INT_T len, IN CONST BYTE_T *key, OUT CHAR_T **out_data)
Decrypt LAN data
OPERATE_RET tuya_svc_lan_cfg(IN CONST Lan_Cfg_e cfg, IN CONST VOID *data)
lan configure
OPERATE_RET tuya_svc_lan_dp_report(IN VOID *data, IN CONST UINT_T len)
LAN dp report
OPERATE_RET tuya_svc_lan_disable(VOID)
Disable LAN service
BOOL_T tuya_svc_lan_canbe_closed(VOID)
check lan can be closed
INT_T tuya_svc_lan_get_valid_connections(VOID)
get count of vaild connections
OPERATE_RET tuya_svc_lan_ext_proto_uninit(VOID)
uninit extend lan protocol
OPERATE_RET tuya_svc_lan_exit(VOID)
Stop and uninit LAN service
OPERATE_RET tuya_svc_lan_ext_proto_unreg(CONST CHAR_T *ext_lan_pro)
Unregister extend lan protocol
OPERATE_RET(* lan_ext_protocol_handler_cb)(IN ty_cJSON *root_json)
Callback to handle lan protocol data
Definition: tuya_svc_lan.h:289
OPERATE_RET tuya_svc_lan_enable(VOID)
Enable LAN service
OPERATE_RET tuya_svc_lan_disconnect_all(VOID)
disconnect all connections
OPERATE_RET(* lan_cmd_handler_cb)(IN CONST BYTE_T *data, OUT BYTE_T **out)
lan cmd extersion
Definition: tuya_svc_lan.h:241
Lan_Cfg_e
Definition of LAN configuration
Definition: tuya_svc_lan.h:142
OPERATE_RET tuya_svc_lan_unregister_cb(IN UINT_T frame_type)
unregister callback
BOOL_T(* lan_canbe_closed)(VOID)
check lan canbe closed
Definition: tuya_svc_lan.h:329
OPERATE_RET tuya_svc_lan_register_cb(IN UINT_T frame_type, IN lan_cmd_handler_cb handler)
register callback