main/task_wifi.h

Tue, 03 Oct 2023 17:24:06 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 03 Oct 2023 17:24:06 +0200
changeset 77
15dc572a7fcb
parent 50
aae0056bc20b
permissions
-rw-r--r--

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.

/**
 * @file task_wifi.h
 * @brief WiFi task. Connect to the known AP with the strongest signal.
 */

#ifndef _TASK_WIFI_H
#define _TASK_WIFI_H


/**
 * @brief Structure containing the information of the driver task.
 */
typedef struct {
    bool		STA_connected;		///< Connected to AP as station.
    bool		STA_online;		///< Connected and online.
    char		STA_ssid[33];		///< Connected to this SSID.
    char		STA_bssid[18];		///< Connected to this BSSID.
    int8_t		STA_rssi;		///< Signal strength.
    uint8_t		STA_channel;		///< Connected channel.
    char		STA_ip[17];		///< IP address.
    char		STA_nm[17];		///< IP netmask.
    char		STA_gw[17];		///< IP gateway.
} WIFI_State;



/**
 * @brief Test if Wifi is ready and connected
 * @return Return true is connected and we have an IP address.
 */
bool ready_WiFi(void);


/**
 * @brief Signal to update the WiFi rssi status.
 */
void status_WiFi(void);


/**
 * @brief Request a WiFi connection.
 */
void request_WiFi(void);


/**
 * @brief Request a WiFi scan.
 */
void scan_WiFi(void);


/**
 * @brief Request WiFi disconnect.
 */
void disconnect_WiFi(void);


/**
 * @brief Main task for the wifi_manager
 * @param pvParameters Parameters for the task.
 */
void task_wifi(void *pvParameters);


#endif

mercurial