Ho to check if a WiFi connection is established?

Hi all, I’m writing an App for streaming and capture images from an ESP32-Cam via WiFi, using WebViewer and Web components. The Arduino code starts with the following, to establish a WiFi network as soft Access Point.
The question is: how can I check if and when the Android device can communicate with the ESP32. I mean, how to check if the connection is ready?
Thanks

// Set up a soft access point to establish a Wi-Fi network with SSID and password
WiFi.softAP(ssid, password);
IPAddress IP = WiFi.softAPIP();
startCameraServer();
Serial.println("Camera Stream Ready");
Serial.println("Connect your device to 'ESP32-Cam' WiFi Access Point");
Serial.print("Current password: ");
Serial.println(password);
Serial.print("IP address: ");
Serial.print("http://");
Serial.println(IP);

you might want to try the wifi exension

and probably the SSID method

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

A mí me resultó muy útil lo siguiente:
http://kio4.com/appinventor/147_conexion_internet.htm 1

Thanks Taifun and Vanesa for your suggestions! I’m trying the following solution, that seems to work just fine (still to test extensively …)

blocks(5)
Clock2Conn starts as TimerEnabled true with TimeInterval 500 and starts checking connection at startup (Home.Initialize)
blocks(1)
sendCmd sends an http request to ESP32Cam via WiFi
blocks(3)
when the App receives the string “camConnected” as response, it stops the Clock2Conn by setting the global camConnected to true:
blocks(2)a

This should be more than enough for me.
Other connection errors are captured 1101 and displayed by Notifier1 dialog
blocks
writeInfo is a function to display messages on a ‘scrollable’ html formatted label:
blocks(4)