|
1 /* |
|
2 * Copyright (c) 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: This is the implementation of application class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <e32base.h> |
|
21 |
|
22 #include "shutdown.h" |
|
23 #include "debug.h" |
|
24 |
|
25 // ---------------------------------------------------------------------- |
|
26 |
|
27 const TInt CLayoutMgrShutdown::KShutdownInterval = 2000000; // 2 seconds |
|
28 |
|
29 // ---------------------------------------------------------------------- |
|
30 |
|
31 CLayoutMgrShutdown* CLayoutMgrShutdown::NewL() |
|
32 { |
|
33 TRACE_INFO( (_L("[HID]\tCLayoutMgrShutdown::NewL()"))); |
|
34 |
|
35 CLayoutMgrShutdown* self = new (ELeave) CLayoutMgrShutdown; |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(); |
|
39 return self; |
|
40 } |
|
41 |
|
42 void CLayoutMgrShutdown::ConstructL() |
|
43 { |
|
44 TRACE_INFO( (_L("[HID]\tCLayoutMgrShutdown::ConstructL() 0x%08x"), this)); |
|
45 |
|
46 CActiveScheduler::Add(this); |
|
47 User::LeaveIfError(iTimer.CreateLocal()); |
|
48 } |
|
49 |
|
50 CLayoutMgrShutdown::CLayoutMgrShutdown() |
|
51 : CActive(CActive::EPriorityStandard) |
|
52 {} |
|
53 |
|
54 CLayoutMgrShutdown::~CLayoutMgrShutdown() |
|
55 { |
|
56 TRACE_INFO( (_L("[HID]\tCLayoutMgrShutdown::~CLayoutMgrShutdown()"))); |
|
57 |
|
58 Cancel(); |
|
59 iTimer.Close(); |
|
60 } |
|
61 |
|
62 void CLayoutMgrShutdown::Start() |
|
63 { |
|
64 iTimer.After(iStatus, KShutdownInterval); |
|
65 SetActive(); |
|
66 } |
|
67 |
|
68 void CLayoutMgrShutdown::DoCancel() |
|
69 { |
|
70 iTimer.Cancel(); |
|
71 } |
|
72 |
|
73 void CLayoutMgrShutdown::RunL() |
|
74 { |
|
75 // Timer has expired, so cause the server to close down: |
|
76 CActiveScheduler::Stop(); |
|
77 } |
|
78 |
|
79 // ---------------------------------------------------------------------- |