clock2/clockengines/clockserver/server/inc/clockserverimpl.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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:   The header file of the CClkSrvImpl class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CLOCKSERVER_IMPL_H__
       
    19 #define __CLOCKSERVER_IMPL_H__
       
    20 
       
    21 // System includes
       
    22 #include <e32base.h>
       
    23 #include <e32cmn.h>
       
    24 #include <etelmm.h>
       
    25 #include <ecom/implementationinformation.h>
       
    26 
       
    27 // User includes
       
    28 #include "clockpluginobserver.h"
       
    29 #include "clockservermccobserver.h"
       
    30 #include "clockecomobserver.h"
       
    31 
       
    32 // Forward declarations
       
    33 class CClockTimeSourceInterface;
       
    34 class CClkSrvMain;
       
    35 class CClkMccListener;
       
    36 class CClockTimeZoneResolver;
       
    37 class CClockEComListener;
       
    38 
       
    39 // Class declaration
       
    40 /**
       
    41 * @class CClkSrvImpl
       
    42 * @brief Performs the actual service requested by the client.
       
    43 *		 Owned by CClkSrv and used by CClkSrvSession.
       
    44 */
       
    45 class CClkSrvImpl : public CBase,
       
    46 						   MClockPluginObserver,
       
    47 						   MClkSrvMccObserver,
       
    48 						   MClockEComObserver
       
    49 	{
       
    50 	
       
    51 	public:				// New functions
       
    52 		
       
    53 		/**
       
    54 		* @brief Two phased constructor
       
    55 		* @return CClkSrvImpl* Pointer to an object of CClkSrvImpl
       
    56 		*/
       
    57 		static CClkSrvImpl* NewL( CClkSrvMain* aClkSrv );
       
    58 
       
    59 		/**
       
    60 		* @brief Destructor.
       
    61 		*/
       
    62 		~CClkSrvImpl();
       
    63 		
       
    64 	public:				// New functions
       
    65 	
       
    66 	    /**
       
    67 		* @brief Activates all the given protocols.
       
    68 		* @return An error code
       
    69 		*/
       
    70 		TInt ActivateAllProtocolsL();
       
    71 		
       
    72 		/**
       
    73 		* @brief Activates the given protocol
       
    74 		* @param aClkSrvProtocol The protocol to be activated.
       
    75 		* @return An error code
       
    76 		*/
       
    77 		TInt ActivateProtocolL( TInt aClkSrvProtocol );
       
    78 		
       
    79 		/**
       
    80 		* @brief Checks if aClkSrvProtocol is Active or not
       
    81 		* @param aIsActive Reference argument, ETrue if aClkSrvProtocol is active, EFalse otherwise.
       
    82 		* @param aClkSrvProtocol The protocol.
       
    83 		* @return An error code
       
    84 		*/
       
    85 		TInt IsProtocolActive( TBool& aIsActive, TInt aClkSrvProtocol = 0 );
       
    86 		
       
    87 		/**
       
    88 		* @brief Deactivate all the installed protocol.
       
    89 		* @return An error code
       
    90 		*/
       
    91 		TInt DeActivateAllProtocolsL();
       
    92 		
       
    93 		/**
       
    94 		* @brief Deactivates the given protocol.
       
    95 		* @param aClkSrvProtocol The protocol.
       
    96 		* @return An error code
       
    97 		*/
       
    98 		TInt DeActivateProtocolL( TInt aClkSrvProtocol );
       
    99 		
       
   100 		/**
       
   101 		* @brief Returns the time information
       
   102 		* @param aTimeInformation A reference to an object of STimeAttributes.
       
   103 		* @return An error code
       
   104 		*/
       
   105 		TInt GetProtocolInformationL( STimeAttributes& aTimeInformation );
       
   106 		
       
   107 		/**
       
   108 		* @brief Returns the current mcc
       
   109 		* @param aCurrentMcc A reference variable holding the current mcc value.
       
   110 		* @return An error code
       
   111 		*/		
       
   112 		TInt GetCurrentMccL( TInt& aCurrentMcc );
       
   113 		
       
   114 		/**
       
   115 		* @brief Returns the current timezone Id
       
   116 		* @param aCurrentTimeZoneId A reference variable holding the current timezone Id value.
       
   117 		* @return An error code
       
   118 		*/
       
   119 		TInt GetCurrentTimeZoneIdL( TInt& aCurrentTimeZoneId );
       
   120 		
       
   121 		/**
       
   122 		* @brief Checks if any protocols have been enabled.
       
   123 		* @param aEnabled ETrue if atleast one protocol is active, EFalse otherwise.
       
   124 		* @return TInt Error code.
       
   125 		*/
       
   126 		TInt IsAutoTimeUpdateOn( TBool& aEnabled );
       
   127 
       
   128 	public:				// From base classes
       
   129 		
       
   130 		/**
       
   131 		* @brief From MTimeSourceObserver. This gets called by one of the time source plugins, when they have
       
   132 		*		 a time update.
       
   133 		*/
       
   134 		void NotifyTimeChangeL( CClockTimeSourceInterface& aPluginImpl );
       
   135 		
       
   136 		/**
       
   137 		* @brief From MClkSrvMccObserver. Called by CClkMccListener when Mcc is available or there is a 
       
   138 		*		 change in the mcc.
       
   139 		*/
       
   140 		void NotifyMccChangeL();
       
   141 		
       
   142 		/**
       
   143 		* @brief From MClockEComObserver. Called whenever the a new timesource plugin gets installed or uninstalled.
       
   144 		* @param aImplInfo The information of the plugin which got installed or uninstalled.
       
   145 		* @param aInstalled ETrue if a plugin has been installed, EFalse otherwise.
       
   146 		*/
       
   147 		void NotifyPluginInstallUninstallL( const CImplementationInformation& aImplInfo, TBool aInstalled );
       
   148 
       
   149 	private:			// New functions
       
   150 		
       
   151 		/**
       
   152 		* @brief Performs the second phase of construction
       
   153 		*/
       
   154 		void ConstructL();
       
   155 		
       
   156 		/**
       
   157 		* @brief The C++ default constructor
       
   158 		*/
       
   159 		CClkSrvImpl( CClkSrvMain* aClkSrv );
       
   160 
       
   161 	private:			// Data
       
   162 
       
   163 		/**
       
   164 		* @var iTimeSourceObjArray
       
   165 		* @brief Pointer to the CClockTimeSourceInterface Array.
       
   166 		*/
       
   167 		RPointerArray<CClockTimeSourceInterface>        iTimeSourceObjArray;
       
   168 		
       
   169 		/**
       
   170 		* @var iClkSrv
       
   171 		* @brief Pointer to the clock server object. Not owned.
       
   172 		*/
       
   173 		CClkSrvMain*									iClkSrv;
       
   174 		
       
   175 		/**
       
   176 		* @var iMccListener
       
   177 		* @brief Pointer to the Mcc listener object. Owned.
       
   178 		*/
       
   179 		CClkMccListener*								iMccListener;
       
   180 		
       
   181 		/**
       
   182 		* @var iMccListener
       
   183 		* @brief Pointer to the Mcc listener object. Owned.
       
   184 		*/
       
   185 		RMobilePhone::TMobilePhoneNetworkCountryCode	iMcc;
       
   186 		
       
   187 		/**
       
   188 		* @var iTimeAttributes
       
   189 		* @brief Object of type struct STimeAttribute, holds the time and offset related information.
       
   190 		*/
       
   191 		STimeAttributes*								iTimeAttributes;
       
   192 		
       
   193 		/**
       
   194 		* @var iMccReceived
       
   195 		* @brief ETrue if MCC is received.
       
   196 		*/
       
   197 		TBool											iMccReceived;
       
   198 		
       
   199 		/**
       
   200 		* @var iPluginData
       
   201 		* @brief ETrue if we have data from plugins.
       
   202 		*/
       
   203 		TBool 											iPluginData;
       
   204 		
       
   205 		/**
       
   206 		* @var iTzResolver 
       
   207 		* @brief Resolver of type CTimezoneResolver.
       
   208 		*/
       
   209 		CClockTimeZoneResolver*							iTzResolver;
       
   210 		
       
   211 		/**
       
   212 		* @var iTimeZoneId
       
   213 		* @brief Hold the current timezone Id.
       
   214 		*/
       
   215 		TInt											iTimeZoneId;
       
   216 		
       
   217 		/**
       
   218         * @var iClockEComListener
       
   219         * @brief Listens for changes in the ECOM registry.
       
   220         */
       
   221 		CClockEComListener*                             iClockEComListener;
       
   222 	};
       
   223 
       
   224 
       
   225 #endif			// __CLOCKSERVER_IMPL_H__
       
   226 
       
   227 // End of file