The article depicts a simple java API for handling text SMS with a PC having a GSM Modem, maybe, a GSM Mobile Connected to the PC via a COM/ Virtual COM Port over a PC-to-Mobile Media, like a simple Data Cable, Infra Red USB Adapter or a Bluetooth Connection.
This API has been entirely designed using Java 2 Standard Edition 1.4 onwards and uses Java Communication API for Windows from Sun Micro Systems. As of now, the Java Communication API is not available under Academic Free License (AFL) in the website of Sun Micro Systems, but a new counterpart of this one has been released by the Java Community Process (http://www.jcp.org) which relates to the Sun Micro Systems, Oracle, BEA, IBM, Nokia, Ericsson et al.
In form of Rx-Tx API this is now available under AFL.
There are several other APIs like the Open Source API, SMSLib, and the commercial ones like JSMS, available which are close competitors to this API. But the author’s API betters the cost-effectiveness of an application solution based on the API, in that, JSMS and SMSLib can handle the same tasks if we use a real Commercial GSM Modem, but for a small infrastructure where we use simple GSM Mobile handsets instead, they fail due to the fact that Mobiles nowadays store SMS not in the SIM, which was the tradition when these APIs were released; but in the Mobile Phone Memory known as “ME”.
The API gives the Application Developer an abstraction for sending, receiving and processing the received text SMS. There are several arenas where the API can be used to give a solution to an application with a minimal infrastructure. To speak of a few relevant and important applications, the followings stand out to be the most interesting ones…
(a) A Simple Solution to publish the internal marks of an Institution where the student capacity is say, around 1500. Although there exists a system where the Exam Boards like West Bengal Council of Higher Secondary Education, CBSE, etc, offer the same service to more than 6, 00,000 students, we cannot go for the same with 1500 students as it’d be very unwise to purchase bulk SMS from a provider for as little as 1000-2000 students and to make the solution cost effective we can go for the proposal the author depicts here. The students are required to SMS their roll number or whatever primary key they are uniquely identified with, to a Life Time Connection on the GSM Mobile, which will notify the PC of the SMS received, to get it processed and generate a suitable response after querying a database system and reply it back to the students’ phone numbers.
(b) This can be used as a medium of public notice of say, an Organization that does not want to invest much on the system.
(c) It can be helpful for NGOs, Insurance Agencies, private Financial Consultants and others who want to automate SMS sending in reply to a received one.
(d) It can be used as a medium to advertisement from small product distributors, House Building Promoters, who will want to publicize their message to a selected mass of people. Even political teams may use this to spread their motto amongst expected voters.
(e) Last but not the least, this SMS systems can be used as a means to control household electrical and electronic appliances through a micro controller driven system and a simple text SMS. Suppose, one has 4 devices namely, A, B, C, D. If one goes on a long trip and feels he did not switch off the Air conditioner machine, say, device A, before leaving his apartment, he’d simply SMS “A off” to the Mobile kept in his house connected to the Controller device, the received SMS will make the systems switch off device A, if it was not already switched off, and an SMS will be sent to the user’s mobile to notify him that the operation succeeded. Proper security measures will be taken, however, to ensure that unauthorized people do not access the system.
2. Contribution with respect to existing counterpart:
Though there exist several robust counterparts of the author’s API, all the way from the open source SMSLib, to the Commercial JSMS, my API betters the cost effectiveness of the solutions based on this technology.
Dating back to 2004, these APIs were released to SMS and receive SMS from and by a GSM Modem. Since GSM Mobile handsets come with an internal GSM Modem, one could use GSM handsets with PC-to-Mobile interface like say, Data cable, to get the job done.
But as Mobile handsets have seen a drastic hardware and software change on a revolutionary footing, unlike in the time of “yore” when Mobiles stored SMS in SIM, which is now in “ME”, a Phone Memory Element, SMS can not be received using a Mobile Phone. But they work as fine with GSM Modems as they used to in those days.
As GSM Modem itself is a costly device, which cannot be afforded by small infrastructures, Tom-Dick-Harry’s first choice will be to use a system that’d be cost effective. A GSM Mobile with Data cable can be had easily off any Mobile Store for as cheaply as INR. 2000. And a life time connection of a GSM service provider’s can be availed for INR 199 and can be recharged with SMS Promo Cards, which costs 5 paise / SMS.
So, the entire solution becomes cost effective if viewed from the part of infrastructures.
This is a pure Java SE 1.4+ API which uses Java Communication API for windows, which is no more available off Sun Micro Systems under AFL. This can, however, be replaced with Java Community Process’s Rx-Tx API off IBM’s contribution page.
The Communication API or Rx-Tx API is used to perform serial communication to and from a COM or Virtual COM Port.
As of the internal functional specification of the API, the API can send SMS, read SMS, process SMS, the first two using Standard AT Commands.
AT Commands are commands which are used to interact with any standard GSM 7.0 Modem.
The command to send SMS is:
AT+CMGF=1 (means, Message in Text Format not in PDU format)
AT+CMGS= <phone_no> (sets destination address)
Followed by <text_msg_not_exceeding140chars> and terminated by <Ctrl+Z>
The command to read SMS is
AT+CMPS=”ME” (SMS store=”ME” Phone Memory)
AT+CMGR=<index>, which returns a Raw String containing several responses like time, date, pdu unit, status etc. The AT Commands are same for all GSM-7.0 and above devices.
The API defines two classes, one Exception class, that is thrown should the COM port not be found, and most essentially, a class, SMSUtil that is basically an abstract one, having two abstract methods which we have to override in the sub class. The sub class should concretely define how the message index would be fetched and how the received SMS would be processed, means whether is requires a reply or database interaction. Other methods fully provide abstraction to the end-developer, defining other methods to be final so that the developers don’t mistakenly override them.
4. Results and Discussion:
(a) This API has been tested to provide 100% success rate for a solution to publish the marks of internal tests of the students of JIS College of Engineering, where the author teaches.
(b) The API has been tested successfully for a student feedback solution using SMS at the same venue.
(c) The API has been recognized by SourceForge.net experts and is already available under AFL(Academic Free License)
(d) The API has been published in IBM Developerworks, US Web journal.
(e) The API has shown 100% success rate in remotely switch on/off household electrical and electronic devices using SMS and a Microcontroller driven circuitry.