Revision: 200919 RCL_3 PDK_3.0.0
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 12:53:11 +0300
branchRCL_3
changeset 21 53b7818cd282
parent 20 2f88a7d66f50
child 35 95674584745d
Revision: 200919 Kit: 2010121
bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp
bluetoothengine/btaudioman/expinc/BTAccObserver.h
bluetoothengine/btaudioman/inc/basrvaccman.h
bluetoothengine/btaudioman/src/basrvaccman.cpp
bluetoothengine/bteng/conf/bteng.confml
bluetoothengine/bteng/conf/bteng_10204DAB.crml
bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettinglist.h
bluetoothengine/btmac/common/atcodec.h
bluetoothengine/btmac/inc/btmonobearer/bmbcmdlistener.h
bluetoothengine/btmac/inc/btmonobearer/bmbplugin.h
bluetoothengine/btmac/inc/btmonocmdhandler/HfpAtCmdHandler.h
bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotdatabuf.h
bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotocol.h
bluetoothengine/btmac/src/ATCodec/atccommand.cpp
bluetoothengine/btmac/src/BTMonoCmdHandler/HfpAtCmdhandler.cpp
bluetoothengine/btmac/src/BTMonoCmdHandler/btmccallinghandler.cpp
bluetoothengine/btmac/src/BTMonoCmdHandler/btmcoperator.cpp
bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp
bluetoothengine/btsac/btrcc/inc/btrccAbsoluteVolumeLevelController.h
bluetoothengine/btsac/btrcc/inc/btrccLegacyVolumeLevelController.h
bluetoothengine/btsac/btrcc/inc/btrccLinker.h
bluetoothengine/btsac/btrcc/inc/btrccVolumeLevelControllerBase.h
bluetoothengine/btsac/btrcc/src/btrccAbsoluteVolumeLevelController.cpp
bluetoothengine/btsac/btrcc/src/btrccLegacyVolumeLevelController.cpp
bluetoothengine/btsac/btrcc/src/btrccLinker.cpp
bluetoothengine/btsac/btrcc/src/btrccVolumeLevelControllerBase.cpp
btservices_plat/bluetooth_local_variation_api/inc/btengdomaincrkeys.h
cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp
cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp
--- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp	Tue May 25 12:53:11 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-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"
@@ -29,18 +29,14 @@
 		if(aProfileVersion == AvrcpSdp::KAvrcpProfileVersion13)
 			{
 			serviceClassUuids->StartListL()
-				->BuildDESL()->StartListL()
 					->BuildUUIDL(TUUID(TUint16(KAVRemoteControlUUID)))
-				->EndListL()
 			->EndListL();
 			}
 		else
 			{
 			serviceClassUuids->StartListL()
-				->BuildDESL()->StartListL()
 					->BuildUUIDL(TUUID(TUint16(KAVRemoteControlUUID)))
 					->BuildUUIDL(TUUID(TUint16(KAVRemoteControlControllerUUID)))
-				->EndListL()
 			->EndListL();
 			}
 		
--- a/bluetoothengine/btaudioman/expinc/BTAccObserver.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btaudioman/expinc/BTAccObserver.h	Tue May 25 12:53:11 2010 +0300
@@ -91,6 +91,7 @@
     virtual TInt ConnectionStatus(const TBTDevAddr& aAddr) = 0;
     
     virtual TBool IsAvrcpVolCTSupported() = 0;
+    virtual TBool IsAvrcpLegacyVolCTSupported() = 0;
     virtual TBool IsAbsoluteVolumeSupported(const TBTDevAddr& aAddr) = 0;
     
     /**
--- a/bluetoothengine/btaudioman/inc/basrvaccman.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btaudioman/inc/basrvaccman.h	Tue May 25 12:53:11 2010 +0300
@@ -16,7 +16,7 @@
 *  Name        : basrvaccman.h
 *  Part of     : BTEng / Bluetooth Accessory Server
 *  Description : 
-*  Version     : %version: 3.1.4.1.2.2.13 %
+*  Version     : %version: 3.1.4.1.2.2.14 %
 *
 */
 
@@ -101,6 +101,7 @@
     TBTEngConnectionStatus ConnectionStatus4Client(const TBTDevAddr& aAddr) const;
 
     TBool IsAvrcpVolCTSupported();
+    TBool IsAvrcpLegacyVolCTSupported(); 
     TBool IsAbsoluteVolumeSupported(const TBTDevAddr& aAddr);
     TBool DisconnectIfAudioOpenFails();
 
