none
Receive SMS inbox data

    Question

  • Hi all,

    Im currently trying to access the SMS inbox of a GSM modem in C#. I have successfully sent sms messages and have been able to use the AT COMMANDS in hyperterminal to retreive SMS data, but I have not been able to get the data shown in hyperterminal to be shown in C# app.

    I have set up a datareceived event handler which appears to be working as I get my AT commands echoed by it and I get data from the device in the way of responses to my command such as OK, ERROR, RING, but I am not able to get the data returned form the command to retrieve SMS messages from the gsm modem.

    This is the code that works in Hyperterminal

    //AT+CMGL="REC UNREAD"

    //+CMGL: 304, "REC UNREAD", "+61403075676"

    //TEST 7

    //OK

    //AT+CMGR=304

    //+CMGR: "REC READ", "+61403075676", "2006/1/17,11:56:38"

    //TEST 7

    //OK

    In C# app the following code executes without error

    port.WriteLine("AT+CMGF=1\r");

    port.WriteLine("AT+CMGL=\"REC UNREAD\"");

    But there is no response form the GSM Modem, how do I get the lines that where replied in hyperterminal to be abtainable in C# app.

     

    Many thanks for your assistance

    Rod

    Wednesday, January 18, 2006 3:07 AM

All replies

  • Too quick of the draw, I found my error as soon as I posted.

    Carraige return is required: port.WriteLine("AT+CMGL=\"REC UNREAD\"\r");

    Foolish me.

    • Proposed as answer by P.Brian.Mackey Monday, November 02, 2009 5:07 PM
    Wednesday, January 18, 2006 3:26 AM
  • hey
    i am working on a project which sill send and receive sms using at commads in c# .i am able to send msg i am having problems when i am receiving sms from inbox .deadline is near so i will be thankful if u send me ur code for receiving sms
    please EMAIL GONE
    reply soon
    Friday, October 09, 2009 8:00 AM
  •  

    I used this method in my program and I worked for me :)
    I found the One application CodeProject.com is just too good that you better use it :)
    http://www.codeproject.com/KB/cs/Send_and_Read_SMS.aspx

      public string ReadResponse(SerialPort port,int timeout)
            {
                string buffer = string.Empty;
                try
                {    
                    do
                    {
                        if (receiveNow.WaitOne(timeout, false))
                        {
                            string t = port.ReadExisting();
                            buffer += t;
                        }
                        else
                        {
                            if (buffer.Length > 0)
                                throw new ApplicationException("Response received is incomplete.");
                            else
                                throw new ApplicationException("No data received from phone.");
                        }
                    }
                    while (!buffer.EndsWith("\r\nOK\r\n") && !buffer.EndsWith("\r\n> ") && !buffer.EndsWith("\r\nERROR\r\n"));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return buffer;
            }

    Monday, November 02, 2009 10:28 AM
  • Hello,

    I'm developing an app to send and received sms as well, I'm able to send sms but I'm having a problem related to the Portuguese alphabet. I need to send characters like á,à,ç and so on..

    I'm using pdu mode, but if I send one of this characters, the result in the phone are strange signals.

    Are you sending sms in text or pdu mode ?
    Best Regards, Diogo Pinheiro
    Monday, November 02, 2009 11:33 AM
  • What's your mobile model?
    Most mobile phones support this mode!
    Monday, November 02, 2009 12:28 PM
  • i dont work with PDU Mode but
    i found this code and i hope it could be helpfull for you 

    if you want Disassembler (cs File SMSPDUMode.dll) Tell me to send you


    http://www.2shared.com/file/8879927/98ffac19/SMSControl.html
    • Edited by qasemt Monday, November 02, 2009 8:32 PM
    Monday, November 02, 2009 12:40 PM
  • I'm using a GSM Modem from Wavecom.
    Thanks but I can´t access rapidshare. =/

    Can I send 8bit sms, with the same behaviour of a 7bit ? I've read somewhere that 7bit is for flash sms and 16bit is for operator logos, configs..

    Because i´ve tried to send a 8bit, but in the phone says that is impossible to display the message.
    Best Regards, Diogo Pinheiro
    Monday, November 02, 2009 4:47 PM
  • hey
    i am working on a project which sill send and receive sms using at commads in c# .i am able to send msg i am having problems when i am receiving sms from inbox .deadline is near so i will be thankful if u send me ur code for receiving sms
    please EMAIL GONE
    reply soon

    Amna, post your own question.  Don't ride on somebody else's.
    Good coding involves knowing one's logical limits and expanding them as necessary.
    Monday, November 02, 2009 5:07 PM
  • I'm using a GSM Modem from Wavecom.
    Thanks but I can´t access rapidshare. =/

    Can I send 8bit sms, with the same behaviour of a 7bit ? I've read somewhere that 7bit is for flash sms and 16bit is for operator logos, configs..

    Because i´ve tried to send a 8bit, but in the phone says that is impossible to display the message.
    Best Regards, Diogo Pinheiro

    This link worked:

    http://www.2shared.com/file/8879927/98ffac19/SMSControl.html
    Monday, November 02, 2009 8:32 PM