I am using a Huawei E160 UMTS stick.

Sending of messages seems to work out of the box but
receiving did not work for me (except when system property
smslib.nocmti was set)

I have digged a bit and found the following reasons:

a) This UMTS stick creates two virtual ttys - the +CMTI indication
    can only be received on the second (on Linux it's usually
    /dev/ttyUSB1)

b) a typical debug log of the incomin +CMTI is:

DEBUG 19:55:18.314 Logger.logDebug GTW: /dev/ttyUSB1: BUFFER: ^BOOT:
23280370,0,0,0,75
^BOOT:23280370,0,0,0,75
^RSSI:14
+CMTI: "SM",5
^RSSI:14
OK
DEBUG 19:55:18.316 Logger.logDebug GTW: /dev/ttyUSB1: RECV :^BOOT:
23280370,0,0,0,75(cr)^BOOT:23280370,0,0,0,75(cr)^RSSI:14(cr)+CMTI:
"SM",5(cr)^RSSI:14(cr)OK(cr)

Interesting is: the +CMTI is not really spontaneout - instead it is
only sent after
smslib executes it's keepalive AT command. And - worse - the +CMTI
comes in
after other messages (^BOOT, ^RSSI and before the OK.

Looking at the code in AModemDriver and the patterns defined in
ATHandler, we see
that the +CMTI will not be recognized when coming in as part of such a
sequence.

An easy fix would be to enhance the patterns of ATHandler so that they
allow
arbitrary data including newlines before the +CMTI. I did this by
defining a
ATHandler_Huawei that exactly does that: prefix all the patterns with
"(.|\\s)*"

Using this fix, incoming messages work - provided I create the gateway
with manufacturer set to "Huawei":

    new SerialModemGateway(portName, portName, 57600, "Huawei",
"E160");

May I propose to add this or an equivalent fix to the smslib package
itself?

Here is the ATHandler_Huawei.java:


public class ATHandler_Huawei
extends ATHandler
{
    /**
     */
    public ATHandler_Huawei(ModemGateway myGateway)
    {
        super(myGateway);

        for (int i = 0; i < terminators.length; i++) {
            terminators[i] = "(.|\\s)*"+terminators[i];
        }
    }
}



BTW: since the +CMTI messages come in only after doing a keepalive,
it seems wise to increase keepalive frequency, e.g.:

       System.setProperty("smslib.serial.keepalive", "5");

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SMSLib User Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/SMSLib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to