Tue, 03 Oct 2023 17:24:06 +0200
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
0
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * @file task_wifi.h |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * @brief WiFi task. Connect to the known AP with the strongest signal. |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | */ |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | #ifndef _TASK_WIFI_H |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | #define _TASK_WIFI_H |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | /** |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * @brief Structure containing the information of the driver task. |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | */ |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | typedef struct { |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | bool STA_connected; ///< Connected to AP as station. |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | bool STA_online; ///< Connected and online. |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | char STA_ssid[33]; ///< Connected to this SSID. |
77
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
17 | char STA_bssid[18]; ///< Connected to this BSSID. |
0
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | int8_t STA_rssi; ///< Signal strength. |
77
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
19 | uint8_t STA_channel; ///< Connected channel. |
0
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | char STA_ip[17]; ///< IP address. |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | char STA_nm[17]; ///< IP netmask. |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | char STA_gw[17]; ///< IP gateway. |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | } WIFI_State; |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | /** |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | * @brief Test if Wifi is ready and connected |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | * @return Return true is connected and we have an IP address. |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | */ |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | bool ready_WiFi(void); |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | |
47
1ab1f4a8c328
Version 0.2.2 Changed to use a permanent network and WiFi connection. Removed three mainloop stages. Removed MQTT sequence counter that was not used. Update WiFi rssi status during eacht measure cycle. Changed FreeRTOS schedulng to 500 Hz.
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
33 | |
49 | 34 | /** |
35 | * @brief Signal to update the WiFi rssi status. | |
36 | */ | |
47
1ab1f4a8c328
Version 0.2.2 Changed to use a permanent network and WiFi connection. Removed three mainloop stages. Removed MQTT sequence counter that was not used. Update WiFi rssi status during eacht measure cycle. Changed FreeRTOS schedulng to 500 Hz.
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
37 | void status_WiFi(void); |
1ab1f4a8c328
Version 0.2.2 Changed to use a permanent network and WiFi connection. Removed three mainloop stages. Removed MQTT sequence counter that was not used. Update WiFi rssi status during eacht measure cycle. Changed FreeRTOS schedulng to 500 Hz.
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
38 | |
1ab1f4a8c328
Version 0.2.2 Changed to use a permanent network and WiFi connection. Removed three mainloop stages. Removed MQTT sequence counter that was not used. Update WiFi rssi status during eacht measure cycle. Changed FreeRTOS schedulng to 500 Hz.
Michiel Broek <mbroek@mbse.eu>
parents:
44
diff
changeset
|
39 | |
0
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | /** |
50
aae0056bc20b
Version 0.2.3 Added WiFi reconnect.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
41 | * @brief Request a WiFi connection. |
aae0056bc20b
Version 0.2.3 Added WiFi reconnect.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
42 | */ |
aae0056bc20b
Version 0.2.3 Added WiFi reconnect.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
43 | void request_WiFi(void); |
aae0056bc20b
Version 0.2.3 Added WiFi reconnect.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
44 | |
aae0056bc20b
Version 0.2.3 Added WiFi reconnect.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
45 | |
aae0056bc20b
Version 0.2.3 Added WiFi reconnect.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
46 | /** |
77
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
47 | * @brief Request a WiFi scan. |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
48 | */ |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
49 | void scan_WiFi(void); |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
50 | |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
51 | |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
52 | /** |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
53 | * @brief Request WiFi disconnect. |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
54 | */ |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
55 | void disconnect_WiFi(void); |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
56 | |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
57 | |
15dc572a7fcb
Version 0.3.0. Backported network code from experimental roaming project. Will now connect after reset to the strongest AP. Id the signal level drops below -67, extra scans are done to see for a better AP. Nothing is done yet. Removed config.conf file, all info is taken from the project menu and live tests. Better log the board type and send it via json mqtt. Send bssid and current channel too.
Michiel Broek <mbroek@mbse.eu>
parents:
50
diff
changeset
|
58 | /** |
0
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | * @brief Main task for the wifi_manager |
44
e52d11b8f252
Removed dead code. Added more doxygen documentation.
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
60 | * @param pvParameters Parameters for the task. |
0
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | */ |
44
e52d11b8f252
Removed dead code. Added more doxygen documentation.
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
62 | void task_wifi(void *pvParameters); |
0
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | |
88d965579617
Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | #endif |