Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Macros | Typedefs | Enumerations | Functions
mx_wifi.h File Reference

Header for mx_wifi.c module. More...

#include "mx_wifi_conf.h"

Go to the source code of this file.

Data Structures

struct  mwifi_ip_attr_t
 Wi-Fi ip address info. More...
 
struct  mwifi_eap_attr_t
 Wi-Fi EAP info. More...
 
struct  MX_WIFI_IO_t
 Wi-Fi low level I/O interface operation handles. More...
 
struct  MX_WIFI_SystemInfo_t
 Wi-Fi system info. More...
 
struct  MX_WIFI_Network_t
 Wi-Fi station info. More...
 
struct  MX_WIFI_APSettings_t
 Wi-Fi softAP info. More...
 
struct  MX_WIFI_Runtime_t
 Wi-Fi runtime info. More...
 
struct  MX_WIFIObject_t
 Wi-Fi Wi-Fi object handle. More...
 
struct  mc_wifi_link_info_t
 Wi-Fi station link info. More...
 
struct  mwifi_ap_info_t
 
struct  sockaddr
 socket address struct More...
 
struct  in_addr
 socket address(net format) More...
 
struct  sockaddr_in
 socket address_in struct More...
 
struct  in6_addr
 socket address(IPV6 net format) More...
 
struct  sockaddr_in6
 socket address_in6 struct More...
 
struct  sockaddr_storage
 
struct  addrinfo
 socket address_in6 info More...
 
struct  _fd_set
 
struct  mc_mdns_service
 mDNS service info More...
 

Macros

#define MX_WIFI_STATUS_OK   (0)
 status code success. More...
 
#define MX_WIFI_STATUS_ERROR   (-1)
 status code common error. More...
 
#define MX_WIFI_STATUS_TIMEOUT   (-2)
 status code timeout. More...
 
#define MX_WIFI_STATUS_IO_ERROR   (-3)
 status code I/O error. More...
 
#define MX_WIFI_STATUS_PARAM_ERROR   (-4)
 status code bad argument error. More...
 
#define MX_WIFI_STATUS_T   int32_t
 status code. More...
 
#define MX_WIFI_MAC_SIZE   (6)
 max length of MAC address. More...
 
#define MX_WIFI_SCAN_BUF_SIZE   (2000)
 max size of scan buffer. More...
 
#define MIN(a, b)   ( ((a) < (b)) ? (a) : (b))
 helper function: get minimum. More...
 
#define FD_SETSIZE   64
 MAX fd number is 64 in MXOS. More...
 
#define NBBY   8
 number of bits in a byte. More...
 
#define NFDBITS   (sizeof(unsigned long) * NBBY)
 bits per mask More...
 
#define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= MC_FDSET_MASK(n))
 Add a fd to FD set. More...
 
#define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~MC_FDSET_MASK(n))
 Remove fd from FD set. More...
 
#define FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & MC_FDSET_MASK(n))
 Check if the fd is set in FD set. More...
 
#define FD_ZERO(p)    memset((p), 0, sizeof(*(p)))
 Clear FD set. More...
 
#define MDNS_MAX_LABEL_LEN   63 /* defined by the standard */
 Maximum length of labels. More...
 
#define MDNS_MAX_NAME_LEN   255 /* defined by the standard : 255*/
 Maximum length of names. More...
 
#define MDNS_MAX_KEYVAL_LEN   255 /* defined by the standard : 255*/
 Maximum length of key/value pair. More...
 
#define MDNS_PROTO_TCP   0
 protocol values for the proto member of the mdns_service descriptor More...
 
#define MDNS_PROTO_UDP   1
 UDP Protocol. More...
 
#define MAX_MDNS_LST   5 /* Maximum no. of services */
 Maximum no. More...
 
#define ERR_MDNS_BASE   -36650
 Starting error code for all mdns errors. More...
 
#define ERR_MDNS_INVAL   -36651
 invalid argument More...
 
#define ERR_MDNS_BADSRC   -36652
 bad service descriptor More...
 
#define ERR_MDNS_TOOBIG   -36653
 not enough room for everything More...
 
#define ERR_MDNS_NOIMPL   -36654
 unimplemented feature More...
 
#define ERR_MDNS_NOMEM   -36655
 insufficient memory More...
 
#define ERR_MDNS_INUSE   -36656
 requested resource is in use More...
 
#define ERR_MDNS_NORESP   -36657
 requested resource is in use More...
 
#define ERR_MDNS_FSOC   -36658
 failed to create socket for mdns More...
 
#define ERR_MDNS_FREUSE   -36659
 failed to reuse multicast socket More...
 
#define ERR_MDNS_FBINDTODEVICE   -36660
 failed to bind mdns socket to device More...
 
#define ERR_MDNS_FBIND   -36661
 failed to bind mdns socket More...
 
