14 * Description: Handles SendUssd command |
14 * Description: Handles SendUssd command |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <cphcltussdsatclient.h> |
19 #include <CPhCltUssdSatClient.h> |
20 #include <cphcltussd.h> |
20 #include <CPhCltUssd.h> |
|
21 #include <AknGlobalNote.h> |
21 #include <exterror.h> |
22 #include <exterror.h> |
|
23 #include <avkon.rsg> |
|
24 #include <centralrepository.h> |
|
25 #include <SATPrivateCRKeys.h> |
22 |
26 |
23 #include "MSatSystemState.h" |
27 #include "MSatSystemState.h" |
24 #include "MSatApi.h" |
28 #include "MSatApi.h" |
25 #include "MSatUtils.h" |
29 #include "MSatUtils.h" |
26 #include "MSatUiSession.h" |
30 #include "MSatUiSession.h" |
562 iNotificationData(), |
566 iNotificationData(), |
563 iNotificationDataPckg( iNotificationData ), |
567 iNotificationDataPckg( iNotificationData ), |
564 iNotificationRsp(), |
568 iNotificationRsp(), |
565 iNotificationRspPckg( iNotificationRsp ), |
569 iNotificationRspPckg( iNotificationRsp ), |
566 // To be removed when icons are allowed in this command |
570 // To be removed when icons are allowed in this command |
567 iIconCommand( EFalse ) |
571 iIconCommand( EFalse ), |
|
572 iIsSatDisplayUssdResult( EFalse ) |
568 { |
573 { |
569 LOG( SIMPLE, |
574 LOG( SIMPLE, |
570 "SENDUSSD: CSendUssdHandler::CSendUssdHandler calling - exiting" ) |
575 "SENDUSSD: CSendUssdHandler::CSendUssdHandler calling" ) |
|
576 CRepository* repository = NULL; |
|
577 |
|
578 TRAPD( result, repository = CRepository::NewL( KCRUidSatServer ); ); |
|
579 LOG2( NORMAL, "SENDUSSD: CSendUssdHandler::CSendUssdHandler \ |
|
580 open CRepository result: %d", result ) |
|
581 |
|
582 if ( repository && ( KErrNone == result ) ) |
|
583 { |
|
584 result = repository->Get( KSatDisplayUssdResult, |
|
585 iIsSatDisplayUssdResult ); |
|
586 LOG2( NORMAL, |
|
587 "SENDUSSD: CSendUssdHandler::CSendUssdHandler \ |
|
588 get CRepository key iIsSatDisplayUssdResult: %d", |
|
589 iIsSatDisplayUssdResult ) |
|
590 |
|
591 if ( KErrNone != result ) |
|
592 { |
|
593 LOG2( NORMAL, |
|
594 "SENDUSSD: CSendUssdHandler::CSendUssdHandler \ |
|
595 get CRepository key error result: %d", |
|
596 result ) |
|
597 } |
|
598 } |
|
599 |
|
600 delete repository; |
|
601 repository = NULL; |
|
602 |
|
603 LOG( SIMPLE, |
|
604 "SENDUSSD: CSendUssdHandler::CSendUssdHandler exiting" ) |
571 } |
605 } |
572 |
606 |
573 |
607 |
574 // ----------------------------------------------------------------------------- |
608 // ----------------------------------------------------------------------------- |
575 // Handles the Ussd string sending |
609 // Handles the Ussd string sending |
592 receiveMessage, |
626 receiveMessage, |
593 sendCompletedFirst, |
627 sendCompletedFirst, |
594 iSendUssdRsp.iUssdString.iDcs ) ); |
628 iSendUssdRsp.iUssdString.iDcs ) ); |
595 |
629 |
596 iSendUssdRsp.iUssdString.iUssdString.Copy( receiveMessage ); |
630 iSendUssdRsp.iUssdString.iUssdString.Copy( receiveMessage ); |
|
631 |
|
632 if ( ( RSat::EAlphaIdProvided != iSendUssdData.iAlphaId.iStatus ) |
|
633 && iIsSatDisplayUssdResult ) |
|
634 { |
|
635 // if no Alpha ID provided, show the text note. |
|
636 LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString \ |
|
637 Show USSD result Note" ) |
|
638 TRAP_IGNORE( |
|
639 ShowUssdResponseNoteL( |
|
640 iSendUssdRsp.iUssdString.iUssdString ) ); |
|
641 } |
597 |
642 |
598 HandleSendUssdResult( error ); |
643 HandleSendUssdResult( error ); |
599 |
644 |
600 LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString exiting" ) |
645 LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString exiting" ) |
601 } |
646 } |
669 |
714 |
670 LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdStringL exiting" ) |
715 LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdStringL exiting" ) |
671 } |
716 } |
672 |
717 |
673 // ----------------------------------------------------------------------------- |
718 // ----------------------------------------------------------------------------- |
|
719 // Show the ussd response note. |
|
720 // ----------------------------------------------------------------------------- |
|
721 // |
|
722 void CSendUssdHandler::ShowUssdResponseNoteL( const TDesC& aText ) |
|
723 { |
|
724 LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ShowUssdResponseNoteL calling" ) |
|
725 |
|
726 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
|
727 note->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY ); |
|
728 note->ShowNoteL( EAknGlobalConfirmationNote, |
|
729 iSendUssdRsp.iUssdString.iUssdString ); |
|
730 CleanupStack::PopAndDestroy( note ); |
|
731 |
|
732 LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ShowUssdResponseNoteL exiting" ) |
|
733 } |
|
734 |
|
735 // ----------------------------------------------------------------------------- |
674 // Handles the result of Ussd sending. |
736 // Handles the result of Ussd sending. |
675 // ----------------------------------------------------------------------------- |
737 // ----------------------------------------------------------------------------- |
676 // |
738 // |
677 void CSendUssdHandler::HandleSendUssdResult( TInt aError ) |
739 void CSendUssdHandler::HandleSendUssdResult( TInt aError ) |
678 { |
740 { |
690 iSendUssdRsp.iAdditionalInfo.Zero(); |
752 iSendUssdRsp.iAdditionalInfo.Zero(); |
691 } |
753 } |
692 else if ( TSatExtErrorUtils::IsExtendedError( aError ) ) // extended error |
754 else if ( TSatExtErrorUtils::IsExtendedError( aError ) ) // extended error |
693 { |
755 { |
694 TUint8 addInfo( 0 ); |
756 TUint8 addInfo( 0 ); |
|
757 // In subcase 2, SAT always gets KErrGsmCCCallRejected |
695 if ( KErrGsmCCCallRejected == aError ) |
758 if ( KErrGsmCCCallRejected == aError ) |
696 { |
759 { |
697 LOG( SIMPLE, |
760 LOG( SIMPLE, |
698 "SENDUSSD: CSendUssdHandler::HandleSendUssdResult permanent error" ) |
761 "SENDUSSD: CSendUssdHandler::HandleSendUssdResult permanent error" ) |
699 // ussd request is rejected by SIM |
762 // ussd request is rejected by SIM |
768 "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \ |
831 "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \ |
769 KModifiedByCallControl" ) |
832 KModifiedByCallControl" ) |
770 iSendUssdRsp.iGeneralResult = RSat::KModifiedByCallControl; |
833 iSendUssdRsp.iGeneralResult = RSat::KModifiedByCallControl; |
771 iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo; |
834 iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo; |
772 iSendUssdRsp.iAdditionalInfo.SetLength( 0 ); |
835 iSendUssdRsp.iAdditionalInfo.SetLength( 0 ); |
773 iSendUssdRsp.iAdditionalInfo.Zero(); |
836 iSendUssdRsp.iAdditionalInfo.Zero(); |
774 } |
837 } |
775 else if ( KErrNone == aError ) // Success case |
838 else if ( KErrNone == aError ) // Success case |
776 { |
839 { |
777 LOG( SIMPLE, |
840 LOG( SIMPLE, |
778 "SENDUSSD: CSendUssdHandler::HandleSendUssdResult success" ) |
841 "SENDUSSD: CSendUssdHandler::HandleSendUssdResult success" ) |
779 // Convert terminal rsp if icon used |
842 // Convert terminal rsp if icon used |