Fork of 
        DISCO_L475VG_IOT01A_wifi 
        by  ST 
« Back to documentation index 
    
wifi.c File Reference 
WIFI interface file.  
More... 
Go to the source code of this file. 
WIFI_Status_t  WIFI_Init  (void)  Initialiaze the WIFI core.   WIFI_Status_t  WIFI_ListAccessPoints  (WIFI_APs_t *APs, uint8_t AP_MaxNbr)  List a defined number of vailable access points.   WIFI_Status_t  WIFI_Connect  (const char *SSID, const char *Password, WIFI_Ecn_t ecn)  Join an Access Point.   WIFI_Status_t  WIFI_GetMAC_Address  (uint8_t *mac)  This function retrieves the WiFi interface's MAC address.   WIFI_Status_t  WIFI_GetIP_Address  (uint8_t *ipaddr)  This function retrieves the WiFi interface's IP address.   WIFI_Status_t  WIFI_Disconnect  (void)  Disconnect from a network.   WIFI_Status_t  WIFI_ConfigureAP  (uint8_t *ssid, uint8_t *pass, WIFI_Ecn_t ecn, uint8_t channel, uint8_t max_conn)  Configure an Access Point.   WIFI_Status_t  WIFI_HandleAPEvents  (WIFI_APSettings_t *setting)  Handle the background events of the wifi module.   WIFI_Status_t  WIFI_Ping  (uint8_t *ipaddr, uint16_t count, uint16_t interval_ms)  Ping an IP address in the network.   WIFI_Status_t  WIFI_GetHostAddress  (char *location, uint8_t *ipaddr)  Get IP address from URL using DNS.   WIFI_Status_t  WIFI_OpenClientConnection  (uint32_t socket, WIFI_Protocol_t type, const char *name, uint8_t *ipaddr, uint16_t port, uint16_t local_port)  Configure and start a client connection.   WIFI_Status_t  WIFI_CloseClientConnection  (uint32_t socket)  Close client connection.   WIFI_Status_t  WIFI_StartServer  (uint32_t socket, WIFI_Protocol_t protocol, const char *name, uint16_t port)  Configure and start a Server.   WIFI_Status_t  WIFI_StopServer  (uint32_t socket)  Stop a server.   WIFI_Status_t  WIFI_SendData  (uint8_t socket, uint8_t *pdata, uint16_t Reqlen, uint16_t *SentDatalen, uint32_t Timeout)  Send Data on a socket.   WIFI_Status_t  WIFI_ReceiveData  (uint8_t socket, uint8_t *pdata, uint16_t Reqlen, uint16_t *RcvDatalen, uint32_t Timeout)  Receive Data from a socket.   WIFI_Status_t  WIFI_SetOEMProperties  (const char *name, uint8_t *Mac)  Customize module data.   WIFI_Status_t  WIFI_ResetModule  (void)  Reset the WIFI module.   WIFI_Status_t  WIFI_SetModuleDefault  (void)  Restore module default configuration.   WIFI_Status_t  WIFI_ModuleFirmwareUpdate  (const char *location)  Update module firmware.   WIFI_Status_t  WIFI_GetModuleFwRevision  (char *rev)  Return Module firmware revision.   WIFI_Status_t  WIFI_GetModuleID  (char *Id)  Return Module ID.   WIFI_Status_t  WIFI_GetModuleName  (char *ModuleName)  Return Module Name.   
Detailed Description 
WIFI interface file. 
Author: MCD Application Team  Version: V1.8.0  Date: 21-April-2017  Attention: © Copyright (c) 2017 STMicroelectronics International N.V. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted, provided that the following conditions are met:
1. Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of other contributors to this software may be used to endorse or promote products derived from this software without specific written permission. 4. This software, including modifications and/or derivative works of this software, must execute solely and exclusively on microcontroller or microprocessor devices manufactured by or for STMicroelectronics. 5. Redistribution and use of this software other than as permitted under this license is void and will automatically terminate your rights under this license.
THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
Definition in file wifi.c .
Function Documentation 
      
        
          WIFI_Status_t WIFI_CloseClientConnection  
          ( 
          uint32_t  
           socket  ) 
           
      
 
Close client connection. 
Parameters: 
  
    type : Connection type TCP/UDP  name : name of the connection  location : Client address  port : Remote port  local_port : Local port  
   
Return values: 
  
   
Definition at line 322  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_ConfigureAP  
          ( 
          uint8_t *  
           ssid ,  
         
        
          uint8_t *  
           pass ,  
         
        
          WIFI_Ecn_t  
           ecn ,  
         
        
          uint8_t  
           channel ,  
         
        
          uint8_t  
           max_conn   
         
        
          ) 
           
      
 
Configure an Access Point. 
Parameters: 
  
    ssid : SSID string  pass : Password string  ecn : Encryption type  channel : channel number  max_conn : Max allowed connections  
   
Return values: 
  
   
Definition at line 196  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_Connect  
          ( 
          const char *  
           SSID ,  
         
        
          const char *  
           Password ,  
         
        
          WIFI_Ecn_t  
           ecn   
         
        
          ) 
           
      
 
Join an Access Point. 
Parameters: 
  
    SSID : SSID string  Password : Password string  ecn : Encryption type  IP_Addr : Got IP Address  IP_Mask : Network IP mask  Gateway_Addr : Gateway IP address  MAC : pointer to MAC Address  
   
Return values: 
  
   
Definition at line 121  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_Disconnect  
          ( 
          void  
           ) 
           
      
 