@@ -223,6 +224,7 @@
     CBasrvActive* iAsyncHandlingActive;
     
     TBool iAvrcpVolCTSupported;
+    TBool iAvrcpLegacyVolCTSupported;
     TBool iDisconnectIfAudioOpenFails;
     };
 
--- a/bluetoothengine/btaudioman/src/basrvaccman.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btaudioman/src/basrvaccman.cpp	Tue May 25 12:53:11 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:  Implementation of an accessory management.
-*  Version     : %version:  14.1.10 %
+*  Version     : %version:  14.1.11 %
 *
 */
 
@@ -53,17 +53,21 @@
     CRepository* cenrep = NULL;
     TRAP_IGNORE(cenrep = CRepository::NewL(KCRUidBluetoothEngine));
     TInt avrcpVol = EBTAvrcpVolCTNotSupported;
+    TInt avrcpLegacyVol = EBTAvrcpLegacyVolCTNotSupported;
     TInt autoDisconnect = EBTDisconnectIfAudioOpenFails;
     if (cenrep)
         {
         cenrep->Get(KBTAvrcpVolCTLV, avrcpVol);
+        cenrep->Get(KBTAvrcpLegacyVolCTLV, avrcpLegacyVol);
         cenrep->Get(KBTDisconnectIfAudioOpenFailsLV, autoDisconnect);
         delete cenrep;
         }
     iAvrcpVolCTSupported = (avrcpVol == EBTAvrcpVolCTSupported);
+    iAvrcpLegacyVolCTSupported = (avrcpLegacyVol == EBTAvrcpLegacyVolCTSupported);
     iDisconnectIfAudioOpenFails = (autoDisconnect == EBTDisconnectIfAudioOpenFails);
     TRACE_INFO((_L("[AVRCP_Vol_CT] %d [DisconnectIfAudioOpenFails] %d"), 
         iAvrcpVolCTSupported, iDisconnectIfAudioOpenFails))
+    TRACE_INFO((_L("[EBTAvrcpLegacyVolCTSupported] %d"), iAvrcpLegacyVolCTSupported))
     LoadServicesL();
     }
 
@@ -532,6 +536,11 @@
     {
     return iAvrcpVolCTSupported;
     }
+
+TBool CBasrvAccMan::IsAvrcpLegacyVolCTSupported()
+    {
+    return iAvrcpLegacyVolCTSupported;
+    }
     
 TBool CBasrvAccMan::IsAbsoluteVolumeSupported(const TBTDevAddr& aAddr)
 	{
Binary file bluetoothengine/bteng/conf/bteng.confml has changed
Binary file bluetoothengine/bteng/conf/bteng_10204DAB.crml has changed
--- a/bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettinglist.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettinglist.h	Tue May 25 12:53:11 2010 +0300
@@ -33,7 +33,7 @@
     CAknSettingItem* CreateSettingItemL(TInt identifier);
 
     // handles the listbox events
-    virtual void HandleListBoxEventL(CEikListBox* aListBox,
+    void HandleListBoxEventL(CEikListBox* aListBox,
             TListBoxEvent aEventType);
 
     void EditCurrentItemL(TInt aCommand);
--- a/bluetoothengine/btmac/common/atcodec.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/common/atcodec.h	Tue May 25 12:53:11 2010 +0300
@@ -21,6 +21,7 @@
 
 //  INCLUDES
 #include <e32base.h>
+#include <atext.h>
 
 enum TATId
     {
@@ -88,7 +89,6 @@
     EATIntParam
     };
     
-const TInt KMaxATSize = 512;
 const TInt KMaxATParamSize = 256;
 
 class RReadStream;
--- a/bluetoothengine/btmac/inc/btmonobearer/bmbcmdlistener.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/inc/btmonobearer/bmbcmdlistener.h	Tue May 25 12:53:11 2010 +0300
@@ -90,7 +90,7 @@
         RProperty iATRespProperty;
 
 		// At command buffer
-		TBuf8<KMaxATSize> iAtCmdBuf;
+		TBuf8<KDefaultCmdBufLength> iAtCmdBuf;
     };
 
 #endif
--- a/bluetoothengine/btmac/inc/btmonobearer/bmbplugin.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/inc/btmonobearer/bmbplugin.h	Tue May 25 12:53:11 2010 +0300
@@ -202,7 +202,7 @@
     private: // owned
 
     	// Last received and corrected-decoded message.
-		TBuf8<KMaxATSize> iInData;       
+		TBuf8<KDefaultCmdBufLength> iInData;       
     	TUid iInterfaceUid;
     	TUint iTransactionId;
     	TUint iOperationId;
--- a/bluetoothengine/btmac/inc/btmonocmdhandler/HfpAtCmdHandler.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/inc/btmonocmdhandler/HfpAtCmdHandler.h	Tue May 25 12:53:11 2010 +0300
@@ -31,7 +31,7 @@
 class MATExtObserver
     {
 public:
-    virtual void ATExtHandleCommandCompletedL(TInt aErr, const TDesC8& aReply) = 0;
+    virtual void ATExtHandleReplyReceivedL(TInt aErr, const TDesC8& aReply) = 0;
 
     virtual void UnsolicitedResultFromATExtL(TInt aErr, const TDesC8& aAT) = 0;
     };
--- a/bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotdatabuf.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotdatabuf.h	Tue May 25 12:53:11 2010 +0300
@@ -43,7 +43,7 @@
 
     private:
 
-	    TBuf8<KMaxATSize> iBuf;
+	    TBuf8<KDefaultCmdBufLength> iBuf;
     };
 
 
