Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Connection

        Here are listed all the functions that implement the Wifi Connection APIs.

Functions

sint8 m2m_wifi_1x_get_option (tenu1xOption enuOptionName, void *pOptionValue, size_t *pOptionLen)
 API to get (read) options relating to Wi-Fi connection using WPA(2) Enterprise authentication. More...
 
sint8 m2m_wifi_1x_set_option (tenu1xOption enuOptionName, const void *pOptionValue, size_t OptionLen)
 API to set (write) options relating to Wi-Fi connection using WPA(2) Enterprise authentication. More...
 
sint8 m2m_wifi_connect (char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *pvAuthInfo, uint16 u16Ch)
 Legacy asynchronous API to request connection to a specified access point. More...
 
sint8 m2m_wifi_connect_1x_mschap2 (tenuCredStoreOption enuCredStoreOption, tstrNetworkId *pstrNetworkId, tstrAuth1xMschap2 *pstrAuth1xMschap2)
 Asynchronous API to connect to an access point using WPA(2) Enterprise authentication with MS-CHAP-V2 credentials. More...
 
sint8 m2m_wifi_connect_1x_tls (tenuCredStoreOption enuCredStoreOption, tstrNetworkId *pstrNetworkId, tstrAuth1xTls *pstrAuth1xTls)
 Asynchronous API to connect to an access point using WPA(2) Enterprise authentication with MS-CHAP-V2 credentials. More...
 
sint8 m2m_wifi_connect_open (tenuCredStoreOption enuCredStoreOption, tstrNetworkId *pstrNetworkId)
 Asynchronous API to connect to an access point using open authentication. More...
 
sint8 m2m_wifi_connect_psk (tenuCredStoreOption enuCredStoreOption, tstrNetworkId *pstrNetworkId, tstrAuthPsk *pstrAuthPsk)
 Asynchronous API to connect to an access point using WPA(2) PSK authentication. More...
 
sint8 m2m_wifi_connect_sc (char *pcSsid, uint8 u8SsidLen, uint8 u8SecType, void *pvAuthInfo, uint16 u16Ch, uint8 u8NoSaveCred)
 Legacy asynchronous API to request connection to a specific AP with the option to save credentials in Flash. More...
 
sint8 m2m_wifi_connect_wep (tenuCredStoreOption enuCredStoreOption, tstrNetworkId *pstrNetworkId, tstrAuthWep *pstrAuthWep)
 Asynchronous API to connect to an access point using WEP authentication. More...
 
sint8 m2m_wifi_default_connect (void)
 Asynchronous API that attempts to reconnect to the last-associated access point. More...
 
sint8 m2m_wifi_delete_sc (char *pcSsid, uint8 u8SsidLen)
 Asynchronous API that deletes connection credentials (PSK, WEP key, 802.1X password) from WINC flash. Either deletes all credentials, or for a specific SSID. More...
 
sint8 m2m_wifi_disconnect (void)
 Synchronous API to request disconnection from a network. More...
 
sint8 m2m_wifi_enable_dhcp (uint8 u8DhcpEn)
 Asynchronous function to control the DHCP client functionality within the WINC. More...
 
sint8 m2m_wifi_get_connection_info (void)
 Asynchronous API for retrieving the WINC connection status. More...
 
sint8 m2m_wifi_req_curr_rssi (void)
 Request the current RSSI for the current connected AP, the response received in wifi_cb M2M_WIFI_RESP_CURRENT_RSSI. More...
 
sint8 m2m_wifi_request_dhcp_client (void)
 Legacy (deprecated) Asynchronous API for starting a DHCP client on the WINC. More...
 
sint8 m2m_wifi_request_dhcp_server (uint8 *addr)
 Legacy (deprecated) asynchronous function to start a DHCP client on the WINC. More...
 
sint8 m2m_wifi_set_static_ip (tstrM2MIPConfig *pstrStaticIPConf)
 Asynchronous API to manually assign a (static) IP address to the WINC. More...
 

sint8 m2m_wifi_1x_get_option ( tenu1xOption  enuOptionName,
void *  pOptionValue,
size_t *  pOptionLen 
)

API to get (read) options relating to Wi-Fi connection using WPA(2) Enterprise authentication.

The following options can be read:\n
    @ref WIFI_1X_BYPASS_SERVER_AUTH\n
    @ref WIFI_1X_TIME_VERIF_MODE\n
    @ref WIFI_1X_SESSION_CACHING\n
    @ref WIFI_1X_SPECIFIC_ROOTCERT\n
Parameters
[in]enuOptionNameThe option to get.
[out]pOptionValuePointer to a buffer to be filled with the value being read. The buffer must be at least as long as the length in pOptionLen
[in,out]pOptionLenPointer to a length. When calling the function, this length must be the length of the buffer available for reading the option value. When the function returns, this length is the length of the data that has been populated by the function.
Returns
The function returns M2M_SUCCESS if the parameters are valid and M2M_ERR_INVALID_ARG otherwise.
The following options can be read:\n
    @ref WIFI_1X_BYPASS_SERVER_AUTH\n
    @ref WIFI_1X_SESSION_CACHING\n
    @ref WIFI_1X_SPECIFIC_ROOTCERT\n
    @ref WIFI_1X_TIME_VERIF_MODE\n
