# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1274781191 -10800 # Node ID 53b7818cd282e040a5a1fdf2d99abd18c0da92b0 # Parent 2f88a7d66f50de7d49a216c710f382af901fd5ee Revision: 200919 Kit: 2010121 diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.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(); } diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btaudioman/expinc/BTAccObserver.h --- 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; /** diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btaudioman/inc/basrvaccman.h --- 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; }; diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btaudioman/src/basrvaccman.cpp --- 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) { diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/bteng/conf/bteng.confml Binary file bluetoothengine/bteng/conf/bteng.confml has changed diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/bteng/conf/bteng_10204DAB.crml Binary file bluetoothengine/bteng/conf/bteng_10204DAB.crml has changed diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/bthid/bthidkbdsettings/inc/bthidsettinglist.h --- 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); diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/common/atcodec.h --- 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 +#include enum TATId { @@ -88,7 +89,6 @@ EATIntParam }; -const TInt KMaxATSize = 512; const TInt KMaxATParamSize = 256; class RReadStream; diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/inc/btmonobearer/bmbcmdlistener.h --- 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 iAtCmdBuf; + TBuf8 iAtCmdBuf; }; #endif diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/inc/btmonobearer/bmbplugin.h --- 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 iInData; + TBuf8 iInData; TUid iInterfaceUid; TUint iTransactionId; TUint iOperationId; diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/inc/btmonocmdhandler/HfpAtCmdHandler.h --- 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; }; diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotdatabuf.h --- 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 iBuf; + TBuf8 iBuf; }; diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/inc/btmonocmdhandler/btmcprotocol.h --- 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); diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/src/ATCodec/atccommand.cpp --- 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(aStream.ReadInt32L()); iType = static_cast(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 buf(aText); + TBuf8 buf(aText); aText.Format(KCRLFFormat, &buf); return KErrNone; } diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/src/BTMonoCmdHandler/HfpAtCmdhandler.cpp --- 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; } diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/src/BTMonoCmdHandler/btmccallinghandler.cpp --- 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 buf; + TBuf8 buf; aErr = iRespProperty.Get(buf); if (!aErr && buf.Length() >= sizeof(TInt)) { diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/src/BTMonoCmdHandler/btmcoperator.cpp --- 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 buf8; buf8.Copy(iInfo.iName); // Unicode convert: - TBuf16 buf16; + TBuf16 buf16; TBuf8 buf8Copy; LEAVE_IF_ERROR(CnvUtfConverter::ConvertToUnicodeFromUtf8(buf16,buf8)); buf8Copy.Copy(buf16); diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp --- 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 cmddes; + TBuf8 cmddes; if (iInDataBuf.NextCommand(cmddes)) { return; @@ -410,7 +410,7 @@ } TRACE_INFO_SEG( { - TBuf8 buf; + TBuf8 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 buf; + TBuf8 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) diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btsac/btrcc/inc/btrccAbsoluteVolumeLevelController.h --- 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 diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btsac/btrcc/inc/btrccLegacyVolumeLevelController.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(); diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btsac/btrcc/inc/btrccLinker.h --- 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 }; diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btsac/btrcc/inc/btrccVolumeLevelControllerBase.h --- 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 diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btsac/btrcc/src/btrccAbsoluteVolumeLevelController.cpp --- 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; } // ----------------------------------------------------------------------------- diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btsac/btrcc/src/btrccLegacyVolumeLevelController.cpp --- 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); } // ----------------------------------------------------------------------------- diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btsac/btrcc/src/btrccLinker.cpp --- 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 #include #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) diff -r 2f88a7d66f50 -r 53b7818cd282 bluetoothengine/btsac/btrcc/src/btrccVolumeLevelControllerBase.cpp --- 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; } } diff -r 2f88a7d66f50 -r 53b7818cd282 btservices_plat/bluetooth_local_variation_api/inc/btengdomaincrkeys.h --- 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\\ */ diff -r 2f88a7d66f50 -r 53b7818cd282 cbsatplugin/atmisccmdplugin/src/atmisccmdplugin.cpp --- 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 // Additional RMobilePhone error code +#include // Additional RMobilePhone error code // +CME error code diff -r 2f88a7d66f50 -r 53b7818cd282 cbsatplugin/atmisccmdplugin/src/cpincommandhandler.cpp --- 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 // define AO wrapper -#include // Additional RMobilePhone error code +#include // Additional RMobilePhone error code #include "debug.h"