--- a/bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotocol.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotocol.h	Tue May 25 12:53:11 2010 +0300
@@ -104,7 +104,7 @@
 
 		// From MATExtObserver
 			
-        void ATExtHandleCommandCompletedL(TInt aErr, const TDesC8& aReply);
+        void ATExtHandleReplyReceivedL(TInt aErr, const TDesC8& aReply);
         
         void UnsolicitedResultFromATExtL(TInt aErr, const TDesC8& aAT);
 
--- a/bluetoothengine/btmac/src/ATCodec/atccommand.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/src/ATCodec/atccommand.cpp	Tue May 25 12:53:11 2010 +0300
@@ -125,7 +125,7 @@
     
     if (version == KStreamVersion1)
         {
-        iText.CreateL(KMaxATSize);
+        iText.CreateL(KDefaultCmdBufLength);
         aStream >> iText;
         iId = static_cast<TATId>(aStream.ReadInt32L());
         iType = static_cast<TATType>(aStream.ReadInt32L());
@@ -491,7 +491,7 @@
 TInt CATResult::Parse(TATId aId, TATType aType, const RATParamArray* aParams)
     {
     TRACE_FUNC
-    TInt err = iText.Create(KMaxATSize);
+    TInt err = iText.Create(KDefaultCmdBufLength);
 
     if (err != KErrNone)
         {
@@ -541,14 +541,14 @@
                         {
                         return err;
                         }
-                    if (iText.Length() + (*aParams)[j].Des().Length() > KMaxATSize)
+                    if (iText.Length() + (*aParams)[j].Des().Length() > KDefaultCmdBufLength)
                         {
                         return KErrArgument;
                         }
                     iText.Append((*aParams)[j].Des());
                     if (j != aParams->Count() - 1)
                         {
-                        if (iText.Length() + comma.Length() > KMaxATSize)
+                        if (iText.Length() + comma.Length() > KDefaultCmdBufLength)
                             {
                             return KErrArgument;
                             }
@@ -565,11 +565,11 @@
     
 TInt CATResult::AddCRLF(TDes8& aText)
     {
-    if (aText.Length() + KCRLFSize > KMaxATSize)
+    if (aText.Length() + KCRLFSize > KDefaultCmdBufLength)
         {
         return KErrOverflow;
         }
-    TBuf8<KMaxATSize> buf(aText);
+    TBuf8<KDefaultCmdBufLength> buf(aText);
     aText.Format(KCRLFFormat, &buf);
     return KErrNone;
     }
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/HfpAtCmdhandler.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/HfpAtCmdhandler.cpp	Tue May 25 12:53:11 2010 +0300
@@ -63,7 +63,7 @@
         }
     iATExtClient.HandleCommand(iCommander->iStatus, 
             iCmdBuffer, iReplyBuffer, iRemainingReplyLengthPckg, iReplyTypePckg);
-    iCommander->GoActive();
+    iCommander->GoActive(); 
     }
 
 void CHFPAtCmdHandler::RequestCompletedL(CBtmcActive& aActive, TInt aErr)
@@ -74,32 +74,37 @@
         {
         case EHandleCommandRequest:
             {
-        	if(err == KErrNone)
-        		{
-        		if (iRemainingReplyLengthPckg())
-        		    {
-                    /*RBuf8 reply2;
-                    reply2.CreateL(iRemainingReplyLengthPckg() + iReplyBuffer.Length());
-                    err = iATExtClient.GetNextPartOfReply(reply2, iRemainingReplyLengthPckg);
-                    if (!err)
+            if(err == KErrNone)
+                {
+                if (iRemainingReplyLengthPckg())
+                    {
+                    TRACE_INFO((_L8("reply '%S'"), &iReplyBuffer))
+                    iObserver.ATExtHandleReplyReceivedL(err, iReplyBuffer);
+                    do 
                         {
-                        reply2.Insert(0, iReplyBuffer);
+                        TRACE_INFO((_L8("iRemainingReplyLength '%d'"), iRemainingReplyLengthPckg()))
+                        RBuf8 reply;
+                        reply.CreateL(iRemainingReplyLengthPckg());
+                        err = iATExtClient.GetNextPartOfReply(iRecvBuffer, iRemainingReplyLengthPckg());
+                        if (!err)
+                            {
+                            reply.Insert(0, iRecvBuffer);
+                            }
+                        TRACE_INFO((_L8("reply '%S'"), &reply))
+                        iObserver.ATExtHandleReplyReceivedL(err, reply);
+                        reply.Close();
                         }
-                    TRACE_INFO((_L8("reply '%S'"), &reply2))
-                    iObserver.ATExtHandleCommandCompletedL(err, reply2);
-                    reply2.Close();*/
-        		    iATExtClient.GetNextPartOfReply( iRecvBuffer,
-        		            iRemainingReplyLength );
-        		    }
-        		else
-        		    {
+                    while (iRemainingReplyLengthPckg());
+                    }
+                else
+                    {
                     TRACE_INFO((_L8("reply '%S'"), &iReplyBuffer))
-                    iObserver.ATExtHandleCommandCompletedL(err, iReplyBuffer);
-        		    }
-        		}
+                    iObserver.ATExtHandleReplyReceivedL(err, iReplyBuffer);
+                    }
+                }
             else
                 {
-                iObserver.ATExtHandleCommandCompletedL(err, iSystemReply);
+                iObserver.ATExtHandleReplyReceivedL(err, iSystemReply);
                 }
             break;
             }
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmccallinghandler.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmccallinghandler.cpp	Tue May 25 12:53:11 2010 +0300
@@ -94,7 +94,7 @@
             TInt result = KErrNone;
             if (!aErr)
                 {
-                TBuf8<KMaxATSize> buf;
+                TBuf8<KDefaultCmdBufLength> buf;
                 aErr = iRespProperty.Get(buf);
                 if (!aErr && buf.Length() >= sizeof(TInt))
                     {
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcoperator.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcoperator.cpp	Tue May 25 12:53:11 2010 +0300
@@ -92,7 +92,7 @@
         LEAVE_IF_ERROR(params.Append(TATParam(0)));
         TBuf8<KMaxOperatorNameLength> buf8;
         buf8.Copy(iInfo.iName); //  Unicode convert:		
-		TBuf16<KMaxOperatorNameLength> buf16;
+        TBuf16<KMaxOperatorNameLength> buf16;
         TBuf8<KMaxOperatorNameLength> buf8Copy;        
         LEAVE_IF_ERROR(CnvUtfConverter::ConvertToUnicodeFromUtf8(buf16,buf8));
         buf8Copy.Copy(buf16);
--- a/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp	Tue May 25 12:53:11 2010 +0300
@@ -399,7 +399,7 @@
         {
         return;
         }
-    TBuf8<KMaxATSize> cmddes;
+    TBuf8<KDefaultCmdBufLength> cmddes;
     if (iInDataBuf.NextCommand(cmddes))
         {
         return;
@@ -410,7 +410,7 @@
         }
     TRACE_INFO_SEG(
         {
-        TBuf8<KMaxATSize> buf;
+        TBuf8<KDefaultCmdBufLength> buf;
         buf = cmddes;
         buf.Trim();
         Trace(_L8("[HFP] [I] %S"), &buf);
@@ -1083,7 +1083,7 @@
     for (TInt i = 0; iCredit >0 && i < count; i++)
         {
         iCredit--;
-        TBuf8<KMaxATSize> buf;
+        TBuf8<KDefaultCmdBufLength> buf;
         buf.Copy(iOutgoPacketQueue->MdcaPoint(0));
         iObserver.SendProtocolDataL(buf);
         iOutgoPacketQueue->Delete(0);
@@ -1199,7 +1199,7 @@
   		}
     }
 
-void CBtmcProtocol::ATExtHandleCommandCompletedL(TInt aErr, const TDesC8& aReply)
+void CBtmcProtocol::ATExtHandleReplyReceivedL(TInt aErr, const TDesC8& aReply)
 		{
 		TRACE_FUNC
 		if(aErr)
--- a/bluetoothengine/btsac/btrcc/inc/btrccAbsoluteVolumeLevelController.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/inc/btrccAbsoluteVolumeLevelController.h	Tue May 25 12:53:11 2010 +0300
@@ -87,7 +87,7 @@
 
         void AdjustRemoteVolume(TInt aVolume); 
         
-        TInt GetPhoneVolume(TInt &aVol);
+        TInt RoundRemoteVolume(TInt aPrevPhVol);        
 
 	public: // New methods
 
@@ -121,6 +121,8 @@
 		TUint iNumRemotes; // not used, but needed for the remote controlling API.
 		
 		TInt iRetryCounter;
+		
+        TInt iStep;
     };
 
 #endif      // BTRCCABSOLUTEVOLUMELEVELCONTROLLER_H
--- a/bluetoothengine/btsac/btrcc/inc/btrccLegacyVolumeLevelController.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/inc/btrccLegacyVolumeLevelController.h	Tue May 25 12:53:11 2010 +0300
@@ -97,7 +97,7 @@
     
 	private: // From CBTRCCVolumeLevelControllerBase
         void AdjustRemoteVolume(TInt aVolume); 
-        TInt GetPhoneVolume(TInt &aVol);
+        void ScalePhoneVolume(TInt& aVolume);
 
     private:  // From MRemConCoreApiControllerObserver
 		TInt MrccacoResponse(); 
--- a/bluetoothengine/btsac/btrcc/inc/btrccLinker.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/inc/btrccLinker.h	Tue May 25 12:53:11 2010 +0300
@@ -319,6 +319,7 @@
         
         CBTRCCVolumeLevelControllerBase* iVolController;
         CBTRCCVolumeLevelControllerBase* iAbsoluteVolController;
+        CBTRCCVolumeLevelControllerBase* iLegacyVolController;
         
         TInt iRegisterVolumeChangeNotificationCounter;//Counter for re-register for remote volume control notification
 };
--- a/bluetoothengine/btsac/btrcc/inc/btrccVolumeLevelControllerBase.h	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/inc/btrccVolumeLevelControllerBase.h	Tue May 25 12:53:11 2010 +0300
@@ -92,6 +92,8 @@
         TInt GetLocalMaxVolume();  
         
         TInt GetCurrentLocalVolume();
+        
+        TInt GetCurrentRemoteVolume();
 
         void AccessoryChangedVolume(TInt aVolumeInPhoneScale);  
 
@@ -106,18 +108,18 @@
         virtual void RegisterVolumeChangeNotification(); 
         
     private:
-        void SetPhoneVolume();
+        void SetPhoneVolume(TInt aRemoteVol);
+        TInt GetPhoneVolume(TInt &aVol);
         
     private: // New methods
 
         /**
         * To be implemented by the specialization class. 
         */
-        virtual void AdjustRemoteVolume(TInt aVolume) = 0; 
-    
-    protected:    
-        virtual TInt GetPhoneVolume(TInt &aVol);
-
+        virtual void AdjustRemoteVolume(TInt aVolume) = 0;
+        virtual TInt RoundRemoteVolume(TInt aPrevPhVol);
+        virtual void ScalePhoneVolume(TInt& aVolume);
+        
     private:    // Data
         RProperty iVolLevelProperty; // owned
         RProperty iVolKeyEventProperty; // owned
--- a/bluetoothengine/btsac/btrcc/src/btrccAbsoluteVolumeLevelController.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccAbsoluteVolumeLevelController.cpp	Tue May 25 12:53:11 2010 +0300
@@ -28,6 +28,7 @@
 
 const TInt KAbsoluteVolumeLevelSetServiceId = 0x02; 
 const TInt KMaxRetries = 3;
+const TInt KDefaultStep = 1000;
 
 // MODULE DATA STRUCTURES
 
@@ -53,7 +54,7 @@
 // -----------------------------------------------------------------------------
 //
 CBTRCCAbsoluteVolumeLevelController::CBTRCCAbsoluteVolumeLevelController(MBTRCCVolumeControllerObserver& aObserver)
-: CBTRCCVolumeLevelControllerBase(aObserver)
+: CBTRCCVolumeLevelControllerBase(aObserver), iStep(KDefaultStep)
 	{
 	}
 
@@ -153,13 +154,48 @@
     }
 
 // -----------------------------------------------------------------------------
-// CBTRCCAbsoluteVolumeLevelController::GetPhoneVolume
+// CBTRCCAbsoluteVolumeLevelController::RoundRemoteVolume
 // -----------------------------------------------------------------------------
 //
-TInt CBTRCCAbsoluteVolumeLevelController::GetPhoneVolume(TInt &aVol)
+TInt CBTRCCAbsoluteVolumeLevelController::RoundRemoteVolume(TInt aPrevPhVol)
     {
     TRACE_FUNC
-    return CBTRCCVolumeLevelControllerBase::GetPhoneVolume(aVol);
+    TInt phoneVol = GetCurrentLocalVolume();
+    TInt remoteVol = GetCurrentRemoteVolume();
+    TRACE_INFO((_L("Volume to be rounded %d"), remoteVol))
+    // Update step
+    if( phoneVol != -1 && aPrevPhVol != -1 )
+        {
+        TInt step = Abs( phoneVol - aPrevPhVol );
+        if( step )
+            {
+            TRACE_INFO((_L("Step %d"), step))
+            // Only update step value if it is not equal to zero
+            iStep = step;
+            }
+        }    
+    if( remoteVol >= 0 && remoteVol <= iLocalMaxVolume )
+        {        
+        TInt lowLimit = 0;
+        TInt highLimit = 0;
+        
+        for( TInt i = 0 ; highLimit < iLocalMaxVolume ; i++ )
+            {
+            lowLimit = i*iStep;
+            highLimit = (i+1)*iStep;
+            // Find the correct low and high value pair in which volume
+            // belongs.
+            if( remoteVol >= lowLimit && remoteVol <= highLimit )
+                {
+                break;
+                }
+            }
+        TInt diff1 = Abs( remoteVol - lowLimit );
+        TInt diff2 = Abs( remoteVol - highLimit );
+        remoteVol = diff1 <= diff2 ? lowLimit : highLimit;
+        }
+    TRACE_INFO((_L("Rounded volume %d"), remoteVol))
+    return remoteVol;
     }
 
 // -----------------------------------------------------------------------------
--- a/bluetoothengine/btsac/btrcc/src/btrccLegacyVolumeLevelController.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccLegacyVolumeLevelController.cpp	Tue May 25 12:53:11 2010 +0300
@@ -247,23 +247,21 @@
     }
 
 // -----------------------------------------------------------------------------
-// CBTRCCLegacyVolumeLevelController::GetPhoneVolume
+// CBTRCCLegacyVolumeLevelController::ScalePhoneVolume
 // -----------------------------------------------------------------------------
 //
-TInt CBTRCCLegacyVolumeLevelController::GetPhoneVolume(TInt &aVol)
+void CBTRCCLegacyVolumeLevelController::ScalePhoneVolume(TInt &aVolume)
     {
-    TRACE_FUNC
-    TInt err = CBTRCCVolumeLevelControllerBase::GetPhoneVolume(aVol); 
-        
+    TRACE_FUNC        
     // Converts volume level scale used in DevSound Audio (0 - 10000) into 0 - KVolumeScaleMax.
-    if( aVol <= 0 )
+    if( aVolume <= 0 )
         {
         // 0 level and -1 (no stream) don't need adjustment. 
-        return err;
+        return;
         }
     
     TReal tgt;
-    TReal src(aVol);    
+    TReal src(aVolume);    
     TReal maxScale(KVolumeScaleMax);    
     TReal maxDevSound(iLocalMaxVolume);
     TReal scale = maxScale/maxDevSound;
@@ -275,9 +273,8 @@
         // values have to be upgraded to level 1.
         tgt = 1;
         }
-    TRACE_INFO((_L("Volume scaled: original %d, scaled %d"), aVol, TInt(tgt)))
-    aVol = TInt(tgt);
-    return err;
+    TRACE_INFO((_L("Volume scaled: original %d, scaled %d"), aVolume, TInt(tgt)))
+    aVolume = TInt(tgt);
     }
 
 // -----------------------------------------------------------------------------
--- a/bluetoothengine/btsac/btrcc/src/btrccLinker.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccLinker.cpp	Tue May 25 12:53:11 2010 +0300
@@ -25,6 +25,7 @@
 #include <apacmdln.h>
 #include <apgcli.h>
 #include "btaudioremconpskeys.h"
+#include "btrccLegacyVolumeLevelController.h"
 #include "btrccAbsoluteVolumeLevelController.h"
 #include "btrccLinker.h"
 #include "btrccplayerstarter.h"
@@ -86,6 +87,14 @@
     if (iAccObserver.IsAvrcpVolCTSupported())
         {
         iAbsoluteVolController = CBTRCCAbsoluteVolumeLevelController::NewL(*iInterfaceSelector, *this);
+        TRACE_INFO((_L("CBTRCCLinker::ConstructL, absolute volume controller created.")))
+
+        // If also legacy is configured into use, prepare to use it with legacy devices. 
+        if(iAccObserver.IsAvrcpLegacyVolCTSupported())
+            {
+            iLegacyVolController = CBTRCCLegacyVolumeLevelController::NewL(*iInterfaceSelector, *this);
+            TRACE_INFO((_L("CBTRCCLinker::ConstructL, legacy volume controller created.")))
+        	}
         }
     else 
    		{
@@ -125,6 +134,7 @@
         User::RequestComplete(iClientRequest, KErrAbort);
 	
     delete iAbsoluteVolController;
+    delete iLegacyVolController;
 	delete iPlayerStarter;
 	Cancel();
     iStateArray.ResetAndDestroy();
@@ -432,7 +442,7 @@
     if (iAccObserver.IsAvrcpVolCTSupported())
         {
         // Choose based on SDP result whether to create 
-        // absolute controller or not.
+        // absolute controller or legacy controller.
         if(!iVolController)
             {
             if (iAccObserver.IsAbsoluteVolumeSupported(iRemoteAddr))
@@ -440,10 +450,10 @@
                 iVolController = iAbsoluteVolController;
                 TRACE_INFO(_L("Absolute volume supported, taking it into use."))
                 }
-            else 
-            	{
-                TRACE_INFO(_L("No absolute volume supported, so no volume control."))
-            	}
+           	else 
+                {
+                iVolController = iLegacyVolController; // iLegacyVolController may be NULL, depends on the configuration. 
+                }
             }
         }
     if (iVolController)