Disconnect from a network. 
Parameters: 
  
   
Return values: 
  
   
Definition at line 175  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_GetHostAddress  
          ( 
          char *  
           location ,  
         
        
          uint8_t *  
           ipaddr   
         
        
          ) 
           
      
 
Get IP address from URL using DNS. 
Parameters: 
  
    location : Host URL  ipaddr : array of the IP address  
   
Return values: 
  
   
Definition at line 273  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_GetIP_Address  
          ( 
          uint8_t *  
           ipaddr  ) 
           
      
 
This function retrieves the WiFi interface's IP address. 
Return values: 
  
   
Definition at line 158  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_GetMAC_Address  
          ( 
          uint8_t *  
           mac  ) 
           
      
 
This function retrieves the WiFi interface's MAC address. 
Return values: 
  
   
Definition at line 143  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_GetModuleFwRevision  
          ( 
          char *  
           rev  ) 
           
      
 
Return Module firmware revision. 
Parameters: 
  
   
Return values: 
  
   
Definition at line 472  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_GetModuleID  
          ( 
          char *  
           Id  ) 
           
      
 
Return Module ID. 
Parameters: 
  
   
Return values: 
  
   
Definition at line 489  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_GetModuleName  
          ( 
          char *  
           ModuleName  ) 
           
      
 
Return Module Name. 
Parameters: 
  
   
Return values: 
  
   
Definition at line 506  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_HandleAPEvents  
          ( 
          WIFI_APSettings_t *  
           setting  ) 
           
      
 
Handle the background events of the wifi module. 
Return values: 
  
   
Definition at line 219  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_Init  
          ( 
          void  
           ) 
           
      
 
Initialiaze the WIFI core. 
Parameters: 
  
   
Return values: 
  
   
Definition at line 60  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_ListAccessPoints  
          ( 
          WIFI_APs_t *  
           APs ,  
         
        
          uint8_t  
           AP_MaxNbr   
         
        
          ) 
           
      
 
List a defined number of vailable access points. 
Parameters: 
  
    APs : pointer to APs structure  AP_MaxNbr : Max APs number to be listed  
   
Return values: 
  
   
Definition at line 86  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_ModuleFirmwareUpdate  
          ( 
          const char *  
           location  ) 
           
      
 
Update module firmware. 
Parameters: 
  
    location : Binary Location IP address  
   
Return values: 
  
   
Definition at line 462  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_OpenClientConnection  
          ( 
          uint32_t  
           socket ,  
         
        
          WIFI_Protocol_t  
           type ,  
         
        
          const char *  
           name ,  
         
        
          uint8_t *  
           ipaddr ,  
         
        
          uint16_t  
           port ,  
         
        
          uint16_t  
           local_port   
         
        
          ) 
           
      
 
Configure and start a client connection. 
Parameters: 
  
    type : Connection type TCP/UDP  name : name of the connection  ipaddr : Client IP address  port : Remote port  local_port : Local port  
   
Return values: 
  
   
Definition at line 293  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_Ping  
          ( 
          uint8_t *  
           ipaddr ,  
         
        
          uint16_t  
           count ,  
         
        
          uint16_t  
           interval_ms   
         
        
          ) 
           
      
 
Ping an IP address in the network. 
Parameters: 
  
    ipaddr : array of the IP address  
   
Return values: 
  
   
Definition at line 256  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_ReceiveData  
          ( 
          uint8_t  
           socket ,  
         
        
          uint8_t *  
           pdata ,  
         
        
          uint16_t  
           Reqlen ,  
         
        
          uint16_t *  
           RcvDatalen ,  
         
        
          uint32_t  
           Timeout   
         
        
          ) 
           
      
 
Receive Data from a socket. 
Parameters: 
  
    pdata : pointer to Rx buffer  *len : pointer to length of data  
   
Return values: 
  
   
Definition at line 395  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_ResetModule  
          ( 
          void  
           ) 
           
      
 
Reset the WIFI module. 
Return values: 
  
   
Definition at line 430  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_SendData  
          ( 
          uint8_t  
           socket ,  
         
        
          uint8_t *  
           pdata ,  
         
        
          uint16_t  
           Reqlen ,  
         
        
          uint16_t *  
           SentDatalen ,  
         
        
          uint32_t  
           Timeout   
         
        
          ) 
           
      
 
Send Data on a socket. 
Parameters: 
  
    pdata : pointer to data to be sent  len : length of data to be sent  
   
Return values: 
  
   
Definition at line 377  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_SetModuleDefault  
          ( 
          void  
           ) 
           
      
 
Restore module default configuration. 
Return values: 
  
   
Definition at line 445  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_SetOEMProperties  
          ( 
          const char *  
           name ,  
         
        
          uint8_t *  
           Mac   
         
        
          ) 
           
      
 
Customize module data. 
Parameters: 
  
    name : MFC name  Mac : Mac Address  
   
Return values: 
  
   
Definition at line 412  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_StartServer  
          ( 
          uint32_t  
           socket ,  
         
        
          WIFI_Protocol_t  
           protocol ,  
         
        
          const char *  
           name ,  
         
        
          uint16_t  
           port   
         
        
          ) 
           
      
 
Configure and start a Server. 
Parameters: 
  
    type : Connection type TCP/UDP  name : name of the connection  port : Remote port  
   
Return values: 
  
   
Definition at line 343  of file wifi.c .
 
 
      
        
          WIFI_Status_t WIFI_StopServer  
          ( 
          uint32_t  
           socket  ) 
           
      
 
Stop a server. 
Return values: 
  
   
Definition at line 361  of file wifi.c .