servicewidget/servicewidgetdatapublisher/inc/cservicewidgetcchhandler.h
branchRCL_3
changeset 23 9a48e301e94b
parent 0 5e5d6b214f4f
equal deleted inserted replaced
22:3104fc151679 23: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 for cch service handling
       
    15  *                
       
    16  *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CSERVICEWIDGETCCHHANDLER_H
       
    21 #define CSERVICEWIDGETCCHHANDLER_H
       
    22 
       
    23 #include <cch.h>
       
    24 #include <cchclient.h>
       
    25 #include <cchtypes.h>
       
    26 #include <cchuiobserver.h>
       
    27 #include "servicewidgetcpglobals.h"
       
    28 #include "servicewidgetenums.hrh"
       
    29 
       
    30 // farword declarations
       
    31 class MServiceWidgetServiceStateObserver;
       
    32 /**
       
    33  * @class cch handler class implementation
       
    34  * @since 5.0
       
    35  */
       
    36 struct TSubServiceState
       
    37 	{
       
    38 	TCCHSubserviceType iSubServiceType; /* subservice type(IM/VOIP/PRESENCE */
       
    39 	TSWSTRegistrationState iSubServiceState; /* observer */
       
    40 	}; 
       
    41 
       
    42 class CServiceWidgetCchHandler  : public CBase,
       
    43                              	  public MCchServiceStatusObserver
       
    44 	{
       
    45 
       
    46 	public:
       
    47 
       
    48 		/**
       
    49 		* Two-phased constructor.
       
    50 		* @param aServiceId, service id
       
    51 		* @param aContentPrioritizer, service state observer
       
    52 		* @return the instance of this class
       
    53 		*/
       
    54 		static CServiceWidgetCchHandler* NewL( TUint32 aServiceId,
       
    55 												MServiceWidgetServiceStateObserver& aContentPrioritizer );
       
    56 
       
    57 		/**
       
    58 		* Two-phased constructor.
       
    59 		* @param aServiceId, service id
       
    60 		* @param aContentPrioritizer, service state observer
       
    61 		* @return the instance of this class
       
    62 		*/
       
    63 		static CServiceWidgetCchHandler* NewLC( TUint32 aServiceId,
       
    64 												MServiceWidgetServiceStateObserver& aContentPrioritizer );
       
    65 
       
    66 		/**
       
    67 		* Standard C++ destructor
       
    68 		*/    
       
    69 		~CServiceWidgetCchHandler();
       
    70 
       
    71 	public: // new methods
       
    72 
       
    73 		/**
       
    74 		* @return own user id
       
    75 		*/ 
       
    76 		const TDesC& OwnUserIdL();
       
    77 
       
    78 		/**
       
    79 		* @return own user id
       
    80 		*/ 
       
    81 		TInt XimpAdaptationUidL();
       
    82 
       
    83 		/**
       
    84 		* @param aSubServiceType, a sub service type
       
    85 		* @return ETrue if service supported 
       
    86 		*/
       
    87 		TBool IsSubServiceSupported(TCCHSubserviceType aSubServiceType );
       
    88 
       
    89 	
       
    90 		/**
       
    91 		* read the supported sub service of selected service 
       
    92 		*/
       
    93 		void ReadSupportedSubServices(); 
       
    94 		
       
    95 		
       
    96 		/**
       
    97 		* mapped the cch state to local state 
       
    98 		* @param aState ,cch state
       
    99 		* @return mapped state
       
   100 		*/ 
       
   101 		TSWSTRegistrationState ParseGetServiceState();
       
   102 
       
   103 		/**
       
   104 		 *  @return tabview id if service installed else NULL
       
   105 		 */ 
       
   106 		TInt GetServiceViewIdL( TInt& aTabUid );
       
   107 		
       
   108 		/**
       
   109 		 *  @returns true if service logged in successfully else KErrNotFound
       
   110 		 */ 
       
   111 		TInt EnableServiceL( );
       
   112 
       
   113 	public: // method from MCchServiceObserver
       
   114 
       
   115 		/**
       
   116 		* Signaled when service status or error changes
       
   117 		*
       
   118 		* @param aServiceId Id of the service
       
   119 		* @param aType Service type
       
   120 		* @param aServiceStatus Service status
       
   121 		*/
       
   122 		void ServiceStatusChanged(TInt aServiceId,
       
   123 								const TCCHSubserviceType aType,
       
   124 								const TCchServiceStatus& aServiceStatus );
       
   125 	
       
   126     private: // Implementation
       
   127 
       
   128 		/**
       
   129 		* Standard C++ constructor
       
   130 		* @param aServiceId, service id
       
   131 		* @param aContentPrioritizer, service state observer
       
   132 	    */
       
   133 		CServiceWidgetCchHandler(TUint32 aServiceId,
       
   134 								 MServiceWidgetServiceStateObserver& aContentPrioritizer );
       
   135 
       
   136 		/**
       
   137 		* Performs the 2nd phase of construction.
       
   138 		*/        
       
   139 		void ConstructL();
       
   140 
       
   141 		/**
       
   142 		* read the own status from the xmmp
       
   143 		* @return the own status
       
   144 		*/ 
       
   145 		HBufC* GetConParametersL( TCchConnectionParameter aConnParam ); 
       
   146 		
       
   147 		/**
       
   148 		* mapped the cch state to local state 
       
   149 		* @param aState ,cch state
       
   150 		* @return mapped state
       
   151 		*/ 
       
   152 		TSWSTRegistrationState GetLocalServiceState(TCCHSubserviceState aState );
       
   153 		
       
   154 		/**
       
   155 		* @return service state
       
   156 		*/
       
   157 		TSWSTRegistrationState GetServiceState( TCCHSubserviceType aServiceType );
       
   158 		
       
   159 		/**
       
   160 		* check from cch service  
       
   161 		* @param aSubServiceType ,a sub service type
       
   162 		* @return ETrue if supported
       
   163 		*/ 
       
   164 		TBool IsServiceSupported(TCCHSubserviceType aSubServiceType );
       
   165 
       
   166 	private: // Data
       
   167 		//owns : serviceid       
       
   168 		TInt iServiceId;
       
   169 		// not owns : reference to state observer
       
   170 		MServiceWidgetServiceStateObserver& iStateObserver; 
       
   171 		//owns : reference to cch 
       
   172 		CCch*   iCchClient;     
       
   173 		//owns : own user id
       
   174 		HBufC* iOwnData;
       
   175 		// owns : service name 
       
   176 		HBufC* iServiceName;
       
   177 		// owns : xmpp parameters
       
   178 		TSWSTRegistrationState iServiceState;
       
   179 		 // does not own array of observers.
       
   180         RArray<TSubServiceState> iSupportedSubServices;
       
   181 	};
       
   182 
       
   183 #endif /*CSERVICEWIDGETCCHHANDLER_H*/