Revision: 201015 RCL_3 PDK_3.0.i
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 27 Apr 2010 17:13:17 +0300
branchRCL_3
changeset 14 71e7b994dff4
parent 11 ba42c4bd84dd
child 20 586d88ba9aa1
Revision: 201015 Kit: 201017
engines/vmbxengine/src/vmnumber.cpp
nwnotifier/data/nwnotifier.rss
phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp
phonecmdhandler/phonecmdhnlr/eabi/phonecmdhandleru.def
phonecmdhandler/phonecmdhnlr/group/PhoneCmdHandler.mmp
phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerCallArray.h
phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerCallState.h
phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerControl.h
phonecmdhandler/phonecmdhnlr/src/PhoneHandlerCallArray.cpp
phonecmdhandler/phonecmdhnlr/src/PhoneHandlerCallState.cpp
phonecmdhandler/phonecmdhnlr/src/PhoneHandlerControl.cpp
satengine/SatServer/Commands/SendSmCmd/src/CSendSmHandler.cpp
satengine/SatServer/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp
satengine/SatServer/Engine/src/CSatCommandHandler.cpp
satengine/SatServer/inc/CSatCommandHandler.h
satui/satplugin/aisatplugininc/caisatengine.h
satui/satplugin/aisatpluginsrc/caisatengine.cpp
--- a/engines/vmbxengine/src/vmnumber.cpp	Wed Apr 14 16:32:24 2010 +0300
+++ b/engines/vmbxengine/src/vmnumber.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -429,11 +429,8 @@
             else
                 {
                 iPhoneBookType = EMBDNPhoneBook;
-                // set ALS line, if identifier reading returns -1
-                if ( KErrNotFound == result )
-                    {
-                    iPhoneVoicemailInfo.iVoice = alsline;
-                    }
+                // if mbdn file can be found, set the entry index to EAlsLine1
+                iPhoneVoicemailInfo.iVoice = EAlsLine1;
 
                 // try to open mbdn-type phonebook
                 result = iPhoneBook.Open( iPhone, KETelIccMbdnPhoneBook );
@@ -445,13 +442,18 @@
                     VMBLOGSTRING2( "Mbdn phonebook opening again \
                     result = %I ", result );
                     }
-                // close phonebook when error in opening or GetInfo
+                // close mbdn phonebook when error in opening or GetInfo 
+                // to test vmbx-phonebook
                 if ( KErrNone != result )
                     {
                     VMBLOGSTRING( "Close MBDN phonebook" );
                     iPhoneBook.Close();
+                    iMbdnPhonebookOk = EFalse;
+                    // try open vmbx-phonebook next 
+                    iPhoneBookType = EVMBXPhoneBook;
                     }
