com.objectxp.msg
Class Cimd2SmsService

java.lang.Object
  extended byAbstractSmsService
      extended bycom.objectxp.msg.Cimd2SmsService
All Implemented Interfaces:
ManualAck, SmsService, WindowingService

public class Cimd2SmsService
extends AbstractSmsService
implements SmsService, WindowingService, ManualAck

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).

The message will be sent through a SMS Center (SMSC) reachable by either TCP/IP or a analog/ISDN modem.

CIMD2 requires a "large volume account" at the SMSC of your Mobile Network Provider. Contact your local provider for further information.


A Word about SME types

CIMD2 supports three different SME (Short Message Entity) types. The type used for your account depends on how your operator has set it up.

Please make sure that you have specified the correct SME type in your init(Properties) properties.

A word about Manual Acknowledgement (ManualAck): For receiving SME types, a incoming Message will be dispatched to your MessageEventListener only once. However, for querying SME types, the same message will be delivered to your MessageEventListener over and over again until you acknowledge the Message. (the CIMD2 SMSC will deliver unacknowledged messages each time jSMS queries for new messages).

Please note: for Windowing to work, this has to be enabled by your SMSC provider.

See Also:
Serialized Form

Nested Class Summary
 class Cimd2SmsService.MessagePoller
          Check for new messages asynchronously.
 
Field Summary
static int CANCEL_ALL
          Cancel all sent messages.
static int CANCEL_DEST
          Cancel all messages with same destination address.
static int CANCEL_THIS
          Cancel a message where the destination address and the time stamp match with a short message submitted earlier.
static java.lang.String CFG_BPS
          CFG_BPS is the name of the constant holding the value "cimd2.serial.bps".
static java.lang.String CFG_CONNECTOR
          CFG_CONNECTOR is the name of the constant holding the value "cimd2.connector".
static java.lang.String CFG_DATABITS
          CFG_DATABITS is the name of the constant holding the value "cimd2.serial.databits".
static java.lang.String CFG_FLOWCTRL
          CFG_FLOWCTRL is the name of the constant holding the value "cimd2.serial.flowcontrol".
static java.lang.String CFG_HOST_ADDRESS
          CFG_HOST_ADDRESS is the name of the constant holding the value "cimd2.host.address".
static java.lang.String CFG_HOST_PORT
          CFG_HOST_PORT is the name of the constant holding the value "cimd2.host.port".
static java.lang.String CFG_INITSTRING
          CFG_INITSTRING is the name of the constant holding the value "cimd2.serial.initstring".
static java.lang.String CFG_LOCAL_ADDRESS
          CFG_LOCAL_ADDRESS is the name of the constant holding the value "cimd2.local.address".
static java.lang.String CFG_LOCAL_PORT
          CFG_LOCAL_PORT is the name of the constant holding the value "cimd2.local.port".
static java.lang.String CFG_LOGIN
          CFG_LOGIN is the name of the constant holding the value "cimd2.login".
static java.lang.String CFG_PARITY
          CFG_PARITY is the name of the constant holding the value "cimd2.serial.parity".
static java.lang.String CFG_PASSWORD
          CFG_PASSWORD is the name of the constant holding the value "cimd2.password".
static java.lang.String CFG_POLL_INTERVAL
          CFG_POLL_INTERVAL is the name of the constant holding the value "cimd2.poll.interval".
static java.lang.String CFG_PORT
          CFG_PORT is the name of the constant holding the value "cimd2.port.name".
static java.lang.String CFG_SME_TYPE
          CFG_SME_TYPE is the name of the constant holding the value "cimd2.sme.type".
static java.lang.String CFG_SMSC
          CFG_SMSC is the name of the constant holding the value "cimd2.smsc.number".
static java.lang.String CFG_STATUSREPORT_PARAMETER
          CFG_STATUSREPORT_PARAMETER is the name of the constant holding the value "cimd2.statusreport.parameter".
static java.lang.String CFG_STOPBITS
          CFG_STOPBITS is the name of the constant holding the value "cimd2.serial.stopbits".
static java.lang.String CFG_VERSION
          CFG_VERSION is the name of the constant holding the value "cimd2.version".
