26 #define WEB_SETUP_SSID "\"WiConnect WebSetup Example\""
30 #define WEB_SETUP_PASSWORD "password"
43 #include "target_config.h"
45 #include "Wiconnect.h"
52 static void webSetupCompleteCallback(
WiconnectResult result,
void *arg1,
void *arg2);
61 static Serial consoleSerial(STDIO_UART_TX, STDIO_UART_RX);
64 static uint8_t wiconnectInternalBuffer[WICONNECT_INTERNAL_BUFFER_SIZE];
67 static volatile bool webSetupCompleteFlag =
false;
73 int main(
int argc,
char **argv)
75 consoleSerial.baud(115200);
84 SerialConfig serialConfig(WICONNECT_RX_PIN, WICONNECT_TX_PIN, WICONNECT_SERIAL_RX_BUFFER_SIZE, NULL);
88 Wiconnect wiconnect(serialConfig,
sizeof(wiconnectInternalBuffer), wiconnectInternalBuffer, WICONNECT_RESET_PIN);
95 printf(
"Initializing WiConnect Library...\r\n");
100 printf(
"Failed to initialize communication with WiFi module!\r\n"
101 "Make sure the wires are connected correctly\r\n");
110 printf(
"Starting Websetup...\r\n");
115 printf(
"Failed to start web setup\r\n");
123 printf(
"Web setup has started.\r\n\r\n");
124 printf(
"1. Using your phone (or PC, Mac, Linux, etc.)\r\n connect to the WiFi network: %s\r\n", WEB_SETUP_SSID);
125 printf(
"2. The password is: %s\r\n", WEB_SETUP_PASSWORD);
126 printf(
"3. Once connected, open your browser and enter the URL: http://setup.com\r\n");
127 printf(
"4. This will bringup a setup page, enter your router's credentials.\r\n");
128 printf(
"5. Click the 'Save & Exit' button at the bottom of the webpage\r\n\r\n");
130 while(!webSetupCompleteFlag)
141 printf(
"Web setup example has completed!\r\n");
151 static void webSetupCompleteCallback(
WiconnectResult result,
void *arg1,
void *arg2)
153 webSetupCompleteFlag =
true;
WiconnectResult
API Result code.
Generic callback function.
Host<->Wiconnect Module serial configuration.
Command successfully completed.
The root WiConnect library class. This class inheriets all WiConnect functionality.