diff -r 7d48bed6ce0c -r 987c9837762f phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp --- a/phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp Tue Aug 31 15:45:17 2010 +0300 +++ b/phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp Wed Sep 01 12:15:03 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -16,20 +16,26 @@ */ // INCLUDE FILES -#include "cphsrvussdmanager.h" -#include "phsrvutils.h" -#include "cphsrvussdsendhandler.h" -#include "cphsrvussdreceivehandler.h" -#include "cphsrvussdnotifynwrelease.h" -#include "cphsrvresourcemanager.h" -#include "cphsrvussdreplytimer.h" -#include "mphsrvussdmessagesentobserver.h" -#include "mphsrvphoneinterface.h" -#include "cphsrvussdsessioncancelwaiter.h" +#include "CPhSrvUssdManager.h" +#include "PhSrvUtils.h" +#include "CPhSrvUssdSendHandler.h" +#include "CPhSrvUssdReceiveHandler.h" +#include "CPhSrvUssdNotifyNWRelease.h" +#include "CPhSrvResourceManager.h" +#include "CPhSrvUssdReplyTimer.h" +#include "MPhSrvUssdMessageSentObserver.h" +#include "MPhSrvPhoneInterface.h" +#include "CPhSrvUssdSessionCancelWaiter.h" +#include +#include +#include +#include #include #include #include +#include +#include #include #include #include @@ -38,26 +44,32 @@ #include #include -#include -#include -#include -#include "phsrvdebuginfo.h" +#include +#include +#include +#include +#include "PhSrvDebugInfo.h" #include + +#include #include +#include #include +//RM-RIM 417-66528 +#include // CONSTANTS const TInt KPhSrvDefaultValue = 0x00000000; -// See SharedDataKeysVariant.h or NcnListInternalPSKeys.h -// const TInt KPhSrvUssdNoTone = 0; +// const TInt KPhSrvUssdNoTone = 0; // See SharedDataKeysVariant.h or NcnListInternalPSKeys.h +const TInt KPhSrvUssdTone = 2; // See SharedDataKeysVariant.h or NcnListInternalPSKeys.h + // const TInt KPhSrvUssdTimeOutObserverGranularity = 2; // const TInt KPhSrvUssdSentMessageObserverGranularity = 2; -// See KUssdSecureId in phcltclientserver.h -//const TInt KPhSrvUssdAppUID = 0x10005955; +const TInt KPhSrvUssdAppUID = 0x10005955; const TInt KPhSrvUssdMessageQueryInterval = 500000; // 0.5 sec -//const TInt KPhSrvUssdNoteExitPeriod = 500000; // 0.5 sec +const TInt KPhSrvUssdNoteExitPeriod = 500000; // 0.5 sec // const TUint KPhSrvUssdDefaultDCS = 0x0f; // 00001111 @@ -82,24 +94,6 @@ const TUint KPhSrvUssdDcsMessageHandlingAlphabet8Bit = 0xf4; // 1111x1xx const TInt KPhrUssdNotifyArraySize = 1; -// Refers to HbPopup::NoDismiss = 0 -const TInt KPhSrvUssdPopupDismissPolicy = 0; -// The time out only for testing, from CPhSrvUssdReplyTimer.cpp -const TUint KPhSrvUssdTimeout = 300000000; - -// Use QT style localization -_LIT(KUssdLocFilename, "ussd_"); -_LIT(KCommonLocFilename, "common_"); -_LIT(KLocPath, "z:\\resource\\qt\\translations"); -_LIT(KUssdReply, "txt_ussd_button_reply"); // Reply -_LIT(KUssdExit, "txt_ussd_button_exit"); // Exit -_LIT(KUssdNext, "txt_ussd_button_next"); //Next -_LIT(KUssdYes, "txt_common_button_yes"); // Yes -_LIT(KUssdNo, "txt_common_button_no"); // No -_LIT(KUssdTitle, "txt_ussd_title_message"); // Message -_LIT(KUssdDone, "txt_ussd_dpopinfo_done"); // Done -_LIT(KUssdConfirm, "txt_ussd_info_there_are_still_unread_notifications"); - // MACROS #define _DPRINT_FLAGS() \ @@ -387,10 +381,9 @@ :CActive( EPriorityLow ), iFsSession( aFsSession ), iResourceManager( aResourceManager ), - iDeviceDialog( NULL ), iDCS ( KPhCltDcsUnknown ), - iReturnResultPckg ( iReturnResult ), - iTextBuffer ( NULL ) + iReturnResultPckg ( iReturnResult ) + { CActiveScheduler::Add( this ); } @@ -405,7 +398,7 @@ // CPhSrvUssdManager::~CPhSrvUssdManager() { - _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.start" ); + _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.start" ); // debug print delete iUssdSendHandler; @@ -420,12 +413,9 @@ Cancel(); iTimer.Close(); - - delete iTextBuffer; - iTextBuffer = NULL; - - delete iDeviceDialog; - iDeviceDialog = NULL; + + delete iGlobalMsgQuery; + iGlobalMsgQuery = NULL; if ( iNotifyArray ) { @@ -442,10 +432,17 @@ iFsSession.Close(); iMobileUssdMessaging.Close(); + + delete iMeQuHeaderText; + iMeQuHeaderText = NULL; delete iMoAckCallback; - _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.end" ); + // RM-RIM 417-66528 + delete iUssdExtnInterface; + iUssdExtnInterface = NULL; + + _DPRINT( 4, "PhSrv.~CPhSrvUssdManager.end" ); // debug print } @@ -458,10 +455,7 @@ // void CPhSrvUssdManager::ConstructL( MPhSrvPhoneInterface& aPhoneInterface ) { - _DPRINT( 4, "PhSrv.ConstructL.Start" ); - const TBool textResolver = HbTextResolverSymbian::Init( - KUssdLocFilename, KLocPath ); - _DDPRINT( 4, "PhSrv.ConstructL.ussd loc:", textResolver ); + _DPRINT( 4, "PhSrv.ConstructL.Start" ); // debug print User::LeaveIfError( iTimer.CreateLocal() ); User::LeaveIfError( iMobileUssdMessaging.Open( aPhoneInterface.PhSrvMobilePhone() ) ); @@ -497,10 +491,18 @@ User::LeaveIfError( GetTelephonyVariantData() ); - _DDPRINT( 4, "PhSrv.ConstructL.iSatCanceled ", iSatCanceled ); + iMeQuHeaderText = iResourceManager.ReadResourceLC( + R_PHSRV_USSD_MESQUERY_MESSAGE); + CleanupStack::Pop( iMeQuHeaderText ); + + _DDPRINT( 4, "PhSrv.ConstructL.iSatCanceled ", iSatCanceled ); _DDPRINT( 4, "PhSrv.ConstructL.iShowDone ", iShowDone ); iNotifyArray = new( ELeave ) CDesCArrayFlat( KPhrUssdNotifyArraySize ); - _DPRINT( 4, "PhSrv.ConstructL.End" ); + + // RM-RIM 417-66528 + TRAP_IGNORE(iUssdExtnInterface = CUssdExtensionInterface::NewL()); + _DPRINT( 4, "PhSrv.ConstructL.iUssdExtnInterface Created"); + _DPRINT( 4, "PhSrv.ConstructL.End" ); // debug print } @@ -515,20 +517,20 @@ { // If SendHandler is not created, first check that MO Ussd // is supported by the TSY. - _DPRINT( 4, "PhSrv.SendHandlerL.Start" ); + _DPRINT( 4, "PhSrv.SendHandlerL.Start" ); // debug print if ( iUssdSendHandler == NULL ) { - _DPRINT( 4, "PhSrv.SendHandlerL.iUssdSendHandler.NULL" ); + _DPRINT( 4, "PhSrv.SendHandlerL.iUssdSendHandler.NULL" ); // debug print RMobileUssdMessaging::TMobileUssdCapsV1 caps; RMobileUssdMessaging::TMobileUssdCapsV1Pckg pckgCaps( caps ); User::LeaveIfError( iMobileUssdMessaging.GetCaps( pckgCaps ) ); - _DPRINT( 4, "PhSrv.SendHandlerL.iMobileUssdMessaging.GetCaps" ); + _DPRINT( 4, "PhSrv.SendHandlerL.iMobileUssdMessaging.GetCaps" ); // debug print if ( ( caps.iUssdTypes & RMobileUssdMessaging::KCapsMOUssd ) == 0 || ( caps.iUssdFormat & RMobileUssdMessaging::KCapsPackedString ) == 0 ) { - _DPRINT( 4, "PhSrv.SendHandlerL.KErrNotSupported" ); + _DPRINT( 4, "PhSrv.SendHandlerL.KErrNotSupported" ); // debug print User::Leave( KErrNotSupported ); } @@ -538,7 +540,7 @@ iMobileUssdMessaging, *iPhoneInterface ); } - _DPRINT( 4, "PhSrv.SendHandlerL.End" ); + _DPRINT( 4, "PhSrv.SendHandlerL.End" ); // debug print return *iUssdSendHandler; } @@ -555,15 +557,25 @@ RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttribute, MPhSrvUssdMessageSentObserver& aObserver ) { - _DPRINT( 4, "PhSrv.SendUssdL.Start ######" ); + _DPRINT( 4, "PhSrv.SendUssdL.Start ######" ); // debug print _DPRINT_FLAGS(); + //417-66528 + if (iUssdExtnInterface) + { + if(!iUssdExtnInterface->ValidateUssdMsgSending(aMsgData,aMsgAttribute)) + { + // invalid attempt to send USSD message. Show the note + User::Leave( KErrAccessDenied ); + } + } + if ( iObserver && iNetworkReleased ) { // Network has been released but the previous send request is still alive. // Cancel the pervious send operation, complete the old request with error // and clean up the pointer. - _DPRINT( 4, "PhSrv.SendUssdL.Error.Complete.Existing" ); + _DPRINT( 4, "PhSrv.SendUssdL.Error.Complete.Existing" ); // debug print if ( iUssdSendHandler ) { iUssdSendHandler->Cancel(); @@ -574,7 +586,7 @@ if ( iObserver || iSendingAck ) { - _DPRINT( 4, "PhSrv.SendUssdL.KErrInUse" ); + _DPRINT( 4, "PhSrv.SendUssdL.KErrInUse" ); // debug print // Other client is using the service. User::Leave( KErrInUse ); } @@ -582,14 +594,14 @@ // Check that message type is set if( ( aMsgAttribute.iFlags & RMobileUssdMessaging::KUssdMessageType ) == 0 ) - _DPRINT( 4, "PhSrv.SendUssdL.KUssdMessageType.0" ); + _DPRINT( 4, "PhSrv.SendUssdL.KUssdMessageType.0" ); // debug print { // Mesasge type not set -> Set it. aMsgAttribute.iFlags |= RMobileUssdMessaging::KUssdMessageType; if ( NetworkWaitingForAnAnswer() ) { // Network is waiting for an answer - _DPRINT( 4, "PhSrv.SendUssdL.EUssdMOReply" ); // debug print + _DPRINT( 4, "PhSrv.SendUssdL.EUssdMOReply" ); // debug print aMsgAttribute.iType = RMobileUssdMessaging::EUssdMOReply; } else @@ -602,7 +614,7 @@ RMobileUssdMessaging::TMobileUssdAttributesV1Pckg attribs( aMsgAttribute ); iShowDone = ETrue; _DPRINT( 4, "PhSrv.SendUssdL.iShowDone.ETrue" ); - _DPRINT( 4, "PhSrv.SendUssdL.Send" ); + _DPRINT( 4, "PhSrv.SendUssdL.Send" ); // debug print SendHandlerL().SendUssdL( aMsgData , attribs ); iObserver = &aObserver; // Not closing nor closed anymore @@ -617,7 +629,7 @@ _DPRINT( 4, "PhSrv.SendUssdCancel.TimerStop" ); // debug print iUssdReplyTimer->Stop(); } - _DPRINT( 4, "PhSrv.SendUssdL.End" ); + _DPRINT( 4, "PhSrv.SendUssdL.End" ); // debug print } // ----------------------------------------------------------------------------- @@ -637,7 +649,7 @@ // void CPhSrvUssdManager::SendUssdCancel() { - _DPRINT( 4, "PhSrv.SendUssdCancel.Start #######" ); + _DPRINT( 4, "PhSrv.SendUssdCancel.Start #######" ); // debug print // Ack sending should not be canceled unless it's about terminating // the whole session @@ -656,7 +668,7 @@ iObserver = NULL; SetActiveIfPendingNotificationsExist(); - _DPRINT( 4, "PhSrv.SendUssdCancel.End" ); + _DPRINT( 4, "PhSrv.SendUssdCancel.End" ); // debug print } // ----------------------------------------------------------------------------- @@ -695,14 +707,14 @@ // complete SAT if needed if ( aError < KErrNone ) { - + // debug print _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.CompleteSat" ); CompleteSatL( NULL, aError ); } if ( iObserver ) { - + // debug print _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.Observer" ); iObserver->UssdMessageSentObserverHandleResult( aError ); @@ -717,7 +729,6 @@ _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleSendEventL.End" ); } - // ----------------------------------------------------------------------------- // CPhSrvUssdManager::UssdAppTaskExists // @@ -733,7 +744,7 @@ _DPRINT( 4, "PhSrv.UssdAppTaskExists.wsSession.Connect" ); CleanupClosePushL(wsSession); TApaTaskList tasklist(wsSession); - TApaTask task = tasklist.FindApp( KUssdSecureId ); + TApaTask task = tasklist.FindApp(TUid::Uid(KPhSrvUssdAppUID)); ret = task.Exists(); CleanupStack::PopAndDestroy(); @@ -760,7 +771,7 @@ if ( aError != KErrNone ) { TurnLightsOn(); //Ensure lights on - + // debug print _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleReceivedEventL.ShErNote" ); ShowErrorNoteL( aError ); } @@ -777,6 +788,9 @@ // ----------------------------------------------------------------------------- // CPhSrvUssdManager::UssdHandleReceivedEventL +// +// +// // ----------------------------------------------------------------------------- // void CPhSrvUssdManager::UssdHandleReceivedEventL( @@ -786,15 +800,15 @@ // This always is either ongoing transaction or starting a new based // on incoming message, mark transaction to be open. iNetworkReleased = EFalse; - + // 2. Complete Send with some positive value. - if ( iObserver ) + if ( iObserver ) { - + // debug print _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Observer" ); UssdNetworkObserverHandleSendEventL( 1 ); // some positive value } - + if ( aMsgAttributes.iFlags&RMobileUssdMessaging::KUssdMessageType && aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTRequest ) { @@ -816,6 +830,14 @@ { iReceivedMessage = iDecodedMessage; } + // 4. Invoke UssdExtensionPlugin + // 417-66528 + TBool isResponseValidated = EFalse; + if (iUssdExtnInterface) + { + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.InvokeExtension" ); + isResponseValidated = iUssdExtnInterface->ValidateUssdResponse(aMsgData); + } // 5. Show note. // debug print _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Note" ); @@ -824,77 +846,81 @@ { if ( !ShowNotesL() ) { - + // debug print _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.SAtReturn" ); return; } } - + //6. Check if the response is valid for the extension + //RM-RIM 417-66528 + if (iUssdExtnInterface && isResponseValidated) + PorcessReceivedMessageInExtesnionL(aMsgData, aMsgAttributes); + else + ProcessReceivedMessageL(aMsgData, aMsgAttributes); + + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Editor" ); + if (aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTRequest + && UssdAppTaskExistsL()) + { + iEmptyEditor = ETrue; + } _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.End" ); + } +// ----------------------------------------------------------------------------- +// CPhSrvUssdManager::ProcessReceivedMessageL +// +// +// +// ----------------------------------------------------------------------------- +// +void CPhSrvUssdManager::ProcessReceivedMessageL(const TDes8& /*aMsgData*/, + const RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttributes) + { // empty string is handled as ok message - if ( !iDecodedMessage.Length() ) + if (!iDecodedMessage.Length()) { TurnLightsOn(); //Ensure lights on - + + // debug print _DPRINT( 4, - "PhSrv.UssdHandleReceivedEventL.EmptyString" ); - + "PhSrv.UssdHandleReceivedEventL.EmptyString" ); ShowDoneNoteL(); - - + // debug print _DPRINT( 4, - "PhSrv.UssdHandleReceivedEventL.EmptyString.OK" ); + "PhSrv.UssdHandleReceivedEventL.EmptyString.OK" ); } else { _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.String" ); - iNotifyMessage = ( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTNotify ); - _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage ); + iNotifyMessage = (aMsgAttributes.iType + == RMobileUssdMessaging::EUssdMTNotify); + _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage ); _DDPRINT( 4, "PhSrv.UssdNOHREventL.iNotifyMessage: ", iNotifyMessage ); - iMsgTypeReply = ( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTReply ); + iMsgTypeReply = (aMsgAttributes.iType + == RMobileUssdMessaging::EUssdMTReply); _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iMsgTypeReply: ", iMsgTypeReply ); - - if ( iNotifyMessage ) + + if (iNotifyMessage) { // need to send an MO ack - iAcksToBeSent ++; + iAcksToBeSent++; } - - if ( !iDeviceDialog ){ - iDeviceDialog = CHbDeviceMessageBoxSymbian::NewL( - CHbDeviceMessageBoxSymbian::EInformation ); - iDeviceDialog->SetObserver( this ); - iDeviceDialog->SetTimeout( KPhSrvUssdTimeout ); - iDeviceDialog->SetDismissPolicy ( KPhSrvUssdPopupDismissPolicy ); - iDeviceDialog->SetIconVisible(EFalse); - - // Show left key with empty string accoring to ui concept - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); - // Show Exit Key always - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::ERejectButton, ETrue ); - iDeviceDialog->SetButtonTextL( - CHbDeviceMessageBoxSymbian::ERejectButton, - LoadDefaultString( KUssdExit ) ); - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Exit" ); - } - - if ( iNotifyMessage || iMsgTypeReply ) + + if (iNotifyMessage || iMsgTypeReply) { //This is for reply message in notifyarray iNotifyMessage = ETrue; _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage ); //Notify added to array - iNotifyArray->AppendL( iReceivedMessage ); + iNotifyArray->AppendL(iReceivedMessage); - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.AppendL" ); - UpdateNotifyMessageL(); + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.AppendL" ); // debug print + UpdateNotifyMessage(); - if ( !iSendRelease && NotifyCount() <= 1 ) + if (!iSendRelease && NotifyCount() <= 1) { - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.!SendRelease.Cancel" ); + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.!SendRelease.Cancel" ); // debug print Cancel(); } } @@ -902,61 +928,79 @@ { // New message deletes old message, i.e. Cancel existing query. Cancel(); - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NewAnswerable" ); + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NewAnswerable" ); // debug print } + CreateGlobalMessageQueryL(aMsgAttributes); + AsyncProcessMoAcks(); + } + _DPRINT( 4, "PhSrv.ProcesdReceivedMessageL.End" ); + } - // Remove Reply key - if( !( aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageType ) - || aMsgAttributes.iType != RMobileUssdMessaging::EUssdMTRequest ) +// ----------------------------------------------------------------------------- +// CPhSrvUssdManager::PorcessReceivedMessageInExtesnionL +// +// +// +// ----------------------------------------------------------------------------- +// +void CPhSrvUssdManager::PorcessReceivedMessageInExtesnionL( + const TDes8& /*aMsgData*/, + const RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttributes) + { + TInt errfromextension = KErrNone; + // empty string is handled as ok message + if (!iDecodedMessage.Length()) + { + // debug print + _DPRINT( 4, + "PhSrv.UssdHandleReceivedEventL.EmptyString" ); + //RM-RIM 417-66528 + TRAP_IGNORE(iUssdExtnInterface->ProcessReceivedUssdL(iDecodedMessage, errfromextension)); + // debug print + _DPRINT( 4, + "PhSrv.UssdHandleReceivedEventL.EmptyString.OK" ); + } + else + { + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.String" ); + iNotifyMessage = (aMsgAttributes.iType + == RMobileUssdMessaging::EUssdMTNotify); + _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage ); + _DDPRINT( 4, "PhSrv.UssdNOHREventL.iNotifyMessage: ", iNotifyMessage ); + iMsgTypeReply = (aMsgAttributes.iType + == RMobileUssdMessaging::EUssdMTReply); + _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iMsgTypeReply: ", iMsgTypeReply ); + + if (iNotifyMessage) { - // Remove Answer key - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NoAnswer" ); - } - // Show Reply key - else - { - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); - iDeviceDialog->SetButtonTextL( - CHbDeviceMessageBoxSymbian::EAcceptButton, - LoadDefaultString( KUssdReply ) ); - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.WithAnswer" ); + // need to send an MO ack + iAcksToBeSent++; } - - _DPRINT( 4, - "PhSrv.UssdHandleReceivedEventL.String.Middle" ); - - // Play the USSD tone if needed. Logically should be in RunL, but here - // to give better balancing with voice and visible message. - // <-- QT PHONE START--> - /* - if ( IsTelephonyFeatureSupported( KTelephonyLVFlagUssdTone ) ) + if (iNotifyMessage || iMsgTypeReply) { - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.PlayTone" ); - PlayUssdTone(); + //This is for reply message in notifyarray + iNotifyMessage = ETrue; + _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.iNotifyMessage: ", iNotifyMessage ); + if (!iSendRelease && NotifyCount() <= 1) + { + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.!SendRelease.Cancel" ); // debug print + Cancel(); + } } - */ - // <-- QT PHONE END--> - // Launch the new message query - if ( !IsActive() ) + else { - iLaunchGMQ = ETrue; - iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); - SetActive(); + // New message deletes old message, i.e. Cancel existing query. + Cancel(); + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.NewAnswerable" ); // debug print } - AsyncProcessMoAcks(); + TInt errfromextension = KErrNone; + ProcessMoAcksL(); + iLaunchGMQ = EFalse; + TRAP_IGNORE(iUssdExtnInterface->ProcessReceivedUssdL(iDecodedMessage, errfromextension)); + _DDPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Extn.ProcessReceivedUssdL.ErrCode", errfromextension); } - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.Editor" ); - if( aMsgAttributes.iType == RMobileUssdMessaging::EUssdMTRequest && UssdAppTaskExistsL() ) - { - iEmptyEditor = ETrue; - } - _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.End" ); } - // ----------------------------------------------------------------------------- // CPhSrvUssdManager::RestartReplyTimerL // @@ -992,31 +1036,31 @@ void CPhSrvUssdManager::UssdNetworkObserverHandleNotifyNWReleaseL( const RMobilePhone::TMobilePhoneSendSSRequestV3 & aReturnResult, TInt aError ) - { - _DDPRINT( 4, "PhSrv.UssdNotifyNWRelease ##### ", aError ); // debug print + { + _DDPRINT( 4, "PhSrv.UssdNotifyNWRelease ##### ", aError ); // debug print _DPRINT_FLAGS(); - TBool showNotes = ShowNotesL(); - iNetworkReleased = ETrue; - iSendingAck = EFalse; + TBool showNotes = ShowNotesL(); + iNetworkReleased = ETrue; + iSendingAck = EFalse; iSendRelease = EFalse; - iAcksToBeSent = 0; - - if ( iHavePendingSatMessagePointer ) - { - iReturnResult = aReturnResult; - if ( !iSatCanceled ) - { - CompleteSatL(&iReceivedMessage, aError ); - _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.CompleteSat" ); - } - } - if ( iUssdReplyTimer && iUssdReplyTimer->IsTimerActive() ) - { - _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.Timer.Stop" ); - iUssdReplyTimer->Stop(); - Cancel(); - CheckArray(); - } + iAcksToBeSent = 0; + + if ( iHavePendingSatMessagePointer ) + { + iReturnResult = aReturnResult; + if ( !iSatCanceled ) + { + CompleteSatL(&iReceivedMessage, aError ); + _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.CompleteSat" ); // debug print + } + } + if ( iUssdReplyTimer && iUssdReplyTimer->IsTimerActive() ) + { + _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.Timer.Stop" ); + iUssdReplyTimer->Stop(); + Cancel(); + CheckArray(); + } if ( showNotes && iShowDone ) { ShowDoneNoteL(); @@ -1026,14 +1070,19 @@ // if we are sending ack, it can be canceled. iUssdSendHandler->Cancel(); } - + //417-66528 + //Notify Extension on NWRelease + if(iUssdExtnInterface) + { + iUssdExtnInterface->NotifyNWError(aError); + } iSatCanceled = EFalse; _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.iSatCanceled.EFalse" ); iShowDone = EFalse; _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.Ending" ); _DPRINT_FLAGS(); _DPRINT( 4, "PhSrv.UssdNetworkObserverHandleNotifyNWReleaseL.End" ); - } + } // ----------------------------------------------------------------------------- // CPhSrvUssdManager::ShowDoneNoteL @@ -1044,8 +1093,11 @@ { _DDPRINT( 4, "PhSrv.ShowDoneNoteL.iShowDone", iShowDone ); // Show global confirmation note "Done" - CHbDeviceMessageBoxSymbian::InformationL( - LoadDefaultString( KUssdDone ) ); + HBufC* noteText = iResourceManager.ReadResourceLC( R_PHSRV_TEXT_DONE ); + CAknGlobalNote* note = CAknGlobalNote::NewLC(); + note->ShowNoteL( EAknGlobalConfirmationNote, *noteText ); + CleanupStack::PopAndDestroy( note ); + CleanupStack::PopAndDestroy( noteText ); iShowDone = EFalse; } @@ -1063,16 +1115,14 @@ return; } - // Show specific error message CTextResolver* textResolver = CTextResolver::NewLC(); + HBufC* buffer = textResolver->ResolveErrorString( aError ).AllocLC(); - CHbDeviceMessageBoxSymbian::InformationL( buffer ->Des() ); + CAknGlobalNote* note = CAknGlobalNote::NewLC(); + note->ShowNoteL( EAknGlobalErrorNote, *buffer ); - CleanupStack::PopAndDestroy( buffer ); - CleanupStack::PopAndDestroy( textResolver ); - - + CleanupStack::PopAndDestroy( 3 ); // note, buffer, textResolver _DPRINT( 4, "PhSrv.ShowErrorNoteL.End" ); return; } @@ -1265,7 +1315,7 @@ if ( aError == KErrNone && IsActive() && - iDeviceDialog ) + iGlobalMsgQuery ) { Cancel(); // Terminates USSD session. @@ -1281,88 +1331,12 @@ // ----------------------------------------------------------------------------- -// CPhSrvUssdManager::MessageBoxClosed -// ----------------------------------------------------------------------------- -// -void CPhSrvUssdManager::MessageBoxClosed( - const CHbDeviceMessageBoxSymbian* aMessageBox, - CHbDeviceMessageBoxSymbian::TButtonId aButton) - { - _DPRINT( 4, "PhSrv.MsgClose.Start" ); - // ussd device dialog observer callback function - TPtrC leftBtn = aMessageBox->ButtonText( - CHbDeviceMessageBoxSymbian::EAcceptButton ); - TPtrC rightBtn = aMessageBox->ButtonText( - CHbDeviceMessageBoxSymbian::ERejectButton ); - - TInt err = KErrNone; - // Click Yes on Confirmation note (Yes, No) - if ( !leftBtn.Compare( - LoadDefaultString( KUssdYes ) ) && - ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) ) - { - _DPRINT( 4, "PhSrv.MsgClose.SK.Yes" ); - iClearArray = EFalse; - iNotifyArray->Reset(); - TryCloseSession(); - } - // Click "No" on Confirmation note (Yes, No) - else if ( !rightBtn.Compare( - LoadDefaultString( KUssdNo ) ) && - ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) ) - { - _DPRINT( 4, "PhSrv.MsgClose.SK.No" ); - iClearArray = EFalse; - iNotifyMessage = ETrue; // for removing the yes/no query - CheckArray(); - TryCloseSession(); - } - // Click "Next" on Notification note (Next, Exit) - else if ( !leftBtn.Compare( - LoadDefaultString( KUssdNext ) ) && - ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) ) - { - _DPRINT( 4, "PhSrv.MsgClose.SK.Next" ); - CheckArray(); - TryCloseSession(); - } - // Click "Exit" on Notification note (Next, Exit or only Exit) - else if ( !rightBtn.Compare( - LoadDefaultString( KUssdExit ) ) && - ( CHbDeviceMessageBoxSymbian::ERejectButton == aButton ) ) - { - TRAP( err, ClearArrayL() ); - _DDPRINT( 4, "PhSrv.MsgClose.SK.Clear.%d", err ); - TryCloseSession(); - _DPRINT( 4, "PhSrv.MsgClose.SK.Exit" ); - } - // Click "Reply" on Message note (Reply, Exit) - else if ( !leftBtn.Compare( - LoadDefaultString( KUssdReply ) ) && - ( CHbDeviceMessageBoxSymbian::EAcceptButton == aButton ) ) - { - // Answer - iStartEditor = ETrue; - iShowDone = EFalse; - // Start the USSD editor now. - TRAP( err, RequestStartEditingL() ); - _DDPRINT( 4, "PhSrv.MsgClose.RequestStartEditingL.%d", err ); - } - else - { - _DPRINT( 4, "PhSrv.MsgClose.SK.Default" ); - } - - _DPRINT( 4, "PhSrv.MsgClose.End" ); - } - -// ----------------------------------------------------------------------------- // CPhSrvUssdManager::RunL // ----------------------------------------------------------------------------- // void CPhSrvUssdManager::RunL() { - _DPRINT( 4, "PhSrv.RunL.Start" ); + _DPRINT( 4, "PhSrv.RunL.Start" ); // debug print ProcessMoAcksL(); @@ -1376,11 +1350,122 @@ else { iStartEditor = EFalse; - // update device dialog + + TInt key = iStatus.Int(); + if ( key == EEikBidOk ) // OK key + { + if ( NetworkWaitingForAnAnswer() ) + { + key = EAknSoftkeyShow; + } + else + { + key = EAknSoftkeyExit; + } + } + + switch( key ) + { + case EAknSoftkeyShow: + { + // Answer + iStartEditor = ETrue; + iShowDone = EFalse; + // Start the USSD editor now. + _DPRINT( 4, "PhSrv.RunL.RequestStartEditingL" ); // debug print + RequestStartEditingL(); + break; + } + case EAknSoftkeyYes: + { + _DPRINT( 4, "PhSrv.RunL.SK.Yes" ); + iClearArray = EFalse; + iNotifyArray->Reset(); + TryCloseSession(); + break; + } + case EAknSoftkeyCancel: + _DPRINT( 4, "PhSrv.RunL.SK.Cancel" ); + if ( iHavePendingSatMessagePointer ) + { + iSatCanceled = ETrue; + CompleteSatL( &iReceivedMessage, KErrCancel ); + _DPRINT( 4, "PhSrv.RunL.CompleteSatL" ); + } + // fall through. + case EAknSoftkeyExit: + _DPRINT( 4, "PhSrv.RunL.SK.Exit" ); + ClearArrayL(); + TryCloseSession(); + break; + case EAknSoftkeyBack: + _DPRINT( 4, "PhSrv.RunL.SK.Back" ); + ClearArrayL(); + TryCloseSession(); + break; + case EAknSoftkeyNo: + _DPRINT( 4, "PhSrv.RunL.SK.No" ); + iClearArray = EFalse; + iNotifyMessage = ETrue; // for removing the yes/no query + // fall through. + case EAknSoftkeyNext: + _DPRINT( 4, "PhSrv.RunL.SK.Next" ); + CheckArray(); + TryCloseSession(); + break; + default: + _DPRINT( 4, "PhSrv.RunL.SK.Default" ); + break; + } _DPRINT( 4, "PhSrv.RunL.End" ); // debug print } } +// RM-RIM 417-66528 +// ----------------------------------------------------------------------------- +// CPhSrvUssdManager::CreateGlobalMessageQueryL +// ----------------------------------------------------------------------------- +// +void CPhSrvUssdManager::CreateGlobalMessageQueryL( + const RMobileUssdMessaging::TMobileUssdAttributesV1& aMsgAttributes) + { + if (!iGlobalMsgQuery) + { + iGlobalMsgQuery = CAknGlobalMsgQuery::NewL(); + } + // Delay after message query so that application execution order will + // be correct. + iGlobalMsgQuery->SetExitDelay(KPhSrvUssdNoteExitPeriod); + + TInt softkeys = R_AVKON_SOFTKEYS_USSD_ANSWER_EXIT__ANSWER; + if (!(aMsgAttributes.iFlags & RMobileUssdMessaging::KUssdMessageType) + || aMsgAttributes.iType != RMobileUssdMessaging::EUssdMTRequest) + { + softkeys = R_AVKON_SOFTKEYS_EXIT; + } + + // Set timer that lauches Global MessageQuery after time interval. + iSoftkeys = softkeys; + + // debug print + _DPRINT( 4, + "PhSrv.UssdHandleReceivedEventL.String.Middle" ); + + // Play the USSD tone if needed. Logically should be in RunL, but here + // to give better balancing with voice and visible message. + if (IsTelephonyFeatureSupported(KTelSrvLVFlagUssdTone)) + { + _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.PlayTone" ); + PlayUssdTone(); + } + // Launch the new message query + if (!IsActive()) + { + iLaunchGMQ = ETrue; + iTimer.After(iStatus, KPhSrvUssdMessageQueryInterval); + SetActive(); + } + } // ----------------------------------------------------------------------------- // CPhSrvUssdManager::LaunchGlobalMessageQueryL // ----------------------------------------------------------------------------- @@ -1389,58 +1474,22 @@ { _DPRINT( 4, "PhSrv.LGMQ.start" ); _DPRINT_FLAGS(); - if ( iNotifyMessage ) { _DDPRINT( 4, "PhSrv.LGMQ.NotifyMessage", iNotifyMessage ); iNotifyMessage = ETrue; TInt count = NotifyCount(); - //check softkey in avkon.rss if ( count > 1 ) { - // Next, Exit - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); - iDeviceDialog->SetButtonTextL( - CHbDeviceMessageBoxSymbian::EAcceptButton, - LoadDefaultString( KUssdNext ) ); - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::ERejectButton, ETrue ); - iDeviceDialog->SetButtonTextL( - CHbDeviceMessageBoxSymbian::ERejectButton, - LoadDefaultString( KUssdExit ) ); - _DPRINT( 4, "PhSrv.LGMQ.Next&Exit" ); + iSoftkeys = R_AVKON_SOFTKEYS_NEXT_EXIT__NEXT; } else { - // Only Exit - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::ERejectButton, ETrue ); - iDeviceDialog->SetButtonTextL( - CHbDeviceMessageBoxSymbian::ERejectButton, - LoadDefaultString( KUssdExit ) ); - _DPRINT( 4, "PhSrv.LGMQ.onlyExit" ); + iSoftkeys = R_AVKON_SOFTKEYS_EXIT; } if ( iClearArray ) { - HbTextResolverSymbian::Init( KCommonLocFilename, KLocPath ); - _DPRINT( 4, "PhSrv.LGMQ.use common loc file" ); - // Yes, No - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); - iDeviceDialog->SetButtonTextL( - CHbDeviceMessageBoxSymbian::EAcceptButton, - LoadDefaultString( KUssdYes ) ); - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::ERejectButton, ETrue ); - iDeviceDialog->SetButtonTextL( - CHbDeviceMessageBoxSymbian::ERejectButton, - LoadDefaultString( KUssdNo ) ); - _DPRINT( 4, "PhSrv.LGMQ.Yes&No" ); - HbTextResolverSymbian::Init( KUssdLocFilename, KLocPath ); - _DPRINT( 4, "PhSrv.LGMQ.back up to use ussd loc file" ); + iSoftkeys = R_AVKON_SOFTKEYS_YES_NO; } iReceivedMessage.Zero(); iReceivedMessage = (*iNotifyArray)[0]; @@ -1449,27 +1498,11 @@ _DPRINT( 4, "PhSrv.LGMQ.ShMsgQuery" ); // debug print // Launch Global MessageQuery as requested. - // Dialog not support header text, this code is only - // for testing, not final solution. - TInt receiveLength = iReceivedMessage.Length(); - _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.MsgLength", receiveLength ); - - TInt titleLength = LoadDefaultString( KUssdTitle ).Length(); - _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.TilteLength", titleLength ); - - TInt length = receiveLength + titleLength; - _DDPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.TotalLength", length ); - - HBufC* titleAndText = HBufC::NewLC( length ); - titleAndText->Des().Append( LoadDefaultString( KUssdTitle ) ); - titleAndText->Des().Append( iReceivedMessage ); - iDeviceDialog->SetTextL( titleAndText->Des() ); - CleanupStack::Pop( titleAndText ); - - iDeviceDialog->Close(); - iDeviceDialog->ShowL(); + iGlobalMsgQuery->ShowMsgQueryL(iStatus, iReceivedMessage, iSoftkeys, + *iMeQuHeaderText, KNullDesC); + _DPRINT( 4, "PhSrv.LGMQ.SetActive" ); + SetActive(); iShowDone = EFalse; - // Do nothing else in RunL this time. _DPRINT( 4, "PhSrv.LGMQ.ShMsgQuery.ret" ); // debug print } @@ -1573,112 +1606,105 @@ // ----------------------------------------------------------------------------- // void CPhSrvUssdManager::CheckArray() - { - _DPRINT( 4, "PhSrv.CheckArray.Start" ); // debug print - if (iNotifyArray && NotifyCount() > 0) - { - if ( !iNotifyMessage && !iClearArray ) - { - iLaunchGMQ = ETrue; - iNotifyMessage = ETrue; - _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.ETrue" ); - iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); - _DDPRINT( 4, "PhSrv.CheckArray.SetActive.NoNotifyMessage ", iStatus.Int() ); - SetActive(); - } - else if( NotifyCount() > 1 ) - { - ( iNotifyArray )->Delete( 0 ); - ( iNotifyArray )->Compress(); - iLaunchGMQ = ETrue; - iNotifyMessage = ETrue; - _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.ETrue" ); - iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); - _DDPRINT( 4, "PhSrv.CheckArray.SetActive.NotifyCount>1 ", iStatus.Int() ); - SetActive(); - } - else - { - iNotifyArray->Reset(); - iNotifyMessage = EFalse; - _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.EFalse" ); - } - } + { + _DPRINT( 4, "PhSrv.CheckArray.Start" ); // debug print + if (iNotifyArray && NotifyCount() > 0) + { + if ( !iNotifyMessage && !iClearArray ) + { + iLaunchGMQ = ETrue; + iNotifyMessage = ETrue; + _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.ETrue" ); + iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); + _DDPRINT( 4, "PhSrv.CheckArray.SetActive.NoNotifyMessage ", iStatus.Int() ); + SetActive(); + } + else if( NotifyCount() > 1 ) + { + ( iNotifyArray )->Delete( 0 ); + ( iNotifyArray )->Compress(); + iLaunchGMQ = ETrue; + iNotifyMessage = ETrue; + _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.ETrue" ); + iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); + _DDPRINT( 4, "PhSrv.CheckArray.SetActive.NotifyCount>1 ", iStatus.Int() ); + SetActive(); + } + else + { + iNotifyArray->Reset(); + iNotifyMessage = EFalse; + _DPRINT( 4, "PhSrv.CheckArray.iNotifyMessage.EFalse" ); + } + } _DPRINT_FLAGS(); - _DPRINT( 4, "PhSrv.CheckArray.End" ); // debug print - } + _DPRINT( 4, "PhSrv.CheckArray.End" ); // debug print + } // ----------------------------------------------------------------------------- // CPhSrvUssdManager::ClearArray() // ----------------------------------------------------------------------------- // void CPhSrvUssdManager::ClearArrayL() - { - _DPRINT( 4, "PhSrv.ClearArrayL.Start" ); // debug print - if (iNotifyArray && NotifyCount() > 0) - { - if (iNotifyMessage && NotifyCount()== 1 ) - { - iNotifyArray->Reset(); - } - else - { - iReceivedMessage.Zero(); - iReceivedMessage.Append( - LoadDefaultString( KUssdConfirm ) ); - iNotifyArray->InsertL( 0, iReceivedMessage ); - iLaunchGMQ = ETrue; - iNotifyMessage = ETrue; - _DPRINT( 4, "PhSrv.ClearArrayL.iNotifyMessage.ETrue" ); - iClearArray = ETrue; - iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); - _DDPRINT( 4, "PhSrv.ClearArrayL.iTimer ", iStatus.Int() ); - SetActive(); - } - } + { + _DPRINT( 4, "PhSrv.ClearArrayL.Start" ); // debug print + if (iNotifyArray && NotifyCount() > 0) + { + if (iNotifyMessage && NotifyCount()== 1 ) + { + iNotifyArray->Reset(); + } + else + { + iReceivedMessage.Zero(); + HBufC* unreadText = iResourceManager.ReadResourceLC( R_PHSRV_TEXT_UNREAD ); + TPtr pMessage( unreadText->Des() ); + iReceivedMessage.Append( pMessage ); + iNotifyArray->InsertL( 0, iReceivedMessage ); + CleanupStack::PopAndDestroy( unreadText ); + iLaunchGMQ = ETrue; + iNotifyMessage = ETrue; + _DPRINT( 4, "PhSrv.ClearArrayL.iNotifyMessage.ETrue" ); + iClearArray = ETrue; + iTimer.After( iStatus , KPhSrvUssdMessageQueryInterval ); + _DDPRINT( 4, "PhSrv.ClearArrayL.iTimer ", iStatus.Int() ); + SetActive(); + } + } _DPRINT_FLAGS(); - _DPRINT( 4, "PhSrv.ClearArrayL.End" ); // debug print - } + _DPRINT( 4, "PhSrv.ClearArrayL.End" ); // debug print + } // ----------------------------------------------------------------------------- // CPhSrvUssdManager::NotifyCount() // ----------------------------------------------------------------------------- // -TInt CPhSrvUssdManager:: NotifyCount() -{ - TInt count = iNotifyArray->Count(); - _DDPRINT( 4, "PhSrv.NotifyCount:", count ); // debug print - return count; -} + TInt CPhSrvUssdManager::NotifyCount() + { + if( iNotifyArray ) + { + return iNotifyArray->Count(); + } + else + { + return 0; + } + } -// ----------------------------------------------------------------------------- -// CPhSrvUssdManager::UpdateNotifyMessageL() + // ----------------------------------------------------------------------------- +// CPhSrvUssdManager::UpdateNotifyMessage() // ----------------------------------------------------------------------------- // - void CPhSrvUssdManager:: UpdateNotifyMessageL() - { - _DDPRINT( 4, "PhSrv.UpdateNotifyMessageL.Start, clear: ", iClearArray ); // debug print - - // Show left softkey - "Next" - if (NotifyCount() > 1 && !iClearArray ) - { - _DPRINT( 4, "PhSrv.UpdateNotifyMessageL" ); // debug print - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); - iDeviceDialog->SetButtonTextL( - CHbDeviceMessageBoxSymbian::EAcceptButton, - LoadDefaultString( KUssdNext ) ); - } - // Remove left softkey - else - { - iDeviceDialog->SetButton( - CHbDeviceMessageBoxSymbian::EAcceptButton, EFalse ); - } - iDeviceDialog->UpdateL(); - - _DPRINT( 4, "PhSrv.UpdateNotifyMessageL.End" ); // debug print - } + void CPhSrvUssdManager::UpdateNotifyMessage() + { + _DDPRINT( 4, "PhSrv.UpdateNotifyMessage.Start, clear: ", iClearArray ); // debug print + if (NotifyCount() > 1 && !iClearArray ) + { + _DPRINT( 4, "PhSrv.UpdateNotifyMessage" ); // debug print + iGlobalMsgQuery->UpdateMsgQuery( R_AVKON_SOFTKEYS_NEXT_EXIT__NEXT ); + } + _DPRINT( 4, "PhSrv.UpdateNotifyMessage.End" ); // debug print + } // ----------------------------------------------------------------------------- // CPhSrvUssdManager::DoCancel @@ -1689,12 +1715,11 @@ _DPRINT( 4, "PhSrv.DoCancel.Start" ); // debug print iTimer.Cancel(); iLaunchGMQ = EFalse; - if ( iDeviceDialog ) + + if ( iGlobalMsgQuery ) { _DPRINT( 4, "PhSrv.DoCancel" ); // debug print - iDeviceDialog->Close(); - delete iDeviceDialog; - iDeviceDialog = NULL; + iGlobalMsgQuery->CancelMsgQuery(); } _DPRINT( 4, "PhSrv.DoCancel.End" ); // debug print } @@ -1727,7 +1752,7 @@ // Find the task with name TApaTaskList tasklist( wsSession ); - TApaTask task = tasklist.FindApp( KUssdSecureId ); + TApaTask task = tasklist.FindApp( TUid::Uid( KPhSrvUssdAppUID ) ); // If task exists, bring it to foreground if ( task.Exists() ) @@ -1744,12 +1769,13 @@ CleanupClosePushL( apaLsSession ); TApaAppInfo appInfo; - - TInt err = apaLsSession.GetAppInfo( appInfo, KUssdSecureId ); - _DDPRINT( 4, "PhSrv.RequestStartEditingL.GetAppInfo ", err ); // debug print - + TInt err = apaLsSession.GetAppInfo( + appInfo, + TUid::Uid( KPhSrvUssdAppUID ) ); if ( err == KErrNone ) { + _DDPRINT( 4, "PhSrv.RequestStartEditingL.GetAppInfo ", err ); // debug print + #ifndef SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1 CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); apaCommandLine->SetExecutableNameL( appInfo.iFullName ); @@ -1758,22 +1784,10 @@ CApaCommandLine::NewLC( appInfo.iFullName ); #endif // SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1 - TThreadId id( static_cast( 0 ) ); - err = apaLsSession.StartApp( *apaCommandLine, id ); - _DDPRINT( 4, "PhSrv.RequestStartEditingL.ThreadId ", id ); + err = apaLsSession.StartApp( *apaCommandLine ); CleanupStack::PopAndDestroy( apaCommandLine ); } - CleanupStack::PopAndDestroy( &apaLsSession ); // apaLsSession - - // bring the ussd editor to foreground, only for testing - TApaTaskList tasklist( wsSession ); - TApaTask task = tasklist.FindApp( KUssdSecureId ); - if ( task.Exists() ) - { - _DPRINT( 4, "PhSrv.UssdM.RequestStartEditingL.task.BringToForeground" ); - task.BringToForeground(); - } - // bring the ussd editor to foreground, only for testing + CleanupStack::PopAndDestroy(); // apaLsSession } CleanupStack::PopAndDestroy(); // wsSession @@ -1812,7 +1826,7 @@ { if ( iUssdReplyTimer->IsTimerActive() ) { - + // debug print _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.timer" ); // Read the information what is the reason @@ -1823,14 +1837,14 @@ 0, exitReasonPckg ); - + // debug print _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.timer2" ); // If reason was the completion of send operation, the USSD // session is not canceled, otherwise it is canceled. if ( exitReason != EPhCltSendCompleted ) { - + // debug print _DPRINT( 4, "PhSrv.UssdM.InfUssdAppTerminatingL.SendRelease" ); CloseSession(); } @@ -1898,7 +1912,7 @@ } else { - _DPRINT( 4, "PhSrv.InformStartSAT.Set" ); + _DPRINT( 4, "PhSrv.InformStartSAT.Set" ); // debug print // There was not pending SAT message iHavePendingSatMessagePointer = ETrue; @@ -1916,7 +1930,7 @@ // void CPhSrvUssdManager::InformStopSAT() { - _DPRINT( 4, "PhSrv.InformStopSAT.Start" ); + _DPRINT( 4, "PhSrv.InformStopSAT.Start" ); // debug print // Do the actions only if there is pending SAT message. if ( iHavePendingSatMessagePointer ) @@ -1929,7 +1943,7 @@ } iHavePendingSatMessagePointer = EFalse; } - _DPRINT( 4, "PhSrv.InformStopSAT.End" ); + _DPRINT( 4, "PhSrv.InformStopSAT.End" ); // debug print } // ----------------------------------------------------------------------------- @@ -1981,7 +1995,7 @@ TDesC* aReceiveString, TInt aError ) { - _DPRINT( 4, "PhSrv.CompleteSatL.Start" ); + _DPRINT( 4, "PhSrv.CompleteSatL.Start" ); // debug print if ( aReceiveString ) { if ( aReceiveString->Length() ) @@ -1990,7 +2004,7 @@ // copy the received string to client side. if ( iPendingSatMessagePointer.Int1() < aReceiveString->Length() ) { - + // debug print _DPRINT( 4, "PhSrv.CompleteSatL.recString.LengthError" ); if ( !iPendingSatMessagePointer.IsNull() ) { @@ -1999,8 +2013,8 @@ } iHavePendingSatMessagePointer = EFalse; } - else - { + else + { _DPRINT( 4, "PhSrv.CompleteSatL.recString.Write" ); // debug print iPendingSatMessagePointer.WriteL( 2, @@ -2014,7 +2028,7 @@ } } } - _DPRINT( 4, "PhSrv.CompleteSatL.Middle" ); + _DPRINT( 4, "PhSrv.CompleteSatL.Middle" ); // debug print if ( !iPendingSatMessagePointer.IsNull() ) { if ( aReceiveString && !iSatCanceled ) @@ -2031,7 +2045,7 @@ iHavePendingSatMessagePointer = EFalse; - _DPRINT( 4, "PhSrv.CompleteSatL.End" ); + _DPRINT( 4, "PhSrv.CompleteSatL.End" ); // debug print } @@ -2043,7 +2057,7 @@ TBool CPhSrvUssdManager::IsTelephonyFeatureSupported( const TInt aFeatureId ) { - return ( aFeatureId & iVariantReadOnlyValues ); + return ( aFeatureId & iVariantReadOnlyValues ); } @@ -2054,13 +2068,12 @@ // TInt CPhSrvUssdManager::PlayUssdTone() { - _DPRINT( 4, "PhSrv.UssdM.PlayTone.start" ); + _DPRINT( 4, "PhSrv.UssdM.PlayTone.start" ); // debug print TInt err = KErrNone; -// <-- QT PHONE START--> -// RProperty::Define( KPSUidNcnList, KNcnPlayAlertTone, RProperty::EInt, ECapability_None , ECapabilityWriteDeviceData ); -// RProperty::Set( KPSUidNcnList, KNcnPlayAlertTone, KPhSrvUssdTone ); -// <-- QT PHONE END--> + + RProperty::Define( KPSUidNcnList, KNcnPlayAlertTone, RProperty::EInt, ECapability_None , ECapabilityWriteDeviceData ); + RProperty::Set( KPSUidNcnList, KNcnPlayAlertTone, KPhSrvUssdTone ); // debug print _DDPRINT( @@ -2079,8 +2092,7 @@ { _DPRINT( 4, "PhSrv.UssdM.GetTelephonyVariantData.Start" ); TInt err = KErrNone; -// <-- QT PHONE START--> -/* + // Variation data should be unchangable during run-time, // therefore, if once succesfully read, later reads are // not allowed. @@ -2088,10 +2100,10 @@ { CRepository* cenRepSession = NULL; TRAP ( err , - cenRepSession = CRepository::NewL( KCRUidTelVariation ) ); + cenRepSession = CRepository::NewL( KCRUidTelSrvVariation ) ); if ( err == KErrNone ) { - err = cenRepSession->Get( KTelVariationFlags, + err = cenRepSession->Get( KTelSrvVariationFlags, iVariantReadOnlyValues ); } delete cenRepSession; @@ -2099,8 +2111,6 @@ _DDPRINT( 4, "PhSrv.UssdM.variant", iVariantReadOnlyValues ); // debug print _DPRINT( 4, "PhSrv.UssdM.GetTelephonyVariantData.End" ); - */ -// <-- QT PHONE END--> return err; } @@ -2112,7 +2122,7 @@ // void CPhSrvUssdManager::SendMoAcknowledgementL() { - _DPRINT( 4, "PhSrv.SendMoAckL.Start" ); + _DPRINT( 4, "PhSrv.SendMoAckL.Start" ); // debug print // Acknowledge MT USSD message. RMobileUssdMessaging::TMobileUssdAttributesV1 msgAttribs; @@ -2130,7 +2140,7 @@ RMobileUssdMessaging::TMobileUssdAttributesV1Pckg attribs = msgAttribs; SendHandlerL().SendUssdL( KNullDesC8() , attribs ); - _DPRINT( 4, "PhSrv.SendMoAckL.End" ); + _DPRINT( 4, "PhSrv.SendMoAckL.End" ); // debug print } // ----------------------------------------------------------------------------- @@ -2140,51 +2150,20 @@ // void CPhSrvUssdManager::TurnLightsOn() { - _DPRINT( 4, "PhSrv.TurnLightsOn.Start" ); + _DPRINT( 4, "PhSrv.TurnLightsOn Start" ); // debug print - // Change the bit on and off. SysAp will detect that + // Change the bit on and off. SysAp will detect that // the lights should be switched on for the specified time. // - RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn); - TInt err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOff); - - if ( err != KErrNone ) - { - _DDPRINT( 4,"PhSrv.TurnLightsOn.Error: ",err );// debug print - } - - _DPRINT( 4, "PhSrv.TurnLightsOn.End" ); - } + RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOn); + TInt err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsControl, ELightsOff); -// ----------------------------------------------------------------------------- -// CPhSrvUssdManager::LoadDefaultString -// ----------------------------------------------------------------------------- -// -const TPtrC CPhSrvUssdManager::LoadDefaultString( const TDesC& aText ) - { - _DPRINT( 4, "PhSrv.LoadDefaultString.Start" ); - - if ( iTextBuffer ) - { - delete iTextBuffer; - iTextBuffer = NULL; - _DPRINT( 4, "PhSrv.LoadDefaultString.Clear" ); - } - TInt err = KErrNone; - TPtrC ptr( aText ); - if ( ptr.Length() ) - { - TRAP( err, iTextBuffer = HbTextResolverSymbian::LoadL( ptr ) ); - _DDPRINT( 4, "PhSrv.LoadDefaultString.LoadL.%d", err ); - if ( iTextBuffer ) - { - ptr.Set( iTextBuffer->Des() ); - _DPRINT( 4, "PhSrv.LoadDefaultString.Set" ); - } - } - _DPRINT( 4, "PhSrv.LoadDefaultString.End" ); - return ptr; + if ( err != KErrNone ) + { + _DDPRINT( 4,"PhSrv.TurnLightsOn.Error: ",err );// debug print + } + + _DPRINT( 4, "PhSrv.TurnLightsOn.End" ); // debug print } - // End of File