|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // CMVSViewTicker.cpp |
|
15 // Part of the MVS Application for TechView |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 // |
|
21 //#include files |
|
22 // |
|
23 #include "MVSViewTicker.h" |
|
24 #include "MVSApp.hrh" |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 // |
|
30 //NewL(...) *** This method can LEAVE *** |
|
31 // |
|
32 // Factory constructor, sets up the ticker for the Set Position dialog |
|
33 // |
|
34 CMVSViewTicker* CMVSViewTicker::NewL(CMVSAppUi* aAppUi) |
|
35 { |
|
36 CMVSViewTicker* self = new(ELeave) CMVSViewTicker(aAppUi); |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(); |
|
39 CleanupStack::Pop(self); |
|
40 return self; |
|
41 } |
|
42 |
|
43 |
|
44 |
|
45 // |
|
46 //CMVSViewTicker(...) |
|
47 // |
|
48 // Initialises the ticker with an interval and the dialog. This is where the |
|
49 // ticker interval is set. |
|
50 // |
|
51 CMVSViewTicker::CMVSViewTicker(CMVSAppUi* aAppUi) |
|
52 { |
|
53 iTickInterval = 200000; |
|
54 iAppUi = aAppUi; |
|
55 } |
|
56 |
|
57 |
|
58 |
|
59 // |
|
60 //~CMVSViewTicker() |
|
61 // |
|
62 // Destructor |
|
63 // |
|
64 CMVSViewTicker::~CMVSViewTicker() |
|
65 { |
|
66 if (iPeriodic) |
|
67 { |
|
68 iPeriodic->Cancel(); |
|
69 } |
|
70 delete iPeriodic; |
|
71 } |
|
72 |
|
73 |
|
74 |
|
75 // |
|
76 //ConstructL() |
|
77 // |
|
78 // Second-phase constructor, initialises the periodic member, and starts it |
|
79 // running. |
|
80 // |
|
81 void CMVSViewTicker::ConstructL() |
|
82 { |
|
83 iPeriodic = CPeriodic::NewL(0); |
|
84 iPeriodic->Start(iTickInterval,iTickInterval,TCallBack(Tick, this)); |
|
85 } |
|
86 |
|
87 |
|
88 |
|
89 // |
|
90 //Tick(...) |
|
91 // |
|
92 // The callback function, which is called upon a periodic timer event. This |
|
93 // method calls the UpdatePositionViewL() in the AppUi |
|
94 // |
|
95 TInt CMVSViewTicker::Tick(TAny* aObject) |
|
96 { |
|
97 TRAPD(err,((CMVSViewTicker*)aObject)->iAppUi->UpdatePositionViewL()); |
|
98 return err; |
|
99 } |