Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
Qt Extended provides support for Over-The-Air (OTA) messages that arrive via SMS. Both SMS datagrams, based on a port number, and WAP Push messages are supported.
Qt Extended monitors the incoming SMS message store for SMS datagrams and WAP Push messages. When such a message is encountered, Qt Extended will look for an application using Qt Extended Data Sharing (QDS) that can handle the message. If an application is found, the message is removed from the incoming SMS message store and passed to that application.
SMS datagrams arrive associated with a port number. This port number can be supplied to Qt Extended Data Sharing (QDS) to dispatch the datagram to the application that wishes to handle it.
For example, vcard messages on port 226 are handled by a QDS service called push with the MIME type application/x-smsapp-226. When such an SMS message arrives, Qt Extended will look up the associated application and forward it on.
For example, if we wanted vcard messages to be processed by the ContactsPhone service, we would place a file such as the following in the etc/qds directory:
[Translation] File=QtopiaServices Context=ContactsPhone [pushVCard] RequestDataType=application/x-smsapp-226 ResponseDataType= Attributes="push" Description[]=Receive a vcard via SMS push on port 226
We also need to place a file called ContactsPhone.service in the services directory with the following contents:
[Translation] File=QtopiaServices Context=ContactsPhone [Service] Actions = "smsBusinessCard();pushVCard(QDSActionRequest)" Icon = service/Contacts/AddressBook Name[]=Contacts [smsBusinessCard()] Icon = phone/sms Name[]=SMS Business Card
When the message arrives, the QCop message pushVCard(QDSActionRequest) will be sent to the ContactsPhone service, with the vcard data as the payload within the QDSActionRequest object.
The QDSActionRequest::auxiliaryData() will contain the complete SMS message, including headers. Normally this auxiliary data can be ignored, but some applications may need to know the sender's phone number, or other information. The following code demonstrates how to do this:
QString extractSender(const QDSActionRequest& request) { QByteArray auxData = request.auxillaryData(); if (auxData.isEmpty()) return QString(); QDataStream stream(auxData); QSMSMessage msg; stream >> msg; return msg.sender(); }
If the OTA message consists of several parts, the parts will be concatenated before the message is delivered to the application.
See the documentation of QSMSMessage::destinationPort() for more information.
WAP Push messages are handled in a similar fashion. The difference being the MIME type in the QDS definition:
[Translation] File=QtopiaServices Context=ContactsPhone [pushVCard] RequestDataType=text/x-vcard ResponseDataType= Attributes="push" Description[]=Receive a vcard via WAP push
Several SMS datagram and WAP Push types can be registered in the same QDS definition. The following example registers SMS datagram ports 226 and 9204, together with the WAP Push MIME type text/x-vcard, and sends them all to the ContactsPhone service.
[Translation] File=QtopiaServices Context=ContactsPhone [QDSInformation] Name[]=SMS VCard [pushVCard] RequestDataType="text/x-vcard;application/x-smsapp-226;application/x-smsapp-9204" ResponseDataType= Attributes="push" Description[]=Receive a vcard via WAP push or SMS
Qt Extended provides built-in support for:
Other OTA messages are handled on a type-by-type basis by vendor-supplied applications, via the Qt Extended Data Sharing (QDS) system.
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |