|
1 /* |
|
2 * Copyright (c) 2002-2005 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: generic timer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "wlmtimer.h" |
|
20 #include "am_debug.h" |
|
21 #include "core_callback.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // am_symbian_timer_c::am_symbian_timer_c |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 am_symbian_timer_c::am_symbian_timer_c( |
|
32 core_callback_c* callback ) : |
|
33 CTimer( CTimer::EPriorityStandard ), |
|
34 callback_m( callback ) |
|
35 { |
|
36 DEBUG( "am_symbian_timer_c::am_symbian_timer_c()" ); |
|
37 // Not the best place for this but... |
|
38 TRAPD( err, CTimer::ConstructL() ); |
|
39 if ( err != KErrNone ) |
|
40 { |
|
41 DEBUG1( "am_symbian_timer_c::am_symbian_timer_c() - ConstructL leaved with %d", |
|
42 err ); |
|
43 } |
|
44 } |
|
45 |
|
46 // Destructor |
|
47 am_symbian_timer_c::~am_symbian_timer_c() |
|
48 { |
|
49 DEBUG( "am_symbian_timer_c::~am_symbian_timer_c()" ); |
|
50 Cancel(); |
|
51 |
|
52 delete callback_m; |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // am_symbian_timer_c::start |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void am_symbian_timer_c::start( |
|
60 unsigned long int delay ) |
|
61 { |
|
62 DEBUG( "am_symbian_timer_c::start()" ); |
|
63 After( delay ); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // am_symbian_timer_c::stop |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 void am_symbian_timer_c::stop() |
|
71 { |
|
72 DEBUG( "am_symbian_timer_c::stop()" ); |
|
73 Cancel(); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // am_symbian_timer_c::is_active |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 bool_t am_symbian_timer_c::is_active() const |
|
81 { |
|
82 return IsActive(); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // am_symbian_timer_c::RunL |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void am_symbian_timer_c::RunL() |
|
90 { |
|
91 DEBUG( "am_symbian_timer_c::RunL()" ); |
|
92 callback_m->func_m( callback_m->ptr_m ); |
|
93 } |
|
94 |
|
95 // End of File |