serviceapifw_plat/liw_service_interface_base_api/inc/liwserviceifbase.h
changeset 57 61b27eec6533
parent 45 7aa6007702af
equal deleted inserted replaced
45:7aa6007702af 57:61b27eec6533
     1 /*
       
     2 * Copyright (c) 2003-2005 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 the License "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:       Declares Base service API for all providers to implement in 
       
    15 *                order to offer services to Language Interworking Framework.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef LIW_SERVICE_IF_BASE_H
       
    25 #define LIW_SERVICE_IF_BASE_H
       
    26 
       
    27 // INCLUDES
       
    28 #include <liwgenericparam.h>
       
    29 #include <liwcommon.h>
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // DATA TYPES
       
    36 /**
       
    37 * Extension interface UIDs.
       
    38 */
       
    39 enum TLiwExtendedIf
       
    40 {
       
    41 	/*
       
    42 	 *  Extension interface UID to get service data interface
       
    43 	 *
       
    44 	 * @see CLiwServiceData
       
    45 	 */
       
    46 	KLiwGetServiceDataIf = 0x102830B2
       
    47 };
       
    48 
       
    49 // FUNCTION PROTOTYPES
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 class MLiwNotifyCallback;
       
    53 class CLiwCriteriaItem;
       
    54 //typedef RPointerArray<CLiwCriteriaItem> RCriteriaArray;
       
    55 class CLiwServiceData;
       
    56 // CLASS DECLARATION
       
    57 
       
    58 /**
       
    59 * This is the base service interface to access providers that offer base services.
       
    60 *
       
    61 * This interface needs to be implemented by all the LIW providers. Base service
       
    62 * providers should inherit from this class directly. Menu service providers 
       
    63 * should inherit from CLiwServiceIfMenu.
       
    64 *
       
    65 * @lib ServiceHandler.lib
       
    66 * @since Series 60 2.6
       
    67 * @see CLiwServiceIfMenu
       
    68 **/
       
    69 class CLiwServiceIfBase : public CBase
       
    70     {
       
    71     public:
       
    72         /** 
       
    73         * Destructor.
       
    74         */
       
    75         IMPORT_C virtual ~CLiwServiceIfBase();
       
    76 
       
    77         /**
       
    78         * Called by the LIW framework to initialise provider with necessary information 
       
    79         * from the Service Handler. This method is called when the consumer makes 
       
    80         * the attach operation.
       
    81         *
       
    82         * @param aFrameworkCallback Framework provided callback for provider to send 
       
    83         *                           events to framework.
       
    84         * @param aInterest List of criteria items which invoked the provider.
       
    85         */
       
    86         virtual void InitialiseL(
       
    87             MLiwNotifyCallback& aFrameworkCallback,
       
    88             const RCriteriaArray& aInterest) = 0;
       
    89         
       
    90         /**
       
    91         * Executes generic service commands included in criteria.
       
    92         *
       
    93         * @param aCmdId Command to be executed.
       
    94         * @param aInParamList Input parameters, can be an empty list.
       
    95         * @param aOutParamList Output parameters, can be an empty list.
       
    96         * @param aCmdOptions Options for the command, see KLiwOpt* in LiwCommon.hrh.
       
    97         * @param aCallback Callback for asynchronous command handling, parameter checking, etc.
       
    98         * @leave KErrArgument Callback is missing when required.
       
    99         * @leave KErrNotSupported No provider supports service.
       
   100         */
       
   101         virtual void HandleServiceCmdL(
       
   102             const TInt& aCmdId,
       
   103             const CLiwGenericParamList& aInParamList,
       
   104             CLiwGenericParamList& aOutParamList,
       
   105             TUint aCmdOptions = 0,
       
   106             const MLiwNotifyCallback* aCallback = NULL) = 0;
       
   107 
       
   108         /**
       
   109         * Executes generic service command
       
   110         *
       
   111         * @param aCmdName The service command to be executed.
       
   112         * @param aInParamList Input parameters, can be an empty list.
       
   113         * @param aOutParamList Output parameters, can be an empty list.
       
   114         * @param aCmdOptions Options for the command, see KLiwOpt* in LiwCommon.hrh.
       
   115         * @param aCallback Callback for asynchronous command handling, parameter checking, etc.
       
   116         * @leave KErrArgument Callback is missing when required.
       
   117         * @leave KErrNotSupported No provider supports service.
       
   118         */
       
   119         void HandleServiceCmdL(                         
       
   120             const TDesC8& aCmdName,
       
   121             const CLiwGenericParamList& aInParamList,
       
   122             CLiwGenericParamList& aOutParamList,
       
   123             TUint aCmdOptions = 0,
       
   124             const MLiwNotifyCallback* aCallback = NULL)
       
   125           {
       
   126             _LIT8(KGenericParamID,"cmd");
       
   127           
       
   128             ((CLiwGenericParamList&)aInParamList).AppendL(
       
   129               TLiwGenericParam(KGenericParamID, TLiwVariant(aCmdName)));
       
   130             
       
   131             HandleServiceCmdL(KLiwCmdAsStr, aInParamList,
       
   132                               aOutParamList, aCmdOptions, aCallback);
       
   133           }
       
   134 
       
   135 		
       
   136 
       
   137         // Rest of the class is for LIW's internal use and doesn't consern 
       
   138         // service providers.
       
   139         friend class CLiwServiceHandlerImpl;
       
   140         friend class CLiwBinding;
       
   141         friend class CLiwEcomMonitor;
       
   142 
       
   143     protected:
       
   144         IMPORT_C virtual void* ExtensionInterface(TUid aInterface);
       
   145 
       
   146 		private:
       
   147         void SetDtorKeyId(TUid aDtorKeyId);
       
   148         TBool Match(CLiwCriteriaItem* aItem);   
       
   149         void AddCriteria(CLiwCriteriaItem* aItem);
       
   150         TUid ImplementationUid() const;
       
   151         void SetImplementationUid(TUid aUid);
       
   152         TBool HasCriteria(CLiwCriteriaItem& aItem) const;
       
   153 
       
   154     private:
       
   155         TUid iDtorKeyId;
       
   156         RCriteriaArray iCriterias;
       
   157         TUid iImplUid;
       
   158 
       
   159         // Reserved member        
       
   160         TAny* iReserved;        
       
   161     };
       
   162 
       
   163 
       
   164 #endif  // LIW_SERVICE_IF_BASE_H
       
   165 
       
   166 // End of file