This is the optimized implementation for WMA 2.0, which provides classes that allow Java applications to access SMS functionality on a mobile device.

The classes in this package support the sending and receiving of SMS messages. The classes in this package, {@link com.sun.midp.io.j2me.sms.Protocol Protocol}, {@link com.sun.midp.io.j2me.sms.MessageObject MessageObject}, {@link com.sun.midp.io.j2me.sms.TextObject TextObject}, {@link com.sun.midp.io.j2me.sms.BinaryObject BinaryObject} and {@link com.sun.midp.io.j2me.sms.TextEncoder TextEncoder} define this implementation. `MessageObject` defines the implementation of the SMS message. `TextObject` and `BinaryObject` extend `MessageObject` and represent the two possible types of SMS messages. Text messages can be enocded as GSM 7-bit text or UCS2 characters. The `TextEncoder` class provides an encoder and decoder for these two types of encodings. `Protocol` defines the implementation of the SMS message connection. `Protocol` interfaces with the platform provided SMS services. It makes native calls to open, close and send messages. This connection is to a low-level transport mechanism which can be any of the following:

- a datagram short message peer-to-peer (SMPP) protocol to a service center to satisfy a network-based solution
- a `comm` connection to a mobile device that understands AT-commands
- a native SMS stack for proprietary implementations
- a loop back implementation; that is, anything that is sent will be automatically received. This implementation is provided for testing purposes.

### Connection and Message Lifecycle

Connections can be made in server mode or in client mode. In server mode, messages can be sent or received. In client mode, messages can be sent only. Applications can treat sending and receiving independently.

To receive messages, the application can open the connection by passing a string containing a local port to the `Connector.open` method. A `MessageConnection` object is returned, on which the message can be received. If there are no messages in the queue, the `receive()` method will block until one arrives. When a message has been received, methods are available in the `MessageObject` class for retrieving its address and data parts. Calling the `close()` method closes the connection.

To send messages, the application will either obtain an existing `Message` object or use the `newMessage` factory method to create one. If the application creates a `Message` object, methods are available in the `MessageObject` class for setting its address and data parts. The application can open a connection by passing a string containing a fully-qualified SMS URL address (phone number and port number) to the `Connector.open` method. A `MessageConnection` object is returned, on which the message can be sent. Calling the `close()` method closes the connection.

## Package Specification

The classes in this package need access to classes in the optional `javax.microedition.io` package, the CLDC implementation (`com.sun.cldc.*`), and the MIDP implementation (`com.sun.midp.*`).

This package is also dependent on `javax.microedition.io` for the definition of `Connector.open` (the CLDC-definition of the Generic Connection Framework).

@since WMA 1.0