S60 5th Edition SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : timesession.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 __CTIMESESSION_H__ 00018 #define __CTIMESESSION_H__ 00019 00020 // INCLUDE FILES 00021 #include <e32base.h> 00022 00023 // FORWARD DECLARATIONS 00024 class CTimeServer; 00025 00026 // CLASS DECLARATION 00027 /** 00028 * CTimeServerSession. 00029 * An instance of class CTimeServerSession is created for each client. 00030 */ 00031 class CTimeServerSession : public CSession2 00032 { 00033 public: // Constructors and destructors 00034 00035 /** 00036 * NewL. 00037 * Two-phased constructor. 00038 * @param aServer The server. 00039 * @return Pointer to created CTimeServerSession object. 00040 */ 00041 static CTimeServerSession* NewL( CTimeServer& aServer ); 00042 00043 /** 00044 * NewLC. 00045 * Two-phased constructor. 00046 * @param aServer The server. 00047 * @return Pointer to created CTimeServerSession object. 00048 */ 00049 static CTimeServerSession* NewLC( CTimeServer& aServer ); 00050 00051 /** 00052 * ~CTimeServerSession. 00053 * Destructor. 00054 */ 00055 virtual ~CTimeServerSession(); 00056 00057 public: // New functions 00058 00059 /** 00060 * SendTimeToClient. 00061 * Call from Beat() and Synchronize(). 00062 * Sends current time back to requesting client. 00063 */ 00064 void SendTimeToClient(); 00065 00066 public: // Functions from base classes 00067 00068 /** 00069 * From CSession, ServiceL. 00070 * Service request from client. 00071 * @param aMessage Message from client 00072 * (containing requested operation and any data). 00073 */ 00074 void ServiceL( const RMessage2& aMessage ); 00075 00076 private: // Constructors and destructors 00077 00078 /** 00079 * CTimeServerSession. 00080 * C++ default constructor. 00081 * @param aServer The server. 00082 */ 00083 CTimeServerSession( CTimeServer& aServer ); 00084 00085 /** 00086 * ConstructL. 00087 * 2nd phase constructor. 00088 */ 00089 void ConstructL(); 00090 00091 private: // New methods 00092 00093 /** 00094 * PanicClient. 00095 * Causes the client thread to panic. 00096 * @param aMessage Message from client. 00097 * @param aPanic Panic code. 00098 */ 00099 void PanicClient( const RMessagePtr2& aMessage, 00100 TInt aPanic ) const; 00101 00102 /** 00103 * RequestTimeL. 00104 * Called as a result of the client requesting the time. 00105 * Starts the 'get time' operation. 00106 * @param aMessage Message from client. 00107 */ 00108 void RequestTimeL( const RMessage2& aMessage ); 00109 00110 private: // Data 00111 00112 /** 00113 * iWaitingForTick, state of tick. 00114 */ 00115 TBool iWaitingForTick; 00116 00117 /** 00118 * iMessage, the message exchange data with the server. 00119 */ 00120 RMessage2 iMessage; 00121 00122 /** 00123 * iServer, reference to the server. 00124 */ 00125 CTimeServer& iServer; 00126 }; 00127 00128 #endif // __CTIMESESSION_H__ 00129 00130 00131 // End of File
© Nokia 2009 |