static java.lang.String CFG_WINDOW_SIZE
          CFG_WINDOW_SIZE is the name of the constant holding the value "cimd2.window.size".
static java.lang.String CONNECTOR_SERIAL
          CONNECTOR_SERIAL is the name of the constant holding the value "SERIAL".
static java.lang.String CONNECTOR_TCP
          CONNECTOR_TCP is the name of the constant holding the value "TCP".
static java.lang.String SME_TYPE_QUERYING
          SME_TYPE_QUERYING is the name of the constant holding the value "query".
static java.lang.String SME_TYPE_RECEIVING
          SME_TYPE_RECEIVING is the name of the constant holding the value "receive".
static java.lang.String SME_TYPE_SENDONLY
          SME_TYPE_SENDONLY is the name of the constant holding the value "send-only".
 
Constructor Summary
Cimd2SmsService()
          Creates a new Cimd2SmsService.
 
Method Summary
 void acknowledge(Message msg)
          Accept a incoming message.
 void acknowledge(Message msg, java.lang.Object status)
          Accept/reject a incoming message.
 void cancel(Message msg)
          Cancel a previously submitted message.
 void cancelMessage(int mode, Message message)
          This method can be used to cancel a message sent earlier by the subscriber.
 void connect()
          Connect to the GSM device or SMS gateway.
 void destroy()
          Release allocated resources and destroy this service.
 void disableManualAck()
          Disable manual acknowledgement.
 void disconnect()
          Disconnect from the GSM device or SMS gateway.
 void enableManualAck()
          Enable manual acknowledgement.
 int getNumberOfMessagesWaiting()
          Get total number of messages waiting to be received.
 int getNumberOfPendingMessages()
          Returns the number of pending (unprocessed messages).
 java.lang.String getServiceName()
          Returns the name of the service.
 StatusReportMessage getStatusReport(Message msg)
          Get a status report for given Message.
 int getWindowSize()
          Returns the current window size or 1 if windowing is disabled.
 boolean hasCapability(Capability capability)
          Determine if a SMS Service has a specific capability.
 void init(java.util.Properties props)
          Initialize the service.
 boolean isManualAckEnabled()
          Check if manual acknowledgement is enabled/disabled.
 void query(Message msg)
          Query the status of a previously submitted message.
 void resetSession()
          Reset the CIMD2 session.
 void sendMessage(Message msg)
          Send a message to a GSM recipient.
 void setWindowSize(int windowSize)
          Set the window size for this service.
 void startReceiving()
          Start receiving Messages.
 void stopReceiving()
          Stop receiving Messages.
 boolean supportReadMessage()
          Deprecated. since jSMS 2.1.8, use hasCapability(Capability.RECEIVE) instead.
 
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, getKeepAliveInterval, getLastIsAliveTime, getProperties, init, init, isAlive, isConnected, isInitialized, isKeepAliveActive, isReceiving, removeMessageEventListener, replace, setKeepAliveInterval, supportDeleteMessage
 

Field Detail

CFG_HOST_ADDRESS

public static final java.lang.String CFG_HOST_ADDRESS
CFG_HOST_ADDRESS is the name of the constant holding the value "cimd2.host.address".

See Also:
Constant Field Values

CFG_HOST_PORT

public static final java.lang.String CFG_HOST_PORT
CFG_HOST_PORT is the name of the constant holding the value "cimd2.host.port".

See Also:
Constant Field Values

CFG_LOCAL_ADDRESS

public static final java.lang.String CFG_LOCAL_ADDRESS
CFG_LOCAL_ADDRESS is the name of the constant holding the value "cimd2.local.address".

See Also:
Constant Field Values

CFG_LOCAL_PORT

public static final java.lang.String CFG_LOCAL_PORT
CFG_LOCAL_PORT is the name of the constant holding the value "cimd2.local.port".

See Also:
Constant Field Values

CFG_LOGIN

public static final java.lang.String CFG_LOGIN
CFG_LOGIN is the name of the constant holding the value "cimd2.login".

See Also:
Constant Field Values

CFG_VERSION

public static final java.lang.String CFG_VERSION
CFG_VERSION is the name of the constant holding the value "cimd2.version".

