|
1 /* |
|
2 * Copyright (c) 2006 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: CTimeOutTimer is used to generate time out events |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "TimeOutTimer.h" |
|
19 #include "TimeOutNotify.h" |
|
20 |
|
21 |
|
22 // --------------------------------------------------------- |
|
23 // CTimeOutTimer::NewL(const TInt aPriority, MTimeOutNotify& aTimeOutNotify) |
|
24 // EPOC two phased constructor |
|
25 // --------------------------------------------------------- |
|
26 // |
|
27 CTimeOutTimer* CTimeOutTimer::NewL(const TInt aPriority, MTimeOutNotify& aTimeOutNotify) |
|
28 { |
|
29 CTimeOutTimer* self = CTimeOutTimer::NewLC(aPriority, aTimeOutNotify); |
|
30 CleanupStack::Pop(self); |
|
31 return self; |
|
32 } |
|
33 |
|
34 |
|
35 // --------------------------------------------------------- |
|
36 // CTimeOutTimer::NewLC(const TInt aPriority, MTimeOutNotify& aTimeOutNotify) |
|
37 // EPOC two phased constructor |
|
38 // --------------------------------------------------------- |
|
39 // |
|
40 CTimeOutTimer* CTimeOutTimer::NewLC(const TInt aPriority, MTimeOutNotify& aTimeOutNotify) |
|
41 { |
|
42 CTimeOutTimer* self = new (ELeave) CTimeOutTimer(aPriority, aTimeOutNotify); |
|
43 CleanupStack::PushL(self); |
|
44 self->ConstructL(); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------- |
|
49 // CTimeOutTimer::CTimeOutTimer(const TInt aPriority, MTimeOutNotify& aTimeOutNotify) |
|
50 // Constructor |
|
51 // --------------------------------------------------------- |
|
52 // |
|
53 CTimeOutTimer::CTimeOutTimer(const TInt aPriority, MTimeOutNotify& aTimeOutNotify) |
|
54 : CTimer(aPriority), iNotify(aTimeOutNotify) |
|
55 { |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------- |
|
59 // CTimeOutTimer::~CTimeOutTimer() |
|
60 // Destructor |
|
61 // --------------------------------------------------------- |
|
62 // |
|
63 CTimeOutTimer::~CTimeOutTimer() |
|
64 { |
|
65 Cancel(); |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------- |
|
69 // CTimeOutTimer::ConstructL() |
|
70 // EPOC two-phased constructor |
|
71 // --------------------------------------------------------- |
|
72 // |
|
73 void CTimeOutTimer::ConstructL() |
|
74 { |
|
75 CTimer::ConstructL(); |
|
76 CActiveScheduler::Add(this); |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------- |
|
80 // CTimeOutTimer::RunL() |
|
81 // Timer event has been generated and timer request completed. |
|
82 // --------------------------------------------------------- |
|
83 // |
|
84 void CTimeOutTimer::RunL() |
|
85 { |
|
86 // Timer request has completed, so notify the timer's owner |
|
87 iNotify.TimerExpired(); |
|
88 } |
|
89 |