Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded

SMSMessage Class Reference

Class that represents the contents of an SMS message. More...

#include <smsmessage.h>

List of all member functions.

Public Members

Protected Members


Detailed Description

Class that represents the contents of an SMS message.

See also Qtopia Phone Classes.


Member Function Documentation

SMSMessage::SMSMessage ()

Constructs an empty SMSMessage.

SMSMessage::SMSMessage ( const SMSMessage & msg )

Constructs an SMSMessage that is a copy of msg.

SMSMessage::SMSMessage ( const QString & recipient, const QString & txt, bool replyRequest = FALSE )

Construct a simple text-based SMSMessage for recipient. The text body will be set to txt. If replyRequest is TRUE, then the message will be marked as needing a reply from the recipient.

SMSMessage::~SMSMessage ()

Destructs the SMSMessage.

void SMSMessage::addPart ( const SMSMessagePart & part )

Add a new body part to this SMS message.

void SMSMessage::addParts ( const QValueList<SMSMessagePart> & parts )

Add a list of body parts to this SMS message.

QByteArray SMSMessage::applicationData () const

Get the data if this SMS message contains an application datagram. Returns an empty byte array if this message is not a datagram.

SMSDataCodingScheme SMSMessage::bestScheme () const

Determine the best SMS data coding scheme to use for this message by inspecting the plain text body parts.

void SMSMessage::clearParts ()

Clear all body parts from this SMS message.

void SMSMessage::computeSize ( uint & numMessages, uint & spaceLeftInLast ) const

Compute an estimate for the number of messages that will need to be used to send this SMS message, and the number of spare characters that are left in the last message before it overflows.

This function may be useful in user interfaces to indicate to the user that an SMS message needs to be sent in multiple pieces, costing the user more money.

int SMSMessage::destinationPort () const

Get the destination port number if this SMS message contains an application datagram, or -1 if not an application datagram.

When an SMS message is received that has a destination port number, Qtopia will attempt to find a service that can handle it. Qtopia first looks for a service named Push/T where T is the MIME type from the WAP push header. Next, it looks for a service named smsapp/N where N is the port number in decimal.

If a matching service is found, then the SMS message is sent to the corresponding application via QCop. The QCop message is smsApplicationDatagram(SMSMessage), sent on the application's primary QCop channel. Thus, applications can register to receive special SMS messages.

If the application fails to process an SMS message that is sent to it via QCop, then it will be lost. It is important that such applications take steps to save the message if necessary.

If a matching service is not found, then the SMS message will be delivered to the qtmail application normally, and then saved by that application.

bool SMSMessage::forceGsm () const

Returns TRUE if the 7-bit GSM encoding has been forced.

uint SMSMessage::gsmValidityPeriod () const

Get the GSM validity period value, between 0 and 255, inclusive.

const QByteArray & SMSMessage::headers () const

Get the SMS message's user data headers.

MessageType SMSMessage::messageType () const

Get the SMS message type.

SMSMessage & SMSMessage::operator= ( const SMSMessage & msg )

Assigns a copy of msg to this object.

QValueList<SMSMessagePart> SMSMessage::parts () const

Get a list of all body parts in this SMS message.

QString SMSMessage::recipient () const

Returns the recipient's telephone number. Normally QString::null for an incoming message.

bool SMSMessage::replyRequest () const

Returns the "reply request" flag.

QString SMSMessage::sender () const

Returns the sender's telephone number. Normally QString::null for an outgoing message.

QString SMSMessage::serviceCenter () const

Returns the service center.

void SMSMessage::setApplicationData ( const QByteArray & value )

Set the data within an SMS message that contains an application datagram.

void SMSMessage::setBestScheme ( SMSDataCodingScheme scheme )

Set the SMS data coding scheme to use for this message. Normally you won't need to call this unless the user has somehow explicitly requested an override. By default, the SMSMessage class will choose the best scheme for you. Should be set to one of SMS_DefaultAlphabet, SMS_8BitAlphabet, or SMS_UCS2Alphabet.

void SMSMessage::setDestinationPort ( int value )

Set the destination port number for an SMS message that contains an application datagram.

void SMSMessage::setForceGsm ( bool force )

If force is TRUE, then the codec set by SMSMessage::setTextCodec is ignored and the 7-bit GSM encoding is always used. Setting this flag increases the number of characters that can be sent in any given SMS message, but may lose information.

void SMSMessage::setGsmValidityPeriod ( uint value )

Set the GSM validity period to value, which must be between 0 and 255, inclusive. The SMSMessage::setValidity method is a friendlier way to set the validity value.

0 to 143 indicates 0 to 12 hours in 5 minute increments (0 = 5 minutes). 144 to 167 indicates 12 hrs 30 min to 24 hrs in 30 minute increments. 168 to 196 indicates 2 days to 30 days in 1 day increments. 197 to 255 indicates 5 weeks to 63 weeks in 1 week increments.

void SMSMessage::setHeaders ( const QByteArray & value )

Set the SMS message's user data headers.

void SMSMessage::setMessageType ( MessageType m ) [protected]

Set the SMS message type. There is rarely any need to set this to something othe than SMSMessage::Normal.

void SMSMessage::setRecipient ( const QString & txt )

Set the recipient's telephone number.

void SMSMessage::setReplyRequest ( bool on )

Enable or disable the "reply request" flag for this SMS message.

void SMSMessage::setSender ( const QString & txt )

Set the sender's telephone number.

void SMSMessage::setServiceCenter ( const QString & str )

Set the service center to use for transmitting this SMS message, or QString::null for the default service center.

void SMSMessage::setSourcePort ( int value )

Set the source port number for an SMS message that contains an application datagram.

void SMSMessage::setText ( const QString & str )

Set the contents of this SMSMessage to a single plain text body containing str. This is for simple messages only. Complex messages should be constructed part by part using the SMSMessage::addPart method.

void SMSMessage::setTextCodec ( QTextCodec * codec )

If the message consists solely of characters in the 7-bit GSM encoding, then the message will be transmitted that way. Otherwise codec is used to convert the characters into an appropriate language-specific 8-bit encoding. If codec is set to NULL, then the default UCS-2 encoding for GSM messages is used.

void SMSMessage::setTimestamp ( const QDateTime & timestamp )

Set the SMS message's timestamp.

void SMSMessage::setValidityPeriod ( uint minutes )

Set the validity period to minutes. The default is 2 days.

int SMSMessage::sourcePort () const

Get the destination port number if this SMS message contains an application datagram, or -1 if not an application datagram.

QString SMSMessage::text () const

Get the contents of this SMSMessage a single plain text string. If the message contains binary parts, they will not appear in the result. This is for simple message viewers only. Complex message viewers should iterate over the list returned by SMSMessage::parts.

QTextCodec * SMSMessage::textCodec () const

Returns the current 8-bit text codec, or NULL if none has been set.

QDateTime SMSMessage::timestamp () const

Get the SMS message's timestamp, which will be null if the message does not have a timestamp.

uint SMSMessage::validityPeriod () const

Get the validity period in minutes for this message.

This file is part of the Qtopia platform, copyright © 1995-2005 Trolltech, all rights reserved.


Copyright © 2005 Trolltech Trademarks
Qtopia version 2.1.2