geniousprogrammer / smslib

Automatically exported from code.google.com/p/smslib
0 stars 1 forks source link

Patch for WAVCOM WISMOQ CDMA serial modem #110

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This is a patch for CDMA serial modem. It is based on SMSLib v3.3.0 beta 2.
Main Update:
1. Add a new AT handler for  WISMOQ CDMA modem

Original issue reported on code.google.com by MDengF...@gmail.com on 4 Aug 2008 at 4:50

Attachments:

GoogleCodeExporter commented 8 years ago
Hello.

I will start the patching. It needs a bit of work since it is based on an older 
release. I will have to manually check things.

I hope you are available if I need assistance. :)

Original comment by ad...@smslib.org on 14 Aug 2008 at 12:50

GoogleCodeExporter commented 8 years ago
Some questions:

1) Why a different CDMASerialModemDriver.java?
There is no difference between this and the standard SerialModemDriver. Is 
there any 
purpose behind this?

2) Why a different CDMASerialModemGateway.java?
When the only difference from the standard Gateway is the following block which 
you 
removed:
<<
bytes = new byte[msgText.length() / 2];
j = 0;
for (i = 0; i < msgText.length(); i += 2)
{
bytes[j] = Byte.parseByte(msgText.substring(i, i + 2), 16);
j++;
}
msgText = GSMAlphabet.bytesToString(bytes);
>>

3) About the new terminator regexp.
What about this:
this.terminators[1] = "\\s*([\\p{ASCII}]|[^\\x00-\\xff])*\\s+OK\\s";

Did you have a problem with the standard regexp? If so, why did you leave the 
first 
part, since the second is a superset of the first?

4) What is the purpose of the extra CDMASERIAL modem type, since this is really 
a 
serial modem working in a different mode?

Reviewing the 50+Kb of patch, I came to the conclusion that it only needs to 
remove 
a couple of lines and change a regexp to support CDMA... Is this correct? Did 
you 
forget any files??? Did I overlooked any code fragments?

Original comment by ad...@smslib.org on 14 Aug 2008 at 3:48

GoogleCodeExporter commented 8 years ago
I forget to mention the getMessageByIndex() and the new AT Handler.

I think that we could merge these changes and leave aside the extra gateways 
and 
drivers. What is your opinion?

Original comment by ad...@smslib.org on 14 Aug 2008 at 3:53

GoogleCodeExporter commented 8 years ago
1) Why a different CDMASerialModemDriver.java?
[A:] This is for keeping the structure of original codes.  Acutally, there is a 
name 
convention among driver, gateway and AThandler. 
2)Why a different CDMASerialModemGateway.java?
[A:]  the format of CDMA message is different from GSM message. Above codes 
don't 
fit CDMA modem
3)About the new terminator regexp.
[A:] Standard regexp can't handle double bytes charaters. such as Chinese. I 
change 
this to make this regexp can be compatible Chinese.
4) What is the purpose of the extra CDMASERIAL modem type, since this is really 
a 
serial modem working in a different mode?
[A:] Because the message format difference, Some method should be overwritten. 
Add a 
new modem type can keep the code structure consistent and there is less impact 
for 
the original codes. 

I don't think it can work you only merge part of changes and leave aside extra 
gateways and drivers. Because there is name convention is involved. Maybe part 
of 
changes can't ensure both GSM modem and CDMA modem can work.

This patch was created from my working codes. I am using one GSM modem and one 
CDMA 
modem. The smsLib has been running for several days and there is no problem 
until 
now.

Original comment by MDengF...@gmail.com on 15 Aug 2008 at 1:51

GoogleCodeExporter commented 8 years ago
Hi,

Thanks for this.
I still believe that there are things that could be merged. I will add your 
mods as 
you've provided them and then we will look for optimizations.

Just one more clarification about this:

[A:]  the format of CDMA message is different from GSM message. Above codes 
don't 
fit CDMA modem

If I switch my GSM modem/phone to text protocol, the responses would be the 
same as 
with a CDMA modem? Do you know the answer to this?

Thanks :)

Original comment by ad...@smslib.org on 18 Aug 2008 at 10:51

GoogleCodeExporter commented 8 years ago
Another q:

Do you know at what character set do CDMA phones work?
(I refer to the CSCS command: is it hex, unicode?)

Original comment by ad...@smslib.org on 18 Aug 2008 at 11:38

GoogleCodeExporter commented 8 years ago
There are several character set for CDMA phone:
8-bits
ASCII
unicode

There is no HEX for CDMA character set 

Original comment by MDengF...@gmail.com on 18 Aug 2008 at 12:41

GoogleCodeExporter commented 8 years ago
If I create a zip with the new sources, could you give it a try?

Original comment by ad...@smslib.org on 18 Aug 2008 at 12:56

GoogleCodeExporter commented 8 years ago
No problem

Original comment by MDengF...@gmail.com on 19 Aug 2008 at 1:06

GoogleCodeExporter commented 8 years ago
Get it from here: http://smslib.org/download/cdma.zip

Download it in its own directory, edit the ReadMessages example to set your own 
com 
port, compile and run the Read example.

What I have done:
1) Consolidate code in existing classes.
2) Set the TEXT protocol to work with 8859-1 encoding. This works ok with my 
GSM 
modem, I hope it also works with your CDMA modem. If not, please give me the 
output 
of the:

