Implementation - continued....

The Jsms Model

The JSMS model provides a small footprint SMS and mail API that can easily be applied on embedded devices. The footprints of the JSMS API includes drivers for several devices in just above 150 KB. One may ask when should which API be used. As a general term, if a complete e-mail application is to be developed, one must stick with the Java API defined by Sun. For applications that don't have to send/receive complex messages or especially for SMS applications, the use of jSMS is recommended.

Installing JSMS

First of all download a copy of jSMS-API from http://www.objectxp.com. After jSMS is downloaded or purchased, an email message is sent to the licensee containing license properties. These properties are required to run jSMS application (for the demo version as well as full versions of jSMS). The following table shows the license properties:

Property Comments
ObjectXP.license.company The company name of the licensee.
ObjectXP.license.User The user name of the licensee.
ObjectXP.license.key The license key you received after registering/purchasing jSMS.

Install JSMS
The following steps are necessary to install the product:
1. Unzip the downloaded file to your target directory (using a tool like WinZip or WinRar).
2. Change the directory to the target directory.
3. Make the necessary changes in jsms.conf file:

  • Copy the license properties that you received via email.
  • Change the connector.serial.port.property to one you have the GSM device connected.

4. Install javax.comm for windows.

We also need a Java JDK/JRE and a Nokia cell phone.

Sending SMS Messages with Jsms
The GSM device is connected directly to a serial port on the host computer. The jsms API will communicate with the device using the javax.comm package.

The following example illustrate how we have applied JSMS for the application.

package example 1
import java.io.*;
import com.objectxp.msg.*;

public class JSMSExample1{
SMSService service=null;
try
{
File config = new File("/path/to/your/jsms.conf");

//create service onject
service = new GSMSMSService();
service.init(config);
//create a new message
Message msg = new Message(service);
msg.setRecipient("+411234567");
msg.setMessage("Hi from jsms");
//connect to devices
service.connect();
//send the message
service.sendMessage(msg);
System.out.println("Message sent successfully");
}catch(Exception e)
{
}
finally{
if(service!=null)
{
service.disconnect();
service.destroy();
}
}
}
}


 

  Java Alert Notification System Home Page

   Previous    Next  
 

UNIVERSAL TEACHER PUBLICATIONS
Web: universalteacherpublications.com, universalteacher.com, universalteacher4u.com