+ All Categories
Home > Documents > dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD....

dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD....

Date post: 11-Mar-2020
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
120
Tuya IPC SDK Description Update Time SDK Version 2019-04-26 4.3.2
Transcript
Page 1: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Tuya IPC SDK DescriptionUpdate Time SDK Version2019-04-26 4.3.2

Page 2: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Contents

1 Macro Definitions..........................................................................................................................61.1.1 Macro Definitions for Device Information................................................................61.1.2 Error Code Macro Definitions..................................................................................61.1.3 Constant Macro Definitions...................................................................................101.1.4 Macro Definitions of the Group and Scenario Error Code.....................................101.1.5 DP Message Macro Definitions..............................................................................111.1.6 Other Macro Definitions........................................................................................15

2 Enum Definitions..........................................................................................................................162.1.1 Types of Uploaded Notification Content................................................................162.1.2 IPC Registration States...........................................................................................162.1.3 Gateway States.......................................................................................................172.1.4 Input Types of Direct Network Access...................................................................172.2.1 Video Code Rate.....................................................................................................172.2.2 Audio and Video Coding Protocols.........................................................................182.2.3 Audio Sampling Rate..............................................................................................192.2.4 Audio Bits...............................................................................................................202.2.5 Audio Channels......................................................................................................202.2.6 Cloud Storage Order Types.....................................................................................202.2.7 Event Types............................................................................................................212.2.8 Event States............................................................................................................212.3.1 Writing Files to an SD Card.....................................................................................212.3.2 Deleting Files..........................................................................................................222.3.3 Storage States........................................................................................................222.3.4 Event Playback.......................................................................................................232.3.5 Frame Types...........................................................................................................232.3.6 Playback States.......................................................................................................242.4.1 Reset Types............................................................................................................242.5.1 Maximum Number of Video and Audio Stream Channels.....................................242.5.2 User Index..............................................................................................................25

3 Structure Definitions....................................................................................................................263.1.1 IPC Environment Variables.....................................................................................263.1.2 TY_INIT_PARAMS_S...............................................................................................273.1.3 GW_ATTACH_ATTR_T.............................................................................................273.1.4 DEV_DESC_IF_S......................................................................................................273.1.5 DP_PROP_VAL_S....................................................................................................283.1.6 DP_PROP_ENUM_S................................................................................................283.1.7 DP_PROP_STR_S....................................................................................................293.1.8 DP_BOOL_S............................................................................................................293.1.9 DP_PROP_BITMAP.................................................................................................293.1.10 TY_RECV_OBJ_DP_S.............................................................................................30

Page 3: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

3.1.11 TY_OBJ_DP_S.......................................................................................................303.1.12 TY_DP_QUERY_S..................................................................................................313.1.13 FW_UG_S.............................................................................................................313.2.1 IPC_MEDIA_INFO_S...............................................................................................313.2.2 AES_HW_CBC_FUNC..............................................................................................323.3.1 SS_QUERY_DAY_TS_ARR_S....................................................................................333.3.2 SS_FILE_TIME_TS_S...............................................................................................333.4.1 Ring_Buffer_Node_S..............................................................................................343.4.2 S_PRESET_PTZ........................................................................................................353.4.3 S_PRESET_POSITION..............................................................................................35

3.5 Joint Type Definition.........................................................................................................363.5.1 TY_OBJ_DP_VALUE_U............................................................................................36

4 Interface Definitions....................................................................................................................364.1 General Interface Definitions............................................................................................36

4.1.1 tuya_ipc_get_sdk_info...........................................................................................364.1.2 tuya_ipc_init_sdk...................................................................................................374.1.3 tuya_ipc_start_sdk.................................................................................................384.1.4 tuya_ipc_upgrade_sdk...........................................................................................384.1.5 tuya_ipc_get_register_status.................................................................................404.1.6 DEV_OBJ_DP_CMD_CB..........................................................................................404.1.7 DEV_DP_QUERY_CB...............................................................................................414.1.8 GW_STATUS_CHANGED_CB...................................................................................424.1.9 GW_UG_INFORM_CB.............................................................................................424.1.10 TUYA_RST_INFORM_CB.......................................................................................434.1.11 TUYA_RESTART_INFORM_CB...............................................................................444.1.12 GET_FILE_DATA_CB..............................................................................................444.1.13 UPGRADE_NOTIFY_CB.........................................................................................45

4.2 Time Interface Definitions.................................................................................................464.2.1 tuya_ipc_get_service_time....................................................................................464.2.2 tuya_ipc_check_in_dls...........................................................................................474.2.3 tuya_ipc_get_local_time........................................................................................484.2.4 tuya_ipc_get_utc_tm.............................................................................................494.2.5 tuya_ipc_get_utc_time..........................................................................................50

4.3 Message Interface Definitions..........................................................................................514.3.1 tuya_ipc_dp_report...............................................................................................514.3.2 tuya_ipc_dp_report_sync......................................................................................524.3.3 tuya_ipc_notification_content_upload_from_buffer............................................534.3.4 tuya_ipc_notification_content_upload_from_file.................................................544.3.5 tuya_ipc_notification_message_upload................................................................554.3.6 tuya_ipc_snapshot_message_upload....................................................................564.3.7 tuya_ipc_report_living_msg..................................................................................56

4.4 Device Management Interface Definitions.......................................................................574.4.1 tuya_ipc_get_wakeup_data...................................................................................574.4.2 tuya_ipc_get_heartbeat_data................................................................................58

Page 4: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.4.3 tuya_ipc_direct_connect.......................................................................................594.4.4 tuya_ipc_set_net_info_nofify_cb..........................................................................604.4.5 tuya_ipc_get_mqtt_status.....................................................................................614.4.6 tuya_ipc_book_wakeup_topic...............................................................................624.4.7 tuya_ipc_get_mqtt_socket_fd...............................................................................634.4.8 tuya_ipc_set_log_attr............................................................................................634.4.9 tuya_ipc_get_free_ram..........................................................................................65

4.5 Cloud Storage Interface Definitions..................................................................................654.5.1 tuya_ipc_cloud_storage_init..................................................................................654.5.2 tuya_ipc_cloud_storage_uninit..............................................................................664.5.3 tuya_ipc_cloud_storage_get_store_mode............................................................674.5.4 tuya_ipc_cloud_storage_event_start....................................................................684.5.5 tuya_ipc_cloud_storage_event_stop.....................................................................694.5.6 tuya_ipc_cloud_storage_get_event_status...........................................................704.5.7 tuya_ipc_cloud_storage_pause.............................................................................704.5.8 tuya_ipc_cloud_storage_resume...........................................................................714.5.9 tuya_ipc_cloud_storage_event_add......................................................................724.5.10 tuya_ipc_cloud_storage_event_delete................................................................73

4.6 SD Card Storage Interface Definitions...............................................................................744.6.1 tuya_ipc_ss_init.....................................................................................................744.6.2 tuya_ipc_ss_uninit.................................................................................................754.6.3 tuya_ipc_ss_set_write_mode................................................................................754.6.4 tuya_ipc_ss_get_write_mode................................................................................764.6.5 tuya_ipc_ss_trigger_event.....................................................................................774.6.6 tuya_ipc_ss_start_event........................................................................................784.6.7 tuya_ipc_ss_stop_event.........................................................................................784.6.8 tuya_ipc_ss_delete_oldest_event.........................................................................794.6.9 tuya_ipc_ss_delete_all_files..................................................................................804.6.10 tuya_ipc_ss_get_status........................................................................................804.6.11 tuya_ipc_pb_query_by_month............................................................................814.6.12 tuya_ipc_pb_query_by_day.................................................................................824.6.13 tuya_ipc_pb_query_free_ts_arr..........................................................................834.6.14 SS_PB_EVENT_CB.................................................................................................844.6.15 SS_PB_GET_MEDIA_CB........................................................................................844.6.16 tuya_ipc_ss_pb_start...........................................................................................854.6.17 tuya_ipc_ss_pb_set_status..................................................................................864.6.18 tuya_ipc_ss_pb_stop...........................................................................................874.6.19 tuya_ipc_ss_pb_seek...........................................................................................884.6.20 tuya_ipc_ss_pb_stop_all......................................................................................88

4.7 Audio and Video Interface Definitions..............................................................................894.7.1 tuya_ipc_ring_buffer_init......................................................................................894.7.2 tuya_ipc_ring_buffer_append_data......................................................................914.7.3 tuya_ipc_ring_buffer_append_extra_data............................................................924.7.4 tuya_ipc_ring_buffer_get_video_frame................................................................93

Page 5: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.7.5 tuya_ipc_ring_buffer_get_audio_frame................................................................954.7.6 tuya_ipc_ring_buffer_find_pre_video_by_frame..................................................964.7.7 tuya_ipc_ring_buffer_find_pre_audio_by_frame..................................................964.7.8 tuya_ipc_ring_buffer_get_pre_video_frame.........................................................974.7.9 tuya_ipc_ring_buffer_get_pre_audio_frame.........................................................984.7.10 tuya_ipc_ring_buffer_anchor_user_to_node......................................................994.7.11 tuya_ipc_ring_buffer_get_next_target_frame..................................................1004.7.12 tuya_ipc_ring_buffer_clean_user_state............................................................1014.7.13 FUNC_REQUEST_I_FRAME.................................................................................102

4.8 PTZ Functions..........................................................................................................................1034.8.1 tuya_ipc_preset_add...........................................................................................1034.8.2 tuya_ipc_preset_add_pic.....................................................................................1044.8.3 tuya_ipc_preset_del............................................................................................1054.8.4 tuya_ipc_preset_get............................................................................................106

Page 6: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

1 Macro Definitions

1.1.1 Macro Definitions for Device Information

Name Value DescriptionIPC_STORAGE_PATH_LEN 64 Storage path lengthIPC_PRODUCT_KEY_LEN 16 Product key lengthIPC_UUID_LEN 25 UUID lengthIPC_AUTH_KEY_LEN 32 Length of the authkey that a specific

Tuya SDK usesIPC_SW_VER_LEN 10 Length of the device firmware version

numberIPC_SERIAL_NUM_LEN 32 Length of a device's unique hardware

identifierIPC_FACTORY_ID_LEN 4 Vendor ID lengthIPC_P2P_ID_LEN 25 P2P ID lengthNOTIFICATION_MOTION_DETECTION 115 Intermittent motion detection DPNOTIFICATION_CONTENT_SIZE_MAX 150*102

4Maximum resolution of reported content

1.1.2 Error Code Macro Definitions

Name Value DescriptionOPRT_OK (0) SuccessOPRT_COM_ERROR (-1) Common errorOPRT_INVALID_PARM (-2) Invalid parameterOPRT_MALLOC_FAILED (-3) Memory allocation failureOPRT_NOT_SUPPORTED (-4) Unsupported functionOPRT_NETWORK_ERROR (-5) Network exception

OPRT_INIT_MUTEX_ATTR_FAILED (-101) Failed to initialize mutex attributesOPRT_SET_MUTEX_ATTR_FAILED (-102) Failed to set mutex attributesOPRT_DESTROY_MUTEX_ATTR_FAILED (-103) Failed to cancel mutex attributesOPRT_INIT_MUTEX_FAILED (-104) Mutex initialization failureOPRT_MUTEX_LOCK_FAILED (-105) Mutex lock failureOPRT_MUTEX_TRYLOCK_FAILED (-106) Trylock failureOPRT_MUTEX_LOCK_BUSY (-107) Busy mutexOPRT_MUTEX_UNLOCK_FAILED (-108) Mutex unlock failure

Page 7: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Name Value DescriptionOPRT_MUTEX_RELEASE_FAILED (-109) Mutex release failureOPRT_CR_MUTEX_ERR (-110)OPRT_MEM_PARTITION_EMPTY (-111) Empty memoryOPRT_MEM_PARTITION_FULL (-112) Full memoryOPRT_MEM_PARTITION_NOT_FOUND (-113) No storage area foundOPRT_DONOT_FOUND_MODULE (-114) No module found

OPRT_INIT_SEM_FAILED (-201)OPRT_WAIT_SEM_FAILED (-202)OPRT_POST_SEM_FAILED (-203)

OPRT_THRD_STA_UNVALID (-301)OPRT_THRD_CR_FAILED (-302)OPRT_THRD_JOIN_FAILED (-303)OPRT_THRD_SELF_CAN_NOT_JOIN (-304)

OPRT_TIMERID_EXIST (-401)OPRT_TIMERID_NOT_FOUND (-402)OPRT_TIMERID_UNVALID (-403)OPRT_GET_IDLE_TIMERID_ERROR (-404)

OPRT_MSG_NOT_FOUND (-501)OPRT_MSG_LIST_EMPTY (-502)

OPRT_WIFI_SCAN_FAIL (-601)OPRT_WF_MAC_SET_FAIL (-602)OPRT_WF_CONN_FAIL (-603)OPRT_WF_NW_CFG_FAIL (-604)OPRT_WF_AP_SACN_FAIL (-605)OPRT_WF_NOT_FIND_ASS_AP (-606)

