3
votes

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.

1
foreach (ShortMessage msg in messages) ... SMSPDULib.SMS sms = new SMSPDULib.SMS(); ... SMSPDULib.SMS.Fetch(sms, ref message); ... phoneNo = sms.PhoneNumber;Alex

1 Answers

1
votes

The modem is responding it's a bug in Mr. Scampers software. We've used the GSMComm software for sending sms messages before but because of this reason we wrote our own gsm implementation. Which I can't share I'm sorry for that. We've ported pygsm and we haven't had one timeout since.