commsconfig/cscengine/inc/cscengservicepluginhandler.h
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  For CSC needed AIW handling for service plug-ins
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CSCENGSERVICPLUGINHANDLER_H
       
    21 #define C_CSCENGSERVICPLUGINHANDLER_H
       
    22 
       
    23 #include <AiwCommon.h>
       
    24 #include "mcscengecomobserver.h"
       
    25 
       
    26 const TUint KMaxServiceProviderNameLength = 128;
       
    27 
       
    28 class CEikonEnv;
       
    29 class CAiwServiceHandler;
       
    30 class MAiwNotifyCallback;
       
    31 class CCSCEngEcomMonitor;
       
    32 class CAiwGenericParamList;
       
    33 class CCSCEngServiceHandler;
       
    34 class MCSCEngProvisioningObserver;
       
    35 
       
    36 /**
       
    37  *  TServicePluginInfo class
       
    38  *
       
    39  *  For storing service plug-in information
       
    40  *
       
    41  *  @lib
       
    42  *  @since S60 v3.2
       
    43  */
       
    44 NONSHARABLE_CLASS ( TServicePluginInfo )
       
    45     {
       
    46     public:
       
    47         
       
    48         /**
       
    49          * Constructor.
       
    50          *
       
    51          * @since S60 3.2
       
    52          */
       
    53         TServicePluginInfo()
       
    54             : iProviderName( KNullDesC ),
       
    55               iPluginsUid( KNullUid ),
       
    56               iViewId( KNullUid ),
       
    57               iModifiedUi( 1 ),
       
    58               iRequiredIap( 0 ),
       
    59               iProvisioned( EFalse ),
       
    60               iOffered( EFalse )
       
    61             {}
       
    62 
       
    63     public: // data
       
    64         
       
    65         /*
       
    66          * Service provider name
       
    67          */
       
    68         TBuf<KMaxServiceProviderNameLength> iProviderName;
       
    69         
       
    70         /*
       
    71          * Service plug-in UID
       
    72          */
       
    73         TUid iPluginsUid;
       
    74         
       
    75         /*
       
    76          * Service plug-in view id
       
    77          */
       
    78         TUid iViewId;
       
    79         
       
    80         /*
       
    81          * 0 = plug-in has no UI
       
    82          * 1 = plug-in has UI
       
    83          * (only to provide backwards compatibility, 
       
    84          *  all new plug-ins must provide UI )
       
    85          */
       
    86         TInt iModifiedUi;
       
    87         
       
    88         /*
       
    89          * 0 = plug-in doesn´t required IAP
       
    90          * 1 = plug-in requires IAP
       
    91          * (only to provide backwards compatibility, 
       
    92          *  all new plug-ins DO NOT require IAP )
       
    93          */
       
    94         TInt iRequiredIap;
       
    95         
       
    96         /*
       
    97          * ETrue if plug-in is provisioned (configured)
       
    98          */
       
    99         TBool iProvisioned;
       
   100         
       
   101         /*
       
   102          * ETrue if plug-in is offered for configuration
       
   103          */
       
   104         TBool iOffered;
       
   105     };
       
   106 
       
   107 
       
   108 /**
       
   109  *  CSCEngServicePluginHandler class
       
   110  *  Handles Application Interworking (AIW) and service plug-in handling
       
   111  *
       
   112  *  @lib
       
   113  *  @since S60 v3.2
       
   114  */
       
   115 NONSHARABLE_CLASS( CCSCEngServicePluginHandler ) : public CBase,
       
   116                                                    public MAiwNotifyCallback,
       
   117                                                    public MCSCEngEcomObserver
       
   118     {
       
   119     public: 
       
   120 
       
   121         /** State of the plugin */
       
   122         enum TPluginState
       
   123             {
       
   124             EPluginInitialize = 1,
       
   125             EPluginProvisioning,
       
   126             EPluginModifySettings,
       
   127             EPluginRemovation
       
   128             };
       
   129         
       
   130         /** Type of plugin count to be returned */
       
   131         enum TPluginCount
       
   132             {
       
   133             EInitialized = 0,
       
   134             EUnprovisioned
       
   135             };
       
   136         
       
   137        // Provisioning plug-in callback service events.
       
   138         enum TServicePluginResponse
       
   139             {
       
   140             EPluginInitialized = KAiwEventStarted,
       
   141             EPluginProvisioned = KAiwEventCompleted,
       
   142             EPluginModified = KAiwEventStopped,
       
   143             EPluginRemoved = KAiwEventQueryExit,
       
   144             EPluginError = KAiwEventError
       
   145             };
       
   146             
       
   147         /**
       
   148          * Two-phased constructor.
       
   149          *
       
   150          * @param aObserver reference to service plug-in provisioning observer
       
   151          * @param aServiceHandler reference to service handler
       
   152          */
       
   153         IMPORT_C static CCSCEngServicePluginHandler* NewL(
       
   154             CEikonEnv& aEikEnv, 
       
   155             MCSCEngProvisioningObserver& aObserver,
       
   156             CCSCEngServiceHandler& aServiceHandler );
       
   157 
       
   158         
       
   159         /**
       
   160          * Two-phased constructor.
       
   161          *
       
   162          * @param aObserver reference to service plug-in provisioning observer
       
   163          * @param aServiceHandler reference to service handler
       
   164          */
       
   165         IMPORT_C static CCSCEngServicePluginHandler* NewLC( 
       
   166             CEikonEnv& aEikEnv,
       
   167             MCSCEngProvisioningObserver& aObserver,
       
   168             CCSCEngServiceHandler& aServiceHandler );
       
   169 
       
   170         
       
   171         /**
       
   172          * Destructor.
       
   173          */
       
   174         virtual ~CCSCEngServicePluginHandler();
       
   175  
       
   176  
       
   177         /**
       
   178          * Initializes CSC supported plugins.
       
   179          *
       
   180          * @since S60 v3.2
       
   181          */
       
   182         IMPORT_C void InitializePluginsL();
       
   183     
       
   184     
       
   185         /**
       
   186          * Informs plugin of provisioning.
       
   187          *
       
   188          * @since S60 v3.2
       
   189          * @param aPluginUid contains plugins Uid
       
   190          * @param aViewUid contains view Uid to be returned
       
   191          */
       
   192         IMPORT_C void DoProvisioningL( const TUid& aPluginUid,
       
   193                                        const TUid& aViewUid );
       
   194     
       
   195     
       
   196         /**
       
   197          * Launches plugin provided setting view.
       
   198          *
       
   199          * @since S60 v3.2
       
   200          * @param aPluginUid contains plugins Uid
       
   201          * @param aViewUid contains view Uid to be returned
       
   202          */
       
   203         IMPORT_C void LaunchPluginViewL( const TUid& aPluginUid, 
       
   204                                          const TUid& aViewUid );
       
   205     
       
   206         
       
   207         /**
       
   208          * Informs plugin from removation.
       
   209          *
       
   210          * @since S60 v3.2
       
   211          * @param aPluginUid contains plugins Uid
       
   212          * @param aRemoveSisPckg for invoking application installer
       
   213          */
       
   214         IMPORT_C void DoRemovationL( const TUid& aPluginUid,
       
   215                                      TBool aRemoveSisPckg );
       
   216     
       
   217                 
       
   218         /**
       
   219          * Returns count of CSC supported plugins in array.
       
   220          * 
       
   221          * @since S60 v3.2
       
   222          * @param aType for items to be returned
       
   223          * @return count of profiles 
       
   224          */
       
   225         IMPORT_C TInt PluginCount( const TPluginCount aType ) const;
       
   226         
       
   227                 
       
   228         /**
       
   229          * Returns item from service plug-in array
       
   230          * 
       
   231          * @param aIndex index
       
   232          * @since S60 v3.2
       
   233          */
       
   234         IMPORT_C TServicePluginInfo ItemFromPluginInfoArray( TInt aIndex );
       
   235         
       
   236         
       
   237          // from base class MAiwNotifyCallBack
       
   238   
       
   239         /**
       
   240          * From MAiwNotifyCallBack.
       
   241          * Handles received callbacks from AIW plugin.
       
   242          *
       
   243          * @since S60 v3.0
       
   244          * @param aCmdId for cmd id
       
   245          * @param aEventId for event id
       
   246          * @param aEventParamList for event param list
       
   247          * @param aInParamList for in param list
       
   248          */
       
   249         TInt HandleNotifyL( TInt aCmdId,
       
   250                             TInt aEventId,
       
   251                             CAiwGenericParamList& aEventParamList,
       
   252                             const CAiwGenericParamList& aInParamList );
       
   253 
       
   254 
       
   255         // from base class MCSCEngEcomObserver
       
   256     
       
   257         /**
       
   258          * Observer interface for notifying ecom events.
       
   259          *
       
   260          * @since S60 v3.2
       
   261          */
       
   262         void NotifyEcomEvent();
       
   263     
       
   264     private:
       
   265 
       
   266 
       
   267         CCSCEngServicePluginHandler( 
       
   268             CEikonEnv& aEikEnv,
       
   269             MCSCEngProvisioningObserver& aObserver,
       
   270             CCSCEngServiceHandler& aServiceHandler );
       
   271 
       
   272    
       
   273         void ConstructL();
       
   274         
       
   275         
       
   276         /**
       
   277          * Gets plug-in index in plug-in info array and plug-ins uid
       
   278          *
       
   279          * @since S60 v3.2
       
   280          * @param aInParamList for params received from plugin
       
   281          * @param aIndex for plug-in info array index
       
   282          * @param aPluginUid for plug-in uid
       
   283          */ 
       
   284         void GetPluginIndexAndUid( 
       
   285             const CAiwGenericParamList& aInParamList, 
       
   286             TInt& aIndex, 
       
   287             TUid& aPluginUid );
       
   288         
       
   289         
       
   290          /**
       
   291          * Gets and sets plug-in view id
       
   292          *
       
   293          * @since S60 v3.2
       
   294          * @param aInParamList for params received from plugin
       
   295          */ 
       
   296         void GetPluginViewId( 
       
   297             const CAiwGenericParamList& aInParamList );
       
   298         
       
   299         /**
       
   300          * Set information of plug-ins to plug-in info array
       
   301          *
       
   302          * @since S60 v3.2
       
   303          * @param aInParamList for params received from plugin
       
   304          */        
       
   305         void SetPluginInitInfoL( const CAiwGenericParamList& aInParamList );
       
   306         
       
   307         
       
   308         /**
       
   309          * Invokes application installer to remove .sis package from device.
       
   310          *
       
   311          * @since S60 v3.2
       
   312          * @param aPluginUid contains plugin uid
       
   313          */        
       
   314         void RemovePluginSisL( const TUid& aPluginUid ) const;
       
   315         
       
   316         
       
   317     private: // data
       
   318         
       
   319         /**
       
   320          * Reference to Eikon environment.
       
   321          */
       
   322         CEikonEnv& iEikEnv;
       
   323         
       
   324         /**
       
   325          * Observer for AIW commands
       
   326          */  
       
   327         MCSCEngProvisioningObserver& iObserver;
       
   328         
       
   329         /*
       
   330          * Reference to CCSCEngServiceHandler
       
   331          */
       
   332         CCSCEngServiceHandler& iServiceHandler;
       
   333                         
       
   334         /**
       
   335          * For AIW Plugin services
       
   336          * Own.
       
   337          */
       
   338         CAiwServiceHandler* iAiwServiceHandler;
       
   339         
       
   340         /**
       
   341          * For monitoring Ecom changes.
       
   342          * Own.
       
   343          */
       
   344         CCSCEngEcomMonitor* iEcomMonitor;
       
   345                       
       
   346         /**
       
   347          * Array for storing information of service plug-ins
       
   348          */
       
   349         RArray<TServicePluginInfo> iServicePluginInfoArray;
       
   350         
       
   351         /**
       
   352          * Resource file offset.
       
   353          */
       
   354         TInt iResourceOffset;
       
   355         
       
   356         /**
       
   357          * Flag indicating that should application installer to be run.
       
   358          */
       
   359         TBool iRunSwinst;
       
   360             
       
   361 #ifdef _DEBUG
       
   362     friend class UT_CSCEngServicePluginHandler;
       
   363 #endif
       
   364     };
       
   365 
       
   366 #endif // C_CSCSERVICPLUGINHANDLER_H