|
1 /* |
|
2 * Copyright (c) 2002-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: |
|
15 * CSmumStartUpMonitor implementation file |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32base.h> |
|
23 #include <startupdomainpskeys.h> |
|
24 #include "MsgSimSCNumberDetector.h" |
|
25 #include "SmumStartUpMonitor.h" |
|
26 |
|
27 #include "SmumLogging.h" |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ======================= |
|
32 |
|
33 // --------------------------------------------------------- |
|
34 // CSmumStartUpMonitor::CSmumStartUpMonitor |
|
35 // |
|
36 // C++ constructor can NOT contain any code, that |
|
37 // might leave. |
|
38 // --------------------------------------------------------- |
|
39 // |
|
40 CSmumStartUpMonitor::CSmumStartUpMonitor( CMsgSimOperation* aWatcher ) |
|
41 : CActive( CActive::EPriorityStandard ), |
|
42 iWatcher( aWatcher ) |
|
43 { |
|
44 SMUMLOGGER_WRITE("CSmumStartUpMonitor::CSmumStartUpMonitor"); |
|
45 CActiveScheduler::Add( this ); |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------- |
|
49 // CSmumStartUpMonitor::ConstructL() |
|
50 // |
|
51 // Symbian OS default constructor can leave. |
|
52 // --------------------------------------------------------- |
|
53 // |
|
54 void CSmumStartUpMonitor::ConstructL() |
|
55 { |
|
56 SMUMLOGGER_ENTERFN("CSmumStartUpMonitor::ConstructL"); |
|
57 User::LeaveIfError( iStartupProperty.Attach( KPSUidStartup, KPSGlobalSystemState ) ); |
|
58 // Complete self |
|
59 iStatus = KRequestPending; |
|
60 TRequestStatus* pStatus = &iStatus; |
|
61 SetActive(); |
|
62 User::RequestComplete( pStatus, KErrNone ); |
|
63 SMUMLOGGER_LEAVEFN("CSmumStartUpMonitor::ConstructL"); |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------- |
|
67 // CSmumStartUpMonitor::NewL |
|
68 // |
|
69 // Two-phased constructor. |
|
70 // --------------------------------------------------------- |
|
71 // |
|
72 CSmumStartUpMonitor* CSmumStartUpMonitor::NewL( CMsgSimOperation* aWatcher ) |
|
73 { |
|
74 SMUMLOGGER_ENTERFN("CSmumStartUpMonitor::NewL 2"); |
|
75 CSmumStartUpMonitor* self = new ( ELeave ) |
|
76 CSmumStartUpMonitor( aWatcher ); |
|
77 |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL(); |
|
80 CleanupStack::Pop(); |
|
81 |
|
82 SMUMLOGGER_LEAVEFN("CSmumStartUpMonitor::NewL 2"); |
|
83 return self; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // CSmumStartUpMonitor::~CSmumStartUpMonitor |
|
88 // |
|
89 // Destructor |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 CSmumStartUpMonitor::~CSmumStartUpMonitor() |
|
93 { |
|
94 Cancel(); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------- |
|
98 // CSmumStartUpMonitor::DoCancel |
|
99 // |
|
100 // From active object framework |
|
101 // --------------------------------------------------------- |
|
102 // |
|
103 void CSmumStartUpMonitor::DoCancel() |
|
104 { |
|
105 iStartupProperty.Cancel(); |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------- |
|
109 // CSmumStartUpMonitor::RunL |
|
110 // |
|
111 // From active object framework |
|
112 // --------------------------------------------------------- |
|
113 // |
|
114 void CSmumStartUpMonitor::RunL() |
|
115 { |
|
116 SMUMLOGGER_ENTERFN("CSmumStartUpMonitor::RunL"); |
|
117 TInt startupState = 0; |
|
118 iStartupProperty.Get( startupState ); |
|
119 |
|
120 if ( startupState == ESwStateNormalRfOn || |
|
121 startupState == ESwStateNormalRfOff || |
|
122 startupState == ESwStateNormalBTSap ) |
|
123 { |
|
124 iWatcher->HandleStartupReadyL(); |
|
125 } |
|
126 else |
|
127 { |
|
128 iStatus = KRequestPending; |
|
129 iStartupProperty.Subscribe( iStatus ); |
|
130 SetActive(); |
|
131 } |
|
132 SMUMLOGGER_LEAVEFN("CSmumStartUpMonitor::RunL"); |
|
133 |
|
134 } |
|
135 |
|
136 // ================= OTHER EXPORTED FUNCTIONS ============== |
|
137 |
|
138 // End of File |