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