com.objectxp.msg
Class TapSmsService

java.lang.Object
  extended by AbstractSmsService
      extended by com.objectxp.msg.TapSmsService
All Implemented Interfaces:
SmsService

public class TapSmsService
extends AbstractSmsService
implements SmsService

This class may be used to send Short Messages (SMS) to a mobile recipient using TAP/IXO.

The message will be sent through the SMS Center (SMSC). The SMSC may be reached by either a modem or ISDN connection.

TAP/IXO only supports 7-Bit encoded messages. All characters in a message above ASCII(127) will therefore be truncated to a dot (.).

Notice: Receiving Messages through TAP is not supported.


Field Summary
static java.lang.String CFG_BPS
          Port speed (baud rate)
static java.lang.String CFG_DATABITS
          Number of databits (5,6,7,8)
static java.lang.String CFG_FLOWCTRL
          Flow-Control ("RTSCTS", "XONXOFF", "NONE")
static java.lang.String CFG_INITSTRING
          CFG_INITSTRING is the name of the constant holding the value "tap.initstring".
static java.lang.String CFG_LOGIN
          Login name (if required by tap gateway)
static java.lang.String CFG_PARITY
          Parity ("NONE","ODD","EVEN", "MARK","SPACE")
static java.lang.String CFG_PORT
          name of the serial port where your modem / ISDN adapter is attached (e.g.
static java.lang.String CFG_SENDER
          Default message sender address
static java.lang.String CFG_SMSC
          configuration property for specifing the SMSC phone number
static java.lang.String CFG_STOPBITS
          Stop bits (1,15,2)
 
Fields inherited from interface com.objectxp.msg.SmsService
VERSION
 
Constructor Summary
TapSmsService()
           
 
Method Summary
 void connect()
          Connect to the GSM device or SMS gateway.
 void destroy()
          Release allocated resources and destroy this service.
 void disconnect()
          Disconnect from the GSM device or SMS gateway.
 java.lang.String getServiceName()
          Gets the name of the service.
 boolean hasCapability(Capability capability)
          Determine if a SMS Service has a specific capability.
 void init(java.util.Properties props)
          Initialize this service.
 boolean isConnected()
          Returns true if the Service is currently connected to the GSM device or SMS gateway, false otherwise.
 void sendMessage(Message message)
          Send a message to a GSM recipient.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.objectxp.msg.SmsService
addMessageEventListener, cancel, getKeepAliveInterval, getLastIsAliveTime, getProperties, init, init, isAlive, isInitialized, isKeepAliveActive, isReceiving, query, removeMessageEventListener, replace, setKeepAliveInterval, startReceiving, stopReceiving, supportDeleteMessage, supportReadMessage
 

Field Detail

CFG_SMSC

public static final java.lang.String CFG_SMSC
configuration property for specifing the SMSC phone number

See Also:
Constant Field Values

CFG_PORT

public static final java.lang.String CFG_PORT
name of the serial port where your modem / ISDN adapter is attached (e.g. "COM3")

See Also:
Constant Field Values

CFG_BPS

public static final java.lang.String CFG_BPS
Port speed (baud rate)

See Also:
Constant Field Values

CFG_DATABITS

public static final java.lang.String CFG_DATABITS
Number of databits (5,6,7,8)

See Also:
Constant Field Values

CFG_PARITY

public static final java.lang.String CFG_PARITY
Parity ("NONE","ODD","EVEN", "MARK","SPACE")

See Also:
Constant Field Values

CFG_STOPBITS

public static final java.lang.String CFG_STOPBITS
Stop bits (1,15,2)

See Also:
Constant Field Values

CFG_FLOWCTRL

public static final java.lang.String CFG_FLOWCTRL
Flow-Control ("RTSCTS", "XONXOFF", "NONE")

See Also:
Constant Field Values

CFG_LOGIN

public static final java.lang.String CFG_LOGIN
Login name (if required by tap gateway)

See Also:
Constant Field Values

CFG_SENDER

public static final java.lang.String CFG_SENDER
Default message sender address

See Also:
Constant Field Values

CFG_INITSTRING

public static final java.lang.String CFG_INITSTRING
CFG_INITSTRING is the name of the constant holding the value "tap.initstring".

See Also:
Constant Field Values
Constructor Detail

TapSmsService

public TapSmsService()
Method Detail

getServiceName

public final java.lang.String getServiceName()
Gets the name of the service.

Specified by:
getServiceName in interface SmsService

init

public void init(java.util.Properties props)
          throws MessageException
Description copied from interface: SmsService
Initialize this service. One of the init() methods has to be called before the SmsService may be used.

Specified by:
init in interface SmsService
Throws:
MessageException
See Also:
SmsService.init(), SmsService.init(java.io.File)

sendMessage

public void sendMessage(Message message)
                 throws MessageException
Description copied from interface: SmsService
Send a message to a GSM recipient. The recipient must be a valid GSM phone number. The message will be truncated to 160 characters.

If the message to send is not a binary or unicode message, the service will convert the message to the default GSM character set using GsmHelper.iso2gsm().

This method will broadcast a MessageEvent to all registered MessageEventListener's. In case of success a MessageEvent of type MESSAGE_SENT is broadcasted. Otherwise, the MessageEvent is of type MESSAGE_NOT_SENT.

Specified by:
sendMessage in interface SmsService
Parameters:
message - the message to send.
Throws:
MessageException - if the message could not be sent.

destroy

public void destroy()
Description copied from interface: SmsService
Release allocated resources and destroy this service. The service may not be re-used after calling destroy(). This method has to be invoked when the SMS Service will not be used anymore.

Specified by:
destroy in interface SmsService

connect

public void connect()
             throws MessageException
Description copied from interface: SmsService
Connect to the GSM device or SMS gateway. Before sending and receiving messages, this method must be called. When the connection is established, the Service broadcasts a MessageEvent.DEVICE_READY event to all registered MessageEventListeners.

Specified by:
connect in interface SmsService
Throws:
MessageException
See Also:
MessageEvent, MessageEventListener

disconnect

public void disconnect()
                throws MessageException
Description copied from interface: SmsService
Disconnect from the GSM device or SMS gateway. Call this method after sending/receiving messages. After the connection has been disconnected, jSMS broadcasts a MessageEvent.DEVICE_NOT_READY even to all registered MessageEventListeners.

Specified by:
disconnect in interface SmsService
Throws:
MessageException
See Also:
MessageEvent, MessageEventListener

isConnected

public boolean isConnected()
Description copied from interface: SmsService
Returns true if the Service is currently connected to the GSM device or SMS gateway, false otherwise.

Specified by:
isConnected in interface SmsService

hasCapability

public boolean hasCapability(Capability capability)
Description copied from interface: SmsService
Determine if a SMS Service has a specific capability.

Specified by:
hasCapability in interface SmsService
Parameters:
capability - one of the Constants in the Capability class.
Returns:
true if the service provides the capability.


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