Identifying connected devices in SoftAP

I’m looking to setup a Photon so that it will try to connect to WiFi and the cloud, then if unable will go into softap. I want to have it keep switching back and forth until it is able to get to the cloud.
The question that I have is weather it is possible to tell if a device has connected to the Photon when it is in SoftAP mode.


Yes. You will probably want to use SYSTEM_THREAD(ENABLED) to make sure your code runs in all modes.

Then you can check with WiFi.ready() and/or Particle.connected() from your loop() code to determine if you want to go into listening mode.

Use WiFi.listen() to switch in or out of listening mode.

Thank you, but neither of those options seem to show that my cell phone (for instance) has connected to the SoftAP.

When a device connects to the SoftAP the myPage() handler will be called - so in this function you could set a flag to indicate that someone has visited.
If you go for a “flag” that also stores the timestamp of the connection you can give it a TTL.

You’d need to clarify a bit more what your use-case would be to give you some less general hints.

Yes, what ScruffR said. Sorry, I misread your question.

There’s no way to see into the SoftAP to see if a device has only connected to Wi-Fi. There’s no list the MAC address or IP addresses of phones/computers connected to the SoftAP, for example.


That sounds perfect.

Basicly my use case is to make the recovery more hands off. If it can’t connect to the cloud it goes to setup mode. If nobody connects in setup mode then it tries to connect to the cloud again. And on and on until something works.

Your idea of a timestamps flag sounds very doable.