Microchip® Advanced Software Framework

main.c File Reference

WINC3400 Simple Roaming HTTPS Example.

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

#include "asf.h"
#include <string.h>
#include "main.h"
#include "common/include/nm_common.h"
#include "driver/include/m2m_wifi.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...
 
void numtostring (char str[], int num)
 
static void socket_cb (SOCKET sock, uint8_t u8Msg, void *pvMsg)
 Callback to get the Data from socket. More...
 
static void wifi_cb (uint8_t u8MsgType, void *pvMsg)
 Callback to get the Wi-Fi status update. More...
 

Variables

unsigned int buffer_size
 
unsigned int counter = 0
 
static uint8_t gau8ReceivedBuffer [MAIN_WIFI_M2M_BUFFER_SIZE] = {0}
 Receive buffer definition. More...
 
static uint8_t gau8SocketTestBuffer [MAIN_WIFI_M2M_BUFFER_SIZE]
 Receive buffer definition. More...
 
char number [4]
 
static SOCKET tcp_client_socket = -1
 Socket for client. More...
 
static uint8_t wifi_connected
 Wi-Fi connection state. More...
 

#define STRING_EOL   "\r\n"
#define STRING_HEADER
Value:
"-- WINC3400 Simple Roaming HTTPS example --"STRING_EOL \
"-- "BOARD_NAME " --"STRING_EOL \
"-- Compiled: "__DATE__ " "__TIME__ " --"STRING_EOL
#define BOARD_NAME
Name of the board.
Definition: same70_xplained.h:75
#define STRING_EOL
Definition: main.c:108

Referenced by main().

static void configure_console ( void  )
static
void numtostring ( char  str[],
int  num 
)

Referenced by socket_cb().

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

Callback to get the Data from socket.

Parameters
[in]socksocket handler.
[in]u8Msgsocket event type. Possible values are:
  • SOCKET_MSG_BIND
  • SOCKET_MSG_LISTEN
  • SOCKET_MSG_ACCEPT
  • SOCKET_MSG_CONNECT
  • SOCKET_MSG_RECV
  • SOCKET_MSG_SEND
  • SOCKET_MSG_SENDTO
  • SOCKET_MSG_RECVFROM
[in]pvMsgis a pointer to message structure. Existing types are:

References close(), counter, gau8ReceivedBuffer, gau8SocketTestBuffer, MAIN_WIFI_M2M_BUFFER_SIZE, number, numtostring(), tstrSocketRecvMsg::pu8Buffer, recv(), tstrSocketRecvMsg::s16BufferSize, tstrSocketConnectMsg::s8Error, send(), SOCKET_MSG_CONNECT, SOCKET_MSG_RECV, SOCKET_MSG_SEND, and tcp_client_socket.

Referenced by main().

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

Callback to get the Wi-Fi status update.

Parameters
[in]u8MsgTypetype 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 M2M_WIFI_CH_ALL, m2m_wifi_connect(), M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, M2M_WIFI_REQ_DHCP_CONF, M2M_WIFI_RESP_CON_STATE_CHANGED, M2M_WIFI_ROAMED, MAIN_WLAN_AUTH, MAIN_WLAN_PSK, MAIN_WLAN_SSID, send(), tcp_client_socket, tstrM2mWifiStateChanged::u8CurrState, and wifi_connected.

Referenced by main().

unsigned int buffer_size
unsigned int counter = 0

Referenced by socket_cb().

uint8_t gau8ReceivedBuffer[MAIN_WIFI_M2M_BUFFER_SIZE] = {0}
static

Receive buffer definition.

Referenced by socket_cb().

uint8_t gau8SocketTestBuffer[MAIN_WIFI_M2M_BUFFER_SIZE]
static

Receive buffer definition.

Referenced by socket_cb().

char number[4]

Referenced by socket_cb().

SOCKET tcp_client_socket = -1
static

Socket for client.

Referenced by main(), socket_cb(), and wifi_cb().

uint8_t wifi_connected
static

Wi-Fi connection state.

Referenced by main(), and wifi_cb().