I have developed SMS Application using the project given on the link:
http://www.codeproject.com/Articles/85636/Introduction-to-AT-commands-and-its-uses
While sending SMS, though the message is sent successfully, the function sendMsg is returning "False" and in error log its showing "Response received is incomplete" . What might be the problem since this returning value is important in my application.
Kindly check the timeout being sent in the Function [ExecCommand]in the following code:
public bool sendMsg(SerialPort port, string PhoneNo, string Message)
{ bool isSend = false;
try
{
string recievedData = ExecCommand(port, "AT", 300, "No phone connected");
recievedData = ExecCommand(port, "AT+CMGF=1", 1000, "Failed to set message format.");
String command = "AT+CMGS=\"" + PhoneNo + "\"";
recievedData = ExecCommand(port, command, 300, "Failed to accept phoneNo");
command = Message + char.ConvertFromUtf32(26) + "\r";
recievedData = ExecCommand(port, command, 5000, "Failed to send message");
if (recievedData.EndsWith("\r\nOK\r\n"))
{
isSend = true;
}
else if (recievedData.Contains("ERROR"))
{
isSend = false;
}
else //01 Apr 2014 (Added for the condition when isSend is returned as false even though the Message is sent)
{
isSend = true;
}
return isSend;
}
catch (Exception ex)
{
throw ex;
}
}
Thanks in advance. Any help will be appreciated.