uiservicetab/vimpstengine/inc/cvimpstengine.h
branchRCL_3
changeset 29 9a48e301e94b
equal deleted inserted replaced
28:3104fc151679 29:9a48e301e94b
       
     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 "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:  Class that capsulates single service data members
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CVIMPSTENGINE_H
       
    19 #define __CVIMPSTENGINE_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "tvimpstenums.h"
       
    25 
       
    26 //base
       
    27 #include "mvimpstengine.h"
       
    28 #include "mvimpststoragecontactsobserver.h"
       
    29 #include "mvimpstenginecchuieventobserver.h"
       
    30 #include "mvimpstengineserviceconnectioneventobserver.h"
       
    31 // FORWARD DECLARATIONS
       
    32 class CVIMPSTEngineServiceTableFetcher;
       
    33 class MVIMPSTServiceListManager;
       
    34 class MVIMPSTStorageServiceView;
       
    35 class MVIMPSTEngineSubService;
       
    36 class CVIMPSTEngineCchHandler;
       
    37 class MVIMPSTEngineSearchExtentionEventObserver;
       
    38 class CVIMPSTEngineSessionCntxtObserver;
       
    39 class MVIMPSTStorageContactsObserver;
       
    40 class MVIMPSTEngineCchUiEventObserver;
       
    41 
       
    42 //CLASS DECLARATION
       
    43 /**
       
    44  * engine class for a Single Service
       
    45  * @lib vimpstengine.dll
       
    46  * @since 5.0
       
    47  */
       
    48 
       
    49 
       
    50 NONSHARABLE_CLASS( CVIMPSTEngine ) : public CBase, 
       
    51 									public MVIMPSTEngine,
       
    52 									public MVIMPSTEngineServiceConnectionEventObserver,
       
    53 									public MVIMPSTStorageContactsObserver,
       
    54 									public MVIMPSTEngineCchUiEventObserver
       
    55 				                    
       
    56                                         
       
    57 						
       
    58 	{
       
    59 	//for test cases.
       
    60     friend class T_VimpstEngine;
       
    61 
       
    62 	public:  // Two-phased constructors and destructor
       
    63 
       
    64 		/**
       
    65 		* NewLC two phase constructor.
       
    66 		* @param aServiceId - Service Id
       
    67 		* @param aTableFetcher - ServiceTable Fetcher
       
    68 		* return @ptr a new instance of this class
       
    69 		*/
       
    70 		static CVIMPSTEngine* NewLC(
       
    71 					TUint32 aServiceId,
       
    72 					CVIMPSTEngineServiceTableFetcher& aTableFetcher );
       
    73 
       
    74 		
       
    75 		/**
       
    76 		* NewL two phase constructor.
       
    77 		* @param aServiceId - Service Id
       
    78 		* @param aTableFetcher - ServiceTable Fetcher
       
    79 		* return @ptr a new instance of this class
       
    80 		*/
       
    81 		static CVIMPSTEngine* NewL(
       
    82 					TUint32 aServiceId,
       
    83 					CVIMPSTEngineServiceTableFetcher& aTableFetcher );
       
    84 					
       
    85 	   /**
       
    86 		* C++ default destructor
       
    87 		*/
       
    88 		virtual ~CVIMPSTEngine();		
       
    89 
       
    90 
       
    91 	public: //From MVIMPSTEngine	   
       
    92 
       
    93 	  
       
    94 		/**
       
    95 		* See MVIMPSTEngine
       
    96 		* 
       
    97 		*/
       
    98 		TUint32 ServiceId() const  ;		
       
    99 
       
   100 
       
   101 		/**
       
   102 		* See MVIMPSTEngine
       
   103 		* 
       
   104 		*/
       
   105 		TVIMPSTEnums::TVIMPSTRegistrationState ServiceState() const ;
       
   106 
       
   107 
       
   108 		/**
       
   109 		* See MVIMPSTEngine
       
   110 		* 
       
   111 		*/
       
   112 		TInt GetBrandInfoL(TLanguage& aBrandLanguage, 
       
   113 					TInt& aBrandVersion, TDes8& aBrandId) const ;
       
   114 
       
   115 
       
   116 
       
   117 		/**
       
   118 		* See MVIMPSTEngine
       
   119 		* 
       
   120 		*/			
       
   121 		TBool IsSubServiceSupportedL(TVIMPSTEnums::SubServiceType aType) const ;
       
   122 					
       
   123 
       
   124 		/**
       
   125 		* See MVIMPSTEngine
       
   126 		* 
       
   127 		*/
       
   128 		TBool IsSubServiceEnabled(TVIMPSTEnums::SubServiceType aType) const ;
       
   129 
       
   130 		/**
       
   131 		* See MVIMPSTEngine
       
   132 		* 
       
   133 		*/
       
   134 		void ContactStoreIdL( 
       
   135 					TDes& aContactStoreId ) const ;
       
   136 		
       
   137 		/*
       
   138 		 * See MVIMPSTEngine
       
   139 		 */
       
   140 		TBool IsUnInstalled( );
       
   141 
       
   142 		/**
       
   143 		* See MVIMPSTEngine
       
   144 		* 
       
   145 		*/
       
   146 		const TDesC& ServiceName() const ;
       
   147 		
       
   148 	
       
   149 		/**
       
   150 		* See MVIMPSTEngine
       
   151 		* 
       
   152 		*/
       
   153 		 void RegisterServiceSessionObserverL
       
   154 		 					(MVIMPSTEngineServiceStateEventObserver* aObserver) ;
       
   155 		 
       
   156 		/**
       
   157 		* See MVIMPSTEngine
       
   158 		* 
       
   159 		*/
       
   160 		void UnRegisterServiceSessionObserver
       
   161 		 					(MVIMPSTEngineServiceStateEventObserver* aObserver) ;
       
   162 		   
       
   163 
       
   164 		/**
       
   165 		* See MVIMPSTEngine
       
   166 		* 
       
   167 		*/	
       
   168 		void IntializeStorageL() ;
       
   169 
       
   170 		/**
       
   171 		* See MVIMPSTEngine
       
   172 		* 
       
   173 		*/	
       
   174 		void UnIntializeStorage() ;	   	    
       
   175 
       
   176 
       
   177 		/**
       
   178 		* See MVIMPSTEngine
       
   179 		* 
       
   180 		*/
       
   181 		MVIMPSTEngineSubService* SubService(TVIMPSTEnums::SubServiceType aType) const;
       
   182 
       
   183 
       
   184 		/**
       
   185 		* See MVIMPSTEngine
       
   186 		* 
       
   187 		*/
       
   188 		MVIMPSTEngineExtentionFeatures* ExtentionFeatures(TVIMPSTEnums::ExtentionType aType) const ;
       
   189 
       
   190 
       
   191 	
       
   192 		/**
       
   193 		* See MVIMPSTEngine
       
   194 		* 
       
   195 		*/
       
   196 		HBufC* GetOwnUserIdFromCChOrStorageL() const ;
       
   197 
       
   198 	
       
   199 		/**
       
   200 		* See MVIMPSTEngine
       
   201 		* 
       
   202 		*/
       
   203 		TInt Login();
       
   204 
       
   205 		/**
       
   206 		* See MVIMPSTEngine
       
   207 		* 
       
   208 		*/
       
   209 		void LogoutL();
       
   210 		
       
   211 		/**
       
   212 		* See MVIMPSTEngine
       
   213 		* 
       
   214 		*/
       
   215 		void DefaultDomainNameL( TDes& aDefaultDomainName ) const;
       
   216 		
       
   217 		/**
       
   218 		* See MVIMPSTEngine
       
   219 		* 
       
   220 		*/
       
   221 		TInt ChangeConnectionL();
       
   222 		/**
       
   223 		 * See MVIMPSTEngine
       
   224 		 * 
       
   225 		 * @return True if password is present in the settings else returns false
       
   226          *
       
   227 		 */
       
   228 		TBool IsPasswordAvailableL();
       
   229 		
       
   230 		/**
       
   231          * See MVIMPSTEngine
       
   232          * 
       
   233         */
       
   234 		TBool IsBlockSupportedL();
       
   235 		
       
   236 		/**
       
   237          * See MVIMPSTEngine
       
   238          * 
       
   239         */
       
   240 		void DeleteDataBaseL();
       
   241 		
       
   242 		/**
       
   243          * See MVIMPSTEngine
       
   244          * 
       
   245         */
       
   246 		MVIMPSTEnginePresenceSubService* GetPreseceSubService();
       
   247 
       
   248 		/**
       
   249          * See MVIMPSTEngine
       
   250          * 
       
   251          */
       
   252 		void FetchBlockedListL();
       
   253 		
       
   254 		/**
       
   255          * See MVIMPSTEngine
       
   256          * 
       
   257          */
       
   258 		void RegisterBlockedListObserver(
       
   259 						MVIMPSTEngineBlockedListFetchEventObserver* aOb);
       
   260 						
       
   261 						
       
   262 		/**
       
   263 		*  See MVIMPSTEngine
       
   264 		* 
       
   265 		*/
       
   266 		void SetOwnUserIdIfChangedL(const TDesC& aUserId ) ;
       
   267 		
       
   268 		
       
   269 		/**
       
   270 		*  See MVIMPSTEngine
       
   271 		* 
       
   272 		*/
       
   273 		void RetriveContextIfCChEnabledL() ;
       
   274 
       
   275 	private: // From MVIMPSTEngineServiceConnectionEventObserver
       
   276 		/**
       
   277 		 * See MVIMPSTEngineServiceConnectionEventObserver
       
   278 		 */ 
       
   279 		void  HandleServceConnectionEventL();
       
   280 	
       
   281 	private:
       
   282 		/**
       
   283 		* Returns a SubService is Supported or not
       
   284 		* Components intertested in knowing whether a SubService is Supported or not can use this API
       
   285 		* @param aType - Type of the SubService TVIMPSTEnums::SubServiceType - Defined in tvimpstenums.h
       
   286 		* @return TBool, ETrue if the SubService is Supported in this Service, else returns EFalse
       
   287 		*/
       
   288 		TBool IsSubServiceSupportedInternal(TVIMPSTEnums::SubServiceType aType) const ;
       
   289 			
       
   290 	public:	    
       
   291 		 /**
       
   292           * Called when all the contacts are fetched from the virtual store.
       
   293           * 
       
   294           * @since s60 5.0
       
   295           */
       
   296          void HandleContactFetchedL();
       
   297               
       
   298  	public: // From MVIMPSTStorageContactsObserver
       
   299        
       
   300        
       
   301         /**
       
   302         * HandleChange: To handle the Chnage event from the MCAStoredContactsObserver
       
   303         * @see MCAStoredContactsObserver
       
   304         * @param aList: reference to the list at which a change has occured
       
   305         * @param aContact:  reference to the contact at which a change has occured
       
   306         * @param aEventType: TVIMPSTEnums::TCAObserverEventType,type of change event that has occured 
       
   307         * @param aUserIdChanged, ETrue if userid has changed, else EFalse.
       
   308         * @return void
       
   309         */
       
   310          void HandleStorageChangeL( TVIMPSTEnums::TVIMPSTStorgaeEventType aEventType,
       
   311          							MVIMPSTStorageContactList* aList, 
       
   312 	        						MVIMPSTStorageContact* aContact,
       
   313 	        						TInt aContactIndex );
       
   314 
       
   315 
       
   316          //From MVIMPSTEngineCchUiEventObserver
       
   317          /**
       
   318           * Handles the change connection event from CCHUI
       
   319           *@ return void
       
   320           */
       
   321          void HandleChangeConnectionEventL();
       
   322 
       
   323                                
       
   324 
       
   325 	private:		
       
   326 	   	
       
   327 	    /**
       
   328          * symbian second phase constructor
       
   329          * @param aServiceId service id
       
   330          */       
       
   331 		void ConstructL( TUint32 aServiceId );
       
   332 
       
   333 		/**
       
   334 		* C++ constructor.
       
   335 		*/
       
   336 		CVIMPSTEngine( TUint32 aServiceId, 
       
   337 					CVIMPSTEngineServiceTableFetcher& aTableFetcher );					
       
   338 		
       
   339 		
       
   340 		/**
       
   341 		* Parses and finds the Cumulative Service State of all Subservices
       
   342 		* @return TVIMPSTRegistrationState
       
   343 		*/
       
   344 		TVIMPSTEnums::TVIMPSTRegistrationState ParseGetServiceState();		
       
   345 	
       
   346 		/**
       
   347 		* Adds Extention Feature
       
   348 		* @param aFeature - Feature to be added
       
   349 		*/
       
   350 		void AddExtentionFeaturesL(MVIMPSTEngineExtentionFeatures* aFeature) ; 
       
   351 	
       
   352 		
       
   353 		/**
       
   354 		* Removes Extention Feature
       
   355 		* @param aFeature - Feature to be Removed
       
   356 		*/
       
   357 		void RemoveExtentionFeatures(TVIMPSTEnums::ExtentionType aType) ;
       
   358 		
       
   359 		
       
   360 		/**
       
   361 		* Creates a list of known extention features
       
   362 		* 
       
   363 		*/
       
   364 		void CreateExtentionFeaturesL();
       
   365 		
       
   366 		 /**
       
   367           * Sets the supported extension feature
       
   368           */
       
   369 		void SetExtentionFeaturesSupportedL();
       
   370 		
       
   371 		/**
       
   372           * ReSets the Support for all extension feature
       
   373           */
       
   374 		void ReSetExtentionFeaturesSupportedL();
       
   375 		
       
   376 	
       
   377 	
       
   378 							
       
   379 	private :
       
   380 		
       
   381 		//Service Id
       
   382 		TUint32 iServiceId;
       
   383 
       
   384 		//Settings Id
       
   385 		TUint32 iSettingsId;
       
   386 			
       
   387 		//doesnt own reference to servicetable entry
       
   388 		CVIMPSTEngineServiceTableFetcher& iTableFetcher;
       
   389 
       
   390 		//owns - service name
       
   391 		HBufC*   iServiceName;
       
   392 		
       
   393 		//Owns, ximpfw session context observer.
       
   394 		CVIMPSTEngineSessionCntxtObserver* iSessionCntxtObserver ;	
       
   395 		
       
   396 		//does not own reference to the contact list interface
       
   397 		MVIMPSTStorageServiceView* iContactInterface;
       
   398 
       
   399 		//owns pointer to subservice     
       
   400 		RPointerArray <MVIMPSTEngineSubService> iSubService;
       
   401 
       
   402 		// Own, cch handler for this service
       
   403 		CVIMPSTEngineCchHandler*    iCchHandler;
       
   404 
       
   405 		//owns pointer to subservice     
       
   406 		RPointerArray <MVIMPSTEngineExtentionFeatures> iExtentionFeatures;
       
   407 
       
   408 		// Doesnt Own, array of observers.
       
   409 		RPointerArray<MVIMPSTEngineServiceStateEventObserver> iObserverArray;
       
   410 		
       
   411 		//Owns Pointer to the ServiceState Listener
       
   412 
       
   413 		//Cumulative Service State of all SubServices Belonging to this Service
       
   414 		TVIMPSTEnums::TVIMPSTRegistrationState iState;
       
   415 	
       
   416 		//block list observer to notify the blocked list has been fetched.
       
   417 		MVIMPSTEngineBlockedListFetchEventObserver* iBlockListObs;
       
   418 		
       
   419 		// UnInstall Flag; Set to true during engine construction
       
   420 		// if engine fails to find ximp object implementation
       
   421 		TBool iUnInstall;
       
   422    
       
   423 	};
       
   424 
       
   425 #endif      //__CVIMPSTENGINE_H
       
   426 
       
   427 //  End of File
       
   428 
       
   429