TuyaOS
宏定义 | 类型定义 | 枚举 | 函数
iot_httpc.h 文件参考

HTTP APIs to interact with TUYA cloud 更多...

#include "tuya_cloud_types.h"
#include "ty_cJSON.h"
#include "gw_intf.h"
#include "http_inf.h"
#include "tuya_matop.h"
iot_httpc.h 的引用(Include)关系图:

浏览源代码.

宏定义

#define http_gw_download_file(url, mlk_buf_len, gfd_cb, priv_data, total_len, p_key, key_len, file_hmac)    httpc_get_file(url, mlk_buf_len, gfd_cb, priv_data, total_len, 0, p_key, key_len, file_hmac)
 
#define httpc_raw_get(p_url, pp_raw_http, offset, total_len)    httpc_raw_get_with_head(p_url, pp_raw_http, offset, total_len, NULL, NULL) \
 Raw HTTP GET request 更多...
 

类型定义

typedef OPERATE_RET(* HTTP_GW_GET_FILE_DATA_CB) (IN PVOID_T priv_data, 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)
 
typedef PVOID_T RAW_HTTP_S
 

枚举

enum  ATOP_ACCESS_E { ATOP_ACCESS_DISABLE , ATOP_ACCESS_ENABLE }
 
enum  ATOP_TYPE_E {
  ATOP_TYPE_ONLINE_DEBUG_LOG , ATOP_TYPE_GET_DYNAMIC_CFG , ATOP_TYPE_GET_TIMER_COUNT , ATOP_TYPE_GET_UPGRADE_SILENT ,
  ATOP_TYPE_GET_NEWEST_SCHEMA , ATOP_TYPE_UPDATE_VERSION
}
 Definition of Atop Access enable
 
enum  DEV_SYNC_STATUS_E { DEV_STATUS_UNKNOWN , DEV_STATUS_RESET , DEV_STATUS_RESET_FACTORY , DEV_STATUS_ENABLE }
 Definition of status to check 更多...
 
enum  HTTP_DYNAMIC_CFG_TYPE { HTTP_DYNAMIC_CFG_TZ = 0x0001 , HTTP_DYNAMIC_CFG_RATERULE = 0x0002 , HTTP_DYNAMIC_CFG_SENIOR_ABILITY = 0x0004 , HTTP_DYNAMIC_CFG_ALL = 0xFFFF }
 Definition of dynamic config 更多...
 

函数

CHAR_T * http_active_url (VOID)
 Retrieve active HTTP url of TUYA cloud 更多...
 
OPERATE_RET http_ble_actived_enable_wifi (VOID)
 Enalbe wifi after activated by BLE 更多...
 
OPERATE_RET http_dynamic_cfg_ack_v20 (IN CONST CHAR_T *timezone_ackId, IN CONST CHAR_T *rateRule_actId, IN CONST CHAR_T *ability_actId)
 ACK of dynamic config(some configs need ack to ensure it is handled correctly) 更多...
 
OPERATE_RET http_dynamic_cfg_get (IN CONST HTTP_DYNAMIC_CFG_TYPE type, OUT ty_cJSON **result)
 Retrieve dynamic config 更多...
 
OPERATE_RET http_ffs_pre_active (IN CONST CHAR_T *wss_token, IN CONST CHAR_T *gw_endpoint)
 Pre-active of FFS netcfg 更多...
 
OPERATE_RET http_get_dev_token_create_v20 (OUT ty_cJSON **result)
 Retrieve token from cloud 更多...
 
OPERATE_RET http_gw_active_mesh (IN CONST CHAR_T *data, OUT ty_cJSON **result)
 Dynamic mesh gw Register and active a device on TUYA cloud 更多...
 
OPERATE_RET http_gw_active_v41 (OUT ty_cJSON **result)
 Register and active a device on TUYA cloud 更多...
 
OPERATE_RET http_gw_custom_cfg_get (IN CONST INT_T biztype, OUT ty_cJSON **result)
 Retrieve customized config 更多...
 
OPERATE_RET http_gw_dev_sync_check (DEV_SYNC_STATUS_E *p_status)
 Retrieve device status 更多...
 
OPERATE_RET http_gw_dev_sync_proc (VOID_T)
 Sync device status 更多...
 
OPERATE_RET http_gw_get_active_info (OUT ty_cJSON **result)
 Register and active a device on TUYA cloud 更多...
 
OPERATE_RET http_gw_get_timer_cnt (IN CONST INT_T lastFetchTime, OUT ty_cJSON **result)
 Get the count of local timers 更多...
 