Parameters
[in]enuOptionNameThe option to get.
[out]pOptionValuePointer to a buffer containing the value to set. The buffer must be at least as long as OptionLen. If OptionLen is 0, then pOptionValue may be NULL.
[in,out]pOptionLenPointer to a length. When calling the function, this length must be the length of the buffer available for reading the option value. When the function returns, this length is the length of the data that has been populated by the function.
Returns
The function returns M2M_SUCCESS if the parameters are valid and M2M_ERR_INVALID_ARG otherwise.
sint8 m2m_wifi_1x_set_option ( tenu1xOption  enuOptionName,
const void *  pOptionValue,
size_t  OptionLen 
)

API to set (write) options relating to Wi-Fi connection using WPA(2) Enterprise authentication.

The following options can be set:\n
    @ref WIFI_1X_BYPASS_SERVER_AUTH\n
    @ref WIFI_1X_TIME_VERIF_MODE\n
    @ref WIFI_1X_SESSION_CACHING\n
    @ref WIFI_1X_SPECIFIC_ROOTCERT\n
The setting applies to all subsequent connection attempts via @ref m2m_wifi_connect_1x_mschap2
or @ref m2m_wifi_connect_1x_tls.\n
Connection attempts via @ref m2m_wifi_default_connect use the
settings which were in place at the time of the original connection.
Parameters
[in]enuOptionNameThe option to set.
[in]pOptionValuePointer to a buffer containing the value to set. The buffer must be at least as long as OptionLen. If OptionLen is 0, then pOptionValue may be NULL.
[in]OptionLenThe length of the option value being set.
Returns
The function returns M2M_SUCCESS if the parameters are valid and M2M_ERR_INVALID_ARG otherwise.
The following options can be set:\n
    @ref WIFI_1X_BYPASS_SERVER_AUTH\n
    @ref WIFI_1X_SESSION_CACHING\n
    @ref WIFI_1X_SPECIFIC_ROOTCERT\n
    @ref WIFI_1X_TIME_VERIF_MODE\n
The setting applies to all subsequent connection attempts via @ref m2m_wifi_connect_1x_mschap2
or @ref m2m_wifi_connect_1x_tls.\n
Connection attempts via @ref m2m_wifi_default_connect use the
settings which were in place at the time of the original connection.
Parameters
[in]enuOptionNameThe option to set.
[in]pOptionValuePointer to a buffer containing the value to set. The buffer must be at least as long as OptionLen. If OptionLen is 0, then pOptionValue may be NULL.
[in]OptionLenThe length of the option value being set.
Returns
The function returns M2M_SUCCESS if the parameters are valid and M2M_ERR_INVALID_ARG otherwise.
NMI_API sint8 m2m_wifi_connect ( char *  pcSsid,
uint8  u8SsidLen,
uint8  u8SecType,
void *  pvAuthInfo,
uint16  u16Ch 
)

Legacy asynchronous API to request connection to a specified access point.

DEPRECATED in v19.6.1 - Kept only for legacy purposes.
Legacy asynchronous API to request connection to a specified access point.

This API is maintained for purposes of compatibility with legacy applications. It is
implemented as a wrapper for the following new APIs:
    @ref m2m_wifi_connect_open
    @ref m2m_wifi_connect_wep
    @ref m2m_wifi_connect_psk
    @ref m2m_wifi_connect_1x_mschap2
    @ref m2m_wifi_connect_1x_tls
These new APIs allow more flexibility and it is recommended that applications use them instead.
Parameters
[in]pcSsidA buffer holding the SSID corresponding to the requested AP. SSID must not contain '\0'.
[in]u8SsidLenLength of the given SSID (not including any NULL termination). A length greater than or equal to M2M_MAX_SSID_LEN will result in a negative error M2M_ERR_FAIL.
[in]u8SecTypeWi-Fi security type security for the network. It can be one of the following types: -M2M_WIFI_SEC_OPEN -M2M_WIFI_SEC_WEP -M2M_WIFI_SEC_WPA_PSK -M2M_WIFI_SEC_802_1X A value outside these possible values will result in a negative return error M2M_ERR_FAIL.
[in]pvAuthInfoAuthentication parameters required for completing the connection. Its type is based on the security type. If the authentication parameters are NULL or are greater than the maximum length of the authentication parameters length as defined by M2M_MAX_PSK_LEN a negative error will return M2M_ERR_FAIL indicating connection failure.
[in]u16ChWi-Fi channel number as defined in tenuM2mScanCh enumeration. Specifying a channel number greater than M2M_WIFI_CH_14 returns a negative error M2M_ERR_FAIL, unless the value is M2M_WIFI_CH_ALL, since this indicates that the firmware should scan all channels to find the SSID specified in parameter pcSsid.

Failure to find the connection match will return a negative error M2M_DEFAULT_CONN_SCAN_MISMATCH.