See Also:
Constant Field Values

CFG_PASSWORD

public static final java.lang.String CFG_PASSWORD
CFG_PASSWORD is the name of the constant holding the value "cimd2.password".

See Also:
Constant Field Values

CFG_SME_TYPE

public static final java.lang.String CFG_SME_TYPE
CFG_SME_TYPE is the name of the constant holding the value "cimd2.sme.type".

See Also:
Constant Field Values

CFG_POLL_INTERVAL

public static final java.lang.String CFG_POLL_INTERVAL
CFG_POLL_INTERVAL is the name of the constant holding the value "cimd2.poll.interval".

See Also:
Constant Field Values

CFG_WINDOW_SIZE

public static final java.lang.String CFG_WINDOW_SIZE
CFG_WINDOW_SIZE is the name of the constant holding the value "cimd2.window.size".

See Also:
Constant Field Values

CFG_CONNECTOR

public static final java.lang.String CFG_CONNECTOR
CFG_CONNECTOR is the name of the constant holding the value "cimd2.connector".

See Also:
Constant Field Values

CONNECTOR_TCP

public static final java.lang.String CONNECTOR_TCP
CONNECTOR_TCP is the name of the constant holding the value "TCP".

See Also:
Constant Field Values

CONNECTOR_SERIAL

public static final java.lang.String CONNECTOR_SERIAL
CONNECTOR_SERIAL is the name of the constant holding the value "SERIAL".

See Also:
Constant Field Values

CFG_SMSC

public static final java.lang.String CFG_SMSC
CFG_SMSC is the name of the constant holding the value "cimd2.smsc.number".

See Also:
Constant Field Values

CFG_PORT

public static final java.lang.String CFG_PORT
CFG_PORT is the name of the constant holding the value "cimd2.port.name".

See Also:
Constant Field Values

CFG_BPS

public static final java.lang.String CFG_BPS
CFG_BPS is the name of the constant holding the value "cimd2.serial.bps".

See Also:
Constant Field Values

CFG_DATABITS

public static final java.lang.String CFG_DATABITS
CFG_DATABITS is the name of the constant holding the value "cimd2.serial.databits".

See Also:
Constant Field Values

CFG_PARITY

public static final java.lang.String CFG_PARITY
CFG_PARITY is the name of the constant holding the value "cimd2.serial.parity".

See Also:
Constant Field Values

CFG_STOPBITS

public static final java.lang.String CFG_STOPBITS
CFG_STOPBITS is the name of the constant holding the value "cimd2.serial.stopbits".

See Also:
Constant Field Values

CFG_FLOWCTRL

public static final java.lang.String CFG_FLOWCTRL
CFG_FLOWCTRL is the name of the constant holding the value "cimd2.serial.flowcontrol".

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 "cimd2.serial.initstring".

See Also:
Constant Field Values

CFG_STATUSREPORT_PARAMETER

public static final java.lang.String CFG_STATUSREPORT_PARAMETER
CFG_STATUSREPORT_PARAMETER is the name of the constant holding the value "cimd2.statusreport.parameter". It corresponds to the CIMD2 Parameter 56 (Status Report Request) and can be used to specify what kind of status reports the SMSC will report.

Possible values are:

The above values can be combined. E.g. to get only status reports about failed (4) or successful (8) deliveries, set the parameter to 12.

The default value used by jSMS is 62.

See Also:
Constant Field Values

SME_TYPE_QUERYING

public static final java.lang.String SME_TYPE_QUERYING
SME_TYPE_QUERYING is the name of the constant holding the value "query".

See Also:
Constant Field Values

SME_TYPE_RECEIVING

public static final java.lang.String SME_TYPE_RECEIVING
SME_TYPE_RECEIVING is the name of the constant holding the value "receive".

See Also:
Constant Field Values

SME_TYPE_SENDONLY

public static final java.lang.String SME_TYPE_SENDONLY
SME_TYPE_SENDONLY is the name of the constant holding the value "send-only".

See Also:
Constant Field Values

CANCEL_DEST

public static final int CANCEL_DEST
Cancel all messages with same destination address.

See Also:
Constant Field Values

CANCEL_ALL

