|
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "CConnectionTimer.h" |
|
17 |
|
18 #include "MConnectionTimerCallback.h" |
|
19 |
|
20 CConnectionTimer* CConnectionTimer::NewL(MConnectionTimerCallback& aCallback) |
|
21 { |
|
22 CConnectionTimer* self = new (ELeave) CConnectionTimer(aCallback); |
|
23 CleanupStack::PushL(self); |
|
24 self->ConstructL(); |
|
25 CleanupStack::Pop(self); |
|
26 return self; |
|
27 } |
|
28 |
|
29 CConnectionTimer::~CConnectionTimer() |
|
30 { |
|
31 } |
|
32 |
|
33 CConnectionTimer::CConnectionTimer(MConnectionTimerCallback& aCallback) |
|
34 : CTimer(EPriorityHigh), iCallback(aCallback) |
|
35 { |
|
36 CActiveScheduler::Add(this); |
|
37 } |
|
38 |
|
39 void CConnectionTimer::ConstructL() |
|
40 { |
|
41 CTimer::ConstructL(); |
|
42 } |
|
43 |
|
44 void CConnectionTimer::Start(TInt aDelayTime) |
|
45 { |
|
46 if( aDelayTime > 0 ) |
|
47 { |
|
48 // No delay timeout if delay time is zero |
|
49 CTimer::After(aDelayTime); |
|
50 } |
|
51 } |
|
52 |
|
53 void CConnectionTimer::RunL() |
|
54 { |
|
55 // Timer has completed - tell the callback object |
|
56 iCallback.HandleConnectionTimedOut(); |
|
57 } |
|
58 |
|
59 TInt CConnectionTimer::RunError(TInt /*aError*/) |
|
60 { |
|
61 // The RunL() cannot leave - nothing to do here. |
|
62 return KErrNone; |
|
63 } |