STA Task.
Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include "FreeRTOS.h"
#include "osprintf.h"
#include "sta.h"
#include "lwip/ip.h"
#include "lwip/api.h"
#include "lwip/tcpip.h"
#include "lwip/dns.h"
#include "os/include/net_init.h"
#include "os/include/m2m_wifi_ex.h"
#include "tinyservices.h"
#include "conf_wilc.h"
#include <string.h>
#include <stdio.h>
#include <wchar.h>
#include "utf8/utf8.h"
Macros | |
#define | HTTP_PORT (80) |
Using broadcast address for simplicity. More... | |
#define | webSHORT_DELAY (10) |
Delay on close error. More... | |
Functions | |
static void | parse_response (char *buffer, uint32_t len) |
Parse weather server HTTP response. More... | |
static void | resolve_cb (const char *hostName, ip_addr_t *ipaddr, void *callback_arg) |
Callback function of IP address. More... | |
void | sta_task (void *argument) |
STA task main function. More... | |
static void | wifi_cb (uint8 msg_type, void *msg) |
Callback to get the Wi-Fi status update. More... | |
Variables | |
static const char * | city_list [] |
Cities list. More... | |
static xSemaphoreHandle | firmware_start_sem = NULL |
Firmware start event. More... | |
static volatile bool | gbConnectedWifi = false |
Wi-Fi status variable. More... | |
static volatile bool | gbHostIpByName = false |
Get host IP status variable. More... | |
tstrM2mWifiWepParams | gstrAPWepParam = WEP_CONN_PARAM |
tstrM2mWifiWepParams | gstrSTAWepParam = WEP_CONN_PARAM |
uint32_t | gu32HostIp = 0 |
IP address of host. More... | |
char | report [512] |
Built up report to display on HTML page for connected STA. More... | |
static char | server_host_name [] = STA_WEATHER_SERVER_NAME |
Server host name. More... | |
static char | server_response [2048] |
Weather forecast server HTTP response. More... | |
uint32_t | sta_connected = 0 |
Number of STA connected. More... | |
tstrM2MAPAssocInfo | strApAssocInfo |
unsigned int * | utf8_STA_mode_PSK = NULL |
unsigned int * | utf8_STA_mode_SSID = NULL |
#define HTTP_PORT (80) |
Using broadcast address for simplicity.
Referenced by sta_task().
#define webSHORT_DELAY (10) |
Delay on close error.
Referenced by sta_task().
|
static |
Parse weather server HTTP response.
[in] | buffer | actual response. |
[in] | len | response length. |
Referenced by sta_task().
|
static |
Callback function of IP address.
[in] | hostName | Domain name. |
[in] | hostIp | Server IP. |
References gbHostIpByName, and gu32HostIp.
Referenced by wifi_cb().
void sta_task | ( | void * | argument | ) |
STA task main function.
Referenced by main().
|
static |
Callback to get the Wi-Fi status update.
[in] | u8MsgType | Type of Wi-Fi notification. |
[in] | pvMsg | A pointer to a buffer containing the notification parameters. |
References AP_INTERFACE, tuniM2MWifiAuth::au8PSK, CONF_METHOD_LABEL, CONF_METHOD_PHYSICAL_PBC, gbConnectedWifi, gstrSTAWepParam, htons, M2M_ERR_AP_NOT_FOUND, M2M_ERR_AP_OVERLOAD, M2M_ERR_ASSOC_FAIL, M2M_ERR_AUTH_FAIL, M2M_ERR_LINK_LOSS, M2M_ERR_NONE, M2M_ERR_SEC_CNTRMSR, M2M_ERR_STATION_IS_LEAVING, M2M_WIFI_CH_11, M2M_WIFI_CH_ALL, M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, m2m_wifi_request_dhcp_client_ex(), M2M_WIFI_RESP_AP_ASSOC_INFO, M2M_WIFI_RESP_CON_STATE_CHANGED, M2M_WIFI_RESP_FIRMWARE_STRTED, M2M_WIFI_SEC_OPEN, M2M_WIFI_SEC_WEP, msg, NET_IF_REQ_DHCP_CONF, NET_IF_STA, net_interface_down(), net_interface_up(), NULL, os_m2m_wifi_connect(), os_m2m_wifi_p2p(), os_m2m_wifi_set_device_name(), os_m2m_wifi_set_p2p_control_ifc(), osprint(), osprintf(), P2P_INTERFACE, P2P_PBC, P2P_STA_CONCURRENCY_INTERFACE, resolve_cb(), server_host_name, sta_connected, STA_WLAN_AUTH, STA_WLAN_PSK, STA_WLAN_SSID, STATION_INTERFACE, tuniM2MWifiAuth::strWepInfo, u8_encode(), tstrM2mWifiStateChanged::u8CurrState, tstrM2mWifiStateChanged::u8ErrCode, tstrM2mWifiStateChanged::u8IfcId, tstrM2mWifiStateChanged::u8MAcAddr, tstrM2MIPConfig2::u8StaticIP, tstrM2MIPConfig2::u8StaticIPv6, utf8_STA_mode_PSK, utf8_STA_mode_SSID, vPortFree(), and xSemaphoreGive.
Referenced by sta_task().
|
static |
Cities list.
Referenced by sta_task().
|
static |
Firmware start event.
Wi-Fi status variable.
Referenced by sta_task(), and wifi_cb().
Get host IP status variable.
Referenced by resolve_cb(), and sta_task().
tstrM2mWifiWepParams gstrAPWepParam = WEP_CONN_PARAM |
Referenced by sta_task().
tstrM2mWifiWepParams gstrSTAWepParam = WEP_CONN_PARAM |
Referenced by sta_task(), and wifi_cb().
uint32_t gu32HostIp = 0 |
IP address of host.
Referenced by resolve_cb(), and sta_task().
char report[512] |
Built up report to display on HTML page for connected STA.
|
static |
Server host name.
Referenced by wifi_cb().
|
static |
Weather forecast server HTTP response.
Referenced by sta_task().
uint32_t sta_connected = 0 |
Number of STA connected.
tstrM2MAPAssocInfo strApAssocInfo |
unsigned int * utf8_STA_mode_PSK = NULL |
Referenced by sta_task(), and wifi_cb().
unsigned int* utf8_STA_mode_SSID = NULL |
Referenced by sta_task(), and wifi_cb().