main/task_wifi.c

changeset 44
e52d11b8f252
parent 37
358bbd5b608e
child 47
1ab1f4a8c328
equal deleted inserted replaced
43:70c99c2084dc 44:e52d11b8f252
15 uint16_t ap_num = MAX_AP_NUM; ///< Scan counter. 15 uint16_t ap_num = MAX_AP_NUM; ///< Scan counter.
16 wifi_ap_record_t *accessp_records; ///< [MAX_AP_NUM] records array with scan results. 16 wifi_ap_record_t *accessp_records; ///< [MAX_AP_NUM] records array with scan results.
17 wifi_config_t *task_wifi_ConfigSTA = NULL; ///< Current STA configuration. 17 wifi_config_t *task_wifi_ConfigSTA = NULL; ///< Current STA configuration.
18 WIFI_State *wifi_state = NULL; ///< Public state for other tasks. 18 WIFI_State *wifi_state = NULL; ///< Public state for other tasks.
19 19
20 wifi_scan_config_t scan_config = { ///< WiFi scanner configuration. 20 wifi_scan_config_t scan_config = {
21 .ssid = 0, 21 .ssid = 0,
22 .bssid = 0, 22 .bssid = 0,
23 .channel = 0, 23 .channel = 0,
24 .show_hidden = false, 24 .show_hidden = false,
25 .scan_time.passive = 130 ///< Beacons are usually sent every 100 mSec. 25 .scan_time.passive = 130 ///< Beacons are usually sent every 100 mSec.
26 }; 26 }; ///< WiFi scanner configuration.
27 27
28 uint8_t _wifi_ssid[33]; ///< Current SSID 28 uint8_t _wifi_ssid[33]; ///< Current SSID
29 bool _wifi_ScanAPs = false; ///< Scanning 29 bool _wifi_ScanAPs = false; ///< Scanning
30 bool _wifi_ScanDone = false; ///< Scan ready 30 bool _wifi_ScanDone = false; ///< Scan ready
31 uint16_t _wifi_Scanned = 0; ///< Total scanned APs. 31 uint16_t _wifi_Scanned = 0; ///< Total scanned APs.
32 32
33 extern uint32_t TimeSpent; ///< Counter that is increased each second.
34 extern bool System_TimeOk;
35 extern time_t now;
36 extern char strftime_buf[64];
37 extern struct tm timeinfo;
38 33
39 const int TASK_WIFI_REQUEST_WIFI_SCAN = BIT0; ///< When set, means a client requested to scan wireless networks. 34 const int TASK_WIFI_REQUEST_WIFI_SCAN = BIT0; ///< When set, means a client requested to scan wireless networks.
40 const int TASK_WIFI_REQUEST_STA_DISCONNECT = BIT1; ///< When set, means a client requested to disconnect from currently connected AP. 35 const int TASK_WIFI_REQUEST_STA_DISCONNECT = BIT1; ///< When set, means a client requested to disconnect from currently connected AP.
41 const int TASK_WIFI_REQUEST_STA_CONNECT = BIT2; ///< When set, means a client requested to connect to an access point. 36 const int TASK_WIFI_REQUEST_STA_CONNECT = BIT2; ///< When set, means a client requested to connect to an access point.
42 37
46 const int TASK_WIFI_STA_CONNECTED = BIT6; ///< Indicate that we are connected to AP as station, flip of BIT6. 41 const int TASK_WIFI_STA_CONNECTED = BIT6; ///< Indicate that we are connected to AP as station, flip of BIT6.
47 42
48 const int TASK_WIFI_REQUEST_SYSTEM = BIT8; ///< The system needs a connection 43 const int TASK_WIFI_REQUEST_SYSTEM = BIT8; ///< The system needs a connection
49 const int TASK_WIFI_REQUEST_USER = BIT9; ///< The user needs a connection 44 const int TASK_WIFI_REQUEST_USER = BIT9; ///< The user needs a connection
50 45
51
52 /**
53 * @brief local callback function. Is called when the timesync is valid
54 * from a timeserver. Sets the global boolean System_TimeOk value.
55 * @param tv is the received time. Not used.
56 */
57 //void time_sync_notification_cb(struct timeval *tv);
58 46
59 /** 47 /**
60 * @brief Array with AP security names 48 * @brief Array with AP security names
61 */ 49 */
62 const char *apsec[] = { "Open", "WEP", "WPA", "WPA2", "WPA WPA2", "Enterprise" }; 50 const char *apsec[] = { "Open", "WEP", "WPA", "WPA2", "WPA WPA2", "Enterprise" };

mercurial