sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // CMVSViewTicker.cpp sl@0: // Part of the MVS Application for TechView sl@0: // sl@0: sl@0: sl@0: sl@0: // sl@0: //#include files sl@0: // sl@0: #include "MVSViewTicker.h" sl@0: #include "MVSApp.hrh" sl@0: sl@0: sl@0: sl@0: sl@0: // sl@0: //NewL(...) *** This method can LEAVE *** sl@0: // sl@0: // Factory constructor, sets up the ticker for the Set Position dialog sl@0: // sl@0: CMVSViewTicker* CMVSViewTicker::NewL(CMVSAppUi* aAppUi) sl@0: { sl@0: CMVSViewTicker* self = new(ELeave) CMVSViewTicker(aAppUi); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: sl@0: sl@0: // sl@0: //CMVSViewTicker(...) sl@0: // sl@0: // Initialises the ticker with an interval and the dialog. This is where the sl@0: // ticker interval is set. sl@0: // sl@0: CMVSViewTicker::CMVSViewTicker(CMVSAppUi* aAppUi) sl@0: { sl@0: iTickInterval = 200000; sl@0: iAppUi = aAppUi; sl@0: } sl@0: sl@0: sl@0: sl@0: // sl@0: //~CMVSViewTicker() sl@0: // sl@0: // Destructor sl@0: // sl@0: CMVSViewTicker::~CMVSViewTicker() sl@0: { sl@0: if (iPeriodic) sl@0: { sl@0: iPeriodic->Cancel(); sl@0: } sl@0: delete iPeriodic; sl@0: } sl@0: sl@0: sl@0: sl@0: // sl@0: //ConstructL() sl@0: // sl@0: // Second-phase constructor, initialises the periodic member, and starts it sl@0: // running. sl@0: // sl@0: void CMVSViewTicker::ConstructL() sl@0: { sl@0: iPeriodic = CPeriodic::NewL(0); sl@0: iPeriodic->Start(iTickInterval,iTickInterval,TCallBack(Tick, this)); sl@0: } sl@0: sl@0: sl@0: sl@0: // sl@0: //Tick(...) sl@0: // sl@0: // The callback function, which is called upon a periodic timer event. This sl@0: // method calls the UpdatePositionViewL() in the AppUi sl@0: // sl@0: TInt CMVSViewTicker::Tick(TAny* aObject) sl@0: { sl@0: TRAPD(err,((CMVSViewTicker*)aObject)->iAppUi->UpdatePositionViewL()); sl@0: return err; sl@0: }