Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more
m2m_wifi.c File Reference
This module contains M2M Wi-Fi APIs implementation. More...
Go to the source code of this file.
Functions | |
| sint8 | m2m_wifi_set_lsn_int (tstrM2mLsnInt *pstrM2mLsnInt) |
| Set the Wi-Fi listen interval for power save operation. It is represented in units of AP Beacon periods. | |
| sint8 | m2m_wifi_req_client_ctrl (uint8 u8Cmd) |
| Send a command to the PS Client (An WINC1500 board running the ps_firmware), if the PS client send any commands it will be received in wifi_cb M2M_WIFI_RESP_CLIENT_INFO. | |
| sint8 | m2m_wifi_req_server_init (uint8 ch) |
| Initialize the PS Server, The WINC1500 support Non secure communication with another WINC1500, (SERVER/CLIENT) through one byte command (probe request and probe response) without any connection setup. | |
| 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. | |
| sint8 | m2m_wifi_get_otp_mac_address (uint8 *pu8MacAddr, uint8 *pu8IsValid) |
| Request the MAC address stored on the OTP (one time programmable) memory of the device. (the function is Blocking until response received) | |
| sint8 | m2m_wifi_get_mac_address (uint8 *pu8MacAddr) |
| Request the current MAC address of the device (the working mac address). (the function is Blocking until response received) | |
| sint8 | m2m_wifi_req_scan_result (uint8 index) |
| Reads the AP information from the Scan Result list with the given index, the response received in wifi_cb M2M_WIFI_RESP_SCAN_RESULT, the response pointer should be casted with tstrM2mWifiscanResult structure. | |
| uint8 | m2m_wifi_get_num_ap_found (void) |
| Reads the number of AP's found in the last Scan Request, The function read the number of AP's from global variable which updated in the wifi_cb in M2M_WIFI_RESP_SCAN_DONE. | |
| uint8 | m2m_wifi_get_sleep_mode (void) |
| Get the current Power save mode. | |
| sint8 | m2m_wifi_set_sleep_mode (uint8 PsTyp, uint8 BcastEn) |
| Set the power saving mode for the WINC1500. | |
| sint8 | m2m_wifi_set_device_name (uint8 *pu8DeviceName, uint8 u8DeviceNameLength) |
| Set the WINC1500 device name which is used as P2P device name. | |
| sint8 | m2m_wifi_get_sytem_time (void) |
| sint8 | m2m_wifi_set_power_profile (uint8 u8PwrMode) |
| Change the power profile mode. | |
| sint8 | m2m_wifi_set_tx_power (uint8 u8TxPwrLevel) |
| set the TX power tenuM2mTxPwrLevel | |
| sint8 | m2m_wifi_enable_firmware_logs (uint8 u8Enable) |
| Enable or Disable logs in run time (Disable Firmware logs will enhance the firmware start-up time and performance) | |
| sint8 | m2m_wifi_set_battery_voltage (uint16 u16BattVoltx100) |
| Enable or Disable logs in run time (Disable Firmware logs will enhance the firmware start-up time and performance) | |
| sint8 | m2m_wifi_prng_get_random_bytes (uint8 *pu8PrngBuff, uint16 u16PrngSize) |
| Get random bytes using the PRNG bytes. | |
| NMI_API sint8 | m2m_wifi_enable_mac_mcast (uint8 *pu8MulticastMacAddress, uint8 u8AddRemove) |
| Add MAC filter to receive Multicast packets. | |
| NMI_API sint8 | m2m_wifi_set_receive_buffer (void *pvBuffer, uint16 u16BufferLen) |
| set the ethernet receive buffer, should be called in the receive call back. | |
Detailed Description
This module contains M2M Wi-Fi APIs implementation.
Copyright (c) 2016-2017 Atmel Corporation. All rights reserved.
Definition in file m2m_wifi.c.
Function Documentation
Enable or Disable logs in run time (Disable Firmware logs will enhance the firmware start-up time and performance)
- Parameters:
-
[in] u8Enable Set 1 to enable the logs 0 for disable
- Returns:
- The function SHALL return M2M_SUCCESE for success and a negative value otherwise.
- See also:
- __DISABLE_FIRMWARE_LOGS__ (build option to disable logs from initializations)
- Precondition:
- m2m_wifi_init
- Warning:
Definition at line 1311 of file m2m_wifi.c.
Add MAC filter to receive Multicast packets.
- Parameters:
-
[in] pu8MulticastMacAddress Pointer to the MAC address. [in] u8AddRemove Flag to Add/Remove MAC address.
- Returns:
- The function SHALL return 0 for success and a negative value otherwise.
Definition at line 1380 of file m2m_wifi.c.
Request the current MAC address of the device (the working mac address). (the function is Blocking until response received)
- Parameters:
-
[out] pu8MacAddr Output MAC address buffer of 6 bytes size.
- Returns:
- The function shall return M2M_SUCCESS for success and a negative value otherwise.
- See also:
- m2m_wifi_get_otp_mac_address
- Precondition:
- m2m_wifi_init required to call any WIFI/socket function
Definition at line 1008 of file m2m_wifi.c.
| NMI_API uint8 m2m_wifi_get_num_ap_found | ( | void | ) |
Reads the number of AP's found in the last Scan Request, The function read the number of AP's from global variable which updated in the wifi_cb in M2M_WIFI_RESP_SCAN_DONE.
- See also:
- m2m_wifi_request_scan
- Returns:
- Return the number of AP's found in the last Scan Request.
- Precondition:
- m2m_wifi_request_scan need to be called first
- Warning:
- That function need to be called in the wifi_cb in M2M_WIFI_RESP_SCAN_DONE, calling that function in any other place will return undefined/undated numbers. Function used only in STA mode only.
Definition at line 1060 of file m2m_wifi.c.
Request the MAC address stored on the OTP (one time programmable) memory of the device. (the function is Blocking until response received)
- Parameters:
-
[out] pu8MacAddr Output MAC address buffer of 6 bytes size. Valid only if *pu8Valid=1. [out] pu8IsValid A output boolean value to indicate the validity of pu8MacAddr in OTP. Output zero if the OTP memory is not programmed, non-zero otherwise.
- Returns:
- The function shall return M2M_SUCCESS for success and a negative value otherwise.
- See also:
- m2m_wifi_get_mac_address
- Precondition:
- m2m_wifi_init required to call any WIFI/socket function
Definition at line 984 of file m2m_wifi.c.
| NMI_API uint8 m2m_wifi_get_sleep_mode | ( | void | ) |
Get the current Power save mode.
- Returns:
- The current operating power saving mode.
- See also:
- tenuPowerSaveModes , m2m_wifi_set_sleep_mode
Definition at line 1070 of file m2m_wifi.c.
| NMI_API sint8 m2m_wifi_get_sytem_time | ( | void | ) |
- See also:
- m2m_wifi_enable_sntp tstrSystemTime
- Note:
- get the system time from the sntp client using the API m2m_wifi_get_sytem_time.
- Returns:
- The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
Definition at line 1250 of file m2m_wifi.c.
Get random bytes using the PRNG bytes.
- Parameters:
-
[in] u16PrngSize Size of the required random bytes to be generated. [in] pu8PrngBuff Pointer to user allocated buffer.
- Returns:
- The function SHALL return M2M_SUCCESE for success and a negative value otherwise.
Definition at line 1348 of file m2m_wifi.c.
Send a command to the PS Client (An WINC1500 board running the ps_firmware), if the PS client send any commands it will be received in wifi_cb M2M_WIFI_RESP_CLIENT_INFO.
- Parameters:
-
[in] cmd Control command sent from PS Server to PS Client (command values defined by the application)
- Returns:
- The function SHALL return M2M_SUCCESE for success and a negative value otherwise.
- See also:
- m2m_wifi_req_server_init, M2M_WIFI_RESP_CLIENT_INFO
- Precondition:
- m2m_wifi_req_server_init should be called first
- Warning:
Definition at line 862 of file m2m_wifi.c.
| 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.
- See also:
- M2M_WIFI_RESP_CURRENT_RSSI
- Returns:
- The function shall return M2M_SUCCESS for success and a negative value otherwise.
Definition at line 951 of file m2m_wifi.c.
Reads the AP information from the Scan Result list with the given index, the response received in wifi_cb M2M_WIFI_RESP_SCAN_RESULT, the response pointer should be casted with tstrM2mWifiscanResult structure.
- Parameters:
-
[in] index Index for the requested result, the index range start from 0 till number of AP's found
- See also:
- tstrM2mWifiscanResult,m2m_wifi_get_num_ap_found,m2m_wifi_request_scan
- Returns:
- The function shall return M2M_SUCCESE for success and a negative value otherwise
- Precondition:
- m2m_wifi_request_scan need to be called first, then m2m_wifi_get_num_ap_found to get the number of AP's found
- Warning:
- Function used only in STA mode only. the scan result updated only if scan request called, else it will be cashed in firmware for the host scan request result, which mean if large delay occur between the scan request and the scan result request, the result will not be up-to-date
Definition at line 1040 of file m2m_wifi.c.
Initialize the PS Server, The WINC1500 support Non secure communication with another WINC1500, (SERVER/CLIENT) through one byte command (probe request and probe response) without any connection setup.
- Parameters:
-
[in] ch Server listening channel
- Returns:
- The function SHALL return M2M_SUCCESE for success and a negative value otherwise
- See also:
- m2m_wifi_req_client_ctrl
- Warning:
- The server mode can't be used with any other modes (STA/P2P/AP)
Definition at line 885 of file m2m_wifi.c.
Enable or Disable logs in run time (Disable Firmware logs will enhance the firmware start-up time and performance)
- Parameters:
-
[in] u16BattVoltx100 battery voltage multiplied by 100
- Returns:
- The function SHALL return M2M_SUCCESE for success and a negative value otherwise.
- See also:
- __DISABLE_FIRMWARE_LOGS__ (build option to disable logs from initializations)
- Precondition:
- m2m_wifi_init
- Warning:
Definition at line 1331 of file m2m_wifi.c.
Set the WINC1500 device name which is used as P2P device name.
- Parameters:
-
[in] pu8DeviceName Buffer holding the device name. [in] u8DeviceNameLength Length of the device name.
- Returns:
- The function SHALL return M2M_SUCCESS for success and a negative value otherwise.
- Warning:
- The Function called once after initialization.
Definition at line 1131 of file m2m_wifi.c.
| NMI_API sint8 m2m_wifi_set_lsn_int | ( | tstrM2mLsnInt * | pstrM2mLsnInt ) |
Set the Wi-Fi listen interval for power save operation. It is represented in units of AP Beacon periods.
- Parameters:
-
[in] pstrM2mLsnInt Structure holding the listen interval configurations.
- Returns:
- The function SHALL return 0 for success and a negative value otherwise.
- See also:
- tstrM2mLsnInt , m2m_wifi_set_sleep_mode
- Precondition:
- m2m_wifi_set_sleep_mode shall be called first
- Warning:
- The Function called once after initialization.
Definition at line 698 of file m2m_wifi.c.
Change the power profile mode.
- Parameters:
-
[in] u8PwrMode Change the WINC power profile to different mode PWR_LOW1/PWR_LOW2/PWR_HIGH/PWR_AUTO (tenuM2mPwrMode)
- Returns:
- The function SHALL return M2M_SUCCESE for success and a negative value otherwise.
- See also:
- tenuM2mPwrMode
- Precondition:
- m2m_wifi_init
- Warning:
- must be called after the initializations and before any connection request and can't be changed in run time,
Definition at line 1273 of file m2m_wifi.c.
set the ethernet receive buffer, should be called in the receive call back.
- Parameters:
-
[in] pvBuffer Pointer to the ethernet receive buffer. [in] u16BufferLen Length of the buffer.
- Returns:
- The function SHALL return 0 for success and a negative value otherwise.
Definition at line 1412 of file m2m_wifi.c.
Set the power saving mode for the WINC1500.
- Parameters:
-
[in] PsTyp Desired power saving mode. Supported types are defined in tenuPowerSaveModes. [in] BcastEn Broadcast reception enable flag. If it is 1, the WINC1500 must be awake each DTIM Beacon for receiving Broadcast traffic. If it is 0, the WINC1500 will not wakeup at the DTIM Beacon, but its wakeup depends only on the the configured Listen Interval.
- Returns:
- The function SHALL return 0 for success and a negative value otherwise.
- See also:
- tenuPowerSaveModes
- Warning:
- The function called once after initialization.
Definition at line 1088 of file m2m_wifi.c.
set the TX power tenuM2mTxPwrLevel
- Parameters:
-
[in] u8TxPwrLevel change the TX power tenuM2mTxPwrLevel
- Returns:
- The function SHALL return M2M_SUCCESE for success and a negative value otherwise.
- See also:
- tenuM2mTxPwrLevel
- Precondition:
- m2m_wifi_init
- Warning:
Definition at line 1291 of file m2m_wifi.c.
Generated on Wed Jul 13 2022 16:32:37 by
1.7.2