STA Task.
Copyright (c) 2018-2020 Atmel Corporation. All rights reserved.
#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>
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 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 |
#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.
References ip_addr::addr, ANT_MODE, ANT_SWTCH_GPIO_CTRL_MODE, ANTENNA_GPIO_NUM_1, ANTENNA_GPIO_NUM_2, AP_WLAN_AUTH, AP_WLAN_PSK, AP_WLAN_SSID, tuniM2MWifiAuth::au8PSK, tstrM2MAPConfig::au8SSID, city_list, CONF_METHOD_LABEL, CONF_METHOD_PHYSICAL_PBC, ERR_OK, gbConnectedWifi, gbHostIpByName, gstrAPWepParam, gstrSTAWepParam, gu32HostIp, HTTP_PORT, M2M_WIFI_CH_11, M2M_WIFI_CH_ALL, M2M_WIFI_SEC_OPEN, M2M_WIFI_SEC_WEP, m2m_wifi_set_antenna_mode(), net_init(), netbuf_data(), netbuf_delete(), netbuf_next(), NULL, os_m2m_wifi_ap_get_assoc_info(), os_m2m_wifi_connect(), os_m2m_wifi_enable_ap(), os_m2m_wifi_init(), os_m2m_wifi_p2p(), os_m2m_wifi_set_device_name(), os_m2m_wifi_set_p2p_control_ifc(), osprint(), P2P_AP_CONCURRENCY_INTERFACE, P2P_PBC, param, parse_response(), tstrWifiInitParam::pfAppWifiCb, rx_buf, server_response, STA_POST_BUFFER, STA_PREFIX_BUFFER, STA_WLAN_AUTH, STA_WLAN_PSK, STA_WLAN_SSID, tuniM2MWifiAuth::strWepInfo, tstrM2MAPConfig::u16BeaconInterval, u8_encode(), tstrM2MAPConfig::u8ListenChannel, tstrM2MAPConfig::u8SecType, tstrM2MAPConfig::uniAuth, utf8_STA_mode_PSK, utf8_STA_mode_SSID, vPortFree(), vSemaphoreDelete, vTaskDelay(), webSHORT_DELAY, wifi_bt_if_sem, wifi_cb(), xSemaphoreCreateCounting, xSemaphoreGive, and xSemaphoreTake.
|
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, 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_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_SEC_WEP, msg, NET_IF_REQ_DHCP_CONF, NET_IF_STA, net_interface_down(), net_interface_up(), os_m2m_wifi_connect(), osprintf(), P2P_INTERFACE, resolve_cb(), server_host_name, sta_connected, STA_WLAN_AUTH, STA_WLAN_PSK, STA_WLAN_SSID, STATION_INTERFACE, tuniM2MWifiAuth::strWepInfo, tstrM2mWifiStateChanged::u8CurrState, tstrM2mWifiStateChanged::u8ErrCode, tstrM2mWifiStateChanged::u8IfcId, tstrM2mWifiStateChanged::u8MAcAddr, tstrM2MIPConfig2::u8StaticIP, and tstrM2MIPConfig2::u8StaticIPv6.
Referenced by sta_task().
|
static |
Cities list.
Referenced by sta_task().
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 |
tstrM2mWifiWepParams gstrSTAWepParam = WEP_CONN_PARAM |
uint32_t gu32HostIp = 0 |
IP address of host.
char report[512] |
Built up report to display on HTML page for connected STA.
Referenced by http_request(), and parse_response().
|
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 |