OPRT_SOCK_ERR (-701)OPRT_SET_SOCK_ERR (-702)OPRT_SOCK_CONN_ERR (-703)OPRT_BUF_NOT_ENOUGH (-704)OPRT_URL_PARAM_OUT_LIMIT (-705)OPRT_HTTP_OS_ERROR (-706)OPRT_HTTP_PR_REQ_ERROR (-707)OPRT_HTTP_SD_REQ_ERROR (-708)OPRT_HTTP_RD_ERROR (-709)OPRT_HTTP_AD_HD_ERROR (-710)

Page 8: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Name Value DescriptionOPRT_HTTP_GET_RESP_ERROR (-711)OPRT_HTTP_AES_INIT_ERR (-712)OPRT_HTTP_AES_OPEN_ERR (-713)OPRT_HTTP_AES_SET_KEY_ERR (-714)OPRT_HTTP_AES_ENCRYPT_ERR (-715)OPRT_CR_HTTP_URL_H_ERR (-716)OPRT_HTTPS_HANDLE_FAIL (-717)OPRT_HTTPS_RESP_UNVALID (-718)OPRT_HTTPS_NO_SUPPORT_RANGE (-719)

OPRT_CR_CJSON_ERR (-801)OPRT_CJSON_PARSE_ERR (-802)OPRT_CJSON_GET_ERR (-803)

OPRT_NOT_FOUND (-901)OPRT_DP_ATTR_ILLEGAL (-902)OPRT_DP_TYPE_PROP_ILLEGAL (-903)OPRT_DP_REPORT_CLOUD_ERR (-904)OPRT_NO_NEED_SET_PRODINFO (-905)OPRT_NW_INVALID (-906)OPRT_SELECT_ERR (-907)OPRT_SELECT_TM (-908)OPRT_SEND_ERR (-909)OPRT_DEV_NOT_BIND (-910)OPRT_FW_UG_FAILED (-911)OPRT_VER_FMT_ERR (-912)OPRT_FW_NOT_EXIST (-913)OPRT_SEM_CR_ERR (-914)OPRT_SELECT_TIMEOUT (-915)OPRT_GW_MQ_OFFLILNE (-916)OPRT_NOT_SPT_CLX_DP (-917)OPRT_RECV_ERR (-918)OPRT_UG_PKG_NOT_ENOUGH (-919)OPRT_SCMA_INVALID (-920)OPRT_PRODECT_KEY_NULL (-921)OPRT_DEVICE_VER_NULL (-922)OPRT_MSG_OUT_OF_LMT (-923)OPRT_NOT_FOUND_AUTH_SSID (-924)OPRT_SOCKET_FAULT (-925)OPRT_MQ_PUBLISH_TIMEOUT (-926)OPRT_GW_NOT_EXIST (-927)

Page 9: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Name Value DescriptionOPRT_GW_SCHEMA_SIZE_LMT_OUT (-928)OPRT_DEV_DP_CNT_INVALID (-929)OPRT_TOKEN_OVERTIME (-930)OPRT_WF_NW_CFG_RECV_CONTINUE (-931)OPRT_RECV_DA_NOT_ENOUGH (-932)OPRT_SERV_VRFY_FAIL (-933)OPRT_KVS_WR_FAIL (-934)OPRT_KVS_RD_FAIL (-935)OPRT_NO_AUTHENTICATION (-936)OPRT_CMD_OUT_OF_TIME_NOT_EXEC (-937)OPRT_CMD_NOT_EXEC (-938)OPRT_CRC32_FAILED (-939)OPRT_LAN_NO_CLIENT (-940)OPRT_WF_INTF_LACK_REG_CB (-941)OPRT_WF_INTF_NO_REG_CB (-942)OPRT_STORAGE_UPLOAD (-943)OPRT_DP_ID_NOT_FOUND (-944) Invalid DPOPRT_DP_TP_NOT_MATCH (-945)OPRT_DEV_NEED_REGISTER (-946)OPRT_DEV_RESET_FACTORY (-947) Factory defaults restorationOPRT_API_VERSION_WRONG (-948)

OPRT_OPEN_FILE_FAILED (-1001)OPRT_PRINT_LOG_LEVEL_HIGHER (-1002)OPRT_FORMAT_STRING_FAILED (-1003)OPRT_STRING_TOO_LONG (-1004)OPRT_WR_FLASH_ERROR (-1005)

OPRT_ROUTER_NOT_FIND (-1006)OPRT_EXCEED_UPPER_LIMIT (-1007)OPRT_SECURITY_VERIFY_NOT_OK (-1008)

OPRT_OSS_OPERATION_INIT_FAILED (-1100)OPRT_OSS_OPERATION_UPDATE_FAILED (-1101)OPRT_OSS_OPERATION_UPLOAD_FAILED (-1102)OPRT_MOTION_DETECTION_ALARM_PACK_REPORT_FAILED (-1103)OPRT_TRANSFER_INIT_FAILED (-1104)

OPRT_EVENT_STATUS_INVALID (-2000) Invalid event statusOPRT_ENCRYPT_KEY_UPDATED (-2001)

Page 10: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Name Value DescriptionOPRT_ORDER_EXPIRE (-2002)OPRT_NO_MORE_DATA (-2003)OPRT_CLOUD_STORAGE_OFF (-2004)OPRT_CLOUD_STORAGE_STATUS_INVALID (-2005)OPRT_REMOTE_API_RUN_UNKNOW_FAILED (-2006) Abnormal server interfaceOPRT_DEVICE_REMOVED (-2007)

1.1.3 Constant Macro Definitions

Name Value DescriptionENCRYPT_KEY_LEN 16 Maximum storage encryption key lengthGW_UUID_LEN 25 Maximum UUID lengthAUTH_KEY_LEN 32 Maximum authkey lengthPRODUCT_KEY_LEN 16 Maximum product key lengthSW_VER_LEN 10 Maximum version string length

GW_ID_LEN 25 Maximum gateway ID lengthDEV_ID_LEN 25 Maximum device ID lengthSCHEMA_ID_LEN 16BIND_TOKEN_LEN 16 Maximum bound token lengthTOKEN_LEN 8 Maximum token lengthREGION_LEN 2 Region lengthREGIST_KEY_LEN 4 Registration key lengthHTTP_URL_LMT 128 Maximum URL lengthMQ_URL_LMT 128 Maximum MQTT URL lengthTIME_ZONE_LEN 10 Maximum time zone lengthSUMMER_TM_ZONE_LEN 256 Maximum length of the daylight saving time string

SEC_KEY_LEN 16 Maximum security key string lengthLOCAL_KEY_LEN 16 Maximum the local key string length

WXAPPID_LEN 32 WX app ID lengthWXUUID_LEN 32 WX UUID length

GRP_ID_LEN 5 GRP ID lengthSCENE_ID_LEN 3 Maximum scenario ID lengthLC_GW_SLEEP_HB_LMT_S 12*3600 Maximum gateway sleep duration

Page 11: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

1.1.4 Macro Definitions of the Group and Scenario Error Code

Name Value DescriptionM_SCE_SUCCESS 0 SuccessM_SCE_ERR_EXCEED 1 Insufficient spaceM_SCE_ERR_TIMEOUT 2 Communication timeoutM_SCE_ERR_PARAM 3 Parameter out of rangeM_SCE_WRITE_FILE 4 Database file writing errorM_SCE_ERR_OTHER 5 Other errors

1.1.5 DP Message Macro Definitions

Name Value DescriptionBasic Function Settings App Page

#define TUYA_DP_SLEEP_MODE 105

Sleep mode, Boolean. The value can be:true: sleepfalse: not sleep

#define TUYA_DP_LIGHT 101

Status indicator, Boolean. The value can be:true: onfalse: off

#define TUYA_DP_FLIP 103

Recording screen flip, Boolean. The value can be:true: flipfalse: normal

#define TUYA_DP_WATERMARK 104

Video watermark, Boolean. The value can be:true: enablefalse: disable

#define TUYA_DP_WDR 107

Wide dynamic range mode, Boolean. The value can be:true: enablefalse: disable

#define TUYA_DP_NIGHT_MODE 108

Infrared (IR) night vision function, enum. The value can be:0: auto mode1: disable2: enable

#define TUYA_DP_CALIBRATION 132 Camera calibration, Boolean.Motion Detection Alarm App Page

#define TUYA_DP_ALARM_FUNCTION 134

Motion detection alarm function, Boolean. The value can be:true: onfalse: off

Page 12: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

#define TUYA_DP_ALARM_SENSITIVITY 106

Motion detection alarm sensitivity, enum. The value can be:0: low sensitivity1: medium sensitivity2: high sensitivity

SD Card Settings App Page

#define TUYA_DP_SD_STATUS_ONLY_GET 110

SD card status, value type. The value can be:1: normal2: abnormal3: insufficient space4: formatting5: no SD card

#define TUYA_DP_SD_STORAGE_ONLY_GET 109

SD card capacity, string. The value contains the total capacity, current usage, and remaining capacity, in kilobytes (KB).

#define TUYA_DP_SD_RECORD_ENABLE 150

SD card recording function, Boolean. The value can be:true: enablefalse: disable

#define TUYA_DP_SD_RECORD_MODE 151

SD card recording mode selection, enum. The value can be:0: event recording1: continuous recording

#define TUYA_DP_SD_UMOUNT 112

SD card unmounting, Boolean. The value can be:true: unmountedfalse: mounted

#define TUYA_DP_SD_FORMAT 111 SD card formatting, Boolean.

#define TUYA_DP_SD_FORMAT_STATUS_ONLY_ GET 117

SD card formatting status, value type. The value can be:–2000: formatting–2001: formatting exceptions–2002: no SD card–2003: SD card error.Positive value: formatting progress

Camera Control App Page#define TUYA_DP_PTZ_CONTROL 119 PTZ rotation direction, enum. The value can

be:0: up1: up right2: right3: down right4: down

Page 13: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

5: down left6: left7: up leftPTZ rotation direction (from SDK 4.0), enum. The value can be:0: up right1: right2: down right3: down4: down left5: left6: up left7: up

#define TUYA_DP_PTZ_STOP 116 PTZ rotation stop, Boolean.

#define TUYA_DP_PTZ_CHECK 132

PTZ self-check. The value can be:0: disable1: enableThe default value is 0.

#define TUYA_DP_TRACK_ENABLE 161

Movement tracking, Boolean. The value can be:true: enablefalse: disable

#define TUYA_DP_HUM_FILTER 170

Human filtering, Boolean. The value can be:true: enablefalse: disableThe default value is false.

#define TUYA_DP_PATROL_SWITCH 174

Patrol switch. The value can be:0: disable1: enable

#define TUYA_DP_PATROL_MODE 175

Patrol type mode. The value can be:0: panoramic patrol1: preset patrol

#define TUYA_DP_PATROL_TMODE 176

Patrol time mode. The value can be:0: all-day patrol1: timed patrol

#define TUYA_DP_PATROL_TIME 177 Patrol time.

#define TUYA_DP_PRESET_SET 178

Preset operation, string. The value type:1 indicates adding, and type: 2 indicates deleting. Different data types have different strings.

#define TUYA_DP_PATROL_STATE 179 Patrol status query command. The returned value can be:0: panoramic patrol

Page 14: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

1: preset patrol2: non-patrol mode

Motion Detection Zone Function

#define TUYA_DP_ALARM_ZONE_ENABLE 168

Detection zone, Boolean. The value can be:true: enablefalse: disable

#define TUYA_DP_ALARM_ZONE_DRAW 169

Detection zone setting, string, for example, {"num":1, "region0":{"x":30,"y":40,"xlen":50,"ylen":60}}

#define TUYA_DP_DOOR_BELL 136Doorbell call, string, for example, "current timestamp"

#define TUYA_DP_BLUB_SWITCH 138

Special light control, Boolean. The value can be:true: enablefalse: disable

#define TUYA_DP_SOUND_DETECT 139

Decibel detection, Boolean. The value can be:true: enablefalse: disable

#define TUYA_DP_SOUND_SENSITIVITY 140

Decibel detection sensitivity, enum. The value can be:0: low sensitivity1: high sensitivity

#define TUYA_DP_SOUND_ALARM 141Decibel alarm channel, string, for example, "current timestamp"

#define TUYA_DP_TEMPERATURE 142Temperature detection, value type. The value range is from 0 to 50.

#define TUYA_DP_HUMIDITY 143Humidity detection, value type. The value range is from 0 to 100.

#define TUYA_DP_ELECTRICITY 145Battery percentage, value type. The value range is from 0 to 100.

#define TUYA_DP_POWERMODE 146

Power supply mode, enum. The value can be:0: battery power supply1: mains power supply or battery charging

#define TUYA_DP_LOWELECTRIC 147Percentage-based low battery alarm threshold, value type

#define TUYA_DP_DOOR_STATUS 149

Doorbell status notification, Boolean. The value can be:true: enablefalse: disable

#define TUYA_DP_MOTION_DETECTION_ALARM 115 Motion detection message alarm

Page 15: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

#define TUYA_DP_DOOR_BELL_SNAP 154 Doorbell push screenshot tips

1.1.6 Other Macro Definitions

Name Value Description

GW_VIRTUAL 0x00

Product that only supports device functions and not sub-device functions, for example, the SoC or MCU

GW_ENTITY_ATTH_DEV 0x01Product that has both sub-device and device functions

