0

I'm writing a linux program which interact with gsm modem through AT-commands. Sometimes the modem respond on at+cmgl="all" command and return sms messages, sometimes the modem doesn't respond on this command(no answer, no ok, no error).

I use Python and pySerial, but it doesn't matter, because I tested the modem via bash terminal, send commands to the modem via echo and read answers from the modem via cat /dev/ttyUSB0. The same situation (sometimes it responds, sometimes not).

George
  • 745
  • 2
  • 11
  • 27
  • 1
    Do you send AT+CMGF=1 before you attempt to retrieve the messages? – dbasnett May 13 '13 at 19:38
  • 1
    You probably need to check if modem is really in command mode, by sending a simple "AT" null command and getting an "OK" response. – sawdust May 13 '13 at 19:44
  • _dbasnett_, yes. _sawdust_, I have sent `AT` command and have got `OK` in response. But the modem **doesn't** answer to `AT+CMGL="ALL"` command **sometimes**. – George May 14 '13 at 09:33
  • Just to make sure, you always use the string `"ALL"` and not `"all"` (because `"ALL"` is the only correct choice)? – hlovdal May 14 '13 at 19:24
  • _hlovdal_, I use both variants, and the modem answers "ALL" and "all" commands, and sometimes it answers neither "ALL" nor "all" commands. – George May 15 '13 at 07:24

1 Answers1

0
private void button3_Click(object sender, EventArgs e)
{
    po.Write("AT+CHUP"+Environment.NewLine);
    po.Close();
    button3.Enabled = false;
    button1.Enabled = true;
}
Rahil Wazir
  • 10,007
  • 11
  • 42
  • 64
AbdusSalam
  • 420
  • 6
  • 10