--- a/bluetoothengine/btsac/btrcc/src/btrccVolumeLevelControllerBase.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/bluetoothengine/btsac/btrcc/src/btrccVolumeLevelControllerBase.cpp	Tue May 25 12:53:11 2010 +0300
@@ -82,6 +82,7 @@
     iBtrccActive->GoActive(); 
 
     (void) GetPhoneVolume(iPhoneVolume);
+    ScalePhoneVolume(iPhoneVolume);
     if( iPhoneVolume > -1)
         {
         DoStart( iPhoneVolume );
@@ -152,10 +153,13 @@
     iRemoteVolume = aVolumeInPhoneScale;
     TInt vol;
     TInt err = GetPhoneVolume(vol);
+    ScalePhoneVolume(iPhoneVolume);
     if(!err)
         {
+        TInt prevPhVol = iPhoneVolume;
         iPhoneVolume = vol;
-        SetPhoneVolume();
+        TInt remoteVol = RoundRemoteVolume(prevPhVol);
+        SetPhoneVolume(remoteVol);
         }
     }
 
@@ -163,24 +167,18 @@
 // CBTRCCVolumeLevelControllerBase::SetPhoneVolume
 // -----------------------------------------------------------------------------
 //
-void CBTRCCVolumeLevelControllerBase::SetPhoneVolume()
+void CBTRCCVolumeLevelControllerBase::SetPhoneVolume(TInt aRemoteVol)
     {
     TRACE_FUNC
-    TRACE_INFO((_L("iRemoteVolume = %d, iPhoneVolume = %d"), iRemoteVolume, iPhoneVolume))
-    if (iRemoteVolume != iPhoneVolume)
+    TRACE_INFO((_L("Remote Volume = %d, iPhoneVolume = %d"), aRemoteVol, iPhoneVolume))
+    TInt err( KErrNotFound );
+    if (aRemoteVol != iPhoneVolume)
         {
-        TInt event = (iRemoteVolume > iPhoneVolume) ? KPSVolumeUpClicked : KPSVolumeDownClicked;
-        TInt err = iVolKeyEventProperty.Set(event);
-        if (err)
-            {
-            TRACE_ERROR((_L("Set KMediaKeysVolumeKeyEvent err %d"), err));
-            }
-        iState = ESetPhoneVolume;
+        TInt event = (aRemoteVol > iPhoneVolume) ? KPSVolumeUpClicked : KPSVolumeDownClicked;
+        err = iVolKeyEventProperty.Set(event);
+        TRACE_INFO((_L("Set KMediaKeysVolumeKeyEvent click %d err %d"), event, err));
         }    
-    else
-        {
-        iState = ESubscribePhoneVolume;
-        } 
+    iState = err ? ESubscribePhoneVolume : ESetPhoneVolume;
     }
 
 // -----------------------------------------------------------------------------