GW_ENTITY 0x02 Product that only has sub-device functions

GNS_UNVALID 0 Device disconnected from LAN and WAN

GNS_LAN_VALID 1Device connected to LAN but disconnected from WAN

GNS_WAN_VALID 2 Device connected to LAN and WAN

EXT_UNAUTH 0EXT_PROD_TEST 1EXT_NORMAL_S 2EXT_GW_UPGRD 3EXT_DEV_UPGRD 4

DEV_NM_ATH_SNGL 0NetLink module with a single device (devid == gwid)

DEV_NM_NOT_ATH_SNGL 1NetLink module without a single device (devid == gwid)

DEV_ZB_SNGL 2 ZigBee deviceDEV_RF433_SNGL 3 RF433 deviceDEV_BLE_SNGL 4 Bluetooth Low Energy (BLE) device

GP_DEV_ZB DEV_ZB_SNGL ZigBee deviceGP_DEV_RF433 DEV_RF433_SNGL RF433 deviceGP_DEV_BLE DEV_BLE_SNGL BLE device

GW_ATTACH_ATTR_LMT 4

T_OBJ 0 dp is value,str,enum,bool,bitmapT_RAW 1 raw typeT_FILE 2 file type

Page 16: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Name Value Description

M_RW 0Readable and writable DP on the cloud or in the app

M_WR 1 Write-only DP on the cloud or in the appM_RO 2 Read-only DP on the cloud or in the app

PROP_BOOL 0 BooleanPROP_VALUE 1 ValuePROP_STR 2 StringPROP_ENUM 3 EnumPROP_BITMAP 4 Bitmap

2 Enum Definitions

2.1.1 Types of Uploaded Notification Contenttypedef enum{ NOTIFICATION_CONTENT_MP4 = 0, NOTIFICATION_CONTENT_JPEG, NOTIFICATION_CONTENT_PNG, NOTIFICATION_CONTENT_MAX,} NOTIFICATION_CONTENT_TYPE_E;

Enum Name Enum Value DescriptionNOTIFICATION_CONTENT_MP4 0 Video, MP4 fileNOTIFICATION_CONTENT_JPEG 1 Image, JPEG fileNOTIFICATION_CONTENT_PNG 2 Image, PNG fileNOTIFICATION_CONTENT_MAX 3 Maximum number of enum values

(excluding 3)

2.1.2 IPC Registration States

Page 17: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

typedef enum { E_IPC_UNREGISTERED = 0,

E_IPC_REGISTERED = 1, E_IPC_ACTIVEATED = 2

}IPC_REGISTER_STATUS;Enum Name Enum Value DescriptionE_IPC_UNREGISTERED 0 Unregistered and unactivatedE_IPC_REGISTERED 1 Intermediate stateE_IPC_ACTIVEATED 2 Activated and bound state, which prevails

2.1.3 Gateway Statestypedef enum{

IPC_GW_UNREGISTERED = 0, IPC_GW_REGISTERED,IPC_GW_ACTIVED, IPC_GW_MQTT_ONLINE, IPC_GW_MQTT_OFFLINE,

}IPC_GW_STATUS_E;

Enum Name Enum Value DescriptionIPC_GW_UNREGISTERED 0 UnregisteredIPC_GW_REGISTERED 1 UnactivatedIPC_GW_ACTIVED 2 ActivatedIPC_GW_MQTT_ONLINE 3 Connected to the MQTTIPC_GW_MQTT_OFFLINE 4 Disconnected from the MQTT

2.1.4 Input Types of Direct Network Accesstypedef enum{

TUYA_IPC_DIRECT_CONNECT_QRCODE = 0, TUYA_IPC_DIRECT_CONNECT_MAX,

} TUYA_IPC_DIRECT_CONNECT_TYPE_E;

Enum Name Enum Value DescriptionTUYA_IPC_DIRECT_CONNECT_QRCODE

0 QR code net-pairing

TUYA_IPC_DIRECT_CONNECT_MAX 1

Page 18: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

2.2.1 Video Code Ratetypedef enum{ TUYA_VIDEO_BITRATE_64K = 64, TUYA_VIDEO_BITRATE_128K = 128, TUYA_VIDEO_BITRATE_256K = 256, TUYA_VIDEO_BITRATE_512K = 512, TUYA_VIDEO_BITRATE_768K = 768, TUYA_VIDEO_BITRATE_1M = 1024, TUYA_VIDEO_BITRATE_1_5M = 1536}TUYA_VIDEO_BITRATE_E;

Enum Name Enum Value DescriptionTUYA_VIDEO_BITRATE_64K 64 The code rate is 64 kbits/s.TUYA_VIDEO_BITRATE_128K 128, The code rate is 128 kbits/s.TUYA_VIDEO_BITRATE_256K 256, The code rate is 256 kbits/s.TUYA_VIDEO_BITRATE_512K 512, The code rate is 512 kbits/s.TUYA_VIDEO_BITRATE_768K 768, The code rate is 768 kbits/s.TUYA_VIDEO_BITRATE_1M 1024, The code rate is 1024 kbits/s.TUYA_VIDEO_BITRATE_1_5M 1536 The code rate is 1536 kbits/s.

2.2.2 Audio and Video Coding Protocolstypedef enum{ TUYA_CODEC_VIDEO_MPEG4 = 0, TUYA_CODEC_VIDEO_H263, TUYA_CODEC_VIDEO_H264, TUYA_CODEC_VIDEO_MJPEG, TUYA_CODEC_VIDEO_H265, TUYA_CODEC_VIDEO_MAX = 99, TUYA_CODEC_AUDIO_ADPCM, TUYA_CODEC_AUDIO_PCM, TUYA_CODEC_AUDIO_AAC_RAW, TUYA_CODEC_AUDIO_AAC_ADTS, TUYA_CODEC_AUDIO_AAC_LATM, TUYA_CODEC_AUDIO_G711U, TUYA_CODEC_AUDIO_G711A, TUYA_CODEC_AUDIO_G726,

Page 19: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

TUYA_CODEC_AUDIO_SPEEX, TUYA_CODEC_AUDIO_MP3, TUYA_CODEC_AUDIO_MAX = 199, TUYA_CODEC_INVALID}TUYA_CODEC_ID;

Enum Name Enum Value DescriptionTUYA_CODEC_VIDEO_MPEG4 0 MPEG-4TUYA_CODEC_VIDEO_H263 1 H.263TUYA_CODEC_VIDEO_H264 2 H.264TUYA_CODEC_VIDEO_MJPEG 3 MJPEGTUYA_CODEC_VIDEO_H265 4 H.265TUYA_CODEC_VIDEO_MAX 99 Maximum number of enum values

TUYA_CODEC_AUDIO_ADPCM 100Adaptive differential pulse-code modulation (ADPCM)

TUYA_CODEC_AUDIO_PCM 101 Pulse-code modulation (PCM)TUYA_CODEC_AUDIO_AAC_RAW 102 AA_RAWTUYA_CODEC_AUDIO_AAC_ADTS 103 AAC_ADTSTUYA_CODEC_AUDIO_AAC_LATM 104 AAC_LATMTUYA_CODEC_AUDIO_G711U 105 G711UTUYA_CODEC_AUDIO_G711A 106 G711ATUYA_CODEC_AUDIO_G726 107 G.726TUYA_CODEC_AUDIO_SPEEX 108 SpeexTUYA_CODEC_AUDIO_MP3 109 MP3TUYA_CODEC_AUDIO_MAX 199 Maximum number of enum valuesTUYA_CODEC_INVALID 200 Invalid protocol

2.2.3 Audio Sampling Ratetypedef enum{ TUYA_AUDIO_SAMPLE_8K = 8000, TUYA_AUDIO_SAMPLE_11K = 11000, TUYA_AUDIO_SAMPLE_12K = 12000, TUYA_AUDIO_SAMPLE_16K = 16000, TUYA_AUDIO_SAMPLE_22K = 22000, TUYA_AUDIO_SAMPLE_24K = 24000, TUYA_AUDIO_SAMPLE_32K = 32000, TUYA_AUDIO_SAMPLE_44K = 44000, TUYA_AUDIO_SAMPLE_48K = 48000, TUYA_AUDIO_SAMPLE_MAX = 0xFFFFFFFF}TUYA_AUDIO_SAMPLE_E;

Page 20: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Enum Name Enum Value DescriptionTUYA_AUDIO_SAMPLE_8K 8000 The sampling rate is 8 kHz.

TUYA_AUDIO_SAMPLE_11K 11000 The sampling rate is 11 kHz.

TUYA_AUDIO_SAMPLE_12K 12000 The sampling rate is 12 kHz.TUYA_AUDIO_SAMPLE_16K 16000 The sampling rate is 16 kHz.TUYA_AUDIO_SAMPLE_22K 22000 The sampling rate is 22 kHz.TUYA_AUDIO_SAMPLE_24K 24000 The sampling rate is 24 kHz.TUYA_AUDIO_SAMPLE_32K 32000 The sampling rate is 32 kHz.TUYA_AUDIO_SAMPLE_44K 44000 The sampling rate is 44 kHz.TUYA_AUDIO_SAMPLE_48K 48000 The sampling rate is 48 kHz.TUYA_AUDIO_SAMPLE_MAX 0xFFFFFFFF

2.2.4 Audio Bitstypedef enum{ TUYA_AUDIO_DATABITS_8 = 8, TUYA_AUDIO_DATABITS_16 = 16, TUYA_AUDIO_DATABITS_MAX = 0xFF}TUYA_AUDIO_DATABITS_E;

Enum Name Enum Value DescriptionTUYA_AUDIO_DATABITS_8 8 8 bitsTUYA_AUDIO_DATABITS_16 16 16 bitsTUYA_AUDIO_DATABITS_MAX 0xFF 255 bits

2.2.5 Audio Channelstypedef enum{ TUYA_AUDIO_CHANNEL_MONO, TUYA_AUDIO_CHANNEL_STERO,}TUYA_AUDIO_CHANNEL_E;

Enum Name Enum Value DescriptionTUYA_AUDIO_CHANNEL_MONO 0 MonoTUYA_AUDIO_CHANNEL_STERO 1 Stereo

Page 21: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

2.2.6 Cloud Storage Order Types

typedef enum{

ClOUD_STORAGE_TYPE_CONTINUE, ClOUD_STORAGE_TYPE_EVENT, ClOUD_STORAGE_TYPE_INVALID

}ClOUD_STORAGE_TYPE_E;

Enum Name Enum Value DescriptionClOUD_STORAGE_TYPE_CONTINUE 0 Data will be uploaded continuously to the

cloud for storage until the end time of the order.

ClOUD_STORAGE_TYPE_EVENT 1 Only event data will be uploaded to the cloud for storage. The start and end are triggered by user-defined data.

ClOUD_STORAGE_TYPE_INVALID 2 No order or other abnormal status.

2.2.7 Event Typestypedef enum{ EVENT_TYPE_MOTION_DETECT, EVENT_TYPE_DOOR_BELL, EVENT_TYPE_INVALID}ClOUD_STORAGE_EVENT_TYPE_E;

Enum Name Enum Value DescriptionEVENT_TYPE_MOTION_DETECT 0 Storage triggered by motion detectionEVENT_TYPE_DOOR_BELL 1 Storage triggered by doorbell wakeupEVENT_TYPE_INVALID 2 Invalid event

2.2.8 Event Statestypedef enum{ EVENT_NONE, EVENT_ONGOING, EVENT_INVALID}EVENT_STATUS_E;

Page 22: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Enum Name Enum Value DescriptionEVENT_NONE 0 No eventEVENT_ONGOING 1 OngoingEVENT_INVALID 2 Invalid state

2.3.1 Writing Files to an SD Cardtypedef enum { SS_WRITE_MODE_NONE, SS_WRITE_MODE_EVENT, SS_WRITE_MODE_ALL, SS_WRITE_MODE_MAX}STREAM_STORAGE_WRITE_MODE_E;

Enum Name Enum Value DescriptionSS_WRITE_MODE_NONE 0 No file is written to the SD card.SS_WRITE_MODE_EVENT 1 Files are written to the SD card when events

occur.SS_WRITE_MODE_ALL 2 Files are always written to the SD card.SS_WRITE_MODE_MAX 3

2.3.2 Deleting Filestypedef enum{ E_DELETE_NONE, E_DELETE_YEAR, E_DELETE_MONTH, E_DELETE_DAY, E_DELETE_EVENT, E_DELETE_INVALID, E_DELETE_FS_ERROR}DELETE_LEVEL_E;Enum Name Enum Value DescriptionE_DELETE_NONE 0 No files are deleted.E_DELETE_YEAR 1 Files are deleted by year.E_DELETE_MONTH 2 Files are deleted by month.E_DELETE_DAY 3 Files are deleted by day.E_DELETE_EVENT 4 Files are deleted by event.E_DELETE_INVALID 5E_DELETE_FS_ERROR 6

Page 23: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

2.3.3 Storage Statestypedef enum