Precondition
Prior to a successful connection request, the wi-fi driver must have been successfully initialized through the call of the m2m_wifi_init function.
Warning
If there is a '\0' character within the first u8SsidLen characters, then this function will assume that the input u8SsidLen was incorrect, set length to strlen(pcSsid) and continue.
It is recommended that the following Wi-Fi connect APIs are used instead: m2m_wifi_connect_open m2m_wifi_connect_wep m2m_wifi_connect_psk m2m_wifi_connect_1x_mschap2 m2m_wifi_connect_1x_tls

Additionally:

  • This function must be called in station mode only.
  • Successful completion of this function does not guarantee success of the WIFI connection, and a negative return value indicates only locally-detected errors.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
See Also
tuniM2MWifiAuth tstr1xAuthCredentials tstrM2mWifiWepParams
Prior to a successful connection, the application must define the SSID of the AP, the security
type, the authentication information parameters and the channel number to which the connection
will be established.

The connection status is known when a response of @ref M2M_WIFI_RESP_CON_STATE_CHANGED is
received based on the states defined in @ref tenuM2mConnState, successful connection is defined
by @ref M2M_WIFI_CONNECTED

The only difference between this function and @ref m2m_wifi_default_connect, is the set of connection parameters.
Connection using this function is expected to be made to a specific AP and to a specified channel.
Parameters
[in]pcSsidA buffer holding the SSID corresponding to the requested AP. SSID must not contain '\0'.
[in]u8SsidLenLength of the given SSID (not including the NULL termination). A length greater than the maximum defined SSID M2M_MAX_SSID_LEN will result in a negative error M2M_ERR_FAIL.
[in]u8SecTypeWi-Fi security type security for the network. It can be one of the following types: -M2M_WIFI_SEC_OPEN -M2M_WIFI_SEC_WEP -M2M_WIFI_SEC_WPA_PSK -M2M_WIFI_SEC_802_1X A value outside these possible values will result in a negative return error M2M_ERR_FAIL.
[in]pvAuthInfoAuthentication parameters required for completing the connection. Its type is based on the security type. If the authentication parameters are NULL or are greater than the maximum length of the authentication parameters length as defined by M2M_MAX_PSK_LEN a negative error will return M2M_ERR_FAIL(-12) indicating connection failure.
[in]u16ChWi-Fi channel number as defined in tenuM2mScanCh enumeration. Specifying a channel number greater than M2M_WIFI_CH_14 returns a negative error M2M_ERR_FAIL(-12), unless the value is M2M_WIFI_CH_ALL, since this indicates that the firmware should scan all channels to find the SSID specified in parameter pcSsid.

Failure to find the connection match will return a negative error M2M_DEFAULT_CONN_SCAN_MISMATCH.

Precondition
Prior to a successful connection request, the wi-fi driver must have been successfully initialized through the call of the m2m_wifi_init function
Warning
If there is a '\0' character within the first u8SsidLen characters, then this function will assume that the input u8SsidLen was incorrect, set length to strlen(pcSsid) and continue.
This function has been deprecated since v19.6.1 and will no longer be supported afterwards. The following should be used instead: m2m_wifi_connect_open m2m_wifi_connect_wep m2m_wifi_connect_psk m2m_wifi_connect_1x_mschap2 m2m_wifi_connect_1x_tls

Additionally:

  • This function must be called in station mode only.
  • Successful completion of this function does not guarantee success of the WIFI connection, and a negative return value indicates only locally-detected errors.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
See Also
tstr1xAuthCredentials tstrM2mWifiWepParams

Referenced by app_ble_wifi_provisioning(), demo_start(), demo_wifi_state(), iperf_wifi_cb(), m2m_wifi_socket_handler(), m2m_wifi_state(), main(), socket_cb(), test_init(), wifi_ap_connect(), wifi_callback(), and wifi_cb().

sint8 m2m_wifi_connect_1x_mschap2 ( tenuCredStoreOption  enuCredStoreOption,
tstrNetworkId pstrNetworkId,
tstrAuth1xMschap2 pstrAuth1xMschap2 
)

Asynchronous API to connect to an access point using WPA(2) Enterprise authentication with MS-CHAP-V2 credentials.

Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
the Enterprise MS-CHAP-V2 credentials provided in pstrAuth1xMschap2.
On successful connection, the connection details may be saved in WINC flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId and pstrAuth1xMschap2) are stored in WINC flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
[in]pstrAuth1xMschap2Structure specifying the MS-CHAP-V2 credentials.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.
Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
the Enterprise MS-CHAP-V2 credentials provided in pstrAuth1xMschap2.
On successful connection, the connection details may be saved in WINC's flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId and pstrAuth1xMschap2) are stored in WINC's flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
[in]pstrAuth1xMschap2Structure specifying the MS-CHAP-V2 credentials.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.

Referenced by m2m_wifi_connect_sc(), main(), and wifi_ap_connect().

sint8 m2m_wifi_connect_1x_tls ( tenuCredStoreOption  enuCredStoreOption,
tstrNetworkId pstrNetworkId,
tstrAuth1xTls pstrAuth1xTls 
)