@@ -205,6 +203,36 @@
     }
 
 // -----------------------------------------------------------------------------
+// CBTRCCVolumeLevelControllerBase::GetCurrentRemoteVolume
+// -----------------------------------------------------------------------------
+//
+TInt CBTRCCVolumeLevelControllerBase::GetCurrentRemoteVolume()
+    {
+    return iRemoteVolume;
+    }
+
+// -----------------------------------------------------------------------------
+// CBTRCCVolumeLevelControllerBase::RoundRemoteVolume
+// -----------------------------------------------------------------------------
+//
+TInt CBTRCCVolumeLevelControllerBase::RoundRemoteVolume(TInt /*aPrevPhVol*/)
+    {
+    TRACE_FUNC
+    // default implementation
+    return iRemoteVolume;
+    }
+
+// -----------------------------------------------------------------------------
+// CBTRCCVolumeLevelControllerBase::ScalePhoneVolume
+// -----------------------------------------------------------------------------
+//
+void CBTRCCVolumeLevelControllerBase::ScalePhoneVolume(TInt& /*aVolume*/)
+    {
+    TRACE_FUNC
+    // default implementation
+    }
+
+// -----------------------------------------------------------------------------
 // CBTRCCVolumeLevelControllerBase::RequestCompletedL
 // -----------------------------------------------------------------------------
 //
