|
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: Predefined contacts engine (state machine) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <startupdomainpskeys.h> |
|
20 #include "DevEncStarterEngine.h" |
|
21 #include "DevEncStarterdef.h" |
|
22 #include "DevEncLog.h" |
|
23 #include "DevEncStarterMmcObserver.h" |
|
24 #include "DevEncUids.hrh" |
|
25 #include "DevEncStarterUtils.h" |
|
26 #include "DevEncProtectedPSKey.h" |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // CDevEncStarterEngine::NewLC |
|
30 // C++ constructor |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 CDevEncStarterEngine* CDevEncStarterEngine::NewLC() |
|
34 { |
|
35 DFLOG( "CDevEncStarterAppUi::NewLC" ); |
|
36 CDevEncStarterEngine* self = new( ELeave ) CDevEncStarterEngine(); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 return self; |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CDevEncStarterEngine::CDevEncStarterEngine |
|
44 // C++ constructor |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CDevEncStarterEngine::CDevEncStarterEngine() |
|
48 : CActive( EPriorityNormal ) |
|
49 { |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CDevEncStarterEngine::ConstructL |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 void CDevEncStarterEngine::ConstructL() |
|
57 { |
|
58 DFLOG( "CDevEncStarterAppUi::ConstructL" ); |
|
59 iUtils = CDevEncStarterUtils::NewL(); |
|
60 iMmcObserver = CDevEncStarterMmcObserver::NewL( iUtils ); |
|
61 |
|
62 const TSecurityPolicy policy( ECapability_None ); |
|
63 RProperty::Define( KDevEncProtectedUid, KDevEncOperationKey, RProperty::EInt, policy, policy ); |
|
64 |
|
65 iProperty.Attach( KPSUidStartup, KPSGlobalSystemState ); |
|
66 CActiveScheduler::Add( this ); |
|
67 |
|
68 iProperty.Subscribe( iStatus ); |
|
69 SetActive(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CDevEncStarterEngine::~CDevEncStarterEngine |
|
74 // Destructor |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CDevEncStarterEngine::~CDevEncStarterEngine() |
|
78 { |
|
79 DFLOG( "CDevEncStarterAppUi::~CDevEncStarterAppUi" ); |
|
80 |
|
81 delete iMmcObserver; |
|
82 delete iUtils; |
|
83 |
|
84 RProperty::Delete( KDevEncProtectedUid, KDevEncOperationKey ); |
|
85 |
|
86 Cancel(); |
|
87 iProperty.Close(); |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CDevEncStarterEngine::DoCancel |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 void CDevEncStarterEngine::DoCancel() |
|
95 { |
|
96 DFLOG( "CDevEncStarterEngine::DoCancel()" ); |
|
97 iProperty.Cancel(); |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CDevEncStarterEngine::RunL |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CDevEncStarterEngine::RunL() |
|
105 { |
|
106 DFLOG( "CDevEncStarterEngine::RunL()" ); |
|
107 TInt value( 0 ); |
|
108 iProperty.Get( value ); |
|
109 |
|
110 if( value == ESwStateShuttingDown ) |
|
111 { |
|
112 CActiveScheduler::Stop(); |
|
113 } |
|
114 else |
|
115 { |
|
116 iProperty.Subscribe( iStatus ); |
|
117 SetActive(); |
|
118 } |
|
119 } |
|
120 |
|
121 // End of file |
|
122 |
|
123 |