OPERATE_RET http_gw_get_timer_content (IN CONST INT_T offset, IN CONST INT_T limit, OUT ty_cJSON **result)
 Get content local timers 更多...
 
OPERATE_RET http_gw_location_info_get (OUT ty_cJSON **result)
 Retrieve location info 更多...
 
OPERATE_RET http_gw_notify_timer_cnt (IN CONST INT_T lastFetchTime, OUT ty_cJSON **result)
 Get the count of local timers, without flow limit 更多...
 
OPERATE_RET http_gw_property_save (IN CONST CHAR_T *data)
 Save property to TUYA cloud 更多...
 
OPERATE_RET http_gw_register_V41 (OUT ty_cJSON **result)
 Register a device on TUYA cloud 更多...
 
OPERATE_RET http_gw_reset (IN CONST GW_WORK_STAT_T stat)
 Reset device 更多...
 
OPERATE_RET http_gw_update_version_v41 (VOID)
 Update versions of device on TUYA cloud 更多...
 
OPERATE_RET http_inf_client_post_field_psk_mode (IN CONST CHAR_T *url, IN CONST HTTP_INF_CB callback, IN CONST BYTE_T *data, IN CONST UINT_T len, IN HTTP_HEAD_ADD_CB add_head_cb, IN VOID *add_head_data, IN CONST CHAR_T *p_decode_key, INOUT PVOID_T *pri_data, IN CONST http_hdr_field_sel_t field_flags)
 
VOID http_iot_dns_cache_cloud_url (VOID)
 Load URLs and related Ips of TUYA cloud to DNS cache
 
OPERATE_RET http_iot_dns_get_cloud_url (VOID)
 Retrieve URLs from TUYA IoT DNS service, device will use URLs to interact with TUYA cloud later on 更多...
 
OPERATE_RET http_iot_dns_get_fast_cloud_url (CHAR_T *env)
 Retrieve special URLs from TUYA IoT DNS service, device will use URLs to interact with TUYA cloud later on 更多...
 
OPERATE_RET http_iot_dns_get_host_ip (IN CONST CHAR_T *domain, OUT ty_cJSON **result)
 Use TUYA IoT DNS service to translate domain to ip 更多...
 
OPERATE_RET http_pskkey_get (OUT ty_cJSON **result)
 Retrieve PSK key 更多...
 
OPERATE_RET http_put_cloud_config (IN CONST CHAR_T *data)
 Upload config to TUYA cloud 更多...
 
OPERATE_RET http_put_rst_log (VOID)
 Upload information of device reset to TUYA cloud 更多...
 
CHAR_T * http_url (VOID)
 Retrieve active HTTP url of TUYA cloud 更多...
 
OPERATE_RET httpc_active_shorturl_get (char *uuid, char *appid, ty_cJSON **result)
 Retrieve short url of QR active 更多...
 
OPERATE_RET httpc_common_post (IN CONST CHAR_T *api_name, IN CONST CHAR_T *api_ver, IN CONST CHAR_T *uuid, IN CONST CHAR_T *devid, IN CHAR_T *post_data, IN CONST CHAR_T *p_head_other, OUT ty_cJSON **pp_result)
 POST HTTP request 更多...
 
OPERATE_RET httpc_common_post_no_remalloc (IN CONST CHAR_T *api_name, IN CONST CHAR_T *api_ver, IN CONST CHAR_T *uuid, IN CONST CHAR_T *devid, IN CHAR_T *post_data, IN UINT_T data_total_len, IN CONST CHAR_T *p_head_other, OUT ty_cJSON **pp_result)
 POST HTTP request without memory realloc 更多...
 
OPERATE_RET httpc_common_post_raw (IN CONST CHAR_T *url, IN CONST CHAR_T *api_name, IN CONST CHAR_T *api_ver, IN CONST CHAR_T *uuid, IN CONST CHAR_T *aes_key, IN CONST CHAR_T *devid, IN CHAR_T *post_data, IN UINT_T data_total_len, IN CONST CHAR_T *p_head_other, OUT ty_cJSON **pp_result)
 
OPERATE_RET httpc_common_post_session (IN CONST CHAR_T *api_name, IN CONST CHAR_T *api_ver, IN CONST CHAR_T *uuid, IN CONST CHAR_T *devid, IN CHAR_T *post_data, IN CONST CHAR_T *p_head_other, OUT ty_cJSON **pp_result)
 
