Listening via mode button VS WiFi.listen()/Mesh.listen()/Ethernet.listen() functions

So I notice there are multiple ways to put a particle gen3 device into “listening mode” where the LED blinks blue. These methods are as follows:

  • Holding down the mode button for 3s+
  • WiFi.listen() function
  • Ethernet.listen() function
  • Mesh.listen() function
  • Unmarking the set up done flag via dct_write_app_data(&val, DCT_SETUP_DONE_OFFSET, 1);
  • Particle CLI particle usb start-listening

All these methods seem to put the device into “listening” mode but given that we have multiple programmatic ways of doing so, is there a difference? Espically between the .listen() functions.

The reason I am asking is that I would like to programmatically toggle the device back to listening mode to pair and configure new devices (wifi/mesh setup) to my own mobile app. I was in the process of writing my own app to interact with the particle using the deviceOS BLE class but thought that maybe I could reuse and leverage on what particle has done on their app and OOBE listening mode.

Sources:

Hi @slacker89! :slight_smile:

All of the network listening commands (WiFi, Ethernet, Mesh) should behave identically. They all just call the same HAL function, network_listen(), as does the button press or the CLI command. (There’s Network.listen() as well, which works with any networking technology!!)

The setup done flag trick is a bit more complicated and I wouldn’t recommend it.

Thanks for the response. I'll try this out on my side. If they are all identical this means I should be able to use something like "WiFi.listen()" and then try to set a device up via the particle app.

I'll probably try this in a bit but going to ask anyway if you know the anwser off the top of your head:

  • This also means that any .listen(false) command will turn off the listening mode as well regardless of it being activated via WiFi.listen(), Ethernet.listen(), Mesh.listen() and Network.listen()?
  • This also means that any .listening() command will also return true regardless if the listening mode was turned on by WiFi.listen(), Ethernet.listen(), Mesh.listen() and Network.listen()?

Hm, I haven’t had any luck using Network.listen(false). I’m not sure if this mode can be escaped this way - @rickkas7?