Microchip® Advanced Software Framework

winc3400/mode_sta_bypass_example/sta.c File Reference

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.

static void resolve_cb ( const char *  hostName,
ip_addr_t ipaddr,
void *  callback_arg 
)
static

Callback function of IP address.

Parameters
[in]hostNameDomain name.
[in]hostIpServer IP.
Returns
None.

References gbHostIpByName, and gu32HostIp.

Referenced by wifi_cb().

static void wifi_cb ( uint8  msg_type,
void *  msg 
)
static

Callback to get the Wi-Fi status update.

Parameters
[in]u8MsgTypeType of Wi-Fi notification.
[in]pvMsgA pointer to a buffer containing the notification parameters.
Returns
None.

References 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().

volatile bool gbConnectedWifi = false
static

Wi-Fi status variable.

Referenced by wifi_cb().

volatile bool gbHostIpByName = false
static

Get host IP status variable.

Referenced by resolve_cb().

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().

char server_host_name[] = STA_WEATHER_SERVER_NAME
static

Server host name.

Referenced by wifi_cb().

uint32_t sta_connected = 0

Number of STA connected.