BGS5 - Creating a DatagramConnection with poor signal causes hang | Telit Cinterion IoT Developer Community
September 26, 2017 - 12:42pm, 1770 views
I am currently in the process of updating an older Java MIDlet originally written for the EGS5 module to work with the BGS5.
Most of the changes have been successful, but I am having a problem when it tries to create a new DatagramConnection object. The code in question looks like this:
System.out.println("DC Settings: " + connString ); dc = (DatagramConnection) Connector.open(connString); // This is the problem System.out.println("DC created");
An example of connString (IP, APN and login details have been replaced):
Whenever this code executes where there is a poor mobile signal (for example when AT+CSQ is less than about 8), the entire MIDlet will freeze for anything up to 2 or 3 minutes, despite the timeout being set to 20 seconds.
This also causes a couple of separate running threads alongside this to also hang, which is causing a problem when notifying an external hardware watchdog connected to one of the GPIO pins, and when flashing a status LED on another pin.
The old EGS5 didn't seem to have the problem when testing the two side by side with the same signal conditions. It would return with an error fairly quickly if it couldn't connect.
Is there any way to stop the module from hanging like this? It doesn't matter if the command itself takes a while to run, as long as it doesn't stop the other threads executing while it waits.
Thanks in advance,
PS - ATI1 for the module I'm using is: