FreeRTOS: Wi-Fi Management Library
Return to main page ↑
iot_wifi.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS WiFi V1.0.6
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
31 #ifndef _AWS_WIFI_H_
32 #define _AWS_WIFI_H_
33 
34 #include <stdint.h>
35 
36 /* FreeRTOS include for BaseType_t. */
37 #include "portmacro.h"
38 
39 /* Wi-Fi configuration includes. */
40 #include "aws_wifi_config.h"
41 #include "types/iot_network_types.h"
42 
49 typedef enum
50 {
56 
62 typedef enum
63 {
71 
78 typedef enum
79 {
85 
92 typedef enum
93 {
99 
107 typedef struct
108 {
109  const char * pcSSID;
110  uint8_t ucSSIDLength;
111  const char * pcPassword;
114  int8_t cChannel;
116 
130 typedef struct
131 {
132  char cSSID[ wificonfigMAX_SSID_LEN + 1 ];
133  uint8_t ucBSSID[ wificonfigMAX_BSSID_LEN ];
135  int8_t cRSSI;
136  int8_t cChannel;
137  uint8_t ucHidden;
139 
149 typedef struct
150 {
151  char cSSID[ wificonfigMAX_SSID_LEN + 1 ];
152  uint8_t ucSSIDLength;
153  uint8_t ucBSSID[ wificonfigMAX_BSSID_LEN ];
154  char cPassword[ wificonfigMAX_PASSPHRASE_LEN + 1 ];
158 
167 /* @[declare_wifi_wifi_on] */
169 /* @[declare_wifi_wifi_on] */
170 
179 /* @[declare_wifi_wifi_off] */
181 /* @[declare_wifi_wifi_off] */
182 
213 /* @[declare_wifi_wifi_connectap] */
214 WIFIReturnCode_t WIFI_ConnectAP( const WIFINetworkParams_t * const pxNetworkParams );
215 /* @[declare_wifi_wifi_connectap] */
216 
223 /* @[declare_wifi_wifi_disconnect] */
225 /* @[declare_wifi_wifi_disconnect] */
226 
232 /* @[declare_wifi_wifi_reset] */
234 /* @[declare_wifi_wifi_reset] */
235 
253 /* @[declare_wifi_wifi_setmode] */
255 /* @[declare_wifi_wifi_setmode] */
256 
275 /* @[declare_wifi_wifi_getmode] */
277 /* @[declare_wifi_wifi_getmode] */
278 
302 /* @[declare_wifi_wifi_networkadd] */
303 WIFIReturnCode_t WIFI_NetworkAdd( const WIFINetworkProfile_t * const pxNetworkProfile,
304  uint16_t * pusIndex );
305 /* @[declare_wifi_wifi_networkadd] */
306 
307 
333 /* @[declare_wifi_wifi_networkget] */
335  uint16_t usIndex );
336 /* @[declare_wifi_wifi_networkget] */
337 
360 /* @[declare_wifi_wifi_networkdelete] */
362 /* @[declare_wifi_wifi_networkdelete] */
363 
373 /* @[declare_wifi_wifi_ping] */
374 WIFIReturnCode_t WIFI_Ping( uint8_t * pucIPAddr,
375  uint16_t usCount,
376  uint32_t ulIntervalMS );
377 /* @[declare_wifi_wifi_ping] */
378 
393 /* @[declare_wifi_wifi_getip] */
394 WIFIReturnCode_t WIFI_GetIP( uint8_t * pucIPAddr );
395 /* @[declare_wifi_wifi_getip] */
396 
411 /* @[declare_wifi_wifi_getmac] */
412 WIFIReturnCode_t WIFI_GetMAC( uint8_t * pucMac );
413 /* @[declare_wifi_wifi_getmac] */
414 
430 /* @[declare_wifi_wifi_gethostip] */
432  uint8_t * pucIPAddr );
433 /* @[declare_wifi_wifi_gethostip] */
434 
452 /* @[declare_wifi_wifi_scan] */
454  uint8_t ucNumNetworks );
455 /* @[declare_wifi_wifi_scan] */
456 
462 /* @[declare_wifi_wifi_startap] */
464 /* @[declare_wifi_wifi_startap] */
465 
471 /* @[declare_wifi_wifi_stopap] */
473 /* @[declare_wifi_wifi_stopap] */
474 
492 /* @[declare_wifi_wifi_configureap] */
493 WIFIReturnCode_t WIFI_ConfigureAP( const WIFINetworkParams_t * const pxNetworkParams );
494 /* @[declare_wifi_wifi_configureap] */
495 
507 /* @[declare_wifi_wifi_setpmmode] */
509  const void * pvOptionValue );
510 /* @[declare_wifi_wifi_setpmmode] */
511 
521 /* @[declare_wifi_wifi_getpmmode] */
523  void * pvOptionValue );
524 /* @[declare_wifi_wifi_getpmmode] */
525 
526 
534 /* @[declare_wifi_wifi_registernetworkstatechangeeventcallback] */
535 WIFIReturnCode_t WIFI_RegisterNetworkStateChangeEventCallback( IotNetworkStateChangeEventCallback_t xCallback );
536 /* @[declare_wifi_wifi_registernetworkstatechangeeventcallback] */
537 
543 /* @[declare_wifi_wifi_isconnected] */
544 BaseType_t WIFI_IsConnected( void );
545 /* @[declare_wifi_wifi_isconnected] */
546 
547 
548 #endif /* _AWS_WIFI_H_ */
WIFI_GetHostIP
WIFIReturnCode_t WIFI_GetHostIP(char *pcHost, uint8_t *pucIPAddr)
Retrieves the host IP address from a host name using DNS.
WIFISecurity_t
WIFISecurity_t
Wi-Fi Security types.
Definition: iot_wifi.h:63
WIFINetworkProfile_t::ucPasswordLength
uint8_t ucPasswordLength
Definition: iot_wifi.h:155
WIFIDeviceMode_t
WIFIDeviceMode_t
Wi-Fi device modes.
Definition: iot_wifi.h:79
eWiFiSecurityWPA2_ent
@ eWiFiSecurityWPA2_ent
Definition: iot_wifi.h:68
WIFINetworkProfile_t::ucSSIDLength
uint8_t ucSSIDLength
Definition: iot_wifi.h:152
eWiFiNotSupported
@ eWiFiNotSupported
Definition: iot_wifi.h:54
eWiFiModeStation
@ eWiFiModeStation
Definition: iot_wifi.h:80
WIFINetworkProfile_t::xSecurity
WIFISecurity_t xSecurity
Definition: iot_wifi.h:156
WIFI_Reset
WIFIReturnCode_t WIFI_Reset(void)
Resets the Wi-Fi Module.
WIFI_On
WIFIReturnCode_t WIFI_On(void)
Turns on Wi-Fi.
eWiFiSecurityWPA2
@ eWiFiSecurityWPA2
Definition: iot_wifi.h:67
WIFI_NetworkAdd
WIFIReturnCode_t WIFI_NetworkAdd(const WIFINetworkProfile_t *const pxNetworkProfile, uint16_t *pusIndex)
Add a Wi-Fi Network profile.
WIFI_GetIP
WIFIReturnCode_t WIFI_GetIP(uint8_t *pucIPAddr)
Retrieves the Wi-Fi interface's IP address.
eWiFiSecurityNotSupported
@ eWiFiSecurityNotSupported
Definition: iot_wifi.h:69
WIFINetworkParams_t::pcPassword
const char * pcPassword
Definition: iot_wifi.h:111
eWiFiPMNormal
@ eWiFiPMNormal
Definition: iot_wifi.h:94
WIFI_StartAP
WIFIReturnCode_t WIFI_StartAP(void)
Start SoftAP mode.
eWiFiFailure
@ eWiFiFailure
Definition: iot_wifi.h:52
WIFI_StopAP
WIFIReturnCode_t WIFI_StopAP(void)
Stop SoftAP mode.
WIFINetworkParams_t::ucPasswordLength
uint8_t ucPasswordLength
Definition: iot_wifi.h:112
eWiFiPMNotSupported
@ eWiFiPMNotSupported
Definition: iot_wifi.h:97
WIFIPMMode_t
WIFIPMMode_t
Wi-Fi device power management modes.
Definition: iot_wifi.h:93
WIFIScanResult_t::xSecurity
WIFISecurity_t xSecurity
Definition: iot_wifi.h:134
eWiFiPMLowPower
@ eWiFiPMLowPower
Definition: iot_wifi.h:95
eWiFiSuccess
@ eWiFiSuccess
Definition: iot_wifi.h:51
WIFI_SetPMMode
WIFIReturnCode_t WIFI_SetPMMode(WIFIPMMode_t xPMModeType, const void *pvOptionValue)
Set the Wi-Fi power management mode.
WIFI_Scan
WIFIReturnCode_t WIFI_Scan(WIFIScanResult_t *pxBuffer, uint8_t ucNumNetworks)
Perform a Wi-Fi network Scan.
WIFINetworkParams_t
Parameters passed to the WIFI_ConnectAP API for connection.
Definition: iot_wifi.h:108
WIFI_NetworkGet
WIFIReturnCode_t WIFI_NetworkGet(WIFINetworkProfile_t *pxNetworkProfile, uint16_t usIndex)
Get a Wi-Fi network profile.
WIFI_ConfigureAP
WIFIReturnCode_t WIFI_ConfigureAP(const WIFINetworkParams_t *const pxNetworkParams)
Configure SoftAP.
WIFI_SetMode
WIFIReturnCode_t WIFI_SetMode(WIFIDeviceMode_t xDeviceMode)
Sets the Wi-Fi mode.
WIFI_RegisterNetworkStateChangeEventCallback
WIFIReturnCode_t WIFI_RegisterNetworkStateChangeEventCallback(IotNetworkStateChangeEventCallback_t xCallback)
Registers application callback for network state change events from WiFi layer.
WIFI_NetworkDelete
WIFIReturnCode_t WIFI_NetworkDelete(uint16_t usIndex)
Delete a Wi-Fi Network profile.
eWiFiModeP2P
@ eWiFiModeP2P
Definition: iot_wifi.h:82
WIFI_Off
WIFIReturnCode_t WIFI_Off(void)
Turns off Wi-Fi.
WIFI_Disconnect
WIFIReturnCode_t WIFI_Disconnect(void)
Disconnects from the currently connected Access Point.
eWiFiTimeout
@ eWiFiTimeout
Definition: iot_wifi.h:53
WIFI_GetMode
WIFIReturnCode_t WIFI_GetMode(WIFIDeviceMode_t *pxDeviceMode)
Gets the Wi-Fi mode.
WIFIScanResult_t
Wi-Fi scan results.
Definition: iot_wifi.h:131
WIFINetworkParams_t::ucSSIDLength
uint8_t ucSSIDLength
Definition: iot_wifi.h:110
WIFINetworkParams_t::pcSSID
const char * pcSSID
Definition: iot_wifi.h:109
WIFI_GetMAC
WIFIReturnCode_t WIFI_GetMAC(uint8_t *pucMac)
Retrieves the Wi-Fi interface's MAC address.
eWiFiPMAlwaysOn
@ eWiFiPMAlwaysOn
Definition: iot_wifi.h:96
eWiFiModeNotSupported
@ eWiFiModeNotSupported
Definition: iot_wifi.h:83
WIFI_IsConnected
BaseType_t WIFI_IsConnected(void)
Check if the Wi-Fi is connected.
WIFINetworkParams_t::cChannel
int8_t cChannel
Definition: iot_wifi.h:114
WIFIScanResult_t::cRSSI
int8_t cRSSI
Definition: iot_wifi.h:135
WIFIScanResult_t::cChannel
int8_t cChannel
Definition: iot_wifi.h:136
WIFI_ConnectAP
WIFIReturnCode_t WIFI_ConnectAP(const WIFINetworkParams_t *const pxNetworkParams)
Connects to the Wi-Fi Access Point (AP) specified in the input.
WIFIReturnCode_t
WIFIReturnCode_t
Return code denoting API status.
Definition: iot_wifi.h:50
eWiFiSecurityWEP
@ eWiFiSecurityWEP
Definition: iot_wifi.h:65
WIFINetworkParams_t::xSecurity
WIFISecurity_t xSecurity
Definition: iot_wifi.h:113
eWiFiSecurityOpen
@ eWiFiSecurityOpen
Definition: iot_wifi.h:64
eWiFiSecurityWPA
@ eWiFiSecurityWPA
Definition: iot_wifi.h:66
WIFI_GetPMMode
WIFIReturnCode_t WIFI_GetPMMode(WIFIPMMode_t *pxPMModeType, void *pvOptionValue)
Get the Wi-Fi power management mode.
WIFINetworkProfile_t
Wi-Fi network parameters passed to the WIFI_NetworkAdd API.
Definition: iot_wifi.h:150
eWiFiModeAP
@ eWiFiModeAP
Definition: iot_wifi.h:81
WIFIScanResult_t::ucHidden
uint8_t ucHidden
Definition: iot_wifi.h:137
WIFI_Ping
WIFIReturnCode_t WIFI_Ping(uint8_t *pucIPAddr, uint16_t usCount, uint32_t ulIntervalMS)
Ping an IP address in the network.