connectionutilities/ConnectionDialogs/src/ExpiryTimer.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 19:05:04 +0300
branchRCL_3
changeset 54 984e13af52c4
parent 1 40cb640ef159
permissions -rw-r--r--
Revision: 201025 Kit: 2010127

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Implementation of class CExpiryTimer 
*
*/


#include "ExpiryTimer.h"

static const TInt KTimeout     = 60000000;
static const TInt KShortTimeout = 1000000;

// ---------------------------------------------------------------------------
// NewL. Constructs and returns the class object.
// ---------------------------------------------------------------------------
//
CExpiryTimer* CExpiryTimer::NewL( MExpiryTimerCallback& aCallback )
    {
    CExpiryTimer* self = new (ELeave) CExpiryTimer( aCallback );
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop(); // self;
    return self;
    }

CExpiryTimer::CExpiryTimer( MExpiryTimerCallback& aCallback ) 
 : CTimer(CActive::EPriorityStandard),
   iCallback( aCallback )
    {
    CActiveScheduler::Add(this);
    }

void CExpiryTimer::ConstructL()
    {
    CTimer::ConstructL();        
    }

// ---------------------------------------------------------------------------
// Start. Starts up the timer
// ---------------------------------------------------------------------------
//

void CExpiryTimer::Start()
    {
    TTimeIntervalMicroSeconds32 timeout = KTimeout;
    After( timeout );
    }

void CExpiryTimer::StartShort()
    {
    TTimeIntervalMicroSeconds32 timeout = KShortTimeout;
    After( timeout );
    }

void CExpiryTimer::RunL()
    {
    iCallback.HandleTimedOut();
    }