main/task_wifi.h

Sat, 20 Oct 2018 13:23:15 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 20 Oct 2018 13:23:15 +0200
changeset 0
b74b0e4902c3
child 1
ad2c8b13eb88
permissions
-rw-r--r--

Initial checkin brewboard

/**
 * @file task_wifi.h
 * @brief WiFi task. Connects to a known Access Point. If we know more then
 *        one AP, try to connect all of them until it succeeds (Not yet written).
 */

#ifndef _TASK_WIFI_H
#define _TASK_WIFI_H


/**
 * @brief Defines the maximum number of access points that can be scanned.
 *
 * To save memory and avoid nasty out of memory errors,
 * we can limit the number of APs detected in a wifi scan.
 * The display can handle 7 entries, allow a few more.
 */
#define MAX_AP_NUM 			10

/** 
 * @brief Defines access point's maximum number of clients. 
 */
#define AP_MAX_CONNECTIONS 		4


/**
 * @brief Structure containing the information of the driver task.
 */
typedef struct {
    bool		AP_active;		///< Is the AP active.
    uint8_t		AP_clients;		///< Connected AP clients.
    bool		STA_connected;		///< Connected to AP as station.
    char		STA_ssid[33];		///< Connected to this SSID.
    int8_t		STA_rssi;		///< Signal strength.
    char		STA_ip[16];		///< IP address.
    char		STA_nm[16];		///< IP netmask.
    char		STA_gw[16];		///< IP gateway.
} WIFI_State;



typedef enum update_reason_code_t {
    UPDATE_CONNECTION_OK = 0,
    UPDATE_FAILED_ATTEMPT = 1,
    UPDATE_USER_DISCONNECT = 2,
    UPDATE_LOST_CONNECTION = 3
} update_reason_code_t;



/**
 * @brief Get WiFi STA config.
 * #return wifi_config_t structure.
 */
//wifi_config_t* task_wifi_GetWifiStaConfig(void);

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

/**
 * @brief WiFi setup, init screens.
 */
bool WiFi_Init(void);

/**
 * @brief WiFi setup, loop screens.
 */
bool WiFi_Loop(void);


#endif

mercurial