Microchip® Advanced Software Framework

winc1500/weather_client_example/main21.c File Reference

WINC1500 Weather Client Example.

Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.

#include "asf.h"
#include "main.h"
#include "bsp/include/nm_bsp.h"
#include "socket/include/socket.h"

Macros

#define STRING_EOL   "\r\n"
 
#define STRING_HEADER
 

Functions

static void configure_console (void)
 Configure UART console. More...
 
int main (void)
 Main application function. More...
 
static void resolve_cb (uint8_t *hostName, uint32_t hostIp)
 Callback function of IP address. More...
 
static void set_dev_name_to_mac (uint8_t *name, uint8_t *mac_addr)
 
static void socket_cb (SOCKET sock, uint8_t u8Msg, void *pvMsg)
 Callback function of TCP client socket. More...
 
static void wifi_cb (uint8_t u8MsgType, void *pvMsg)
 Callback to get the Wi-Fi status update. More...
 

Variables

static struct usart_module cdc_uart_module
 UART module for debug. More...
 
static uint8_t gau8ReceivedBuffer [MAIN_WIFI_M2M_BUFFER_SIZE] = {0}
 Receive buffer definition. More...
 
static bool gbConnectedWifi = false
 Wi-Fi status variable. More...
 
static bool gbHostIpByName = false
 Get host IP status variable. More...
 
static bool gbTcpConnection = false
 TCP Connection status variable. More...
 
uint32_t gu32HostIp = 0
 IP address of host. More...
 
static SOCKET tcp_client_socket = -1
 TCP client socket handlers. More...
 

#define STRING_EOL   "\r\n"
#define STRING_HEADER
Value:
"-- WINC1500 weather client example --"STRING_EOL \
"-- "BOARD_NAME " --"STRING_EOL \
"-- Compiled: "__DATE__ " "__TIME__ " --"STRING_EOL
#define BOARD_NAME
Definition: app_init.h:140
#define STRING_EOL
Definition: winc1500/weather_client_example/main21.c:90

Referenced by main().

static void resolve_cb ( uint8_t *  hostName,
uint32_t  hostIp 
)
static

Callback function of IP address.

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

References gbHostIpByName, gu32HostIp, IPV4_BYTE, and printf.

Referenced by main().

static void set_dev_name_to_mac ( uint8_t *  name,
uint8_t *  mac_addr 
)
static

References len, m2m_strlen(), and MAIN_HEX2ASCII.

Referenced by main().

static void socket_cb ( SOCKET  sock,
uint8_t  u8Msg,
void *  pvMsg 
)
static

Callback function of TCP client socket.

Parameters
[in]socksocket handler.
[in]u8MsgType of Socket notification
[in]pvMsgA structure contains notification informations.
Returns
None.

References close(), gau8ReceivedBuffer, gbTcpConnection, MAIN_CITY_NAME, MAIN_POST_BUFFER, MAIN_PREFIX_BUFFER, MAIN_WIFI_M2M_BUFFER_SIZE, NULL, port_pin_set_output_level(), printf, tstrSocketRecvMsg::pu8Buffer, recv(), tstrSocketRecvMsg::s16BufferSize, tstrSocketConnectMsg::s8Error, send(), SOCK_ERR_NO_ERROR, SOCKET_MSG_CONNECT, SOCKET_MSG_RECV, and tcp_client_socket.

Referenced by main().

static void wifi_cb ( uint8_t  u8MsgType,
void *  pvMsg 
)
static

struct usart_module cdc_uart_module
static

UART module for debug.

uint8_t gau8ReceivedBuffer[MAIN_WIFI_M2M_BUFFER_SIZE] = {0}
static

Receive buffer definition.

Referenced by socket_cb().

bool gbConnectedWifi = false
static

Wi-Fi status variable.

Referenced by main(), and wifi_cb().

bool gbHostIpByName = false
static

Get host IP status variable.

Referenced by main(), and resolve_cb().

bool gbTcpConnection = false
static

TCP Connection status variable.

Referenced by main(), and socket_cb().

uint32_t gu32HostIp = 0

IP address of host.

SOCKET tcp_client_socket = -1
static

TCP client socket handlers.

Referenced by main(), and socket_cb().