OPERATE_RET httpc_common_post_sesssion_raw (IN CONST CHAR_T *url, IN CONST CHAR_T *api_name, IN CONST CHAR_T *api_ver, IN CONST CHAR_T *uuid, IN CONST CHAR_T *aes_key, IN CONST CHAR_T *devid, IN CHAR_T *post_data, IN UINT_T data_total_len, IN CONST CHAR_T *p_head_other, OUT ty_cJSON **pp_result, BOOL_T is_session)
 
OPERATE_RET httpc_dev_ext_module_report (OUT ty_cJSON **result)
 
OPERATE_RET httpc_get_file (IN CONST CHAR_T *url, IN CONST UINT_T mlk_buf_len, IN CONST HTTP_GW_GET_FILE_DATA_CB gfd_cb, IN PVOID_T priv_data, IN CONST UINT_T total_len, IN CONST UINT_T offset, IN CONST BYTE_T *p_key, IN CONST UINT_T key_len, INOUT BYTE_T file_hmac[32])
 Download file 更多...
 
OPERATE_RET httpc_gw_extra_erro_code_tranfer (char *ErroValu)
 Transfer HTTP error string to error code 更多...
 
OPERATE_RET httpc_gw_get_device_auth (CHAR_T *product_id, CHAR_T *product_secret, CHAR_T *client_id, ty_cJSON **result)
 Retrieve UUID and authkey 更多...
 
OPERATE_RET httpc_iot_certificate_get_v10 (OUT ty_cJSON **result, IN CONST CHAR_T *url_msg)
 Retrieve certs of special domain 更多...
 
OPERATE_RET httpc_iot_cloud_storage_encrypt_key_get (OUT ty_cJSON **result)
 Retrieve encrypt key of cloud storage 更多...
 
OPERATE_RET httpc_raw_close (IN RAW_HTTP_S p_raw_http)
 Close raw HTTP request 更多...
 
OPERATE_RET httpc_raw_get_with_head (IN CONST CHAR_T *p_url, INOUT RAW_HTTP_S *pp_raw_http, IN UINT_T offset, IN UINT_T total_len, IN HTTP_HEAD_ADD_CB add_head_cb, IN VOID *add_head_data)
 Raw HTTP GET request 更多...
 
OPERATE_RET httpc_raw_post (IN CONST CHAR_T *p_url, IN CONST UINT_T data_total_len, INOUT RAW_HTTP_S *pp_raw_http)
 Raw HTTP POST request 更多...
 
OPERATE_RET httpc_raw_put (IN CONST CHAR_T *p_url, IN CONST UINT_T data_total_len, INOUT RAW_HTTP_S *pp_raw_http)
 Raw HTTP PUT request 更多...
 
INT_T httpc_raw_read_content (IN RAW_HTTP_S p_raw_http, IN BYTE_T *buf, IN CONST UINT_T buf_len)
 Read content of raw HTTP response 更多...
 
OPERATE_RET httpc_raw_read_resp_header (INOUT RAW_HTTP_S p_raw_http, OUT INT_T *p_status_code, OUT BOOL_T *p_chunked, OUT UINT_T *p_content_len)
 Read header of raw HTTP respose 更多...
 
INT_T httpc_raw_write_content (IN RAW_HTTP_S p_raw_http, IN CONST BYTE_T *buf, IN CONST UINT_T buf_len, BOOL_T chunked)
 Write raw HTTP request 更多...
 
VOID httpc_update_localtime_set (BOOL_T is_auto_update)
 Enable or disable time update from httpc (enable by default) 更多...
 
OPERATE_RET tuya_get_ble_beacon_key (OUT CHAR_T **beaconKey)
 
OPERATE_RET tuya_set_atop_access (ATOP_TYPE_E type, ATOP_ACCESS_E access)
 set atop access enable or disable 更多...
 

详细描述

HTTP APIs to interact with TUYA cloud

版本
0.1
日期
2015-05-27

宏定义说明

◆ httpc_raw_get

#define httpc_raw_get (   p_url,
  pp_raw_http,
  offset,
  total_len 
)     httpc_raw_get_with_head(p_url, pp_raw_http, offset, total_len, NULL, NULL) \

Raw HTTP GET request

参数
[in]p_urlURL to request
[in,out]pp_raw_httpPointer to RAW_HTTP_S
[in]offsetOffset of buffer
[in]total_lenTotal length of buffer
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

枚举类型说明

◆ DEV_SYNC_STATUS_E

Definition of status to check

