ipsservices/ipssosaoplugin/src/IpsSosAOPluginTimer.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 15:41:10 +0300
changeset 23 2dc6caa42ec3
parent 0 8466d47a6819
child 57 ae34e1715e21
permissions -rw-r--r--
Revision: 201017 Kit: 201019

/*
* Copyright (c) 2008 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: 
*     Timer for AO Plugin
*
*/


#include "emailtrace.h"
#include "IpsSosAOPluginTimer.h"


// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
CIpsSosAOPluginTimer* CIpsSosAOPluginTimer::NewL( 
    TInt aPriority, 
    MIpsSosAOPluginTimerCallBack& aCallBack )
    {
    FUNC_LOG;
    CIpsSosAOPluginTimer* self = new( 
        ELeave ) CIpsSosAOPluginTimer( aPriority, aCallBack );
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );
    return self;
    }

// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
CIpsSosAOPluginTimer::CIpsSosAOPluginTimer( 
    TInt aPriority, 
    MIpsSosAOPluginTimerCallBack& aCallBack )
    : CActive (aPriority), iCallBack( aCallBack )
    {
    FUNC_LOG;
    }


// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
CIpsSosAOPluginTimer::~CIpsSosAOPluginTimer()
    {
    FUNC_LOG;
    Cancel();
    iTimer.Close();
    }


// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsSosAOPluginTimer::ConstructL()
    {
    FUNC_LOG;
    User::LeaveIfError( iTimer.CreateLocal() );
    CActiveScheduler::Add(this);
    }



// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsSosAOPluginTimer::After(const TTimeIntervalSeconds& aSeconds)
    {
    FUNC_LOG;
    Cancel();
    TTime time;
    time.HomeTime();
    time = time + aSeconds;
    iTimer.At( iStatus, time );
    SetActive();
    }
    
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsSosAOPluginTimer::DoCancel()
    {
    FUNC_LOG;
    iTimer.Cancel();
    }


// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsSosAOPluginTimer::RunL()
    {
    FUNC_LOG;
    iCallBack.TimerFiredL();
    }
    
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
TInt CIpsSosAOPluginTimer::RunError( TInt /* aError */ )
    {
    FUNC_LOG;
    // Just ignore any error and continue without
    // any handling to allow smooth execution. 
    return KErrNone;            
    }


//EOF