examples/SDKExamples/ClientServerAsync/server/inc/timeserver.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : timeserver.h
00004 *  Part of     : CSAsync
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
00010 *  All rights reserved.
00011 *  This component and the accompanying materials are made available
00012 *  under the terms of "Eclipse Public License v1.0"
00013 *  which accompanies this distribution, and is available
00014 *  at the URL "http://www.eclipse.org/legal/epl-v10.html".
00015 * ==============================================================================
00016 */
00017 
00018 
00019 #ifndef __CTIMESERVER_H__
00020 #define __CTIMESERVER_H__
00021 
00022 // INCLUDE FILES
00023 #include <e32base.h>
00024 #include "AsyncServer.pan"
00025 
00026 // CLASS DECLARATION
00032 class CTimeServer : public CServer2, public MBeating
00033     {
00034     public : // Constructors and destructors
00035 
00041         static CTimeServer* NewL();
00042 
00048         static CTimeServer* NewLC();
00049 
00054         virtual ~CTimeServer();
00055 
00056     public: // New functions
00057 
00065         static TInt ThreadFunction( TAny* aStarted );
00066 
00071         void IncrementSessions();
00072 
00078         void DecrementSessions();
00079 
00084         void WaitForTickL();
00085 
00086     public: // Functions from base classes
00087 
00092         void Beat();
00093 
00098         void Synchronize();
00099 
00100     protected: // Functions from base classes
00101 
00108         TInt RunError( TInt aError );
00109 
00110     private: // Constructors and destructors
00111 
00117         CTimeServer( TInt aPriority );
00118 
00123         void ConstructL();
00124 
00125     private: // New methods
00126 
00133         static void PanicClient( const RMessage2& aMessage,
00134                                  TTimeServPanic aReason );
00135 
00141         static void PanicServer( TTimeServPanic aPanic );
00142 
00147         static void ThreadFunctionL();
00148 
00153         void SendTimeToSessions();
00154 
00155     private: // Functions from base classes
00156 
00164         CSession2* NewSessionL( const TVersion& aVersion, 
00165                                 const RMessage2& aMessage ) const;
00166 
00167     private: // Data
00168 
00172         TInt iSessionCount;
00173 
00178         CHeartbeat* iHeartbeat;
00179     };
00180 
00181 #endif // __CTIMESERVER_H__
00182 
00183 // End of File

Generated by  doxygen 1.6.2