枚举值
DEV_STATUS_UNKNOWN 

Unknown status

DEV_STATUS_RESET 

Device need reset

DEV_STATUS_RESET_FACTORY 

Device need refactory

DEV_STATUS_ENABLE 

Device is normal

◆ HTTP_DYNAMIC_CFG_TYPE

Definition of dynamic config

枚举值
HTTP_DYNAMIC_CFG_TZ 

time zone

HTTP_DYNAMIC_CFG_RATERULE 

rate rule for dp

HTTP_DYNAMIC_CFG_SENIOR_ABILITY 

senior ability

HTTP_DYNAMIC_CFG_ALL 

all configs

函数说明

◆ http_active_url()

CHAR_T * http_active_url ( VOID  )

Retrieve active HTTP url of TUYA cloud

返回
NULL on error.

◆ http_ble_actived_enable_wifi()

OPERATE_RET http_ble_actived_enable_wifi ( VOID  )

Enalbe wifi after activated by BLE

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

◆ http_dynamic_cfg_ack_v20()

OPERATE_RET http_dynamic_cfg_ack_v20 ( IN CONST CHAR_T *  timezone_ackId,
IN CONST CHAR_T *  rateRule_actId,
IN CONST CHAR_T *  ability_actId 
)

ACK of dynamic config(some configs need ack to ensure it is handled correctly)

参数
[in]timezone_ackIdACK id of timezone
[in]rateRule_actIdACK id of dp rate rule
[in]ability_actIdACK id of senior ability
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_dynamic_cfg_get()

OPERATE_RET http_dynamic_cfg_get ( IN CONST HTTP_DYNAMIC_CFG_TYPE  type,
OUT ty_cJSON **  result 
)

Retrieve dynamic config

参数
[in]typeDefined by HTTP_DYNAMIC_CFG_TYPE
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_ffs_pre_active()

OPERATE_RET http_ffs_pre_active ( IN CONST CHAR_T *  wss_token,
IN CONST CHAR_T *  gw_endpoint 
)

Pre-active of FFS netcfg

参数
[in]wss_tokenwss token
[in]gw_endpointgateway endpoint
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_get_dev_token_create_v20()

OPERATE_RET http_get_dev_token_create_v20 ( OUT ty_cJSON **  result)

Retrieve token from cloud

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_active_mesh()

OPERATE_RET http_gw_active_mesh ( IN CONST CHAR_T *  data,
OUT ty_cJSON **  result 
)

Dynamic mesh gw Register and active a device on TUYA cloud

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_active_v41()

OPERATE_RET http_gw_active_v41 ( OUT ty_cJSON **  result)

Register and active a device on TUYA cloud

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_custom_cfg_get()

OPERATE_RET http_gw_custom_cfg_get ( IN CONST INT_T  biztype,
OUT ty_cJSON **  result 
)

Retrieve customized config

参数
[in]biztypeCustomized key
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_dev_sync_check()

OPERATE_RET http_gw_dev_sync_check ( DEV_SYNC_STATUS_E p_status)

Retrieve device status

参数
[out]p_statusDevice status on TUYA cloud, defined by DEV_SYNC_STATUS_E
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_dev_sync_proc()

OPERATE_RET http_gw_dev_sync_proc ( VOID_T  )

Sync device status

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

◆ http_gw_get_active_info()

OPERATE_RET http_gw_get_active_info ( OUT ty_cJSON **  result)

Register and active a device on TUYA cloud

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_get_timer_cnt()

OPERATE_RET http_gw_get_timer_cnt ( IN CONST INT_T  lastFetchTime,
OUT ty_cJSON **  result 
)

Get the count of local timers

参数
[in]lastFetchTimeLast fetch time returned
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_get_timer_content()

OPERATE_RET http_gw_get_timer_content ( IN CONST INT_T  offset,
IN CONST INT_T  limit,
OUT ty_cJSON **  result 
)

Get content local timers

参数
[in]offsetTimer index
[in]limitMax count of timers
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_location_info_get()

OPERATE_RET http_gw_location_info_get ( OUT ty_cJSON **  result)

Retrieve location info

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_notify_timer_cnt()

OPERATE_RET http_gw_notify_timer_cnt ( IN CONST INT_T  lastFetchTime,
OUT ty_cJSON **  result 
)

Get the count of local timers, without flow limit

参数
[in]lastFetchTimeLast fetch time returned
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_property_save()

OPERATE_RET http_gw_property_save ( IN CONST CHAR_T *  data)

