Detailed Description
The QSMSReader class provides access to the incoming SMS message store on the modem device.
The modem scans for new messages at start up and whenever a new message indication is received from the modem. It will then update unreadCount(), unreadList(), usedMessages(), and totalMessages() to indicate the current state of the incoming SMS message store.
The messageCount() signal is emitted when these values change, especially for new messages. The unreadCountChanged() signal will be emitted whenever the number of unread messages changes, which could be when a new message arrives, or when the count is reset with setUnreadCount().
SMS reading applications, such as qtmail, access the message store by calling check(). The QSMSReader class will respond with a messageCount() signal once the store is ready to be read. The SMS reading application then calls firstMessage() to fetch the first message in the store. The QSMSReader class will respond with a fetched() signal containing the message. If the id parameter of fetched() is empty, then the list has terminated. Otherwise, the SMS reading application can call nextMessage() to read the next message; and so on.
The deleteMessage() function can be used to delete a message from the incoming SMS message store.
The setUnreadCount() function is used by the qpe server to reset unreadCount() after power up to the state it had before shutdown. It is also used by SMS reading applications like qtmail to reset the count to zero once all new messages have been processed.
Some special SMS messages are not delivered via QSMSReader. These are WAP push messages and SMS datagrams that are dispatched as soon as they arrive. See QSMSMessage::destinationPort() for more information on how these types of messages are dispatched.
See also QSMSMessage.
Member Function Documentation
QSMSReader::QSMSReader ( const QString & service = QString(), QObject * parent = 0, QCommInterface::Mode mode = Client )
Construct a new SMS request object for service and attach it to parent. The object will be created in client mode if mode is Client, or server mode otherwise.
If service is empty, this class will use the first available service that supports SMS requests. If there is more than one service that supports network registration, the caller should enumerate them with QCommServiceManager::supports() and create separate QSMSReader objects for each.
See also QCommServiceManager::supports().
QSMSReader::~QSMSReader ()
Destroy this SMS request object.
void QSMSReader::check () [virtual slot]
Fetch the total number of messages in the incoming SMS buffer. The number is returned via the messageCount() signal.
See also messageCount() and firstMessage().
void QSMSReader::deleteMessage ( const QString & id ) [virtual slot]
Delete the message with the identifier id from the incoming SMS buffer.
void QSMSReader::fetched ( const QString & id, const QSMSMessage & m ) [signal]
Signal that is emitted when a message in the incoming SMS buffer of is fetched. id will be zero-length if there are no remaining messages in the buffer to be fetched. Otherwise, the message content is in m.
See also firstMessage() and nextMessage().
void QSMSReader::firstMessage () [virtual slot]
Fetch the first message in the incoming SMS buffer. Note: only one application (usually the mail application) should ever call this method and nextMessage().
See also nextMessage().
void QSMSReader::messageCount ( int total ) [signal]
Signal that is emitted when either a new SMS message arrives, the total count is explicitly fetched using check(), or a message is deleted using deleteMessage().
See also check() and deleteMessage().
void QSMSReader::nextMessage () [virtual slot]
Fetch the next message in the incoming SMS buffer.
See also firstMessage().
bool QSMSReader::ready () const
Returns true if the SMS reader is ready to access the SIM; otherwise returns false.
See also setReady() and readyChanged().
void QSMSReader::readyChanged () [signal]
Signal that is emitted whenever ready() changes state.
See also ready() and setReady().
void QSMSReader::setReady ( bool value ) [protected]
Sets the ready() state to value and emit the readyChanged() signal.
See also ready() and readyChanged().
void QSMSReader::setUnreadCount ( int value ) [virtual slot]
Sets the number of unread messages to value.
See also unreadCount(), unreadList(), and unreadCountChanged().
int QSMSReader::totalMessages () const
Returns the total number of messages that could be stored on the SIM if all slots were in use. If usedMessages() and totalMessages() are the same, then the SIM is full. Returns -1 if the value is not currently known because the incoming message store has not yet been scanned.
See also usedMessages() and messageCount().
int QSMSReader::unreadCount () const
Returns the number of messages that have not yet been read by the user. This value will gradually increase as new messages arrive until reset by a call to setUnreadCount().
See also unreadList(), setUnreadCount(), and unreadCountChanged().
void QSMSReader::unreadCountChanged () [signal]
Signal that is emitted when unreadCount() changes.
See also unreadCount(), unreadList(), and setUnreadCount().
QStringList QSMSReader::unreadList () const
Returns a list of message identifiers for messages that are new and unread since the last time firstMessage() was called. This list will reset to empty when firstMessage() is called. The list will be ordered roughly in the order in which the messages arrived.
See also unreadCount(), setUnreadCount(), and unreadCountChanged().
int QSMSReader::usedMessages () const
Returns the number of messages that are currently stored on the SIM. Note that this may be greater than the value returned by the messageCount() signal. The messageCount() signal reports the value after multi-part messages have been combined. The unreadMessages() function returns the value before multi-part messages have been combined. Returns -1 if the value is not currently known because the incoming message store has not yet been scanned.
See also totalMessages() and messageCount().