|
TuyaOS
|
Common process - adapter the wi-fi api 更多...
#include "tuya_cloud_types.h"

结构体 | |
| struct | FAST_WF_CONNECTED_AP_INFO_T |
宏定义 | |
| #define | WIFI_PASSWD_LEN 64 |
| #define | WIFI_SSID_LEN 32 |
类型定义 | |
| typedef VOID_T(* | SNIFFER_CALLBACK) (CONST UINT8_T *buf, CONST UINT16_T len, CONST INT8_T rssi) |
| callback function: SNIFFER_CALLBACK when wifi sniffers package from air, notify tuyaos with this callback. the package should include 更多... | |
| typedef VOID_T(* | WIFI_EVENT_CB) (WF_EVENT_E event, VOID_T *arg) |
| callback function: WIFI_STATUS_CHANGE_CB when wifi connect status changed, notify tuyaos with this callback. 更多... | |
| typedef VOID_T(* | WIFI_REV_MGNT_CB) (UCHAR_T *buf, UINT_T len) |
| callback function: WIFI_REV_MGNT_CB when receive wifi management frame, notify tuyaos with this callback. 更多... | |
枚举 | |
| enum | COUNTRY_CODE_E { COUNTRY_CODE_CN , COUNTRY_CODE_US , COUNTRY_CODE_JP , COUNTRY_CODE_EU } |
| enum | WF_AP_AUTH_MODE_E { WAAM_OPEN = 0 , WAAM_WEP , WAAM_WPA_PSK , WAAM_WPA2_PSK , WAAM_WPA_WPA2_PSK , WAAM_WPA_WPA3_SAE , WAAM_UNKNOWN } |
| enum | WF_EVENT_E { WFE_CONNECTED , WFE_CONNECT_FAILED , WFE_DISCONNECTED } |
| enum | WF_IF_E { WF_STATION = 0 , WF_AP } |
| enum | WF_IOCTL_CMD_E { WFI_BEACON_CMD } |
| enum | WF_STATION_STAT_E { WSS_IDLE = 0 , WSS_CONNECTING , WSS_PASSWD_WRONG , WSS_NO_AP_FOUND , WSS_CONN_FAIL , WSS_CONN_SUCCESS , WSS_GOT_IP } |
| enum | WF_WK_MD_E { WWM_POWERDOWN = 0 , WWM_SNIFFER , WWM_STATION , WWM_SOFTAP , WWM_STATIONAP , WWM_UNKNOWN } |
函数 | |
| OPERATE_RET | tkl_wifi_get_bssid (UCHAR_T *mac) |
| get wifi bssid 更多... | |
| OPERATE_RET | tkl_wifi_get_connected_ap_info (FAST_WF_CONNECTED_AP_INFO_T **fast_ap_info) |
| : get ap info for fast connect 更多... | |
| OPERATE_RET | tkl_wifi_get_cur_channel (UCHAR_T *chan) |
| get wifi interface work channel 更多... | |
| OPERATE_RET | tkl_wifi_get_ip (CONST WF_IF_E wf, NW_IP_S *ip) |
| get wifi ip info.when wifi works in ap+station mode, wifi has two ips. 更多... | |
| OPERATE_RET | tkl_wifi_get_mac (CONST WF_IF_E wf, NW_MAC_S *mac) |
| get wifi mac info.when wifi works in ap+station mode, wifi has two macs. 更多... | |
| OPERATE_RET | tkl_wifi_get_work_mode (WF_WK_MD_E *mode) |
| get wifi work mode 更多... | |
| OPERATE_RET | tkl_wifi_init (WIFI_EVENT_CB cb) |
| set wifi station work status changed callback 更多... | |
| OPERATE_RET | tkl_wifi_ioctl (WF_IOCTL_CMD_E cmd, VOID *args) |
| wifi ioctl 更多... | |
| OPERATE_RET | tkl_wifi_register_recv_mgnt_callback (CONST BOOL_T enable, CONST WIFI_REV_MGNT_CB recv_cb) |
| register receive wifi management callback 更多... | |
| OPERATE_RET | tkl_wifi_release_ap (AP_IF_S *ap) |
| release the memory malloced in <tkl_wifi_ap_scan> if needed. tuyaos will call this function when the ap info is no use. 更多... | |
| OPERATE_RET | tkl_wifi_scan_ap (CONST SCHAR_T *ssid, AP_IF_S **ap_ary, UINT_T *num) |
| scan current environment and obtain the ap infos in current environment 更多... | |
| OPERATE_RET | tkl_wifi_send_mgnt (CONST UCHAR_T *buf, CONST UINT_T len) |
| send wifi management 更多... | |
| OPERATE_RET | tkl_wifi_set_country_code (CONST COUNTRY_CODE_E ccode) |
| set wifi country code 更多... | |
| OPERATE_RET | tkl_wifi_set_cur_channel (CONST UCHAR_T chan) |
| set wifi interface work channel 更多... | |
| OPERATE_RET | tkl_wifi_set_lp_mode (CONST BOOL_T enable, CONST UCHAR_T dtim) |
| set wifi lowpower mode 更多... | |
| OPERATE_RET | tkl_wifi_set_mac (CONST WF_IF_E wf, CONST NW_MAC_S *mac) |
| set wifi mac info.when wifi works in ap+station mode, wifi has two macs. 更多... | |
| OPERATE_RET | tkl_wifi_set_rf_calibrated (VOID_T) |
| do wifi calibration 更多... | |
| OPERATE_RET | tkl_wifi_set_sniffer (CONST BOOL_T en, CONST SNIFFER_CALLBACK cb) |
| enable / disable wifi sniffer mode. if wifi sniffer mode is enabled, wifi recv from packages from the air, and user shoud send these packages to tuya-sdk with callback <cb>. 更多... | |
| OPERATE_RET | tkl_wifi_set_work_mode (CONST WF_WK_MD_E mode) |
| set wifi work mode 更多... | |
| OPERATE_RET | tkl_wifi_start_ap (CONST WF_AP_CFG_IF_S *cfg) |
| start a soft ap 更多... | |
| OPERATE_RET | tkl_wifi_station_connect (CONST SCHAR_T *ssid, CONST SCHAR_T *passwd) |
| connect wifi with ssid and passwd 更多... | |
| OPERATE_RET | tkl_wifi_station_disconnect (VOID_T) |
| disconnect wifi from connect ap 更多... | |
| OPERATE_RET | tkl_wifi_station_fast_connect (CONST FAST_WF_CONNECTED_AP_INFO_T *fast_ap_info) |
| : fast connect 更多... | |
| OPERATE_RET | tkl_wifi_station_get_conn_ap_rssi (SCHAR_T *rssi) |
| get wifi connect rssi 更多... | |
| OPERATE_RET | tkl_wifi_station_get_status (WF_STATION_STAT_E *stat) |
| get wifi station work status 更多... | |
| OPERATE_RET | tkl_wifi_stop_ap (VOID_T) |
| stop a soft ap 更多... | |
Common process - adapter the wi-fi api
Common process - adapter the wi-fi hostap api
| typedef VOID_T(* SNIFFER_CALLBACK) (CONST UINT8_T *buf, CONST UINT16_T len, CONST INT8_T rssi) |
callback function: SNIFFER_CALLBACK when wifi sniffers package from air, notify tuyaos with this callback. the package should include
| [in] | buf | the buf wifi recv |
| [in] | len | the len of buf |
| typedef VOID_T(* WIFI_EVENT_CB) (WF_EVENT_E event, VOID_T *arg) |
callback function: WIFI_STATUS_CHANGE_CB when wifi connect status changed, notify tuyaos with this callback.
| [out] | is_up | the wifi link status is up or not |
| typedef VOID_T(* WIFI_REV_MGNT_CB) (UCHAR_T *buf, UINT_T len) |
callback function: WIFI_REV_MGNT_CB when receive wifi management frame, notify tuyaos with this callback.
| [in] | buf | the buf wifi recv |
| [in] | len | the len of buf |
| enum WF_AP_AUTH_MODE_E |
| enum WF_IF_E |
| enum WF_STATION_STAT_E |
| enum WF_WK_MD_E |
| OPERATE_RET tkl_wifi_get_bssid | ( | UCHAR_T * | mac | ) |
get wifi bssid
| [out] | mac | uplink mac |
| OPERATE_RET tkl_wifi_get_connected_ap_info | ( | FAST_WF_CONNECTED_AP_INFO_T ** | fast_ap_info | ) |
: get ap info for fast connect
| [out] | fast_ap_info |
| OPERATE_RET tkl_wifi_get_cur_channel | ( | UCHAR_T * | chan | ) |
get wifi interface work channel
| [out] | chan | the channel wifi works |
get wifi ip info.when wifi works in ap+station mode, wifi has two ips.
| [in] | wf | wifi function type |
| [out] | ip | the ip addr info |
get wifi mac info.when wifi works in ap+station mode, wifi has two macs.
| [in] | wf | wifi function type |
| [out] | mac | the mac info |
| OPERATE_RET tkl_wifi_get_work_mode | ( | WF_WK_MD_E * | mode | ) |
get wifi work mode
| [out] | mode | wifi work mode |
| OPERATE_RET tkl_wifi_init | ( | WIFI_EVENT_CB | cb | ) |
set wifi station work status changed callback
| [in] | cb | the wifi station work status changed callback |
| OPERATE_RET tkl_wifi_ioctl | ( | WF_IOCTL_CMD_E | cmd, |
| VOID * | args | ||
| ) |
wifi ioctl
| [in] | cmd | refer to WF_IOCTL_CMD_E |
| [in] | args | args associated with the command |
| OPERATE_RET tkl_wifi_register_recv_mgnt_callback | ( | CONST BOOL_T | enable, |
| CONST WIFI_REV_MGNT_CB | recv_cb | ||
| ) |
register receive wifi management callback
| [in] | enable | |
| [in] | recv_cb | receive callback |
| OPERATE_RET tkl_wifi_release_ap | ( | AP_IF_S * | ap | ) |
release the memory malloced in <tkl_wifi_ap_scan> if needed. tuyaos will call this function when the ap info is no use.
| [in] | ap | the ap info |
| OPERATE_RET tkl_wifi_scan_ap | ( | CONST SCHAR_T * | ssid, |
| AP_IF_S ** | ap_ary, | ||
| UINT_T * | num | ||
| ) |
scan current environment and obtain the ap infos in current environment
| [in] | ssid | the specific ssid |
| [out] | ap_ary | current ap info array |
| [out] | num | the num of ar_ary |
| OPERATE_RET tkl_wifi_send_mgnt | ( | CONST UCHAR_T * | buf, |
| CONST UINT_T | len | ||
| ) |
send wifi management
| [in] | buf | pointer to buffer |
| [in] | len | length of buffer |
| OPERATE_RET tkl_wifi_set_country_code | ( | CONST COUNTRY_CODE_E | ccode | ) |
set wifi country code
| [in] | ccode | country code |
| OPERATE_RET tkl_wifi_set_cur_channel | ( | CONST UCHAR_T | chan | ) |
set wifi interface work channel
| [in] | chan | the channel to set |
| OPERATE_RET tkl_wifi_set_lp_mode | ( | CONST BOOL_T | enable, |
| CONST UCHAR_T | dtim | ||
| ) |
set wifi lowpower mode
| [in] | enable | enbale lowpower mode |
| [in] | dtim | the wifi dtim |
set wifi mac info.when wifi works in ap+station mode, wifi has two macs.
| [in] | wf | wifi function type |
| [in] | mac | the mac info |
| OPERATE_RET tkl_wifi_set_rf_calibrated | ( | VOID_T | ) |
do wifi calibration
| OPERATE_RET tkl_wifi_set_sniffer | ( | CONST BOOL_T | en, |
| CONST SNIFFER_CALLBACK | cb | ||
| ) |
enable / disable wifi sniffer mode. if wifi sniffer mode is enabled, wifi recv from packages from the air, and user shoud send these packages to tuya-sdk with callback <cb>.
| [in] | en | enable or disable |
| [in] | cb | notify callback |
| OPERATE_RET tkl_wifi_set_work_mode | ( | CONST WF_WK_MD_E | mode | ) |
set wifi work mode
| [in] | mode | wifi work mode |
| OPERATE_RET tkl_wifi_start_ap | ( | CONST WF_AP_CFG_IF_S * | cfg | ) |
start a soft ap
| [in] | cfg | the soft ap config |
| OPERATE_RET tkl_wifi_station_connect | ( | CONST SCHAR_T * | ssid, |
| CONST SCHAR_T * | passwd | ||
| ) |
connect wifi with ssid and passwd
| [in] | ssid | |
| [in] | passwd |
| OPERATE_RET tkl_wifi_station_disconnect | ( | VOID_T | ) |
disconnect wifi from connect ap
| OPERATE_RET tkl_wifi_station_fast_connect | ( | CONST FAST_WF_CONNECTED_AP_INFO_T * | fast_ap_info | ) |
: fast connect
| [in] | fast_ap_info |
| OPERATE_RET tkl_wifi_station_get_conn_ap_rssi | ( | SCHAR_T * | rssi | ) |
get wifi connect rssi
| [out] | rssi | the return rssi |
| OPERATE_RET tkl_wifi_station_get_status | ( | WF_STATION_STAT_E * | stat | ) |
get wifi station work status
| [out] | stat | the wifi station work status |
| OPERATE_RET tkl_wifi_stop_ap | ( | VOID_T | ) |
stop a soft ap