|
1 /* |
|
2 * Copyright (c) 2004 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: |
|
15 * Implementation of class CTimeout. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include "Timeout.h" |
|
24 #include "CodLogger.h" |
|
25 #include "CodPanic.h" |
|
26 |
|
27 // ================= MEMBER FUNCTIONS ======================= |
|
28 |
|
29 // --------------------------------------------------------- |
|
30 // CTimeout::NewL() |
|
31 // --------------------------------------------------------- |
|
32 // |
|
33 CTimeout* CTimeout::NewL( TInt aPriority, TCallBack aCallBack ) |
|
34 { |
|
35 CTimeout* timeout = new (ELeave) CTimeout( aPriority, aCallBack ); |
|
36 CleanupStack::PushL( timeout ); |
|
37 timeout->ConstructL(); |
|
38 CleanupStack::Pop( timeout ); |
|
39 return timeout; |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------- |
|
43 // CTimeout::~CTimeout() |
|
44 // --------------------------------------------------------- |
|
45 // |
|
46 CTimeout::~CTimeout() |
|
47 { |
|
48 CLOG(( ECodEng, 2, _L("CTimeout::~CTimeout") )); |
|
49 Cancel(); |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------- |
|
53 // CTimeout::RunL() |
|
54 // --------------------------------------------------------- |
|
55 // |
|
56 void CTimeout::RunL() |
|
57 { |
|
58 CLOG(( ECodEng, 2, _L("CTimeout::RunL iStatus(%d)"), iStatus.Int() )); |
|
59 #ifdef _DEBUG |
|
60 TBool again = |
|
61 #endif /* def _DEBUG */ |
|
62 iCallBack.CallBack(); |
|
63 // Assert that this is a "once-only" callback. |
|
64 __ASSERT_DEBUG( !again, CodPanic( ECodInternal ) ); |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------- |
|
68 // CTimeout::CTimeout() |
|
69 // --------------------------------------------------------- |
|
70 // |
|
71 CTimeout::CTimeout( TInt aPriority, TCallBack aCallBack ) |
|
72 : CTimer( aPriority ), iCallBack( aCallBack ) |
|
73 { |
|
74 CLOG(( ECodEng, 2, _L("CTimeout::CTimeout") )); |
|
75 CActiveScheduler::Add( this ); |
|
76 } |
|
77 |