satengine/SatServer/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp
branchRCL_3
changeset 19 7d48bed6ce0c
parent 18 594d59766373
child 20 987c9837762f
equal deleted inserted replaced
18:594d59766373 19:7d48bed6ce0c
    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>
       
    22 #include    <exterror.h>
    21 #include    <exterror.h>
    23 #include    <avkon.rsg>
       
    24 #include    <centralrepository.h>
       
    25 #include    <SATPrivateCRKeys.h>
       
    26 
    22 
    27 #include    "MSatSystemState.h"
    23 #include    "MSatSystemState.h"
    28 #include    "MSatApi.h"
    24 #include    "MSatApi.h"
    29 #include    "MSatUtils.h"
    25 #include    "MSatUtils.h"
    30 #include    "MSatUiSession.h"
    26 #include    "MSatUiSession.h"
   566     iNotificationData(),
   562     iNotificationData(),
   567     iNotificationDataPckg( iNotificationData ),
   563     iNotificationDataPckg( iNotificationData ),
   568     iNotificationRsp(),
   564     iNotificationRsp(),
   569     iNotificationRspPckg( iNotificationRsp ),
   565     iNotificationRspPckg( iNotificationRsp ),
   570     // To be removed when icons are allowed in this command
   566     // To be removed when icons are allowed in this command
   571     iIconCommand( EFalse ),
   567     iIconCommand( EFalse )
   572     iIsSatDisplayUssdResult( EFalse )
       
   573     {
   568     {
   574     LOG( SIMPLE,
   569     LOG( SIMPLE,
   575         "SENDUSSD: CSendUssdHandler::CSendUssdHandler calling" )
   570         "SENDUSSD: CSendUssdHandler::CSendUssdHandler calling - exiting" )
   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" )
       
   605     }
   571     }
   606 
   572 
   607 
   573 
   608 // -----------------------------------------------------------------------------
   574 // -----------------------------------------------------------------------------
   609 // Handles the Ussd string sending
   575 // Handles the Ussd string sending
   626         receiveMessage,
   592         receiveMessage,
   627         sendCompletedFirst,
   593         sendCompletedFirst,
   628         iSendUssdRsp.iUssdString.iDcs ) );
   594         iSendUssdRsp.iUssdString.iDcs ) );
   629 
   595 
   630     iSendUssdRsp.iUssdString.iUssdString.Copy( receiveMessage );
   596     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         }
       
   642 
   597 
   643     HandleSendUssdResult( error );
   598     HandleSendUssdResult( error );
   644 
   599 
   645     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString exiting" )
   600     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString exiting" )
   646     }
   601     }
   714 
   669 
   715     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdStringL exiting" )
   670     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdStringL exiting" )
   716     }
   671     }
   717     
   672     
   718 // -----------------------------------------------------------------------------
   673 // -----------------------------------------------------------------------------
   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 // -----------------------------------------------------------------------------
       
   736 // Handles the result of Ussd sending.
   674 // Handles the result of Ussd sending.
   737 // -----------------------------------------------------------------------------
   675 // -----------------------------------------------------------------------------
   738 //
   676 //
   739 void CSendUssdHandler::HandleSendUssdResult( TInt aError )
   677 void CSendUssdHandler::HandleSendUssdResult( TInt aError )
   740     {
   678     {
   752         iSendUssdRsp.iAdditionalInfo.Zero();
   690         iSendUssdRsp.iAdditionalInfo.Zero();
   753         }
   691         }
   754     else if ( TSatExtErrorUtils::IsExtendedError( aError ) ) // extended error
   692     else if ( TSatExtErrorUtils::IsExtendedError( aError ) ) // extended error
   755         {
   693         {
   756         TUint8 addInfo( 0 );
   694         TUint8 addInfo( 0 );
   757         // In subcase 2, SAT always gets KErrGsmCCCallRejected
       
   758         if ( KErrGsmCCCallRejected == aError )   
   695         if ( KErrGsmCCCallRejected == aError )   
   759            {
   696            {
   760            LOG( SIMPLE, 
   697            LOG( SIMPLE, 
   761            "SENDUSSD: CSendUssdHandler::HandleSendUssdResult permanent error" )	
   698            "SENDUSSD: CSendUssdHandler::HandleSendUssdResult permanent error" )	
   762            // ussd request is rejected by SIM
   699            // ussd request is rejected by SIM
   831         "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \
   768         "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \
   832         KModifiedByCallControl" )
   769         KModifiedByCallControl" )
   833         iSendUssdRsp.iGeneralResult = RSat::KModifiedByCallControl;
   770         iSendUssdRsp.iGeneralResult = RSat::KModifiedByCallControl;
   834         iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
   771         iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
   835         iSendUssdRsp.iAdditionalInfo.SetLength( 0 );
   772         iSendUssdRsp.iAdditionalInfo.SetLength( 0 );
   836         iSendUssdRsp.iAdditionalInfo.Zero(); 
   773         iSendUssdRsp.iAdditionalInfo.Zero();
   837         }
   774 		}
   838     else if ( KErrNone == aError )   //  Success case
   775     else if ( KErrNone == aError )   //  Success case
   839         {
   776         {
   840         LOG( SIMPLE, 
   777         LOG( SIMPLE, 
   841         "SENDUSSD: CSendUssdHandler::HandleSendUssdResult success" )
   778         "SENDUSSD: CSendUssdHandler::HandleSendUssdResult success" )
   842         // Convert terminal rsp if icon used
   779         // Convert terminal rsp if icon used