Asynchronous API to connect to an access point using WPA(2) Enterprise authentication with MS-CHAP-V2 credentials.

Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
the Enterprise TLS credentials provided in pstrAuth1xTls.
On successful connection, the connection details may be saved in WINC flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function @ref tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId and pstrAuth1xTls) are stored in WINC flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
[in]pstrAuth1xTlsStructure specifying the EAP-TLS credentials.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.
Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
the Enterprise TLS credentials provided in pstrAuth1xTls.
On successful connection, the connection details may be saved in WINC's flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function @ref tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId and pstrAuth1xTls) are stored in WINC's flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
[in]pstrAuth1xTlsStructure specifying the EAP-TLS credentials.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.

Referenced by main(), and wifi_ap_connect().

sint8 m2m_wifi_connect_open ( tenuCredStoreOption  enuCredStoreOption,
tstrNetworkId pstrNetworkId 
)

Asynchronous API to connect to an access point using open authentication.

Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
open authentication.
On successful connection, the connection details may be saved in WINC flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function @ref tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId) are stored in WINC flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.
Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
open authentication.
On successful connection, the connection details may be saved in WINC's flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function @ref tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId) are stored in WINC's flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.

Referenced by m2m_wifi_connect_sc().

sint8 m2m_wifi_connect_psk ( tenuCredStoreOption  enuCredStoreOption,
tstrNetworkId pstrNetworkId,
tstrAuthPsk pstrAuthPsk 
)

Asynchronous API to connect to an access point using WPA(2) PSK authentication.

Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
the PSK passphrase provided in pstrAuthPsk.
On successful connection, the connection details may be saved in WINC flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function @ref tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId and pstrAuthPsk) are stored in WINC flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
[in]pstrAuthPskStructure specifying the Passphrase/PSK.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.
Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
the PSK passphrase provided in pstrAuthPsk.
On successful connection, the connection details may be saved in WINC's flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function @ref tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId and pstrAuthPsk) are stored in WINC's flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
[in]pstrAuthPskStructure specifying the Passphrase/PSK.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.

Referenced by m2m_wifi_connect_sc().

NMI_API sint8 m2m_wifi_connect_sc ( char *  pcSsid,
uint8  u8SsidLen,
uint8  u8SecType,
void *  pvAuthInfo,
uint16  u16Ch,
uint8  u8NoSaveCred 
)

Legacy asynchronous API to request connection to a specific AP with the option to save credentials in Flash.

DEPRECATED in v19.6.1 - Kept only for legacy purposes.
Legacy asynchronous API to request connection to a specific AP with the option to save credentials in Flash.

This API is maintained for purposes of compatibility with legacy applications. It is
implemented as a wrapper for the following new APIs:
    @ref m2m_wifi_connect_open
    @ref m2m_wifi_connect_wep
    @ref m2m_wifi_connect_psk
    @ref m2m_wifi_connect_1x_mschap2
    @ref m2m_wifi_connect_1x_tls
These new APIs allow more flexibility and it is recommended that applications use them instead.
Parameters
[in]pcSsidA buffer holding the SSID corresponding to the requested AP. SSID must not contain '\0'.
[in]u8SsidLenLength of the given SSID (not including any NULL termination). A length greater than or equal to M2M_MAX_SSID_LEN will result in a negative error M2M_ERR_FAIL.
[in]u8SecTypeWi-Fi security type security for the network (see tenuM2mSecType). It can be one of the following types: -M2M_WIFI_SEC_OPEN -M2M_WIFI_SEC_WEP -M2M_WIFI_SEC_WPA_PSK -M2M_WIFI_SEC_802_1X A value outside these possible values will result in a negative return error M2M_ERR_FAIL.
[in]pvAuthInfoAuthentication parameters required for completing the connection. Its type is based on the security type. If the authentication parameters are NULL or are greater than the maximum length of the authentication parameters length as defined by M2M_MAX_PSK_LEN a negative error will return M2M_ERR_FAIL indicating connection failure.
[in]u16ChWi-Fi channel number as defined in tenuM2mScanCh enumeration. Specification of a channel number greater than M2M_WIFI_CH_14 returns a negative error M2M_ERR_FAIL unless the value is M2M_WIFI_CH_ALL. A channel number of M2M_WIFI_CH_ALL indicates that the firmware should scan all channels to find the SSID specified in parameter pcSsid.

Failure to find the connection match will return a negative error M2M_DEFAULT_CONN_SCAN_MISMATCH.

Parameters
[in]u8SaveCredOption to store the access point SSID and password into the WINC flash memory or not.
Precondition
Prior to a successful connection request, the wi-fi driver must have been successfully initialized through the call of the m2m_wifi_init function.
Warning
If there is a '\0' character within the first u8SsidLen characters, then this function will assume that the input u8SsidLen was incorrect, set length to strlen(pcSsid) and continue.
It is recommended that the following Wi-Fi connect APIs are used instead: m2m_wifi_connect_open m2m_wifi_connect_wep m2m_wifi_connect_psk m2m_wifi_connect_1x_mschap2 m2m_wifi_connect_1x_tls

Additionally:

  • This function must be called in station mode only.
  • Successful completion of this function does not guarantee success of the WIFI connection, and a negative return value indicates only locally-detected errors.
See Also
tuniM2MWifiAuth tenuM2mSecType tstr1xAuthCredentials tstrM2mWifiWepParams
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
Prior to a successful connection, the application developers must know the SSID of the AP, the security
type, the authentication information parameters and the channel number to which the connection will
be established.

