Experts in SMS and MMS Technology. NCLs Provato is an SMS/MMS Gateway supporting  WAP Push, EMS, MMS, SMS, Nokia Smart Messaging, SMPP, CIMD, UCP, MM7, M20, TC35 NCL Technologies Ltd
Provato - SMS MMS Gateway
Mobile Messaging in J2EE & .NET

SwiftNote - Java SMS Toolkit

ie.ncl.sms.modem
Class UssdModem

java.lang.Object
  extended by ie.ncl.msg.impl.SimpleConnection
      extended by ie.ncl.sms.modem.GsmModem
          extended by ie.ncl.sms.modem.UssdModem
All Implemented Interfaces:
AttributeNames, Connection, Receiver, ReceiverListener, Sender, MessageAttributeNames, java.lang.Runnable

public class UssdModem
extends GsmModem
implements ReceiverListener


Nested Class Summary
 class UssdModem.UssdMessage
           
 
Field Summary
 ReceiverListener applicationLayerReceiver
           
 
Fields inherited from class ie.ncl.sms.modem.GsmModem
INIT_TIMER, resetTimeout, RESPONSE_TIMEOUT, SEND_RESPONSE_TIMEOUT, SIGNAL_STRENGTH_MAX, SIGNAL_STRENGTH_MIN, SIGNAL_STRENGTH_UNKNOWN, staticLog, USSD_RESPONSE_CODE_ATTRIBUTE, USSD_RESPONSE_DCS_ATTRIBUTE, USSD_RESPONSE_MMI_ATTRIBUTE
 
Fields inherited from interface ie.ncl.msg.Connection
CONNECTED, NOT_CONNECTED, NOT_USED, RECONNECTING
 
Fields inherited from interface ie.ncl.sms.MessageAttributeNames
CC, DCS, EOT_GSM_ESCAPE_CHARACTER, NATIONAL_LANGUAGE, PID, PRIORITY, RECEIPT, RECEIPT_BYTES, RECEIPT_STATUS, RECEIPT_TEXT, REGISTERED, REPLACE, REPLY_PATH, SCA, SCHEDULE, SUBMIT_ERROR, TIMESTAMP, UDH, UDHI, VALIDITY
 
Constructor Summary
UssdModem()
           
UssdModem(java.lang.String pin, java.lang.String comPortDevice, java.lang.String baudSpeed)
           
 
Method Summary
 void close()
          Close down the connection with the GsmModem device.
 void connect()
          Connect with the device.
 java.lang.String getConnectionErrorMatch()
           
 java.lang.String getFailMatch()
           
 long getNextMessageId()
           
 java.lang.String getSuccessMatch()
           
 long getUssdResponseTimeout()
           
 void init(java.util.Properties props)
          Initialise the object with settings specified in the properties.
 java.lang.String nullIfEmpty(java.lang.String s)
           
 boolean received(Receiver receiver, java.lang.Exception ex, Message m)
          This method will be called when a message is received.
 void send(Message message, SenderListener listener)
          Send a message asynchronously.
 java.lang.String sendRequest(java.lang.String ussdRequest)
           
 java.lang.String sendUssdRequest(Message original)
           
 void setConnectionErrorMatch(java.lang.String connectionErrorMatch)
           
 void setFailMatch(java.lang.String failMatch)
           
 void setReceiverListener(ReceiverListener listener)
          Receive messages asynchronously.
 void setSuccessMatch(java.lang.String successMatch)
           
 void setUssdResponseTimeout(long ussdResponseTimeout)
           
 void shutdown()
          Shutdown the connection.
 
Methods inherited from class ie.ncl.sms.modem.GsmModem
acknowledge, clean, constructPDU, constructSmsDeliver, constructSmsSubmit, constructTpud, detect, enableDeliveryReporting, find, getConfiguration, getDefault, getDefaultToGsmAlphabet, getIMEI, getLoopbackAllowed, getMake, getMakeModel, getModel, getOwnNumber, getSendRetries, getSendRetryPause, getSignalStrength, getSignalStrengthThreshold, getVersion, isMakeModel, isUssdRequest, isUssdResponse, main, receive, run, setDebugMode, setDefault, setDefaultToGsmAlphabet, setGPRS, setLoopbackAllowed, setOwnNumber, setSendRetries, setSendRetryPause, setSignalStrengthThreshold, setSmsc
 