#define ERR_MDNS_FMCAST_JOIN   -36662
 failed to join multicast socket More...
 
#define ERR_MDNS_FMCAST_SET   -36663
 failed to set multicast socket More...
 
#define ERR_MDNS_FQUERY_SOC   -36664
 failed to create query socket More...
 
#define ERR_MDNS_FQUERY_THREAD   -36665
 failed to create mdns thread More...
 
#define ERR_MDNS_END   -36670
 Last generic error code (inclusive) More...
 

Typedefs

typedef uint8_t mwifi_if_t
 wifi mode. More...
 
typedef uint8_t mc_wifi_scan_mode_t
 wifi scan mode. More...
 
typedef int8_t(* IO_Init_Func) (uint16_t mode)
 I/O interface init function. More...
 
typedef int8_t(* IO_DeInit_Func) (void)
 I/O interface deinit function. More...
 
typedef void(* IO_Delay_Func) (uint32_t ms)
 I/O interface delay function. More...
 
typedef uint16_t(* IO_Send_Func) (uint8_t *data, uint16_t len)
 I/O interface send function. More...
 
typedef uint16_t(* IO_Receive_Func) (uint8_t *buffer, uint16_t buff_size)
 I/O interface receive function. More...
 
typedef void(* mx_wifi_status_callback_t) (uint8_t cate, uint8_t event, void *arg)
 Prototype of Wi-Fi status changed callback function. More...
 
typedef void(* mx_wifi_fota_status_cb_t) (mx_wifi_fota_status_e status, uint32_t user_args)
 Prototype of FOTA status callback function. More...
 
typedef void(* mx_wifi_netlink_input_cb_t) (mx_buf_t *pbuf, void *user_args)
 Prototype of netlink input callback function for network bypass mode. More...
 
typedef uint8_t mwifi_security_t
 Wi-Fi softAP info. More...
 
typedef void * mtls_t
 mxchip TLS handler type More...
 

Enumerations

Functions

int32_t MX_WIFI_RegisterBusIO (MX_WIFIObject_t *Obj, IO_Init_Func IO_Init, IO_DeInit_Func IO_DeInit, IO_Delay_Func IO_Delay, IO_Send_Func IO_Send, IO_Receive_Func IO_Receive)
 Register low level IO interface. More...
 
int32_t MX_WIFI_HardResetModule (MX_WIFIObject_t *Obj)
 Reset wifi module by hardware IO. More...
 
int32_t MX_WIFI_Init (MX_WIFIObject_t *Obj)
 Initialize WIFI module and get module fw & mac info. More...
 
int32_t MX_WIFI_DeInit (MX_WIFIObject_t *Obj)
 DeInitialize WIFI module. More...
 
int32_t MX_WIFI_SetTimeout (MX_WIFIObject_t *Obj, uint32_t Timeout)
 Change default Timeout for wifi cmd. More...
 
int32_t MX_WIFI_IO_YIELD (MX_WIFIObject_t *Obj, uint32_t timeout)
 Yield data from Wi-Fi module. More...
 
int32_t MX_WIFI_station_powersave (MX_WIFIObject_t *Obj, int32_t ps_onoff)
 set powersave onoff for wifi station mode. More...
 
int32_t MX_WIFI_ResetModule (MX_WIFIObject_t *Obj)
 Reset the module by Software. More...
 
int32_t MX_WIFI_ResetToFactoryDefault (MX_WIFIObject_t *Obj)
 Reset To factory defaults. More...
 
int32_t MX_WIFI_GetVersion (MX_WIFIObject_t *Obj, uint8_t *version, uint32_t size)
 Get the firmware version string of the wifi module. More...
 
int32_t MX_WIFI_GetMACAddress (MX_WIFIObject_t *Obj, uint8_t *mac)
 Get the MAC address of the wifi module. More...
 
int32_t MX_WIFI_Scan (MX_WIFIObject_t *Obj, mc_wifi_scan_mode_t scan_mode, char *ssid, int32_t len)
 wifi block scan More...
 
int8_t MX_WIFI_Get_scan_result (MX_WIFIObject_t *Obj, uint8_t *results, uint8_t number)
 wifi get scan result More...
 
int32_t MX_WIFI_RegisterStatusCallback (MX_WIFIObject_t *Obj, mx_wifi_status_callback_t cb, void *arg)
 Register wifi status changed callback. More...
 
int32_t MX_WIFI_RegisterStatusCallback_if (MX_WIFIObject_t *Obj, mx_wifi_status_callback_t cb, void *arg, mwifi_if_t interface)
 < status code. More...
 
int32_t MX_WIFI_UnRegisterStatusCallback (MX_WIFIObject_t *Obj)
 UnRegister wifi status changed callback. More...
 