public static final int CANCEL_ALL
Cancel all sent messages.

See Also:
Constant Field Values

CANCEL_THIS

public static final int CANCEL_THIS
Cancel a message where the destination address and the time stamp match with a short message submitted earlier.

See Also:
Constant Field Values
Constructor Detail

Cimd2SmsService

public Cimd2SmsService()
Creates a new Cimd2SmsService. The service has to be initialized by calling init(Properties)

Method Detail

getServiceName

public final java.lang.String getServiceName()
Description copied from interface: SmsService
Returns the name of the service.

Specified by:
getServiceName in interface SmsService

sendMessage

public void sendMessage(Message msg)
                 throws MessageException,
                        Cimd2Exception,
                        TimeoutException
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:
msg - the message to send.
Throws:
MessageException - if the message could not be sent.
Cimd2Exception
TimeoutException

init

public void init(java.util.Properties props)
          throws MessageException
Initialize the service. The Properties object passed as argument to this method may contain the following properties:

KeyDescription
cimd2.connector Type of connection to the SMSC: Use SERIAL for Modem connections, TCP for TCP/IP connections. Default: TCP.
cimd2.login Login (Short ID)
cimd2.password Password
cimd2.version Version of the CIMD2 specification that the SMSC complies with. Allowed values are 4 for CIMD2 V4.x, or 5 for CIMD2 V5.x. Defaults to 5. This property influences the character conversion from/to the SMSC.
cimd2.sme.type Type of SME (as defined by your SMSC operator). There are three types of SME: Receiving types, Querying (polling) types and send-only types. Values allowed are either query, receive or send-only.
cimd2.poll.interval Incoming messages: Polling interval in seconds (default: 5). Used only if cimd2.sme.type=query
cimd2.keepalive.interval Keepalive interval in seconds. Set to 0 to turn off keep-alive. Defaults to 60.
cimd2.connector.timeout Communication timeout in milliseconds. Defaults to 10000 (10 secs)
cimd2.statusreport.parameter Status Report parameter to use (defaults to 62 if unset). Have a look at the CIMD2 specification for more information about possible values.
cimd2.window.size Windowing size to use. (Defaults to 1 (Windowing disabled))
cimd2.host.address Hostname or IP-Address of the SMSC. E.g. smsc.yourdomain.com
cimd2.host.port IP port number of the SMSC. E.g. 4711
cimd2.local.address Local address (interface) to bind. Example: 192.168.1.1 (if unset, the operating system decides which interface to use, based on the SMSC host address).
cimd2.local.port Local port to bind (if unset or 0, the port will be chosen by the operating system)
cimd2.smsc.number Phone number of your SMSC. This number will be dialed when establishing a modem connection to your CIMD2 SMSC.
cimd2.serial.port Name of the serial port where your modem is connected (e.g. COM1).
cimd2.serial.bps Port speed (bits per second), If unset, 9600 will be used.
cimd2.serial.databits Number of data bits (5,6,7,8).
cimd2.serial.parity Parity (NONE, ODD, EVEN).
cimd2.serial.stopbits Number of stop bits (1, 1.5, 2).
cimd2.serial.flowcontrol Flow Control (NONE, RTSCTS, XONXOFF)
cimd2.serial.initstring Modem init string (defaults to ATZ\nATQ0V1E0\n)



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

disconnect

public void disconnect()
                throws Cimd2Exception,
                       TimeoutException,
                       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:
Cimd2Exception
TimeoutException
MessageException
See Also:
MessageEvent, MessageEventListener

connect

public void connect()
             throws MessageException,
                    TimeoutException,
                    Cimd2Exception
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
TimeoutException
Cimd2Exception
See Also:
MessageEvent, MessageEventListener

cancelMessage

public void cancelMessage(int mode,
                          Message message)
                   throws java.io.IOException,
                          Cimd2Exception,
                          TimeoutException,
                          MessageException,
                          java.lang.IllegalArgumentException
This method can be used to cancel a message sent earlier by the subscriber. It is possible to cancel more than one message. If the message has already been delivered to its destination, it cannot be cancelled.

There are three possible cancel modes:

