Microchip® Advanced Software Framework

wilc/weather_concurrent_bt_demo/sta.c File Reference

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 void parse_response ( char *  buffer,
uint32_t  len 
)
static

Parse weather server HTTP response.

Parameters
[in]bufferactual response.
[in]lenresponse length.
Returns
None.

References NULL, and report.

Referenced by sta_task().

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

void sta_task ( void *  argument)

STA task main function.

Referenced by main().

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

const char* city_list[]
static
Initial value:
= {
"Paris",
"Rome",
"Berlin",
"Cairo",
"Windhoek",
"Chennai",
"Hyderabad",
"Mumbai",
"Bangkok",
"Shanghai",
"Tokyo"
}

Cities list.

Referenced by sta_task().

xSemaphoreHandle firmware_start_sem = NULL
static

Firmware start event.

volatile bool gbConnectedWifi = false
static

Wi-Fi status variable.

Referenced by sta_task(), and wifi_cb().

volatile bool gbHostIpByName = false
static

Get host IP status variable.

Referenced by resolve_cb(), and sta_task().

Referenced by sta_task().

Referenced by sta_task(), and wifi_cb().

uint32_t gu32HostIp = 0

IP address of host.

char report[512]

Built up report to display on HTML page for connected STA.

char server_host_name[] = STA_WEATHER_SERVER_NAME
static

Server host name.

Referenced by wifi_cb().

char server_response[2048]
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().