Methods inherited from class ie.ncl.msg.impl.SimpleConnection
connected, getConnectionStatus, getErrorListener, getName, getTypeDefaults, init, mergeDefaultAttributes, putTypeDefaults, setErrorListener, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ie.ncl.msg.Connection
connected, getConnectionStatus, getTypeDefaults, init, putTypeDefaults, setErrorListener
 

Field Detail

applicationLayerReceiver

public ReceiverListener applicationLayerReceiver
Constructor Detail

UssdModem

public UssdModem(java.lang.String pin,
                 java.lang.String comPortDevice,
                 java.lang.String baudSpeed)
          throws java.io.IOException,
                 GsmModemException,
                 ConnectionException
Throws:
java.io.IOException
GsmModemException
ConnectionException

UssdModem

public UssdModem()
Method Detail

getSuccessMatch

public java.lang.String getSuccessMatch()

setSuccessMatch

public void setSuccessMatch(java.lang.String successMatch)

getFailMatch

public java.lang.String getFailMatch()

setFailMatch

public void setFailMatch(java.lang.String failMatch)

getConnectionErrorMatch

public java.lang.String getConnectionErrorMatch()

setConnectionErrorMatch

public void setConnectionErrorMatch(java.lang.String connectionErrorMatch)

getUssdResponseTimeout

public long getUssdResponseTimeout()

setUssdResponseTimeout

public void setUssdResponseTimeout(long ussdResponseTimeout)

getNextMessageId

public long getNextMessageId()

nullIfEmpty

public java.lang.String nullIfEmpty(java.lang.String s)

init

public void init(java.util.Properties props)
          throws ConnectionException
Description copied from interface: Connection
Initialise the object with settings specified in the properties. The properties will be implementation specific.

Specified by:
init in interface Connection
Overrides:
init in class GsmModem
Throws:
ConnectionException

sendRequest

public java.lang.String sendRequest(java.lang.String ussdRequest)
                             throws MessageException,
                                    ConnectionException
Throws:
MessageException
ConnectionException

sendUssdRequest

public java.lang.String sendUssdRequest(Message original)
                                 throws MessageException,
                                        ConnectionException
Throws:
MessageException
ConnectionException

connect

public void connect()
             throws ConnectionException
Description copied from class: GsmModem
Connect with the device.

Specified by:
connect in interface Connection
Overrides:
connect in class GsmModem
Throws:
ConnectionException

send

public void send(Message message,
                 SenderListener listener)
          throws MessageException,
                 ConnectionException
Description copied from class: GsmModem
Send a message asynchronously.

Specified by:
send in interface Sender
Overrides:
send in class GsmModem
Throws:
MessageException
ConnectionException
See Also:
SenderListener, Message

setReceiverListener

public void setReceiverListener(ReceiverListener listener)
                         throws ConnectionException
Description copied from class: GsmModem
Receive messages asynchronously.

Specified by:
setReceiverListener in interface Receiver
Overrides:
setReceiverListener in class GsmModem
Throws:
ConnectionException
See Also:
Message

received

public boolean received(Receiver receiver,
                        java.lang.Exception ex,
                        Message m)
Description copied from interface: ReceiverListener
This method will be called when a message is received. The application should return true to acknowledge the message.

Returning false (or throwing an runtime exception) will result in the message being unacknowledged and therefore undelivered as far as the underlying connection is concerned. As such, the message may be redelivered at a later time.

If an error occurs receiving a message then the exception will be non-null and the message may be incomplete or even null.

Callbacks are setup in implementations of the Receiver interface.

Specified by:
received in interface ReceiverListener
Returns:
true to indicate the message was received successfully, false otherwise
See Also:
Receiver, Receiver.receive(ReceiverListener)

close

public void close()
Description copied from class: GsmModem
Close down the connection with the GsmModem device.

Specified by:
close in interface Connection
Overrides:
close in class GsmModem

shutdown

public void shutdown()
Description copied from interface: Connection
Shutdown the connection. This is used to shutdown a connection ungracefully.

Specified by:
shutdown in interface Connection
Overrides:
shutdown in class GsmModem

Experts in SMS and MMS Technology. NCLs Provato is an SMS/MMS Gateway supporting  WAP Push, EMS, MMS, SMS, Nokia Smart Messaging, SMPP, CIMD, UCP, MM7, M20, TC35 NCL Technologies Ltd
Provato - SMS MMS Gateway
Mobile Messaging in J2EE & .NET

SwiftNote - Java SMS Toolkit