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:-
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.
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:-
Code:
string portName = cboPort.Text;
lvwMessages.Items.Clear();
Update();
// Set up the phone and read the messages
ShortMessageCollection messages = null;
try
{
this.port = OpenPort(portName);
Cursor.Current = Cursors.WaitCursor;
// Check connection
ExecCommand("AT", 300, "No phone connected at " + portName + "." );
// Use message format "Text mode"
ExecCommand("AT+CMGF=1", 300, "Failed to set message format.");
// Use character set "ISO 8859-1"
ExecCommand("AT+CSCS=\"8859-1\"", 300, "Failed to set character set.");
// Select SIM storage
ExecCommand("AT+CPMS=\"SM\"", 300, "Failed to select message storage.");
// Read the messages
string input = ExecCommand("AT+CMGL=\"ALL\"", 5000, "Failed to read the messages.");
messages = ParseMessages(input);
Cursor.Current = Cursors.Default;
}
catch (Exception ex)
{
Cursor.Current = Cursors.Default;
MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
finally
{
if (port != null)
{
ClosePort(this.port);
this.port = null;
}
}
if (messages != null)
DisplayMessages(messages); // this function will show all the msgs to the window.
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.
Comment