Documentation

Documentation

Includes

tuya_hal_wifi.h

#include "tuya_hal_wifi.h"
#include "tuya_hal_wifi.h"

tuya_cloud_types.h

#include "tuya_cloud_types.h"
#include "tuya_cloud_types.h"

tuya_hal_network.h

#include "tuya_hal_network.h"
#include "tuya_hal_network.h"

Macros

Marco _WF_BASIC_INTF_H

#define _WF_BASIC_INTF_H


      

Marco __WF_BASIC_INTF_EXT

#define __WF_BASIC_INTF_EXT


      

Marco __WF_BASIC_INTF_EXT

#define __WF_BASIC_INTF_EXT extern

      

Functions

Vars

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_all_ap_scan(OUT AP_IF_S **ap_ary,OUT UINT_T *num);


      

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_assign_ap_scan(IN CONST CHAR_T *ssid,OUT AP_IF_S **ap);
/**
 * @brief do wifi Scan with specificed SSID.
 *
 * @param[in] ssid the ssid to be scaned 
 * @param[out] ap ap info of the ssid
 *
 * @note must set station mode first.
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_release_ap(IN AP_IF_S *ap);
/**
 * @brief free ap memory.
 *
 * @param[in] ap the ap info to be free 
 *
 * @note called after wf_all_ap_scan or wf_assign_ap_scan
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_set_cur_channel(IN CONST BYTE_T chan);


      

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_get_cur_channel(OUT BYTE_T *chan);


      

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_sniffer_set(IN CONST BOOL_T en,IN CONST SNIFFER_CALLBACK cb);


      

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_get_ip(IN CONST WF_IF_E wf,OUT NW_IP_S *ip);
/**
 * @brief get wifi ip.
 *
 * @param[in] wf station or ap  
 *
 * @param[out] ip ip address of station or ap
 *
 * @note called in station mode or ap mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_get_mac(IN CONST WF_IF_E wf,OUT NW_MAC_S *mac);
/**
 * @brief get wifi mac address.
 *
 * @param[in] wf station or ap  
 *
 * @param[out] mac mac address of station or ap
 *
 * @note called in station mode or ap mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_set_mac(IN CONST WF_IF_E wf,IN CONST NW_MAC_S *mac);


      

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_wk_mode_set(IN CONST WF_WK_MD_E mode);
/**
 * @brief set wifi work mode.
 *
 * @param[in] mode wifi work mode,such as station, soft ap...
 *
 * @note called before other wifi operation
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_wk_mode_get(OUT WF_WK_MD_E *mode);
/**
 * @brief get wifi work mode.
 *
 * @param[out] mode current wifi work mode
 *
 * @note 
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_get_connected_ap_info(OUT FAST_WF_CONNECTED_AP_INFO_V2_S **fast_ap_info);
/**
 * @brief get connect ap info.
 *
 * @param[out] fast_ap_info the ap infomation of the connected ap
 *
 * @note called after wifi connection has established in station mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_fast_station_connect(IN FAST_WF_CONNECTED_AP_INFO_V2_S *fast_ap_info);
/**
 * @brief do fast wifi connect.
 *
 * @param[in] fast_ap_info the ap infomation of the ap to be connected
 *
 * @note called after wf_get_connected_ap_info is called
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_station_connect(IN CONST CHAR_T *ssid,IN CONST CHAR_T *passwd);
/**
 * @brief do wifi connect in station mode.
 *
 * @param[in] ssid the ssid of the ap to be connected
 *
 * @param[in] passwd the passwd of the ap to be connected
 *
 * @note called in station mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_station_disconnect(VOID);


      

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_station_get_conn_ap_rssi(OUT SCHAR_T *rssi);
/**
 * @brief get rssi of the connected ap.
 *
 * @param[out] rssi the rssi of the connected ap
 *
 * @note called after connection has established in station mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_station_stat_get(OUT WF_STATION_STAT_E *stat);
/**
 * @brief get wifi station stat.
 *
 * @param[out] stat the stat in the station mode,refer to WF_STATION_STAT_E 
 *
 * @note called after wf_station_connect
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_ap_start(IN CONST WF_AP_CFG_IF_S *cfg);
/**
 * @brief start ap in ap mode.
 *
 * @param[in] cfg the configuration of the ap 
 *
 * @note called in wifi ap mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_ap_stop(VOID);
/**
 * @brief stop ap in ap mode.
 *
 * @note called in wifi ap mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_get_ap_mac(INOUT NW_MAC_S *mac);
/**
 * @brief get the ap mac address.
 *
 * @note called in wifi ap mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_set_country_code(IN CONST CHAR_T *p_country_code);
/**
 * @brief set the wifi country code.
 *
 * @note called in wifi ap mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET wf_get_country_code(IN CONST CHAR_T *p_country_code);
/**
 * @brief get the wifi country code.
 *
 * @note called after wf_set_country_code
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
VOID_T tuya_wifi_set_lps_dtim(const unsigned int dtim);
/**
 * @brief set the wifi low power dtim.
 *
 * @note called before enter wifi low power mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET tuya_wifi_lp_disable(VOID);
/**
 * @brief disable the wifi low power mode.
 *
 * @note called when exiting wifi low power mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET tuya_wifi_lp_enable(VOID);
/**
 * @brief enable the wifi low power mode.
 *
 * @note called when entering wifi low power mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET tuya_cpu_lp_disable(VOID);
/**
 * @brief disable the cpu low power mode.
 *
 * @note called when exiting wifi low power mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
OPERATE_RET tuya_cpu_lp_enable(VOID);
/**
 * @brief enable the cpu low power mode.
 *
 * @note called when entering wifi low power mode
 *
 * @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
 */

Variable __WF_BASIC_INTF_EXT

__WF_BASIC_INTF_EXT \
BOOL_T wf_rf_calibrated(VOID_T);

      

Consts

Types

Typedefs