int32_t MX_WIFI_UnRegisterStatusCallback_if (MX_WIFIObject_t *Obj, mwifi_if_t interface)
 < status code. More...
 
int32_t MX_WIFI_Connect (MX_WIFIObject_t *Obj, const char *SSID, const char *Password, MX_WIFI_SecurityType_t SecType)
 Join an Access point. More...
 
int32_t MX_WIFI_EAP_Connect (MX_WIFIObject_t *Obj, const char *SSID, const char *Identity, const char *Password, mwifi_eap_attr_t *attr, mwifi_ip_attr_t *ip)
 Join an Access point with WPA-E. More...
 
int32_t MX_WIFI_Disconnect (MX_WIFIObject_t *Obj)
 Disconnect from a network. More...
 
int32_t MX_WIFI_WPS_Connect (MX_WIFIObject_t *Obj)
 Join an Access point with WPS (PUSH-BUTTON) mode. More...
 
int32_t MX_WIFI_WPS_Stop (MX_WIFIObject_t *Obj)
 Stop WPS connect. More...
 
int8_t MX_WIFI_IsConnected (MX_WIFIObject_t *Obj)
 Check whether the module is connected to an access point. More...
 
int32_t MX_WIFI_GetIPAddress (MX_WIFIObject_t *Obj, uint8_t *ipaddr, mwifi_if_t wifi_if)
 Get the local IPv4 address of the wifi module. More...
 
int32_t MX_WIFI_GetIP6Address (MX_WIFIObject_t *Obj, uint8_t *ipaddr6, int32_t addr_num, mwifi_if_t wifi_if)
 Get the local IPv6 address of the wifi module. More...
 
int32_t MX_WIFI_GetIP6AddressState (MX_WIFIObject_t *Obj, int32_t addr_num, mwifi_if_t wifi_if)
 Get the local IPv6 address state of the wifi module. More...
 
int32_t MX_WIFI_StartAP (MX_WIFIObject_t *Obj, MX_WIFI_APSettings_t *ap_settings)
 Start softAP(miniAP) mode. More...
 
int32_t MX_WIFI_StopAP (MX_WIFIObject_t *Obj)
 Stop softAP(miniAP) mode. More...
 
int32_t MX_WIFI_Socket_create (MX_WIFIObject_t *Obj, int32_t domain, int32_t type, int32_t protocol)
 Create a socket. More...
 
int32_t MX_WIFI_Socket_setsockopt (MX_WIFIObject_t *Obj, int32_t sockfd, int32_t level, int32_t optname, const void *optvalue, int32_t optlen)
 Set option for a socket. More...
 
int32_t MX_WIFI_Socket_getsockopt (MX_WIFIObject_t *Obj, int32_t sockfd, int32_t level, int32_t optname, void *optvalue, uint32_t *optlen)
 Get option of a socket. More...
 
int32_t MX_WIFI_Socket_bind (MX_WIFIObject_t *Obj, int32_t sockfd, const struct sockaddr *addr, int32_t addrlen)
 Bind a socket. More...
 
int32_t MX_WIFI_Socket_listen (MX_WIFIObject_t *Obj, int32_t sockfd, int32_t backlog)
 Listen a socket. More...
 
int32_t MX_WIFI_Socket_accept (MX_WIFIObject_t *Obj, int32_t sockfd, struct sockaddr *addr, uint32_t *addrlen)
 Accept a socket. More...
 
int32_t MX_WIFI_Socket_connect (MX_WIFIObject_t *Obj, int32_t sockfd, const struct sockaddr *addr, int32_t addrlen)
 Socket connect. More...
 
int32_t MX_WIFI_Socket_shutdown (MX_WIFIObject_t *Obj, int32_t sockfd, int32_t mode)
 Socket shutdown. More...
 
int32_t MX_WIFI_Socket_close (MX_WIFIObject_t *Obj, int32_t sockfd)
 Socket close. More...
 
int32_t MX_WIFI_Socket_send (MX_WIFIObject_t *Obj, int32_t sockfd, uint8_t *buf, int32_t len, int32_t flags)
 Socket send. More...
 
int32_t MX_WIFI_Socket_recv (MX_WIFIObject_t *Obj, int32_t sockfd, uint8_t *buf, int32_t len, int32_t flags)
 Socket recv. More...
 
int32_t MX_WIFI_Socket_sendto (MX_WIFIObject_t *Obj, int32_t sockfd, uint8_t *buf, int32_t len, int32_t flags, struct sockaddr *toaddr, int32_t toaddrlen)
 Socket sendto. More...
 
int32_t MX_WIFI_Socket_recvfrom (MX_WIFIObject_t *Obj, int32_t sockfd, uint8_t *buf, int32_t len, int32_t flags, struct sockaddr *fromaddr, uint32_t *fromaddrlen)
 Socket recvfrom. More...
 
