|
1 /* |
|
2 * Copyright (c) 2006-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: Shutdown timer for the preset server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "psdebug.h" |
|
20 #include "psshutdown.h" |
|
21 |
|
22 const TInt KPSShutdownPriority = CActive::EPriorityStandard; // The priority of the shutdown timer. |
|
23 |
|
24 // ======== LOCAL FUNCTIONS ======== |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // Two-phased constructor. |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CPSShutdown* CPSShutdown::NewL() |
|
33 { |
|
34 CPSShutdown* self = new ( ELeave ) CPSShutdown; |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL(); |
|
37 CleanupStack::Pop( self ); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Constructor. |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CPSShutdown::CPSShutdown() |
|
46 : CTimer( KPSShutdownPriority ) |
|
47 { |
|
48 CActiveScheduler::Add( this ); |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // Second-phase constructor. |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CPSShutdown::ConstructL() |
|
56 { |
|
57 CTimer::ConstructL(); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // Destructor. |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CPSShutdown::~CPSShutdown() |
|
65 { |
|
66 Cancel(); |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // Starts the shutdown timer. |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CPSShutdown::Start(TTimeIntervalMicroSeconds32 aDelay) |
|
74 { |
|
75 PSDEBUG3( "CPSShutdown::Start() - Should start the shutdown timer now (IsActive() = %d, aDelay = %d).", |
|
76 IsActive(), aDelay.Int() ); |
|
77 Cancel(); |
|
78 After( aDelay ); |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // From class CActive |
|
83 // Called when the timer expires. |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CPSShutdown::RunL() |
|
87 { |
|
88 PSDEBUG( "CPSShutdown::RunL() >> Timer expired. Stopping the preset server now!" ); |
|
89 CActiveScheduler::Stop(); |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // From class CActive |
|
94 // Called when the timer expires. |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 void CPSShutdown::DoCancel() |
|
98 { |
|
99 PSDEBUG( "CPSShutdown::DoCancel() >> Timer halted." ); |
|
100 CTimer::DoCancel(); |
|
101 } |
|
102 |
|
103 // ======== GLOBAL FUNCTIONS ======== |