uiservicetab/vimpstengine/inc/cvimpstengine.h
changeset 0 5e5d6b214f4f
child 10 78867dafe7eb
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     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 		*/
       
   141 		const TDesC& ServiceName() const ;
       
   142 		
       
   143 	
       
   144 		/**
       
   145 		* See MVIMPSTEngine
       
   146 		* 
       
   147 		*/
       
   148 		 void RegisterServiceSessionObserverL
       
   149 		 					(MVIMPSTEngineServiceStateEventObserver* aObserver) ;
       
   150 		 
       
   151 		/**
       
   152 		* See MVIMPSTEngine
       
   153 		* 
       
   154 		*/
       
   155 		void UnRegisterServiceSessionObserver
       
   156 		 					(MVIMPSTEngineServiceStateEventObserver* aObserver) ;
       
   157 		   
       
   158 
       
   159 		/**
       
   160 		* See MVIMPSTEngine
       
   161 		* 
       
   162 		*/	
       
   163 		void IntializeStorageL() ;
       
   164 
       
   165 		/**
       
   166 		* See MVIMPSTEngine
       
   167 		* 
       
   168 		*/	
       
   169 		void UnIntializeStorage() ;	   	    
       
   170 
       
   171 
       
   172 		/**
       
   173 		* See MVIMPSTEngine
       
   174 		* 
       
   175 		*/
       
   176 		MVIMPSTEngineSubService* SubService(TVIMPSTEnums::SubServiceType aType) const;
       
   177 
       
   178 
       
   179 		/**
       
   180 		* See MVIMPSTEngine
       
   181 		* 
       
   182 		*/
       
   183 		MVIMPSTEngineExtentionFeatures* ExtentionFeatures(TVIMPSTEnums::ExtentionType aType) const ;
       
   184 
       
   185 
       
   186 	
       
   187 		/**
       
   188 		* See MVIMPSTEngine
       
   189 		* 
       
   190 		*/
       
   191 		HBufC* GetOwnUserIdFromCChOrStorageL() const ;
       
   192 
       
   193 	
       
   194 		/**
       
   195 		* See MVIMPSTEngine
       
   196 		* 
       
   197 		*/
       
   198 		TInt Login();
       
   199 
       
   200 		/**
       
   201 		* See MVIMPSTEngine
       
   202 		* 
       
   203 		*/
       
   204 		void LogoutL();
       
   205 		
       
   206 		/**
       
   207 		* See MVIMPSTEngine
       
   208 		* 
       
   209 		*/
       
   210 		void DefaultDomainNameL( TDes& aDefaultDomainName ) const;
       
   211 		
       
   212 		/**
       
   213 		* See MVIMPSTEngine
       
   214 		* 
       
   215 		*/
       
   216 		TInt ChangeConnectionL();
       
   217 		/**
       
   218 		 * See MVIMPSTEngine
       
   219 		 * 
       
   220 		 * @return True if password is present in the settings else returns false
       
   221          *
       
   222 		 */
       
   223 		TBool IsPasswordAvailableL();
       
   224 		
       
   225 		/**
       
   226          * See MVIMPSTEngine
       
   227          * 
       
   228         */
       
   229 		TBool IsBlockSupportedL();
       
   230 		
       
   231 		/**
       
   232          * See MVIMPSTEngine
       
   233          * 
       
   234         */
       
   235 		void DeleteDataBaseL();
       
   236 		
       
   237 		/**
       
   238          * See MVIMPSTEngine
       
   239          * 
       
   240         */
       
   241 		MVIMPSTEnginePresenceSubService* GetPreseceSubService();
       
   242 
       
   243 		/**
       
   244          * See MVIMPSTEngine
       
   245          * 
       
   246          */
       
   247 		void FetchBlockedListL();
       
   248 		
       
   249 		/**
       
   250          * See MVIMPSTEngine
       
   251          * 
       
   252          */
       
   253 		void RegisterBlockedListObserver(
       
   254 						MVIMPSTEngineBlockedListFetchEventObserver* aOb);
       
   255 						
       
   256 						
       
   257 		/**
       
   258 		*  See MVIMPSTEngine
       
   259 		* 
       
   260 		*/
       
   261 		void SetOwnUserIdIfChangedL(const TDesC& aUserId ) ;
       
   262 		
       
   263 		
       
   264 		/**
       
   265 		*  See MVIMPSTEngine
       
   266 		* 
       
   267 		*/
       
   268 		void RetriveContextIfCChEnabledL() ;
       
   269 
       
   270 	private: // From MVIMPSTEngineServiceConnectionEventObserver
       
   271 		/**
       
   272 		 * See MVIMPSTEngineServiceConnectionEventObserver
       
   273 		 */ 
       
   274 		void  HandleServceConnectionEventL();
       
   275 	
       
   276 	private:
       
   277 		/**
       
   278 		* Returns a SubService is Supported or not
       
   279 		* Components intertested in knowing whether a SubService is Supported or not can use this API
       
   280 		* @param aType - Type of the SubService TVIMPSTEnums::SubServiceType - Defined in tvimpstenums.h
       
   281 		* @return TBool, ETrue if the SubService is Supported in this Service, else returns EFalse
       
   282 		*/
       
   283 		TBool IsSubServiceSupportedInternal(TVIMPSTEnums::SubServiceType aType) const ;
       
   284 			
       
   285 	public:	    
       
   286 		 /**
       
   287           * Called when all the contacts are fetched from the virtual store.
       
   288           * 
       
   289           * @since s60 5.0
       
   290           */
       
   291          void HandleContactFetchedL();
       
   292               
       
   293  	public: // From MVIMPSTStorageContactsObserver
       
   294        
       
   295        
       
   296         /**
       
   297         * HandleChange: To handle the Chnage event from the MCAStoredContactsObserver
       
   298         * @see MCAStoredContactsObserver
       
   299         * @param aList: reference to the list at which a change has occured
       
   300         * @param aContact:  reference to the contact at which a change has occured
       
   301         * @param aEventType: TVIMPSTEnums::TCAObserverEventType,type of change event that has occured 
       
   302         * @param aUserIdChanged, ETrue if userid has changed, else EFalse.
       
   303         * @return void
       
   304         */
       
   305          void HandleStorageChangeL( TVIMPSTEnums::TVIMPSTStorgaeEventType aEventType,
       
   306          							MVIMPSTStorageContactList* aList, 
       
   307 	        						MVIMPSTStorageContact* aContact,
       
   308 	        						TInt aContactIndex );
       
   309 
       
   310 
       
   311          //From MVIMPSTEngineCchUiEventObserver
       
   312          /**
       
   313           * Handles the change connection event from CCHUI
       
   314           *@ return void
       
   315           */
       
   316          void HandleChangeConnectionEventL();
       
   317 
       
   318                                
       
   319 
       
   320 	private:		
       
   321 	   	
       
   322 	    /**
       
   323          * symbian second phase constructor
       
   324          * @param aServiceId service id
       
   325          */       
       
   326 		void ConstructL( TUint32 aServiceId );
       
   327 
       
   328 		/**
       
   329 		* C++ constructor.
       
   330 		*/
       
   331 		CVIMPSTEngine( TUint32 aServiceId, 
       
   332 					CVIMPSTEngineServiceTableFetcher& aTableFetcher );					
       
   333 		
       
   334 		
       
   335 		/**
       
   336 		* Parses and finds the Cumulative Service State of all Subservices
       
   337 		* @return TVIMPSTRegistrationState
       
   338 		*/
       
   339 		TVIMPSTEnums::TVIMPSTRegistrationState ParseGetServiceState();		
       
   340 	
       
   341 		/**
       
   342 		* Adds Extention Feature
       
   343 		* @param aFeature - Feature to be added
       
   344 		*/
       
   345 		void AddExtentionFeaturesL(MVIMPSTEngineExtentionFeatures* aFeature) ; 
       
   346 	
       
   347 		
       
   348 		/**
       
   349 		* Removes Extention Feature
       
   350 		* @param aFeature - Feature to be Removed
       
   351 		*/
       
   352 		void RemoveExtentionFeatures(TVIMPSTEnums::ExtentionType aType) ;
       
   353 		
       
   354 		
       
   355 		/**
       
   356 		* Creates a list of known extention features
       
   357 		* 
       
   358 		*/
       
   359 		void CreateExtentionFeaturesL();
       
   360 		
       
   361 		 /**
       
   362           * Sets the supported extension feature
       
   363           */
       
   364 		void SetExtentionFeaturesSupportedL();
       
   365 		
       
   366 		/**
       
   367           * ReSets the Support for all extension feature
       
   368           */
       
   369 		void ReSetExtentionFeaturesSupportedL();
       
   370 		
       
   371 	
       
   372 	
       
   373 							
       
   374 	private :
       
   375 		
       
   376 		//Service Id
       
   377 		TUint32 iServiceId;
       
   378 
       
   379 		//Settings Id
       
   380 		TUint32 iSettingsId;
       
   381 			
       
   382 		//doesnt own reference to servicetable entry
       
   383 		CVIMPSTEngineServiceTableFetcher& iTableFetcher;
       
   384 
       
   385 		//owns - service name
       
   386 		HBufC*   iServiceName;
       
   387 		
       
   388 		//Owns, ximpfw session context observer.
       
   389 		CVIMPSTEngineSessionCntxtObserver* iSessionCntxtObserver ;	
       
   390 		
       
   391 		//does not own reference to the contact list interface
       
   392 		MVIMPSTStorageServiceView* iContactInterface;
       
   393 
       
   394 		//owns pointer to subservice     
       
   395 		RPointerArray <MVIMPSTEngineSubService> iSubService;
       
   396 
       
   397 		// Own, cch handler for this service
       
   398 		CVIMPSTEngineCchHandler*    iCchHandler;
       
   399 
       
   400 		//owns pointer to subservice     
       
   401 		RPointerArray <MVIMPSTEngineExtentionFeatures> iExtentionFeatures;
       
   402 
       
   403 		// Doesnt Own, array of observers.
       
   404 		RPointerArray<MVIMPSTEngineServiceStateEventObserver> iObserverArray;
       
   405 		
       
   406 		//Owns Pointer to the ServiceState Listener
       
   407 
       
   408 		//Cumulative Service State of all SubServices Belonging to this Service
       
   409 		TVIMPSTEnums::TVIMPSTRegistrationState iState;
       
   410 	
       
   411 		//block list observer to notify the blocked list has been fetched.
       
   412 		MVIMPSTEngineBlockedListFetchEventObserver* iBlockListObs;
       
   413    
       
   414 	};
       
   415 
       
   416 #endif      //__CVIMPSTENGINE_H
       
   417 
       
   418 //  End of File
       
   419 
       
   420