-                // close phonebook when no number founf to test vmbx-phonebook
+                // close mbdn phonebook when no number found 
+                // to test vmbx-phonebook
                 else if ( ( KErrNone == result ) && iNoNumberFound )
                     {
                     VMBLOGSTRING( "mbdn close, number not found" );
@@ -2377,6 +2379,8 @@
     if ( iPhoneBookType == EMBDNPhoneBook )
         {
         VMBLOGSTRING( "start MBDN PhoneBook read" );
+        VMBLOGSTRING2( "VMBX: RVmbxNumber::PhonebookReadL: \
+        iPhoneVoicemailInfo.iVoice = %I", iPhoneVoicemailInfo.iVoice );
         iPhoneBook.Read( status, iPhoneVoicemailInfo.iVoice,
                                                         numEntries, pbData );
         }
@@ -2572,6 +2576,8 @@
     if ( iPhoneBookType == EMBDNPhoneBook )
         {
         TInt index = iPhoneVoicemailInfo.iVoice;
+        VMBLOGSTRING2( "VMBX: RVmbxNumber::PhonebookWrite: \
+        iPhoneVoicemailInfo.iVoice index = %I", index );
         iPhoneBook.Write( status, pbData, index );
         VMBLOGSTRING( "Mbdn writing" );
         }
--- a/nwnotifier/data/nwnotifier.rss	Wed Apr 14 16:32:24 2010 +0300
+++ b/nwnotifier/data/nwnotifier.rss	Tue Apr 27 17:13:17 2010 +0300
@@ -17,7 +17,7 @@
 
 //  INCLUDES
 #include <eikon.rh>
-#include "../loc/networknotifier.loc" 
+#include <networknotifier.loc>
 
 NAME NWNS
 
--- a/phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp	Wed Apr 14 16:32:24 2010 +0300
+++ b/phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdManager.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -47,7 +47,7 @@
 #include <CPhCltUssd.h>
 #include <avkon.rsg>
 #include <PhoneServer.rsg>
-#include <telephonyvariant.hrh>
+#include <telservicesvariant.hrh>
 #include "PhSrvDebugInfo.h"
 #include <e32property.h>
 
@@ -904,7 +904,7 @@
 
         // Play the USSD tone if needed. Logically should be in RunL, but here
         // to give better balancing with voice and visible message.
-        if ( IsTelephonyFeatureSupported( KTelephonyLVFlagUssdTone ) )
+        if ( IsTelephonyFeatureSupported( KTelSrvLVFlagUssdTone ) )
             {
             _DPRINT( 4, "PhSrv.UssdHandleReceivedEventL.PlayTone" );
             PlayUssdTone();
--- a/phonecmdhandler/phonecmdhnlr/eabi/phonecmdhandleru.def	Wed Apr 14 16:32:24 2010 +0300
+++ b/phonecmdhandler/phonecmdhnlr/eabi/phonecmdhandleru.def	Tue Apr 27 17:13:17 2010 +0300
@@ -4,4 +4,6 @@
 	_ZN13CPhoneHandlerD0Ev @ 3 NONAME
 	_ZN13CPhoneHandlerD1Ev @ 4 NONAME
 	_ZN13CPhoneHandlerD2Ev @ 5 NONAME
+	_ZTI22CPhoneHandlerCallArray @ 6 NONAME
+	_ZTV22CPhoneHandlerCallArray @ 7 NONAME
 
--- a/phonecmdhandler/phonecmdhnlr/group/PhoneCmdHandler.mmp	Wed Apr 14 16:32:24 2010 +0300
+++ b/phonecmdhandler/phonecmdhnlr/group/PhoneCmdHandler.mmp	Tue Apr 27 17:13:17 2010 +0300
@@ -40,6 +40,7 @@
 SOURCE		PhoneHandlerDTMF.cpp
 SOURCE		PhoneHandlerResponse.cpp
 SOURCE		PhoneHandlerCallState.cpp
+SOURCE          PhoneHandlerCallArray.cpp
 
 USERINCLUDE     ../inc 
 
@@ -52,6 +53,7 @@
 LIBRARY 	logcli.lib
 LIBRARY		efsrv.lib
 LIBRARY		pbkeng.lib
+LIBRARY         telephonyservice.lib
 
 MACRO       API_TRACE_FLAG
 MACRO       COMPONENT_TRACE_FLAG
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerCallArray.h	Tue Apr 27 17:13:17 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarations for class CPhoneHandlerCallArray
+*
+*/
+
+
+#ifndef CPHONEHANDLERCALLARRAY_H
+#define CPHONEHANDLERCALLARRAY_H
+
+#include <e32base.h>
+
+class TCallInfo;
+class MCall;
+
+/**
+* Handles call adding 
+*
+*  @lib phonecmdhandler.dll
+*/
+class CPhoneHandlerCallArray: public CBase
+    {
+    
+    public: //Constructors and descructor    
+    
+        /**
+        * Two-phased constructing for the array.
+        *
+        */
+        static CPhoneHandlerCallArray* NewL( );
+
+        /**
+        * C++ default destructor
+        */
+        ~CPhoneHandlerCallArray( );
+
+        /**
+         * Add call to array
+         * @param aCall call to be added
+         * @return result of appending
+         */        
+        void AddL( const MCall* aCall );
+        
+        /**
+         * Remove call from array
+         * @param aCall call to be removed
+         * @return result of removal
+         */
+        TInt Remove( TCallInfo* aCall );
+        
+        /**
+         * Get call count.
+         */
+        TInt CallCount( );
+                
+        /**
+		 * Get call by state.
+		 */
+        TCallInfo* CallByState( TInt state );
+        
+        /**
+        * Finds call pointer specified by call index.
+        * @param aCallIndex
+        * @return corresponding call pointer or NULL if not found.
+        */
+        TCallInfo* FindCall( TInt aCallIndex );
+    
+        /**
+		* Get connected call count.
+		*/
+		TInt ConnectedCallCount( );
+		
+		/**
+		* Get existing call count.
+		*/
+		TInt ExistingCallCount();
+		              
+    private:
+        /**
+        * C++ default constructor
+        */
+        CPhoneHandlerCallArray( );
+                                          
+    private: // data
+        
+        /**
+        * Pointer array of call objects.     
+        */
+    	RPointerArray<TCallInfo> iCallArray;
+        
+    };
+
+#endif // CPHONEHANDLERCALLARRAY_H
--- a/phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerCallState.h	Wed Apr 14 16:32:24 2010 +0300
+++ b/phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerCallState.h	Tue Apr 27 17:13:17 2010 +0300
@@ -23,6 +23,8 @@
 // INCLUDES
 #include <e32base.h>
 #include <e32property.h>
+#include <ccallinformation.h>
+#include <mcallinformationobserver.h>
 
 // CONSTANTS
 
@@ -43,7 +45,7 @@
 *  @lib RemConAsy
 *  @since S60 3.1
 */
-NONSHARABLE_CLASS( CPhoneHandlerCallState ) : public CActive
+NONSHARABLE_CLASS( CPhoneHandlerCallState ) : public CBase, public MCallInformationObserver
 	{
 	public:	// Constructors and destructor
 	
@@ -57,25 +59,6 @@
         */
 		~CPhoneHandlerCallState();
 	
-	public: // New functions
-				
-	public: // Functions from base classes
-		
-	protected:  // New functions
-    
-    protected:  // Functions from base classes
-    
-    	/**
-        * From CActive. Handles S60 start up state change event.
-        */
-    	void RunL();
-	
-		/**
-        * From CActive. Implements cancellation of an outstanding Subscibe() 
-        * request.
-        */
-		void DoCancel();
-	
 	private:
 		
 		/**
@@ -87,11 +70,22 @@
         * By default Symbian 2nd phase constructor is private.
         */
 		void ConstructL();
+
+		/**
+		* Signals that there are changes in ongoing calls.
+		*    
+		* @return void
+		*/
+		void CallInformationChangedL();
+     	
+		// From MCallInformationObserver
 		
 		/**
-      	* Starts to listen change in S60 start up state.
-     	**/
-     	void Subscribe();
+		* Signals that there are changes in ongoing calls.
+		*    
+		* @return void
+		*/
+		void CallInformationChanged();
 	
 	public:     // Data
     
@@ -99,9 +93,8 @@
     
     private:    // Data
     
-    	// Publish and Subscribe handle used to listen changes in call states 
-    	RProperty iProperty;
-						
+    	CCallInformation* iInfo;
+
 		// reference to control
         CPhoneHandlerControl& iControl;
 		
--- a/phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerControl.h	Wed Apr 14 16:32:24 2010 +0300
+++ b/phonecmdhandler/phonecmdhnlr/inc/PhoneHandlerControl.h	Tue Apr 27 17:13:17 2010 +0300
@@ -26,6 +26,7 @@
 #include <e32base.h>
 #include <PhCltTypes.h>	
 #include <e32property.h> 
+#include <ccpdefs.h>
 
 // CONSTANTS
 
@@ -42,6 +43,8 @@
 class CRemConCallHandlingTarget;
 class CPhoneHandlerResponse;
 class CPhoneHandlerCallState;
+class CPhoneHandlerCallArray;
+class MCall;
 
 /**
 * Receives call handling related key presses from accessories and executes 
@@ -119,11 +122,11 @@
 		
 		/**
         * Informs the latest call state.
-        * @since S60 3.1
-        * @param aState Call state from KTelephonyCallState P&S key
-        * @return void
+        * @since S60 9.2
+        * @param aCall Call from MCallInformationObserver
+          * @return void
         */
-		void NotifyCallState( const TInt aState );
+		void NotifyCallStateL( const MCall* aCall );
 
 		/**
         * Get iSwitchCall flag, if this flag is ETrue, it means
@@ -267,16 +270,13 @@
         // Previous call state
         TInt iPrevState;
         
-        // Number of active calls
-        // Used to determine whether there's a multicall case when call state
-        TInt iActiveCalls;
-        
         // switch phonecall by press "Send" key
         TBool iSwitchCall;
         
         // Listens to phone call state changes.
         CPhoneHandlerCallState* iCallStateObserver;
         
+        CPhoneHandlerCallArray* iCallArray;
                     
     public:     // Friend classes
     
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonecmdhandler/phonecmdhnlr/src/PhoneHandlerCallArray.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2010 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the class CPhoneHandlerCallArray
+*
+*/
+
+#include <callinformation.h>
+#include "phonehandlercallarray.h"
+
+// ---------------------------------------------------------------------------
+// CPhoneHandlerCallArray::NewL.
+// ---------------------------------------------------------------------------
+//
+CPhoneHandlerCallArray* CPhoneHandlerCallArray::NewL( )
+    {
+    CPhoneHandlerCallArray* self = new ( ELeave ) CPhoneHandlerCallArray(  );
+    return self;    
+    }
+
+// ---------------------------------------------------------------------------
+// Destructs the array including remaining calls.
+// ---------------------------------------------------------------------------
+//
+CPhoneHandlerCallArray::~CPhoneHandlerCallArray( )
+    {
+     TInt callCount = iCallArray.Count();
+    
+    for (TInt callIndex = 0; callIndex < callCount; callIndex++)
+        {
+        TCallInfo* call = iCallArray[ callIndex ];
+        delete call;
+        }
+        
+    iCallArray.Reset();
+    iCallArray.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Iterates through call objects finding the call matching the given call index.
+// ---------------------------------------------------------------------------
+//    
+TCallInfo* CPhoneHandlerCallArray::FindCall( TInt aCallIndex )
+    {
+    TInt callCount = iCallArray.Count();
+    for (TInt callIndex = 0; callIndex < callCount; callIndex++)
+        {
+        TCallInfo* call = iCallArray[ callIndex ];        
+        if ( call )
+            {
+            if ( call->CallIndex() == aCallIndex )
+                {
+                return call;
+                }
+            }
+        }
+
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CPhoneHandlerCallArray::Add
+// ---------------------------------------------------------------------------
+//    
+void CPhoneHandlerCallArray::AddL( const MCall* aCall )
+    {
+    //take heap based copy and add it to the array
+    TCallInfo* call = new( ELeave )TCallInfo;    
+	
+    call->iIndex = aCall->CallIndex();
+	call->iState = aCall->CallState();
+	call->iType = aCall->CallType();
+	call->iDirection = aCall->CallDirection();
+	call->iEmergencyCall = aCall->IsEmergency();
+	call->iServiceId = aCall->ServiceId();    
+
+	CleanupStack::PushL( call );
+	iCallArray.AppendL( call );    
+	CleanupStack::Pop( call );
+    }
+
+// ---------------------------------------------------------------------------
+// CPhoneHandlerCallArray::Remove
+// ---------------------------------------------------------------------------
+//    
+TInt CPhoneHandlerCallArray::Remove( TCallInfo* aCall ) 
+    {
+    TInt index = iCallArray.Find( aCall );
+    if ( index != KErrNotFound )
+        {
+        TCallInfo* call = iCallArray[ index ];
+        delete call;
+        iCallArray.Remove( index );
+        return KErrNone;
+        }
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CPhoneHandlerCallArray::CallCount
+// ---------------------------------------------------------------------------
+//    
+TInt CPhoneHandlerCallArray::CallCount( )
+    {
+    return iCallArray.Count();
+    }
+
+//---------------------------------------------------------------------------
+// CPhoneHandlerCallArray::CallByState
+// ---------------------------------------------------------------------------
+//    
+TCallInfo* CPhoneHandlerCallArray::CallByState( TInt aState )
+    {
+    TCallInfo* call;
+    TInt callCount = iCallArray.Count();
+    for (TInt callIndex = 0; callIndex < callCount; callIndex++)
+        {
+        call = iCallArray[ callIndex ];      
+        
+        if( call->CallState() == aState)
+        	{
+        	return call;
+            }
+        }
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructs the monitor.
+// ---------------------------------------------------------------------------
+//
+CPhoneHandlerCallArray::CPhoneHandlerCallArray()
+    {
+    }
+	
+//---------------------------------------------------------------------------
+// CPhoneHandlerCallArray::ConnectedCallCount
+// ---------------------------------------------------------------------------
+//    
+TInt CPhoneHandlerCallArray::ConnectedCallCount()
+    {
+    TInt callCount = iCallArray.Count();
+	TInt connectedCalls = 0;
+    for ( TInt callIndex = 0; callIndex < callCount; callIndex++ )
+        {
+        MCall* call = iCallArray[ callIndex ];        
+        if ( CCPCall::EStateConnected == call->CallState() )
+            {
+            connectedCalls++;
+            }
+        }
+    return connectedCalls;
+    }
+
+//---------------------------------------------------------------------------
+// CPhoneHandlerCallArray::ExistingCallCount
+// ---------------------------------------------------------------------------
+//    
+TInt CPhoneHandlerCallArray::ExistingCallCount()
+    {
+    TInt callCount = iCallArray.Count();
+	TInt existingCalls = 0;
+    for ( TInt callIndex = 0; callIndex < callCount; callIndex++ )
+        {
+        TCallInfo* call = iCallArray[ callIndex ];      
+        CCPCall::TCallState callState = call->CallState();
+        
+        if( CCPCall::EStateIdle != callState  
+			&& CCPCall::EStateDisconnecting != callState )
+			{
+			existingCalls++;
+            }
+        }
+    return existingCalls;
+    }
+
+// End of File
--- a/phonecmdhandler/phonecmdhnlr/src/PhoneHandlerCallState.cpp	Wed Apr 14 16:32:24 2010 +0300
+++ b/phonecmdhandler/phonecmdhnlr/src/PhoneHandlerCallState.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -22,6 +22,11 @@
 #include "PhoneHandlerDebug.h"
 #include <ctsydomainpskeys.h>
 
+#include <ccallinformation.h>
+#include <mcall.h>
+#include <ccallinfoiter.h>
+
+
 // EXTERNAL DATA STRUCTURES
 
 // EXTERNAL FUNCTION PROTOTYPES  
@@ -50,10 +55,8 @@
 // -----------------------------------------------------------------------------
 //
 CPhoneHandlerCallState::CPhoneHandlerCallState( CPhoneHandlerControl& aControl )
-:	CActive(CActive::EPriorityStandard),
-	iControl( aControl )
+:	iControl( aControl )
 	{
-	CActiveScheduler::Add(this);
 	} 
 
 // -----------------------------------------------------------------------------
@@ -65,11 +68,9 @@
 	{
 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::ConstructL() start" );
 	
-	// Allows CPhoneHandlerCallState to start to listen S60 call states.
-	User::LeaveIfError( 
-		iProperty.Attach( KPSUidCtsyCallInformation, KCTsyCallState ) );
-		
-	Subscribe();
+	// Allows CPhoneHandlerCallState to start to listen call states.
+	iInfo = CCallInformation::NewL();
+	iInfo->NotifyCallInformationChanges(*this);
 	
 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::ConstructL() end" );
 	}
@@ -94,62 +95,40 @@
 CPhoneHandlerCallState::~CPhoneHandlerCallState()
 	{
 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::~CPhoneHandlerCallState() start" );
-	
-	Cancel();
-	iProperty.Cancel();
-    iProperty.Close();
-	
+	    
+    if ( iInfo )
+    	{
+    	iInfo->CancelNotification();
+    	delete iInfo;
+    	}    
+
 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::~CPhoneHandlerCallState() end" );
 	}
 
 // -----------------------------------------------------------------------------
-// CPhoneHandlerCallState::RunL()
-// Informs caller of an asynchronous request that it has been completed.
-// (other items were commented in a header).
+// CPhoneHandlerCallState::CallInformationChanged
 // -----------------------------------------------------------------------------
 //
-void CPhoneHandlerCallState::RunL()
+void CPhoneHandlerCallState::CallInformationChanged()
 	{
-	COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerCallState::RunL() - return code = %d", iStatus.Int() );
-		
-	TInt state( 0 );
-	iProperty.Get( state );
-	
-	COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerCallState - KTelephonyCallState = %d", state );
-		
-	if( iStatus.Int() == KErrNone )
-		{
-		iControl.NotifyCallState( state );
-		}
-		
-	Subscribe();
+    TRAP_IGNORE( CallInformationChangedL() );
     }
 
 // -----------------------------------------------------------------------------
-// CPhoneHandlerCallState::DoCancel
-// (other items were commented in a header).
+// CPhoneHandlerCallState::CallInformationChangedL
 // -----------------------------------------------------------------------------
 //
-void CPhoneHandlerCallState::DoCancel()
-	{
-	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::DoCancel()" );
-	
-	iProperty.Cancel();
-	}
+void CPhoneHandlerCallState::CallInformationChangedL()
+    {
+     CCallInfoIter& iter = iInfo->GetCallsL();    
+     for( iter.First(); !iter.IsDone(); iter.Next() )
+         {
+         const MCall* call ( &iter.Current() );
+         if ( call )
+        	 {
+        	 iControl.NotifyCallStateL( call );
+        	 }
+         }
+    }
 
-// -----------------------------------------------------------------------------
-// CPhoneHandlerCallState::Subscribe
-// Start to listen changes in call state.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void CPhoneHandlerCallState::Subscribe()
-	{
-	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallState::Subscribe()" );
-	
-    iProperty.Subscribe( iStatus );
-    SetActive();
-	}
-
-//
 // End of file
--- a/phonecmdhandler/phonecmdhnlr/src/PhoneHandlerControl.cpp	Wed Apr 14 16:32:24 2010 +0300
+++ b/phonecmdhandler/phonecmdhnlr/src/PhoneHandlerControl.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -38,6 +38,8 @@
 #include <ctsydomainpskeys.h>
 #include <connect/sbdefs.h>
 #include <coreapplicationuisdomainpskeys.h>
+#include "PhoneHandlerCallArray.h"
+#include <callinformation.h>
 
 // EXTERNAL DATA STRUCTURES
 
@@ -101,7 +103,8 @@
     	
 	iResponse = CPhoneHandlerResponse::NewL( *this );
 	iCallStateObserver = CPhoneHandlerCallState::NewL( *this );
-			
+    iCallArray = CPhoneHandlerCallArray::NewL();
+    
 	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::ConstructL() end" );
 	}
 
@@ -145,7 +148,9 @@
     	{
     	delete iCallStateObserver;
     	}
-            
+    
+    delete iCallArray;
+    
     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::~CPhoneHandlerControl() end" );
     }
 
@@ -226,31 +231,36 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CPhoneHandlerControl::NotifyCallState( const TInt aState )
+void CPhoneHandlerControl::NotifyCallStateL( const MCall* aCall )
     {
-    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aState=%d", aState );
+    COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() aCall.CallIndex:%d, aCall.CallState:%d",
+				aCall->CallIndex(), aCall->CallState() );
     
-	if( aState == EPSCTsyCallStateConnected && iPrevState != EPSCTsyCallStateHold )
-		{
-		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls++" );
-		
-		iActiveCalls++;
-		}
-	else if( aState == EPSCTsyCallStateDisconnecting && 
-			( iPrevState == EPSCTsyCallStateConnected || iPrevState == EPSCTsyCallStateHold ))
-		{
-		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls--" );
-		
-		iActiveCalls--;
-		}
-	else if( aState == EPSCTsyCallStateNone )
-		{
-		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): iActiveCalls = 0" );
-		iActiveCalls = 0;
-		}
-		
-	iPrevState = aState;
-	COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() iActiveCalls=%d", iActiveCalls );
+    TCallInfo* call = iCallArray->FindCall( aCall->CallIndex() );
+   
+    if ( call )
+    	{
+    	// If the call is in idle or disconnecting state it can be removed from the array
+    	if ( CCPCall::EStateIdle == aCall->CallState() 
+    			|| CCPCall::EStateDisconnecting == aCall->CallState() )
+    		{
+    		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): remove call" );
+        	iCallArray->Remove( call );
+    		}
+    	else
+    		{
+    		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): update existing call" );
+    		iCallArray->Remove( call );
+    		iCallArray->AddL( aCall );
+    		}
+    	}
+    else
+    	{
+    	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState(): new call" );
+    	iCallArray->AddL( aCall );
+    	}
+	COM_TRACE_3( "[PHONECMDHANDLER] CPhoneHandlerControl::NotifyCallState() connected:%d existing:%d total:%d", 
+			iCallArray->ConnectedCallCount(), iCallArray->ExistingCallCount(), iCallArray->CallCount() );
 	}
 
 // -----------------------------------------------------------------------------
@@ -531,7 +541,7 @@
         case ERemConExtAnswerCall:
 		    {
 		    COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerCall command" );
-		    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iActiveCalls is %d", iActiveCalls );
+		    COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - iCallArray->ExistingCallCount() is %d", iCallArray->ExistingCallCount() );
 
 			/*    	    
     	    if( iActiveCalls > 0 )
@@ -563,49 +573,39 @@
         case ERemConExtAnswerEnd:
         	{
         	COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - ERemConExtAnswerEnd command" );
-    	            	
-        	TInt callState( EPSCTsyCallStateUninitialized );
-    		iProperty.Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); 
-    		
-    		COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() call state = %d", callState );
-			   
-		    if( callState != EPSCTsyCallStateUninitialized &&
-		    	callState != EPSCTsyCallStateNone && 
-		    	callState != EPSCTsyCallStateDisconnecting )
-		    	{
-		    	if( callState == EPSCTsyCallStateAlerting ||
-		    		callState == EPSCTsyCallStateDialling ||
-		    		callState == EPSCTsyCallStateAnswering ||
-		    		callState == EPSCTsyCallStateConnected ||
-		    		callState == EPSCTsyCallStateHold )
-		    		{
-		    		pService = CPhoneHandlerEndCall::NewL( *this, 
-		    									   	   aOperation );
-		    		}
-		    	// callState == EPSTelephonyCallStateRinging
-		    	else
-		    		{
-		    		COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() iActiveCalls = %d", iActiveCalls );
-		    		if( iActiveCalls > 0 )
-		    			{
-		    			// multicall case : End call that has existed longer.
-		    			// (From UI viewpoint ringing call is in waiting state.)
-		    			pService = CPhoneHandlerEndCall::NewL( *this, 
-		    									   	   aOperation );
-		    	        if( callState == EPSCTsyCallStateRinging )
-		    	            {
-		    	            // In multiparty case the telephony key is not
-		    	            // updated. The call amount is updated manually.
-		    	            iActiveCalls--;
-		    	            }
-		    			}
-		    		else
-		    			{
-		    			pService = CPhoneHandlerAnswerCall::NewL( 
-		    							*this, 
-		    							aOperation );
-		    			}
-		    		}
+    	       
+        	if( iCallArray->ExistingCallCount() )
+          		{
+          		COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - call(s) exist" );
+          		// If only one call exists and it's state is CCPCall::EStateQueued,
+          		// it is actually in ringing state and should be answered.
+          		if ( NULL == iCallArray->CallByState( CCPCall::EStateRinging ) 
+						&& ( iCallArray->ExistingCallCount() == 1 
+							&& NULL == iCallArray->CallByState( CCPCall::EStateQueued ) ) )
+						{
+						COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - no ringing calls" );
+						pService = CPhoneHandlerEndCall::NewL( *this, 
+														   aOperation );
+						}
+				// Ringing call(s) exist
+				else
+					{
+					if( iCallArray->ExistingCallCount() > 1 )
+						{
+						COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - several ringing calls" );
+						// multicall case : End call that has existed longer.
+						// (From UI viewpoint ringing call is in waiting state.)
+						pService = CPhoneHandlerEndCall::NewL( *this, 
+													   aOperation );
+						}
+					else
+						{
+						COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerControl::CreateServiceL() - single ringing call" );
+						pService = CPhoneHandlerAnswerCall::NewL( 
+										*this, 
+										aOperation );
+						}
+					}
 		    	}
 		    else
 		    	{
--- a/satengine/SatServer/Commands/SendSmCmd/src/CSendSmHandler.cpp	Wed Apr 14 16:32:24 2010 +0300
+++ b/satengine/SatServer/Commands/SendSmCmd/src/CSendSmHandler.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2002-2010 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"
@@ -136,7 +136,9 @@
 void CSendSmHandler::Event( TInt aEvent )
     {
     LOG( SIMPLE, "SENDSM: CSendSmHandler::Event calling" )
-    LOG2( SIMPLE, "SENDSM:   Event %i", aEvent )
+    LOG2( SIMPLE, "SENDSM: CSendSmHandler::Event iWaitingUiLaunch=%d",  
+    iWaitingUiLaunch ) 
+    LOG2( SIMPLE, "SENDSM: CSendSmHandler::Event IsActive=%d", IsActive() ) 
     if ( MSatUtils::EMoSmControlExecuting == aEvent )
         {
         LOG( NORMAL, "SENDSM:   Event EMoSmControlExecuting" )
@@ -147,7 +149,9 @@
         LOG( NORMAL, "SENDSM:   Event EMoSmControlDone" )
         iMoSmControlActive = EFalse;
         // Check if Sendsm is waiting.
-        if ( !IsActive() )
+        // Completing call control should not trigger this command handler 
+        // if it is still waiting for UI to be launched. 
+        if ( !IsActive() && !iWaitingUiLaunch ) 
             {
             LOG( SIMPLE, "SENDSM: CSendSmHandler::Event sendsm" )
             // Do the Sendsm.
@@ -513,6 +517,11 @@
     // and sends the command then.
     if ( !iMoSmControlActive )
         {
+        LOG2( SIMPLE,  
+        "SENDSM: CSendSmHandler::HandleCommand: !iMoSmControlActive, \
+        iNeedUiSession=%d",
+        iNeedUiSession ) 
+
         iUtils->NotifyEvent( MSatUtils::ESendSmExecuting );
 
         if ( !iNeedUiSession )
@@ -614,6 +623,8 @@
                     ESatSProactiveNotificationResponse,
                     this ) )
 
+                LOG( SIMPLE, 
+                    "SENDSM: CSendSmHandler::HandleCommand send ui notification" )
                 iUtils->SatUiHandler().UiSession()->SendCommand(
                     &iNotificationDataPckg,
                     &iNotificationRspPckg,
@@ -623,6 +634,8 @@
                 }
             else
                 {
+                LOG( SIMPLE, 
+                "SENDSM: CSendSmHandler::HandleCommand user confirmation needed" ) 
                 // Register service request handler for SendSm command,
                 // If there is already service request for query, registering
                 // updates command handler, so client responses comes to this
@@ -634,6 +647,9 @@
 
                 iNotificationSent = EFalse;
 
+                LOG( SIMPLE, 
+                "SENDSM: CSendSmHandler::HandleCommand send user confirmation request" ) 
+
                 // Ask the user permission to send sms. Reply will come
                 // to ClientResponse method.
                 iUtils->SatUiHandler().UiSession()->SendCommand(
--- a/satengine/SatServer/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp	Wed Apr 14 16:32:24 2010 +0300
+++ b/satengine/SatServer/Commands/SendUSSDCmd/src/CSendUssdHandler.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2002-2007 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"
@@ -18,6 +18,7 @@
 
 #include    <CPhCltUssdSatClient.h>
 #include	<CPhCltUssd.h>
+#include    <exterror.h>
 
 #include    "MSatSystemState.h"
 #include    "MSatApi.h"
@@ -688,8 +689,18 @@
     else if ( TSatExtErrorUtils::IsExtendedError( aError ) ) // extended error
         {
         TUint8 addInfo( 0 );
+        // In subcase 2, SAT always gets KErrGsmCCCallRejected
+        if ( KErrGsmCCCallRejected == aError )   
+           {
+           LOG( SIMPLE, 
+           "SENDUSSD: CSendUssdHandler::HandleSendUssdResult permanent error" )	
+           // ussd request is rejected by SIM
+           iSendUssdRsp.iGeneralResult = RSat::KInteractionWithCCPermanentError;
+           iSendUssdRsp.iInfoType = RSat::KMeProblem;
+           addInfo = RSat::KActionNotAllowed;
+           }   
         // Check and map network failure
-        if ( TSatExtErrorUtils::IsNetworkError( aError ) )
+        else if ( TSatExtErrorUtils::IsNetworkError( aError ) )
             {
             LOG( SIMPLE, 
             "SENDUSSD: CSendUssdHandler::HandleSendUssdResult NetworkError" )
@@ -749,6 +760,16 @@
         iSendUssdRsp.iAdditionalInfo.SetLength( 0 );
         iSendUssdRsp.iAdditionalInfo.Zero();
         }
+    else if ( KErrSatControl == aError )
+        {
+        LOG( SIMPLE, 
+        "SENDUSSD: CSendUssdHandler::HandleSendUssdResult \
+        KModifiedByCallControl" )
+        iSendUssdRsp.iGeneralResult = RSat::KModifiedByCallControl;
+        iSendUssdRsp.iInfoType = RSat::KNoAdditionalInfo;
+        iSendUssdRsp.iAdditionalInfo.SetLength( 0 );
+        iSendUssdRsp.iAdditionalInfo.Zero(); 
+        }
     else if ( KErrNone == aError )   //  Success case
         {
         LOG( SIMPLE, 
--- a/satengine/SatServer/Engine/src/CSatCommandHandler.cpp	Wed Apr 14 16:32:24 2010 +0300
+++ b/satengine/SatServer/Engine/src/CSatCommandHandler.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2002-2010 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"
@@ -158,6 +158,12 @@
                     // Notify derived class that ui launch failed.
                     UiLaunchFailed();
                     }
+                else 
+                    { 
+                    LOG( SIMPLE,  
+                    "SATENGINE: CSatCommandHandler::DoHandleCommand iWaitingUiLaunch")
+                    iWaitingUiLaunch = ETrue; 
+                    }
                 }
             else
                 {
--- a/satengine/SatServer/inc/CSatCommandHandler.h	Wed Apr 14 16:32:24 2010 +0300
+++ b/satengine/SatServer/inc/CSatCommandHandler.h	Tue Apr 27 17:13:17 2010 +0300
@@ -185,6 +185,9 @@
         // Utils interface
         MSatUtils* iUtils;
 
+        // Indicates that command is pending for UI to launch
+        TBool iWaitingUiLaunch;
+
     private:    // Data
 
         // Requiered attribute for the ECOM framework.
@@ -197,8 +200,6 @@
         // starting to handle pending proactive command.
         RTimer iDelayTimer;
 
-        // Indicates that command is pending for UI to launch
-        TBool iWaitingUiLaunch;
     };
 
 #endif      // CSATCOMMANDHANDLER_H
--- a/satui/satplugin/aisatplugininc/caisatengine.h	Wed Apr 14 16:32:24 2010 +0300
+++ b/satui/satplugin/aisatplugininc/caisatengine.h	Tue Apr 27 17:13:17 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -104,16 +104,6 @@
 private: // New functions
 
     /**
-     * Duplicate a bitmap by copying memory.
-     *
-     * @param aSrcBmp The source bitmap.
-     * @param aDestBmp The destination bitmap.
-     * @return The error code.
-     */
-    TInt DuplicateBitmap( const CFbsBitmap* aDestBmp,
-                          const CFbsBitmap* aSrcBmp );    
-
-    /**
      * Loads the Idle Mode icon from SatIcon.
      *
      * @param aIconId The icon record id.
--- a/satui/satplugin/aisatpluginsrc/caisatengine.cpp	Wed Apr 14 16:32:24 2010 +0300
+++ b/satui/satplugin/aisatpluginsrc/caisatengine.cpp	Tue Apr 27 17:13:17 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2007-2010 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"
@@ -119,6 +119,7 @@
     // destroying the bitmap owned by UAA.
     if ( iIcon )
         {
+        TFLOGSTRING( "CAiSatEngine::ContentIconL iIcon != NULL" )
         // The bitmap for publishing.
         CFbsBitmap* bitmapToPublish( NULL );    
                   
@@ -127,17 +128,18 @@
 
         TSize size = iIcon->SizeInPixels();
         TInt error = bitmapToPublish->Create( size, iIcon->DisplayMode() ); 
-         
+        TFLOGSTRING2( "CFbsBitmap::Create returns %d", error )
         // Duplicate the bitmap owned by UAA into the new bitmap.
         if ( !error )
             {
-            error = DuplicateBitmap( bitmapToPublish, iIcon );        
+            error = bitmapToPublish->Duplicate( iIcon->Handle() );
+            TFLOGSTRING2( "CFbsBitmap::Duplicate returns %d", error )
             if ( !error )
                 {
                 // Create a icon from the bitmap and publish it.
                 aGulIcon = CGulIcon::NewL( bitmapToPublish );
                 CleanupStack::Pop( bitmapToPublish );        
-                TFLOGSTRING( "CAiSatEngine::ContentIconL create GulIcon" )                
+                TFLOGSTRING( "CAiSatEngine::ContentIconL create GulIcon" )
                 }
             } 
         if ( error )  
@@ -146,7 +148,7 @@
             aGulIcon = NULL;
             }        
         }   
-    TFLOGSTRING( "CAiSatEngine::ContentIconL exits" )    
+    TFLOGSTRING( "CAiSatEngine::ContentIconL exits" )
     }
 
 //------------------------------------------------------------------------------
@@ -305,46 +307,4 @@
     TFLOGSTRING( "CAiSatEngine::SendSatResponseL exits" )
     }
       
-// ---------------------------------------------------------------------------
-// Duplicate a bitmap by copying memory.
-// ---------------------------------------------------------------------------
-//
-TInt CAiSatEngine::DuplicateBitmap( const CFbsBitmap* aDestBmp,
-                                    const CFbsBitmap* aSrcBmp )
-    {
-    TFLOGSTRING( "CAiSatPlugin::DuplicateBitmap() called" )
-
-    TInt error( KErrGeneral );
-
-    // Get display mode about bitmap
-    TDisplayMode bmpDisplayMode = aSrcBmp->DisplayMode();
-
-    // Get size and scan line length of the source bitmap.
-    TSize size = aSrcBmp->SizeInPixels();
-    TInt scanLineLength = CFbsBitmap::ScanLineLength( 
-                            size.iWidth, bmpDisplayMode );
-    TInt bitmapHeight = size.iHeight;
-
-    TUint* bufUint = new TUint[ scanLineLength ];
-    if ( bufUint )
-        {
-        TPtr8 bufPtr ( ( TUint8* )bufUint, scanLineLength, scanLineLength );
-        // Initialize the pixel data for destination bitmap
-        for ( TInt pixelIndex = 0; pixelIndex < bitmapHeight; ++pixelIndex )
-            {
-            TPoint pixelPoint( 0, pixelIndex );
-            aSrcBmp->GetScanLine( bufPtr, pixelPoint,
-            scanLineLength, bmpDisplayMode );
-            aDestBmp->SetScanLine( bufPtr, pixelIndex );
-            }
-        error = KErrNone;
-        TFLOGSTRING3( "CAiSatPlugin::DuplicateBitmap() \
-        scanLineLength = %d bitmapHeight = %d", scanLineLength, bitmapHeight )
-        }
-
-    delete bufUint;
-    bufUint = NULL;
-
-    TFLOGSTRING( "CAiSatPlugin::DuplicateBitmap() exits" )
-    return error;
-    }  
+// End Of File