clock/clockengines/clockserver/server/inc/clockserversession.h
changeset 18 c198609911f9
equal deleted inserted replaced
0:f979ecb2b13e 18:c198609911f9
       
     1 /*
       
     2 * Copyright (c) 2009 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 CClkSrvSession class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CLOCKSERVER_SESSION_H__
       
    19 #define __CLOCKSERVER_SESSION_H__
       
    20 
       
    21 // System includes
       
    22 #include <e32base.h>
       
    23 
       
    24 // User includes
       
    25 
       
    26 // Forward declaration
       
    27 class CClkSrvImpl;
       
    28 
       
    29 // Constants
       
    30 /**
       
    31 * @enum TSessionPendingFlags
       
    32 * @brief These flags hold the status of notification of the message.
       
    33 */
       
    34 enum TSessionPendingFlags
       
    35     {
       
    36     ENotifyMsgPending = 0x0001,
       
    37     EFirstChangeMsg = 0x0002
       
    38     };
       
    39 
       
    40 // Class declaration
       
    41 /**
       
    42 * @class CClkSrvSession
       
    43 * @brief A CSession2 derived object. Handles the communications of CClkSrvMain
       
    44 */
       
    45 class CClkSrvSession : public CSession2
       
    46 	{
       
    47 	public:			// New functions
       
    48 	
       
    49 		/**
       
    50 		* @brief The constructor
       
    51 		*/
       
    52 		CClkSrvSession( CClkSrvImpl* aClkSrvImpl );
       
    53 		
       
    54 		/**
       
    55 		* @brief The destructor
       
    56 		*/
       
    57 		~CClkSrvSession();
       
    58 		
       
    59 	public:			// New functions		
       
    60 		
       
    61 		/**
       
    62 		* @brief Returns the offset to the link member.
       
    63         * @return TInt
       
    64         */
       
    65         static TInt LinkOffset();
       
    66         
       
    67         /**
       
    68         * @brief Notifies the client about change in the server data.
       
    69         * @param aWhatChanged This indicates what was changed.
       
    70         * @param aWhoChanged The entity which caused the change. Will usually be the plug-in id.
       
    71         * @param aNotification KErrNone if there was no error.
       
    72         */
       
    73         void NotifyAboutChange( TInt32 aWhatChanged, TInt32 aWhoChanged, TInt aNotification );
       
    74 		
       
    75 	public:			// From base classes
       
    76 		
       
    77 		/**
       
    78 		* @brief From CSession2. Called when client requests for a service.
       
    79 		* @param aMessage of type RMessage2, contains the client data.
       
    80 		*/
       
    81 		void ServiceL( const RMessage2& aMessage );
       
    82 		
       
    83 	private:		// New functions
       
    84 	
       
    85 		/**
       
    86 		* @brief Handles the servicing of client requests.
       
    87 		* @param aMessage Of type RMessage2, contains the client data.
       
    88 		* @return TInt The error code.
       
    89 		*/
       
    90 		TInt DoServiceL( const RMessage2& aMessage );
       
    91 		
       
    92 		/**
       
    93 		* @brief Calls the server implementation to activate the protocol with the id mentioned
       
    94 		*		 in the message.
       
    95 		* @param aMessage Of type RMessage2, contains the client data.
       
    96 		* @return TInt The error code.
       
    97 		*/
       
    98 		TInt DoActivateProtocolL( const RMessage2& /*aMessage*/ );
       
    99 		
       
   100 		/**
       
   101 		* @brief Calls the server implementation to check if the protocol with the id mentioned
       
   102 		*		 in the message is active.
       
   103 		* @param aMessage Of type RMessage2, contains the client data.
       
   104 		* @return TInt The error code.
       
   105 		*/
       
   106 		TInt DoCheckProtocolActiveL( const RMessage2& aMessage );
       
   107 		
       
   108 		/**
       
   109 		* @brief Calls the server implementation to deactivate a protocol.
       
   110 		* @param aMessage Of type RMessage2, contains the client data.
       
   111 		* @return TInt The error code.
       
   112 		*/
       
   113 		TInt DoDeActivateProtocolL( const RMessage2& /*aMessage*/ );
       
   114 		
       
   115 		/**
       
   116 		* @brief Calls the server implementation to get the protocol information.
       
   117 		* @param aMessage Of type RMessage2, contains the client data.
       
   118 		* @return TInt The error code.
       
   119 		*/
       
   120 		TInt DoGetProtocolInfoL( const RMessage2& aMessage );
       
   121 		
       
   122 		/**
       
   123 		* @brief Calls the server implementation to get the current mcc.
       
   124 		* @param aMessage Of type RMessage2, contains the client data.
       
   125 		* @return TInt The error code.
       
   126 		*/
       
   127 		TInt DoGetCurrentMccL( const RMessage2& aMessage );
       
   128 		
       
   129 		/**
       
   130 		* @brief Calls the server implementation to get the current timezone Id.
       
   131 		* @param aMessage Of type RMessage2, contains the client data.
       
   132 		* @return TInt The error code.
       
   133 		*/
       
   134 		TInt DoGetCurrentTimeZoneIdL( const RMessage2& aMessage );
       
   135 		
       
   136 		/**
       
   137 		* @brief Sets the message for notification later.
       
   138 		* @param aMessage Of type RMessage2, contains the client data.
       
   139 		*/
       
   140 		void DoNotifyOnChange( const RMessage2& aMessage );
       
   141 		
       
   142 		/**
       
   143 		* @brief Calls the server implementation to check if any protocols are active.
       
   144         * @param aMessage Of type RMessage2, contains the client data.
       
   145         * @return TInt The error code.
       
   146         */
       
   147 		TInt DoCheckAutoTimeUpdateOn( const RMessage2& aMessage );
       
   148 		
       
   149 		/**
       
   150 		* @brief Stores the message for notification later.
       
   151 		* @param aMessage Of type RMessage2, contains the client data.
       
   152 		*/
       
   153 		void SetNotifyMessagePtr( const RMessage2& aMessage );
       
   154 		
       
   155 		/**
       
   156 		* @brief Returns whether this session is the fisrt requst of notification.
       
   157 		* @return ETrue if the Session is the first request.
       
   158 		*/
       
   159 		TBool FirstNotifyRequest() const;
       
   160 		
       
   161 		/**
       
   162 		* @brief Returs if the notification is still pending.
       
   163 		* @return ETrue if the Client is yet to be notified.
       
   164 		*/
       
   165 		TBool NotifyPending() const;
       
   166 		
       
   167 	private:		// Data
       
   168 	
       
   169 		/**
       
   170 		* @var iSessionLink 
       
   171 		* @brief The Session link.
       
   172 		*/
       
   173 		TDblQueLink 				iSessionLink;
       
   174 		
       
   175 		/**
       
   176 		* @var iClkSrvImpl 
       
   177 		* @brief Passed on by the server. Does the actual service. Not owned.
       
   178 		*/
       
   179 		CClkSrvImpl* 				iClkSrvImpl;
       
   180 		
       
   181 		/**
       
   182 		* @var iNotifyChangeMsg 
       
   183 		* @brief Used to notify the client about change in the server data.
       
   184 		*/
       
   185 		RMessagePtr2 				iNotifyChangeMsg;
       
   186 		
       
   187 		/**
       
   188 		* @var iMsgPendingFlags 
       
   189 		* @brief Has the status of notification of the message.
       
   190 		*/
       
   191 		TInt    					iMsgPendingFlags;
       
   192 		
       
   193 		/**
       
   194 		* @var iMessageComplete
       
   195 		* @brief This indicates that the message has been Completed by the server.
       
   196 		*/
       
   197 		TBool						iMessageComplete;
       
   198 		
       
   199 	};
       
   200 
       
   201 #endif 		// __CLOCKSERVER_SESSION_H__
       
   202 
       
   203 // End of file