The connection status is known when a response of @ref M2M_WIFI_RESP_CON_STATE_CHANGED is received based
on the states defined in @ref tenuM2mConnState, successful connection is defined by @ref M2M_WIFI_CONNECTED
The only difference between this function and @ref m2m_wifi_connect, is the option to save the access point
info (SSID, password...etc) or not.
Connection using this function is expected to be made to a specific AP and to a specified channel.
Parameters
[in]pcSsidA buffer holding the SSID corresponding to the requested AP. SSID must not contain '\0'.
[in]u8SsidLenLength of the given SSID (not including the NULL termination). A length greater than the maximum defined SSID M2M_MAX_SSID_LEN will result in a negative error M2M_ERR_FAIL.
[in]u8SecTypeWi-Fi security type security for the network see tenuM2mSecType. It can be one of the following types: -M2M_WIFI_SEC_OPEN -M2M_WIFI_SEC_WEP -M2M_WIFI_SEC_WPA_PSK -M2M_WIFI_SEC_802_1X A value outside these possible values will result in a negative return error M2M_ERR_FAIL.
[in]pvAuthInfoAuthentication parameters required for completing the connection. Its type is based on the security type. If the authentication parameters are NULL or are greater than the maximum length of the authentication parameters length as defined by M2M_MAX_PSK_LEN a negative error will return M2M_ERR_FAIL(-12) indicating connection failure.
[in]u16ChWi-Fi channel number as defined in tenuM2mScanCh enumeration. Specification of a channel number greater than M2M_WIFI_CH_14 returns a negative error M2M_ERR_FAIL(-12) unless the value is M2M_WIFI_CH_ALL. A channel number of M2M_WIFI_CH_ALL indicates that the firmware should scan all channels to find the SSID specified in parameter pcSsid.

Failure to find the connection match will return a negative error M2M_DEFAULT_CONN_SCAN_MISMATCH.

Parameters
[in]u8NoSaveCredOption to store the access point SSID and password into the WINC flash memory or not.
Precondition
Prior to a successful connection request, the wi-fi driver must have been successfully initialized through the call of the m2m_wifi_init function.
Warning
If there is a '\0' character within the first u8SsidLen characters, then this function will assume that the input u8SsidLen was incorrect, set length to strlen(pcSsid) and continue.
This function has been deprecated since v19.6.1 and will no longer be supported afterwards. The following should be used instead: m2m_wifi_connect_open m2m_wifi_connect_wep m2m_wifi_connect_psk m2m_wifi_connect_1x_mschap2 m2m_wifi_connect_1x_tls

Additionally:

  • This function must be called in station mode only.
  • Successful completion of this function does not guarantee success of the WIFI connection, and a negative return value indicates only locally-detected errors.
See Also
tenuM2mSecType tstr1xAuthCredentials tstrM2mWifiWepParams
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.

Referenced by m2m_wifi_connect().

sint8 m2m_wifi_connect_wep ( tenuCredStoreOption  enuCredStoreOption,
tstrNetworkId pstrNetworkId,
tstrAuthWep pstrAuthWep 
)

Asynchronous API to connect to an access point using WEP authentication.

Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
the WEP key provided in pstrAuthWep.
On successful connection, the connection details may be saved in WINC flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function @ref tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId and pstrAuthWep) are stored in WINC flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
[in]pstrAuthWepStructure specifying the WEP key.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.
Asynchronous Wi-Fi connection function. An application calling this function will cause the
firmware to attempt to connect to an access point matching the details in pstrNetworkId, with
the WEP key provided in pstrAuthWep.
On successful connection, the connection details may be saved in WINC's flash, according to
the option selected in enuCredStoreOption.
Once connection has been attempted (whether successful or otherwise), a response event
@ref M2M_WIFI_RESP_CON_STATE_CHANGED will be sent to the callback function @ref tpfAppWifiCb
provided during initialization @ref m2m_wifi_init.

Possible results indicated by the response event are:
- @ref M2M_WIFI_DISCONNECTED if the connection attempt failed.
- @ref M2M_WIFI_CONNECTED if the connection attempt succeeded.
Precondition
Prior to attempting connection, the WINC driver must have been initialized by calling the m2m_wifi_init function.
Warning
This function is handled in station mode only.
Parameters
[in]enuCredStoreOptionOption to specify whether connection details (i.e. the contents of pstrNetworkId and pstrAuthWep) are stored in WINC's flash and, if so, whether they are encrypted before storing.
[in]pstrNetworkIdStructure specifying SSID/BSSID and Wi-Fi channel.
[in]pstrAuthWepStructure specifying the WEP key.
Returns
The function returns M2M_SUCCESS if the connect request has been successfully passed to the firmware and a negative value otherwise.

Referenced by m2m_wifi_connect_sc().

NMI_API sint8 m2m_wifi_default_connect ( void  )

Asynchronous API that attempts to reconnect to the last-associated access point.

Asynchronous Wi-Fi connection function. An application calling this function will cause
the firmware to attempt to reconnect to the access point with which it had last successfully connected.
A failure to connect will result in a response of @ref M2M_WIFI_RESP_DEFAULT_CONNECT
indicating a connection error as defined in the structure @ref tstrM2MDefaultConnResp.