Parameters:
mode - the cancel mode to use
message - the Message to cancel or null if mode is CANCEL_ALL.
Throws:
java.io.IOException - if the communication to the SMSC unexpectedly failed.
Cimd2Exception - if the SMSC signaled an error
TimeoutException - if the communication with the SMSC timed out.
MessageException - if the service has not been initialized or is currently not connected to the SMSC.
java.lang.IllegalArgumentException - if the arguments passed don't provide all necessary data (e.g. recipient, timestamp) to cancel message(s).

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

startReceiving

public void startReceiving()
                    throws java.io.IOException,
                           java.lang.IllegalStateException,
                           java.lang.IllegalArgumentException
Description copied from interface: SmsService
Start receiving Messages. The Service has to be initialized and must be connected to the SMS gateway/device. Furthermore, you have to register at least one MessageEventListener with the Service. After receiving has started, the service will broadcast a MessageEvent of type MessageEvent.RECEIVING_STARTED to all registered MessageEvent listeners.

Specified by:
startReceiving in interface SmsService
Throws:
java.lang.IllegalStateException - if the service isn't initialized and in connected state or there are no registered Message Event Listeners.
java.io.IOException - if the communication with the SMS gateway/device fails
java.lang.IllegalArgumentException
See Also:
SmsService.addMessageEventListener(MessageEventListener)

stopReceiving

public void stopReceiving()
Description copied from interface: SmsService
Stop receiving Messages. If the service isn't currently receiving messages, this method will return immediately. After receiving has stopped, the service will broadcast a MessageEvent of type MessageEvent.RECEIVING_STOPPED to all registered MessageEvent listeners.

Specified by:
stopReceiving in interface SmsService

getNumberOfMessagesWaiting

public int getNumberOfMessagesWaiting()
                               throws java.io.IOException,
                                      MessageException,
                                      Cimd2Exception,
                                      TimeoutException
Get total number of messages waiting to be received.

Returns:
number of messages waiting to be received
Throws:
java.io.IOException - if the connection to the SMSC is broken
MessageException - if the service has not been initialized or is currently not connected to the SMSC.
Cimd2Exception - if the SMSC signaled an error
TimeoutException

resetSession

public void resetSession()
                  throws java.io.IOException,
                         MessageException,
                         Cimd2Exception,
                         TimeoutException
Reset the CIMD2 session. If the service is currently connected to the CIMD2 SMSC, reset will call disconnect(), otherwise, a connection to the SMSC will be established,a LOGOUT operation will be submitted to the SMSC and the connection will be closed. In the later case, the service will not broadcast any MessageEvents to registered listeners.

Throws:
java.io.IOException - if an I/O Exception of some sort occurred
MessageException - if the service is currently connected, and disconnect() fails
TimeoutException - if the SMSC did not respond to the LOGOUT operation within reasonable time
Cimd2Exception - if the SMSC responded with an error operation

getStatusReport

public StatusReportMessage getStatusReport(Message msg)
                                    throws Cimd2Exception,
                                           java.io.IOException,
                                           java.lang.IllegalArgumentException
Get a status report for given Message.

Parameters:
msg - the message for which to query a status
Throws:
java.io.IOException - if the service is not yet initialized, a connection to the SMSC could not be established or the communication to the SMSC unexpectedly fails.
java.lang.IllegalArgumentException - if the passed message is either null or doesn't contain a recipient and timestamp.
Cimd2Exception - if the SMSC responded with an error operation

supportReadMessage

public boolean supportReadMessage()
Deprecated. since jSMS 2.1.8, use hasCapability(Capability.RECEIVE) instead.

Check if receiving messages is supported. Returns true, if the Service is set up as either querying or receiving type of SME, false otherwise.

Specified by:
supportReadMessage in interface SmsService

acknowledge

public void acknowledge(Message msg)
                 throws java.lang.IllegalArgumentException,
                        java.lang.IllegalStateException,
                        java.io.IOException
Description copied from interface: ManualAck
Accept a incoming message. The SmsService acknowledges the reception of the message to the Short Message Center (SMSC).

Specified by:
acknowledge in interface ManualAck
Parameters:
msg - the Message to accept
Throws:
java.lang.IllegalStateException - if the Service is not initialized or not connected to the SMSC.
java.lang.IllegalArgumentException - if the Message is null or not a incoming message, or if the message has been received by another SmsService.
java.io.IOException

