S60 5th Edition SDK
Example Applications Guide

timesession.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : timesession.h
00004 *  Part of     : CSSync
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 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 __TIMESESSION_H__
00018 #define __TIMESESSION_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: // Functions from base classes
00058 
00059         /**
00060         * From CSession, ServiceL.
00061         * Service request from client.
00062         * @param aMessage Message from client
00063         *                 (containing requested operation and any data).
00064         */
00065         void ServiceL( const RMessage2& aMessage );
00066 
00067     private: // Constructors and destructors
00068 
00069         /**
00070         * CTimeServerSession.
00071         * C++ default constructor.
00072         * @param aServer The server.
00073         */
00074         CTimeServerSession( CTimeServer& aServer );
00075 
00076         /**
00077         * ConstructL.
00078         * 2nd phase constructor.
00079         */
00080         void ConstructL();
00081 
00082     private: // New methods
00083 
00084         /**
00085         * PanicClient.
00086         * Causes the client thread to panic.
00087         * @param aMessage Message from client.
00088         * @param aPanic Panic code.
00089         */
00090         void PanicClient( const RMessagePtr2& aMessage, TInt aPanic ) const;
00091 
00092         /**
00093         * RequestTimeL.
00094         * Handle the result of the client requesting the time.
00095         * Gets the time and writes it back to the client synchronously.
00096         * @param aMessage Message from client.
00097         */
00098         void RequestTimeL( const RMessage2& aMessage );
00099 
00100     private: // Data
00101 
00102         /**
00103         * iServer, reference to the server.
00104         */
00105         CTimeServer& iServer;
00106     };
00107 
00108 #endif // __TIMESESSION_H__
00109 
00110 
00111 // End of File

© Nokia 2009

Back to top