{ E_STORAGE_STOP, E_STORAGE_START, //The following internal status interfaces cannot be set externally. E_STORAGE_ONGOING, E_STORAGE_READY_TO_STOP, E_STORAGE_RESTART, E_STORAGE_INVALID

}STORAGE_STATUS_E;Enum Name Enum Value DescriptionE_STORAGE_STOP 0 PauseE_STORAGE_START 1 StartE_STORAGE_ONGOING 2 StoringE_STORAGE_READY_TO_STOP 3 Ready to pauseE_STORAGE_RESTART 4 RestartE_STORAGE_INVALID 5 Invalid parameter

2.3.4 Event Playbacktypedef enum{ SS_PB_FINISH = 0, SS_PB_NEWFILE, }SS_PB_EVENT_E;

Enum Name Enum Value DescriptionSS_PB_FINISH 0 The current file has finished playing.SS_PB_NEWFILE 1 There is a continuous file to play.

2.3.5 Frame Typestypedef enum{ E_VIDEO_PB_FRAME = 0, E_VIDEO_I_FRAME, E_VIDEO_TS_FRAME,

Page 24: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

E_AUDIO_FRAME, E_MEDIA_FRAME_TYPE_MAX}MEDIA_FRAME_TYPE_E;

Enum Name Enum Value DescriptionE_VIDEO_PB_FRAME 0 PG frameE_VIDEO_I_FRAME 1 I-FrameE_VIDEO_TS_FRAME 2 TS frameE_AUDIO_FRAME 3 Audio frameE_MEDIA_FRAME_TYPE_MAX

4

2.3.6 Playback Statestypedef enum{ SS_PB_MUTE, SS_PB_UN_MUTE, SS_PB_PAUSE, SS_PB_RESUME, }SS_PB_STATUS_E;

Enum Name Enum Value DescriptionSS_PB_MUTE 0 MuteSS_PB_UN_MUTE 1 UnmuteSS_PB_PAUSE 2 PauseSS_PB_RESUME 3 Continue

2.4.1 Reset Typestypedef enum { GW_LOCAL_RESET_FACTORY = 0, GW_REMOTE_UNACTIVE, GW_LOCAL_UNACTIVE, GW_REMOTE_RESET_FACTORY}GW_RESET_TYPE_E;

Enum Name Enum Value DescriptionGW_LOCAL_RESET_FACTORY 0 Local device resetGW_REMOTE_UNACTIVE 1 Remote inactive resetGW_LOCAL_UNACTIVE 2 Local inactive reset

Page 25: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

GW_REMOTE_RESET_FACTORY 3 Remote device reset

