mmsengine/mmswatcher/src/mmspollingtimer.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 12 Mar 2010 15:42:19 +0200
branchRCL_3
changeset 17 caea42e26caa
parent 0 72b543305e3a
permissions -rw-r--r--
Revision: 201007 Kit: 201008

/*
* Copyright (c) 2004-2007 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:  
*     This creates an event at regular intervals.
*
*/



// INCLUDE FILES
#include <e32base.h>
#include <msvapi.h>
#include <msvids.h>

#include "mmspollingtimer.h"
#include "mmswatcherdebuglogging.h"
#include "mmsconst.h"

// EXTERNAL DATA STRUCTURES

// EXTERNAL FUNCTION PROTOTYPES  

// CONSTANTS

// MACROS

// LOCAL CONSTANTS AND MACROS
const TInt KMmsFirstPollingInterval = 5000000; // 5 seconds

// MODULE DATA STRUCTURES

// LOCAL FUNCTION PROTOTYPES

// ==================== LOCAL FUNCTIONS ====================

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CMmsPollingTimer::CMmsPollingTimer
// ---------------------------------------------------------
//
CMmsPollingTimer::CMmsPollingTimer()
    :CTimer ( EPriorityStandard )
    {   
    }

// ---------------------------------------------------------
// CMmsPollingTimer::ConstructL
// ---------------------------------------------------------
//
void CMmsPollingTimer::ConstructL()
    {
    CTimer::ConstructL();
    CActiveScheduler::Add( this );
    }

// ---------------------------------------------------------
// CMmsPollingTimer::NewL
// ---------------------------------------------------------
//
CMmsPollingTimer* CMmsPollingTimer::NewL()
    {
    CMmsPollingTimer* self = new ( ELeave ) CMmsPollingTimer;
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );
    return self;
    }

// ---------------------------------------------------------
// CMmsPollingTimer::~CMmsPollingTimer
// ---------------------------------------------------------
//
CMmsPollingTimer::~CMmsPollingTimer()
    {
    Cancel();        
    }

// ---------------------------------------------------------
// CMmsPollingTimer::Start
// ---------------------------------------------------------
//
void CMmsPollingTimer::Start( MMsvSessionObserver* aRequester, const TInt aTimerValue )
    {
    // Store reference to object that will be called back
    iRequester = (MMsvSessionObserver*) aRequester;
    // Store timeout value that will be used regularly
    iTimeout = aTimerValue;
    // First timeout however will occur after fixed 5 seconds in order to give time for
    // emulator statup
    After( KMmsFirstPollingInterval ); 
    }

// ---------------------------------------------------------
// CMmsPollingTimer::RunL()
// ---------------------------------------------------------
//
void CMmsPollingTimer::RunL()
    {
    LOG( _L("CMmsPollingTimer::RunL") );
    TMsvId tid = KMsvSentEntryId;
    iRequester->HandleSessionEventL( 
        MMsvSessionObserver::EMsvEntriesCreated,
        NULL, 
        &tid, 
        NULL );
    
    After( iTimeout );
    }

// ---------------------------------------------------------
// CMmsPollingTimer::DoCancel()
// ---------------------------------------------------------
//
void CMmsPollingTimer::DoCancel()
    {
    LOG( _L("CMmsPollingTimer::DoCancel") );
    CTimer::DoCancel();
    }

// ================= OTHER EXPORTED FUNCTIONS ==============

//  End of File