|
1 /* |
|
2 * Copyright (c) 2002-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 "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: This class implements the shutdown timer that is used by the RadioServer |
|
15 * to shutdown the server 2 seconds after the last client has disconnected. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "RadioServerShutdown.h" |
|
23 #include "RadioDebug.h" |
|
24 |
|
25 // CONSTANTS |
|
26 const TInt KServerShutdownDelay = 1000000; // 1 secs |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CRadioServerShutdown::CRadioServerShutdown |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CRadioServerShutdown::CRadioServerShutdown() |
|
37 : CTimer(EPriorityStandard) |
|
38 { |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CRadioServerShutdown::ConstructL |
|
43 // Symbian 2nd phase constructor can leave. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void CRadioServerShutdown::ConstructL() |
|
47 { |
|
48 RADIO_RDEBUG(_L("[RADIO-SVR] CRadioServerShutdown::ConstructL()")); |
|
49 CTimer::ConstructL(); |
|
50 CActiveScheduler::Add(this); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CRadioServerShutdown::NewL |
|
55 // Two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CRadioServerShutdown* CRadioServerShutdown::NewL() |
|
59 { |
|
60 CRadioServerShutdown* self = new( ELeave ) CRadioServerShutdown(); |
|
61 CleanupStack::PushL(self); |
|
62 self->ConstructL(); |
|
63 CleanupStack::Pop(self); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // Destructor |
|
68 CRadioServerShutdown::~CRadioServerShutdown() |
|
69 { |
|
70 if ( IsActive() ) |
|
71 { |
|
72 Cancel(); |
|
73 } |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CRadioServerShutdown::Start |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CRadioServerShutdown::Start() |
|
81 { |
|
82 if ( !IsActive() ) |
|
83 { |
|
84 After(KServerShutdownDelay); |
|
85 } |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CRadioServerShutdown::DoCancel |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CRadioServerShutdown::DoCancel() |
|
93 { |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CRadioServerShutdown::RunL |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void CRadioServerShutdown::RunL() |
|
101 { |
|
102 RADIO_RDEBUG(_L("[RADIO-SVR] CRadioServerShutdown::RunL()")); |
|
103 CActiveScheduler::Stop(); |
|
104 } |
|
105 |
|
106 // End of File |
|
107 |