Wednesday, November 25, 2015

How to ReadMessages from usb modem using sms-lib in ubuntu system

This week I worked on Reading messages from USB modem with the help of smslib library.

The prerequisites

1) USB modem details
Manufacturer: ZTE CORPORATION
Model: MF190

2) SIM : Tata docomo

3) Ubuntu i386 laptop

For windows users you can follow this blog
http://gsmmodemtutoialbysamyan.blogspot.in/2013/12/what-is-gsm-modem-gsm-modem-specialized.html?showComment=1448442361213

The process I am sharing is similar to the process mentioned in above blog

The only change is 2nd step
In Linux environments we need to copy "libLinuxSerialParallel.so" to jdk/bin and jre/bin
This file you can find in java comm api of oracle, file is "comm3.0_linux.zip"





Change the javax.comm.properties in my case the paths are

 # Paths to server-side serial port devices
serpath0 = /dev/ttyUSB2
serpath1 = /dev/ttyUSB1

Then after the steps are similar add smslib.jar and log4j.jar to your project and Run ReadMessages.java

While running the ReadMessages.java you may get stringindexoutofboundsexception it can be solved by setting actual message storage location i.e., either SM or SR or ME or MD.
In my case it is ME

this is the method to be used in smslib to set the storage location
gateway.getATHandler().setStorageLocations("ME");
The total files can be found in this link
https://dl.dropboxusercontent.com/u/87378162/SMSlib-requiredfiles.tar.gz

The java project I implemented can be downloaded from here
https://dl.dropboxusercontent.com/u/87378162/USBModem.zip

2 comments:


  1. Thanks for sharing
    Msgclub have two types of sms api Java; XML and JSON for sending SMS in bulk to your prospects from our gateway.

    ReplyDelete