equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 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 * |
|
16 */ |
|
17 |
|
18 #include "highrestimer.h" |
|
19 |
|
20 |
|
21 CHighResTimer* CHighResTimer::NewL(TCallBack aCallBack, TInt aPriority) |
|
22 { |
|
23 CHighResTimer* self = new(ELeave) CHighResTimer(aCallBack, aPriority); |
|
24 CleanupStack::PushL(self); |
|
25 self->ConstructL(); |
|
26 CleanupStack::Pop(self); |
|
27 return self; |
|
28 } |
|
29 |
|
30 CHighResTimer::~CHighResTimer() |
|
31 { |
|
32 Cancel(); |
|
33 } |
|
34 |
|
35 void CHighResTimer::CallBack(const TInt aWaitInMilliSecs) |
|
36 { |
|
37 TInt wait = aWaitInMilliSecs*1000; |
|
38 if (wait < 1000) |
|
39 { |
|
40 wait = 1000; |
|
41 } |
|
42 if (wait > 15000) |
|
43 { |
|
44 wait = 15000; |
|
45 } |
|
46 |
|
47 HighRes( TTimeIntervalMicroSeconds32( wait ) ); |
|
48 } |
|
49 |
|
50 CHighResTimer::CHighResTimer(TCallBack aCallBack, TInt aPriority) |
|
51 : CTimer(aPriority), iCallBack(aCallBack) |
|
52 { |
|
53 CActiveScheduler::Add(this); |
|
54 } |
|
55 |
|
56 void CHighResTimer::RunL() |
|
57 { |
|
58 if (iStatus.Int() != KErrCancel) |
|
59 { |
|
60 iCallBack.CallBack(); |
|
61 } |
|
62 } |
|
63 |