24
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2009 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:
|
|
15 |
* Name : CSatTimer.cpp
|
|
16 |
* Part of : Common SIM ATK TSY / commonsimatktsy
|
|
17 |
* Implementation of the sat timer functions.
|
|
18 |
* Version : 1.0
|
|
19 |
*
|
|
20 |
*/
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
#ifndef CSATTIMER_H
|
|
26 |
#define CSATTIMER_H
|
|
27 |
|
|
28 |
|
|
29 |
// INCLUDES
|
|
30 |
#include <e32base.h> // Symbian base types
|
|
31 |
|
|
32 |
|
|
33 |
// CONSTANTS
|
|
34 |
const TUint8 KMaxNumberOfParallelTimers = 8;
|
|
35 |
const TInt KTimeStampsEqual = 0;
|
|
36 |
const TInt KFirstTimeStampBigger = 1;
|
|
37 |
const TInt KFirstTimeStampSmaller = -1;
|
|
38 |
|
|
39 |
|
|
40 |
// FORWARD DECLARATIONS
|
|
41 |
class CSatMessHandler;
|
|
42 |
class CSatNotificationsTsy;
|
|
43 |
|
|
44 |
|
|
45 |
// DESCRIPTION
|
|
46 |
/**
|
|
47 |
* Implementation of the sat timer functions.
|
|
48 |
* @lib Commonsimatktsy
|
|
49 |
* @since 3.1
|
|
50 |
*/
|
|
51 |
|
|
52 |
NONSHARABLE_CLASS ( CSatTimer ) : public CBase, public MBeating
|
|
53 |
{
|
|
54 |
public:
|
|
55 |
// DESCRIPTION
|
|
56 |
//
|
|
57 |
// CSatTimer::TTimer class.
|
|
58 |
//
|
|
59 |
class TTimer
|
|
60 |
{
|
|
61 |
public:
|
|
62 |
/**
|
|
63 |
* Non default Constructor
|
|
64 |
* @param aTimerId: Timer id
|
|
65 |
* @param aStartTime: Timer start time
|
|
66 |
* @param aTimeStamp: Time stamp
|
|
67 |
*/
|
|
68 |
TTimer( TInt aTimerId, TUint32 aStartTime,
|
|
69 |
TUint32 aTimeStamp );
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Returns iTimeStamp from a TTimer
|
|
73 |
* @params None
|
|
74 |
* @returns value of the iTimeStamp attribute
|
|
75 |
*/
|
|
76 |
TUint32 TimeStamp();
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Returns iTimerId from a TTimer
|
|
80 |
* @params: None
|
|
81 |
* @returns value of the iTimerId attribute
|
|
82 |
*/
|
|
83 |
TInt TimerId();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Returns iStartTime from a TTimer
|
|
87 |
* @params: None
|
|
88 |
* @returns value of the iStartTime attribute
|
|
89 |
*/
|
|
90 |
TUint32 TimerStartTime();
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Returns if two entries are equal
|
|
94 |
* @param aArg1: first argument
|
|
95 |
* @param aArg2: second argument
|
|
96 |
* @returns ETrue if two entries are equal
|
|
97 |
*/
|
|
98 |
static TBool CompareEntries( const TTimer& aArg1,
|
|
99 |
const TTimer& aArg2 );
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Returns order between two entries
|
|
103 |
* @param aArg1: first argument
|
|
104 |
* @param aArg2: second argument
|
|
105 |
* @returns 0 if arg1 = arg2
|
|
106 |
* 1 if arg1 > arg2
|
|
107 |
* -1 else
|
|
108 |
*/
|
|
109 |
static TInt OrderEntries( const TTimer& aArg1,
|
|
110 |
const TTimer& aArg2 );
|
|
111 |
|
|
112 |
private:
|
|
113 |
|
|
114 |
// Timer identifier
|
|
115 |
TInt iTimerId;
|
|
116 |
|
|
117 |
// Timer start time
|
|
118 |
TUint32 iStartTime;
|
|
119 |
|
|
120 |
// Time stamp
|
|
121 |
TUint32 iTimeStamp;
|
|
122 |
|
|
123 |
};
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Two-phased constructor.
|
|
127 |
* @param aNotificationsTsy: Pointer to notifications tsy
|
|
128 |
* @return created object
|
|
129 |
*/
|
|
130 |
static CSatTimer* NewL( CSatNotificationsTsy* aSatNotificationsTsy );
|
|
131 |
/**
|
|
132 |
* Constructor.
|
|
133 |
* @param aNotificationsTsy: Pointer to notifications tsy
|
|
134 |
*/
|
|
135 |
void ConstructL( CSatNotificationsTsy* aSatNotificationsTsy );
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Destructor
|
|
139 |
*/
|
|
140 |
~CSatTimer();
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Starts the timer counting
|
|
144 |
* @param aTimerId: Timer id
|
|
145 |
* @param aTimerValue: Timeout value
|
|
146 |
* @return KErrNone or error code
|
|
147 |
*/
|
|
148 |
TInt Start( TInt aTimerId, TUint32 aTimerValue );
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Stops the timer counting
|
|
152 |
* @params: None
|
|
153 |
* @return None
|
|
154 |
*/
|
|
155 |
void Stop();
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Deletes timer from the table
|
|
159 |
* @param aTimerId: timer identifier
|
|
160 |
* @returns KErrNone or KErrNotFound
|
|
161 |
*/
|
|
162 |
TInt DeleteTimerById( TInt aTimerId );
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Gets current value of timer by timer id
|
|
166 |
* @param aTimerId: timer identifier
|
|
167 |
* @returns Current timer value
|
|
168 |
*/
|
|
169 |
TUint32 CurrentValueOfTimerById( TInt aTimerId );
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Sets status for ProactiveCommandOnGoing flag
|
|
173 |
* @param aStatus: Status for proactive command
|
|
174 |
* @return None
|
|
175 |
*/
|
|
176 |
void SetProactiveCommandOnGoingStatus( TBool aStatus );
|
|
177 |
|
|
178 |
private:
|
|
179 |
/**
|
|
180 |
* Constructor
|
|
181 |
* @params: None
|
|
182 |
* @returns None
|
|
183 |
*/
|
|
184 |
CSatTimer();
|
|
185 |
|
|
186 |
|
|
187 |
/**
|
|
188 |
* Called when beat works ok, once every second
|
|
189 |
* @param None
|
|
190 |
* @returns None
|
|
191 |
*/
|
|
192 |
void Beat();
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Called when we need to synchronize
|
|
196 |
* @params: None
|
|
197 |
* @returns None
|
|
198 |
*/
|
|
199 |
void Synchronize();
|
|
200 |
|
|
201 |
/**
|
|
202 |
* Checks if an entry is in iEntryTable
|
|
203 |
* @param aTimerId: timer identifier
|
|
204 |
* @return ETrue if the timer has an entry in the table
|
|
205 |
* EFalse otherwise.
|
|
206 |
*/
|
|
207 |
TBool CheckTimerTable( TInt aTimerId );
|
|
208 |
|
|
209 |
private:
|
|
210 |
|
|
211 |
// Sat notifications tsy pointer
|
|
212 |
CSatNotificationsTsy* iSatNotificationsTsy;
|
|
213 |
|
|
214 |
// Count of beats of the timer
|
|
215 |
TUint32 iBeatCounter;
|
|
216 |
|
|
217 |
// Pointer to the CHeartbeat type timer.
|
|
218 |
CHeartbeat* iTimer;
|
|
219 |
|
|
220 |
// Pointer to the entry array
|
|
221 |
RArray<TTimer>* iTimerTable;
|
|
222 |
|
|
223 |
// Flag for proactiveCommandOnGoing status
|
|
224 |
TBool iIsProactiveCommandOnGoing;
|
|
225 |
|
|
226 |
};
|
|
227 |
|
|
228 |
#endif // CSATTIMER_H
|
|
229 |
|
|
230 |
// End of File
|