serviceproviders/sapi_serviceregistry/inc/serviceinterface.h
changeset 5 989d2f495d90
child 23 50974a8b132e
equal deleted inserted replaced
1:a36b1e19a461 5:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2008 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SERVICEINTERFACE_H
       
    20 #define SERVICEINTERFACE_H
       
    21 
       
    22 #include <liwcommon.h>
       
    23 #include <LiwVariant.h>
       
    24 #include <LiwGenericParam.h>
       
    25 #include <LiwServiceHandler.h>
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 class CSvcRegIterator;
       
    30 
       
    31 /**
       
    32  *  Service interface class for ServiceRegistry SAPI.
       
    33  *  Checks the requested command and delegates query to correct core class method.
       
    34  */
       
    35 class CServiceInterface : public CActive, public MLiwInterface
       
    36     {
       
    37     	
       
    38 public:
       
    39 	
       
    40     /**
       
    41      * Two-phased constructor.
       
    42      * @return CServiceInterface* Returns the instance of
       
    43      *                  CServiceInterface.
       
    44      */
       
    45     static CServiceInterface* NewL();
       
    46 
       
    47     /**
       
    48      * Destructor.
       
    49      */
       
    50     ~CServiceInterface();
       
    51 
       
    52     static void RCriteriaArrayCleanup( TAny* aParam ) ;
       
    53     /**
       
    54      * This function handles the request of consumer.
       
    55      * @param aCmdName Command name of SAPI
       
    56      * @param aInParamList  Contains argument on which operation has to
       
    57      *                       be performed
       
    58      * @param aOutParamList Result of given command will be
       
    59      *                       stored in the output parameter list
       
    60      * @param aCmdOptions Set option for asynchronous request or
       
    61      *                     for canceling the asynchronous request
       
    62      * @param aCallback Contains the callback for Asynchronous request
       
    63      */
       
    64     void ExecuteCmdL( const TDesC8& aCmdName,
       
    65                       const CLiwGenericParamList& aInParamList,
       
    66                       CLiwGenericParamList& aOutParamList,
       
    67                       TUint aCmdOptions = 0,
       
    68                       MLiwNotifyCallback* aCallback = 0 );
       
    69                             
       
    70     /**
       
    71      * This function handles the request of consumer.
       
    72      * @param aCmdName Command name of SAPI
       
    73      * @param aInParamList  Contains argument on which operation has to
       
    74      *                       be performed
       
    75      * @param aOutParamList Result of given command will be
       
    76      *                       stored in the output parameter list
       
    77      * @param aCmdOptions Set option for asynchronous request or
       
    78      *                     for canceling the asynchronous request
       
    79      * @param aCallback Contains the callback for Asynchronous request
       
    80      */
       
    81     void ExecuteServiceCommandL( const TDesC8& aCmdName,
       
    82                                  const CLiwGenericParamList& aInParamList,
       
    83                                  CLiwGenericParamList& aOutParamList,
       
    84                                  TUint aCmdOptions = 0,
       
    85                                  MLiwNotifyCallback* aCallback = 0 );
       
    86                                
       
    87     /**
       
    88      * Close function called by consumer when it wants to delete the interface.
       
    89      * This function will release all the internal resources.
       
    90      * @return void
       
    91      */
       
    92     void Close() {delete this;}
       
    93     
       
    94 private:
       
    95 	
       
    96     /**
       
    97      * Constructor.
       
    98      */    
       
    99     CServiceInterface();
       
   100     
       
   101     /**
       
   102      * Two-phased constructor.
       
   103      * @return void
       
   104      */
       
   105     void ConstructL();    
       
   106     /**
       
   107      * This function processes the command and calls right service function.
       
   108      * @param aCmdName Command name of SAPI
       
   109      * @param aInParamList  Contains argument on which operation has to
       
   110      *                       be performed
       
   111      * @param aOutParamList Result of given command will be
       
   112      *                       stored in the output parameter list
       
   113      * @param aCmdOptions Set option for asynchronous request or
       
   114      *                     for canceling the asynchronous request
       
   115      * @param aCallback Contains the callback for Asynchronous request
       
   116      */
       
   117     void ProcessCommandL( const TDesC8& aCmdName,
       
   118                           const CLiwGenericParamList& aInParamList,
       
   119                           CLiwGenericParamList& aOutParamList,
       
   120                           TUint aCmdOptions,
       
   121                           MLiwNotifyCallback* aCallback );
       
   122     /**
       
   123      * Gets the list of ServiceProviders.
       
   124      * @param aInParamList Input parameter list.
       
   125      * @param aOutParamList Output parameter list.
       
   126      * @param aTransactionId: Transaction Id received from LIW 
       
   127      * @param aCallBack: Client callback interface used to notify asynchronous call results.
       
   128      */
       
   129     void GetListL( const CLiwGenericParamList& aInParamList, 
       
   130                    CLiwGenericParamList& aOutParamList, 
       
   131                    TInt32 aTransactionId, 
       
   132                    MLiwNotifyCallback* aCallBack );
       
   133                          
       
   134     void ListServiceProvidersL(TInt32 aError);        
       
   135                             
       
   136     virtual void DoCancel(); 
       
   137     
       
   138     virtual void RunL(); 
       
   139     
       
   140     friend void GetListProviderL(CServiceInterface* aInterface);                                          
       
   141 private:
       
   142 	
       
   143     /**
       
   144      * Stores the instance of SAPI Core Class.
       
   145      */
       
   146      MLiwNotifyCallback* iCallback;
       
   147             
       
   148     //trasaction ID.
       
   149     TInt32 iTransactionId;
       
   150     
       
   151     //Descriptor to hold the service name
       
   152     HBufC8* iServiceName;
       
   153     
       
   154     //Descriptor to hold the interface name    
       
   155     HBufC8* iInterfaceName;    
       
   156     
       
   157     //Min version number. 
       
   158     TReal iMinVersion;
       
   159     
       
   160     //Max version number.
       
   161     TReal iMaxVersion;
       
   162     
       
   163     //Referance to top the Input Parameter list passed by consumer.
       
   164     const CLiwGenericParamList* iInParamList;
       
   165         
       
   166     //handle to the service handler.
       
   167     CLiwServiceHandler* iServiceHandler;
       
   168     //pointer to the iterator
       
   169     CSvcRegIterator* iIterator; 
       
   170     //Thread handle
       
   171     RThread iThread;            
       
   172     };
       
   173     
       
   174 #endif // SERVICEINTERFACE_H