satengine/SatServer/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
--- a/satengine/SatServer/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp	Tue Aug 31 15:45:17 2010 +0300
+++ b/satengine/SatServer/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp	Wed Sep 01 12:15:03 2010 +0100
@@ -16,9 +16,13 @@
 */
 
 
-#include    <cphcltussdsatclient.h>
-#include	<cphcltussd.h>
+#include    <CPhCltUssdSatClient.h>
+#include    <CPhCltUssd.h>
+#include    <AknGlobalNote.h>
 #include    <exterror.h>
+#include    <avkon.rsg>
+#include    <centralrepository.h>
+#include    <SATPrivateCRKeys.h>
 
 #include    "MSatSystemState.h"
 #include    "MSatApi.h"
@@ -564,10 +568,40 @@
     iNotificationRsp(),
     iNotificationRspPckg( iNotificationRsp ),
     // To be removed when icons are allowed in this command
-    iIconCommand( EFalse )
+    iIconCommand( EFalse ),
+    iIsSatDisplayUssdResult( EFalse )
     {
     LOG( SIMPLE,
-        "SENDUSSD: CSendUssdHandler::CSendUssdHandler calling - exiting" )
+        "SENDUSSD: CSendUssdHandler::CSendUssdHandler calling" )
+    CRepository* repository = NULL;
+
+    TRAPD( result, repository = CRepository::NewL( KCRUidSatServer ); );
+    LOG2( NORMAL, "SENDUSSD: CSendUssdHandler::CSendUssdHandler \
+        open CRepository result: %d", result )
+
+    if ( repository && ( KErrNone == result ) )
+        {
+        result = repository->Get( KSatDisplayUssdResult, 
+        iIsSatDisplayUssdResult );
+        LOG2( NORMAL, 
+             "SENDUSSD: CSendUssdHandler::CSendUssdHandler \
+              get CRepository key iIsSatDisplayUssdResult: %d", 
+              iIsSatDisplayUssdResult )
+        
+        if ( KErrNone != result )
+            {
+            LOG2( NORMAL, 
+                 "SENDUSSD: CSendUssdHandler::CSendUssdHandler \
+                 get CRepository key error result: %d", 
+                 result )
+            }
+        }
+
+    delete repository;
+    repository = NULL;
+
+    LOG( SIMPLE,
+        "SENDUSSD: CSendUssdHandler::CSendUssdHandler exiting" )
     }
 
 
@@ -595,6 +629,17 @@
 
     iSendUssdRsp.iUssdString.iUssdString.Copy( receiveMessage );
 
+    if ( ( RSat::EAlphaIdProvided != iSendUssdData.iAlphaId.iStatus )
+          && iIsSatDisplayUssdResult )
+        {
+        // if no Alpha ID provided, show the text note.
+        LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString \
+        Show USSD result Note" )
+        TRAP_IGNORE( 
+        ShowUssdResponseNoteL( 
+        iSendUssdRsp.iUssdString.iUssdString ) );
+        }
+
     HandleSendUssdResult( error );
 
     LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::SendUssdString exiting" )
@@ -671,6 +716,23 @@
     }
     
 // -----------------------------------------------------------------------------
+// Show the ussd response note.
+// -----------------------------------------------------------------------------
+//
+void CSendUssdHandler::ShowUssdResponseNoteL( const TDesC& aText )
+    {
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ShowUssdResponseNoteL calling" )
+
+    CAknGlobalNote* note = CAknGlobalNote::NewLC();
+    note->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY );
+    note->ShowNoteL( EAknGlobalConfirmationNote,
+        iSendUssdRsp.iUssdString.iUssdString );
+    CleanupStack::PopAndDestroy( note );
+
+    LOG( SIMPLE, "SENDUSSD: CSendUssdHandler::ShowUssdResponseNoteL exiting" )
+    }
+
+// -----------------------------------------------------------------------------
 // Handles the result of Ussd sending.
 // -----------------------------------------------------------------------------
 //
@@ -692,6 +754,7 @@
     else if ( TSatExtErrorUtils::IsExtendedError( aError ) ) // extended error
         {
         TUint8 addInfo( 0 );
+        // In subcase 2, SAT always gets KErrGsmCCCallRejected
         if ( KErrGsmCCCallRejected == aError )   
            {
            LOG( SIMPLE, 
@@ -770,8 +833,8 @@
         iSendUssdRsp.iGeneralResult = RSat::KModifiedByCallControl;
         iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
         iSendUssdRsp.iAdditionalInfo.SetLength( 0 );
-        iSendUssdRsp.iAdditionalInfo.Zero();
-		}
+        iSendUssdRsp.iAdditionalInfo.Zero(); 
+        }
     else if ( KErrNone == aError )   //  Success case
         {
         LOG( SIMPLE,