473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Receive SMS using AT command in C# form

Hello sir,
I am trying to read sms from my motorokr E6 mobile phone in c# application, but i am not able to do so. The code that i am using is as follows:-

Expand|Select|Wrap|Line Numbers
  1. string portName = cboPort.Text;
  2. lvwMessages.Items.Clear();
  3. Update();
  4.     // Set up the phone and read the messages
  5. ShortMessageCollection messages = null;
  6. try
  7.    {
  8.     this.port = OpenPort(portName);
  9.     Cursor.Current = Cursors.WaitCursor;
  10.     // Check connection
  11.     ExecCommand("AT", 300, "No phone connected at " + portName + "." );
  12.     // Use message format "Text mode"
  13.     ExecCommand("AT+CMGF=1", 300, "Failed to set message format.");
  14.     // Use character set "ISO 8859-1"
  15.     ExecCommand("AT+CSCS=\"8859-1\"", 300, "Failed to set character set.");
  16.     // Select SIM storage
  17.     ExecCommand("AT+CPMS=\"SM\"", 300, "Failed to select message storage.");
  18.     // Read the messages
  19.     string input = ExecCommand("AT+CMGL=\"ALL\"", 5000, "Failed to read the messages.");
  20.     messages = ParseMessages(input);
  21.     Cursor.Current = Cursors.Default;
  22.     }
  23. catch (Exception ex)
  24. {
  25.     Cursor.Current = Cursors.Default;
  26.     MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  27.                return;
  28. }
  29.  
  30. finally
  31. {
  32.       if (port != null)
  33.     {
  34.         ClosePort(this.port);
  35.         this.port = null;
  36.                 }
  37. }
  38.  
  39. if (messages != null)
  40.     DisplayMessages(messages); // this function will show all the msgs to the window.
  41.  
now when try to read the messges i am getting error "Failed to set message format."

and if i try to do the same thing using Nokia 6620 phone then i am getting error "Failed to set character set."



Please kindly help me out.
Mar 18 '08 #1
1 10224
remove this line

// Use character set "ISO 8859-1"
ExecCommand("AT+CSCS=\"8859-1\"", 300, "Failed to set character set.");
Nov 22 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Sven Groot | last post by:
I have a Windows Service application that acts as if it's an SMTP server. Outlook connects to this service, which is always running on the localhost. This works fine most of the time. However,...
3
by: MasterChief | last post by:
I have a form that uses the POST method to call up test.asp and it passes what is typed into the text box. Since is uses the Like command the user can enter stuff like %Constant% to get something...
1
by: Dan Kelley | last post by:
I have 2 projects - 1 Winform project that sends Udp messages using the UdpClient class when a button is clicked, and a Console application that listens for these Udp messages. If I try to use...
1
by: BilMuh | last post by:
Hello Developpers, I am developping a TCP/IP Client application using Visual C++ .NET Standard on Windows 2000 Pro. I noticed that I could not receive more than 2KB once at a time. The server...
0
by: Shoveler | last post by:
I've got an odd problem here that I've been beating my head on for days. I've written a class that uses a pre-established connection for communication, meaning I can use this class for a server or...
4
by: http://www.visual-basic-data-mining.net/forum | last post by:
Hi Does anyone know how to stay connected to the server and at the same time i can pass the string to and from the module to the form..... What I want: I put the connection at the...
2
by: Robert Treat | last post by:
We got a few of these on a 7.3 server this afternoon. The server was completed pegged on i/o activity (both physical disks, including the one the db doesn't live on) May 12 15:15:51 gnvdb01...
3
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
2
by: Daniel Lindberg | last post by:
Hi, im a beginner in C# and i just cant seem to get my udp broadcasting to work. What happens is that it just locks down on the Receive call and never gets any data. I have the code for the server...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.