@@ -213,7 +241,9 @@
     TRACE_FUNC
     if(aActive.ServiceId() == KVolumeChangeListenerServiceId)
         {
+        TInt prevPhVol = iPhoneVolume;
         TInt err = GetPhoneVolume(iPhoneVolume);
+        ScalePhoneVolume(iPhoneVolume);
                 
         if(!err && !aErr && iPhoneVolume > -1)
             {
@@ -224,7 +254,8 @@
                     AdjustRemoteVolume(iPhoneVolume); 
                     break;
                 case ESetPhoneVolume:
-                    SetPhoneVolume();
+                    TInt remoteVol = RoundRemoteVolume(prevPhVol);
+                    SetPhoneVolume(remoteVol);
                     break;
                 }
             }
--- a/btservices_plat/bluetooth_local_variation_api/inc/btengdomaincrkeys.h	Tue May 11 16:23:08 2010 +0300
+++ b/btservices_plat/bluetooth_local_variation_api/inc/btengdomaincrkeys.h	Tue May 25 12:53:11 2010 +0300
@@ -137,7 +137,7 @@
  * Indicates if supports remote volume control over AVRCP Controller.
  *
  * Possible integer values:
- * 0  supported
+ * 0  not supported
  * 1  supported
  *
  * Default value: 1
