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.
Handling incoming SMS datagrams
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.
Handling incoming WAP Push messages
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
Built-in OTA message types
Qt Extended provides built-in support for:
- OTA network configuration messages with the MIME type application/vnd.wap.connectivity-wbxml which are handled by netsetup program. This is described in the WAP/OMA standards:
- wap-183-provcont-20010724-a.pdf and
- OMA-WAP-ProvCont-V1_1-20021112-C.pdf
at Open Mobile Alliance
- Network Configuration Messages, with MIME type application/x-wap-prov.browser-settings which are handled by netsetup program. This is described in the: Nokia Over The Air Settings Specification 7.0.
- MMS notifications that are sent via SMS and are handled by qtmail. These notifications have the MIME type application/vnd.wap.mms-message. This is described in the WAP/OMA standard : oma-wap-mms-enc-v1_1-20021030-c.pdf.
- Vcard messages are handled by addressbook. The WAP push type text/x-vcard and the two SMS datagram port numbers 226 and 9204 are supported for receiving vcards.
Other OTA messages are handled on a type-by-type basis by vendor-supplied applications, via the Qt Extended Data Sharing (QDS) system.