homescreensrv_plat/servicemodel_api/service.h
changeset 66 32469d7d46ff
parent 61 8e5041d13c84
child 73 4bc7b118b3df
equal deleted inserted replaced
61:8e5041d13c84 66:32469d7d46ff
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SERVICE_H
       
    20 #define SERVICE_H
       
    21 
       
    22 #include "servicemodel_global.h"
       
    23 #include <QObject>
       
    24 #include <QVariant>
       
    25 
       
    26 class ServiceParameters;
       
    27 
       
    28 /**
       
    29  * @ingroup group_hsservicemodel group_service_api_candidates
       
    30  * @brief Base class for all the services. 
       
    31  */
       
    32 class HSSERVICEMODEL_EXPORT HsService : public QObject
       
    33 {
       
    34 	Q_OBJECT
       
    35 	
       
    36 public:
       
    37 
       
    38     /**
       
    39     * Constructor
       
    40     * @param aParent 
       
    41     */
       
    42     HsService( QObject* aParent = 0 ) : QObject( aParent ) {}
       
    43 	  
       
    44     /**
       
    45      * destructor
       
    46      * @since S60 ?S60_version.
       
    47      */
       
    48     virtual ~HsService() {}
       
    49     
       
    50 public:
       
    51 
       
    52     /**
       
    53      * Execute service command
       
    54      * @param aCommand service command 
       
    55      * @param aInParameters parameters. 
       
    56      * For example messaging service
       
    57      * needs to have at least the following pairs to send short message:
       
    58      * 'MessageType' - 'SMS'
       
    59      * 'To' - 'phone number here'
       
    60      * 'BodyText' - 'this is text to be sent'
       
    61      * So aInParameters should include QMap:
       
    62      * @code
       
    63      *   QMap<QString, QVariant> parameters;
       
    64      *   parameters["MessageType"]=QVariant(QString("SMS"));
       
    65      *   parameters["To"]=QVariant(QString("555555"));
       
    66      *   parameters["BodyText"]=QVariant(QString("this is bodytext"));
       
    67      *   QVariant inParameters;
       
    68      *   inParameters.setValue(parameters);
       
    69      * @endcode
       
    70      */
       
    71     virtual void executeCommand(const QByteArray &aCommand, const QVariant &aInParameters) = 0;
       
    72     
       
    73     /**
       
    74     * Cancels ALL then pending commands.
       
    75     */
       
    76     virtual void cancelCommands() = 0;
       
    77     
       
    78     /**
       
    79      * Get data after dataReceived signal has been received.
       
    80      * 
       
    81      * @param aData data buffer to be filled
       
    82      * TODO: error?
       
    83      */
       
    84     virtual void getData(QVariant &aData) = 0;
       
    85         
       
    86 signals:
       
    87 
       
    88     /**
       
    89      * Signal emitted when data is received, client can then make query for the received data using getData function.
       
    90      */
       
    91     void dataReceived();
       
    92     
       
    93     /**
       
    94      * Signal emitted when data is received
       
    95      * @param aData (QMap<QString, QVariant>) data received from the service 
       
    96      */
       
    97     void dataReceived(const QVariant &aData);
       
    98     	    
       
    99 };
       
   100 
       
   101 #endif