satengine/SatServer/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp
branchRCL_3
changeset 11 586d88ba9aa1
parent 9 71e7b994dff4
child 18 594d59766373
equal deleted inserted replaced
9:71e7b994dff4 11:586d88ba9aa1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    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>
    22 
    24 
    23 #include    "MSatSystemState.h"
    25 #include    "MSatSystemState.h"
    24 #include    "MSatApi.h"
    26 #include    "MSatApi.h"
    25 #include    "MSatUtils.h"
    27 #include    "MSatUtils.h"
    26 #include    "MSatUiSession.h"
    28 #include    "MSatUiSession.h"
   255     {
   257     {
   256     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::CommandAllowed calling" )
   258     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::CommandAllowed calling" )
   257 
   259 
   258     // Allow next terminal response to be sent
   260     // Allow next terminal response to be sent
   259     iTerminalRespSent = EFalse;
   261     iTerminalRespSent = EFalse;
       
   262     
       
   263     iSendUssdRsp.iUssdString.iUssdString.FillZ();
       
   264     iSendUssdRsp.iUssdString.iDcs = 0;
   260 
   265 
   261     RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
   266     RMobilePhone::TMobilePhoneRegistrationStatus registrationStatus(
   262         iUtils->SystemState().GetNetworkRegistrationStatus() );
   267         iUtils->SystemState().GetNetworkRegistrationStatus() );
   263 
   268 
   264     TBool commandAllowed( ETrue );
   269     TBool commandAllowed( ETrue );
   590         sendCompletedFirst,
   595         sendCompletedFirst,
   591         iSendUssdRsp.iUssdString.iDcs ) );
   596         iSendUssdRsp.iUssdString.iDcs ) );
   592 
   597 
   593     iSendUssdRsp.iUssdString.iUssdString.Copy( receiveMessage );
   598     iSendUssdRsp.iUssdString.iUssdString.Copy( receiveMessage );
   594 
   599 
       
   600     if ( RSat::EAlphaIdProvided != iSendUssdData.iAlphaId.iStatus )
       
   601         {
       
   602         // if no Alpha ID provided, show the text note.
       
   603         LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString Show Note" )
       
   604         TRAP_IGNORE( 
       
   605             ShowUssdResponseNoteL( iSendUssdRsp.iUssdString.iUssdString ) );
       
   606         }
       
   607 
   595     HandleSendUssdResult( error );
   608     HandleSendUssdResult( error );
   596 
   609 
   597     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString exiting" )
   610     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString exiting" )
   598     }
   611     }
   599 
   612 
   665     User::LeaveIfError( error );
   678     User::LeaveIfError( error );
   666 
   679 
   667     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdStringL exiting" )
   680     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdStringL exiting" )
   668     }
   681     }
   669     
   682     
       
   683 // -----------------------------------------------------------------------------
       
   684 // Show the ussd response note.
       
   685 // -----------------------------------------------------------------------------
       
   686 //
       
   687 void CSendUssdHandler::ShowUssdResponseNoteL( const TDesC& aText )
       
   688     {
       
   689     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ShowUssdResponseNoteL calling" )
       
   690 
       
   691     CAknGlobalNote* note = CAknGlobalNote::NewLC();
       
   692     note->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY );
       
   693     note->ShowNoteL( EAknGlobalConfirmationNote,
       
   694         iSendUssdRsp.iUssdString.iUssdString );
       
   695     CleanupStack::PopAndDestroy( note );
       
   696 
       
   697     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ShowUssdResponseNoteL exiting" )
       
   698     }
       
   699 
   670 // -----------------------------------------------------------------------------
   700 // -----------------------------------------------------------------------------
   671 // Handles the result of Ussd sending.
   701 // Handles the result of Ussd sending.
   672 // -----------------------------------------------------------------------------
   702 // -----------------------------------------------------------------------------
   673 //
   703 //
   674 void CSendUssdHandler::HandleSendUssdResult( TInt aError )
   704 void CSendUssdHandler::HandleSendUssdResult( TInt aError )
   885     if ( !iTerminalRespSent )
   915     if ( !iTerminalRespSent )
   886         {
   916         {
   887         LOG( SIMPLE, 
   917         LOG( SIMPLE, 
   888         "SENDUSSD: CSendUssdHandler::SendTerminalResponse iTerminalRespSent \
   918         "SENDUSSD: CSendUssdHandler::SendTerminalResponse iTerminalRespSent \
   889         false" )
   919         false" )
       
   920         
       
   921         LOG3(SIMPLE, "SENDUSSD: CSendUssdHandler::SendTerminalResponse \
       
   922             iDcs=%d,iUssdString=%s", iSendUssdRsp.iUssdString.iDcs,
       
   923             &iSendUssdRsp.iUssdString.iUssdString);
       
   924         
   890         iTerminalRespSent = ETrue;
   925         iTerminalRespSent = ETrue;
   891         iSendUssdRsp.SetPCmdNumber( iSendUssdData.PCmdNumber() );
   926         iSendUssdRsp.SetPCmdNumber( iSendUssdData.PCmdNumber() );
   892         TerminalRsp( RSat::ESendUssd, iSendUssdRspPckg );
   927         TerminalRsp( RSat::ESendUssd, iSendUssdRspPckg );
   893         }
   928         }
   894 
   929