1 /* |
|
2 * Copyright (c) 2007 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 the License "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: A timer.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CRtpTimer.h" |
|
22 #include "MRtpTimerObserver.h" |
|
23 |
|
24 // CONSTANTS |
|
25 // None. |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CRtpTimer::NewL |
|
31 // Two-phased constructor. |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CRtpTimer* CRtpTimer::NewL( |
|
35 MRtpTimerObserver& aObs, |
|
36 const TPriority& aPrior ) |
|
37 { |
|
38 CRtpTimer* self= new( ELeave ) CRtpTimer( aObs, aPrior ); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop( self ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CRtpTimer::CRtpTimer |
|
47 // C++ parameter constructor can NOT contain any code, that might leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CRtpTimer::CRtpTimer( MRtpTimerObserver& aObs, const TPriority& aPrior ) |
|
51 : CTimer( aPrior ), |
|
52 iObs( aObs ) |
|
53 { |
|
54 // None |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CRtpTimer::ConstructL |
|
59 // Symbian 2nd phase constructor can leave. |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 void CRtpTimer::ConstructL() |
|
63 { |
|
64 CTimer::ConstructL(); |
|
65 CActiveScheduler::Add( this ); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // Destructor |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 EXPORT_C CRtpTimer::~CRtpTimer() |
|
73 { |
|
74 Cancel(); |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CRtpTimer::RunL |
|
79 // To inform the notifier that time is up. |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CRtpTimer::RunL() |
|
83 { |
|
84 iObs.TimerEventL(); |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CRtpTimer::RunError |
|
89 // Returns: System wide error code of indication send leave reason |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 TInt CRtpTimer::RunError( TInt aError ) |
|
93 { |
|
94 iObs.TimerError( aError ); |
|
95 return KErrNone; |
|
96 } |
|
97 |
|
98 // End of File |
|