2.5.1 Maximum Number of Video and Audio Stream Channelstypedef enum{ E_CHANNEL_VIDEO_MAIN = 0, E_CHANNEL_VIDEO_SUB, E_CHANNEL_VIDEO_3RD, E_CHANNEL_VIDEO_4TH, E_CHANNEL_VIDEO_MAX = 8, // Maximum number of video stream channels E_CHANNEL_AUDIO, E_CHANNEL_AUDIO_2RD, E_CHANNEL_AUDIO_3RD, E_CHANNEL_AUDIO_4TH, E_CHANNEL_MAX = 16}CHANNEL_E;

Enum Name Enum Value DescriptionE_CHANNEL_VIDEO_MAIN 0 Main streamE_CHANNEL_VIDEO_SUB 1 Substream 1E_CHANNEL_VIDEO_3RD 2 Substream 2E_CHANNEL_VIDEO_4TH 3 Substream 3E_CHANNEL_VIDEO_MAX 8 Maximum number of video stream channelsE_CHANNEL_AUDIO 9 Main audio streamE_CHANNEL_AUDIO_2RD 10 Audio stream 1E_CHANNEL_AUDIO_3RD 11 Audio stream 2E_CHANNEL_AUDIO_4TH 12 Audio stream 3E_CHANNEL_MAX 16 Maximum number of audio stream channels

2.5.2 User Indextypedef enum{ E_USER_STREAM_STORAGE = 0, E_USER_COULD_STORAGE = 1, E_USER_ECHO_SHOW = 2, E_USER_CHROMECAST = 3, E_USER_P2P_USER = 4, //Multi-channel P2P, which uses the E_USER_P2P_USER and P2P index

to distinguish users E_USER_RTSP = 10,

Page 26: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

E_USER_NUM_MAX = 16}USER_INDEX_E;

Enum Name Enum Value DescriptionE_USER_STREAM_STORAGE 0 Local storageE_USER_COULD_STORAGE 1 Cloud storageE_USER_ECHO_SHOW 2 Echo Show userE_USER_CHROMECAST 3 Chromecast userE_USER_P2P_USER 4 P2P userE_USER_RTSP 10 Real Time Streaming Protocol (RTSP)E_USER_NUM_MAX 16 Maximum number of users

3 Structure Definitions

3.1.1 IPC Environment Variablestypedef struct{ CHAR_T storage_path[IPC_STORAGE_PATH_LEN + 1]; CHAR_Tproduct_key[IPC_PRODUCT_KEY_LEN + 1];

CHAR_T uuid[IPC_UUID_LEN + 1]; CHAR_T auth_key[IPC_AUTH_KEY_LEN + 1];CHAR_T p2p_id[IPC_P2P_ID_LEN + 1]; CHAR_T dev_sw_version[IPC_SW_VER_LEN + 1]; CHAR_T dev_serial_num[IPC_SERIAL_NUM_LEN + 1];DEV_OBJ_DP_CMD_CB dev_obj_dp_cb;DEV_DP_QUERY_CB ev_dp_query_cb;GW_STATUS_CHANGED_CB status_changed_cb; GW_UG_INFORM_CB gw_ug_cb; TUYA_RST_INFORM_CB gw_rst_cb;TUYA_RESTART_INFORM_CB w_restart_cb;

BOOL_T mem_save_mode; VOID *p_reserved;}TUYA_IPC_ENV_VAR_S;

Parameter Descriptionstorage_path Readable and writable storage path of Tuya SDK internal configuration

files. Data will not be lost in case of power failure.

Page 27: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Descriptionproduct_key Product key.uuid UUID for Tuya SDK. If this parameter is empty, the SDK uses the pre-

written value in the configuration file.auth_key Authkey for Tuya SDK. If this parameter is empty, the SDK uses the pre-

written value in the configuration file.p2p_id P2P ID for Tuya SDK. If the local user does not have a PIP ID, the value

of this parameter is null.dev_sw_version Device firmware version number.dev_serial_num Unique hardware identifier of a device.dev_obj_dp_cb Tuya command distribution function.dev_dp_query_cb Tuya query distribution function.status_changed_cb Device status change callback function. The value can be NULL.gw_ug_cb Callback function for getting the firmware upgrade information in IPC

mode. The value can be NULL.gw_rst_cb Callback function for resetting the IPC in IPC mode. The value can be

NULL.gw_restart_cb Callback function for restarting the IPC progress in IPC mode. The

value can be NULL.mem_save_mode Low memory mode.p_reserved Reserved parameter.

3.1.2 TY_INIT_PARAMS_Stypedef struct

{ BYTE_T encrypt_key[ENCRYPT_KEY_LEN];

}TY_INIT_PARAMS_S;

Parameter Descriptionencrypt_key Storage key

3.1.3 GW_ATTACH_ATTR_Ttypedef struct

{GW_PERMIT_DEV_TP_T tp; CHAR_T ver[SW_VER_LEN+1];

}GW_ATTACH_ATTR_T;

Parameter DescriptionTp See definition of GW_PERMIT_DEV_TP_T.

Page 28: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

ver Software version.

3.1.4 DEV_DESC_IF_Stypedef struct

{ CHAR_T id[DEV_ID_LEN+1]; CHAR_Tsw_ver[SW_VER_LEN+1]; CHAR_T schema_id[SCHEMA_ID_LEN+1]; CHAR_T product_key[PRODUCT_KEY_LEN+1]; USER_DEV_DTL_DEF_T uddd; DEV_TYPE_T tp; BOOL_Tbind; BOOL_T sync; BYTE_T attr_num; GW_ATTACH_ATTR_T attr[GW_ATTACH_ATTR_LMT];}DEV_DESC_IF_S;

Parameter Descriptionid Device IDsw_ver Software versionschema_idproduct_key Device keyuddd User-defined typetpbindsyncattr_numattr See section 3.1.3 "GW_ATTACH_ATTR_T."

3.1.5 DP_PROP_VAL_Stypedef struct { INT_T min; INT_T max; SHORT_T step; USHORT_T scale; INT_T value;

}DP_PROP_VAL_S;

Page 29: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Descriptionminmaxstepscalevalue

3.1.6 DP_PROP_ENUM_Stypedef struct

{INT_T cnt; CHAR_T **pp_enum; INT_T value;

}DP_PROP_ENUM_S;

Parameter Descriptioncntpp_enumvalue Enum

3.1.7 DP_PROP_STR_Stypedef struct

{ INT_Tmax_len; CHAR_T *value;}DP_PROP_STR_S;

Parameter Descriptionmax_len Lengthvalue String

3.1.8 DP_BOOL_Stypedef struct

{ BOOL_T value;

}DP_BOOL_S;

Parameter Description

Page 30: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

value Boolean

3.1.9 DP_PROP_BITMAPtypedef struct { UINT_T max_len; UINT_Tvalue;}DP_PROP_BITMAP;

Parameter Descriptionmax_len Lengthvalue Bitmap

3.1.10 TY_RECV_OBJ_DP_Stypedef struct { DP_CMD_TYPE_E cmd_tp; DP_TRANS_TYPE_Tdtt_tp; CHAR_T *cid; UINT_T dps_cnt; TY_OBJ_DP_S dps[0];}TY_RECV_OBJ_DP_S;

Parameter Descriptioncmd_tp #define DP_CMD_LAN 0 // cmd from LAN;

#define DP_CMD_MQ 1 // cmd from MQTT;#define DP_CMD_TIMER 2 // cmd from Local Timer;#define DP_CMD_SCENE_LINKAGE 3 // cmd from scene linkage;

dtt_tp #define DTT_SCT_UNC 0 // unicast;#define DTT_SCT_BNC 1 // boardcast;#define DTT_SCT_MNC 2 // multicast;#define DTT_SCT_SCENE 3 // scene

cid if(NULL == cid) then then the cid represents gwiddps_cntdps[0] See section 3.1.11 "TY_OBJ_DP_S."

3.1.11 TY_OBJ_DP_Stypedef struct {

Page 31: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

BYTE_T dpid; DP_PROP_TP_E type; TY_OBJ_DP_VALUE_U value; UINT_T time_stamp; }TY_OBJ_DP_S;

Parameter Descriptiondpid DP IDtype DP type

#define PROP_BOOL 0#define PROP_VALUE 1#define PROP_STR 2#define PROP_ENUM 3#define PROP_BITMAP 4

value DP value. See section 3.5.1 "TY_OBJ_DP_VALUE_U."time_stamp DP happen time. if 0, mean now

3.1.12 TY_DP_QUERY_Stypedef struct { CHAR_T *cid; UINT_T cnt; BYTE_T dpid[0]; }TY_DP_QUERY_S;

Parameter Descriptioncid if(NULL == cid) then then the cid represents gwidcnt DP ID cnt if(0 == cnt) then query all object DPdpid[0] DP ID

3.1.13 FW_UG_Stypedef struct { DEV_TYPE_Ttp; CHAR_T fw_url[FW_URL_LEN+1]; CHAR_T fw_md5[FW_MD5_LEN+1]; CHAR_T sw_ver[SW_VER_LEN+1]; UINT_T file_size; }FW_UG_S;

Parameter Descriptiontp Firmware type:

Page 32: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

#define DEV_NM_ATH_SNGL 0 // netlink module attach single device,(devid == gwid);#define DEV_NM_NOT_ATH_SNGL 1 // netlink module not attach single device,(devid == gwid);#define DEV_ZB_SNGL 2 // zigbee single device;#define DEV_RF433_SNGL 3 // rf433 single device;#define DEV_BLE_SNGL 4 // ble single device;

fw_url Firmware downloading addressfw_md5 Firmware encryption typesw_ver Firmware versionfile_size Firmware size

3.2.1 IPC_MEDIA_INFO_Stypedef struct{ BOOL_Tchannel_enable[E_CHANNEL_MAX]; UINT_T video_fps[E_CHANNEL_VIDEO_MAX]; UINT_T video_gop[E_CHANNEL_VIDEO_MAX]; TUYA_VIDEO_BITRATE_E video_bitrate[E_CHANNEL_VIDEO_MAX]; UINT_T video_width[E_CHANNEL_VIDEO_MAX]; UINT_T video_height[E_CHANNEL_VIDEO_MAX]; UINT_T video_freq[E_CHANNEL_VIDEO_MAX]; TUYA_CODEC_ID video_codec[E_CHANNEL_VIDEO_MAX]; TUYA_CODEC_ID audio_codec[E_CHANNEL_MAX]; UINT_T audio_fps[E_CHANNEL_MAX]; TUYA_AUDIO_SAMPLE_E audio_sample[E_CHANNEL_MAX]; TUYA_AUDIO_DATABITS_E audio_databits[E_CHANNEL_MAX]; TUYA_AUDIO_CHANNEL_E audio_channel[E_CHANNEL_MAX];}IPC_MEDIA_INFO_S;

Parameter Descriptionchannel_enable Enable.video_fps Frame rate. The default value is 30.video_gop I-Frame interval. The default value is 60.video_bitrate See definition of TUYA_VIDEO_BITRATE_E.video_width Width range, which is associated with the video coding formats SD and

HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720 pixels to 1920 x 1080 pixels.

video_height Height range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720 pixels to 1920 x 1080 pixels.

Page 33: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

video_freq Clock frequency. The default value is 90000.video_codec See definition of TUYA_CODEC_ID.audio_codec See definition of TUYA_CODEC_ID.audio_fps Audio frame rate range. The default value is 25.audio_sample See definition of TUYA_AUDIO_SAMPLE_E.audio_databits See definition of TUYA_AUDIO_DATABITS_E.audio_channel See definition of TUYA_AUDIO_CHANNEL_E.

3.2.2 AES_HW_CBC_FUNCtypedef struct

{ Tuya_CBC_AES128_Init init; Tuya_CBC_AES128_Encrypt encrypt; Tuya_CBC_AES128_Destroy destory;

}AES_HW_CBC_FUNC;

Note:TypedefINT_T (*Tuya_CBC_AES128_Init)(VOID);

typedef INT_T (*Tuya_CBC_AES128_Encrypt)(

IN BYTE_T *pdata_in, //Data before encryption, which cannot be modified. IN UINT_T data_len, //Data size before encryption IN BYTE_T *pdata_out, //Data destination address after encryption. A space has been

applied for in the SDK and additional memory allocation is not required.

OUT UINT_T *pdata_out_len, //Data size after encryption IN BYTE_T *pkey, //AES encryption key IN BYTE_T *piv //AES CBC encryption IV );

typedef INT_T (*Tuya_CBC_AES128_Destroy)(VOID);

Parameter Descriptioninit See definition of Tuya_CBC_AES128_Init.encrypt See definition of Tuya_CBC_AES128_Encrypt.destory See definition of Tuya_CBC_AES128_Destroy.

3.3.1 SS_QUERY_DAY_TS_ARR_Stypedef struct

Page 34: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

{ UINT_T file_count; SS_FILE_TIME_TS_S file_arr[0]; } SS_QUERY_DAY_TS_ARR_S;

Parameter Descriptionfile_count Number of playback files on the current dayfile_arr Playback file array

3.3.2 SS_FILE_TIME_TS_Stypedef struct{ UINT_T start_timestamp; UINT_T end_timestamp; } SS_FILE_TIME_TS_S;

Parameter Descriptionstart_timestamp Playback file start timestamp (in seconds)end_timestamp Playback file end timestamp (in seconds)

typedef struct{ MEDIA_FRAME_TYPE_E type; BYTE_T *p_buf; UINT_T size; UINT64_T pts; UINT64_T timestamp;}MEDIA_FRAME_S;

Parameter Descriptiontype Frame type. See definition of MEDIA_FRAME_TYPE_E.p_buf Callback data.size Data size.pts Displayed timestamp.timestamp Timestamp.

3.4.1 Ring_Buffer_Node_Stypedef struct {

Page 35: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

UINT_T index; MEDIA_FRAME_TYPE_E type; UCHAR_T *rawData; UINT_T size; UINT64_T pts; UINT64_T timestamp; UINT_T seqNo; UCHAR_T *extraData; UINT_T extraSize;}Ring_Buffer_Node_S;

Parameter Descriptionindex Indextype Frame type. See definition of MEDIA_FRAME_TYPE_E.rawData Original data, such as audio and video data.size Data size.pts Displayed timestamp.

timestampTimestamp. The value is 1000 times the actual timestamp. The actual timestamp is this parameter value divided by 1000.

seqNo Frame number.*extraData Alternative parameter, which is meaningless.extraSize Alternative parameter, which is meaningless.

3.4.2 S_PRESET_PTZtypedef struct { INT_T pan; INT_T tilt; INT_T zoom; }S_PRESET_PTZ;

Parameter Descriptionpan Horizontal PTZ. The driver layer parameter value range is not limited

and can be defined as needed.tilt Vertical PTZ. The driver layer parameter value range is not limited and

can be defined as needed.zoom Zoom function. The driver layer parameter value range is not limited

and can be defined as needed.

3.4.3 S_PRESET_POSITION

Page 36: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

typedef struct { CHAR_T id; CHAR_T name[32]; INT_T mpId; S_PRESET_PTZ ptz; } S_PRESET_POSITION;

Parameter Descriptionid Identifier for each preset point on the server.tilt Preset name. The value is a maximum of 31 characters, including

Chinese characters.zoom Preset point index ID, which must be unique.Ptz PTZ position information.

3.5 Joint Type Definition

3.5.1 TY_OBJ_DP_VALUE_Utypedef union { INT_T dp_value; // valid when dp type is value UINT_Tdp_enum; // valid when dp type is enum CHAR_T *dp_str; // valid when dp type is str BOOL_T dp_bool; // valid when dp type is bool UINT_T dp_bitmap; // valid when dp type is bitmap}TY_OBJ_DP_VALUE_U;

Parameter Descriptiondp_value Valid when the DP is an integerdp_enum Valid when the DP is an enumdp_str Valid when the DP is a stringdp_bool Valid when the DP is Booleandp_bitmap Valid when the DP is a bitmap

Page 37: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4 Interface Definitions

4.1 General Interface Definitions

4.1.1 tuya_ipc_get_sdk_infoFunction prototype

CHAR_T *tuya_ipc_get_sdk_info(VOID

);

Function descriptionThis interface obtains the Tuya SDK compilation information.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned valueReturned Value DescriptionInfo Tuya SDK compilation information, SDK version, compiling time,

and supported functions

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.2 tuya_ipc_init_sdkFunction prototype

OPERATE_RET tuya_ipc_init_sdk(IN CONST TUYA_IPC_ENV_VAR_S *p_var

);

Function description

Page 38: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

This interface verifies and initializes the required Tuya SDK operating environment.

Parameter description

Parameter Description Parameter Type Mandatory Settingp_var Running

environment configuration structure pointer

Input parameter Yes See definition of TUYA_IPC_ENV_VAR_S.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

Constraints

Operating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.3 tuya_ipc_start_sdkFunction prototype

OPERATE_RET tuya_ipc_start_sdk(IN CONST WIFI_INIT_MODE_E wifi_mode,IN CONST char *pToken);

Function descriptionThis interface starts the Tuya SDK in WIFI_DEVICE mode.

Parameter description

Parameter Description Parameter Type Mandatory Settingwifi_mode Device network

configuration modeInput parameter Yes See definition of

WIFI_INIT_MODE_E.pToken Token Input parameter Yes

Page 39: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Returned value

Returned value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

Constraints

Operating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.4 tuya_ipc_upgrade_sdkFunction prototype

OPERATE_RET tuya_ipc_upgrade_sdk( IN CONST FW_UG_S *fw, IN CONST GET_FILE_DATA_CB get_file_cb,

IN CONST UPGRADE_NOTIFY_CBupgrd_nofity_cb, IN PVOID_T pri_data

);

Function descriptionThis interface upgrades the local firmware.

Parameter description

Parameter Description Parameter Type Mandatory Settingfw Firmware

informationInput parameter Yes See section 3.1.13

"FW_UG_S."get_file_cb Callback

function for firmware file download

Input parameter Yes See section 4.1.12 "GET_FILE_DATA_CB."

upgrd_nofity_cb Callback function for notifications on the

Input parameter Yes See section 4.1.13 "UPGRADE_NOTIFY_CB."

Page 40: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

completion of downloading firmware

pri_data Additional parameter when the callback function is called.

Input parameter Yes

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.5 tuya_ipc_get_register_statusFunction prototype

IPC_REGISTER_STATUS tuya_ipc_get_register_status(VOID

);Function description

This interface obtains IPC registration and activation states.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned value Description

Page 41: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

IPC_REGISTER_STATUS See IPC_REGISTER_STATUS.

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.6 DEV_OBJ_DP_CMD_CBFunction prototype

typedef VOID (*DEV_OBJ_DP_CMD_CB)(IN CONST TY_RECV_OBJ_DP_S *dp

);

Function descriptionThis is a Tuya command distribution function.

Parameter description

Parameter Description Parameter Type Mandatory Settingdp Original DP

informationInput parameter Yes See definition of

TY_RECV_OBJ_DP_S.

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.7 DEV_DP_QUERY_CB

Page 42: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Function prototypeTypedef VOID (*DEV_DP_QUERY_CB)(

IN CONST TY_DP_QUERY_S*dp_qry);

Function descriptionThis is a Tuya query distribution function.

Parameter description

Parameter Description Parameter Type Mandatory Settingdp_qry Querying

informationInput parameter Yes See section 3.1.12

"TY_DP_QUERY_S."

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.8 GW_STATUS_CHANGED_CBFunction prototype

typedef VOID (*GW_STATUS_CHANGED_CB)(IN CONST GW_STATUS_E status

);

Function descriptionThis is a device status change callback function. The value can be NULL.

Parameter description

Parameter Description Parameter Type Mandatory Settingdp_qry Gateway status Input parameter Yes #define GW_RESET

0 // gw reset;

Page 43: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

#define GW_ACTIVED 1 // gw actived;#define GW_FIRST_START 2 // start tuya-sdk in the first time.;#define GW_NORMAL 3 // tuya-sdk is activated and started

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.9 GW_UG_INFORM_CBFunction prototype

typedef VOID (*GW_UG_INFORM_CB)(IN CONST FW_UG_S *fw

);Function description

This is a callback function for getting the firmware upgrade information in IPC mode. The value can be NULL.

Parameter description

Parameter Description Parameter Type Mandatory Settingfw Firmware

informationInput parameter Yes See section 3.1.13

"FW_UG_S."

Returned value

Returned Value DescriptionNone None

Page 44: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.10 TUYA_RST_INFORM_CBFunction prototype

Typedef VOID (*TUYA_RST_INFORM_CB)(GW_RESET_TYPE_E from

);

Function descriptionThis is a callback function for resetting the IPC in IPC mode. The value can be NULL.

Parameter description

Parameter Description Parameter Type Mandatory Settingfrom Firmware

informationInput parameter Yes See section 3.1.13

"FW_UG_S."

Returned value

Returned Value DescriptionNone NoneConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.11 TUYA_RESTART_INFORM_CBFunction prototype

typedef VOID (*TUYA_RESTART_INFORM_CB)(

Page 45: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

VOID);

Function descriptionThis is a callback function for restarting the IPC progress in IPC mode. The value can be NULL.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.12 GET_FILE_DATA_CBFunction prototype

typedef OPERATE_RET (*GET_FILE_DATA_CB)(IN CONST FW_UG_S *fw, IN CONST UINT_T total_len,IN CONST UINT_T offset,

IN CONST BYTE_T *data,IN CONST UINT_T len,OUT UINT_T *remain_len, IN PVOID_T pri_data

);

Function descriptionThis is a callback function for downloading firmware files.

Parameter description

Page 46: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory Settingfw Firmware

informationInput parameter Yes See section 3.1.13

"FW_UG_S."total_len Firmware size Input parameter Yesoffset Downloaded

packet offsetInput parameter Yes

data Packet data Input parameter Yeslen Packet length Input parameter Yesremain_len Volume of data

to downloadOutput parameter

Yes

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.1.13 UPGRADE_NOTIFY_CBFunction prototype

typedef VOID (*UPGRADE_NOTIFY_CB)(IN CONST FW_UG_S *fw, IN CONST INT_T download_result, IN PVOID_T pri_data

);

Function descriptionThis is a callback function for notifications on the completion of downloading firmware.

Parameter description

Parameter Description Parameter Type Mandatory Setting

Page 47: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

fw Firmware information

Input parameter Yes See section 3.1.13 "FW_UG_S."

download_result Downloading result

Input parameter Yes The value 0 indicates that the firmware has been downloaded and a non-zero value indicates that the download has failed.

pri_data Input parameter Yes

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.2 Time Interface Definitions

4.2.1 tuya_ipc_get_service_timeFunction prototype

OPERATE_RET tuya_ipc_get_service_time(OUT UINT_T *time_utc, OUT INT_T *time_zone

);

Function descriptionThis interface obtains the server time that is the same as the time in the app.

Parameter description

Parameter Description Parameter Type Mandatory Settingtime_utc UTC Output parameter Yes None

Page 48: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

time_zone Time zone, which is returned in seconds.

Output parameter Yes None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.2.2 tuya_ipc_check_in_dlsFunction prototype

OPERATE_RET tuya_ipc_check_in_dls(IN UINT_T time_utc, OUT BOOL_T * pIsDls

);

Function descriptionThis interface verifies whether it is in daylight saving time.Note: The function is available in the US.

Parameter description

Parameter Description Parameter Type Mandatory Settingtime_utc UTC Input parameter Yes UTCpIsDls Indicates whether

it is in daylight saving time TRUE: YesFALSE: No

Output parameter Yes None

Returned value

Returned Value Description

Page 49: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

OPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.2.3 tuya_ipc_get_local_timeFunction prototype

OPERATE_RET tuya_ipc_get_local_time(IN UINT_T inTime, OUT struct tm *localTime

);

Function descriptionThis interface converts time to local time in UTC.

Parameter description

Parameter Description Parameter Type Mandatory SettinginTime UTC, which is

returned in seconds.

Input parameter Yes UTC, in seconds

localTime Local time in UTC, in the time structure format. The output contains the year, month, date, day, hour, minute, second, and week.

Output parameter Yes None

Returned value

Returned Value Description

Page 50: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

OPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.2.4 tuya_ipc_get_utc_tmFunction prototypeOPERATE_RET tuya_ipc_get_utc_tm(

OUT struct tm *localTime);

Function descriptionThis interface obtains the UTC.

Parameter description

Parameter Description Parameter Type Mandatory SettinglocalTime UTC, which is

returned in the year-month-day format.

Output parameter Yes UTC after 1970. UTC before 1970 is not supported. If the parameter is set to UTC before 1970, an error will occur.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.a

Page 51: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

libtuya_p2p.a

4.2.5 tuya_ipc_get_utc_timeFunction prototypeOPERATE_RET tuya_ipc_get_utc_time(

OUT UINT_T *time_utc);

Function descriptionThis interface obtains the UTC.

Parameter description

Parameter Description Parameter Type Mandatory Settingtime_utc UTC, which is

returned in seconds.

Output parameter Yes None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.3 Message Interface Definitions

4.3.1 tuya_ipc_dp_reportFunction prototype

OPERATE_RET tuya_ipc_dp_report(IN CONST CHAR_T *dev_id, IN BYTE_T dp_id,

Page 52: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

IN DP_PROP_TP_E type,IN VOID * pVal,IN CONST UINT_Tcnt

);

Function descriptionThis interface reports Tuya messages.

Parameter description

Parameter Description Parameter Type Mandatory Settingdev_id device id Input parameter No The value can be NULL.dp_id DP ID Input parameter Yes DP ID, for example, 134

(motion detection)type Reporting type Input parameter Yes #define PROP_BOOL 0;

#define PROP_VALUE 1;#define PROP_STR 2#define PROP_ENUM 3;#define PROP_BITMAP 4;

pVal Reported value address

Input parameter Yes

cnt Number of reporting times

Input parameter Yes

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.3.2 tuya_ipc_dp_report_syncFunction prototype

OPERATE_RET tuya_ipc_dp_report_sync(

Page 53: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

IN CONST CHAR_T *p_json_data,IN CONST BOOL_T force,IN CONST UINT_T timeout

);Function description

This interface reports Tuya messages.

Parameter description

Parameter Description Parameter Type Mandatory Settingp_json_data Message content

pointerInput parameter Yes JSON format

force Indicates whether a message is forcibly sent

Input parameter Yes 0: No1: Yes

timeout Timeout Input parameter Yes Timeout range. 5s is recommended.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.3.3 tuya_ipc_notification_content_upload_from_bufferFunction prototype

OPERATE_RET tuya_ipc_notification_content_upload_from_buffer(IN NOTIFICATION_CONTENT_TYPE_E type,

IN CHAR_T *data, IN INT_T data_len,

OUT VOID*message);

Function descriptionThis interface pushes buffer audio and video data to Tuya Cloud.

Note:

Page 54: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

1. It is a blocking function that can be used securely in multiple threads.2. From SDK 4.3.0, this interface can no longer be used to upload video files.

Parameter description

Parameter Description Parameter Type

Mandatory Setting

type Image or video type

Input parameter

Yes See definition of NOTIFICATION_CONTENT_TYPE_E.

data Data pointer Input parameter

Yes Image data path

data_len Data length Input parameter

Yes Image data size: ≤ 150 KB

message Message storage pointer for notification information

Output parameter

Yes Message returned by the server

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.3.4 tuya_ipc_notification_content_upload_from_fileFunction prototype

OPERATE_RET tuya_ipc_notification_content_upload_from_file(IN CHAR_T *name,IN NOTIFICATION_CONTENT_TYPE_E type, OUT VOID *message

);Function description

This interface uploads the content body of a notification message to Tuya Cloud.Note:

Page 55: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

1. It is a blocking function that can be used securely in multiple threads. 2. This interface cannot be used to upload videos.

Parameter description

Parameter

Description Parameter Type

Mandatory Setting

name Image path and name

Input parameter

Yes Not limited

type Image type Input parameter

Yes See definition of NOTIFICATION_CONTENT_TYPE_E.The value can be 1 or 2, but not 0.

message Message storage pointer for notification information

Output parameter

Yes None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.3.5 tuya_ipc_notification_message_uploadFunction prototypeOPERATE_RET tuya_ipc_notification_message_upload(

IN CONST BYTE_T notification, IN VOID*message, IN UINT_T time_out

);

Function description

Page 56: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

This interface automatically generates messages and pushes them to the app based on the push type and content.

Parameter description

Parameter Description Parameter Type Mandatory Settingnotification Push type Input parameter Yes In SDK 4.3.0 and earlier

versions, this interface can only be used to send IPC DP 115 (motion detection), and not doorbell DP 115 or other message types.

message Message pointer

Input parameter Yes Message returned by the server

time_out Timeout Input parameter Yes 5s is recommended.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.3.6 tuya_ipc_snapshot_message_uploadFunction prototype

OPERATE_RET tuya_ipc_snapshot_message_upload(IN CONST BYTE_T snapshot,IN VOID *message,

IN UINT_T time_out);

Function descriptionThis interface pushes the screenshot information to the app when the doorbell is pressed.

Page 57: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Note: This function is only available for doorbells.

Parameter description

Parameter Description Parameter Type Mandatory Settingsnapshot Push type Input parameter Yes Doorbell push screenshot

(DP 154)message Message

pointerInput parameter Yes Result returned by the

servertime_out Timeout Input parameter Yes The default value is 5, in

seconds.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.3.7 tuya_ipc_report_living_msgFunction prototype

OPERATE_RET tuya_ipc_report_living_msg(IN UINT_T error_code, IN UINT_T force,IN UINT_T timeout

);

Function descriptionThis interface notifies the app of the live video information.Note: The interface is used for Minrui devices only. The internal encapsulation 305

protocol and error_code are meaningless.

Parameter description

Page 58: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory

Setting

error_code Error code Input parameter Yesforce Indicates

whether a message is forcibly pushed

Input parameter Yes 0: No1: Yes

timeout Timeout Input parameter Yes Time range. 5s is recommended.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4 Device Management Interface Definitions

4.4.1 tuya_ipc_get_wakeup_dataFunction prototype

OPERATE_RET tuya_ipc_get_wakeup_data(INOUT BYTE_T *wakeup_data_arr, INOUT UINT_T *p_len

);

Function descriptionThis interface obtains a device's sleep mode data.

Parameter description

Page 59: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory Settingwakeup_data_arr

Wakeup data pushed to the device in sleep mode

Output parameter

Yes

p_len Length of the wakeup data pushed to the device in sleep mode

Output parameter

Yes

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4.2 tuya_ipc_get_heartbeat_dataFunction prototype

OPERATE_RET tuya_ipc_get_heartbeat_data(INOUT BYTE_T *heartbeat_data_arr,

INOUT UINT_T *p_len);

Function descriptionThis interface obtains the heartbeat data of a device in sleep mode.

Parameter description

Page 60: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory Settingheartbeat_data_arr

Heartbeat data for a device in sleep mode

Input parameter Yes

p_len Length of the heartbeat data for a device in sleep mode

Input parameter Yes

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4.3 tuya_ipc_direct_connectFunction prototype

OPERATE_RET tuya_ipc_direct_connect(IN CONST CHAR_T*p_str, IN CONST TUYA_IPC_DIRECT_CONNECT_TYPE_E source

);

Function descriptionThis interface is used for direct network access, for example, QR code net-pairing and sound wave net-pairing.

Parameter description

Page 61: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory Settingp_str Network

configuration parameter

Input parameter Yes Format: {"p":"20112012pw1","s":"GAOKE_57093C","t":"AYkbx3mD298GJi"}p: passwords: SSIDt: token

source Network configuration mode

Input parameter Yes Currently, only QR code net-pairing is supported. For details, see definition of TUYA_IPC_DIRECT_CONNECT_QRCODE.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4.4 tuya_ipc_set_net_info_nofify_cbFunction prototype

OPERATE_RET tuya_ipc_set_net_info_nofify_cb(VOID

);Function description

This interface sets a callback function for notification of the network configuration information.

Parameter description

Page 62: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned Value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4.5 tuya_ipc_get_mqtt_statusFunction prototype

OPERATE_RET tuya_ipc_get_mqtt_status(VOID

);

Function descriptionThis interface obtains the MQTT connection status.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionMQTT status 0: offline

1: onlineError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and Android

Page 63: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Header File tuya_cloud_types.htuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4.6 tuya_ipc_book_wakeup_topicFunction prototype

OPERATE_RET tuya_ipc_book_wakeup_topic(VOID

);

Function descriptionThis interface is used for subscribed wakeup events.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4.7 tuya_ipc_get_mqtt_socket_fdFunction prototype

INT_T tuya_ipc_get_mqtt_socket_fd(VOID

Page 64: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

);Function description

This interface obtains the MQTT socket FD.Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionSocket_fd MQTT socket FD

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4.8 tuya_ipc_set_log_attrFunction prototype

OPERATE_RET tuya_ipc_set_log_attr(IN CONST INT_T log_level, CHAR_T *filename

);

Function descriptionThis interface sets the log printing level.

Page 65: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter description

Parameter Description Parameter Type Mandatory Settinglog_level Log printing

levelInput parameter Yes The value range is 0 to 5.

A numerically higher value indicates more log content.Level 0: error message, which is unexpected when the program is running properly

Level 1: warning

Level 2: information that needs attention

Level 3: notification

Level 4: program running debugging information, which is deleted in the release version

Level 5: program running path information, which is deleted in the release version

Logs at levels 1, 2, and 3 are not used.

filename File path Input parameter No This parameter is temporarily meaningless. The saving log function is available.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

Page 66: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.4.9 tuya_ipc_get_free_ramFunction prototype

OPERATE_RET tuya_ipc_get_free_ram(IN ULONG_T *free

);

Function descriptionThis interface queries available system memory.

Parameter description

Parameter Description Parameter Type Mandatory Settingfree Available

memory, in kilobytes (KB)

Output parameter

Yes None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_cloud_com_defs.h

Static Library libtuya_ipc.alibtuya_p2p.a

Page 67: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.5 Cloud Storage Interface Definitions

4.5.1 tuya_ipc_cloud_storage_initFunction prototypeOPERATE_RET tuya_ipc_cloud_storage_init(

IN IPC_MEDIA_INFO_S*media_setting,IN AES_HW_CBC_FUNC *aes_func

);Function description

This interface initializes the cloud storage function.

Parameter description

Parameter Description Parameter Type Mandatory Settingmedia_setting Multimedia stream

configuration information. Specify the maximum value if it uses a variable bit rate or is modifiable during operation.

Input parameter Yes See section 3.2.1 "IPC_MEDIA_INFO_S."

aes_func Encryption information

Input parameter Yes See section 3.2.2 "AES_HW_CBC_FUNC."

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.a

Page 68: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

libtuya_p2p.a

4.5.2 tuya_ipc_cloud_storage_uninitFunction prototype

VOID tuya_ipc_cloud_storage_uninit(VOID

);

Function descriptionThis interface deinitializes the cloud storage function.Note: You are advised to use the interface to release resources before the device restarts.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.5.3 tuya_ipc_cloud_storage_get_store_modeFunction prototype

ClOUD_STORAGE_TYPE_E tuya_ipc_cloud_storage_get_store_mode(VOID

);

Function descriptionThis interface obtains the current cloud storage order type.

Parameter description

Page 69: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionCloud storage order type See definition of ClOUD_STORAGE_TYPE_E.

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.5.4 tuya_ipc_cloud_storage_event_startFunction prototype

OPERATE_RET tuya_ipc_cloud_storage_event_start(IN CHAR_T *snapshot_buffer, IN UINT_T snapshot_size, IN ClOUD_STORAGE_EVENT_TYPE_E type

);

Function descriptionThis interface reports the start of an event.Note: You need to enable the cloud storage service; otherwise, an invalid event error

(error code –2000) will be reported.

Parameter description

Parameter Description Parameter Type Mandatory Settingsnapshot_buffer Snapshot when

the current event occurs

Input parameter Yes Image data cache pointer

snapshot_size Size of the snapshot when the current event occurs

Input parameter Yes ≤ 100 KB

Page 70: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

type Event type Input parameter Yes See definition of ClOUD_STORAGE_EVENT_TYPE_E.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.5.5 tuya_ipc_cloud_storage_event_stopFunction prototype

OPERATE_RET tuya_ipc_cloud_storage_event_stop(VOID

);

Function descriptionThis interface reports the end of the current event. Cross reporting of the start and end of multiple events is not supported.Note: In SDK 4.3.2, all on-going events can be ended simultaneously.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

Constraints

Page 71: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Operating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.5.6 tuya_ipc_cloud_storage_get_event_statusFunction prototype

EVENT_STATUS_E tuya_ipc_cloud_storage_get_event_status(ClOUD_STORAGE_EVENT_TYPE_E type

);

Function descriptionThis interface reports the current event status.Note: In SDK 4.3.2, the input parameter type has been added. Querying an event

requires the event ID.Parameter description

Parameter Description Parameter Type Mandatory Settingtype Event type Input parameter Yes See definition of

EVENT_STATUS_E.

Returned value

Returned Value DescriptionEvent status See definition of EVENT_STATUS_E.

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.5.7 tuya_ipc_cloud_storage_pauseFunction prototype

Page 72: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

VOID tuya_ipc_cloud_storage_pause(VOID

);

Function descriptionThis interface pauses cloud storage.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.5.8 tuya_ipc_cloud_storage_resumeFunction prototype

VOID tuya_ipc_cloud_storage_resume(VOID

);

Function descriptionThis interface resumes cloud storage. It is used with tuya_ipc_cloud_storage_pause.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Page 73: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.5.9 tuya_ipc_cloud_storage_event_addFunction prototype

EVENT_ID tuya_ipc_cloud_storage_event_add(CHAR_T * snapshot_buffer, UINT_T snapshot_size,ClOUD_STORAGE_EVENT_TYPE_E type, UINT_T max_duration);

Function descriptionThis interface adds cloud storage events.Note: This interface is new in SDK 4.3.2. It can be used to add a maximum of six cloud storage events and is recommended. The tuya_ipc_cloud_storage_event_start interface can be used to add a single event.

Parameter Description Parameter Type

Mandatory Setting

snapshot_buffer Snapshot when the current event occurs

Input parameter

Yes Buffer pointer

snapshot_size Image size Input parameter

Yes 1 KB to 100 KB

type Event type Input parameter

Yes See definition of ClOUD_STORAGE_EVENT_TYPE_E.

max_duration Maximum event duration

Input parameter

Yes 0s to 300s

Page 74: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Returned value

Returned Value DescriptionEVENT_ID Event ID, ranging from 0 to 5. If the event creation fails,

INVALID_EVENT_ID 0xFFFF is returned.

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_cloud_storage.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.5.10 tuya_ipc_cloud_storage_event_deleteFunction prototype

OPERATE_RET tuya_ipc_cloud_storage_event_delete(EVENT_ID event_id

);

Function descriptionThis interface stops a specified cloud storage event.

Parameter Description Parameter Type Mandatory Settingevent_id Event ID Input parameter Yes Value: 0 to 5

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_cloud_storage.h

Static Library libtuya_ipc.alibtuya_p2p.a

Page 75: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.6 SD Card Storage Interface Definitions

4.6.1 tuya_ipc_ss_initFunction prototype

OPERATE_RET tuya_ipc_ss_init(IN CHAR_T *base_path, IN IPC_MEDIA_INFO_S *media_setting, IN UINT_T max_event_per_day

);

Function descriptionThis interface initializes the SD card storage logic.

Parameter description

Parameter Description Parameter Type Mandatory Settingbase_path Root directory of

the SD cardInput parameter Yes

media_setting Audio and video configuration information

Input parameter Yes See section 3.2.1 "IPC_MEDIA_INFO_S."

max_event_per_day

Maximum number of events on a single day

Input parameter Yes If the number of events on a single day exceeds the value, playback will fail due to storage exceptions. If this parameter is set to a large value, it will take a long time to respond to the app, causing user experience to deteriorate.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

Page 76: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.2 tuya_ipc_ss_uninitFunction prototype

VOID tuya_ipc_ss_uninit(VOID

);

Function descriptionThis interface deinitializes the local storage to release memory resources.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.3 tuya_ipc_ss_set_write_modeFunction prototype

Page 77: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

OPERATE_RET tuya_ipc_ss_set_write_mode(IN CONST STREAM_STORAGE_WRITE_MODE_Ewrite_mode

);Function description

This interface sets the local storage mode.

Parameter description

Parameter Description Parameter Type Mandatory Settingwrite_mode Full-time recording

or event-triggered recording

Input parameter Yes See definition of STREAM_STORAGE_WRITE_MODE_E.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.4 tuya_ipc_ss_get_write_modeFunction prototype

STREAM_STORAGE_WRITE_MODE_E tuya_ipc_ss_get_write_mode(VOID

);

Function descriptionThis interface obtains the current local storage mode.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Page 78: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Returned value

Returned Value DescriptionStorage mode See definition of STREAM_STORAGE_WRITE_MODE_E.ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.5 tuya_ipc_ss_trigger_eventFunction prototype

OPERATE_RET tuya_ipc_ss_trigger_event(UINT_Tevent_duration

);

Function descriptionThis interface triggers a local SD card to record events with a fixed duration. This interface is not recommended and may be discarded in later versions.

Parameter description

Parameter Description Parameter Type Mandatory Settingevent_duration Duration Input parameter Yes

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

Page 79: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.6.6 tuya_ipc_ss_start_eventFunction prototype

OPERATE_RET tuya_ipc_ss_start_event(VOID

);

Function descriptionThis interface starts the recording of the local SD card event. It must be used with tuya_ipc_ss_stop_event.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.7 tuya_ipc_ss_stop_eventFunction prototype

OPERATE_RET tuya_ipc_ss_stop_event (VOID

);

Function description

Page 80: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

This interface stops the recording of the local SD card event. It must be used with tuya_ipc_ss_start_event.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.8 tuya_ipc_ss_delete_oldest_eventFunction prototype

DELETE_LEVEL_E tuya_ipc_ss_delete_oldest_event(VOID

);

Function descriptionThis interface deletes the oldest event file when there is insufficient disk space. In continuous storage, the video is divided into virtualized event segments with a fixed length.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value Description

Page 81: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Deleted event information See definition of DELETE_LEVEL_E.

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.9 tuya_ipc_ss_delete_all_filesFunction prototype

VOID tuya_ipc_ss_delete_all_files(VOID

);

Function descriptionThis interface deletes files stored locally.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

Page 82: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.6.10 tuya_ipc_ss_get_statusFunction prototype

STORAGE_STATUS_E tuya_ipc_ss_get_status(VOID

);

Function descriptionThis interface obtains the storage running status.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionStorage status See definition of STORAGE_STATUS_E.

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.11 tuya_ipc_pb_query_by_monthFunction prototype

OPERATE_RET tuya_ipc_pb_query_by_month(IN USHORT_T query_year, IN USHORT_T query_month, OUT UINT_T *p_return_days

);

Function descriptionThis interface queries the number of days for storing data locally on the SD card in a specified year and month.

Parameter description

Page 83: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory Settingquery_year Year Input parameter Yes Yearquery_month Month Input parameter Yes Monthp_return_days Effective number

of storage daysOutput parameter

Yes Number of days

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.12 tuya_ipc_pb_query_by_dayFunction prototype

OPERATE_RET tuya_ipc_pb_query_by_day(IN UINT_T pbIdx,

IN USHORT_T year, IN USHORT_T month,

IN UCHAR_T day,OUT SS_QUERY_DAY_TS_ARR_S **pTsArr

);

Function descriptionThis interface checks details of data stored locally on the SD card on a specified date.

Parameter description

Parameter Description Parameter Type Mandatory SettingpbIdx Playback ID Input parameter Yesyear Year Input parameter Yes Yearmonth Month Input parameter Yes Monthday Day Input parameter Yes Day

Page 84: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

pTsArr Valid data details Output parameter Yes

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failureConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.13 tuya_ipc_pb_query_free_ts_arrFunction prototype

OPERATE_RET tuya_ipc_pb_query_free_ts_arr(IN SS_QUERY_DAY_TS_ARR_S *p_query_ts_arr);

Function descriptionThis interface releases the memory returned by the SDK.

Parameter description

Parameter Description Parameter Type Mandatory Settingp_query_ts_arr Memory to be

releasedInput parameter Yes See section 3.3.1

"SS_QUERY_DAY_TS_ARR_S."

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

Page 85: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.14 SS_PB_EVENT_CBFunction prototype

typedef VOID (*SS_PB_EVENT_CB)(IN UINT_T pb_idx, IN SS_PB_EVENT_E pb_event, IN PVOID_T args

);

Function descriptionThis interface defines the callback function for event playback.

Parameter description

Parameter Description Parameter Type Mandatory Settingpb_idx Playback ID Input parameter Yes Value: 0 to 65535pb_event Playback event

IDInput parameter Yes See definition of

SS_PB_EVENT_E.args Reserved

parameterInput parameter Yes

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

Page 86: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.6.15 SS_PB_GET_MEDIA_CBFunction prototype

typedef VOID (*SS_PB_GET_MEDIA_CB)(IN UINT_T pb_idx, IN CONST MEDIA_FRAME_S *p_frame

);Function description

This interface obtains playback data.

Parameter description

Parameter Description Parameter Type Mandatory Settingpb_idx Playback ID Input parameter Yes Value: 0 to 65535p_frames

Playback data Input parameter Yes See definition of MEDIA_FRAME_S

Returned value

Returned Value DescriptionNone None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.16 tuya_ipc_ss_pb_startFunction prototype

OPERATE_RET tuya_ipc_ss_pb_start(IN UINT_T pb_idx, IN SS_PB_EVENT_CB event_cb, IN SS_PB_GET_MEDIA_CB video_cb, IN SS_PB_GET_MEDIA_CBaudio_cb

);

Function descriptionThis interface starts a new playback.

Page 87: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter description

Parameter Description Parameter Type

Mandatory Setting

pb_idx Playback ID Input parameter

Yes Value: 0 to 65535

event_cb Callback function for event playback

Input parameter

Yes See definition of SS_PB_EVENT_CB.

video_cb Callback function for video playback

Input parameter

Yes See definition of IN SS_PB_GET_MEDIA_CB.

audio_cb Callback function for audio playback

Input parameter

Yes See definition of IN SS_PB_GET_MEDIA_CB.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.17 tuya_ipc_ss_pb_set_statusFunction prototype

OPERATE_RET tuya_ipc_ss_pb_set_status(IN UINT_T pb_idx, IN SS_PB_STATUS_E new_status

);

Function descriptionThis interface sets the playback attribute.

Parameter description

Page 88: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter Description Parameter Type Mandatory Settingpb_idx Playback ID Input parameter Yes Value: 0 to 65535new_status Status Input parameter Yes See definition of

SS_PB_STATUS_E.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.18 tuya_ipc_ss_pb_stopFunction prototype

OPERATE_RET tuya_ipc_ss_pb_stop(IN UINT_T pb_idx

);

Function descriptionThis interface stops a playback.

Parameter description

Parameter Description Parameter Type Mandatory Settingpb_idx Playback ID Input parameter Yes Value: 0 to 65535

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

Constraints

Page 89: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Operating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.6.19 tuya_ipc_ss_pb_seekFunction prototype

OPERATE_RET tuya_ipc_ss_pb_seek(IN UINT_T pb_idx, IN SS_FILE_TIME_TS_S *pb_file_info, IN UINT_T play_timestamp

);

Function descriptionThis interface seeks a specified playback.

Parameter description

Parameter Description Parameter Type

Mandatory Setting

pb_idx Playback ID Input parameter

Yes Value: 0 to 65535

pb_file_info File to seek Input parameter

Yes See section 3.3.2 "SS_FILE_TIME_TS_S."

play_timestamp Absolute timestamp for lookup

Input parameter

Yes Timestamp

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

Page 90: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.6.20 tuya_ipc_ss_pb_stop_allFunction prototype

OPERATE_RET tuya_ipc_ss_pb_stop_all(VOID

);Function description

This interface stops all playbacks.

Parameter description

Parameter Description Parameter Type Mandatory SettingNone None None None None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7 Audio and Video Interface Definitions

4.7.1 tuya_ipc_ring_buffer_initFunction prototype

OPERATE_RET tuya_ipc_ring_buffer_init(CHANNEL_E channel, UINT_T bitrate, UINT_T fps, UINT_T max_buffer_seconds, FUNC_REQUEST_I_FRAME requestIframeCB

Page 91: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

);

Function descriptionThis interface initializes a ring buffer.

Parameter description

Parameter Description Parameter Type

Mandatory Setting

channel The ring buffer supports multiple channels that apply to IPC scenarios, such as main streams, substreams, and triple streams.

Input parameter

Yes See definition of CHANNEL_E. Currently, 16 channels are supported. The value 1 indicates the video main stream, and the value 9 indicates the audio main stream. Values of CHANNEL_E are for reference only. Redefine the channels based on your requirements.

bitrate Code rate of the current stream; unit: kbits/s

Input parameter

Yes The recommended range is 64 kbits/s to 1536 kbits/s. Set the value based on the capability of your product.

fps Frames per second Input parameter

Yes The value range is not limited, and the value 25 is recommended. Set the value based on your product requirements.

max_buffer_seconds

Maximum cache seconds, one I-Frame interval of up to 10s. When the value is set to 0, the duration is 10 seconds by default. The default setting is

Input parameter

Yes

Page 92: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

recommended.requestIframeCB Callback function for

applying for I-Frames, which accelerates the I-Frame plotting when a new user accesses the SDK and sends a request. If the value is NULL, the system will not automatically apply for I-Frames.

Input parameter

Yes See section 4.7.13 "FUNC_REQUEST_I_FRAME."

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.2 tuya_ipc_ring_buffer_append_dataFunction prototype

OPERATE_RET tuya_ipc_ring_buffer_append_data(CHANNEL_E channel, UCHAR_T *addr, UINT_T size, MEDIA_FRAME_TYPE_E type,

UINT64_T pts);

Function descriptionThis interface adds new data to the ring buffer.

Page 93: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter description

Parameter Description Parameter Type

Mandatory Setting

channel The ring buffer supports multiple channels that apply to IPC scenarios, such as main streams, substreams, and triple streams.

Input parameter

Yes See definition of CHANNEL_E.

addr Input parameter

Yes Audio and video stream data

size Uploaded data size Input parameter

Yes < 200 x 1024 pixels

type Frame type Input parameter

Yes See definition of MEDIA_FRAME_TYPE_E.

pts Input parameter

Yes Timestamp of synchronization between the device and server

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.3 tuya_ipc_ring_buffer_append_extra_dataFunction prototype

OPERATE_RET tuya_ipc_ring_buffer_append_extra_data(CHANNEL_E channel,

Page 94: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

UCHAR_T *dataAddr, UINT_T dataSize

);

Function descriptionThis interface adds additional data to the ring buffer.Note: This interface stores the generated audio and video data of the same frame in different formats. For example, the same code is stored in both PCM and AAC formats.The data is stored in the extraData and extraSize fields of the node.Note: This interface must be used with tuya_ipc_ring_buffer_append_data to ensure that the data is stored in the same frame node.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel The ring buffer

supports multiple channels that apply to IPC scenarios, such as main streams, substreams, and triple streams.

Input parameter Yes See definition of CHANNEL_E.

dataAddr Input parameter YesdataSize Uploaded data size Input parameter Yes

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.4 tuya_ipc_ring_buffer_get_video_frame

Page 95: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Function prototypeRing_Buffer_Node_S *tuya_ipc_ring_buffer_get_video_frame(

CHANNEL_E channel, USER_INDEX_E userIndex, BOOL_T isRetry

);

Function descriptionThis interface gets video stream data from the ring buffer.Note: User indexes distinguish different users in the same ring buffer, and each user maintains the status of getting data.When getting data lags behind writing data and the lagging value exceeds the threshold, tuya_ipc_ring_buffer_get_audio_frame automatically skips frames to the latest I-Frame or audio frame.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel The ring buffer

supports multiple channels that apply to IPC scenarios, such as main streams, substreams, and triple streams.

Input parameter Yes See definition of CHANNEL_E.

userIndex User index Input parameter Yes See definition of USER_INDEX_E.

isRetry Indicates whether to retransmit the data

Input parameter Yes 0: NoNon-zero value: Yes

Returned value

Returned Value DescriptionRing buffer node data See section 3.4.1 "Ring_Buffer_Node_S."

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

Page 96: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.7.5 tuya_ipc_ring_buffer_get_audio_frameFunction prototype

Ring_Buffer_Node_S *tuya_ipc_ring_buffer_get_audio_frame(CHANNEL_E channel, USER_INDEX_E userIndex, BOOL_T isRetry);

Function descriptionThis interface gets audio stream data from the ring buffer.Note: User indexes distinguish different users in the same ring buffer, and each user maintains the status of getting data.When getting data lags behind writing data and the lagging value exceeds the threshold, tuya_ipc_ring_buffer_get_audio_frame automatically skips frames to the latest I-Frame or audio frame.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel The ring buffer

supports multiple channels that apply to IPC scenarios, such as audio stream, audio stream 1, and audio stream 2.

Input parameter Yes See definition of CHANNEL_E.

userIndex User index Input parameter Yes See definition of USER_INDEX_E.

isRetry Indicates whether to retransmit the data

Input parameter Yes 0: NoNon-zero value: Yes

Returned value

Returned Value DescriptionRing buffer node data See section 3.4.1 "Ring_Buffer_Node_S."

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Page 97: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.6 tuya_ipc_ring_buffer_find_pre_video_by_frameFunction prototype

Ring_Buffer_Node_S *tuya_ipc_ring_buffer_find_pre_video_by_frame(CHANNEL_E channel, UINT_T frameNum

);

Function descriptionThis interface searches for frames based on the frameNum value from the latest node to earlier nodes until the I-Frame is found.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel The ring buffer

supports multiple channels that apply to IPC scenarios, such as main streams, substreams, and triple streams.

Input parameter Yes See definition of CHANNEL_E.

frameNum Number of frames to find

Input parameter Yes Value: 0 to 65535

Returned value

Returned Value DescriptionRing buffer node data See section 3.4.1 "Ring_Buffer_Node_S."

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

Page 98: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

4.7.7 tuya_ipc_ring_buffer_find_pre_audio_by_frameFunction prototype

Ring_Buffer_Node_S *tuya_ipc_ring_buffer_find_pre_audio_by_frame(CHANNEL_E channel, UINT_T frameNum

);

Function descriptionThis interface searches for audio frames based on the frameNum value from the latest node to earlier nodes.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel The ring buffer supports

multiple channels that apply to IPC scenarios, such as audio stream, audio stream 1, and audio stream 2.

Input parameter Yes See definition of CHANNEL_E.

frameNum Number of frames to find Input parameter Yes

Returned value

Returned Value DescriptionDoorbell buffer node data See section 3.4.1 "Ring_Buffer_Node_S."

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.8 tuya_ipc_ring_buffer_get_pre_video_frameFunction prototype

Ring_Buffer_Node_S *tuya_ipc_ring_buffer_get_pre_video_frame(CHANNEL_E channel,

Page 99: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

USER_INDEX_E userIndex, UINT_T frameNum

);

Function descriptionThis interface searches for frames based on the frameNum value from the latest node to earlier nodes until the I-Frame is found. After the pre-recorded data is obtained, tuya_ipc_ring_buffer_get_pre_video_frame updates the user corresponding to the userIndex value on the new node and automatically gets data from the pre-recorded I-Frame.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel The ring buffer supports

multiple channels that apply to IPC scenarios, such as main streams, substreams, and triple streams.

Input parameter Yes See definition of CHANNEL_E.

userIndex User index Input parameter Yes See definition of USER_INDEX_E.

frameNum Number of frames to find Input parameter Yes

Returned value

Returned Value DescriptionRing buffer node data See section 3.4.1 "Ring_Buffer_Node_S."

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.9 tuya_ipc_ring_buffer_get_pre_audio_frameFunction prototype

Ring_Buffer_Node_S *tuya_ipc_ring_buffer_get_pre_audio_frame(CHANNEL_E channel,

Page 100: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

USER_INDEX_E userIndex, UINT_T frameNum

);

Function descriptionThis interface searches for audio frames based on the frameNum value from the latest node to earlier nodes. After the pre-recorded data is obtained, tuya_ipc_ring_buffer_get_pre_video_frame updates the user corresponding to the userIndex value on the new node and automatically gets data from the pre-recorded I-Frame.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel The ring buffer

supports multiple channels that apply to IPC scenarios, such as audio stream, audio stream 1, and audio stream 2.

Input parameter Yes See definition of CHANNEL_E.

userIndex User index Input parameter Yes See definition of USER_INDEX_E.

frameNum Number of frames to find

Input parameter Yes

Returned value

Returned Value DescriptionRing buffer node data See section 3.4.1 "Ring_Buffer_Node_S."

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.10 tuya_ipc_ring_buffer_anchor_user_to_nodeFunction prototype

VOID tuya_ipc_ring_buffer_anchor_user_to_node(

Page 101: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

CHANNEL_Echannel, USER_INDEX_E userIndex, Ring_Buffer_Node_S *node);

Function descriptionThis interface anchors the user corresponding to a user index on a specified node.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel Audio and video

channelInput parameter Yes See definition of

CHANNEL_E.userIndex User index Input parameter Yes See definition of

USER_INDEX_E.node Buffer node data Input parameter Yes See section 3.4.1

"Ring_Buffer_Node_S."

Returned value

Returned Value Description

None None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.11 tuya_ipc_ring_buffer_get_next_target_frameFunction prototype

Ring_Buffer_Node_S *tuya_ipc_ring_buffer_get_next_target_frame(CHANNEL_E channel, USER_INDEX_EuserIndex, UINT_T seqNo, MEDIA_FRAME_TYPE_E type

);

Function description

Page 102: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

This interface searches for a specified type of node with a larger seqNo value from the current position of the user index.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel Audio and video

channelInput parameter

Yes See definition of CHANNEL_E.

userIndex User index Input parameter

Yes See definition of USER_INDEX_E.

seqNo Input parameter

Yes

type Frame type Input parameter

Yes See definition of MEDIA_FRAME_TYPE_E.

Returned value

Returned Value DescriptionRing buffer node data See section 3.4.1 "Ring_Buffer_Node_S."

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.12 tuya_ipc_ring_buffer_clean_user_stateFunction prototype

VOID tuya_ipc_ring_buffer_clean_user_state(CHANNEL_E channel, USER_INDEX_E userIndex

);

Function descriptionThis interface deletes the status of the ring buffer user corresponding to the userIndex value. The tuya_ipc_ring_buffer_get_video_frame or tuya_ipc_ring_buffer_get_audio_frame interface will start from the latest I-Frame.

Page 103: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel Audio and video

channelInput parameter Yes See definition of

CHANNEL_E.userIndex User index Input parameter Yes See definition of

USER_INDEX_E.

Returned value

Returned Value Description

None None

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.7.13 FUNC_REQUEST_I_FRAMEFunction prototype

typedef VOID (*FUNC_REQUEST_I_FRAME)(INT_T channel

);

Function descriptionThis is the callback function for applying for I-Frames.

Parameter description

Parameter Description Parameter Type Mandatory Settingchannel Video stream channel Input parameter Yes Video stream channels

0, 1, 2, and 3

Returned value

Returned Value Description

Page 104: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

None NoneConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File tuya_cloud_types.h

tuya_cloud_error_code.htuya_ipc_media.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.8 PTZ Functions

4.8.1 tuya_ipc_preset_addFunction prototype

OPERATE_RET tuya_ipc_preset_add(CHAR_T *addr, UINT_T size, S_PRESET_POSITION * preset_pos)

Function descriptionThis interface adds presets.Note: The SDK interface does not limit the number of presets, but the Tuya Cloud server supports a maximum of six presets.

Parameter description

Parameter Description Parameter Type Mandatory Settingaddr Synchronized image

information when a preset is added

Input parameter No Set this parameter to null.

size Image size Input parameter No Set this parameter to null.

preset_pos Position information of an added preset

Input parameter Yes See section 3.4.3 "S_PRESET_POSITION." The ID in the structure is not configurable and is meaningless.

Page 105: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

Returned value

Returned Value Description

OPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File preset_operation.h

tuya_cloud_error_code.htuya_cloud_types.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.8.2 tuya_ipc_preset_add_picFunction prototype

OPERATE_RET tuya_ipc_preset_add_pic(CHAR_T *addr, UINT_T size, S_PRESET_POSITION* preset_pos)

Function descriptionThis interface adds a preset image.Note: The tuya_ipc_preset_add_pic interface adds an image immediately after the tuya_ipc_preset_add interface adds a preset. It cannot be used to add images for multiple presets that have been created in advance.

Parameter description

Parameter Description Parameter Type Mandatory Settingaddr Synchronized image

information when a preset is added

Input parameter Yes Image pointer, supporting the JPG and PNG formats

size Image size Input parameter Yes Image size. The image size is not limited in the SDK and can be adjusted based on network conditions. The recommended size is 150 KB or

Page 106: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

smaller.preset_pos Position information

of an added presetInput parameter No The parameter is

meaningless from SDK 4.3.2.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File preset_operation.h

tuya_cloud_error_code.htuya_cloud_types.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.8.3 tuya_ipc_preset_delFunction prototypeOPERATE_RET tuya_ipc_preset_del(

CHAR_T* preset_id)

Function descriptionThis interface deletes a preset.

Parameter description

Parameter Description Parameter Type Mandatory Settingpreset_id Preset ID

registered on the server

Input parameter Yes Use the tuya_ipc_preset_get interface to query the preset ID.

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

Page 107: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File preset_operation.h

tuya_cloud_error_code.htuya_cloud_types.h

Static Library libtuya_ipc.alibtuya_p2p.a

4.8.4 tuya_ipc_preset_getFunction prototypeOPERATE_RET tuya_ipc_preset_get (S_PRESET_CFG *preset_cfg)

Function descriptionThis interface queries preset information.Note: A maximum of six presets can be queried.

Parameter description

Parameter Description Parameter Type Mandatory Settingpreset_cfg Indicates where

the returned value is stored after preset configuration information is queried on the server.

Output parameter Yes None

Returned value

Returned Value DescriptionOPRT_OK SuccessError code Error code returned upon a failure

ConstraintsOperating System Linux (Ubuntu), LiteOS, and AndroidHeader File preset_operation.h

tuya_cloud_error_code.htuya_cloud_types.h

Static Library libtuya_ipc.a

Page 108: dl.openipc.org · Web viewWidth range, which is associated with the video coding formats SD and HD. The SD resolution is below 1280 x 720 pixels, and the HD resolution is 1280 x 720

libtuya_p2p.a


Recommended