Possible errors are:
@ref M2M_DEFAULT_CONN_EMPTY_LIST indicating that the connection list is empty, or
@ref M2M_DEFAULT_CONN_SCAN_MISMATCH indicating a mismatch for the saved AP name.
Precondition
Prior to connecting, the WINC driver should have been successfully initialized by calling the m2m_wifi_init function.
Warning
This function must be called in station mode only. It is important to note that successful completion of a call to m2m_wifi_default_connect does not guarantee success of the WIFI connection; a negative return value indicates only locally-detected errors.
See Also
m2m_wifi_connect
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
Asynchronous Wi-Fi connection function. An application calling this function will cause
the firmware to correspondingly connect to the last successfully connected AP from the 
cached connections.\n
A failure to connect will result in a response of @ref M2M_WIFI_RESP_DEFAULT_CONNECT 
indicating the connection error as defined in the structure @ref tstrM2MDefaultConnResp.

Possible errors are: 
The connection list is empty @ref M2M_DEFAULT_CONN_EMPTY_LIST or a mismatch for the 
saved AP name @ref M2M_DEFAULT_CONN_SCAN_MISMATCH.
Precondition
Prior to connecting, the WINC driver should have been successfully initialized by calling the m2m_wifi_init function.
Warning
This function must be called in station mode only. It is important to note that successful completion of a call to m2m_wifi_default_connect() does not guarantee success of the WIFI connection; a negative return value indicates only locally-detected errors.
See Also
m2m_wifi_connect
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.

Referenced by demo_start(), main(), and wifi_cb().

sint8 m2m_wifi_delete_sc ( char *  pcSsid,
uint8  u8SsidLen 
)

Asynchronous API that deletes connection credentials (PSK, WEP key, 802.1X password) from WINC flash. Either deletes all credentials, or for a specific SSID.

Causes WINC to delete connection credentials. If the parameter is NULL, then WINC will delete
all credentials from flash. Otherwise WINC will only delete credentials for matching SSID.
Callback will report the status of the operation (success or not).
Parameters
[in]pcSsidSSID to match on when deleting credentials. SSID must not contain '\0'. NULL is a valid argument here, in which case all credentials are deleted.
[in]u8SsidLenLength of SSID provided in pcSsid. Must be less than M2M_MAX_SSID_LEN. This parameter is ignored if pcSsid is NULL.
Precondition
Prior to deleting credentials, the WINC driver should have been successfully initialized by calling the m2m_wifi_init function.
Warning
The option to delete for a specific SSID is currently not supported; all credentials are deleted regardless of the input parameters.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
Causes WINC to delete connection credentials. If the parameter is NULL, then WINC will delete
all credentials from flash. Otherwise WINC will only delete credentials for matching SSID.
Callback will report the status of the operation (success or not).
Parameters
[in]pcSsidSSID to match on when deleting credentials. SSID must not contain '\0'. NULL is a valid argument here, in which case all credentials are deleted.
[in]u8SsidLenLength of SSID provided in pcSsid. Must be less than M2M_MAX_SSID_LEN. This parameter is ignored if pcSsid is NULL.
Precondition
Prior to deleting credentials, the WINC driver should have been successfully initialized by calling the m2m_wifi_init function.
Warning
The option to delete for a specific SSID is currently not supported; all credentials are deleted regardless of the input parameters.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
NMI_API sint8 m2m_wifi_disconnect ( void  )

Synchronous API to request disconnection from a network.

Request a Wi-Fi disconnect from the currently connected AP.
The connection status will be indicated to the application via a @ref M2M_WIFI_RESP_CON_STATE_CHANGED event.
The status will be one of those defined in @ref tenuM2mConnState, with @ref M2M_WIFI_DISCONNECTED indicating
a successful disconnection.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
Precondition
Disconnection request must be made to a successfully connected AP. If the WINC is not in the connected state, a call to this function will hold insignificant.
Warning
This function must be called in station mode only.
See Also
m2m_wifi_connect m2m_wifi_connect_sc m2m_wifi_default_connect m2m_wifi_connect_open m2m_wifi_connect_wep m2m_wifi_connect_psk m2m_wifi_connect_1x_mschap2 m2m_wifi_connect_1x_tls
Request a Wi-Fi disconnect from the currently connected AP.
After the disconnect is complete the driver should receive a response of @ref M2M_WIFI_RESP_CON_STATE_CHANGED based on the states defined
in @ref tenuM2mConnState, successful disconnection is defined by @ref M2M_WIFI_DISCONNECTED .
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
Precondition
Disconnection request must be made to a successfully connected AP. If the WINC is not in the connected state, a call to this function will hold insignificant.
Warning
This function must be called in station mode only.
See Also
m2m_wifi_connect_open m2m_wifi_connect_wep m2m_wifi_connect_psk m2m_wifi_connect_1x_mschap2 m2m_wifi_connect_1x_tls m2m_wifi_default_connect

Referenced by app_ble_wifi_provisioning(), and retry_smtp_server().

NMI_API sint8 m2m_wifi_enable_dhcp ( uint8  u8DhcpEn)

Asynchronous function to control the DHCP client functionality within the WINC.

