Package com.objectxp.msg

This Package provides the classes necessary to send and receive GSM Short Messages (SMS).

See:
          Description

Interface Summary
ManualAck This interface defines the methods necessary to manually acknowledge (ACK) incoming messages.
MessageEventInterceptor  
MessageEventListener The listener interface for receiving notification about message events.
MultiPartMessage Interface for handling short messages consisting of more than 140 octets (160 characters).
SmsService This interface defines the methods to send and receive GSM Short Messages (SMS).
SmsStatus This interface represents a SMS Status Report result.
WindowingService This interface may be implemented by SmsServices that support Windowing.
 

Class Summary
Address This class represent a simple address.
AtReply This class represents a reply received from a Modem after sending an AT command.
Capability The Capabilities class can be used to determine if a SMS Service has a specific feature: SmsService service = new GsmSmsService(); ...
Cimd2Message This class extends the class SmsMessage with CIMD2 specific properties.
Cimd2SmsService This class may be used to send (and receive) Short Messages (SMS) to a mobile recipient using Nokia's CIMD2 protocoll (Computer Interface to Message Distribution).
Cimd2Status This class is a representation of a CIMD2 Status Report Operation (23).
GsmAddress This class represents a GSM Address field according to GSM 03.40.
GsmConnector Base class for Gsm Connections.
GsmHelper This class contains various static helper methods used for GSM communication.
GsmSmsService This class may be used to send and receive GSM Short Messages (SMS) using a GSM mobile device.
GsmStatus This class is a representation of the TP-STATUS field as defined in GSM 03.40.
Message This class represents a generic Message.
MessageEvent A Message Event.
MultiPartReceiver This class can be used to receive concatenated SMS (SMS that carry more than 140 octets / 160 characters and therefore are fragmented in multiple short messages).
MultipleRecipientMessage This class may be used to send a SMS to multiple recipients at once.
Recipient This class represents a message recipient.
SEOMessage This class can be used to send Multimedia Short Messages to Siemens Phones which support the Siemens Exchange Object (SEO) format.
SmppMessage This class extends the class SmsMessage with SMPP specific properties.
SmppOptionalParameter This class represents a SMPP TLV field.
SmppSmsService This class may be used to send (and receive) Short Messages (SMS) to a mobile recipient using the SMPP Protocol.
SmppStatus This class is a representation of a SMPP Delivery Receipt.
SmsMessage This class extends the generic Message class with SMS specific attributes.
SmtpMessage This class extends the generic Message class with SMTP specific properties.
SmtpService This class may be used to send a Internet mail message using a Smtp mail server.
StatusReportMessage This class represents a SMS Status Report.
TapSmsService This class may be used to send Short Messages (SMS) to a mobile recipient using TAP/IXO.
UcpMessage This class extends the class SmsMessage with UCP specific properties.
UcpSmsService This class may be used to send (and receive) Short Messages (SMS) to a mobile recipient using UCP (Universal Computer Protocol).
UcpStatus This class represents a UCP Status Report result.
 

Exception Summary
Cimd2Exception This exception will be thrown by the Cimd2SmsService for CIMD2 specific exceptions.
GsmException This exception will be thrown by the GsmSmsService for GSM specific exceptions.
MessageException This exception will be thrown by the Messaging package
ParseException The class ParseException is thrown by jSMS parsing /decoding code (e.g. the GsmHelper.decodePDU(String, boolean, boolean) method) if parsing/decoding fails.
SmppException This exception will be thrown by the SmppSmsService for SMPP specific exceptions.
TimeoutException This exception will be thrown by jSMS if a GSM device (in case of a GsmSmsService) or SMSC doesn't reply to commands within a reasonable time.
UcpException This exception will be thrown by the UcpSmsService for UCP specific exceptions.
 

Package com.objectxp.msg Description

This Package provides the classes necessary to send and receive GSM Short Messages (SMS).

jSMS currently supports the following transport facilities:

jSMS supports text messages (using the 7-bit and UCS2 alphabet) as well as binary messages (8-bit) and Nokia SmartMessages (Business Cards, Calendar Entries, Picture Messages, Operator Logos and Ringtones).

The jSMS API has been designed with a modular architecture in focus. This allows an easy integration of other SMS capable facilities.

The following example code demonstrates how to send a Short Message using a SMS-capable GSM-Device:

  package com.mydomain.sms;

  import java.io.File;
  import com.objectxp.msg.*;

  public class SendSMS
  {
    public static void main(String args[])
    {
      File configuration = new File("/path/to/my/jsms.properties");
      SmsService service = new GsmSmsService();

      try {
        service.init(configuration);
      } catch( Exception ex ) {
        System.err.println("Unable to initialize service: "+ex.getMessage());
        System.exit(0);
      }
      
      SmsMessage msg = new SmsMessage(service);
      msg.setRecipient("+411123456");
      msg.setMessage("Hello World");
      
      try {
        service.connect();
        service.sendMessage(msg);
        System.out.println("Message sent!");   
      } catch( MessageException ex ) {
        System.err.println("Error while sending the Message: "+ex.getMessage());
      }
    }
  }

The next example shows you how to receive Short Messages using CIMD2 over TCP/IP:

  package com.mydomain.sms;
  
  import com.objectxp.msg.*;
  import java.io.File;
  
  public class ReceiveSMS
  {
    public static void main(String[] args)
    {
      File configuration = new File("/path/to/my/jsms.properties");
      SmsService service = new Cimd2SmsService();
    
      try {
        service.init(configuration);
      } catch( Exception ex ) {
        System.err.println("Unable to initialize service: "+ex.getMessage());
        System.exit(0);
      }
      
      // Register a message event handler
      service.addMessageEventListener( new MessageEventListener() {
        public void handleMessageEvent(MessageEvent event)
        {
          if ( event.getType() == MessageEvent.MESSAGE_RECEIVED )
          {
              Message msg = event.getMessage();
              System.out.println("Message from "+msg.getSender()+": "+msg.getMessage());
          }
        }
      });
      
      try {
        // Connect to the CIMD2 SMS Center
        service.connect();
      
        // Start receiving messages
        service.startReceiving();
        
        System.out.print("Press any key to stop receiving messages");
        System.in.read();
        
        // Disconnect 
        service.disconnect();
        
      } catch( Exception ex ) {
        System.err.println("Exception occured while receiving SMS: "+ex.getMessage());
        System.exit(0);
      }
    }
  }



object XP, Inc. © 2000-2008. All rights reserved object XP