57 :CSCPLockEventHandler( aServer ), |
57 :CSCPLockEventHandler( aServer ), |
58 iLockMessage( aLockMessage ), |
58 iLockMessage( aLockMessage ), |
59 iSession( aSession ), |
59 iSession( aSession ), |
60 iState( aState ), |
60 iState( aState ), |
61 iAutolock( aAutolock ), |
61 iAutolock( aAutolock ), |
62 iWaitingForAck( EFalse ), |
|
63 iAckReceived( EFalse ), |
|
64 iUnlockSent( EFalse ), |
62 iUnlockSent( EFalse ), |
65 iMessageStatus( KErrNone ) |
63 iMessageStatus( KErrNone ) |
66 { |
64 { |
67 Dprint( (_L("--> CSCPLockSettingEventHandler::CSCPLockSettingEventHandler()") )); |
65 Dprint( (_L("--> CSCPLockSettingEventHandler::CSCPLockSettingEventHandler()") )); |
68 |
66 |
254 } |
252 } |
255 |
253 |
256 Dprint( (_L("<-- CSCPLockSettingEventHandler::~CSCPLockSettingEventHandler()") )); |
254 Dprint( (_L("<-- CSCPLockSettingEventHandler::~CSCPLockSettingEventHandler()") )); |
257 } |
255 } |
258 |
256 |
259 |
|
260 // --------------------------------------------------------- |
|
261 // void CSCPLockSettingEventHandler::AckReceived() |
|
262 // Sets the ackReceived member to indicate that the call has |
|
263 // already been acknowledged. |
|
264 // |
|
265 // Status : Approved |
|
266 // --------------------------------------------------------- |
|
267 |
|
268 void CSCPLockSettingEventHandler::AckReceived() |
|
269 { |
|
270 iAckReceived = ETrue; |
|
271 } |
|
272 |
257 |
273 // --------------------------------------------------------- |
258 // --------------------------------------------------------- |
274 // void CSCPLockSettingEventHandler::SetAutolockStateL( TBool aActive ) |
259 // void CSCPLockSettingEventHandler::SetAutolockStateL( TBool aActive ) |
275 // Activates Autolock by signalling the SA/PubSub event, or |
260 // Activates Autolock by signalling the SA/PubSub event, or |
276 // deactivates it by sending it the deactivation message. |
261 // deactivates it by sending it the deactivation message. |
385 { |
370 { |
386 Dprint( (_L("CSCPLockSettingEventHandler::RunL(): Unlock call TIMEOUT") )); |
371 Dprint( (_L("CSCPLockSettingEventHandler::RunL(): Unlock call TIMEOUT") )); |
387 iMessageStatus = ret; |
372 iMessageStatus = ret; |
388 } |
373 } |
389 } |
374 } |
390 else if ( iWaitingForAck ) // Received an acknowledgement for the set lock setting call |
375 else // Received an acknowledgement for the set lock setting call |
391 { |
376 { |
392 if ( ret == KErrNone ) |
377 if ( ret == KErrNone ) |
393 { |
378 { |
394 Dprint( (_L("CSCPLockSettingEventHandler::RunL():\ |
379 Dprint( (_L("CSCPLockSettingEventHandler::RunL():\ |
395 Acknowledgement received") )); |
380 Acknowledgement received") )); |
400 Dprint( (_L("CSCPLockSettingEventHandler::RunL():\ |
385 Dprint( (_L("CSCPLockSettingEventHandler::RunL():\ |
401 Lock setting call TIMEOUT") )); |
386 Lock setting call TIMEOUT") )); |
402 iMessageStatus = ret; |
387 iMessageStatus = ret; |
403 } |
388 } |
404 } |
389 } |
405 else // SetLockSetting completed |
|
406 { |
|
407 // Save the status of the lock setting call |
|
408 iMessageStatus = ret; |
|
409 |
|
410 Dprint( (_L("CSCPLockSettingEventHandler::RunL():\ |
|
411 SetLockSetting returned: %d"), ret )); |
|
412 |
|
413 if ( iAckReceived ) |
|
414 { |
|
415 Dprint( (_L("CSCPLockSettingEventHandler::RunL(): Ack already received") )); |
|
416 startFinalPhase = ETrue; |
|
417 } |
|
418 else |
|
419 { |
|
420 iSession->LockOperationPending( ESCPCommandLockPhone, &iStatus ); |
|
421 iWaitingForAck = ETrue; |
|
422 finalCall = EFalse; |
|
423 SetActive(); // Wait for the session-class to complete this call |
|
424 } |
|
425 } |
|
426 |
390 |
427 if ( ( startFinalPhase ) && ( iAutolock ) ) |
391 if ( ( startFinalPhase ) && ( iAutolock ) ) |
428 { |
392 { |
|
393 Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-startFinalPhase") )); |
429 // Autolock activation/deactivation was requested |
394 // Autolock activation/deactivation was requested |
430 TRAPD( err, SetAutolockStateL( iState ) ); |
395 TRAPD( err, SetAutolockStateL( iState ) ); |
431 |
396 |
432 if ( err != KErrNone ) |
397 if ( err != KErrNone ) |
433 { |
398 { |
434 // If the call failed, send the result as the message status |
399 // If the call failed, send the result as the message status |
|
400 Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-err!=Kerrnone") )); |
435 iMessageStatus = err; |
401 iMessageStatus = err; |
436 } |
402 } |
437 else if ( !iState ) |
403 else if ( !iState ) |
438 { |
404 { |
439 // Inform the session-class that an unlock-message has been sent |
405 // Inform the session-class that an unlock-message has been sent |
440 // (the server won't respond to Autolock until the handler finishes) |
406 // (the server won't respond to Autolock until the handler finishes) |
|
407 Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-!iState") )); |
441 iSession->LockOperationPending( ESCPCommandUnlockPhone, &iStatus ); |
408 iSession->LockOperationPending( ESCPCommandUnlockPhone, &iStatus ); |
442 iUnlockSent = ETrue; |
409 iUnlockSent = ETrue; |
443 finalCall = EFalse; |
410 finalCall = EFalse; |
444 SetActive(); // Wait for the session-class to complete this call |
411 SetActive(); // Wait for the session-class to complete this call |
445 } |
412 } |
467 // |
434 // |
468 void CSCPLockSettingEventHandler::DoCancel() |
435 void CSCPLockSettingEventHandler::DoCancel() |
469 { |
436 { |
470 Dprint( (_L("--> CSCPLockSettingEventHandler::DoCancel()") )); |
437 Dprint( (_L("--> CSCPLockSettingEventHandler::DoCancel()") )); |
471 |
438 |
472 if ( !iWaitingForAck ) |
439 iPhone->CancelAsyncRequest( EMobilePhoneSetLockSetting ); |
473 { |
|
474 iPhone->CancelAsyncRequest( EMobilePhoneSetLockSetting ); |
|
475 } |
|
476 |
440 |
477 iLockMessage.Complete( KErrCancel ); |
441 iLockMessage.Complete( KErrCancel ); |
478 iSession->LockOperationCompleted(); |
442 iSession->LockOperationCompleted(); |
479 |
443 |
480 Dprint( (_L("<-- CSCPLockSettingEventHandler::DoCancel()") )); |
444 Dprint( (_L("<-- CSCPLockSettingEventHandler::DoCancel()") )); |