Gemalto is now part of the Thales Group, find out more.

You are here

PLS62 ATCommand.send() sometimes not returning | Thales IoT Developer Community

September 30, 2021 - 10:37am, 155 views

Hi!

We noticed that every once in a while our midlet fails to execute properly due to  "AT^SLED=2\r\n" not properly executing, thereby never returning anything.

Our midlet is auto-started, using the following parameters in the associated jad-File:

Oracle-MIDlet-Autostart: 2 
Oracle-MIDlet-Restart: true 
Oracle-MIDlet-Restart-Count: 3 

The problem can be reproduced using the following code with above parameters in the jad file, but only seems to occur randomly once in a while: 

    public static String sendATcmd(String cmd) throws ATCommandFailedException {
            ATCommand atc = null;            
            try {
                atc = new ATCommand(false);
                //atc.send("AT^SMSO\r\n");
                cmd = new StringBuffer(cmd).append("\r\n").toString();
                System.out.println(cmd);
                return atc.send(cmd);
            } catch (ATCommandFailedException ex) {
                ex.printStackTrace();
                throw ex;
            } finally {
                if (atc != null) {
                    try {
                        atc.release();
                    } catch (IllegalStateException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    atc = null;
                }
            }                
    }
    protected void startApp() throws MIDletStateChangeException {
            try {
                sendATcmd("AT^SLED=2");
            } catch (ATCommandFailedException ex) {
                ex.printStackTrace();
            }
            System.out.println("Thread.sleep(60000)");
            try {
                Thread.sleep(60000);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
            try {
                sendATcmd("AT+CFUN=1,1");
            } catch (ATCommandFailedException ex) {
                ex.printStackTrace();
            }            
    }

Is this a known issue and what can we do to avoid this?

Thanks and best Regards,
Christopher