I've developed an SMS app (send/receive SMS using GSM modem) using this library - http://www.scampers.org/steve/sms/libraries.htm
I have a timer that checks received messages every 3 seconds. The problem is that every few minutes I get this error:
***
at GsmComm.GsmCommunication.GsmPhone.GsmComm.GsmCommunication.IProtocol.ReceiveAnything(String pattern)
at GsmComm.GsmCommunication.GsmPhone.GsmComm.GsmCommunication.IProtocol.ReceiveMultiple()
at GsmComm.GsmCommunication.GsmPhone.GsmComm.GsmCommunication.IProtocol.ExecAndReceiveMultiple(String command)
at GsmComm.GsmCommunication.GsmPhone.ListMessages(PhoneMessageStatus status)
at GsmComm.GsmCommunication.GsmCommMain.ReadMessages(PhoneMessageStatus status, String storage)
at SMS.BL.TimerCalls_rec.recProcessTimerEvent(Object sender, EventArgs e) in D:\Csharp\SMS GSM\SMS\BL\TimerCalls_rec.cs:line 57++++++++No data received from phone after waiting for 30000 ms.
This is the part of that code:
try
{
// Read all SMS messages from the storage
if (CommSetting.comm.IsConnected())
{
DecodedShortMessage[] messages = CommSetting.comm.ReadMessages(PhoneMessageStatus.All, PhoneStorageType.Phone);
foreach (DecodedShortMessage message in messages)
{
ReadMessage(message.Data);
//delete message
indexP = message.Index;
CommSetting.comm.DeleteMessage(indexP, PhoneStorageType.Phone);
}
}
}
catch (Exception err)
{
RIWL.log(err.StackTrace + "++++++++" + err.Message, "Error: ");
}
This is the line where the error occurs:
DecodedShortMessage[] messages = CommSetting.comm.ReadMessages(PhoneMessageStatus.All, PhoneStorageType.Phone);
Any ideas why once in a while the modem is not responding? Sending/receiving messages is done separately. While sending SMS - reading is halted and the other way around.
Can I do anything else to check if serial port is busy?
EDIT: If it's any help, at the point when error happens, dllhost.exe - COM Surrogate appears shortly in processes.