This module contains WINC3400 Host MCU Provisioning implementation.
Copyright (c) 2019 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include "wifi_prov.h"
#include "http_content.h"
#include "socket/include/socket.h"
#include "driver/include/m2m_wifi.h"
#include <string.h>
Enumerations | |
enum | prov_app_status { APP_PROV_INIT, APP_PROV_WINC_CONNECTED, APP_PROV_START, APP_PROV_END, APP_PROV_AP_DISABLE, APP_PROV_DEINIT, APP_PROV_IDLE, APP_PROV_INIT, APP_PROV_WINC_CONNECTED, APP_PROV_START, APP_PROV_END, APP_PROV_AP_DISABLE, APP_PROV_DEINIT, APP_PROV_IDLE } |
Main app status. More... | |
Functions | |
static void | html_handler (SOCKET sock, uint8_t *p, int16_t p_sz, wifiProvisionParams *provInfo) |
static void | prov_socket_cb (SOCKET sock, uint8_t u8Msg, void *pvMsg) |
Callback to get the Data from socket. More... | |
static void | prov_wifi_cb (uint8_t u8MsgType, void *pvMsg) |
Callback to get the Wi-Fi status update. More... | |
void | wifi_ap_connect (wifiProvisionParams *provParams) |
Wi-Fi Provisioning ap connect function. More... | |
void | wifi_ap_provision (wifiProvisionParams *provParams) |
Wi-Fi Provisioning main application function. More... | |
Variables | |
static volatile prov_app_status | gu8AppStatus = APP_PROV_INIT |
static SOCKET | http_server_socket = -1 |
Socket for TCP communication. More... | |
wifiProvisionParams * | httpProvInfo |
static uint8_t | rx_buf [RX_BUF_SZ] |
HTTP server globals. More... | |
static SOCKET | tcp_client_socket = -1 |
tstr1xAuthTLSCredentials | tlsCredentials |
enum prov_app_status |
|
static |
References APP_PROV_END, construct_http_response(), gu8AppStatus, POST_RESP, send(), and SOCKET_BUFFER_MAX_LENGTH.
Referenced by prov_socket_cb().
|
static |
Callback to get the Data from socket.
[in] | sock | socket handler. |
[in] | u8Msg | socket event type. Possible values are:
|
[in] | pvMsg | is a pointer to message structure. Existing types are: |
References accept(), html_handler(), http_server_socket, listen(), NULL, tstrSocketRecvMsg::pu8Buffer, recv(), rx_buf, tstrSocketRecvMsg::s16BufferSize, tstrSocketAcceptMsg::sock, SOCKET_MSG_ACCEPT, SOCKET_MSG_BIND, SOCKET_MSG_LISTEN, SOCKET_MSG_RECV, SOCKET_MSG_SEND, tstrSocketBindMsg::status, tstrSocketListenMsg::status, and tcp_client_socket.
Referenced by wifi_ap_provision().
|
static |
Callback to get the Wi-Fi status update.
[in] | u8MsgType | type of Wi-Fi notification. Possible types are:
|
[in] | pvMsg | A 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 APP_PROV_AP_DISABLE, APP_PROV_DEINIT, APP_PROV_WINC_CONNECTED, gu8AppStatus, M2M_WIFI_CONNECTED, M2M_WIFI_DISCONNECTED, M2M_WIFI_REQ_DHCP_CONF, M2M_WIFI_RESP_CON_STATE_CHANGED, and tstrM2mWifiStateChanged::u8CurrState.
Referenced by wifi_ap_provision().
void wifi_ap_connect | ( | wifiProvisionParams * | provParams | ) |
Wi-Fi Provisioning ap connect function.
This will connect to the AP with the credentials received in wifiProvisionParams The user is expected to perform m2m_wifi_init() before calling this api.
Referenced by main().
void wifi_ap_provision | ( | wifiProvisionParams * | provParams | ) |
Wi-Fi Provisioning main application function.
This is a blocking function that wait for the user to connect to the PROV_WLAN_SOFTAP_SSID and provide the credentials in web page http://192.168.1.1/provisioning.html. The user is expected to close all the open socket and perform socketDeinit() and m2m_wifi_deinit before this function is called
Referenced by main().
|
static |
Referenced by html_handler(), prov_wifi_cb(), and wifi_ap_provision().
|
static |
Socket for TCP communication.
Referenced by prov_socket_cb(), and wifi_ap_provision().
wifiProvisionParams* httpProvInfo |
|
static |
HTTP server globals.
Referenced by m2m_wifi_cb(), and prov_socket_cb().
|
static |
Referenced by prov_socket_cb(), and wifi_ap_provision().
tstr1xAuthTLSCredentials tlsCredentials |
Referenced by post_main_page().