examples/S60CppExamples/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.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 
00017 #ifndef __CTIMESERVER_H__
00018 #define __CTIMESERVER_H__
00019 
00020 // INCLUDE FILES
00021 #include <e32base.h>
00022 #include "AsyncServer.pan"
00023 
00024 // CLASS DECLARATION
00030 class CTimeServer : public CServer2, public MBeating
00031     {
00032     public : // Constructors and destructors
00033 
00039         static CTimeServer* NewL();
00040 
00046         static CTimeServer* NewLC();
00047 
00052         virtual ~CTimeServer();
00053 
00054     public: // New functions
00055 
00063         static TInt ThreadFunction( TAny* aStarted );
00064 
00069         void IncrementSessions();
00070 
00076         void DecrementSessions();
00077 
00082         void WaitForTickL();
00083 
00084     public: // Functions from base classes
00085 
00090         void Beat();
00091 
00096         void Synchronize();
00097 
00098     protected: // Functions from base classes
00099 
00106         TInt RunError( TInt aError );
00107 
00108     private: // Constructors and destructors
00109 
00115         CTimeServer( TInt aPriority );
00116 
00121         void ConstructL();
00122 
00123     private: // New methods
00124 
00131         static void PanicClient( const RMessage2& aMessage,
00132                                  TTimeServPanic aReason );
00133 
00139         static void PanicServer( TTimeServPanic aPanic );
00140 
00145         static void ThreadFunctionL();
00146 
00151         void SendTimeToSessions();
00152 
00153     private: // Functions from base classes
00154 
00162         CSession2* NewSessionL( const TVersion& aVersion, 
00163                                 const RMessage2& aMessage ) const;
00164 
00165     private: // Data
00166 
00170         TInt iSessionCount;
00171 
00176         CHeartbeat* iHeartbeat;
00177     };
00178 
00179 #endif // __CTIMESERVER_H__
00180 
00181 // End of File

Generated by  doxygen 1.6.2