org.mgif.connectivity.async
Interface TextMessage

All Superinterfaces:
Attributes, Datagram, Message

public interface TextMessage
extends Message

An interface representing a text message. This is a subinterface of Message which contains methods to get and set the text payload. The setText method sets the value of the payload in the data container without any checking whether the value is valid in any way. Methods for manipulating the address portion of the message are inherited from Message.

Text messages using this interface deal with Strings encoded in Java. The underlying implementation will convert the Strings into a suitable encoding for the messaging protocol in question. Different protocols recognize different character sets. To ensure that characters are transmitted correctly across the network, an application should use the character set(s) recognized by the protocol. If an application is unaware of the protocol, or uses a character set that the protocol does not recognize, then some characters might be transmitted incorrectly.

The following encoding rules should be used with the GSM protocol. The 7-bit alphabet MUST be used for encoding if the String that is given by the application only contains characters that are present in the GSM 7-bit alphabet. If the String given by the application contains at least one character that is not present in the GSM 7-bit alphabet, the UCS-2 encoding MUST be used.

The messages that the application sends can be too long to fit in a single protocol message. In this case, the implementation MUST use the concatenation feature if that is possible with the corresponding protocol or split the message payload into multiple protocol messages. Similarly, when receiving messages, the implementation MUST automatically concatenate the received protocol messages and pass the fully reassembled payload to the application if that is possible with the corresponding protocol.

Implementations MUST support at least 3 SMS protocol messages to be received and concatenated together. Similarly, for sending, messages that can be sent with up to 3 SMS protocol messages MUST be supported. Depending on the implementation, these limits may be higher. However, applications are advised not to send messages that will take up more than 3 SMS protocol messages, unless they have reason to assume that the recipient will be able to handle a larger number. The Message.numberOfSegments method allows the application to check how many SMS protocol messages a given message will use when sent.

See Also:
Message.numberOfSegments(), MGIF

Method Summary
 TextMessage getReplyMessage()
          Returns a reply message for sending a message back to the originator of this message.
 java.lang.String getText()
          Returns the message payload data as a String.
 void setText(java.lang.String text)
          Sets the payload data of this message.
 
Methods inherited from interface org.mgif.connectivity.async.Message
getDeliveryNotification, getExpiration, getMessageId, getTimestamp, numberOfSegments, send, setDeliveryNotification, setExpiration
 
Methods inherited from interface org.mgif.connectivity.transfer.Datagram
getLocale, getLocales, getProtocol, getScheme, getTerminalId
 
Methods inherited from interface org.mgif.connectivity.transfer.Attributes
getAttribute, getAttributeNames, getAttributes, isAttribute, removeAttribute, setAttribute
 

Method Detail

getReplyMessage

public TextMessage getReplyMessage()
Returns a reply message for sending a message back to the originator of this message.
Returns:
reply message or null if the message cannot be replied to

getText

public java.lang.String getText()
Returns the message payload data as a String.
Returns:
the payload of this message, or null if the payload for the message is not set.

setText

public void setText(java.lang.String text)
Sets the payload data of this message. The payload data may be null.
Parameters:
text - payload data as a String


Copyright © 2002 Mobile Games Interoperability Forum. All rights reserved.
This source code is protected by the legal notice posted at http://www.mgif.org/docs/notice.html