Enable/Disable the DHCP client after connection.

This function allows the application to control the behaviour of the DHCP client function within
the WINC once it has associated with an access point. DHCP client functionality is enabled by
default.
Parameters
[in]u8DhcpEnThe state of the DHCP client feature after successful association with an access point:
  • 1: Enables DHCP client after connection.
  • 0: Disables DHCP client after connection.
Returns
The function returns M2M_SUCCESS for successful operation and a negative value otherwise.
Warning
DHCP client is enabled by default. This Function should be called to disable DHCP client operation before using m2m_wifi_set_static_ip.
See Also
m2m_wifi_set_static_ip
Synchronous Wi-Fi DHCP enable function. This function will Enable/Disable the DHCP protocol.
Parameters
[in]u8DhcpEnThe state of the DHCP client feature after successful association with an access point:
  • 1: Enables DHCP client after connection.
  • 0: Disables DHCP client after connection.
Returns
The function SHALL return M2M_SUCCESS for successful operation and a negative value otherwise.
Warning
DHCP client is enabled by default. This Function should be called before using m2m_wifi_set_static_ip
See Also
m2m_wifi_set_static_ip
sint8 m2m_wifi_get_connection_info ( void  )

Asynchronous API for retrieving the WINC connection status.

Asynchronous API for retrieving the WINC IC's connection status.

Requests the connection status from the WINC including information regarding any access
point to which it is currently connected, or any non-AP station that is connected to the WINC.
All information will be returned to the application via the Wi-Fi notification callback through
the event @ref M2M_WIFI_RESP_CONN_INFO.

The connection info can be retrieved using the structure @ref tstrM2MConnInfo which contains:
- Connection Security
- Connection RSSI
- Remote MAC address
- Remote IP address
- SSID of the network (in cases where the WINC is in non-AP mode)
Precondition
  • A Wi-Fi notification callback of type tpfAppWifiCb MUST be implemented and registered at startup. Registering the callback is done through passing it to the initialization m2m_wifi_init function.
  • The event M2M_WIFI_RESP_CONN_INFO must be handled in the callback to receive the requested connection info.
Warning
  • In case the WINC is operating in AP mode or P2P mode, the SSID field will be returned as a NULL string.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
See Also
M2M_WIFI_RESP_CONN_INFO, tstrM2MConnInfo

Example

The code snippet shows an example of how wi-fi connection information is retrieved .

#include "m2m_wifi.h"
#include "m2m_types.h"
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
switch(u8WiFiEvent)
{
{
tstrM2MConnInfo *pstrConnInfo = (tstrM2MConnInfo*)pvMsg;
printf("CONNECTED AP INFO\n");
printf("SSID : %s\n",pstrConnInfo->acSSID);
printf("SEC TYPE : %d\n",pstrConnInfo->u8SecType);
printf("Signal Strength : %d\n", pstrConnInfo->s8RSSI);
printf("Local IP Address : %d.%d.%d.%d\n",
pstrConnInfo->au8IPAddr[0] , pstrConnInfo->au8IPAddr[1], pstrConnInfo->au8IPAddr[2], pstrConnInfo->au8IPAddr[3]);
}
break;
{
// Get the current AP information.
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
// connect to the default AP
while(1)
{
}
}
}
Asynchronous connection status retrieval function, retrieves the status information of the 
currently connected AP. 
The result is passed to the Wi-Fi notification callback through the event 
@ref M2M_WIFI_RESP_CONN_INFO. Connection information is retrieved from 
the structure @ref tstrM2MConnInfo.

Connection Information retrieved:
-Connection Security
-Connection RSSI
-Remote MAC address
-Remote IP address

In case the WINC is operating in station mode, the SSID of the AP is also retrieved.
Precondition
  • A Wi-Fi notification callback of type tpfAppWifiCb MUST be implemented and registered at startup. Registering the callback is done through passing it to the initialization m2m_wifi_init function.
  • The event M2M_WIFI_RESP_CONN_INFO must be handled in the callback to receive the requested connection info.
Warning
  • In case the WINC is operating in AP mode, the SSID field will be returned as a NULL string.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
See Also
M2M_WIFI_RESP_CONN_INFO, tstrM2MConnInfo

Example

The code snippet shows an example of how wi-fi connection information is retrieved .

#include "m2m_wifi.h"
#include "m2m_types.h"
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
switch(u8WiFiEvent)
{
{
tstrM2MConnInfo *pstrConnInfo = (tstrM2MConnInfo*)pvMsg;
printf("CONNECTED AP INFO\n");
printf("SSID : %s\n",pstrConnInfo->acSSID);
printf("SEC TYPE : %d\n",pstrConnInfo->u8SecType);
printf("Signal Strength : %d\n", pstrConnInfo->s8RSSI);
printf("Local IP Address : %d.%d.%d.%d\n",
pstrConnInfo->au8IPAddr[0] , pstrConnInfo->au8IPAddr[1], pstrConnInfo->au8IPAddr[2], pstrConnInfo->au8IPAddr[3]);
}
break;
{
// Get the current AP information.
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
// connect to the default AP
while(1)
{
}
}
}

Referenced by demo_wifi_state(), and m2m_wifi_state().

