0 Replies - 478 Views - Last Post: 04 September 2012 - 11:39 PM Rate Topic: -----

#1 jambyvedar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-September 12

Help reading sms with at commands(text mode).

Posted 04 September 2012 - 11:39 PM

I tried to send and read sms from hyperterminal using text mode, it works fine. I can now also send at command using serial port of c#. Now my porblem, after lots of time researching and trying, I can't figure how to read sms using at commands with c#.. I wrote the codes below, but I know there is something wrong with it. How can I read the sms message and sender number and be displayed on listview? Thanks

// if button was clicked, read sms stored on sim
 private void button3_Click(object sender, EventArgs e)
        {

            if (this.serialPort1.IsOpen)
            {

              serialPort1.BaseStream.Flush();


              string a = "sm"; string b = "all";
              //this.serialPort1.Write("AT+CPMS=\"" + a + "\"\r\n");
        
                  this.serialPort1.Write("AT+CMGF=1\r\n");
                 this.serialPort1.Write("AT+CSCS=\"PCCP437\"");
                 this.serialPort1.Write("AT+CPMS=\"" + a + "\"\r\n");
                 this.serialPort1.Write("AT+CMGR=2\r\n");
        


              //this.serialPort1.Write("AT+CMGL=\"" + b + "\"\r\n");

              //textBox5.Text = this.serialPort1.ReadLine();

             //textBox5.Text = this.serialPort1.ReadExisting();
          

                
          MessageBox.Show("\nMessage Was Read\n", "Information");
               

            }

           else
           {
                MessageBox.Show("\nSerial Port Is Not Open\n", " ERROR ");
           }


        }




Is This A Good Question/Topic? 0
  • +

Page 1 of 1