imstutils/imconversationview/imcvuiengine/inc/cimcvengine.h
branchRCL_3
changeset 22 3104fc151679
parent 21 2b7283837edb
child 23 9a48e301e94b
equal deleted inserted replaced
21:2b7283837edb 22:3104fc151679
     1 /*
       
     2 * Copyright (c) 2007-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:  owner class of this dll
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CIMCVENGINE_H
       
    19 #define CIMCVENGINE_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include  <e32base.h>
       
    23 
       
    24 #include <ximpclient.h>
       
    25 #include <ximpcontext.h>
       
    26 #include <ximpcontextobserver.h>
       
    27 #include <ximpcontextstate.h>
       
    28 #include "mimcvenginecchhandler.h"
       
    29 #include "mimcvengineopenchats.h"
       
    30 #include "mimcvenginecchobserver.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 
       
    34 class   MIMCVEngineChatInterface;
       
    35 class   CIMCVEngineMessageHandler;
       
    36 class   MIMCVEngineMessageCreator;
       
    37 class 	CIMCVEngineContextObserver;
       
    38 class 	MIMCVEngineMessageHandler;
       
    39 class 	MIMCVEngineConnectionHandler;
       
    40 class   CIMCVEngineCchHandler;
       
    41 class   MBSAccess;
       
    42 class   CBSFactory;
       
    43 class   CGulIcon;
       
    44 class   CFbsBitmap;
       
    45 class  CIMCVEngineFetchSmiley;
       
    46 /**
       
    47  *  CIMCVEngine provides one of the interfaces to the engine.
       
    48  *  This interface is used by UI to access network services i.e.
       
    49  *  sending messages and joining to groups e.g. This class is
       
    50  *  also used to get different interfaces to the services
       
    51  *  offered by the imcvengine.dll.
       
    52  *
       
    53  *  @lib imcvengine.lib
       
    54  *  @since 5.0
       
    55  */
       
    56 class CIMCVEngine : public CActive,
       
    57                     public MIMCVEngineCCHObserver
       
    58     {
       
    59     
       
    60     //from MIMCVEngineCCHObserver
       
    61     void ServiceStatusChanged( TInt aServiceId,     								   
       
    62 	                          TServiceState aServiceStatus );	                                 
       
    63     
       
    64     
       
    65     private:
       
    66 	/**
       
    67          * Issues Request
       
    68          */
       
    69     	void IssueRequest();
       
    70     	 		
       
    71     public:  // Constructors and destructor
       
    72 
       
    73         /**
       
    74          * Two-phased constructor.         
       
    75          */
       
    76         static CIMCVEngine* NewL(TInt aServiceId, 
       
    77                 MIMCVEngineMessageCreator& aMessageCreater, 
       
    78                 CBSFactory& aBrandingFactory);
       
    79 
       
    80         /**
       
    81          * Destructor.
       
    82          */
       
    83          virtual ~CIMCVEngine();
       
    84  
       
    85     
       
    86         /**
       
    87          * Get interface for chat interface.
       
    88          */         
       
    89         IMPORT_C MIMCVEngineChatInterface& ChatInterface() const;
       
    90         
       
    91         
       
    92         /**
       
    93          * Get interface to message handler 
       
    94          */
       
    95 		IMPORT_C MIMCVEngineMessageHandler& MessageHandler() const ;
       
    96    
       
    97 	    /**
       
    98          * IsLoggedIn 
       
    99          * Return ETrue if loggedin else EFalse
       
   100          */
       
   101         IMPORT_C TBool IsLoggedIn() const;
       
   102         
       
   103         /**
       
   104          * GetLoggedInUserId 
       
   105          * Return logged in user id 
       
   106          */
       
   107         IMPORT_C const TDesC& GetLoggedInUserId()  ;
       
   108         
       
   109         /**
       
   110          * ReleaseConnectionL 
       
   111          * Release the connection from server
       
   112          */
       
   113        	IMPORT_C void ReleaseConnectionL() ;
       
   114        
       
   115           
       
   116         /**
       
   117          * Checks engine if its ready for shutdown.
       
   118          * @return ETrue if ready.
       
   119          */
       
   120         IMPORT_C TBool ReadyForShutdown();
       
   121 
       
   122     	
       
   123 		/**
       
   124 		* DeleteContextL 
       
   125 		*/
       
   126  		void DeleteContextL() ;
       
   127 
       
   128 		/**
       
   129 		* CreateContextL 
       
   130 		*/
       
   131  		void CreateContextL() ;
       
   132 	
       
   133  		 /**
       
   134           * GetLoggedInUserId 
       
   135           * Return logged in user id 
       
   136           */
       
   137         IMPORT_C const TDesC8& GetBrandId()  ;
       
   138         
       
   139         /**
       
   140          * Get Service Specific Array of Smiley Strings 
       
   141          * Return array
       
   142          * ownership not transferred
       
   143          */
       
   144         IMPORT_C RPointerArray<HBufC> GetSmileStringArray();
       
   145         
       
   146         /**
       
   147          * Get Service Specific Icon Array of Smiley's 
       
   148          * Return array
       
   149          * ownership not transferred
       
   150          */        
       
   151         IMPORT_C RPointerArray<CGulIcon> GetSmileyIconArray();
       
   152         
       
   153         
       
   154         IMPORT_C CGulIcon* GetPresenceIconL(const TDesC8& aIconid);
       
   155  		        
       
   156        /**
       
   157         * GetLoggedInUserId 
       
   158         * Return logged in user id 
       
   159         */
       
   160         IMPORT_C TInt GetLanguageId()  ;
       
   161         
       
   162         
       
   163        /**
       
   164         * CCHHandler 
       
   165         * Returns handler to CCH 
       
   166         */
       
   167         IMPORT_C MIMCVEngineCchHandler& CCHHandler() ;
       
   168         
       
   169         
       
   170         /**
       
   171         * ServiceName 
       
   172         * Returns Name of the Service
       
   173         */                
       
   174 		IMPORT_C const TDesC& ServiceName() ;
       
   175 		
       
   176 		
       
   177 		/**
       
   178         * Returns the M-Interface class for list of Open Conversations 
       
   179         * Returns MIMCVEngineOpenChats
       
   180         */
       
   181 		IMPORT_C MIMCVEngineOpenChats& OpenChats() ;
       
   182 		
       
   183 		
       
   184 		/**
       
   185         * ServiceId 
       
   186         * Returns Service Id of the Engine
       
   187         */
       
   188 		IMPORT_C TInt GetServiceId() ;
       
   189 		
       
   190 		
       
   191 		/**
       
   192 		* Resolves the CCH service state to and does a bindl to
       
   193 		* ximpfw if required.
       
   194 		*/
       
   195 		IMPORT_C void ResolveServiceStateL();		
       
   196 		
       
   197 		/**
       
   198 		* Login to the Service
       
   199 		* 
       
   200 		*/
       
   201 		IMPORT_C TInt LoginL();
       
   202 		
       
   203 		/**
       
   204          * CreateConnectionL
       
   205         */
       
   206 		void CreateConnectionL() ;
       
   207 		
       
   208 		/*
       
   209 		 * close all open chats
       
   210 		 */
       
   211 		void CloseAllOpenChatsL();
       
   212 		
       
   213 	    /**
       
   214 	         * Check whether the service is VOIP Enabled Service
       
   215 	         *
       
   216 	         * @since S60 5.0
       
   217 	         * @return ETrue/EFalse
       
   218 	         */
       
   219 		IMPORT_C TBool IsVoipServiceL();
       
   220 		
       
   221 	private:
       
   222 
       
   223         /**
       
   224          * By default Symbian OS constructor is private.
       
   225          */
       
   226         void ConstructL(MIMCVEngineMessageCreator& aMessageCreater );
       
   227 
       
   228         /**
       
   229          * C++ default constructor.
       
   230          * @see CIMCVEngine::NewL.
       
   231          */
       
   232         CIMCVEngine(TInt aServiceId,CBSFactory& aBrandingFactory);
       
   233 		
       
   234 		
       
   235 		/**
       
   236          * Returns property brand language.
       
   237          *
       
   238          * @since S60 5.0
       
   239          * @param aServiceId, service id
       
   240          * @return TLanguage, brand language
       
   241          */        
       
   242         TLanguage PropertyBrandLanguageL( 
       
   243             TUint32 aServiceId );
       
   244 
       
   245 
       
   246 		/**
       
   247          * Gets brand id
       
   248          *
       
   249          * @since S60 5.0
       
   250          * @param aServiceId service id
       
   251          * @param aBrandId brand id
       
   252          * @return None
       
   253          */
       
   254         void GetBrandIdL( TUint32 aServiceId, TDes8& aBrandId );
       
   255 
       
   256 		/**
       
   257          * Gets the Settings ID
       
   258          *
       
   259          * @since S60 5.0
       
   260          * @param aServiceId, service id         
       
   261          * @return settings id
       
   262          */						
       
   263 		TInt PropertySettingsIdL( TUint32 aServiceId );	
       
   264 		
       
   265 		
       
   266 		/**
       
   267          * Gets the User Id ID
       
   268          *
       
   269          * @since S60 5.0
       
   270          * @param aUserId holds the user id    
       
   271          * @return None
       
   272          */
       
   273 		void GetUserIdL(TPtr& aUserId ) ;
       
   274 		
       
   275 		/**
       
   276          * Gets the ServiceName
       
   277          *
       
   278          * @since S60 5.0
       
   279          * @param aServiceId, service id 
       
   280          * @param aServiceName holds the ServiceName    
       
   281          * @return None
       
   282          */
       
   283 		void GetServiceNameL( TUint32 aServiceId, TDes& aServiceName );
       
   284 		/**
       
   285 		 *consturct's the brandaccess specific to service engine
       
   286 		 */
       
   287 		void ConstructBrandL();
       
   288 		
       
   289 		/**
       
   290 		 *utility function to parse the smiley string received from branding server
       
   291 		 * for example if smiley string is  ":-) [8]"
       
   292 		 * it forms an array of each smiley string 
       
   293 		 */
       
   294 		void ParseAllSmileyStringL(TInt aTotalCount, const TDesC& aAllSmileyString);
       
   295 	
       
   296 	private: // From CActive
       
   297         void RunL();
       
   298         void DoCancel();
       
   299         TInt RunError(
       
   300                 TInt aError );
       
   301                 	
       
   302     private:    // Data
       
   303     
       
   304     	/// Process states
       
   305         enum TState
       
   306             {
       
   307             ELogin,                        
       
   308             EOperationComplete,
       
   309             EOperationInComplete
       
   310             };
       
   311         
       
   312                 
       
   313 		// service id to use
       
   314 		TInt iServiceId;
       
   315 		
       
   316 			// own user id
       
   317 		HBufC* iOwnUserId;
       
   318 		
       
   319 		//  Owns,Settings id of the service..
       
   320         HBufC8* iBrandId;
       
   321 
       
   322         // Language id
       
   323         TInt iLanguageId; 
       
   324 		
       
   325 	    // Owns , reference to message handler
       
   326         CIMCVEngineMessageHandler*      iMessageHandler;
       
   327        
       
   328       
       
   329         //owned, Chat interface
       
   330         MIMCVEngineChatInterface* iChatInterface;
       
   331         
       
   332         // own , client for ximp framework
       
   333 		MXIMPClient*               		  iClient;
       
   334 		// own ,presence context to ximp framework
       
   335 		MXIMPContext*     		  iPresenceContext;
       
   336 		
       
   337 		//owned, observre for ximp call back
       
   338 		CIMCVEngineContextObserver* iContextEventObserver;
       
   339 		
       
   340 		//Stores the XIMPFw EventTypes Subscribed for		
       
   341 		RArray< TInt32 > iAcceptedEventTypes;
       
   342 	
       
   343 		//owns the handler for CCH
       
   344 		CIMCVEngineCchHandler* iCCHHandler;
       
   345 		
       
   346 		//Owns the ServiceName
       
   347 		HBufC* iServiceName;
       
   348 		
       
   349 		/// Own: State of the command
       
   350         TState iState;  
       
   351         
       
   352         // own active sheduler 
       
   353         CActiveSchedulerWait    iWait;      
       
   354         //doesn't own
       
   355         CBSFactory& iBrandingFactory;
       
   356                   
       
   357         //owns: branding access specific to service
       
   358         MBSAccess* iBrandingAccess;
       
   359         // not owned array of smiley strings
       
   360         RPointerArray<HBufC> iSmileyArray; 
       
   361         // not owned ,array of smiley icons
       
   362         RPointerArray<CGulIcon> iSmileyDlgIconArray;
       
   363         // ETrue if array owned
       
   364         TBool iSmileyArrayOwned;
       
   365         // ETrue if array owned
       
   366         TBool iSmileyDlgIconArrayOwned;
       
   367     };
       
   368 
       
   369 #endif      // CIMCVENGINE_H
       
   370 
       
   371 // End of File