| java.lang.Object com.sun.tck.wma.PropLoader com.sun.tck.wma.sms.SMSMessageConnection
Field Summary | |
byte[] | buf Datagram buffer. | protected String | clientHost Datagram host for sending/receiving. | DatagramSocket | dgc Datagram server connection. | int | fragmentsize Fragment size for large messages. | protected String | host Machine name - the parsed target address from the URL. | DatagramPacket | mess Datagram envelope for sending or receiving messages. | protected boolean | open Open flag indicates when the connection is closed. | protected String | phoneNumber Phone number of the message sender. | protected String | port Port number from the URL connection string. | protected int | portIn Datagram transport for receiving. | protected int | portOut Datagram transport for sending. |
Method Summary | |
public void | close() Closes the connection. | public Message | newMessage(String type) Constructs a new message object of a text or binary type.
When the TEXT_MESSAGE constant is passed in, the created
object implements the TextMessage interface. | public Message | newMessage(String type, String addr) Constructs a new message object of a text or binary type and specifies
a destination address.
When the
TEXT_MESSAGE constant is passed in, the created
object implements the TextMessage interface.
When the BINARY_MESSAGE constant is passed in, the
created object implements the BinaryMessage
interface. | public MessageConnection | openPrim(String name) Opens a connection.
This method is called from Connector.open() method to obtain
the destination address given in the name parameter.
The format for the name string for this method is:
sms://phone_number:port
where the phone_number: is optional. | public synchronized Message | receive() Receives the bytes that have been sent over the connection, constructs a
Message object, and returns it. | public void | send(Message dmsg) Sends a message over the connection. |
buf | byte[] buf(Code) | | Datagram buffer.
|
clientHost | protected String clientHost(Code) | | Datagram host for sending/receiving.
|
fragmentsize | int fragmentsize(Code) | | Fragment size for large messages.
|
host | protected String host(Code) | | Machine name - the parsed target address from the URL.
|
open | protected boolean open(Code) | | Open flag indicates when the connection is closed. When a connection is
closed, subsequent operations throw an exception.
|
phoneNumber | protected String phoneNumber(Code) | | Phone number of the message sender.
|
port | protected String port(Code) | | Port number from the URL connection string.
|
portIn | protected int portIn(Code) | | Datagram transport for receiving.
|
portOut | protected int portOut(Code) | | Datagram transport for sending.
|
SMSMessageConnection | public SMSMessageConnection()(Code) | | Constructor for SMS message connection handling.
|
close | public void close() throws IOException(Code) | | Closes the connection. Reset the connection is open flag
so methods can be checked to throws an appropriate exception
for operations on a closed connection.
exception: IOException - if an I/O error occurs. |
newMessage | public Message newMessage(String type)(Code) | | Constructs a new message object of a text or binary type.
When the TEXT_MESSAGE constant is passed in, the created
object implements the TextMessage interface. When the
BINARY_MESSAGE constant is passed in, the created object
implements the BinaryMessage interface.
If this method is called in a sending mode, a new Message
object is requested from the connection. For example:
Message msg = conn.newMessage(TEXT_MESSAGE);
The newly created Message does not have the destination
address set. It must be set by the application before the message is
sent.
If it is called in receiving mode, the Message object does
have its address set. The application can act on the object to extract
the address and message data.
Parameters: type - either TEXT_MESSAGE or BINARY_MESSAGE. a new message |
newMessage | public Message newMessage(String type, String addr)(Code) | | Constructs a new message object of a text or binary type and specifies
a destination address.
When the
TEXT_MESSAGE constant is passed in, the created
object implements the TextMessage interface.
When the BINARY_MESSAGE constant is passed in, the
created object implements the BinaryMessage
interface.
The destination address addr has the following format:
sms:// phone_number:port.
Parameters: type - either TEXT_MESSAGE or BINARY_MESSAGE. Parameters: addr - the destination address of the message. a new Message object. |
openPrim | public MessageConnection openPrim(String name) throws IOException(Code) | | Opens a connection.
This method is called from Connector.open() method to obtain
the destination address given in the name parameter.
The format for the name string for this method is:
sms://phone_number:port
where the phone_number: is optional. If the
phone_number parameter is present, the connection is being
opened in "client" mode. This means that messages can be sent. If the
parameter is absent, the connection is being opened in "server" mode.
This means that messages can be sent and received.
The connection that is opened is to a low-level transport mechanism which
can be any of the following:
- A datagram Short Message Peer to Peer (SMPP) to a service
center.
- A
comm connection to a phone device with AT-commands.
Parameters: name - the target of the connection this connection throws: IOException - if the connection is closed or unavailable. |
receive | public synchronized Message receive() throws IOException(Code) | | Receives the bytes that have been sent over the connection, constructs a
Message object, and returns it.
If there are no Message s waiting on the connection, this
method will block until a message is received, or the
MessageConnection is closed.
a Message object exception: IOException - if an I/O error occurs. |
send | public void send(Message dmsg) throws IOException(Code) | | Sends a message over the connection. This method extracts
the data payload from
the Message object so that it
can be sent as a datagram.
Parameters: dmsg - a Message object. exception: ConnectionNotFoundException - if the address is invalid or if no address is found in the message. exception: IOException - if an I/O error occurs. |
|
|