STA Task.
Copyright (c) 2019 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 "net_init.h"
#include "m2m_wifi_ex.h"
#include "tinyservices.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 | 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 volatile bool | gbConnectedWifi = false |
Wi-Fi status variable. More... | |
static volatile bool | gbHostIpByName = false |
Get host IP status variable. More... | |
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... | |
uint32_t | sta_connected = 0 |
Number of STA connected. More... | |
#define HTTP_PORT (80) |
Using broadcast address for simplicity.
#define webSHORT_DELAY (10) |
Delay on close error.
Callback function of IP address.
[in] | hostName | Domain name. |
[in] | hostIp | Server IP. |
References gbHostIpByName, and gu32HostIp.
Referenced by wifi_cb().
STA task main function.
References tstrM2MAPConfig::au8SSID, M2M_WIFI_CH_11, M2M_WIFI_CH_ALL, M2M_WIFI_SEC_OPEN, net_init(), os_m2m_wifi_connect(), os_m2m_wifi_init(), tstrWifiInitParam::pfAppWifiCb, STA_WLAN_AUTH, STA_WLAN_PSK, STA_WLAN_SSID, tstrM2MAPConfig::u8ListenChannel, tstrM2MAPConfig::u8SecType, vTaskDelay(), and wifi_cb().
Referenced by main().
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 dns_gethostbyname(), gbConnectedWifi, M2M_WIFI_CH_ALL, M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, M2M_WIFI_REQ_DHCP_CONF, m2m_wifi_request_dhcp_client_ex(), M2M_WIFI_RESP_CON_STATE_CHANGED, NET_IF_STA, net_interface_down(), net_interface_up(), os_m2m_wifi_connect(), osprintf(), resolve_cb(), server_host_name, STA_WLAN_AUTH, STA_WLAN_PSK, STA_WLAN_SSID, and tstrM2mWifiStateChanged::u8CurrState.
Referenced by sta_task().
Get host IP status variable.
Referenced by resolve_cb().
uint32_t gu32HostIp = 0 |
IP address of host.
Referenced by resolve_cb().
char report[512] |
Built up report to display on HTML page for connected STA.
|
static |
Server host name.
Referenced by wifi_cb().
uint32_t sta_connected = 0 |
Number of STA connected.