Save property to TUYA cloud

参数
[in]dataPrivate data to upload
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_register_V41()

OPERATE_RET http_gw_register_V41 ( OUT ty_cJSON **  result)

Register a device on TUYA cloud

参数
[out]resultJson encoded result
注解
This API is deprecated
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_gw_reset()

OPERATE_RET http_gw_reset ( IN CONST GW_WORK_STAT_T  stat)

Reset device

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

◆ http_gw_update_version_v41()

OPERATE_RET http_gw_update_version_v41 ( VOID  )

Update versions of device on TUYA cloud

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_iot_dns_get_cloud_url()

OPERATE_RET http_iot_dns_get_cloud_url ( VOID  )

Retrieve URLs from TUYA IoT DNS service, device will use URLs to interact with TUYA cloud later on

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

◆ http_iot_dns_get_fast_cloud_url()

OPERATE_RET http_iot_dns_get_fast_cloud_url ( CHAR_T *  env)

Retrieve special URLs from TUYA IoT DNS service, device will use URLs to interact with TUYA cloud later on

参数
[in]envDevice runtime env
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_iot_dns_get_host_ip()

OPERATE_RET http_iot_dns_get_host_ip ( IN CONST CHAR_T *  domain,
OUT ty_cJSON **  result 
)

Use TUYA IoT DNS service to translate domain to ip

参数
[in]domainDomain name
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_pskkey_get()

OPERATE_RET http_pskkey_get ( OUT ty_cJSON **  result)

Retrieve PSK key

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_put_cloud_config()

OPERATE_RET http_put_cloud_config ( IN CONST CHAR_T *  data)

Upload config to TUYA cloud

参数
[in]dataPrivate data to upload
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ http_put_rst_log()

OPERATE_RET http_put_rst_log ( VOID  )

Upload information of device reset to TUYA cloud

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

◆ http_url()

CHAR_T * http_url ( VOID  )

Retrieve active HTTP url of TUYA cloud

返回
NULL on error.

◆ httpc_active_shorturl_get()

OPERATE_RET httpc_active_shorturl_get ( char *  uuid,
char *  appid,
ty_cJSON **  result 
)

Retrieve short url of QR active

参数
[in]uuidUUID of device
[in]appidID of app
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_common_post()

OPERATE_RET httpc_common_post ( IN CONST CHAR_T *  api_name,
IN CONST CHAR_T *  api_ver,
IN CONST CHAR_T *  uuid,
IN CONST CHAR_T *  devid,
IN CHAR_T *  post_data,
IN CONST CHAR_T *  p_head_other,
OUT ty_cJSON **  pp_result 
)

POST HTTP request

参数
[in]api_nameName of API
[in]api_verVersion of API
[in]uuidUUID of device
[in]devidID of device
[in]post_dataPointer to data
[in]p_head_otherAdditional header to send
[out]pp_resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_common_post_no_remalloc()

OPERATE_RET httpc_common_post_no_remalloc ( IN CONST CHAR_T *  api_name,
IN CONST CHAR_T *  api_ver,
IN CONST CHAR_T *  uuid,
IN CONST CHAR_T *  devid,
IN CHAR_T *  post_data,
IN UINT_T  data_total_len,
IN CONST CHAR_T *  p_head_other,
OUT ty_cJSON **  pp_result 
)

POST HTTP request without memory realloc

参数
[in]api_nameName of API
[in]api_verVersion of API
[in]uuidUUID of device
[in]devidID of device
[in]post_dataPointer to data
[in]data_total_lenLength of data
[in]p_head_otherAdditional header to send
[out]pp_resultJson encoded result
注解
Caller ot this API shall ensure data buffer is bigger enough to include data padding
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_get_file()

OPERATE_RET httpc_get_file ( IN CONST CHAR_T *  url,
IN CONST UINT_T  mlk_buf_len,
IN CONST HTTP_GW_GET_FILE_DATA_CB  gfd_cb,
IN PVOID_T  priv_data,
IN CONST UINT_T  total_len,
IN CONST UINT_T  offset,
IN CONST BYTE_T *  p_key,
IN CONST UINT_T  key_len,
INOUT BYTE_T  file_hmac[32] 
)

Download file

参数
[in]urlURL of the file to download
[in]mlk_buf_lenblock size of dowload buffer
[in]gfd_cbHander when download file
[in]priv_dataPrivate data
[in]total_lenTotal length of file
[in]p_keyHTTP decode key
[in]key_lenLenght od decode key
[in,out]file_hmacHMAC of download file
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_gw_extra_erro_code_tranfer()

