I have a scenario where my firmware is sending UDP messages at a short interval (20 seconds) and the Electron (3G, US model) is located in a vehicle. Periodically the vehicle will move through areas with poor cell coverage and the Internet connection will drop.
The dropped connections are expected, but the Cellular.ready() method seems to take a bit to “realize” the connection has dropped, and my UDP messages during this window of time just get blasted off into the void and never reach the recipient.
I experimented with connecting and disconnecting a 3G antenna. When I disconnect the antenna, the signal strength quickly drops to -113 (as expected), but Cellular.ready() returns true for almost exactly 30 seconds after this, after which it finally flips to false. If any UDP messages are sent in this window of time, they are lost.
I am trying to figure out if there’s a way to more proactively detect if the connection has dropped, or at least learn more about why Cellular.ready() takes 30 seconds to flip the flag when the antenna is unplugged. Also, is there any other useful low-level info available on the modem that I can inspect in my code that may not currently be exposed in the Particle firmware SDK?
Note: My 3rd party SIM keep-alive value is set to 30 seconds, if that is related in some way.
Any thoughts would be appreciated.