|
1 /* |
|
2 * Copyright (c) 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 "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: Class to handle server delayed shutdown |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "EPos_CPosLmServerDelayedShutdown.h" |
|
22 |
|
23 // CONSTANTS |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CPosLmServer::CPosLmServer |
|
29 // C++ default constructor can NOT contain any code, that |
|
30 // might leave. |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CPosLmServerDelayedShutdown::CPosLmServerDelayedShutdown() |
|
34 : CActive(EPriorityLow) |
|
35 { |
|
36 CActiveScheduler::Add(this); |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CPosLmServer::ConstructL |
|
41 // Symbian 2nd phase constructor can leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CPosLmServerDelayedShutdown::ConstructL() |
|
45 { |
|
46 User::LeaveIfError(iTimer.CreateLocal()); |
|
47 } |
|
48 |
|
49 // Two-phased constructor |
|
50 CPosLmServerDelayedShutdown* CPosLmServerDelayedShutdown::NewL() |
|
51 { |
|
52 CPosLmServerDelayedShutdown* self = |
|
53 new (ELeave) CPosLmServerDelayedShutdown; |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop(self); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // Destructor |
|
61 CPosLmServerDelayedShutdown::~CPosLmServerDelayedShutdown() |
|
62 { |
|
63 Cancel(); |
|
64 iTimer.Close(); |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CPosLmServerDelayedShutdown::Start |
|
69 // |
|
70 // (other items were commented in a header). |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 void CPosLmServerDelayedShutdown::Start( |
|
74 TTimeIntervalMicroSeconds32 aDelay) |
|
75 { |
|
76 iTimer.After(iStatus, aDelay); |
|
77 SetActive(); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CPosLmServerDelayedShutdown::RunL |
|
82 // |
|
83 // (other items were commented in a header). |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CPosLmServerDelayedShutdown::RunL() |
|
87 { |
|
88 // Shutdown the server by shutting down the active scheduler. |
|
89 CActiveScheduler::Stop(); |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CPosLmServerDelayedShutdown::DoCancel |
|
94 // |
|
95 // (other items were commented in a header). |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void CPosLmServerDelayedShutdown::DoCancel() |
|
99 { |
|
100 iTimer.Cancel(); |
|
101 } |
|
102 |
|
103 // End of File |