acknowledge

public void acknowledge(Message msg,
                        java.lang.Object status)
                 throws java.lang.IllegalArgumentException,
                        java.lang.IllegalStateException,
                        java.io.IOException
Accept/reject a incoming message. The status parameter can be used to pass an Integer object holding the CIMD2 error code. Consult the CIMD2 specification for more details about the error codes available.

Specified by:
acknowledge in interface ManualAck
Parameters:
msg - the Message to acknowledge
status - an Integer holding the CIMD2 error code or null to accept the message.
Throws:
java.lang.IllegalArgumentException - if the Message is null or not a incoming message, or if the message has been received by another SmsService.
java.lang.IllegalArgumentException - if the status parameter is not an instance of java.lang.Integer
java.lang.IllegalStateException - if the Service is not initialized or not connected to the SMSC.
java.io.IOException - if the communication with the SMSC fails.

enableManualAck

public void enableManualAck()
Description copied from interface: ManualAck
Enable manual acknowledgement. Incoming messages have to be acknowledged by calling ManualAck.acknowledge(Message).

Specified by:
enableManualAck in interface ManualAck

disableManualAck

public void disableManualAck()
Description copied from interface: ManualAck
Disable manual acknowledgement. Incoming messages will automatically be acknowledged by the SmsService upon reception of the message.

Specified by:
disableManualAck in interface ManualAck

isManualAckEnabled

public boolean isManualAckEnabled()
Description copied from interface: ManualAck
Check if manual acknowledgement is enabled/disabled.

Specified by:
isManualAckEnabled in interface ManualAck

getWindowSize

public int getWindowSize()
Description copied from interface: WindowingService
Returns the current window size or 1 if windowing is disabled.

Specified by:
getWindowSize in interface WindowingService

setWindowSize

public void setWindowSize(int windowSize)
Description copied from interface: WindowingService
Set the window size for this service. To disable windowing, set the window size to 1. The window size can only be changed if the SmsService is not currently connected to the SMSC.

Specified by:
setWindowSize in interface WindowingService
Parameters:
windowSize - the window size

getNumberOfPendingMessages

public int getNumberOfPendingMessages()
Description copied from interface: WindowingService
Returns the number of pending (unprocessed messages). You may use this method to check if all outgoing messages have been acknowledged by the SMSC prior to calling disconnect() on the SmsService.

Specified by:
getNumberOfPendingMessages in interface WindowingService

query

public void query(Message msg)
           throws java.lang.UnsupportedOperationException,
                  java.lang.IllegalStateException,
                  java.lang.IllegalArgumentException,
                  MessageException
Description copied from interface: SmsService
Query the status of a previously submitted message. The status of the message will be delivered asynchronously using a MessageEvent of type STATUS_RECEIVED.

Specified by:
query in interface SmsService
Parameters:
msg - the previously submitted message.
Throws:
MessageException - if querying the status failed.
java.lang.IllegalStateException - if the service is not initialized or not connected to the SMSC.
java.lang.UnsupportedOperationException - if the service does not support canceling messages.
java.lang.IllegalArgumentException - if the message is null or doesn't contain the information required for querying the message status (e.g. missing message ID).

cancel

public void cancel(Message msg)
            throws java.lang.UnsupportedOperationException,
                   java.lang.IllegalStateException,
                   java.lang.IllegalArgumentException,
                   MessageException
Description copied from interface: SmsService
Cancel a previously submitted message. The message can only be cancelled if it has not yet been delivered to the recipient. For messages requesting a status report, a MessageEvent of type STATUS_RECEIVED will be generated upon cancellation of the message.

Specified by:
cancel in interface SmsService
Parameters:
msg - The previously sent message
Throws:
java.lang.IllegalArgumentException - if the message is null or doesn't contain the information required for cancelling the message (e.g. missing message ID).
java.lang.UnsupportedOperationException - if the service does not support canceling messages.
java.lang.IllegalStateException - if the service is not initialized or not connected to the SMSC.
MessageException - if cancellation failed.

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-2007. All rights reserved object XP