@@ -151,14 +151,29 @@
     EBTAvrcpVolCTSupported
     };
     
+/**
+ * CenRep key for storing Bluetooth feature settings.
+ * Indicates if supports legacy remote volume control over AVRCP Controller.
+ *
+ * Possible integer values:
+ * 0  not supported
+ * 1  supported
+ *
+ * Default value: 0
+ */
+const TUint32 KBTAvrcpLegacyVolCTLV = 0x00000008;
+
+/**  Enumeration for remote volume control AVRCP Controller support */
+enum TBTAvrcpLegacyVolCTSupported
+    {
+    EBTAvrcpLegacyVolCTNotSupported = 0,
+    EBTAvrcpLegacyVolCTSupported
+    };
     
 /**
  * CenRep key for default folder for file receiving.
  * Indicates where receving files will be saved.
  
- * Possible integer values:
- * 0  supported
- * 1  supported
  *
  * Default value: Received files\\
  */
--- a/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp	Tue May 25 12:53:11 2010 +0300
@@ -28,7 +28,7 @@
 #include "atmisccmdpluginconsts.h"
 #include "debug.h"
 
-#include <EXTERROR.H>           // Additional RMobilePhone error code
+#include <exterror.h>           // Additional RMobilePhone error code
 
 
 // +CME error code
--- a/cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp	Tue May 11 16:23:08 2010 +0300
+++ b/cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp	Tue May 25 12:53:11 2010 +0300
@@ -18,7 +18,7 @@
 #include "cpincommandhandler.h"
 
 #include <mmretrieve.h>         // define AO wrapper
-#include <EXTERROR.H>           // Additional RMobilePhone error code
+#include <exterror.h>           // Additional RMobilePhone error code
 
 #include "debug.h"