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

You are here

HTTP Post using AT command in J2ME | Thales IoT Developer Community

vutu0001@e.ntu.edu.sg

January 8, 2016 - 11:08am, 1865 views

Hello,

I am trying to us AT command in J2ME program to perform HTTP post. However, when I try to issue command AT^SISW=1,5 (i.e I would like to write 5 bytes) after receiving URC: ^SISW: 1,1 the AT command instant is stuck and does not return any response (it should return ^SISW=1,5,0) so that I can enter post data. Using Terminal, this write command performs OK. Could you help me to solve this. This is my snapshot of Java code:

            String  lastATCmd = "AT^SISS=1,\"address\",\"http://httpbin.org\"";

            System.out.println(lastATCmd);

            m_Cmd.send(lastATCmd+"\r",new RspListener());  //Response: OK

            Thread.sleep(5000);

            System.out.println("AT^SISS=1,\"cmd\",\"post\"\r");

            m_Cmd.send("AT^SISS=1,\"cmd\",\"post\"\r",new RspListener());  //Response: OK

            Thread.sleep(2000);

            lastATCmd = "AT^SISS=1,\"hcContLen\",5"; // Response: OK

            System.out.println(lastATCmd);

            m_Cmd.send(lastATCmd+"\r",new RspListener()); // Response: OK

            

            Thread.sleep(2000);

            System.out.println("AT^SISO=1\r");

            m_Cmd.send("AT^SISO=1\r",new RspListener());   //Response OK with correct URC ^SISW:1,1

            Thread.sleep(5000);

            System.out.println("AT^SISW=1,5\r"); 

            m_Cmd.send("AT^SISW=1,5\r", new RspListener()); // stuck here

            Thread.sleep(20000);

            System.out.println("12345");

            m_Cmd.send("12345", new RspListener());  //error: another at command is in being processed

            Thread.sleep(5000);