|
1 /** |
|
2 * @file task_wifi.h |
|
3 * @brief WiFi task. Connects to a known Access Point. If we know more then |
|
4 * one AP, try to connect all of them until it succeeds (Not yet written). |
|
5 */ |
|
6 |
|
7 #ifndef _TASK_WIFI_H |
|
8 #define _TASK_WIFI_H |
|
9 |
|
10 |
|
11 /** |
|
12 * @brief Defines the maximum number of access points that can be scanned. |
|
13 * |
|
14 * To save memory and avoid nasty out of memory errors, |
|
15 * we can limit the number of APs detected in a wifi scan. |
|
16 * The display can handle 7 entries, allow a few more. |
|
17 */ |
|
18 #define MAX_AP_NUM 10 |
|
19 |
|
20 /** |
|
21 * @brief Defines access point's maximum number of clients. |
|
22 */ |
|
23 #define AP_MAX_CONNECTIONS 4 |
|
24 |
|
25 |
|
26 /** |
|
27 * @brief Structure containing the information of the driver task. |
|
28 */ |
|
29 typedef struct { |
|
30 bool AP_active; ///< Is the AP active. |
|
31 uint8_t AP_clients; ///< Connected AP clients. |
|
32 bool STA_connected; ///< Connected to AP as station. |
|
33 char STA_ssid[33]; ///< Connected to this SSID. |
|
34 int8_t STA_rssi; ///< Signal strength. |
|
35 char STA_ip[16]; ///< IP address. |
|
36 char STA_nm[16]; ///< IP netmask. |
|
37 char STA_gw[16]; ///< IP gateway. |
|
38 } WIFI_State; |
|
39 |
|
40 |
|
41 |
|
42 typedef enum update_reason_code_t { |
|
43 UPDATE_CONNECTION_OK = 0, |
|
44 UPDATE_FAILED_ATTEMPT = 1, |
|
45 UPDATE_USER_DISCONNECT = 2, |
|
46 UPDATE_LOST_CONNECTION = 3 |
|
47 } update_reason_code_t; |
|
48 |
|
49 |
|
50 |
|
51 /** |
|
52 * @brief Get WiFi STA config. |
|
53 * #return wifi_config_t structure. |
|
54 */ |
|
55 //wifi_config_t* task_wifi_GetWifiStaConfig(void); |
|
56 |
|
57 /** |
|
58 * @brief Main task for the wifi_manager |
|
59 */ |
|
60 void task_wifi( void * pvParameters ); |
|
61 |
|
62 /** |
|
63 * @brief WiFi setup, init screens. |
|
64 */ |
|
65 bool WiFi_Init(void); |
|
66 |
|
67 /** |
|
68 * @brief WiFi setup, loop screens. |
|
69 */ |
|
70 bool WiFi_Loop(void); |
|
71 |
|
72 |
|
73 #endif |