A Technology Blog About Code Development, Architecture, Operating System, Hardware, Tips and Tutorials for Developers.

Wednesday, June 23, 2010


10:02:00 PM Posted by Satish Kumar , , , , 6 comments


A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves. Computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands.


In general, a GSM/GPRS modem is recommended for use with a computer to send and receive messages. This is because some mobile phones have certain limitations comparing to GSM/GPRS modems. Using my Nokia 3110C, I am not able to receive any messages to my computer. And also I noticed the phone always run out battery in no time. But there are some phones in the market which support all the AT commands. Here is the list of AT Commands supported by the Nokia phones.


1. Connect your mobile phone to a computer and set up the corresponding wireless modem driver.
2. Run MS HyperTerminal by selecting Start -> Programs -> Accessories -> Communications -> HyperTerminal.
3. In the Connection Description dialog box, enter a name and choose an icon you like for the connection. Then click the OK button.

4. In the Connect To dialog box, choose the COM port that your mobile phone is connecting to in the Connect using combo box. For example, choose COM1 if your mobile phone is connecting to the COM1 port. Then click the OK button.
Sometimes there will have more than one COM port in the "Connect Using" combo box. To know which COM port is used by your mobile phone, follow the procedure below:
a. Go to Control Panel -> Phone and Modem Options".
b. Then click the Modems tab. In the list box, you can see which COM port the mobile phone or GSM/GPRS modem is connected to.
5. The "Properties" dialog box comes out. Enter the correct port settings for your mobile phone. Then click the OK button.
To find the correct port settings that should be used with your mobile phone, one way is to consult the manual of your mobile phone. Another way is to check the port settings used by the wireless modem driver that you installed earlier.
To check the port settings used by the wireless modem driver, follow these steps:
a. Go to Control Panel -> Phone and Modem Options -> Modems tab.
b. Select your mobile phone in the list box.
c. Click the "Properties" button.
d. The Properties dialog box appears. Click the Advanced tab and then click the Change Default Preferences button.
e. The Change Default Preferences dialog box appears. The Port speed field on the General tab corresponds to HyperTerminal's "Bits per second" field. You can also find the setting for flow control on the General tab. On the Advanced tab, you can find the settings for data bits, parity and stop bits.
6. Type AT in the main window. A response OK should be returned from the mobile phone or GSM/GPRS modem. Type AT+CPIN? in the main window. The AT command AT+CPIN? is used to query whether the mobile phone is waiting for a PIN (personal identification number, i.e. password). If the response is +CPIN: READY, it means the SIM card does not require a PIN and it is ready for use. If your SIM card requires a PIN, you need to set the PIN with the AT command AT+CPIN=[PIN].

Now the mobile phone is configured to work as a GSM modem.

As the modem is connected to the COM port of the computer, you have to use Java Communications API.
Sun provides an API extension for communicating with parallel and serial ports, specifically for Solaris and Windows environments. The API can be found here. There are also third party APIs and an open source implementation, which works on several platforms including Linux. You can download the Java Communications API from here.


Among the items that you download from Sun are three very important files:
1. comm.jar
2. win32com.dll
3. javax.comm.properties

For the JVM to recognize the serial ports, proper placement of these files is important. And have found the following installation methods to be effective:

1. comm.jar should be placed in:


2. win32com.dll should be placed in:


3. javax.comm.properties should be placed in:


Now Java is correctly configured to interact with the COM ports. Now it is the time to write a program to send and receive message.


For sending and receiving SMS I am using the following procedure.

1. Connecting to the COM port where the modem is connected.
2. Registering the listener for serial port event.
3. Using the following set of AT commands to send the SMS.

            AT (To check the modem)
            OK (Response - modem connected)

            AT+CMGF=1 (To set the text messaging mode)
            OK (Response - text messaging mode set successfully)

            AT+CSCA="+979797979796464" (To set the message center)
            OK (Response - message center is set properly)

            AT+CMGS="+91021482048023" (To set the recipient no and open the message writing prompt)
            >my test message + [Ctrl+z] ("Ctrl+z" is to come out of the message writing prompt)
            CMGS: +919886599334 (Message sent)
4. As we have registered to the serial port events, when ever any data will come to the serial port the implemented method will print the data to the console. It is applicable for receive message also.

If you are using the GSM/GPRS modem, then lot of other features of phone like call receiving, making a call, call forwarding, answering machine etc can be developed for any enterprise application. 


1. Source Code or you can fork at GitHub.

Tuesday, June 1, 2010


9:25:00 AM Posted by Satish Kumar , , 2 comments

JavaScript is a object based language and Java is a object oriented language. There are lot of object oriented features comes with java like static and non-static members, private and public members, inheritance etc. So why can't we have all these in JavaScript??? After googling and discussing with some of the JavaScript developers, finally we could able to demonstrate the object oriented features using JavaScript. We made use of JavaScript function and prototype to achieve this.

Work Flow:

1. One base class is created.
2. Another child class created extending the base class to demonstrate the inheritance.
3. One subclass created extending the second class to demonstrate the multilevel inheritance.

I am sharing the source code to better understand, what we did.


1. All the classes will be having static, non-static, private and public members.
2. In the test client we are demonstrating some of these features.
3. To test the other features, additional caller codes has to be added.

4. What ever we worked out is not the actual object oriented features in JavaScript. But certainly works like that.
5. There can be many other ways to do the same.

Shared Items: