Microchip® Advanced Software Framework

main21.c File Reference

WINC1500 locate IP address example.

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

#include "asf.h"
#include "main.h"
#include "driver/include/m2m_wifi.h"
#include "socket/include/socket.h"
#include "stdio_serial.h"
#include <errno.h>
#include "iot/http/http_client.h"
#include "iot/json.h"

Macros

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

Functions

static void configure_console (void)
 Configure UART console. More...
 
static void configure_http_client (void)
 Configure HTTP client module. More...
 
static void configure_timer (void)
 Configure Timer module. More...
 
static void http_client_callback (struct http_client_module *module_inst, int type, union http_client_data *data)
 Callback of the HTTP client. More...
 
int main (void)
 Main application function. More...
 
static void socket_event_handler (SOCKET sock, uint8_t msg_type, void *msg_data)
 Callback to get the Socket event. More...
 
static void socket_resolve_handler (uint8_t *domain_name, uint32_t server_ip)
 Callback of gethostbyname function. More...
 
static void wifi_callback (uint8_t msg_type, void *msg_data)
 Callback to get the Wi-Fi status update. More...
 

Variables

static struct usart_module cdc_uart_module
 UART module for debug. More...
 
struct http_client_module http_client_module_inst
 Instance of HTTP client module. More...
 
struct sw_timer_module swt_module_inst
 Instance of Timer module. More...
 

#define STRING_EOL   "\r\n"
#define STRING_HEADER
Value:
"-- WINC1500 locate IP address example --"STRING_EOL \
"-- "BOARD_NAME " --"STRING_EOL \
"-- Compiled: "__DATE__ " "__TIME__ " --"STRING_EOL
#define BOARD_NAME
Name string macro.
Definition: samd21_xplained_pro.h:65
#define STRING_EOL
Definition: main21.c:97

Referenced by main().

static void configure_timer ( void  )
static

Configure Timer module.

References sw_timer_enable(), sw_timer_get_config_defaults(), sw_timer_init(), and swt_module_inst.

Referenced by main().

static void socket_event_handler ( SOCKET  sock,
uint8_t  msg_type,
void *  msg_data 
)
static

Callback to get the Socket event.

Parameters
[in]Socketdescriptor.
[in]msg_typetype of Socket notification. Possible types are:
[in]msg_dataA structure contains notification informations.

References http_client_socket_event_handler().

Referenced by main().

static void socket_resolve_handler ( uint8_t *  domain_name,
uint32_t  server_ip 
)
static

Callback of gethostbyname function.

Parameters
[in]doamin_nameDomain name.
[in]server_ipIP of server.

References http_client_socket_resolve_handler().

Referenced by main().

static void wifi_callback ( uint8_t  msg_type,
void *  msg_data 
)
static

Callback to get the Wi-Fi status update.

Parameters
[in]msg_typetype of Wi-Fi notification. Possible types are:
[in]pvMsgA pointer to a buffer containing the notification parameters (if any). It should be casted to the correct data type corresponding to the notification type. Existing types are:

References http_client_module_inst, http_client_send_request(), M2M_WIFI_CH_ALL, m2m_wifi_connect(), M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, M2M_WIFI_REQ_DHCP_CONF, m2m_wifi_request_dhcp_client(), M2M_WIFI_RESP_CON_STATE_CHANGED, MAIN_HTTP_CLIENT_TEST_METHOD, MAIN_HTTP_CLIENT_TEST_URL, MAIN_WLAN_AUTH, MAIN_WLAN_PSK, MAIN_WLAN_SSID, NULL, and tstrM2mWifiStateChanged::u8CurrState.

Referenced by main().

struct usart_module cdc_uart_module
static

UART module for debug.

Referenced by configure_console().

struct http_client_module http_client_module_inst

Instance of HTTP client module.

Referenced by configure_http_client(), http_client_callback(), and wifi_callback().

struct sw_timer_module swt_module_inst

Instance of Timer module.

Referenced by configure_http_client(), configure_timer(), and main().