|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Implements VoIP delayed server shutdown routines. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "VoIPServerShutdown.h" |
|
20 |
|
21 // CONSTANTS |
|
22 _LIT(KDelayServerShutdownPanic, "CDelayVoIPServerShutDown"); |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CDelayVoIPServerShutDown::NewL |
|
26 // Two-phased constructor. |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 CDelayVoIPServerShutDown* CDelayVoIPServerShutDown::NewL() |
|
30 { |
|
31 CDelayVoIPServerShutDown* self = new (ELeave) CDelayVoIPServerShutDown; |
|
32 CleanupStack::PushL(self); |
|
33 self->ConstructL(); |
|
34 CleanupStack::Pop(self); |
|
35 return self; |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CDelayVoIPServerShutDown::CDelayVoIPServerShutDown() |
|
40 // C++ constructor. |
|
41 // (other items were commented in a header). |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CDelayVoIPServerShutDown::CDelayVoIPServerShutDown() : |
|
45 CActive(0) |
|
46 { |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CDelayVoIPServerShutDown::ConstructL |
|
51 // Symbian 2nd phase constructor can leave. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 void CDelayVoIPServerShutDown::ConstructL() |
|
55 { |
|
56 User::LeaveIfError(iShutDownTimer.CreateLocal()); |
|
57 CActiveScheduler::Add(this); |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CDelayVoIPServerShutDown::~CDelayVoIPServerShutDown |
|
62 // Destructor |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CDelayVoIPServerShutDown::~CDelayVoIPServerShutDown() |
|
66 { |
|
67 Cancel(); |
|
68 iShutDownTimer.Close(); |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CDelayVoIPServerShutDown::SetDelay |
|
73 // Request a timeout after aDelay |
|
74 // (other items were commented in a header). |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void CDelayVoIPServerShutDown::SetDelay(TTimeIntervalMicroSeconds32 aDelay) |
|
78 { |
|
79 __ASSERT_ALWAYS(!IsActive(), User::Panic(KDelayServerShutdownPanic, 1)); |
|
80 |
|
81 if (!IsActive()) |
|
82 { |
|
83 iShutDownTimer.After(iStatus, aDelay); |
|
84 } |
|
85 |
|
86 SetActive(); |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CDelayVoIPServerShutDown::RunL |
|
91 // Called by Active object framework when timer times out. |
|
92 // (other items were commented in a header). |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CDelayVoIPServerShutDown::RunL() |
|
96 { |
|
97 CActiveScheduler::Stop(); |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CDelayVoIPServerShutDown::DoCancel |
|
102 // Called by the Active object framework when user cancels active object. |
|
103 // (other items were commented in a header). |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CDelayVoIPServerShutDown::DoCancel() |
|
107 { |
|
108 iShutDownTimer.Cancel(); |
|
109 } |
|
110 |
|
111 // End of File |