int32_t MX_WIFI_Socket_gethostbyname (MX_WIFIObject_t *Obj, struct sockaddr *addr, char *name)
 Gethostbyname, only for IPv4 address. More...
 
int32_t MX_WIFI_Socket_ping (MX_WIFIObject_t *Obj, const char *hostname, int32_t count, int32_t delay, int32_t response[])
 Ping a host, only for IPv4 address. More...
 
int32_t MX_WIFI_Socket_getpeername (MX_WIFIObject_t *Obj, int32_t sockfd, struct sockaddr *addr, uint32_t *addrlen)
 socket getpeername. More...
 
int32_t MX_WIFI_Socket_getsockname (MX_WIFIObject_t *Obj, int32_t sockfd, struct sockaddr *addr, uint32_t *addrlen)
 socket getsockname. More...
 
int32_t MX_WIFI_MDNS_start (MX_WIFIObject_t *Obj, const char *domain, char *hostname)
 start mDNS service. More...
 
int32_t MX_WIFI_MDNS_stop (MX_WIFIObject_t *Obj)
 stop mDNS service. More...
 
int32_t MX_WIFI_MDNS_announce_service (MX_WIFIObject_t *Obj, struct mc_mdns_service *service, mwifi_if_t interface)
 announce a service. More...
 
int32_t MX_WIFI_MDNS_deannounce_service (MX_WIFIObject_t *Obj, struct mc_mdns_service *service, mwifi_if_t interface)
 deannounce a service. More...
 
int32_t MX_WIFI_MDNS_deannounce_service_all (MX_WIFIObject_t *Obj, mwifi_if_t interface)
 deannounce all services. More...
 
int32_t MX_WIFI_MDNS_iface_state_change (MX_WIFIObject_t *Obj, mwifi_if_t interface, enum iface_state state)
 Send interface state change event to mdns. More...
 
int32_t MX_WIFI_MDNS_set_hostname (MX_WIFIObject_t *Obj, char *hostname)
 Set new host name, use mdns_iface_state_change(interface, REANNOUNCE) to anounce the new host name. More...
 
int32_t MX_WIFI_MDNS_set_txt_rec (MX_WIFIObject_t *Obj, struct mc_mdns_service *service, char *keyvals, char separator)
 sets the TXT record field for a given mDNS service. More...
 
int32_t MX_WIFI_TLS_set_ver (MX_WIFIObject_t *Obj, mtls_ver_t version)
 set the TLS protocol version. More...
 
int32_t MX_WIFI_TLS_set_clientCertificate (MX_WIFIObject_t *Obj, uint8_t *client_cert, uint16_t cert_len)
 TLS set client certificate. More...
 
int32_t MX_WIFI_TLS_set_clientPrivateKey (MX_WIFIObject_t *Obj, uint8_t *client_private_key, uint16_t key_len)
 TLS set client private key. More...
 
int32_t MX_WIFI_TLS_connect (MX_WIFIObject_t *Obj, int32_t domain, int32_t type, int32_t protocol, const struct sockaddr *addr, int32_t addrlen, char *ca, int32_t calen)
 TLS client create a TLS connection. More...
 
int32_t MX_WIFI_TLS_connect_sni (MX_WIFIObject_t *Obj, const char *sni_servername, int32_t sni_servername_len, const struct sockaddr *addr, int32_t addrlen, char *ca, int32_t calen)
 TLS client create a TLS connection with SNI. More...
 
int32_t MX_WIFI_TLS_send (MX_WIFIObject_t *Obj, mtls_t tls, void *data, int32_t len)
 TLS send data. More...
 
int32_t MX_WIFI_TLS_recv (MX_WIFIObject_t *Obj, mtls_t tls, void *buf, int32_t len)
 TLS redeive data. More...
 
int32_t MX_WIFI_TLS_close (MX_WIFIObject_t *Obj, mtls_t tls)
 Close the TLS session, release resource. More...
 
int32_t MX_WIFI_TLS_set_nonblock (MX_WIFIObject_t *Obj, mtls_t tls, int32_t nonblock)
 Set TLS nonblock mode. More...
 
int32_t MX_WIFI_Webserver_start (MX_WIFIObject_t *Obj)
 Start webserver. More...
 
int32_t MX_WIFI_Webserver_stop (MX_WIFIObject_t *Obj)
 Stop webserver. More...
 
int32_t MX_WIFI_FOTA_start (MX_WIFIObject_t *Obj, const char *url, const char *md5, mx_wifi_fota_status_cb_t fota_status_callback, uint32_t user_args)
 Start FOTA. More...
 

Detailed Description

Header for mx_wifi.c module.

Author
MCD Application Team
Attention

Copyright (c) 2021 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file mx_wifi.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.