1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of CFlexTimer class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 1 % |
|
20 */ |
|
21 //#include <e32panic.h> |
|
22 |
|
23 #include "flextimer.h" |
|
24 #include "flextimerpanic.h" |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "flextimerTraces.h" |
|
28 #endif |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // Destructs the object. |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CFlexTimer::~CFlexTimer() |
|
35 { |
|
36 OstTrace1( TRACE_NORMAL, CFLEXTIMER_CFLEXTIMER, |
|
37 "CFlexTimer::~CFlexTimer;this=%x", this ); |
|
38 |
|
39 Cancel(); |
|
40 iTimer.Close(); |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // Fire timer at latest on the given interval. 32-bit interval. |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 EXPORT_C void CFlexTimer::After( TTimeIntervalMicroSeconds32 aInterval ) |
|
48 { |
|
49 OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_AFTER32, |
|
50 "CFlexTimer::After32;this=%x;aInterval=%d", |
|
51 ( TUint )this, aInterval.Int() ); |
|
52 |
|
53 __ASSERT_ALWAYS( IsAdded(), |
|
54 User::Panic( KCFlexTimerPanicCat, |
|
55 EFlexTimerNotAddedToActiveScheduler ) ); |
|
56 iTimer.After( iStatus, aInterval ); |
|
57 SetActive(); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // Fire timer at latest on the given interval. 64-bit interval. |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 EXPORT_C void CFlexTimer::After( TTimeIntervalMicroSeconds aInterval ) |
|
65 { |
|
66 OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_AFTER64, |
|
67 "CFlexTimer::After64;this=%x;aInterval=%llu", |
|
68 ( TUint )this, aInterval.Int64() ); |
|
69 |
|
70 __ASSERT_ALWAYS( IsAdded(), |
|
71 User::Panic(KCFlexTimerPanicCat, |
|
72 EFlexTimerNotAddedToActiveScheduler ) ); |
|
73 iTimer.After( iStatus, aInterval ); |
|
74 SetActive(); |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // Fire timer between at latest by the given time value. |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 EXPORT_C void CFlexTimer::At( const TTime& aTime ) |
|
82 { |
|
83 OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_AT, |
|
84 "CFlexTimer::At;this=%x;aTime=%lld", ( TUint )this, |
|
85 aTime.Int64() ); |
|
86 |
|
87 __ASSERT_ALWAYS( IsAdded(), |
|
88 User::Panic( KCFlexTimerPanicCat, |
|
89 EFlexTimerNotAddedToActiveScheduler ) ); |
|
90 iTimer.At( iStatus, aTime ); |
|
91 SetActive(); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // Fire timer between at latest by the given time value. |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 EXPORT_C void CFlexTimer::AtUTC( const TTime& aTime ) |
|
99 { |
|
100 OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_ATUTC, |
|
101 "CFlexTimer::AtUTC;this=%x;aTime=%lld", |
|
102 ( TUint )this, aTime.Int64() ); |
|
103 |
|
104 __ASSERT_ALWAYS( IsAdded(), |
|
105 User::Panic(KCFlexTimerPanicCat, |
|
106 EFlexTimerNotAddedToActiveScheduler ) ); |
|
107 iTimer.AtUTC( iStatus, aTime ); |
|
108 SetActive(); |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // Sets the window size in which alignment is possible for the timer. |
|
113 // This is a synchronous command. 32-bit function argument. |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 EXPORT_C TInt CFlexTimer::Configure( TTimeIntervalMicroSeconds32 aWindowSize ) |
|
117 { |
|
118 OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_CONFIGURE, |
|
119 "CFlexTimer::Configure32;this=%x;aWindowSize=%d", |
|
120 ( TUint )this, aWindowSize.Int() ); |
|
121 |
|
122 return iTimer.Configure( aWindowSize ); |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // Sets the window size in which alignment is possible for the timer. |
|
127 // This is a synchronous command. 64-bit function argument. |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 EXPORT_C TInt CFlexTimer::Configure( TTimeIntervalMicroSeconds aWindowSize ) |
|
131 { |
|
132 OstTraceExt2( TRACE_NORMAL, DUP1_CFLEXTIMER_CONFIGURE, |
|
133 "CFlexTimer::Configure64;this=%x;aWindowSize=%lld", |
|
134 ( TUint )this, aWindowSize.Int64() ); |
|
135 |
|
136 return iTimer.Configure( aWindowSize ); |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // Constructs the object. Connects to the server and create a session. |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 EXPORT_C void CFlexTimer::ConstructL() |
|
144 { |
|
145 OstTrace1( TRACE_NORMAL, CFLEXTIMER_CONSTRUCTL, |
|
146 "CFlexTimer::ConstructL;this=%x", ( TUint )this ); |
|
147 |
|
148 User::LeaveIfError(iTimer.Connect()); |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // Constructs the object. |
|
153 // --------------------------------------------------------------------------- |
|
154 // |
|
155 EXPORT_C CFlexTimer::CFlexTimer( TInt aPriority ) : |
|
156 CActive( aPriority ) |
|
157 { |
|
158 } |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // Inherited from CActive. Handles the object canceling operations. |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 EXPORT_C void CFlexTimer::DoCancel() |
|
165 { |
|
166 OstTrace1( TRACE_NORMAL, CFLEXTIMER_DOCANCEL, |
|
167 "CFlexTimer::DoCancel;this=%x", ( TUint )this ); |
|
168 |
|
169 iTimer.Cancel(); |
|
170 } |
|
171 |
|