77 return KErrInUse; |
78 return KErrInUse; |
78 } |
79 } |
79 |
80 |
80 iStatus = KRequestPending; |
81 iStatus = KRequestPending; |
81 |
82 |
82 switch(iType) { |
83 switch(iType) |
83 case ESecUiDeviceLockObserver: |
84 { |
84 |
85 case ESecUiDeviceLockObserver: |
85 Dprint(_L("CSCPLockObserver::Start() Device Lock Observer")); |
86 |
86 |
87 Dprint(_L("CSCPLockObserver::Start() Device Lock Observer")); |
87 iProperty.Attach(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus); |
88 |
88 break; |
89 iProperty.Attach(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus); |
89 case ESecUiCallStateObserver: { |
90 break; |
90 Dprint(_L("CSCPLockObserver::Start() Call State Observer")); |
91 case ESecUiCallStateObserver: |
91 iProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState); |
92 |
|
93 Dprint(_L("CSCPLockObserver::Start() Call State Observer")); |
|
94 |
|
95 iProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState); |
|
96 break; |
|
97 |
|
98 default: |
|
99 break; |
92 } |
100 } |
93 break; |
|
94 |
|
95 default: |
|
96 break; |
|
97 } |
|
98 |
101 |
99 iProperty.Subscribe(iStatus); |
102 iProperty.Subscribe(iStatus); |
|
103 SetActive(); |
100 iSubscribedToEvent = ETrue; |
104 iSubscribedToEvent = ETrue; |
101 SetActive(); |
105 |
102 Dprint(_L("CSCPLockObserver::Start() END")); |
106 Dprint(_L("CSCPLockObserver::Start() END")); |
|
107 |
103 return KErrNone; |
108 return KErrNone; |
104 } |
109 } |
105 // |
110 // |
106 // ---------------------------------------------------------- |
111 // ---------------------------------------------------------- |
107 // CLockObserver::CLockObserver() |
112 // CLockObserver::CLockObserver() |
108 // C++ constructor |
113 // C++ constructor |
109 // ---------------------------------------------------------- |
114 // ---------------------------------------------------------- |
110 // |
115 // |
111 CSCPLockObserver :: CSCPLockObserver(CSCPQueryDialog* aDialog, TInt aType) : CActive(0), |
116 CSCPLockObserver::CSCPLockObserver(CSCPQueryDialog* aDialog, TInt aType) : CActive(0), iDialog(aDialog), iSubscribedToEvent(EFalse), iType(aType) |
112 iDialog(aDialog), iType(aType), |
117 { |
113 iInformCallEnding(EFalse), iSubscribedToEvent(EFalse) { |
118 } |
114 |
|
115 TInt lStatus; |
|
116 RProperty :: Get(KPSUidCtsyCallInformation, KCTsyCallState, lStatus); |
|
117 |
|
118 switch(lStatus) { |
|
119 default: |
|
120 case EPSCTsyCallStateUninitialized: |
|
121 case EPSCTsyCallStateNone: |
|
122 iInformCallEnding = EFalse; |
|
123 break; |
|
124 case EPSCTsyCallStateDisconnecting: |
|
125 case EPSCTsyCallStateAlerting: |
|
126 case EPSCTsyCallStateHold: |
|
127 case EPSCTsyCallStateRinging: |
|
128 case EPSCTsyCallStateDialling: |
|
129 case EPSCTsyCallStateAnswering: |
|
130 case EPSCTsyCallStateConnected: |
|
131 iInformCallEnding = ETrue; |
|
132 break; |
|
133 }; |
|
134 } |
|
135 // |
119 // |
136 // ---------------------------------------------------------- |
120 // ---------------------------------------------------------- |
137 // CSCPLockObserver::ConstructL() |
121 // CSCPLockObserver::ConstructL() |
138 // Symbian OS default constructor |
122 // Symbian OS default constructor |
139 // ---------------------------------------------------------- |
123 // ---------------------------------------------------------- |
155 // ---------------------------------------------------------- |
139 // ---------------------------------------------------------- |
156 // CSCPLockObserver::RunL() |
140 // CSCPLockObserver::RunL() |
157 // Called by Active Scheduler |
141 // Called by Active Scheduler |
158 // ---------------------------------------------------------- |
142 // ---------------------------------------------------------- |
159 // |
143 // |
160 void CSCPLockObserver :: RunL() { |
144 void CSCPLockObserver::RunL() |
161 Dprint(_L("[CSCPLockObserver]-> RunL() >>>")); |
145 { |
162 |
146 |
163 switch(iType) { |
147 Dprint(_L("CSCPLockObserver::RunL() BEGIN")); |
164 case ESecUiDeviceLockObserver: |
148 |
165 TInt autolockState; |
149 |
166 iProperty.Get(autolockState); |
150 switch(iType) |
167 |
151 { |
168 if(autolockState > EAutolockOff) { |
152 case ESecUiDeviceLockObserver: |
169 Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Device Lock")); |
153 TInt autolockState; |
170 iDialog->TryCancelQueryL(ESecUiDeviceLocked); |
154 iProperty.Get( autolockState ); |
171 iSubscribedToEvent = EFalse; |
155 if (autolockState > EAutolockOff) |
|
156 { |
|
157 |
|
158 Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Device Lock")); |
|
159 |
|
160 iDialog->TryCancelQueryL(ESecUiDeviceLocked); |
|
161 iSubscribedToEvent = EFalse; |
|
162 } |
|
163 break; |
|
164 case ESecUiCallStateObserver: |
|
165 TInt callState; |
|
166 iProperty.Get( callState ); |
|
167 |
|
168 Dprint( (_L("CSCPLockObserver::RunL() callState : %d"),callState )); |
|
169 if(callState == EPSCTsyCallStateDisconnecting) |
|
170 { |
|
171 |
|
172 Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Active Call")); |
|
173 |
|
174 iDialog->TryCancelQueryL(EPSCTsyCallStateDisconnecting); |
|
175 iSubscribedToEvent = EFalse; |
|
176 } |
|
177 break; |
|
178 |
|
179 default: |
|
180 break; |
172 } |
181 } |
173 else if((autolockState == EAutolockOff)||(autolockState == EAutolockStatusUninitialized)) |
182 |
174 { |
183 |
175 Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Device UnLocked")); |
184 |
176 iDialog->TryCancelQueryL(ESecUiNone); |
185 Dprint(_L("CSCPLockObserver::RunL() END")); |
177 iSubscribedToEvent = EFalse; |
186 |
178 } |
187 } |
179 break; |
|
180 case ESecUiCallStateObserver: { |
|
181 TInt callState; |
|
182 iProperty.Get(callState); |
|
183 Dprint( (_L("CSCPLockObserver::RunL() callState before Start() : %d"), callState )); |
|
184 Start(); |
|
185 |
|
186 switch(callState) { |
|
187 default: |
|
188 break; |
|
189 case EPSCTsyCallStateNone: |
|
190 if(iInformCallEnding) { |
|
191 Dprint( (_L("CSCPLockObserver::RunL() Branched to EPSCTsyCallStateNone"))); |
|
192 iDialog->TryCancelQueryL(EEnded); |
|
193 iInformCallEnding = EFalse; |
|
194 } |
|
195 break; |
|
196 case EPSCTsyCallStateAlerting: |
|
197 case EPSCTsyCallStateHold: |
|
198 case EPSCTsyCallStateRinging: |
|
199 case EPSCTsyCallStateDialling: |
|
200 case EPSCTsyCallStateAnswering: |
|
201 case EPSCTsyCallStateConnected: { |
|
202 Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Active Call")); |
|
203 TRAPD(lErr, iDialog->TryCancelQueryL(EInProgress)); |
|
204 Dprint( (_L("CSCPLockObserver::RunL() lErr : %d"), lErr )); |
|
205 iInformCallEnding = ETrue; |
|
206 } |
|
207 break; |
|
208 }; |
|
209 } |
|
210 break; |
|
211 default: |
|
212 break; |
|
213 } |
|
214 |
|
215 Dprint(_L("[CSCPLockObserver]-> RunL() <<<")); |
|
216 } |
|
217 |
|
218 // ---------------------------------------------------------------------------- |
188 // ---------------------------------------------------------------------------- |
219 // CSCPLockObserver::RunError |
189 // CSCPLockObserver::RunError |
220 // ---------------------------------------------------------------------------- |
190 // ---------------------------------------------------------------------------- |
221 TInt CSCPLockObserver::RunError ( TInt /*aError*/ ) |
191 TInt CSCPLockObserver::RunError ( TInt /*aError*/ ) |
222 { |
192 { |
223 return KErrNone; |
193 return KErrNone; |
224 } |
194 } |
225 |
|
226 |
|
227 // |
195 // |
228 // ---------------------------------------------------------- |
196 // ---------------------------------------------------------- |
229 // CSCPLockObserver::DoCancel() |
197 // CSCPLockObserver::DoCancel() |
230 // Cancels event listening |
198 // Cancels event listening |
231 // ---------------------------------------------------------- |
199 // ---------------------------------------------------------- |