Home · All Classes · Grouped Classes · Annotated · Functions

Services

Introduction

Application Services are standardized APIs to access functionality supplied by other applications. They allow applications to invoke the services of other applications, while allowing the specific application providing the service to be selected by the system integrator or end-user. Messages between applications are delivered via Qtopia IPC.

Pre-defined Services

The following provides a list of the pre-defined services:

Available Services

Alarm ContactsPhone OmaDrmAgent Suspend
AlarmServer ContentSetView PackageManager SystemMessages
Alert Date PhotoEdit TaskManager
BluetoothPush Dialer PrintServer Tasks
Calendar Email Profiles Telephony
CallForwarding Help QtopiaApplicationService Time
CallHistory InfraredBeaming QtopiaPowerManager TimeMonitor
CallNetworks InputMethod Ringtone TimeUpdate
Camera Messages Settings VirtualKeyboard
Clock ModemEmulator SettingsManager VoiceRecording
Contacts NetworkSetup SMS WebAccess

Requesting Services

To request a service, the calling application executes:

    QtopiaServiceRequest srv(servicename, action);
    srv << parameters;
    srv.send();

For example:

    QtopiaServiceRequest srv("WebAccess", "openURL(QString)");
    srv << QString("www.trolltech.com");
    srv.send();

QtopiaServiceRequest::send() returns a boolean value indicating whether the service is available. The next image demonstrates the service interaction, assuming that the qtmail application is requesting the WebAccess service:

"Qtopia Service execution"

Responding to Service Requests

To respond to a service request, an application should use the QtopiaAbstractService class. The following example responds to the openURL(QString) request on the WebAccess service. It would typically be implemented by a Web browser application:

    class WebAccessService : public QtopiaAbstractService
    {
        Q_OBJECT
    public:
        WebAccessService( QObject *parent )
            : QtopiaAbstractService( "WebAccess", parent )
            { publishAll(); }

    public slots:
        void openURL( const QString& url );
    };

When an openURL(QString) request arrives, it will be automatically delivered to the WebAccessService::openURL() slot in the application.

Applications register as providing a service by supplying a standard Qtopia configuration file, $QPEDIR/services/<servicename>/<appname> where:

The standard keys in this file are:

The file may contain any additional sections, keys and values as defined by the documentation of the service.

Adding a New Service

Each new service must be carefully specified as it provides a system- wide API that can be invoked by other applications and the user. A service should only be added if it:

To add a new service, provide a standard Qtopia configuration file, $QPEDIR/services/<servicename>.service. The keys in this file are:

For example:

    [Translation]
    File=QtopiaServices
    Context=Calendar
    [Service]
    Actions = "raiseToday();newEvent()"
    Icon = datebook_icon
    Name[]=Calendar
    [newEvent()]
    Icon = datebook_icon
    Name[]=New event
    [raiseToday()]
    Icon=today
    Name[]=Today's calendar

Usually, only one application responds to a given service. The user selects the application to handle the service using the Application Serviceas settings. If the service can be provided by multiple applications, the service file will contain:

    Multiple = 1

in the [Service] section.

Advanced Service Functionality

Some services may be parameterised on the type of data to be processed. Different applications may handle different data types. The Qtopia Data Sharing (QDS) system should be used for these types of services.


Copyright © 2008 Nokia Trademarks
Qtopia 4.3.3