NMI_API sint8 m2m_wifi_req_curr_rssi ( void  )

Request the current RSSI for the current connected AP, the response received in wifi_cb M2M_WIFI_RESP_CURRENT_RSSI.

Asynchronous API to request the current Receive Signal Strength (RSSI) of the current connection.

See Also
M2M_WIFI_RESP_CURRENT_RSSI
Returns
The function shall return M2M_SUCCESS for success and a negative value otherwise.
This function will result in the application receiving the RSSI via a
@ref M2M_WIFI_RESP_CURRENT_RSSI event.
Precondition
  • A Wi-Fi notification callback of type tpfAppWifiCb MUST be implemented and registered during initialization. Registration of the callback is done through passing it to m2m_wifi_init via the tstrWifiInitParam initialization structure.
  • The event M2M_WIFI_RESP_CURRENT_RSSI must be handled in the callback to receive the requested Rssi information.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.

Example

The code snippet demonstrates how the RSSI request is called in the application's main function and the handling of the event received in the callback.

#include "m2m_wifi.h"
#include "m2m_types.h"
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
static uint8 u8ScanResultIdx = 0;
switch(u8WiFiEvent)
{
{
sint8 *rssi = (sint8*)pvMsg;
M2M_INFO("ch rssi %d\n",*rssi);
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
// Scan all channels
while(1)
{
}
}
}

Referenced by timer_callback(), and wifi_cb().

NMI_API sint8 m2m_wifi_request_dhcp_client ( void  )

Legacy (deprecated) Asynchronous API for starting a DHCP client on the WINC.

Legacy (deprecated) Asynchronous API for starting a DHCP client on the WINC IC.

This is a legacy API and is no longer supported. Calls to this API will not result in any
changes being made to the state of the WINC.
Warning
This function has been deprecated. DHCP is used automatically when the WINC connects.
Returns
This function always returns M2M_SUCCESS.
This is a legacy API and is no longer supported. Calls to this API will not result in any 
changes being made to the state of the WINC IC. 
Warning
This function has been deprecated. DHCP is used automatically when the WINC IC connects.
Returns
This function always returns M2M_SUCCESS.

Referenced by demo_wifi_state(), iperf_wifi_cb(), m2m_wifi_state(), wifi_callback(), and wifi_cb().

NMI_API sint8 m2m_wifi_request_dhcp_server ( uint8 addr)

Legacy (deprecated) asynchronous function to start a DHCP client on the WINC.

Dhcp requested by the firmware automatically in STA/AP mode).

This is a legacy API and is no longer supported. Calls to this API will not result in any
changes being made to the state of the WINC.
Parameters
[in]addrThe address to issue to a connected client (only one client is supported)
Warning
This function is legacy and exists only for compatibility with older applications. DHCP server is started automatically when enabling the AP mode.
Returns
This function always returns M2M_SUCCESS.
Warning
This function is legacy and exists only for compatibility with older applications. DHCP server is started automatically when enabling the AP mode.
Returns
This function always returns M2M_SUCCESS.
NMI_API sint8 m2m_wifi_set_static_ip ( tstrM2MIPConfig pstrStaticIPConf)

Asynchronous API to manually assign a (static) IP address to the WINC.

Synchronous API to manually assign a (static) IP address to the WINC IC.

Assigns a static IP address to the WINC.
Typically an infrastructure access point will be able to provide an IP address to all clients
after they associate. The WINC will request configuration via DHCP automatically after
successfully connecting to an access point.
This function should only be called in the event that the network has no DHCP server or in case the application
wants to assign a predefined known IP address and the application.
This function can be used to assign a static IP address in case the application knows the specifics of the network.
The user must keep in mind that assigning a static IP address might
result in an IP address conflict. In case of an IP address conflict observed
by the WINC the user will get a response of @ref M2M_WIFI_RESP_IP_CONFLICT
in the wifi callback. The application is then responsible to either solve the
conflict or assign another IP address.
Precondition
The application must first call m2m_wifi_enable_dhcp to request that DHCP functionality is disabled prior to calling this function.
Warning
Exercise caution using this function. DHCP is the preferred method for configuring IP addresses.
Parameters
[in]pstrStaticIPConfPointer to a structure holding the static IP configuration (IP, Gateway, subnet mask and DNS address).
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
See Also
tstrM2MIPConfig
Assign a static IP address to the WINC board.
This function assigns a static IP address in case the AP doesn't have a DHCP 
server or in case the application wants to assign a predefined known IP 
address. The user must keep in mind that assigning a static IP address might
result in an IP address conflict. In case of an IP address conflict observed 
by the WINC board the user will get a response of @ref M2M_WIFI_RESP_IP_CONFLICT 
in the wifi callback. The application is then responsible to either solve the 
conflict or assign another IP address. 
Precondition
The application must disable auto DHCP using m2m_wifi_enable_dhcp before assigning a static IP address.
Warning
Normally this function should not be used. DHCP configuration is requested automatically after successful Wi-Fi connection is established.
Parameters
[in]pstrStaticIPConfPointer to a structure holding the static IP configuration (IP, Gateway, subnet mask and DNS address).
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
See Also
tstrM2MIPConfig