AT+CSCS=?

command (use Hyperterminal or something similar). If we find an encoding which 
works 
in both worlds (GSM & CDMA) the code will be much simplified.

Original comment by ad...@smslib.org on 19 Aug 2008 at 5:38

GoogleCodeExporter commented 8 years ago
I will test your code soon.
I put the specification of CDMA in attachment

Original comment by MDengF...@gmail.com on 19 Aug 2008 at 6:01

Attachments:

GoogleCodeExporter commented 8 years ago
Here is the result that I run AT+CSCS=? in hyperteminal

ATZ
OK
AT
OK
AT+CSCS=?
+CSCS: ("PC437","CDMA","CUST")

OK

Original comment by MDengF...@gmail.com on 19 Aug 2008 at 6:10

GoogleCodeExporter commented 8 years ago
Forget the zip - it will not work!

I will get back to you.

(Thanks for the info.)

Original comment by ad...@smslib.org on 19 Aug 2008 at 6:12

GoogleCodeExporter commented 8 years ago
Ok, please download the above zip **again**.

What I did was to use CDMA encoding in your custom at handler and continue to 
use 
8859-1 in all the other GSM/TEXT modems.

Make sure you change your com port as well as modem identifiers in the 
ReadMessages 
example.

Thanks.

Original comment by ad...@smslib.org on 19 Aug 2008 at 6:23

GoogleCodeExporter commented 8 years ago
I got below errors when I run your codes:

 java -Dsmslib.debug examples.modem.ReadMessages
Example: Read messages from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem
or other supported gateways.
Web Site: http://smslib.org
This software is distributed under the terms of the Apache v2.0 License.
Version: 3.3.0-B4
0 [main] INFO org.smslib  - SMSLib: A Java API library for sending and 
receiving SMS 
via a GSM modem
or other supported gateways.
Web Site: http://smslib.org
This software is distributed under the terms of the Apache v2.0 License.
2 [main] INFO org.smslib  - Version: 3.3.0-B4
2 [main] INFO org.smslib  - JRE Version: 1.5.0_15
3 [main] INFO org.smslib  - JRE Impl Version: 1.5.0_15-b04
3 [main] INFO org.smslib  - O/S: Linux / i386 / 2.4.21-4.ELsmp
33 [Thread-0] DEBUG org.smslib  - WatchDog started.
33 [Thread-0] INFO org.smslib  - WatchDog running...
34 [Thread-1] INFO org.smslib  - Starting gateway, using Wavecom WISMOQCDMA AT 
Handler.
34 [Thread-1] INFO org.smslib  - Opening: ttyS1 @9600
org.smslib.GatewayException: Comm library exception: 
java.lang.reflect.InvocationTargetException
        at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:93)
        at org.smslib.modem.AModemDriver.connect(AModemDriver.java:106)
        at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:109)
        at org.smslib.Service$1Starter.run(Service.java:189)
1041 [Thread-0] DEBUG org.smslib  - WatchDog stopped.
1041 [main] INFO org.smslib  - Stopping gateway...
1041 [main] DEBUG org.smslib  - SEND :AT+WATH=31(cr)
java.lang.NullPointerException
        at org.smslib.modem.SerialModemDriver.write(SerialModemDriver.java:159)
        at org.smslib.modem.AModemDriver.write(AModemDriver.java:244)
        at org.smslib.modem.athandler.ATHandler_Wavecom.done
(ATHandler_Wavecom.java:52)
        at org.smslib.modem.ModemGateway.stopGateway(ModemGateway.java:118)
        at org.smslib.Service.stopService(Service.java:267)
        at examples.modem.ReadMessages.doIt(ReadMessages.java:107)
        at examples.modem.ReadMessages.main(ReadMessages.java:152)

It seems SerialModemDriver was picked up. Actually, CDMASerialModemDriver 
should be 
picked up

Original comment by MDengF...@gmail.com on 19 Aug 2008 at 6:24

GoogleCodeExporter commented 8 years ago
Don't worry about the modem driver...

Are you using RxTx?

Original comment by ad...@smslib.org on 19 Aug 2008 at 6:27

GoogleCodeExporter commented 8 years ago
I am using JavaComm 

Original comment by MDengF...@gmail.com on 19 Aug 2008 at 6:31

GoogleCodeExporter commented 8 years ago
BTW , in the ReadMessages.java, ModemGateway should be replaced by 
CDMAModemGateway 
like this:

            CDMASerialModemGateway gateway = new CDMASerialModemGateway
("modem.com1", "/dev/ttyS1", 9600, "Wavecom", "WISMOQCDMA");

Original comment by MDengF...@gmail.com on 19 Aug 2008 at 6:34

GoogleCodeExporter commented 8 years ago
JavaComm v3, right?

Original comment by ad...@smslib.org on 19 Aug 2008 at 6:35

GoogleCodeExporter commented 8 years ago
Followup:

After private testing, the new functionality introduced by DengFeng Mao seems 
to 
work correctly. The new code will soon be merged into trunk.

Original comment by ad...@smslib.org on 19 Aug 2008 at 7:36

GoogleCodeExporter commented 8 years ago
Merged in trunk - r1224.

Original comment by ad...@smslib.org on 19 Aug 2008 at 6:50

GoogleCodeExporter commented 8 years ago

Original comment by T.Delenikas on 3 Sep 2008 at 8:17