OPERATE_RET httpc_gw_extra_erro_code_tranfer ( char *  ErroValu)

Transfer HTTP error string to error code

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

◆ httpc_gw_get_device_auth()

OPERATE_RET httpc_gw_get_device_auth ( CHAR_T *  product_id,
CHAR_T *  product_secret,
CHAR_T *  client_id,
ty_cJSON **  result 
)

Retrieve UUID and authkey

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_iot_certificate_get_v10()

OPERATE_RET httpc_iot_certificate_get_v10 ( OUT ty_cJSON **  result,
IN CONST CHAR_T *  url_msg 
)

Retrieve certs of special domain

参数
[in]url_msgDomain name to get certs
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_iot_cloud_storage_encrypt_key_get()

OPERATE_RET httpc_iot_cloud_storage_encrypt_key_get ( OUT ty_cJSON **  result)

Retrieve encrypt key of cloud storage

参数
[out]resultJson encoded result
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_raw_close()

OPERATE_RET httpc_raw_close ( IN RAW_HTTP_S  p_raw_http)

Close raw HTTP request

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

◆ httpc_raw_get_with_head()

OPERATE_RET httpc_raw_get_with_head ( IN CONST CHAR_T *  p_url,
INOUT RAW_HTTP_S *  pp_raw_http,
IN UINT_T  offset,
IN UINT_T  total_len,
IN HTTP_HEAD_ADD_CB  add_head_cb,
IN VOID *  add_head_data 
)

Raw HTTP GET request

参数
[in]p_urlURL to request
[in,out]pp_raw_httpPointer to RAW_HTTP_S
[in]offsetOffset of buffer
[in]total_lenTotal length of buffer
[in]add_head_cbHook before HTTP request sent, to add more HTTP header
[in]add_head_dataHeader data of add_head_cb
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_raw_post()

OPERATE_RET httpc_raw_post ( IN CONST CHAR_T *  p_url,
IN CONST UINT_T  data_total_len,
INOUT RAW_HTTP_S *  pp_raw_http 
)

Raw HTTP POST request

参数
[in]p_urlURL to request
[in]data_total_lenTotal length of raw request
[in,out]pp_raw_httpPointer to RAW_HTTP_S
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_raw_put()

OPERATE_RET httpc_raw_put ( IN CONST CHAR_T *  p_url,
IN CONST UINT_T  data_total_len,
INOUT RAW_HTTP_S *  pp_raw_http 
)

Raw HTTP PUT request

参数
[in]p_urlURL to request
[in]data_total_lenTotal length of raw request
[in,out]pp_raw_httpPointer to RAW_HTTP_S
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_raw_read_content()

INT_T httpc_raw_read_content ( IN RAW_HTTP_S  p_raw_http,
IN BYTE_T *  buf,
IN CONST UINT_T  buf_len 
)

Read content of raw HTTP response

参数
[in]pp_raw_httpPointer to RAW_HTTP_S
[in]bufPointer of data to write
[in]buf_lenLength of buffer
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_raw_read_resp_header()

OPERATE_RET httpc_raw_read_resp_header ( INOUT RAW_HTTP_S  p_raw_http,
OUT INT_T *  p_status_code,
OUT BOOL_T *  p_chunked,
OUT UINT_T *  p_content_len 
)

Read header of raw HTTP respose

参数
[in,out]pp_raw_httpPointer to RAW_HTTP_S
[out]p_status_codeStatus code from HTTP response
[out]p_chunkedData is chunk or not
[out]p_content_lenTotal length of response content
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_raw_write_content()

INT_T httpc_raw_write_content ( IN RAW_HTTP_S  p_raw_http,
IN CONST BYTE_T *  buf,
IN CONST UINT_T  buf_len,
BOOL_T  chunked 
)

Write raw HTTP request

参数
[in]pp_raw_httpPointer to RAW_HTTP_S
[in]bufPointer of data to write
[in]buf_lenLength of buffer
[in]chunkedIs chunk enabled
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ httpc_update_localtime_set()

VOID httpc_update_localtime_set ( BOOL_T  is_auto_update)

Enable or disable time update from httpc (enable by default)

参数
[in]is_auto_updateAuto update from httpc or not

◆ tuya_set_atop_access()

OPERATE_RET tuya_set_atop_access ( ATOP_TYPE_E  type,
ATOP_ACCESS_E  access 
)

set atop access enable or disable

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