|
1 /* |
|
2 ============================================================================ |
|
3 Name : AnimationAO.cpp |
|
4 Author : |
|
5 Version : 1.0 |
|
6 Copyright : Your copyright notice |
|
7 Description : CAnimationAO implementation |
|
8 ============================================================================ |
|
9 */ |
|
10 |
|
11 #include "RollAO.h" |
|
12 // --------------------------------------------------------------------------- |
|
13 // CRollAO() |
|
14 // --------------------------------------------------------------------------- |
|
15 // |
|
16 CRollAO::CRollAO() : |
|
17 CActive(EPriorityStandard) // Standard priority |
|
18 { |
|
19 } |
|
20 // --------------------------------------------------------------------------- |
|
21 // NewLC() |
|
22 // --------------------------------------------------------------------------- |
|
23 // |
|
24 CRollAO* CRollAO::NewLC() |
|
25 { |
|
26 CRollAO* self = new (ELeave) CRollAO(); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(); |
|
29 return self; |
|
30 } |
|
31 // --------------------------------------------------------------------------- |
|
32 // NewL() |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CRollAO* CRollAO::NewL() |
|
36 { |
|
37 CRollAO* self = CRollAO::NewLC(); |
|
38 CleanupStack::Pop(); // self; |
|
39 return self; |
|
40 } |
|
41 // --------------------------------------------------------------------------- |
|
42 // ConstructL() |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 void CRollAO::ConstructL() |
|
46 { |
|
47 User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer |
|
48 CActiveScheduler::Add(this); // Add to scheduler |
|
49 } |
|
50 // --------------------------------------------------------------------------- |
|
51 // ~CRollAO() |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CRollAO::~CRollAO() |
|
55 { |
|
56 Cancel(); // Cancel any request, if outstanding |
|
57 iTimer.Close(); // Destroy the RTimer object |
|
58 // Delete instance variables if any |
|
59 } |
|
60 // --------------------------------------------------------------------------- |
|
61 // DoCancel() |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void CRollAO::DoCancel() |
|
65 { |
|
66 iTimer.Cancel(); |
|
67 } |
|
68 // --------------------------------------------------------------------------- |
|
69 // StartL() |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 void CRollAO::StartL(TTimeIntervalMicroSeconds32 aDelay) |
|
73 { |
|
74 Cancel(); // Cancel any request, just to be sure |
|
75 iTimer.After(iStatus, aDelay); // Set for later |
|
76 SetActive(); // Tell scheduler a request is active |
|
77 } |
|
78 // --------------------------------------------------------------------------- |
|
79 // RunL() |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 void CRollAO::RunL() |
|
83 { |
|
84 iTimer.After(iStatus, 300); // Set for 1 sec later |
|
85 SetActive(); |
|
86 iObserver->Roll(); |
|
87 } |
|
88 // --------------------------------------------------------------------------- |
|
89 // RunError() |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 TInt CRollAO::RunError(TInt aError) |
|
93 { |
|
94 return aError; |
|
95 } |
|
96 // --------------------------------------------------------------------------- |
|
97 // SetObserver() |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CRollAO::SetObserver(MRollObserver *aObserver) |
|
101 { |
|
102 iObserver = aObserver; |
|
103 } |