bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp
changeset 22 4255033c5d30
parent 2 0b192a3a05a4
child 19 43824b19ee35
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp	Tue Feb 02 00:20:42 2010 +0200
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp	Fri Apr 23 23:23:50 2010 +0300
@@ -389,7 +389,6 @@
         {
         iCallStatus->ReportCallStatusL();
         }
-    iVolumeSyncFromAccessory = EFalse;
     TRACE_FUNC_EXIT
     }
 
@@ -938,12 +937,15 @@
             LEAVE_IF_ERROR(aCmd.Parameter(0, param))
             TInt value;
             LEAVE_IF_ERROR(param.Int(value))
-            if (!iPhoneStatus)
+            // In HFP, AT+VGS is not valid before service level connection
+            // has established.
+            // In HSP, AT+VGS is allowed at any time.
+            if (!iPhoneStatus && iProtocolStatus->iProfile == EBtmcHSP )
                 {
                 iPhoneStatus = CBtmcPhoneStatus::NewL(*this, iPhone, iProtocolStatus->iProfile);
                 iPhoneStatus->SetVolumeControlFeatureL(ETrue);
                 }
-            if(iVolumeSyncFromAccessory)
+            if(iPhoneStatus)
                 {
                 iPhoneStatus->SetSpeakerVolumeL(value);
                 }
@@ -1025,37 +1027,9 @@
     CleanupStack::Pop(ok);
     SendResponseL(resarr);
     CleanupStack::PopAndDestroy(&resarr);
-    
-    // solution to volume sync - phone will always send its volume status back to accessory
-    
-    if( (aCmd.Id() == EATVGS) && (iVolumeSyncFromAccessory == EFalse) )
-    	{
-    	iVolumeSyncFromAccessory = ETrue;
-    	TInt vol(KErrNotFound);
-
-        if(iPhoneStatus)
-            {
-            vol = iPhoneStatus->GetVolumeStatus();
-            }
-
-    	if(vol > KErrNotFound) // volume exists
-    		{
-        TATParam param = TATParam();
-        LEAVE_IF_ERROR(aCmd.Parameter(0, param))
-        TInt value;
-        LEAVE_IF_ERROR(param.Int(value))
-        if(value != vol)
-    			{
-    			CATResult* event = CATResult::NewLC(EATVGS, EATUnsolicitedResult, vol);
-    			SendUnsoltResultL(*event);
-    			CleanupStack::PopAndDestroy(event);
-    			}
-    		}
-    	}
     CmdHandlingCompletedL();    
     }
 
-
 // -----------------------------------------------------------------------------
 // CBtmcProtocol::HandleActionCommandL
 //