Nokia N97 SDK
Example Applications Guide

servertimeouttimer.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : servertimeouttimer.cpp
00004 *  Part of     : Animation example
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 // INCLUDE FILES
00017 #include <w32std.h>
00018 #include <e32cons.h>
00019 #include <in_sock.h>
00020 
00021 #include "servertimeoutnotify.h"
00022 #include "servertimeouttimer.h"
00023 
00024 // ============================ MEMBER FUNCTIONS ===============================
00025 
00026 // -----------------------------------------------------------------------------
00027 // CTimeOutTimer::CTimeOutTimer()
00028 // C++ default constructor can NOT contain any code, that might leave.
00029 // -----------------------------------------------------------------------------
00030 //
00031 CTimeOutTimer::CTimeOutTimer( const TInt aPriority, MTimeoutNotify&
00032                aTimeOutNotify ) : CTimer( aPriority ), iNotify( aTimeOutNotify )
00033     {
00034     // No implementation required
00035     }
00036 
00037 // -----------------------------------------------------------------------------
00038 // CTimeOutTimer::NewL()
00039 // Two-phased constructor.
00040 // -----------------------------------------------------------------------------
00041 //
00042 CTimeOutTimer* CTimeOutTimer::NewL(const TInt aPriority, MTimeoutNotify&
00043                                                                  aTimeOutNotify)
00044     {
00045     CTimeOutTimer* self = CTimeOutTimer::NewLC( aPriority, aTimeOutNotify );
00046     CleanupStack::Pop(); // self
00047     return self;
00048     }
00049 
00050 // -----------------------------------------------------------------------------
00051 // CTimeOutTimer::NewLC()
00052 // Two-phased constructor.
00053 // -----------------------------------------------------------------------------
00054 //
00055 CTimeOutTimer* CTimeOutTimer::NewLC( const TInt aPriority, MTimeoutNotify&
00056                                                                 aTimeOutNotify )
00057     {
00058     CTimeOutTimer *self = new ( ELeave ) CTimeOutTimer( aPriority,
00059                                                                aTimeOutNotify );
00060     CleanupStack::PushL( self );
00061     self->ConstructL();
00062     return self;
00063     }
00064 
00065 // -----------------------------------------------------------------------------
00066 // CTimeOutTimer::~CTimeOutTimer()
00067 // Destructor.
00068 // -----------------------------------------------------------------------------
00069 //
00070 CTimeOutTimer::~CTimeOutTimer()
00071     {
00072     Cancel();
00073     }
00074 
00075 // -----------------------------------------------------------------------------
00076 // CTimeOutTimer::ConstructL()
00077 // Symbian 2nd phase constructor can leave.
00078 // -----------------------------------------------------------------------------
00079 //
00080 void CTimeOutTimer::ConstructL()
00081     {
00082     // Call the base class ConstructL
00083     CTimer::ConstructL();
00084 
00085     // Add this timer to the active scheduler
00086     CActiveScheduler::Add( this );
00087     }
00088 
00089 // -----------------------------------------------------------------------------
00090 // CTimeOutTimer::RunL()
00091 // When the timer times out notify the object registered with this timer.
00092 // -----------------------------------------------------------------------------
00093 //
00094 void CTimeOutTimer::RunL()
00095     {
00096     iNotify.TimedOut();
00097     }
00098 
00099 // End of File

© Nokia 2009

Back to top