# HG changeset patch # User hgs # Date 1287490174 -10800 # Node ID f5508c13dfe054c322c16abaf1d4164a84891fc4 # Parent 16e4b90079601ebd6d7dbdc076d3b6c2bfde895f 201041 diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/bwins/remconabsolutevolumeu.def --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/bwins/remconabsolutevolumeu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -EXPORTS - ?SetAbsoluteVolume@CRemConAbsoluteVolumeController@@QAEXAAVTRequestStatus@@KAAI@Z @ 1 NONAME ; void CRemConAbsoluteVolumeController::SetAbsoluteVolume(class TRequestStatus &, unsigned long, unsigned int &) - ?RegisterAbsoluteVolumeNotification@CRemConAbsoluteVolumeController@@QAEXXZ @ 2 NONAME ; void CRemConAbsoluteVolumeController::RegisterAbsoluteVolumeNotification(void) - ?NewL@CRemConAbsoluteVolumeTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConAbsoluteVolumeTargetObserver@@KK@Z @ 3 NONAME ; class CRemConAbsoluteVolumeTarget * CRemConAbsoluteVolumeTarget::NewL(class CRemConInterfaceSelector &, class MRemConAbsoluteVolumeTargetObserver &, unsigned long, unsigned long) - ??1CRemConAbsoluteVolumeTarget@@UAE@XZ @ 4 NONAME ; CRemConAbsoluteVolumeTarget::~CRemConAbsoluteVolumeTarget(void) - ?WriteL@RRemConAbsoluteVolumeResponse@@UAEXAAVTDes8@@@Z @ 5 NONAME ; void RRemConAbsoluteVolumeResponse::WriteL(class TDes8 &) - ?AbsoluteVolumeChanged@CRemConAbsoluteVolumeTarget@@QAEXK@Z @ 6 NONAME ; void CRemConAbsoluteVolumeTarget::AbsoluteVolumeChanged(unsigned long) - ?SetAbsoluteVolumeResponse@CRemConAbsoluteVolumeTarget@@QAEXKH@Z @ 7 NONAME ; void CRemConAbsoluteVolumeTarget::SetAbsoluteVolumeResponse(unsigned long, int) - ?ReadL@RRemConAbsoluteVolumeRequest@@UAEXABVTDesC8@@@Z @ 8 NONAME ; void RRemConAbsoluteVolumeRequest::ReadL(class TDesC8 const &) - ?WriteL@RRemConAbsoluteVolumeRequest@@UAEXAAVTDes8@@@Z @ 9 NONAME ; void RRemConAbsoluteVolumeRequest::WriteL(class TDes8 &) - ?ReadL@RRemConAbsoluteVolumeResponse@@UAEXABVTDesC8@@@Z @ 10 NONAME ; void RRemConAbsoluteVolumeResponse::ReadL(class TDesC8 const &) - ??1CRemConAbsoluteVolumeController@@UAE@XZ @ 11 NONAME ; CRemConAbsoluteVolumeController::~CRemConAbsoluteVolumeController(void) - ?CancelAbsoluteVolumeNotification@CRemConAbsoluteVolumeController@@QAEXXZ @ 12 NONAME ; void CRemConAbsoluteVolumeController::CancelAbsoluteVolumeNotification(void) - ?Close@RRemConAbsoluteVolume@@QAEXXZ @ 13 NONAME ; void RRemConAbsoluteVolume::Close(void) - ?NewL@CRemConAbsoluteVolumeController@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConAbsoluteVolumeControllerObserver@@K@Z @ 14 NONAME ; class CRemConAbsoluteVolumeController * CRemConAbsoluteVolumeController::NewL(class CRemConInterfaceSelector &, class MRemConAbsoluteVolumeControllerObserver &, unsigned long) - ?CancelSetAbsoluteVolume@CRemConAbsoluteVolumeController@@QAEXXZ @ 15 NONAME ; void CRemConAbsoluteVolumeController::CancelSetAbsoluteVolume(void) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/eabi/remconabsolutevolumeu.def --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/eabi/remconabsolutevolumeu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -EXPORTS - _ZN21RRemConAbsoluteVolume5CloseEv @ 1 NONAME - _ZN27CRemConAbsoluteVolumeTarget21AbsoluteVolumeChangedEm @ 2 NONAME - _ZN27CRemConAbsoluteVolumeTarget25SetAbsoluteVolumeResponseEmi @ 3 NONAME - _ZN27CRemConAbsoluteVolumeTarget4NewLER24CRemConInterfaceSelectorR35MRemConAbsoluteVolumeTargetObservermm @ 4 NONAME - _ZN27CRemConAbsoluteVolumeTargetD0Ev @ 5 NONAME - _ZN27CRemConAbsoluteVolumeTargetD1Ev @ 6 NONAME - _ZN27CRemConAbsoluteVolumeTargetD2Ev @ 7 NONAME - _ZN28RRemConAbsoluteVolumeRequest5ReadLERK6TDesC8 @ 8 NONAME - _ZN28RRemConAbsoluteVolumeRequest6WriteLER5TDes8 @ 9 NONAME - _ZN29RRemConAbsoluteVolumeResponse5ReadLERK6TDesC8 @ 10 NONAME - _ZN29RRemConAbsoluteVolumeResponse6WriteLER5TDes8 @ 11 NONAME - _ZN31CRemConAbsoluteVolumeController17SetAbsoluteVolumeER14TRequestStatusmRj @ 12 NONAME - _ZN31CRemConAbsoluteVolumeController32CancelAbsoluteVolumeNotificationEv @ 13 NONAME - _ZN31CRemConAbsoluteVolumeController34RegisterAbsoluteVolumeNotificationEv @ 14 NONAME - _ZN31CRemConAbsoluteVolumeController4NewLER24CRemConInterfaceSelectorR39MRemConAbsoluteVolumeControllerObserverm @ 15 NONAME - _ZN31CRemConAbsoluteVolumeControllerD0Ev @ 16 NONAME - _ZN31CRemConAbsoluteVolumeControllerD1Ev @ 17 NONAME - _ZN31CRemConAbsoluteVolumeControllerD2Ev @ 18 NONAME - _ZTI28RRemConAbsoluteVolumeRequest @ 19 NONAME - _ZTI29RRemConAbsoluteVolumeResponse @ 20 NONAME - _ZTV28RRemConAbsoluteVolumeRequest @ 21 NONAME - _ZTV29RRemConAbsoluteVolumeResponse @ 22 NONAME - _ZN31CRemConAbsoluteVolumeController23CancelSetAbsoluteVolumeEv @ 23 NONAME - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/group/absolutevolumeapi.mmp --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/group/absolutevolumeapi.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -// Copyright (c) 2004-2009 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: -// absolutevolumeapicontroller.dll Remote Control Absolute Volume API- an outer-layer client -// side library. -// - - - -/** - @file - @internalComponent -*/ - -TARGET remconabsolutevolume.dll -TARGETPATH /system/libs - -// We need all these caps because we don't know anything about the process -// we'll be running in. -CAPABILITY All -Tcb -TARGETTYPE dll - -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x101f9067 -VENDORID 0x70000001 - -SOURCEPATH ../src -SOURCE absolutevolumeapicontroller.cpp -SOURCE absolutevolumeapitarget.cpp -SOURCE absolutevolumesender.cpp -SOURCE absolutevolumeutils.cpp - -MW_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE ../inc - -LIBRARY euser.lib -LIBRARY remconinterfacebase.lib -LIBRARY avrcpipc.lib -LIBRARY estor.lib - -#include - -UNPAGED - -SMPSAFE - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - - - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -absolutevolumeapi.mmp - -PRJ_EXPORTS -../public/absolutevolumeapicontroller.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapicontroller.h) -../public/absolutevolumeapicontrollerobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapicontrollerobserver.h) -../public/absolutevolumeapitarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapitarget.h) -../public/absolutevolumeapitargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapitargetobserver.h) -../public/absolutevolumeutils.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(absolutevolumeutils.h) -../public/absolutevolumeapi.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(absolutevolumeapi.h) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/inc/absolutevolumesender.h --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/inc/absolutevolumesender.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#ifndef ABSOLUTEVOLUMESENDER_H -#define ABSOLUTEVOLUMESENDER_H - -#include -#include -#include - -/** -@file -@internalComponent -@released -*/ - -NONSHARABLE_CLASS(CAbsVolSender) : public CActive - { -public: - static CAbsVolSender* NewL(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver); - ~CAbsVolSender(); - - void SendNotify(const TDesC8& aData); - void SendSetAbsoluteVolume(TUint& aNumRemotes, const TDesC8& aData); - -private: - void RunL(); - void DoCancel(); - - CAbsVolSender(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver); - -private: - CRemConInterfaceSelector& iIfSel; - MAbsVolSenderObserver& iObserver; - TBool iSendingNotify; - }; - -#endif // ABSOLUTEVOLUMESENDER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapi.h --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapi.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef ABSOLUTEVOLUMEAPI_H_ -#define ABSOLUTEVOLUMEAPI_H_ - -#include - -const TInt KRemConAbsoluteVolumeControllerApiUid = 0x1020831E; -const TInt KRemConAbsoluteVolumeTargetApiUid = 0x10215bbd; - -const TInt KErrAbsoluteVolumeInternalError = -6537; - -/** -Error code(4 bytes) + The relative volume(4 bytes) + -The maximum volume against which volume is relative(4 bytes) -*/ -const TUint KAbsoluteVolumeResponseDataSize = 12; - -/** Operation Id of set absolute volume */ -const TUint KRemConSetAbsoluteVolume = 0x1050; -/** Operation Id of register volume change notification */ -const TUint KRemConAbsoluteVolumeNotification = 0x0d31; - -/** -The relative volume to be set(4 bytes) + -The maximum volume against which volume is relative(4 bytes) + -Reserved(4 bytes) -*/ -const TInt KAbsoluteVolumeRequestDataSize = 12; - -/** -The absolute volume is represented in one octet. The top bit(bit 7) -is reserved for future use. -*/ -const TUint8 KAbsoluteVolumeMask = 0x7f; - -/** PDU length of set absolute volume response */ -const TUint8 KLengthSetAbsoluteVolumeResponse = 11; -/** PDU length of notify volume change response */ -const TUint8 KLengthNotifyVolumeChangeResponse = 12; - -/** Absolute Volume(1 byte) */ -const TUint8 KLengthSetAbsoluteVolumeRequestParameter = 1; -/** Event ID(1 byte) + Reserved(4 bytes) */ -const TUint8 KLengthNotifyVolumeChangeRequestParameter = 5; - -/** Absolute Volume(1 byte) */ -const TUint8 KLengthSetAbsoluteVolumeResponseParamter = 1; -/** Event ID(1 byte) + Absolute Volume(1 byte) */ -const TUint8 KLengthNotifyVolumeChangeResponseParameter = 2; - -#endif /*ABSOLUTEVOLUMEAPI_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapicontroller.h --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapicontroller.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONABSOLUTEVOLUMEAPICONTROLLER_H_ -#define REMCONABSOLUTEVOLUMEAPICONTROLLER_H_ - -#include -#include -#include - -_LIT(KAbsoluteVolumeControllerPanicName, "AbsoluteVolumeController"); -enum TAbsoluteVolumeControllerPanics - { - EControllerInvalidMaxVolume = 0, - EControllerVolumeBeyondMaxVolume = 1, - EAbsoluteVolumeNotificationAlreadyRegistered = 2, - EMultipleSetAbsoluteVolumes = 3, - EMultipleNotifies = 4, - }; - -class MRemConAbsoluteVolumeControllerObserver; -class CAbsVolSender; - -/** -@internalComponent -*/ -class MAbsVolSenderObserver - { -public: - virtual void MavsoSendComplete(TInt aResult) = 0; - }; - -/** -This class is used to set and observer the volume level on a remote device. - -An active scheduler is required in order to use this class. -*/ -NONSHARABLE_CLASS(CRemConAbsoluteVolumeController) -: public CRemConInterfaceBase, public MRemConInterfaceIf2, public MAbsVolSenderObserver - { -public: - IMPORT_C static CRemConAbsoluteVolumeController* NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConAbsoluteVolumeControllerObserver& aObserver, - TUint32 aMaxVolume); - - IMPORT_C ~CRemConAbsoluteVolumeController(); - -public: - IMPORT_C void SetAbsoluteVolume(TRequestStatus& aStatus, - TUint32 aVolume, - TUint& aNumRemotes); - IMPORT_C void CancelSetAbsoluteVolume(); - - IMPORT_C void RegisterAbsoluteVolumeNotification(); - IMPORT_C void CancelAbsoluteVolumeNotification(); - -private: - CRemConAbsoluteVolumeController( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConAbsoluteVolumeControllerObserver& aObserver, - TUint32 aMaxVolume); - void ConstructL(); - -private: // Utility functions - void HandleNotify(const TDesC8& aData, - TRemConMessageSubType aMessageSubType); - - void HandleSetAbsoluteVolumeResponse( const TDesC8& aData ); - static TInt AsyncErrorCallBack(TAny* aObserver); - void KickOffSendIfNeeded(); - void SetAbsoluteVolumeSendComplete(TInt aResult); - void RegisterNotifySendComplete(); - void SendSetAbsoluteVolume(); - void SendNotify(); - - void VolumeUpdate(TUint32 aVolume, TUint32 aMaxVolume); - -private: // From CRemConInterfaceBase - TAny* GetInterfaceIf(TUid aUid); - -private: // From MRemConInterfaceIf2 - void MrcibNewMessage(TUint aOperationId, - const TDesC8& aData, - TRemConMessageSubType - aMessageSubType); - -private: // From MAbsVolSenderObserver - void MavsoSendComplete(TInt aResult); - -private: // Unowned - MRemConAbsoluteVolumeControllerObserver& iObserver; - -private: // Owned - // For operation-specific data. - TBuf8 iNotifyData; - TBuf8 iSetData; - - // Records the current absolute volume value. - TUint32 iCurrentVolume; - TUint32 iCurrentMaxVolume; - - // Used when sending SetAbsoluteVolume commands - TUint32 iClientMaxVolume; - - CAbsVolSender* iAbsVolSender; - - TBool iNotificationRequested; - - // Only used for abs vol sends. - TRequestStatus* iClientStatus; - TUint* iClientNumRemotes; - - enum TRequestState - { - // There is no request outstanding - ENotInUse = 0, - // We're currently sending this request. - ESending, - // This request is waiting to be sent (possibly because we were busy sending a previous request when this one arose). - EPending, - }; - // The two requests we support. - TRequestState iAbsVolRequest; - TRequestState iNotifyRequest; - }; - -#endif /*REMCONABSOLUTEVOLUMEAPICONTROLLER_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapicontrollerobserver.h --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapicontrollerobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - - -#ifndef REMCONABSOLUTEVOLUMEAPICONTROLLEROBSERVER_H_ -#define REMCONABSOLUTEVOLUMEAPICONTROLLEROBSERVER_H_ - -#include - -/** -Clients must implement this interface in order to instantiate objects of type -CRemConAbsoluteVolumeController. This interface passes incoming responses -from RemCon to the client. -*/ -class MRemConAbsoluteVolumeControllerObserver - { -public: - /** - The current volume has been received. - - @param aVolume The current relative volume on the target device. - @param aMaxVolume The maximum volume against which aVolume is relative. - @param aError The response error. - */ - virtual void MrcavcoCurrentVolume(TUint32 aVolume, - TUint32 aMaxVolume, - TInt aError)=0; - - /** - The response for setting absolute volume. - - @param aVolume The relative volume that has been set on the target device. - @param aMaxVolume The maximum volume against which aVolume is relative. - @param aError The response error. - */ - virtual void MrcavcoSetAbsoluteVolumeResponse(TUint32 aVolume, - TUint32 aMaxVolume, - TInt aError)=0; - - /** - The error occurs for absolute volume notification. - - When this is called, the client must call - RegisterAbsoluteVolumeNotification() to register again if the client - wants to receive the notification. - */ - virtual void MrcavcoAbsoluteVolumeNotificationError() = 0; - - }; - -#endif /*REMCONABSOLUTEVOLUMEAPICONTROLLEROBSERVER_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapitarget.h --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapitarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONABSOLUTEVOLUMEAPITARGET_H -#define REMCONABSOLUTEVOLUMEAPITARGET_H - -#include -#include - -_LIT(KAbsoluteVolumeTargetPanicName, "AbsoluteVolumeTarget"); -enum TAbsoluteVolumeTargetPanics - { - ETargetInvalidMaxVolume = 0, - ETargetVolumeBeyondMaxVolume = 1, - }; - -class MRemConAbsoluteVolumeTargetObserver; - -/** -Client-instantiable type supporting sending absolute volume API responses for -Set Absolute Volume and Register Absolute Volume Change Notification. This API -should be used in preference to the extapi. -*/ -NONSHARABLE_CLASS(CRemConAbsoluteVolumeTarget) : public CRemConInterfaceBase, - public MRemConInterfaceIf2 - { -public: - IMPORT_C static CRemConAbsoluteVolumeTarget* NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConAbsoluteVolumeTargetObserver& aObserver, - TUint32 aVolume, - TUint32 aMaxVolume); - - IMPORT_C ~CRemConAbsoluteVolumeTarget(); - -public: - IMPORT_C void SetAbsoluteVolumeResponse(TUint32 aVolume, - TInt aErr); - - IMPORT_C void AbsoluteVolumeChanged(TUint32 aVolume); - -private: - CRemConAbsoluteVolumeTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConAbsoluteVolumeTargetObserver& aObserver, - TUint32 aVolume, - TUint32 aMaxVolume); - - void ConstructL(); - -private: // From CRemConInterfaceBase - TAny* GetInterfaceIf(TUid aUid); - -private: // From MRemConInterfaceIf2 - void MrcibNewMessage(TUint aOperationId, - const TDesC8& aData, - TRemConMessageSubType aMsgSubType); - -private: // Utility Funtions - void SendError(TInt aError, TUint aOperationId); - void SendNotificationResponse(TRemConMessageSubType aMsgSubType); - void ProcessGetStatus(); - void ProcessGetStatusAndBeginObserving(); - void ProcessSetAbsoluteVolume(const TDesC8& aData); - -private: // Unowned - MRemConAbsoluteVolumeTargetObserver& iObserver; - -private: // Owned - // ETrue indicates a request for absolute volume change notification has - // been received. - TBool iAbsoluteVolumeNotificationRequest; - RBuf8 iOutBuf; - TUint32 iClientVolume; - TUint32 iClientMaxVolume; - }; -#endif // ABSOLUTEVOLUMEAPITARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapitargetobserver.h --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeapitargetobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONABSOLUTEVOLUMEAPITARGETOBSERVER_H -#define REMCONABSOLUTEVOLUMEAPITARGETOBSERVER_H - -#include - -/** -Clients must implement this interface in order to instantiate objects of type -CRemConAbsoluteVolumeTarget. This interface passes incoming commands from -RemCon to the client. -*/ -NONSHARABLE_CLASS(MRemConAbsoluteVolumeTargetObserver) - { -public: - /** - This is called when the controller wishes to set absolute volume on the - client. Response must be provided by the client by calling - CRemConAbsoluteVolumeTarget::SetAbsoluteVolumeResponse() - - @see CRemConAbsoluteVolumeTarget::SetAbsoluteVolumeResponse() - @param aVolume The relative volume. - @param aMaxVolume The maximum volume against which aVolume is relative. - */ - virtual void MrcavtoSetAbsoluteVolumeRequest(TUint32 aVolume, - TUint32 aMaxVolume) = 0; - }; - -#endif // REMCONABSOLUTEVOLUMEAPITARGETOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeutils.h --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/public/absolutevolumeutils.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedPartner - @released -*/ - -#ifndef ABSOLUTEVOLUMEUTILS_H_ -#define ABSOLUTEVOLUMEUTILS_H_ - -#include -#include - -class RRemConAbsoluteVolume - { -public: - virtual void ReadL(const TDesC8& aData) = 0; - virtual void WriteL(TDes8& aOutData) = 0; - IMPORT_C void Close(); - -public: - TUint32 iVolume; - TUint32 iMaxVolume; - -protected: - RDesWriteStream iStream; - RDesReadStream iReadStream; - }; - -class RRemConAbsoluteVolumeRequest : public RRemConAbsoluteVolume - { -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -class RRemConAbsoluteVolumeResponse : public RRemConAbsoluteVolume - { -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); -public: - TInt32 iError; - }; - -#endif /*ABSOLUTEVOLUMEUTILS_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumeapicontroller.cpp --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumeapicontroller.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,478 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include -#include -#include "absolutevolumesender.h" -#include -#include - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_REMCONABSOLUTEVOLUME); -#endif - -#ifdef _DEBUG -_LIT(KAbsoluteVolumeControllerFaultName, "AbsVolFault"); -// The panic codes associated with category KAbsoluteVolumeControllerFaultName are line numbers in this file. -#endif - -/** -Allocates and constructs a new CRemConAbsoluteVolumeController object - -@param aInterfaceSelector The interface selector. The client must have - created one of these first. -@param aObserver The observer. The client must have implemented the observer, - owned by the client. -@param aMaxVolume The client maximum volume. -@return A new CRemConAbsoluteVolumeController, owned by the interface selector -@panic AbsoluteVolumeController 0 if aMaxVolume is zero. -*/ -EXPORT_C -CRemConAbsoluteVolumeController* CRemConAbsoluteVolumeController::NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConAbsoluteVolumeControllerObserver& aObserver, - TUint32 aMaxVolume) - { - LOG_STATIC_FUNC - - __ASSERT_ALWAYS(aMaxVolume > 0, - User::Panic(KAbsoluteVolumeControllerPanicName, - EControllerInvalidMaxVolume) - ); - - CRemConAbsoluteVolumeController* self = - new(ELeave) CRemConAbsoluteVolumeController(aInterfaceSelector, - aObserver, aMaxVolume); - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -/** -Constructor. - -@param aInterfaceSelector The interface selector. -@param aObserver The observer. -*/ -CRemConAbsoluteVolumeController::CRemConAbsoluteVolumeController( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConAbsoluteVolumeControllerObserver& aObserver, - TUint32 aMaxVolume) -: CRemConInterfaceBase(TUid::Uid(KRemConAbsoluteVolumeControllerApiUid), - KAbsoluteVolumeResponseDataSize, - aInterfaceSelector, - ERemConClientTypeController), - iObserver(aObserver), - iClientMaxVolume(aMaxVolume), - iNotificationRequested(EFalse), - iAbsVolRequest(ENotInUse), - iNotifyRequest(ENotInUse) - { - LOG_FUNC - } - -EXPORT_C CRemConAbsoluteVolumeController::~CRemConAbsoluteVolumeController() - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - delete iAbsVolSender; - } - -void CRemConAbsoluteVolumeController::ConstructL() - { - LOG_FUNC - - iAbsVolSender = CAbsVolSender::NewL(InterfaceSelector(), *this); - BaseConstructL(); - } - -/** -Sets an absolute volume on the target device, -Any responses will be returned via the observer interface. - -@pre The send of any previous SetAbsoluteVolume command has completed. -@param aStatus Indicates the completion of the send request. The client must - not block execution by using User::WaitForRequest to await - completion of this send. -@param aVolume The relative volume against the client max volume. -@param aNumRemotes The number of remotes to which the command was sent. -@panic AbsoluteVolumeController 1, if aVolume greater than the client - max volume. -*/ -EXPORT_C void CRemConAbsoluteVolumeController::SetAbsoluteVolume( - TRequestStatus& aStatus, - TUint32 aVolume, - TUint& aNumRemotes) - { - LOG_FUNC - LOG1(_L8("\taVolume = %d"), aVolume); - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - __ASSERT_ALWAYS(aVolume <= iClientMaxVolume, - User::Panic(KAbsoluteVolumeControllerPanicName, - EControllerVolumeBeyondMaxVolume) - ); - __ASSERT_DEBUG(iAbsVolRequest == ENotInUse, User::Panic(KAbsoluteVolumeControllerPanicName, - EMultipleSetAbsoluteVolumes)); - - RRemConAbsoluteVolumeRequest setAbsVol; - setAbsVol.iVolume = aVolume; - setAbsVol.iMaxVolume = iClientMaxVolume; - TRAPD(err, setAbsVol.WriteL(iSetData)); - if (err == KErrNone) - { - // Store the client's info so we can complete their request later - aStatus = KRequestPending; - iAbsVolRequest = EPending; - __ASSERT_DEBUG(iClientStatus == NULL, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - iClientStatus = &aStatus; - __ASSERT_DEBUG(iClientNumRemotes == NULL, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - iClientNumRemotes = &aNumRemotes; - KickOffSendIfNeeded(); - } - else - { - iObserver.MrcavcoSetAbsoluteVolumeResponse(0, 0, err); - } - } - -EXPORT_C void CRemConAbsoluteVolumeController::CancelSetAbsoluteVolume() - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - switch ( iAbsVolRequest ) - { - case ENotInUse: - // Nothing to do. - break; - case ESending: - iAbsVolSender->Cancel(); - SetAbsoluteVolumeSendComplete(KErrCancel); - break; - case EPending: - SetAbsoluteVolumeSendComplete(KErrCancel); - break; - default: - __ASSERT_DEBUG(EFalse, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - break; - } - } - -/** -Requests notification when the volume on the target device changes, -Any responses will be returned via the observer interface. - -Volume changes will continue to be provided until either the -CancelAbsoluteVolumeNotification function is called, or MrcavcoCurrentVolume -is called on the client with an error. - -@see MRemConAbsoluteVolumeControllerObserver::MrcavcoCurrentVolume -@see CRemConAbsoluteVolumeController::CancelAbsoluteVolumeNotification -@pre The client is not currently registered to receive absolute volume notifications. -*/ -EXPORT_C -void CRemConAbsoluteVolumeController::RegisterAbsoluteVolumeNotification() - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - // The request is outstanding, so not allowed to register again. - __ASSERT_DEBUG(!iNotificationRequested, User::Panic(KAbsoluteVolumeControllerPanicName, EAbsoluteVolumeNotificationAlreadyRegistered)); - __ASSERT_DEBUG(iNotifyRequest == ENotInUse, User::Panic(KAbsoluteVolumeControllerPanicName, EMultipleNotifies)); - - RRemConAbsoluteVolumeRequest absVol; - TRAPD(err, absVol.WriteL(iNotifyData)); - if (err == KErrNone) - { - iNotifyRequest = EPending; - iNotificationRequested = ETrue; - KickOffSendIfNeeded(); - } - else - { - iObserver.MrcavcoAbsoluteVolumeNotificationError(); - } - } - -/** -Called by the client to tell the controller that the client doesn't wish to -receicve the volume change notification -until the client re-register again. -*/ -EXPORT_C -void CRemConAbsoluteVolumeController::CancelAbsoluteVolumeNotification() - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - if ( iNotifyRequest == ESending ) - { - iAbsVolSender->Cancel(); - } - - iNotificationRequested = EFalse; - RegisterNotifySendComplete(); - } - -TAny* CRemConAbsoluteVolumeController::GetInterfaceIf(TUid aUid) - { - LOG_FUNC - - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf2) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -void CRemConAbsoluteVolumeController::MrcibNewMessage(TUint aOperationId, - const TDesC8& aData, - TRemConMessageSubType aMessageSubType) - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - switch (aOperationId) - { - case KRemConAbsoluteVolumeNotification: - HandleNotify(aData, aMessageSubType); - break; - case KRemConSetAbsoluteVolume: - HandleSetAbsoluteVolumeResponse(aData); - break; - default: - break; - } - } - -/** -Process the 'volume changed notification response' - -@param aData The response data. -@param aMessageSubType The RemCon submessage type. -*/ -void CRemConAbsoluteVolumeController::HandleNotify(const TDesC8& aData, - TRemConMessageSubType aMessageSubType) - { - LOG_FUNC - - TInt err = KErrNone; - - if(iNotificationRequested) - { - RRemConAbsoluteVolumeResponse absVol; - TRAP(err, absVol.ReadL(aData)) - if (err == KErrNone) - { - if (absVol.iError == KErrNone) - { - switch ( aMessageSubType ) - { - case ERemConNotifyResponseInterim: - { - VolumeUpdate(absVol.iVolume, absVol.iMaxVolume); - break; - } - case ERemConNotifyResponseChanged: - { - VolumeUpdate(absVol.iVolume, absVol.iMaxVolume); - - // Register notification again. - iNotificationRequested = EFalse; - RegisterAbsoluteVolumeNotification(); - break; - } - default: - break; - }//switch - } - else //Error response - { - iNotificationRequested = EFalse; - iObserver.MrcavcoAbsoluteVolumeNotificationError(); - } - } - else - { - iNotificationRequested = EFalse; - iObserver.MrcavcoAbsoluteVolumeNotificationError(); - } - } - } - -/** -Process the 'set absolute volume response' -@param aData The response data. -*/ -void CRemConAbsoluteVolumeController::HandleSetAbsoluteVolumeResponse( - const TDesC8& aData ) - { - LOG_FUNC - - TInt err = KErrNone; - RRemConAbsoluteVolumeResponse absVol; - TRAP(err, absVol.ReadL(aData)) - if (err == KErrNone) - { - iCurrentVolume = absVol.iVolume; - iCurrentMaxVolume = absVol.iMaxVolume; - iObserver.MrcavcoSetAbsoluteVolumeResponse(absVol.iVolume, - absVol.iMaxVolume, - absVol.iError); - } - else - { - iObserver.MrcavcoSetAbsoluteVolumeResponse(0, - 0, - err); - } - } - -void CRemConAbsoluteVolumeController::MavsoSendComplete(TInt aResult) - { - LOG_FUNC - LOG1(_L8("\taResult = %d"), aResult); - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - if ( iAbsVolRequest == ESending ) - { - __ASSERT_DEBUG(iNotifyRequest != ESending, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - SetAbsoluteVolumeSendComplete(aResult); - } - else if ( iNotifyRequest == ESending ) - { - // This updates our own state and kicks off any pending send. The - // later client upcall (if there was an error) gives them a chance - // to make further calls on us. - RegisterNotifySendComplete(); - - if(aResult != KErrNone) - { - iNotificationRequested = EFalse; - iObserver.MrcavcoAbsoluteVolumeNotificationError(); - } - } - else - { - // Send complete with no send outstanding. - __ASSERT_DEBUG(EFalse, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - } - } - -void CRemConAbsoluteVolumeController::KickOffSendIfNeeded() - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - if ( iAbsVolRequest == ESending || iNotifyRequest == ESending ) - { - // Any pending send will be kicked off when current send completes and this function is called again. - return; - } - - if ( iAbsVolRequest == EPending ) - { - SendSetAbsoluteVolume(); - } - else if ( iNotifyRequest == EPending ) - { - SendNotify(); - } - } - -void CRemConAbsoluteVolumeController::SetAbsoluteVolumeSendComplete(TInt aResult) - { - LOG_FUNC - LOG1(_L8("\taResult = %d"), aResult); - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - __ASSERT_DEBUG(iClientStatus, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - User::RequestComplete(iClientStatus, aResult); - iClientStatus = NULL; - iClientNumRemotes = NULL; - iSetData.SetLength(0); - __ASSERT_DEBUG(iAbsVolRequest != ENotInUse, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - iAbsVolRequest = ENotInUse; - - KickOffSendIfNeeded(); - } - -void CRemConAbsoluteVolumeController::RegisterNotifySendComplete() - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - iNotifyData.SetLength(0); - // This method doesn't actually complete a client request so we don't bother asserting state. - iNotifyRequest = ENotInUse; - - KickOffSendIfNeeded(); - } - -void CRemConAbsoluteVolumeController::VolumeUpdate(TUint32 aVolume, TUint32 aMaxVolume) - { - LOG_FUNC - LOG2(_L8("\taVolume = %d, aMaxVolume = %d"), aVolume, aMaxVolume); - - // Only update the client if the volume has changed - if (aVolume != iCurrentVolume || aMaxVolume != iCurrentMaxVolume) - { - iCurrentVolume = aVolume; //store the new value - iCurrentMaxVolume = aMaxVolume; - - iObserver.MrcavcoCurrentVolume(aVolume, - aMaxVolume, - KErrNone); - } - } - -void CRemConAbsoluteVolumeController::SendSetAbsoluteVolume() - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - __ASSERT_DEBUG(iClientNumRemotes, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - iAbsVolSender->SendSetAbsoluteVolume(*iClientNumRemotes, iSetData); - __ASSERT_DEBUG(iAbsVolRequest == EPending, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - iAbsVolRequest = ESending; - } - -void CRemConAbsoluteVolumeController::SendNotify() - { - LOG_FUNC - LOG2(_L8("\tiAbsVolRequest = %d, iNotifyRequest = %d"), iAbsVolRequest, iNotifyRequest); - - iAbsVolSender->SendNotify(iNotifyData); - __ASSERT_DEBUG(iNotifyRequest == EPending, User::Panic(KAbsoluteVolumeControllerFaultName, __LINE__)); - iNotifyRequest = ESending; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumeapitarget.cpp --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumeapitarget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,324 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include -#include -#include -#include - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_REMCONABSOLUTEVOLUME); -_LIT8(KLogFormat, "Operation Id = 0x%x, Data Lengh = %d"); -_LIT8(KLogNewL, "CRemConAbsoluteVolumeTarget::NewL"); -#endif - -/** -Allocates and constructs a new CRemConAbsoluteVolumeTarget object - -@param aInterfaceSelector The interface selector. The client must have - created one of these first. -@param aObserver The observer through which the client will receive absolute - volume commands from M class MRemConAbsoluteVolumeTargetObserver. -@param aVolume The initial relative volume on the client. -@param aMaxVolume The client maximum volume against which aVolume is relative. -@return A new CRemConAbsoluteVolumeTarget, owned by the interface selector. -@panic AbsoluteVolumeTarget 0 if aMaxVolume is zero - AbsoluteVolumeTarget 1 if aVolume greater than aMaxVolume - -*/ -EXPORT_C CRemConAbsoluteVolumeTarget* CRemConAbsoluteVolumeTarget::NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConAbsoluteVolumeTargetObserver& aObserver, - TUint32 aVolume, - TUint32 aMaxVolume) - { - LOG(KLogNewL); - - __ASSERT_ALWAYS(aMaxVolume > 0, - User::Panic(KAbsoluteVolumeTargetPanicName, - ETargetInvalidMaxVolume) - ); - __ASSERT_ALWAYS(aVolume <= aMaxVolume, - User::Panic(KAbsoluteVolumeTargetPanicName, - ETargetVolumeBeyondMaxVolume) - ); - - CRemConAbsoluteVolumeTarget* self = - new(ELeave) CRemConAbsoluteVolumeTarget(aInterfaceSelector, - aObserver, aVolume, aMaxVolume); - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -/** -Constructor. -@param aInterfaceSelector The interface selector. -@param aObserver The observer of this interface. -@param aVolume The initial relative volume on the client -@param aMaxVolume The maximum volume on the client against which - aVolume is relative. -*/ -CRemConAbsoluteVolumeTarget::CRemConAbsoluteVolumeTarget( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConAbsoluteVolumeTargetObserver& aObserver, - TUint32 aVolume, - TUint32 aMaxVolume) -: CRemConInterfaceBase(TUid::Uid(KRemConAbsoluteVolumeTargetApiUid), - KAbsoluteVolumeRequestDataSize, - aInterfaceSelector, - ERemConClientTypeTarget), - iObserver(aObserver), - iAbsoluteVolumeNotificationRequest(EFalse), - iClientVolume(aVolume), - iClientMaxVolume(aMaxVolume) - { - } - -void CRemConAbsoluteVolumeTarget::ConstructL() - { - iOutBuf.CreateL(KAbsoluteVolumeResponseDataSize); - - //Mandate the following features supported. - RRemConInterfaceFeatures features; - User::LeaveIfError(features.Open()); - CleanupClosePushL(features); - features.AddOperationL(KRemConSetAbsoluteVolume); - - BaseConstructL(features); - CleanupStack::PopAndDestroy(&features); - } - -EXPORT_C CRemConAbsoluteVolumeTarget::~CRemConAbsoluteVolumeTarget() - { - iOutBuf.Close(); - } - -TAny* CRemConAbsoluteVolumeTarget::GetInterfaceIf(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf2) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -/** -Called by the client in response to a MrcavtoSetAbsoluteVolume() call. - -@param aVolume The relative volume against the client maximum volume. -@param aErr The error code. - - KErrNone if the client has changed its absolute volume. - - System wide error code otherwise. -@panic AbsoluteVolumeTarget 1, if volume is greater than max volume. -*/ -EXPORT_C void CRemConAbsoluteVolumeTarget::SetAbsoluteVolumeResponse( - TUint32 aVolume, - TInt aErr) - { - __ASSERT_ALWAYS(aVolume <= iClientMaxVolume, - User::Panic(KAbsoluteVolumeTargetPanicName, - ETargetVolumeBeyondMaxVolume) - ); - - RRemConAbsoluteVolumeResponse response; - response.iError = KErrNone; - response.iVolume = aVolume; - response.iMaxVolume = iClientMaxVolume; - TRAPD(error, response.WriteL(iOutBuf)); - if (error != KErrNone) - { - SendError(KErrAbsoluteVolumeInternalError, KRemConSetAbsoluteVolume); - return; - } - - if (aErr == KErrNone) - { - // send the response back to the CT - error = InterfaceSelector().SendUnreliable( - TUid::Uid(KRemConAbsoluteVolumeTargetApiUid), - KRemConSetAbsoluteVolume, ERemConResponse, iOutBuf ); - } - else - { - SendError(KErrAbsoluteVolumeInternalError, KRemConSetAbsoluteVolume); - } - } - -/** -Must be called each time the volume changes on the client. - -It is used to inform the controller if it has requested updates on the client -volume change. - -@param aVolume The relative volume against the client maximum volume. -@panic AbsoluteVolume 1, if volume greater than the client max volume. -*/ -EXPORT_C void CRemConAbsoluteVolumeTarget::AbsoluteVolumeChanged( - TUint32 aVolume) - { - __ASSERT_ALWAYS(aVolume <= iClientMaxVolume, - User::Panic(KAbsoluteVolumeTargetPanicName, - ETargetVolumeBeyondMaxVolume) - ); - - if (aVolume != iClientVolume) - { - // Records the current volume each time - // when the client absolute volume is changed - iClientVolume = aVolume; - - if (iAbsoluteVolumeNotificationRequest) - { - iAbsoluteVolumeNotificationRequest = EFalse; - SendNotificationResponse(ERemConNotifyResponseChanged); - } - } - } - -// From MRemConInterfaceIf -void CRemConAbsoluteVolumeTarget::SendError(TInt aError, TUint aOperationId) - { - TInt error = KErrNone; - RRemConAbsoluteVolumeResponse errRsp; - errRsp.iError = aError; - TRAP(error, errRsp.WriteL(iOutBuf)); - if (error == KErrNone) - { - InterfaceSelector().SendUnreliable( - TUid::Uid(KRemConAbsoluteVolumeTargetApiUid), - aOperationId, ERemConResponse, iOutBuf); - } - } - -void CRemConAbsoluteVolumeTarget::MrcibNewMessage(TUint aOperationId, - const TDesC8& aData, - TRemConMessageSubType aMsgSubType) - { - LOG_FUNC - LOG2(KLogFormat, aOperationId, aData.Length()); - - switch(aOperationId) - { - case KRemConSetAbsoluteVolume: - { - ProcessSetAbsoluteVolume(aData); - break; - } - case KRemConAbsoluteVolumeNotification: - { - // register for Notifications - if (aMsgSubType == ERemConNotifyCommandAwaitingInterim) - { - ProcessGetStatusAndBeginObserving(); - } - else if (aMsgSubType == ERemConNotifyCommandAwaitingChanged) - { - ProcessGetStatus(); - } - break; - } - default: - break; - }; - } - -/** -Processes the request for setting absolute volume. - -@param aData The absolute volume data to be setted. -*/ -void CRemConAbsoluteVolumeTarget::ProcessSetAbsoluteVolume( - const TDesC8& aData) - { - TInt error; - RRemConAbsoluteVolumeRequest request; - TRAP(error, request.ReadL(aData)); - if ( error == KErrNone) - { - iObserver.MrcavtoSetAbsoluteVolumeRequest(request.iVolume, - request.iMaxVolume); - } - else - { - SendError(KErrAbsoluteVolumeInternalError, KRemConSetAbsoluteVolume); - } - } - -/** -Processes the request for notify command waiting interim. -*/ -void CRemConAbsoluteVolumeTarget::ProcessGetStatusAndBeginObserving() - { - //Flag is ETure to indicate the request for absolute volume change - //notification has been received. - iAbsoluteVolumeNotificationRequest = ETrue; - - //send the interim response with the current absolute volume. - SendNotificationResponse(ERemConNotifyResponseInterim); - } - -/** -Processes the request for notify command waiting changed. -*/ -void CRemConAbsoluteVolumeTarget::ProcessGetStatus() - { - // send the current value - SendNotificationResponse(ERemConNotifyResponseChanged); - } - -/** -Sends absolute volume interim or change response according to the message -type aMsgSubType - -@param aMsgSubType The remcon submessage type. -*/ -void CRemConAbsoluteVolumeTarget::SendNotificationResponse( - TRemConMessageSubType aMsgSubType) - { - LOG_FUNC - - TInt error = 0; - RRemConAbsoluteVolumeResponse response; - response.iError = KErrNone; - response.iVolume = iClientVolume; - response.iMaxVolume = iClientMaxVolume; - TRAP(error, response.WriteL(iOutBuf)); - if (error == KErrNone) - { - error = InterfaceSelector().SendUnreliable( - TUid::Uid(KRemConAbsoluteVolumeTargetApiUid), - KRemConAbsoluteVolumeNotification, - ERemConResponse, - aMsgSubType, - iOutBuf); - } - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumesender.cpp --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumesender.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#include "absolutevolumesender.h" -#include - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_REMCONABSOLUTEVOLUME); -#endif - -CAbsVolSender* CAbsVolSender::NewL(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver) - { - LOG_STATIC_FUNC - return new(ELeave)CAbsVolSender(aIfSel, aObserver); - } - -CAbsVolSender::CAbsVolSender(CRemConInterfaceSelector& aIfSel, MAbsVolSenderObserver& aObserver) - : CActive(EPriorityStandard), iIfSel(aIfSel), iObserver(aObserver) - { - LOG_FUNC - CActiveScheduler::Add(this); - } - -CAbsVolSender::~CAbsVolSender() - { - LOG_FUNC - Cancel(); - } - -void CAbsVolSender::RunL() - { - LOG_LINE - LOG_FUNC - iObserver.MavsoSendComplete(iStatus.Int()); - } - -void CAbsVolSender::DoCancel() - { - LOG_FUNC - LOG1(_L8("\tiSendingNotify = %d"), iSendingNotify); - - if(iSendingNotify) - { - iIfSel.SendCancel(ERemConNotifyCommand); - } - else - { - iIfSel.SendCancel(ERemConCommand); - } - } - -void CAbsVolSender::SendNotify(const TDesC8& aData) - { - LOG_FUNC - iIfSel.SendNotify(iStatus, - TUid::Uid(KRemConAbsoluteVolumeControllerApiUid), - KRemConAbsoluteVolumeNotification, - ERemConNotifyCommand, - ERemConNotifyCommandAwaitingInterim, - aData); - iSendingNotify = ETrue; - - SetActive(); - } - -void CAbsVolSender::SendSetAbsoluteVolume(TUint& aNumRemotes, const TDesC8& aData) - { - LOG_FUNC - iIfSel.Send(iStatus, - TUid::Uid(KRemConAbsoluteVolumeControllerApiUid), - KRemConSetAbsoluteVolume, - aNumRemotes, - ERemConCommand, - aData); - iSendingNotify = EFalse; - - SetActive(); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumeutils.cpp --- a/bluetoothappprofiles/avrcp/absolutevolumeapi/src/absolutevolumeutils.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedPartner - @released -*/ - -#include - -EXPORT_C -void RRemConAbsoluteVolume::Close() - { - iStream.Close(); - iReadStream.Close(); - } - -EXPORT_C -void RRemConAbsoluteVolumeRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iVolume = iReadStream.ReadUint32L(); - iMaxVolume = iReadStream.ReadUint32L(); - iReadStream.ReadUint32L(); - iReadStream.Close(); - } - -EXPORT_C -void RRemConAbsoluteVolumeRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - iStream.WriteUint32L(iVolume); - iStream.WriteUint32L(iMaxVolume); - iStream.WriteUint32L(NULL); - iStream.CommitL(); - } - -EXPORT_C -void RRemConAbsoluteVolumeResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iError = iReadStream.ReadInt32L(); - if (iError == KErrNone) - { - iVolume = iReadStream.ReadUint32L(); - iMaxVolume = iReadStream.ReadUint32L(); - } - iReadStream.Close(); - } - -EXPORT_C -void RRemConAbsoluteVolumeResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - iStream.WriteInt32L(iError); - if (KErrNone == iError) - { - iStream.WriteUint32L(iVolume); - iStream.WriteUint32L(iMaxVolume); - } - iStream.CommitL(); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avc/avc.mmp --- a/bluetoothappprofiles/avrcp/avc/avc.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -// Copyright (c) 2004-2009 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: -// avc.dll. AV/C -// -// - -/** - @file -*/ - -TARGET avc.dll -CAPABILITY All -Tcb -TARGETTYPE dll - -UID 0x1000008d 0x10207ea6 -VENDORID 0x70000001 - -DEFFILE avc.def - -SOURCEPATH . -SOURCE avcframe.cpp - -USERINCLUDE . - -MW_LAYER_SYSTEMINCLUDE_SYMBIAN -LIBRARY euser.lib - -#include - -UNPAGED - -SMPSAFE diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avc/avcframe.cpp --- a/bluetoothappprofiles/avrcp/avc/avcframe.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,523 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @publishedPartner - @released -*/ - -#include -#include - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_FRAME); -#endif - -#ifdef _DEBUG -PANICCATEGORY("avctpframe"); -#endif - -/** Constructor. - -@param aFrameType ECommand if this is a command, EResponse - if it's a response. -@internalComponent -@released -*/ -CAVCFrame::CAVCFrame(AVC::TFrameType aFrameType) - : iFrameType(aFrameType) - { - LOG_FUNC - } - -/** Destructor. - -@publishedPartner -@released -*/ -EXPORT_C CAVCFrame::~CAVCFrame() - { - LOG_FUNC - iBuffer.Close(); - } - -/** Factory function. - -This overload should be called when an AV/C frame is -to be constructed, that is it is probably an outgoing frame. - -@param aFrameType ECommand if this is a command, EResponse - if it's a response. -@param aType The AV/C CType for this frame. -@param aSubunitType The AV/C subunit type for this frame. -@param aSubunitId The AV/C subunit id for this frame. -@return A fully constructed CAVCFrame. -@leave System wide error code. -@publishedPartner -@released -*/ -EXPORT_C CAVCFrame* CAVCFrame::NewL(AVC::TFrameType aFrameType, - AVC::TCType aType, - AVC::TSubunitType aSubunitType, - AVC::TSubunitID aSubunitID) - { - CAVCFrame* frame = new(ELeave)CAVCFrame(aFrameType); - CleanupStack::PushL(frame); - frame->ConstructL(aType, aSubunitType, aSubunitID); - CleanupStack::Pop(frame); - return frame; - } - -/** Factory function. - -This overload should be used when a data buffer should -be parsed as an AV/C frame, that is it is probably an -incoming frame. - -@param aBuffer A buffer to be parsed as an AV/C frame. -@param aFrameType ECommand if this is a command, EResponse - if it's a response. -@return A fully constructed CAVCFrame. -@leave System wide error code. -@publishedPartner -@released -*/ -EXPORT_C CAVCFrame* CAVCFrame::NewL(const TDesC8& aBuffer, AVC::TFrameType aFrameType) - { - CAVCFrame* frame = new(ELeave)CAVCFrame(aFrameType); - CleanupStack::PushL(frame); - frame->ConstructL(aBuffer); - CleanupStack::Pop(frame); - return frame; - } - -/** Second phase construction. - -This overload is used when an AV/C frame is -to be constructed, that is it is probably an outgoing frame. - -@param aType The AV/C CType for this frame. -@param aSubunitType The AV/C subunit type for this frame. -@param aSubunitId The AV/C subunit id for this frame. -@return A fully constructed CAVCFrame. -@leave System wide error code. -@internalComponent -@released -*/ -void CAVCFrame::ConstructL(AVC::TCType aType, AVC::TSubunitType aSubunitType, AVC::TSubunitID aSubunitID) - { - iBuffer.CreateL(KAVCFrameMaxLength); - iBuffer.Zero(); - iBuffer.Append(TChar(aType)); - - TInt subType = aSubunitType; - TInt subID = aSubunitID; - - if (subType > AVC::ETypeExtended2) - { - iSubunitTypeExtensionBytes = 1; - iBuffer.Append(TChar(AVC::ETypeExtended1 << 3)); - subType -= 0x100; - - while (subType > 0x100) - { - iBuffer.Append(TChar(AVC::ETypeExtended2)); - subType -= 0x100; - } - - iBuffer.Append(TChar(subType)); - } - else - { - iBuffer.Append(TChar(subType << 3)); - } - - if (subID > AVC::EIDExtended2) - { - iSubunitIDExtensionBytes = 1; - iBuffer[1] |= AVC::EIDExtended1; - subID -= 0x100; - - while (subID > 0x100) - { - iBuffer.Append(TChar(AVC::EIDExtended2)); - subID -= 0x100; - } - - iBuffer.Append(TChar(subID)); - } - else - { - iBuffer[1] |= subID; - } - } - -/** Second phase construction. - -This overload is used when a data buffer should -be parsed as an AV/C frame, that is it is probably an -incoming frame. - -For details of parsing refer to the AV/C digital -interface command set specification. - -@param aBuffer A buffer to be parsed as an AV/C frame. -@return A fully constructed CAVCFrame. -@leave System wide error code. -@publishedPartner -@released -*/ -void CAVCFrame::ConstructL(const TDesC8& aBuffer) - { - iBuffer.CreateL(aBuffer); - FindExtensionL(iBuffer, iSubunitTypeExtensionBytes, iSubunitIDExtensionBytes); - } - -/** Gets the AV/C frame type. - -@return ECommand if this is a command, EResponse if this - is a response. -@publishedPartner -@released -*/ -EXPORT_C AVC::TFrameType CAVCFrame::FrameType() const - { - return iFrameType; - } - -/** Gets the AV/C frame type. - -@param aFrame The frame to get the frame type for. -@return ECommand if this is a command, EResponse if this - is a response. -@publishedPartner -@released -*/ -EXPORT_C AVC::TFrameType CAVCFrame::FrameType(const TDesC8& aFrame) - { - AVC::TFrameType frameType = AVC::ECommand; - - if( aFrame[0] > KAVCCommandMaxRangeLength ) - { - frameType = AVC::EResponse; - } - return frameType; - } - -/** Set the AV/C frame type for this frame. - -@param The frame type to set. -@publishedPartner -@released -*/ -EXPORT_C void CAVCFrame::SetFrameType(AVC::TFrameType aFrameType) - { - iFrameType = aFrameType; - } - -/** Get the AV/C CType for this frame. - -@return The AV/C CType for this frame. -@publishedPartner -@released -*/ -EXPORT_C AVC::TCType CAVCFrame::Type() const - { - return static_cast(iBuffer[0]); - } - -/** Set the AV/C CType for this frame. - -@param aType The AV/C CType to set. -@publishedPartner -@released -*/ -EXPORT_C void CAVCFrame::SetType(AVC::TCType aType) - { - iBuffer[0] = aType; - } - -/** Get the AV/C subunit type for this frame. - -@return The AV/C subunit type for this frame. -@publishedPartner -@released -*/ -EXPORT_C AVC::TSubunitType CAVCFrame::SubunitType() const - { - if (iSubunitTypeExtensionBytes == 0) - { - return static_cast((iBuffer[1] & KAVCSubunitTypeMask) >> 3); - } - - return static_cast(iBuffer[1 + iSubunitTypeExtensionBytes] + (iSubunitTypeExtensionBytes * 0x100)); - } - -/** Get the AV/C subunit id for this frame. - -@return The AV/C subunit id for this frame. -@publishedPartner -@released -*/ -EXPORT_C AVC::TSubunitID CAVCFrame::SubunitID() const - { - if (iSubunitIDExtensionBytes == 0) - { - return static_cast(iBuffer[1] & KAVCSubunitIDMask); - } - - return static_cast(iBuffer[1 + iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes] + (iSubunitIDExtensionBytes * 0x100)); - } - -/** Find extension bytes for the frame. - -@param aBuffer buffer to be used. -@return True if its a valid frame. -@leave System wide error code. -@internalComponent -@released -*/ -/* static */ void CAVCFrame::FindExtensionL(const TDesC8& aBuffer, TInt& aSubunitTypeExtensionBytes, TInt& aSubunitIDExtensionBytes) - { - TInt minLength = KAVCFrameHeaderLength; - if(aBuffer.Length() < minLength) - { - User::Leave(KErrCorrupt); - } - - if (static_cast((aBuffer[1] & KAVCSubunitTypeMask) >> 3) == AVC::ETypeExtended1) - { - aSubunitTypeExtensionBytes++; - minLength++; - - while (aBuffer[1 + aSubunitTypeExtensionBytes] == AVC::ETypeExtended2) - { - if(aBuffer.Length() < minLength) - { - User::Leave(KErrCorrupt); - } - - aSubunitTypeExtensionBytes++; - minLength++; - } - } - - if (static_cast(aBuffer[1] & KAVCSubunitIDMask) == AVC::EIDExtended1) - { - aSubunitIDExtensionBytes++; - minLength++; - - while (aBuffer[1 + aSubunitIDExtensionBytes] == AVC::EIDExtended1) - { - if(aBuffer.Length() < minLength) - { - User::Leave(KErrCorrupt); - } - - aSubunitIDExtensionBytes++; - minLength++; - } - } - - //Ensure frame is a valid length i.e. the Opcode() method can be safely called. - if(aBuffer.Length() < minLength) - { - User::Leave(KErrCorrupt); - } - } - -/** Get the AV/C opcode for this frame. - -@param aBuffer buffer to search. -@return The AV/C opcode for this frame. -@leave System wide error code. -@internalComponent -@released -*/ -/* static */ EXPORT_C AVC::TOpcode CAVCFrame::OpcodeL(const TDesC8& aBuffer) - { - TInt subunitTypeExtensionBytes=0; - TInt subunitIDExtensionBytes=0; - - FindExtensionL(aBuffer, subunitTypeExtensionBytes, subunitIDExtensionBytes); - return static_cast (aBuffer[KAVCFrameHeaderLength + subunitTypeExtensionBytes + subunitIDExtensionBytes - 1]); - } - -/** Get the AV/C opcode for this frame. - -@return The AV/C opcode for this frame. -@publishedPartner -@released -*/ -EXPORT_C TUint8 CAVCFrame::Opcode() const - { - return iBuffer[KAVCFrameHeaderLength + iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes - 1]; - } - -/** Get the AV/C OperationId for this frame. - -This is only valid for passthrough commands. - -@param aOpId On return, the AV/C opcode for this frame. -@return KErrNotSupported if this is not a passthrough command, - KErrCorrupt if this passthrough command does not contain a OpId, - KErrNone otherwise. -@publishedPartner -@released -*/ -EXPORT_C TInt CAVCFrame::OperationId(TUint8& aOpId) const - { - TInt err = KErrNotSupported; - - if(Opcode() == AVC::EPassThrough) - { - if(DataLength()) - { - aOpId = (iBuffer[iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes + KAVCFrameHeaderLength]) & 0x7f; - err = KErrNone; - } - else - { - err = KErrCorrupt; - } - } - - return err; - } - -/** Get the AV/C button action for this frame. - -This is only valid for passthrough commands. - -@param aOpId On return, the AV/C button action for this frame. -@return KErrNotSupported if this is not a passthrough command, - KErrCorrupt if this passthrough command does not contain a button action, - KErrNone otherwise. -@publishedPartner -@released -*/ -EXPORT_C TInt CAVCFrame::ButtonAct(AVCPanel::TButtonAction& aButtonAction) const - { - TInt err = KErrNotSupported; - - if(Opcode() == AVC::EPassThrough) - { - if(DataLength()) - { - aButtonAction = (((iBuffer[iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes + KAVCFrameHeaderLength]) & 0x80) == AVCPanel::EButtonRelease) ? AVCPanel::EButtonRelease : AVCPanel::EButtonPress; - err = KErrNone; - } - else - { - err = KErrCorrupt; - } - } - return err; - } - -/** Retrieve data from the AV/C frame. - -@param aIndex The offset of the data element within the data segment of the frame -@return The data element at aIndex. -@panic If aIndex is outside the frame. DataLength() should be used to check the length of the data segment before using the [] operator. -@publishedPartner -@released -*/ -EXPORT_C const TUint8& CAVCFrame::operator[](TInt aIndex) const - { - return iBuffer[aIndex + iSubunitTypeExtensionBytes + iSubunitIDExtensionBytes + KAVCFrameHeaderLength]; - } - -/** Retrieve the entire AV/C frame. - -@return The AV/C frame. -@publishedPartner -@released -*/ -EXPORT_C const TDesC8& CAVCFrame::Data() const - { - return iBuffer; - } - -/** Append data to the AV/C frame. - -@param aDes The data to be appended. -@publishedPartner -@released -*/ -EXPORT_C void CAVCFrame::Append(const TDesC8& aDes) - { - iBuffer.Append(aDes); - } - -/** Append data to the AV/C frame. - -@param aChar The data to be appended. -@publishedPartner -@released -*/ -EXPORT_C void CAVCFrame::Append(TChar aChar) - { - iBuffer.Append(aChar); - } - -/** Return the length of the data in the AV/C frame - -@return The length of the data in the AV/C frame -@publishedPartner -@released -*/ -EXPORT_C TInt CAVCFrame::DataLength() const - { - return (iBuffer.Length() - iSubunitTypeExtensionBytes - iSubunitIDExtensionBytes - KAVCFrameHeaderLength); - } - -EXPORT_C CAVCFrame* CAVCVendorDependentResponse::NewL(TUint aVendorID) - { - using namespace AVC; - CAVCFrame* frame = CAVCFrame::NewL(EResponse, - ENotImplemented, //client can override - EPanel, - EID0); - // stupid frames don't know about themselves so we construct in derived classes - // first opcode - base class REALLY ought to have opcode setter - frame->Append(0); //opcode for VD frame - // second vendor - frame->Append(aVendorID>>16); - frame->Append(aVendorID>>8); - frame->Append(aVendorID); - return frame; - } - -EXPORT_C TPtrC8 CAVCVendorDependentCommand::GetPayloadAndVID(const CAVCFrame& aFrame, TUint& aVID) - { - ASSERT_DEBUG(aFrame.Opcode()==AVC::EVendorDependent); //opcode - aVID = (aFrame.operator[](0)<<16) | - (aFrame.operator[](1)<<8) | - (aFrame.operator[](2)); - - return (aFrame.Data().Right(aFrame.DataLength()-KAVCVendorIdLength)); - } - -EXPORT_C TPtrC8 CAVCVendorUniquePassthroughCommand::GetPayloadAndVID(const CAVCFrame& aFrame, TUint& aVID) - { - ASSERT_DEBUG(aFrame.Opcode()==AVC::EPassThrough); //opcode - aVID = (aFrame.operator[](2)<<16) | - (aFrame.operator[](3)<<8) | - (aFrame.operator[](4)); - - return (aFrame.Data().Right(aFrame.DataLength()-KAVCVendorIdLength-2)); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avc/avcframe.h --- a/bluetoothappprofiles/avrcp/avc/avcframe.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,540 +0,0 @@ -// Copyright (c) 2004-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: -// - -#ifndef AVCFRAME_H -#define AVCFRAME_H - -/** -@file -@released -@publishedPartner -*/ - -#include -#include - -static const TInt KAVCFrameMaxLength = 0x200; -static const TInt KAVCFrameHeaderLength = 0x3; -static const TInt KAVCPassthroughFrameLength = 0x5; -static const TUint8 KAVCCommandTypeMask = 0x0f; -static const TUint8 KAVCResponseTypeMask = 0x0f; -static const TUint8 KAVCSubunitTypeMask = 0xf8; -static const TUint8 KAVCSubunitIDMask = 0x07; -static const TUint8 KAVCCommandMaxRangeLength = 0x7; - -static const TUint KAVCVendorUniquePassthroughHeader = 7; -static const TUint KAVCVendorIdBaseOffset = 5; -static const TUint KAVCVendorIdLength = 3; - -static const TInt KAVCMaxVendorDependentPayload = KAVCFrameMaxLength-KAVCFrameHeaderLength-KAVCVendorIdLength; - -namespace AVC - { - enum TFrameType - { - ECommand, - EResponse - }; - /** - As per section 7.3.1, AV/C Digital Interface Command Set General Specification v4.0 - As per section 7.3.2, AV/C Digital Interface Command Set General Specification v4.0 - */ - enum TCType - { - EControl = 0x0, - EStatus = 0x1, - ESpecificEnquiry = 0x2, - ENotify = 0x3, - EGeneralEnquiry = 0x4, - EReserved1 = 0x5, - EReserved2 = 0x6, - EReserved3 = 0x7, - ENotImplemented = 0x8, - EAccepted = 0x9, - ERejected = 0xa, - EInTransition = 0xb, - EImplemented = 0xc, - EStable = 0xc, // NB: EImplemented and EStable are the same! - EChanged = 0xd, - EReserved4 = 0xe, - EInterim = 0xf - }; - /** - As per sections 7.3.4.1 and 7.3.4.3, AV/C Digital Interface Command Set General Specification v4.0 - - Extended subunit types should be coded as 0xXYY in this enumeration where - X is the nth extension and YY is the type number. e.g. 0x101 would correspond - to example 3 in table 7.9 and 0x201 would correspond to example 4. - */ - enum TSubunitType - { - EMonitor = 0x00, - EAudio = 0x01, - EPrinter = 0x02, - EDisc = 0x03, - ETape = 0x04, - ETuner = 0x05, - ECA = 0x06, - ECamera = 0x07, - EPanel = 0x09, - EBulletinBoard = 0x0a, - ECameraStorage = 0x0b, - EVendorUnique = 0x1c, - ETypeExtended1 = 0x1e, - EUnit = 0x1f, - ETypeExtended2 = 0xff - }; - /** - As per sections 7.3.4.1 and 7.3.4.3, AV/C Digital Interface Command Set General Specification v4.0 - - Extended subunit IDs should be coded as 0xXYY in this enumeration where - X is the nth extension and YY is the ID number. e.g. 0x102 would correspond - to example 2 in table 7.10 and 0x201 would correspond to example 3. - */ - enum TSubunitID - { - EID0 = 0x00, - EID1 = 0x01, - EID2 = 0x02, - EID3 = 0x04, - EIDExtended1 = 0x05, - EIgnore = 0x07, - EIDExtended2 = 0xff - }; - /** - As per section 10.1.2, AV/C Digital Interface Command Set General Specification v4.0 - - AV/C unit source plug addresses - */ - enum TUnitInputPlug - { - ESerialIsochronousInput0 = 0x00, - ESerialIsochronousInput1 = 0x01, - ESerialIsochronousInput2 = 0x02, - ESerialIsochronousInput3 = 0x03, - ESerialIsochronousInput4 = 0x04, - ESerialIsochronousInput5 = 0x05, - ESerialIsochronousInput6 = 0x06, - ESerialIsochronousInput7 = 0x07, - ESerialIsochronousInput8 = 0x08, - ESerialIsochronousInput9 = 0x09, - ESerialIsochronousInput10 = 0x0a, - ESerialIsochronousInput11 = 0x0b, - ESerialIsochronousInput12 = 0x0c, - ESerialIsochronousInput13 = 0x0d, - ESerialIsochronousInput14 = 0x0e, - ESerialIsochronousInput15 = 0x0f, - ESerialIsochronousInput16 = 0x10, - ESerialIsochronousInput17 = 0x11, - ESerialIsochronousInput18 = 0x12, - ESerialIsochronousInput19 = 0x13, - ESerialIsochronousInput20 = 0x14, - ESerialIsochronousInput21 = 0x15, - ESerialIsochronousInput22 = 0x16, - ESerialIsochronousInput23 = 0x17, - ESerialIsochronousInput24 = 0x18, - ESerialIsochronousInput25 = 0x19, - ESerialIsochronousInput26 = 0x1a, - ESerialIsochronousInput27 = 0x1b, - ESerialIsochronousInput28 = 0x1c, - ESerialIsochronousInput29 = 0x1d, - ESerialIsochronousInput30 = 0x1e, - EAnySerialIsochronousInput = 0x7f, - EExternalInput0 = 0x80, - EExternalInput1 = 0x81, - EExternalInput2 = 0x82, - EExternalInput3 = 0x83, - EExternalInput4 = 0x84, - EExternalInput5 = 0x85, - EExternalInput6 = 0x86, - EExternalInput7 = 0x87, - EExternalInput8 = 0x88, - EExternalInput9 = 0x89, - EExternalInput10 = 0x8a, - EExternalInput11 = 0x8b, - EExternalInput12 = 0x8c, - EExternalInput13 = 0x8d, - EExternalInput14 = 0x8e, - EExternalInput15 = 0x8f, - EExternalInput16 = 0x90, - EExternalInput17 = 0x91, - EExternalInput18 = 0x92, - EExternalInput19 = 0x93, - EExternalInput20 = 0x94, - EExternalInput21 = 0x95, - EExternalInput22 = 0x96, - EExternalInput23 = 0x97, - EExternalInput24 = 0x98, - EExternalInput25 = 0x99, - EExternalInput26 = 0x9a, - EExternalInput27 = 0x9b, - EExternalInput28 = 0x9c, - EExternalInput29 = 0x9d, - EExternalInput30 = 0x9e, - ESerialAsynchronousInput0 = 0xa0, - ESerialAsynchronousInput1 = 0xa1, - ESerialAsynchronousInput2 = 0xa2, - ESerialAsynchronousInput3 = 0xa3, - ESerialAsynchronousInput4 = 0xa4, - ESerialAsynchronousInput5 = 0xa5, - ESerialAsynchronousInput6 = 0xa6, - ESerialAsynchronousInput7 = 0xa7, - ESerialAsynchronousInput8 = 0xa8, - ESerialAsynchronousInput9 = 0xa9, - ESerialAsynchronousInput10 = 0xaa, - ESerialAsynchronousInput11 = 0xab, - ESerialAsynchronousInput12 = 0xac, - ESerialAsynchronousInput13 = 0xad, - ESerialAsynchronousInput14 = 0xae, - ESerialAsynchronousInput15 = 0xaf, - ESerialAsynchronousInput16 = 0xb0, - ESerialAsynchronousInput17 = 0xb1, - ESerialAsynchronousInput18 = 0xb2, - ESerialAsynchronousInput19 = 0xb3, - ESerialAsynchronousInput20 = 0xb4, - ESerialAsynchronousInput21 = 0xb5, - ESerialAsynchronousInput22 = 0xb6, - ESerialAsynchronousInput23 = 0xb7, - ESerialAsynchronousInput24 = 0xb8, - ESerialAsynchronousInput25 = 0xb9, - ESerialAsynchronousInput26 = 0xba, - ESerialAsynchronousInput27 = 0xbb, - ESerialAsynchronousInput28 = 0xbc, - ESerialAsynchronousInput29 = 0xbd, - ESerialAsynchronousInput30 = 0xbe, - EAnySerialAsynchronousInput = 0xbf, - EInvalidInput = 0xfe, - EAnyExternalInput = 0xff - }; - /** - As per section 10.1.2, AV/C Digital Interface Command Set General Specification v4.0 - - AV/C unit destination plug addresses - */ - enum TUnitOutputPlug - { - ESerialIsochronousOutput0 = 0x00, - ESerialIsochronousOutput1 = 0x01, - ESerialIsochronousOutput2 = 0x02, - ESerialIsochronousOutput3 = 0x03, - ESerialIsochronousOutput4 = 0x04, - ESerialIsochronousOutput5 = 0x05, - ESerialIsochronousOutput6 = 0x06, - ESerialIsochronousOutput7 = 0x07, - ESerialIsochronousOutput8 = 0x08, - ESerialIsochronousOutput9 = 0x09, - ESerialIsochronousOutput10 = 0x0a, - ESerialIsochronousOutput11 = 0x0b, - ESerialIsochronousOutput12 = 0x0c, - ESerialIsochronousOutput13 = 0x0d, - ESerialIsochronousOutput14 = 0x0e, - ESerialIsochronousOutput15 = 0x0f, - ESerialIsochronousOutput16 = 0x10, - ESerialIsochronousOutput17 = 0x11, - ESerialIsochronousOutput18 = 0x12, - ESerialIsochronousOutput19 = 0x13, - ESerialIsochronousOutput20 = 0x14, - ESerialIsochronousOutput21 = 0x15, - ESerialIsochronousOutput22 = 0x16, - ESerialIsochronousOutput23 = 0x17, - ESerialIsochronousOutput24 = 0x18, - ESerialIsochronousOutput25 = 0x19, - ESerialIsochronousOutput26 = 0x1a, - ESerialIsochronousOutput27 = 0x1b, - ESerialIsochronousOutput28 = 0x1c, - ESerialIsochronousOutput29 = 0x1d, - ESerialIsochronousOutput30 = 0x1e, - EAnySerialIsochronousOutput = 0x7f, - EExternalOutput0 = 0x80, - EExternalOutput1 = 0x81, - EExternalOutput2 = 0x82, - EExternalOutput3 = 0x83, - EExternalOutput4 = 0x84, - EExternalOutput5 = 0x85, - EExternalOutput6 = 0x86, - EExternalOutput7 = 0x87, - EExternalOutput8 = 0x88, - EExternalOutput9 = 0x89, - EExternalOutput10 = 0x8a, - EExternalOutput11 = 0x8b, - EExternalOutput12 = 0x8c, - EExternalOutput13 = 0x8d, - EExternalOutput14 = 0x8e, - EExternalOutput15 = 0x8f, - EExternalOutput16 = 0x90, - EExternalOutput17 = 0x91, - EExternalOutput18 = 0x92, - EExternalOutput19 = 0x93, - EExternalOutput20 = 0x94, - EExternalOutput21 = 0x95, - EExternalOutput22 = 0x96, - EExternalOutput23 = 0x97, - EExternalOutput24 = 0x98, - EExternalOutput25 = 0x99, - EExternalOutput26 = 0x9a, - EExternalOutput27 = 0x9b, - EExternalOutput28 = 0x9c, - EExternalOutput29 = 0x9d, - EExternalOutput30 = 0x9e, - ESerialAsynchronousOutput0 = 0xa0, - ESerialAsynchronousOutput1 = 0xa1, - ESerialAsynchronousOutput2 = 0xa2, - ESerialAsynchronousOutput3 = 0xa3, - ESerialAsynchronousOutput4 = 0xa4, - ESerialAsynchronousOutput5 = 0xa5, - ESerialAsynchronousOutput6 = 0xa6, - ESerialAsynchronousOutput7 = 0xa7, - ESerialAsynchronousOutput8 = 0xa8, - ESerialAsynchronousOutput9 = 0xa9, - ESerialAsynchronousOutput10 = 0xaa, - ESerialAsynchronousOutput11 = 0xab, - ESerialAsynchronousOutput12 = 0xac, - ESerialAsynchronousOutput13 = 0xad, - ESerialAsynchronousOutput14 = 0xae, - ESerialAsynchronousOutput15 = 0xaf, - ESerialAsynchronousOutput16 = 0xb0, - ESerialAsynchronousOutput17 = 0xb1, - ESerialAsynchronousOutput18 = 0xb2, - ESerialAsynchronousOutput19 = 0xb3, - ESerialAsynchronousOutput20 = 0xb4, - ESerialAsynchronousOutput21 = 0xb5, - ESerialAsynchronousOutput22 = 0xb6, - ESerialAsynchronousOutput23 = 0xb7, - ESerialAsynchronousOutput24 = 0xb8, - ESerialAsynchronousOutput25 = 0xb9, - ESerialAsynchronousOutput26 = 0xba, - ESerialAsynchronousOutput27 = 0xbb, - ESerialAsynchronousOutput28 = 0xbc, - ESerialAsynchronousOutput29 = 0xbd, - ESerialAsynchronousOutput30 = 0xbe, - EAnySerialAsynchronousOutput= 0xbf, - EMultipleOutputs = 0xfd, - EInvalidOutput = 0xfe, - EAnyExternalOutput = 0xff - }; - /** - As per section 10.2.3, AV/C Digital Interface Command Set General Specification v4.0 - - AV/C subunit source plug addresses - subunit does not have to implement any subunit plug if it does not send or receive any signals - */ - enum TSubunitSourcePlug - { - ESource0 = 0x00, - ESource1 = 0x01, - ESource2 = 0x02, - ESource3 = 0x03, - ESource4 = 0x04, - ESource5 = 0x05, - ESource6 = 0x06, - ESource7 = 0x07, - ESource8 = 0x08, - ESource9 = 0x09, - ESource10 = 0x0a, - ESource11 = 0x0b, - ESource12 = 0x0c, - ESource13 = 0x0d, - ESource14 = 0x0e, - ESource15 = 0x0f, - ESource16 = 0x10, - ESource17 = 0x11, - ESource18 = 0x12, - ESource19 = 0x13, - ESource20 = 0x14, - ESource21 = 0x15, - ESource22 = 0x16, - ESource23 = 0x17, - ESource24 = 0x18, - ESource25 = 0x19, - ESource26 = 0x1a, - ESource27 = 0x1b, - ESource28 = 0x1c, - ESource29 = 0x1d, - ESource30 = 0x1e, - EInvalidSource = 0xfe, - EAnySource = 0xff - }; - /** - As per section 10.2.3, AV/C Digital Interface Command Set General Specification v4.0 - - AV/C subunit destination plug - subunit does not have to implement any subunit plug if it does not send or receive any signals - */ - enum TSubunitDestinationPlug - { - EDestination0 = 0x00, - EDestination1 = 0x01, - EDestination2 = 0x02, - EDestination3 = 0x03, - EDestination4 = 0x04, - EDestination5 = 0x05, - EDestination6 = 0x06, - EDestination7 = 0x07, - EDestination8 = 0x08, - EDestination9 = 0x09, - EDestination10 = 0x0a, - EDestination11 = 0x0b, - EDestination12 = 0x0c, - EDestination13 = 0x0d, - EDestination14 = 0x0e, - EDestination15 = 0x0f, - EDestination16 = 0x10, - EDestination17 = 0x11, - EDestination18 = 0x12, - EDestination19 = 0x13, - EDestination20 = 0x14, - EDestination21 = 0x15, - EDestination22 = 0x16, - EDestination23 = 0x17, - EDestination24 = 0x18, - EDestination25 = 0x19, - EDestination26 = 0x1a, - EDestination27 = 0x1b, - EDestination28 = 0x1c, - EDestination29 = 0x1d, - EDestination30 = 0x1e, - EMultipleDestinations = 0xfe, - EInvalidDestination = 0xfe, - EAnyDestination = 0xff - }; - /** - As per sections 11 and 12, AV/C Digital Interface Command Set General Specification v4.0 - Other commands are defined by the various subunit specifications - */ - enum TOpcode - { - EPower = 0xb2, - EUnitInfo = 0x30, - ESubunitInfo = 0x31, - EReserve = 0x01, - EVersion = 0xb0, - EVendorDependent = 0x00, - EPlugInfo = 0x02, - EChannelUsage = 0x12, - EConnect = 0x24, - EConnectAV = 0x20, - EConnections = 0x22, - EDigitalInput = 0x11, - EDigitalOutput = 0x10, - EDisconnect = 0x25, - EDisconnectAV = 0x21, - EInputPlugSignalFormat = 0x19, - EOutputPlugSignalFormat = 0x18, - EPassThrough = 0x7c - }; - - enum TPacketType - { - EASingle = 0x00, - EStart = 0x01, - EContinue = 0x10, - EEnd = 0x11, - }; - - typedef TUint TAVCVendorId; - } - -/** -AVC frame creation and utilities. -@released -@publishedPartner -*/ -NONSHARABLE_CLASS(CAVCFrame) : public CBase - { -public: - - // Construction / destruction - // TBH this acts as a factory now and could (eventually!) return a derived class - // the caller could check by calling Opcode - // at the moment we are going to use the derived classes just for outbound responses - IMPORT_C static CAVCFrame* NewL(AVC::TFrameType aFrameType, - AVC::TCType aType, - AVC::TSubunitType aSubunitType, - AVC::TSubunitID aSubunitID); - - IMPORT_C static CAVCFrame* NewL(const TDesC8& aBuffer, AVC::TFrameType aType); - - IMPORT_C virtual ~CAVCFrame(); - - // Utility - IMPORT_C AVC::TFrameType FrameType() const; - IMPORT_C static AVC::TFrameType FrameType(const TDesC8& aFrame); - IMPORT_C void SetFrameType(AVC::TFrameType aFrameType); - - IMPORT_C AVC::TCType Type() const; - IMPORT_C void SetType(AVC::TCType aType); - - IMPORT_C AVC::TSubunitType SubunitType() const; - IMPORT_C AVC::TSubunitID SubunitID() const; - IMPORT_C TUint8 Opcode() const; - IMPORT_C TInt OperationId(TUint8& aOpId) const; - IMPORT_C TInt ButtonAct(AVCPanel::TButtonAction& aButtonAction) const; - - IMPORT_C const TUint8& operator[](TInt aIndex) const; - IMPORT_C const TDesC8& Data() const; - - IMPORT_C void Append(const TDesC8& aDes); - IMPORT_C void Append(TChar aChar); - IMPORT_C TInt DataLength() const; - - IMPORT_C static AVC::TOpcode OpcodeL(const TDesC8& aBuffer); - -private: - CAVCFrame(AVC::TFrameType aFrameType); - - void ConstructL(AVC::TCType aType, - AVC::TSubunitType aSubunitType, - AVC::TSubunitID aSubunitID); - void ConstructL(const TDesC8& aBuffer); - static void FindExtensionL(const TDesC8& aBuffer, TInt& aSubunitTypeExtensionBytes, TInt& aSubunitIDExtensionBytes); - -private: - RBuf8 iBuffer; - - AVC::TFrameType iFrameType; - TInt iSubunitTypeExtensionBytes; - TInt iSubunitIDExtensionBytes; - }; - - -// Factory pattern stuff - these are useful to do donkey work, -// but have existing clients treat them as the base class - -class CAVCVendorDependentResponse // codescanner::missingcclass - { -public: - IMPORT_C static CAVCFrame* NewL(TUint aVendorId); - }; - -class CAVCPassthroughCommand // codescanner::missingcclass - { -public: - }; - -// likely not have newl because dont allocate on parse pattern -class CAVCVendorDependentCommand // codescanner::missingcclass - { -public: - IMPORT_C static TPtrC8 GetPayloadAndVID(const CAVCFrame& aFrame, TUint& aVID); - }; - -// likely not have newl because dont allocate on parse pattern -class CAVCVendorUniquePassthroughCommand // codescanner::missingcclass - { -public: - IMPORT_C static TPtrC8 GetPayloadAndVID(const CAVCFrame& aFrame, TUint& aVID); - }; - -#endif // AVCFRAME_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avc/avcpanel.h --- a/bluetoothappprofiles/avrcp/avc/avcpanel.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef AVCPANEL_H -#define AVCPANEL_H - -/** -@file -@publishedPartner -@released -*/ - -namespace AVCPanel - { - enum TOperationId - { - ESelect = 0x00, - EUp = 0x01, - EDown = 0x02, - ELeft = 0x03, - ERight = 0x04, - ERightUp = 0x05, - ERightDown = 0x06, - ELeftUp = 0x07, - ELeftDown = 0x08, - ERootMenu = 0x09, - ESetupMenu = 0x0a, - EContentsMenu = 0x0b, - EFavoriteMenu = 0x0c, - EExit = 0x0d, - E0 = 0x20, - E1 = 0x21, - E2 = 0x22, - E3 = 0x23, - E4 = 0x24, - E5 = 0x25, - E6 = 0x26, - E7 = 0x27, - E8 = 0x28, - E9 = 0x29, - EDot = 0x2a, - EEnter = 0x2b, - EClear = 0x2c, - EChannelUp = 0x30, - EChannelDown = 0x31, - EPreviousChannel = 0x32, - ESoundSelect = 0x33, - EInputSelect = 0x34, - EDisplayInformation = 0x35, - EHelp = 0x36, - EPageUp = 0x37, - EPageDown = 0x38, - EPower = 0x40, - EVolumeUp = 0x41, - EVolumeDown = 0x42, - EMute = 0x43, - EPlay = 0x44, - EStop = 0x45, - EPause = 0x46, - ERecord = 0x47, - ERewind = 0x48, - EFastForward = 0x49, - EEject = 0x4a, - EForward = 0x4b, - EBackward = 0x4c, - EAngle = 0x50, - ESubpicture = 0x51, - EF1 = 0x71, - EF2 = 0x72, - EF3 = 0x73, - EF4 = 0x74, - EF5 = 0x75, - EVendorUnique = 0x7e - }; - - enum TButtonAction - { - EButtonPress = 0x0 << 7, - EButtonRelease = 0x1 << 7, - EButtonUnknown = 0x0 << 7 // Default to push - }; - } - -#endif // AVCPANEL_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avc/bld.inf --- a/bluetoothappprofiles/avrcp/avc/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent -*/ - -PRJ_EXPORTS -avcframe.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(avcframe.h) -avcpanel.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(avcpanel.h) - -PRJ_MMPFILES -avc.mmp diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/bwins/avrcpipcu.def --- a/bluetoothappprofiles/avrcp/avrcpipc/bwins/avrcpipcu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -EXPORTS - ?Close@REAResponse@@QAEXXZ @ 1 NONAME ; void REAResponse::Close(void) - ?Close@RItem@@QAEXXZ @ 2 NONAME ; void RItem::Close(void) - ?Close@RRemConGetCapabilitiesResponse@@QAEXXZ @ 3 NONAME ; void RRemConGetCapabilitiesResponse::Close(void) - ?Close@RRemConGetElementAttributesRequest@@QAEXXZ @ 4 NONAME ; void RRemConGetElementAttributesRequest::Close(void) - ?Close@RRemConGetElementAttributesResponse@@QAEXXZ @ 5 NONAME ; void RRemConGetElementAttributesResponse::Close(void) - ?Close@RRemConGetFolderItemsRequest@@QAEXXZ @ 6 NONAME ; void RRemConGetFolderItemsRequest::Close(void) - ?Close@RRemConGetFolderItemsResponse@@QAEXXZ @ 7 NONAME ; void RRemConGetFolderItemsResponse::Close(void) - ?Close@RRemConGetItemAttributesRequest@@QAEXXZ @ 8 NONAME ; void RRemConGetItemAttributesRequest::Close(void) - ?Close@RRemConGetItemAttributesResponse@@QAEXXZ @ 9 NONAME ; void RRemConGetItemAttributesResponse::Close(void) - ?Close@RRemConGetPlayerApplicationTextResponse@@QAEXXZ @ 10 NONAME ; void RRemConGetPlayerApplicationTextResponse::Close(void) - ?Close@RRemConPlayerAttributeIdsAndValues@@QAEXXZ @ 11 NONAME ; void RRemConPlayerAttributeIdsAndValues::Close(void) - ?Close@RRemConPlayerListOfAttributes@@QAEXXZ @ 12 NONAME ; void RRemConPlayerListOfAttributes::Close(void) - ?Close@RRemConSearchRequest@@QAEXXZ @ 13 NONAME ; void RRemConSearchRequest::Close(void) - ?Close@RAvrcpGetFolderItemsResponse@@QAEXXZ @ 14 NONAME ; void RAvrcpGetFolderItemsResponse::Close(void) - ?WriteL@RRemConPlayerInformation32BitResponse@@UAEXAAVTDes8@@@Z @ 15 NONAME ; void RRemConPlayerInformation32BitResponse::WriteL(class TDes8 &) - ?WriteL@RRemConPlayerInformation8BitResponse@@UAEXAAVTDes8@@@Z @ 16 NONAME ; void RRemConPlayerInformation8BitResponse::WriteL(class TDes8 &) - ?WriteL@RRemConPlayerInformationGetPlayStatusResponse@@UAEXAAVTDes8@@@Z @ 17 NONAME ; void RRemConPlayerInformationGetPlayStatusResponse::WriteL(class TDes8 &) - ?ReadL@RRemConSearchRequest@@UAEXABVTDesC8@@@Z @ 18 NONAME ; void RRemConSearchRequest::ReadL(class TDesC8 const &) - ?ReadL@RRemConGetElementAttributesResponse@@UAEXABVTDesC8@@@Z @ 19 NONAME ; void RRemConGetElementAttributesResponse::ReadL(class TDesC8 const &) - ?Size@RRemConGetElementAttributesResponse@@QAEHXZ @ 20 NONAME ; int RRemConGetElementAttributesResponse::Size(void) - ?Size@RMediaPlayerItem@@QAEHXZ @ 21 NONAME ; int RMediaPlayerItem::Size(void) - ?Size@RRemConGetFolderItemsResponse@@QAEHXZ @ 22 NONAME ; int RRemConGetFolderItemsResponse::Size(void) - ?WriteL@RRemConGetCapabilitiesResponse@@UAEXAAVTDes8@@@Z @ 23 NONAME ; void RRemConGetCapabilitiesResponse::WriteL(class TDes8 &) - ?WriteL@RRemConGetFolderItemsResponse@@UAEXAAVTDes8@@@Z @ 24 NONAME ; void RRemConGetFolderItemsResponse::WriteL(class TDes8 &) - ?WriteL@RRemConGetElementAttributesResponse@@UAEXAAVTDes8@@@Z @ 25 NONAME ; void RRemConGetElementAttributesResponse::WriteL(class TDes8 &) - ?CopyAttributes@RRemConGetFolderItemsRequest@@QAEHAAV?$RArray@W4TMediaAttributeId@@@@@Z @ 26 NONAME ; int RRemConGetFolderItemsRequest::CopyAttributes(class RArray &) - ?WriteL@RRemConPlayerListOfAttributes@@UAEXAAVTDes8@@@Z @ 27 NONAME ; void RRemConPlayerListOfAttributes::WriteL(class TDes8 &) - ?WriteL@RAvrcpIPCError@@UAEXAAVTDes8@@@Z @ 28 NONAME ; void RAvrcpIPCError::WriteL(class TDes8 &) - ?WriteL@RAvrcpGetFolderItemsRequest@@UAEXAAVTDes8@@@Z @ 29 NONAME ; void RAvrcpGetFolderItemsRequest::WriteL(class TDes8 &) - ?ReadL@RRemConPlayerAttributeIdsAndValues@@UAEXABVTDesC8@@@Z @ 30 NONAME ; void RRemConPlayerAttributeIdsAndValues::ReadL(class TDesC8 const &) - ?CopyItems@RRemConGetFolderItemsResponse@@QAEHABV?$TArray@VTRemConItem@@@@@Z @ 31 NONAME ; int RRemConGetFolderItemsResponse::CopyItems(class TArray const &) - ?Remove@TRemConMessageQueue@@QAEXAAVCRemConQueuedMessage@@@Z @ 32 NONAME ; void TRemConMessageQueue::Remove(class CRemConQueuedMessage &) - ?Find@TRemConMessageQueue@@QAEPBVCRemConQueuedMessage@@VTUid@@H@Z @ 33 NONAME ; class CRemConQueuedMessage const * TRemConMessageQueue::Find(class TUid, int) - ?Close@RMediaPlayerItem@@QAEXXZ @ 34 NONAME ; void RMediaPlayerItem::Close(void) - ?NewL@CRemConQueuedMessage@@SAPAV1@VTUid@@ABVTDesC8@@H@Z @ 35 NONAME ; class CRemConQueuedMessage * CRemConQueuedMessage::NewL(class TUid, class TDesC8 const &, int) - ?WriteL@RRemConChangePathResponse@@UAEXAAVTDes8@@@Z @ 36 NONAME ; void RRemConChangePathResponse::WriteL(class TDes8 &) - ?ReadL@RAvrcpSetAddressedPlayerResponse@@UAEXABVTDesC8@@@Z @ 37 NONAME ; void RAvrcpSetAddressedPlayerResponse::ReadL(class TDesC8 const &) - ?WriteL@RRemConUidsChangedResponse@@UAEXAAVTDes8@@@Z @ 38 NONAME ; void RRemConUidsChangedResponse::WriteL(class TDes8 &) - ?WriteL@RRemConGetFolderItemsRequest@@UAEXAAVTDes8@@@Z @ 39 NONAME ; void RRemConGetFolderItemsRequest::WriteL(class TDes8 &) - ?WriteL@RAvrcpGetFolderItemsResponse@@UAEXAAVTDes8@@@Z @ 40 NONAME ; void RAvrcpGetFolderItemsResponse::WriteL(class TDes8 &) - ?ReadL@RAvrcpGetFolderItemsResponse@@UAEXABVTDesC8@@@Z @ 41 NONAME ; void RAvrcpGetFolderItemsResponse::ReadL(class TDesC8 const &) - ?ReadL@RAvrcpGetFolderItemsRequest@@UAEXABVTDesC8@@@Z @ 42 NONAME ; void RAvrcpGetFolderItemsRequest::ReadL(class TDesC8 const &) - ?ReadL@RRemConNowPlayingResponse@@UAEXABVTDesC8@@@Z @ 43 NONAME ; void RRemConNowPlayingResponse::ReadL(class TDesC8 const &) - ?IsEmpty@TRemConMessageQueue@@QAEHXZ @ 44 NONAME ; int TRemConMessageQueue::IsEmpty(void) - ?SymbianErrToStatus@RAvrcpIPC@@SAEH@Z @ 45 NONAME ; unsigned char RAvrcpIPC::SymbianErrToStatus(int) - ?First@TRemConMessageQueue@@QBEPAVCRemConQueuedMessage@@XZ @ 46 NONAME ; class CRemConQueuedMessage * TRemConMessageQueue::First(void) const - ?Reset@TRemConMessageQueue@@QAEXXZ @ 47 NONAME ; void TRemConMessageQueue::Reset(void) - ?WriteL@RAvrcpSetAddressedPlayerResponse@@UAEXAAVTDes8@@@Z @ 48 NONAME ; void RAvrcpSetAddressedPlayerResponse::WriteL(class TDes8 &) - ?ReadL@RRemConMediaErrorResponse@@UAEXABVTDesC8@@@Z @ 49 NONAME ; void RRemConMediaErrorResponse::ReadL(class TDesC8 const &) - ?SymbianErrorCheck@RAvrcpIPC@@SAHH@Z @ 50 NONAME ; int RAvrcpIPC::SymbianErrorCheck(int) - ?GetEventIdFromIPCOperationId@RAvrcpIPC@@SA?AW4TRegisterNotificationEvent@@H@Z @ 51 NONAME ; enum TRegisterNotificationEvent RAvrcpIPC::GetEventIdFromIPCOperationId(int) - ?WriteL@RRemConSetBrowsedPlayerRequest@@UAEXAAVTDes8@@@Z @ 52 NONAME ; void RRemConSetBrowsedPlayerRequest::WriteL(class TDes8 &) - ?WriteL@RRemConGetElementAttributesRequest@@UAEXAAVTDes8@@@Z @ 53 NONAME ; void RRemConGetElementAttributesRequest::WriteL(class TDes8 &) - ?AddLast@TRemConMessageQueue@@QAEXAAVCRemConQueuedMessage@@@Z @ 54 NONAME ; void TRemConMessageQueue::AddLast(class CRemConQueuedMessage &) - ?WriteL@RRemConGetPathResponse@@UAEXAAVTDes8@@@Z @ 55 NONAME ; void RRemConGetPathResponse::WriteL(class TDes8 &) - ?Size@RRemConGetItemAttributesResponse@@QAEHXZ @ 56 NONAME ; int RRemConGetItemAttributesResponse::Size(void) - ?ReadL@RRemConNowPlayingRequest@@UAEXABVTDesC8@@@Z @ 57 NONAME ; void RRemConNowPlayingRequest::ReadL(class TDesC8 const &) - ?ReadL@RAvrcpSetAddressedPlayerRequest@@UAEXABVTDesC8@@@Z @ 58 NONAME ; void RAvrcpSetAddressedPlayerRequest::ReadL(class TDesC8 const &) - ?WriteL@RRemConPlayerInformation64BitResponse@@UAEXAAVTDes8@@@Z @ 59 NONAME ; void RRemConPlayerInformation64BitResponse::WriteL(class TDes8 &) - ?WriteL@RRemConSearchResponse@@UAEXAAVTDes8@@@Z @ 60 NONAME ; void RRemConSearchResponse::WriteL(class TDes8 &) - ?ReadL@RRemConPlayerInformation64BitResponse@@UAEXABVTDesC8@@@Z @ 61 NONAME ; void RRemConPlayerInformation64BitResponse::ReadL(class TDesC8 const &) - ?ReadL@RRemConPlayerInformation8BitResponse@@UAEXABVTDesC8@@@Z @ 62 NONAME ; void RRemConPlayerInformation8BitResponse::ReadL(class TDesC8 const &) - ?WriteL@RRemConNowPlayingRequest@@UAEXAAVTDes8@@@Z @ 63 NONAME ; void RRemConNowPlayingRequest::WriteL(class TDes8 &) - ?Size@RRemConGetPlayerApplicationTextResponse@@QAEHXZ @ 64 NONAME ; int RRemConGetPlayerApplicationTextResponse::Size(void) - ?ReadL@RRemConPlayerListOfAttributes@@UAEXABVTDesC8@@@Z @ 65 NONAME ; void RRemConPlayerListOfAttributes::ReadL(class TDesC8 const &) - ?WriteL@RRemConPlayerAttributeIdsAndValues@@UAEXAAVTDes8@@@Z @ 66 NONAME ; void RRemConPlayerAttributeIdsAndValues::WriteL(class TDes8 &) - ?Size@RItem@@QAEHXZ @ 67 NONAME ; int RItem::Size(void) - ?WriteL@RRemConGetItemAttributesRequest@@UAEXAAVTDes8@@@Z @ 68 NONAME ; void RRemConGetItemAttributesRequest::WriteL(class TDes8 &) - ?WriteL@RRemConChangePathRequest@@UAEXAAVTDes8@@@Z @ 69 NONAME ; void RRemConChangePathRequest::WriteL(class TDes8 &) - ?WriteL@RRemConGetItemAttributesResponse@@UAEXAAVTDes8@@@Z @ 70 NONAME ; void RRemConGetItemAttributesResponse::WriteL(class TDes8 &) - ?Size@RRemConSearchRequest@@QAEHXZ @ 71 NONAME ; int RRemConSearchRequest::Size(void) - ?ReadL@RAvrcpAddressedPlayerNotificationResponse@@UAEXABVTDesC8@@@Z @ 72 NONAME ; void RAvrcpAddressedPlayerNotificationResponse::ReadL(class TDesC8 const &) - ?RequestNextItem@RRemConGetFolderItemsResponse@@QAEHAAHAAVRBuf8@@G@Z @ 73 NONAME ; int RRemConGetFolderItemsResponse::RequestNextItem(int &, class RBuf8 &, unsigned short) - ?ReadL@RRemConPlayerInformation32BitResponse@@UAEXABVTDesC8@@@Z @ 74 NONAME ; void RRemConPlayerInformation32BitResponse::ReadL(class TDesC8 const &) - ?Size@RRemConGetPathResponse@@QAEHXZ @ 75 NONAME ; int RRemConGetPathResponse::Size(void) - ??0TRemConMessageQueue@@QAE@XZ @ 76 NONAME ; TRemConMessageQueue::TRemConMessageQueue(void) - ?ReadL@RRemConGetItemAttributesRequest@@UAEXABVTDesC8@@@Z @ 77 NONAME ; void RRemConGetItemAttributesRequest::ReadL(class TDesC8 const &) - ?ReadL@RRemConGetItemAttributesResponse@@UAEXABVTDesC8@@@Z @ 78 NONAME ; void RRemConGetItemAttributesResponse::ReadL(class TDesC8 const &) - ?ReadL@RRemConGetPlayerApplicationTextResponse@@UAEXABVTDesC8@@@Z @ 79 NONAME ; void RRemConGetPlayerApplicationTextResponse::ReadL(class TDesC8 const &) - ?SetIPCOperationIdFromEventId@RAvrcpIPC@@SAHW4TRegisterNotificationEvent@@@Z @ 80 NONAME ; int RAvrcpIPC::SetIPCOperationIdFromEventId(enum TRegisterNotificationEvent) - ?Data@CRemConQueuedMessage@@QAEABVTDesC8@@XZ @ 81 NONAME ; class TDesC8 const & CRemConQueuedMessage::Data(void) - ?WriteL@RRemConNowPlayingResponse@@UAEXAAVTDes8@@@Z @ 82 NONAME ; void RRemConNowPlayingResponse::WriteL(class TDes8 &) - ?ReadL@RRemConPlayerInformationGetPlayStatusResponse@@UAEXABVTDesC8@@@Z @ 83 NONAME ; void RRemConPlayerInformationGetPlayStatusResponse::ReadL(class TDesC8 const &) - ?ReadL@RRemConGetFolderItemsRequest@@UAEXABVTDesC8@@@Z @ 84 NONAME ; void RRemConGetFolderItemsRequest::ReadL(class TDesC8 const &) - ?Close@RSettingWithCharset@@QAEXXZ @ 85 NONAME ; void RSettingWithCharset::Close(void) - ?ReadL@RAvrcpIPCError@@UAEXABVTDesC8@@@Z @ 86 NONAME ; void RAvrcpIPCError::ReadL(class TDesC8 const &) - ?WriteL@RRemConMediaErrorResponse@@UAEXAAVTDes8@@@Z @ 87 NONAME ; void RRemConMediaErrorResponse::WriteL(class TDes8 &) - ?ReadL@RRemConGetPathResponse@@UAEXABVTDesC8@@@Z @ 88 NONAME ; void RRemConGetPathResponse::ReadL(class TDesC8 const &) - ?ReadL@RRemConSearchResponse@@UAEXABVTDesC8@@@Z @ 89 NONAME ; void RRemConSearchResponse::ReadL(class TDesC8 const &) - ?ReadL@RRemConSetBrowsedPlayerRequest@@UAEXABVTDesC8@@@Z @ 90 NONAME ; void RRemConSetBrowsedPlayerRequest::ReadL(class TDesC8 const &) - ?ReadL@RRemConChangePathResponse@@UAEXABVTDesC8@@@Z @ 91 NONAME ; void RRemConChangePathResponse::ReadL(class TDesC8 const &) - ?ReadL@RRemConGetCapabilitiesResponse@@UAEXABVTDesC8@@@Z @ 92 NONAME ; void RRemConGetCapabilitiesResponse::ReadL(class TDesC8 const &) - ?ReadL@RRemConUidsChangedResponse@@UAEXABVTDesC8@@@Z @ 93 NONAME ; void RRemConUidsChangedResponse::ReadL(class TDesC8 const &) - ?GetPDUIdFromIPCOperationId@RAvrcpIPC@@SA?AW4TMetadataTransferPDU@@H@Z @ 94 NONAME ; enum TMetadataTransferPDU RAvrcpIPC::GetPDUIdFromIPCOperationId(int) - ?Size@RAvrcpGetFolderItemsResponse@@QAEHXZ @ 95 NONAME ; int RAvrcpGetFolderItemsResponse::Size(void) - ?ReadL@RRemConChangePathRequest@@UAEXABVTDesC8@@@Z @ 96 NONAME ; void RRemConChangePathRequest::ReadL(class TDesC8 const &) - ?ReadL@RRemConGetFolderItemsResponse@@UAEXABVTDesC8@@@Z @ 97 NONAME ; void RRemConGetFolderItemsResponse::ReadL(class TDesC8 const &) - ?Close@RRemConGetPathResponse@@QAEXXZ @ 98 NONAME ; void RRemConGetPathResponse::Close(void) - ?ReadL@RRemConGetElementAttributesRequest@@UAEXABVTDesC8@@@Z @ 99 NONAME ; void RRemConGetElementAttributesRequest::ReadL(class TDesC8 const &) - ??1CRemConQueuedMessage@@UAE@XZ @ 100 NONAME ; CRemConQueuedMessage::~CRemConQueuedMessage(void) - ?WriteL@RRemConSearchRequest@@UAEXAAVTDes8@@@Z @ 101 NONAME ; void RRemConSearchRequest::WriteL(class TDes8 &) - ?WriteL@RRemConGetPlayerApplicationTextResponse@@UAEXAAVTDes8@@@Z @ 102 NONAME ; void RRemConGetPlayerApplicationTextResponse::WriteL(class TDes8 &) - ?WriteL@RAvrcpAddressedPlayerNotificationResponse@@UAEXAAVTDes8@@@Z @ 103 NONAME ; void RAvrcpAddressedPlayerNotificationResponse::WriteL(class TDes8 &) - ?WriteL@RAvrcpSetAddressedPlayerRequest@@UAEXAAVTDes8@@@Z @ 104 NONAME ; void RAvrcpSetAddressedPlayerRequest::WriteL(class TDes8 &) - ?Close@RAvrcpGetFolderItemsRequest@@QAEXXZ @ 105 NONAME ; void RAvrcpGetFolderItemsRequest::Close(void) - ?ReadL@RRemConUidsChangedRequest@@UAEXABVTDesC8@@@Z @ 106 NONAME ; void RRemConUidsChangedRequest::ReadL(class TDesC8 const &) - ?WriteL@RRemConUidsChangedRequest@@UAEXAAVTDes8@@@Z @ 107 NONAME ; void RRemConUidsChangedRequest::WriteL(class TDes8 &) - ?WriteL@RAvrcpUidCounterNotificationResponse@@UAEXAAVTDes8@@@Z @ 108 NONAME ; void RAvrcpUidCounterNotificationResponse::WriteL(class TDes8 &) - ?ReadL@RAvrcpUidCounterNotificationResponse@@UAEXABVTDesC8@@@Z @ 109 NONAME ; void RAvrcpUidCounterNotificationResponse::ReadL(class TDesC8 const &) - ?WriteL@RRemConPlayerInformationGetPlayStatusUpdateRequest@@UAEXAAVTDes8@@@Z @ 110 NONAME ; void RRemConPlayerInformationGetPlayStatusUpdateRequest::WriteL(class TDes8 &) - ?ReadL@RRemConPlayerInformationGetPlayStatusUpdateResponse@@UAEXABVTDesC8@@@Z @ 111 NONAME ; void RRemConPlayerInformationGetPlayStatusUpdateResponse::ReadL(class TDesC8 const &) - ?ReadL@RRemConPlayerInformationGetPlayStatusUpdateRequest@@UAEXABVTDesC8@@@Z @ 112 NONAME ; void RRemConPlayerInformationGetPlayStatusUpdateRequest::ReadL(class TDesC8 const &) - ?WriteL@RRemConPlayerInformationGetPlayStatusUpdateResponse@@UAEXAAVTDes8@@@Z @ 113 NONAME ; void RRemConPlayerInformationGetPlayStatusUpdateResponse::WriteL(class TDes8 &) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/eabi/avrcpipcu.def --- a/bluetoothappprofiles/avrcp/avrcpipc/eabi/avrcpipcu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,186 +0,0 @@ -EXPORTS - _ZN11REAResponse5CloseEv @ 1 NONAME - _ZN14RAvrcpIPCError5ReadLERK6TDesC8 @ 2 NONAME - _ZN14RAvrcpIPCError6WriteLER5TDes8 @ 3 NONAME - _ZN16RMediaPlayerItem4SizeEv @ 4 NONAME - _ZN16RMediaPlayerItem5CloseEv @ 5 NONAME - _ZN19RSettingWithCharset5CloseEv @ 6 NONAME - _ZN19TRemConMessageQueue4FindE4TUidi @ 7 NONAME - _ZN19TRemConMessageQueue5ResetEv @ 8 NONAME - _ZN19TRemConMessageQueue6RemoveER20CRemConQueuedMessage @ 9 NONAME - _ZN19TRemConMessageQueue7AddLastER20CRemConQueuedMessage @ 10 NONAME - _ZN19TRemConMessageQueue7IsEmptyEv @ 11 NONAME - _ZN19TRemConMessageQueueC1Ev @ 12 NONAME - _ZN19TRemConMessageQueueC2Ev @ 13 NONAME - _ZN20CRemConQueuedMessage4DataEv @ 14 NONAME - _ZN20CRemConQueuedMessage4NewLE4TUidRK6TDesC8i @ 15 NONAME - _ZN20CRemConQueuedMessageD0Ev @ 16 NONAME - _ZN20CRemConQueuedMessageD1Ev @ 17 NONAME - _ZN20CRemConQueuedMessageD2Ev @ 18 NONAME - _ZN20RRemConSearchRequest4SizeEv @ 19 NONAME - _ZN20RRemConSearchRequest5CloseEv @ 20 NONAME - _ZN20RRemConSearchRequest5ReadLERK6TDesC8 @ 21 NONAME - _ZN20RRemConSearchRequest6WriteLER5TDes8 @ 22 NONAME - _ZN21RRemConSearchResponse5ReadLERK6TDesC8 @ 23 NONAME - _ZN21RRemConSearchResponse6WriteLER5TDes8 @ 24 NONAME - _ZN22RRemConGetPathResponse4SizeEv @ 25 NONAME - _ZN22RRemConGetPathResponse5CloseEv @ 26 NONAME - _ZN22RRemConGetPathResponse5ReadLERK6TDesC8 @ 27 NONAME - _ZN22RRemConGetPathResponse6WriteLER5TDes8 @ 28 NONAME - _ZN24RRemConChangePathRequest5ReadLERK6TDesC8 @ 29 NONAME - _ZN24RRemConChangePathRequest6WriteLER5TDes8 @ 30 NONAME - _ZN24RRemConNowPlayingRequest5ReadLERK6TDesC8 @ 31 NONAME - _ZN24RRemConNowPlayingRequest6WriteLER5TDes8 @ 32 NONAME - _ZN25RRemConChangePathResponse5ReadLERK6TDesC8 @ 33 NONAME - _ZN25RRemConChangePathResponse6WriteLER5TDes8 @ 34 NONAME - _ZN25RRemConMediaErrorResponse5ReadLERK6TDesC8 @ 35 NONAME - _ZN25RRemConMediaErrorResponse6WriteLER5TDes8 @ 36 NONAME - _ZN25RRemConNowPlayingResponse5ReadLERK6TDesC8 @ 37 NONAME - _ZN25RRemConNowPlayingResponse6WriteLER5TDes8 @ 38 NONAME - _ZN25RRemConUidsChangedRequest5ReadLERK6TDesC8 @ 39 NONAME - _ZN25RRemConUidsChangedRequest6WriteLER5TDes8 @ 40 NONAME - _ZN26RRemConUidsChangedResponse5ReadLERK6TDesC8 @ 41 NONAME - _ZN26RRemConUidsChangedResponse6WriteLER5TDes8 @ 42 NONAME - _ZN27RAvrcpGetFolderItemsRequest5CloseEv @ 43 NONAME - _ZN27RAvrcpGetFolderItemsRequest5ReadLERK6TDesC8 @ 44 NONAME - _ZN27RAvrcpGetFolderItemsRequest6WriteLER5TDes8 @ 45 NONAME - _ZN28RAvrcpGetFolderItemsResponse4SizeEv @ 46 NONAME - _ZN28RAvrcpGetFolderItemsResponse5CloseEv @ 47 NONAME - _ZN28RAvrcpGetFolderItemsResponse5ReadLERK6TDesC8 @ 48 NONAME - _ZN28RAvrcpGetFolderItemsResponse6WriteLER5TDes8 @ 49 NONAME - _ZN28RRemConGetFolderItemsRequest14CopyAttributesER6RArrayI17TMediaAttributeIdE @ 50 NONAME - _ZN28RRemConGetFolderItemsRequest5CloseEv @ 51 NONAME - _ZN28RRemConGetFolderItemsRequest5ReadLERK6TDesC8 @ 52 NONAME - _ZN28RRemConGetFolderItemsRequest6WriteLER5TDes8 @ 53 NONAME - _ZN29RRemConGetFolderItemsResponse15RequestNextItemERiR5RBuf8t @ 54 NONAME - _ZN29RRemConGetFolderItemsResponse4SizeEv @ 55 NONAME - _ZN29RRemConGetFolderItemsResponse5CloseEv @ 56 NONAME - _ZN29RRemConGetFolderItemsResponse5ReadLERK6TDesC8 @ 57 NONAME - _ZN29RRemConGetFolderItemsResponse6WriteLER5TDes8 @ 58 NONAME - _ZN29RRemConGetFolderItemsResponse9CopyItemsERK6TArrayI11TRemConItemE @ 59 NONAME - _ZN29RRemConPlayerListOfAttributes5CloseEv @ 60 NONAME - _ZN29RRemConPlayerListOfAttributes5ReadLERK6TDesC8 @ 61 NONAME - _ZN29RRemConPlayerListOfAttributes6WriteLER5TDes8 @ 62 NONAME - _ZN30RRemConGetCapabilitiesResponse5CloseEv @ 63 NONAME - _ZN30RRemConGetCapabilitiesResponse5ReadLERK6TDesC8 @ 64 NONAME - _ZN30RRemConGetCapabilitiesResponse6WriteLER5TDes8 @ 65 NONAME - _ZN30RRemConSetBrowsedPlayerRequest5ReadLERK6TDesC8 @ 66 NONAME - _ZN30RRemConSetBrowsedPlayerRequest6WriteLER5TDes8 @ 67 NONAME - _ZN31RAvrcpSetAddressedPlayerRequest5ReadLERK6TDesC8 @ 68 NONAME - _ZN31RAvrcpSetAddressedPlayerRequest6WriteLER5TDes8 @ 69 NONAME - _ZN31RRemConGetItemAttributesRequest5CloseEv @ 70 NONAME - _ZN31RRemConGetItemAttributesRequest5ReadLERK6TDesC8 @ 71 NONAME - _ZN31RRemConGetItemAttributesRequest6WriteLER5TDes8 @ 72 NONAME - _ZN32RAvrcpSetAddressedPlayerResponse5ReadLERK6TDesC8 @ 73 NONAME - _ZN32RAvrcpSetAddressedPlayerResponse6WriteLER5TDes8 @ 74 NONAME - _ZN32RRemConGetItemAttributesResponse4SizeEv @ 75 NONAME - _ZN32RRemConGetItemAttributesResponse5CloseEv @ 76 NONAME - _ZN32RRemConGetItemAttributesResponse5ReadLERK6TDesC8 @ 77 NONAME - _ZN32RRemConGetItemAttributesResponse6WriteLER5TDes8 @ 78 NONAME - _ZN34RRemConGetElementAttributesRequest5CloseEv @ 79 NONAME - _ZN34RRemConGetElementAttributesRequest5ReadLERK6TDesC8 @ 80 NONAME - _ZN34RRemConGetElementAttributesRequest6WriteLER5TDes8 @ 81 NONAME - _ZN34RRemConPlayerAttributeIdsAndValues5CloseEv @ 82 NONAME - _ZN34RRemConPlayerAttributeIdsAndValues5ReadLERK6TDesC8 @ 83 NONAME - _ZN34RRemConPlayerAttributeIdsAndValues6WriteLER5TDes8 @ 84 NONAME - _ZN35RRemConGetElementAttributesResponse4SizeEv @ 85 NONAME - _ZN35RRemConGetElementAttributesResponse5CloseEv @ 86 NONAME - _ZN35RRemConGetElementAttributesResponse5ReadLERK6TDesC8 @ 87 NONAME - _ZN35RRemConGetElementAttributesResponse6WriteLER5TDes8 @ 88 NONAME - _ZN36RRemConPlayerInformation8BitResponse5ReadLERK6TDesC8 @ 89 NONAME - _ZN36RRemConPlayerInformation8BitResponse6WriteLER5TDes8 @ 90 NONAME - _ZN37RRemConPlayerInformation32BitResponse5ReadLERK6TDesC8 @ 91 NONAME - _ZN37RRemConPlayerInformation32BitResponse6WriteLER5TDes8 @ 92 NONAME - _ZN37RRemConPlayerInformation64BitResponse5ReadLERK6TDesC8 @ 93 NONAME - _ZN37RRemConPlayerInformation64BitResponse6WriteLER5TDes8 @ 94 NONAME - _ZN39RRemConGetPlayerApplicationTextResponse4SizeEv @ 95 NONAME - _ZN39RRemConGetPlayerApplicationTextResponse5CloseEv @ 96 NONAME - _ZN39RRemConGetPlayerApplicationTextResponse5ReadLERK6TDesC8 @ 97 NONAME - _ZN39RRemConGetPlayerApplicationTextResponse6WriteLER5TDes8 @ 98 NONAME - _ZN41RAvrcpAddressedPlayerNotificationResponse5ReadLERK6TDesC8 @ 99 NONAME - _ZN41RAvrcpAddressedPlayerNotificationResponse6WriteLER5TDes8 @ 100 NONAME - _ZN45RRemConPlayerInformationGetPlayStatusResponse5ReadLERK6TDesC8 @ 101 NONAME - _ZN45RRemConPlayerInformationGetPlayStatusResponse6WriteLER5TDes8 @ 102 NONAME - _ZN5RItem4SizeEv @ 103 NONAME - _ZN5RItem5CloseEv @ 104 NONAME - _ZN9RAvrcpIPC17SymbianErrorCheckEi @ 105 NONAME - _ZN9RAvrcpIPC18SymbianErrToStatusEi @ 106 NONAME - _ZN9RAvrcpIPC26GetPDUIdFromIPCOperationIdEi @ 107 NONAME - _ZN9RAvrcpIPC28GetEventIdFromIPCOperationIdEi @ 108 NONAME - _ZN9RAvrcpIPC28SetIPCOperationIdFromEventIdE26TRegisterNotificationEvent @ 109 NONAME - _ZNK19TRemConMessageQueue5FirstEv @ 110 NONAME - _ZTI14RAvrcpIPCError @ 111 NONAME - _ZTI20RRemConSearchRequest @ 112 NONAME - _ZTI21RRemConSearchResponse @ 113 NONAME - _ZTI22RRemConGetPathResponse @ 114 NONAME - _ZTI24RRemConChangePathRequest @ 115 NONAME - _ZTI24RRemConNowPlayingRequest @ 116 NONAME - _ZTI25RRemConChangePathResponse @ 117 NONAME - _ZTI25RRemConMediaErrorResponse @ 118 NONAME - _ZTI25RRemConNowPlayingResponse @ 119 NONAME - _ZTI25RRemConUidsChangedRequest @ 120 NONAME - _ZTI26RRemConUidsChangedResponse @ 121 NONAME - _ZTI27RAvrcpGetFolderItemsRequest @ 122 NONAME - _ZTI28RAvrcpGetFolderItemsResponse @ 123 NONAME - _ZTI28RRemConGetFolderItemsRequest @ 124 NONAME - _ZTI29RRemConGetFolderItemsResponse @ 125 NONAME - _ZTI29RRemConPlayerListOfAttributes @ 126 NONAME - _ZTI30RRemConGetCapabilitiesResponse @ 127 NONAME - _ZTI30RRemConSetBrowsedPlayerRequest @ 128 NONAME - _ZTI31RAvrcpSetAddressedPlayerRequest @ 129 NONAME - _ZTI31RRemConGetItemAttributesRequest @ 130 NONAME - _ZTI32RAvrcpSetAddressedPlayerResponse @ 131 NONAME - _ZTI32RRemConGetItemAttributesResponse @ 132 NONAME - _ZTI34RRemConGetElementAttributesRequest @ 133 NONAME - _ZTI34RRemConPlayerAttributeIdsAndValues @ 134 NONAME - _ZTI35RRemConGetElementAttributesResponse @ 135 NONAME - _ZTI36RRemConPlayerInformation8BitResponse @ 136 NONAME - _ZTI37RRemConPlayerInformation32BitResponse @ 137 NONAME - _ZTI37RRemConPlayerInformation64BitResponse @ 138 NONAME - _ZTI39RRemConGetPlayerApplicationTextResponse @ 139 NONAME - _ZTI41RAvrcpAddressedPlayerNotificationResponse @ 140 NONAME - _ZTI45RRemConPlayerInformationGetPlayStatusResponse @ 141 NONAME - _ZTV14RAvrcpIPCError @ 142 NONAME - _ZTV20RRemConSearchRequest @ 143 NONAME - _ZTV21RRemConSearchResponse @ 144 NONAME - _ZTV22RRemConGetPathResponse @ 145 NONAME - _ZTV24RRemConChangePathRequest @ 146 NONAME - _ZTV24RRemConNowPlayingRequest @ 147 NONAME - _ZTV25RRemConChangePathResponse @ 148 NONAME - _ZTV25RRemConMediaErrorResponse @ 149 NONAME - _ZTV25RRemConNowPlayingResponse @ 150 NONAME - _ZTV25RRemConUidsChangedRequest @ 151 NONAME - _ZTV26RRemConUidsChangedResponse @ 152 NONAME - _ZTV27RAvrcpGetFolderItemsRequest @ 153 NONAME - _ZTV28RAvrcpGetFolderItemsResponse @ 154 NONAME - _ZTV28RRemConGetFolderItemsRequest @ 155 NONAME - _ZTV29RRemConGetFolderItemsResponse @ 156 NONAME - _ZTV29RRemConPlayerListOfAttributes @ 157 NONAME - _ZTV30RRemConGetCapabilitiesResponse @ 158 NONAME - _ZTV30RRemConSetBrowsedPlayerRequest @ 159 NONAME - _ZTV31RAvrcpSetAddressedPlayerRequest @ 160 NONAME - _ZTV31RRemConGetItemAttributesRequest @ 161 NONAME - _ZTV32RAvrcpSetAddressedPlayerResponse @ 162 NONAME - _ZTV32RRemConGetItemAttributesResponse @ 163 NONAME - _ZTV34RRemConGetElementAttributesRequest @ 164 NONAME - _ZTV34RRemConPlayerAttributeIdsAndValues @ 165 NONAME - _ZTV35RRemConGetElementAttributesResponse @ 166 NONAME - _ZTV36RRemConPlayerInformation8BitResponse @ 167 NONAME - _ZTV37RRemConPlayerInformation32BitResponse @ 168 NONAME - _ZTV37RRemConPlayerInformation64BitResponse @ 169 NONAME - _ZTV39RRemConGetPlayerApplicationTextResponse @ 170 NONAME - _ZTV41RAvrcpAddressedPlayerNotificationResponse @ 171 NONAME - _ZTV45RRemConPlayerInformationGetPlayStatusResponse @ 172 NONAME - _ZN36RAvrcpUidCounterNotificationResponse5ReadLERK6TDesC8 @ 173 NONAME - _ZN36RAvrcpUidCounterNotificationResponse6WriteLER5TDes8 @ 174 NONAME - _ZTI36RAvrcpUidCounterNotificationResponse @ 175 NONAME - _ZTV36RAvrcpUidCounterNotificationResponse @ 176 NONAME - _ZN50RRemConPlayerInformationGetPlayStatusUpdateRequest5ReadLERK6TDesC8 @ 177 NONAME - _ZN50RRemConPlayerInformationGetPlayStatusUpdateRequest6WriteLER5TDes8 @ 178 NONAME - _ZN51RRemConPlayerInformationGetPlayStatusUpdateResponse5ReadLERK6TDesC8 @ 179 NONAME - _ZN51RRemConPlayerInformationGetPlayStatusUpdateResponse6WriteLER5TDes8 @ 180 NONAME - _ZTI50RRemConPlayerInformationGetPlayStatusUpdateRequest @ 181 NONAME - _ZTI51RRemConPlayerInformationGetPlayStatusUpdateResponse @ 182 NONAME - _ZTV50RRemConPlayerInformationGetPlayStatusUpdateRequest @ 183 NONAME - _ZTV51RRemConPlayerInformationGetPlayStatusUpdateResponse @ 184 NONAME - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/group/avrcpipc.mmp --- a/bluetoothappprofiles/avrcp/avrcpipc/group/avrcpipc.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -// Copyright (c) 2007-2009 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: -// avrcp.dll Shared code for IPC communication between the client API and remcon -// side library. -// -// - -/** - @file - @internalComponent -*/ - -TARGET avrcpipc.dll -CAPABILITY All -Tcb -TARGETTYPE dll - -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x101f9067 -VENDORID 0x70000001 - -SOURCEPATH ../src -SOURCE ipc.cpp -SOURCE avrcpipc.cpp remconqueuemessage.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../common -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY remconinterfacebase.lib -LIBRARY esock.lib - -#include - -UNPAGED - -SMPSAFE diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/group/bld.inf --- a/bluetoothappprofiles/avrcp/avrcpipc/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -avrcpipc.mmp - -PRJ_EXPORTS -../public/avrcpspec.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcon/avrcpspec.h) - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/inc/avrcpipcutils.h --- a/bluetoothappprofiles/avrcp/avrcpipc/inc/avrcpipcutils.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -// Copyright (c) 2009 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: -// - -#ifndef AVRCPIPCUTILS_H -#define AVRCPIPCUTILS_H - -_LIT(KAvrcpIpcPanicName, "AVRCP IPC"); - -enum TAvrcpIpcPanic - { - EAvrcpIpcCommandDataTooLong = 0, - }; - -class AvrcpIpcUtils - { -public: - static void Panic(TAvrcpIpcPanic aPanic); // The macro is probably more useful so this can be removed - }; - -/** Utility AVRCP panic function. - -@param aPanic The panic number. -*/ -void AvrcpIpcUtils::Panic(TAvrcpIpcPanic aPanic) - { - User::Panic(KAvrcpIpcPanicName, aPanic); - } - -#endif //AVRCPIPCUTILS_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/public/avrcpspec.h --- a/bluetoothappprofiles/avrcp/avrcpipc/public/avrcpspec.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef AVRCPSPEC_H -#define AVRCPSPEC_H - -#include - -// The IANA assigned MIB Enum for UTF8, defined at: -// http://www.iana.org/assignments/character-sets -// and specified in the AVRCP 1.3 specification in -// section 13, "References" as reference number 11. - -const TInt KUtf8MibEnum = 106; - -// The maximum absolute volume defined by the AVRCP 1.4 spcification -// in section 6.13.1 -const TUint8 KAvrcpMaxAbsoluteVolume = 0x7F; - -// These PDU ids are defined by the AVRCP 1.3 specification -// in sections 5.1, 5.2, 5.3 and 5.4. - -enum TMetadataTransferPDU - { - EGetCapabilities = 0x10, - EListPlayerApplicationSettingAttributes = 0x11, - EListPlayerApplicationSettingValues = 0x12, - EGetCurrentPlayerApplicationSettingValue = 0x13, - ESetPlayerApplicationSettingValue = 0x14, - EGetPlayerApplicationSettingAttributeText = 0x15, - EGetPlayerApplicationSettingValueText = 0x16, - EInformDisplayableCharacterSet = 0x17, // not implemented; always use UTF8 - EInformBatteryStatusOfCT = 0x18, - EGetElementAttributes = 0x20, - EGetPlayStatus = 0x30, - ERegisterNotification = 0x31, - ERequestContinuingResponse = 0x40, - EAbortContinuingResponse = 0x41, - ESetAbsoluteVolume = 0x50, - ESetAddressedPlayer = 0x60, - EPlayItem = 0x74, - EAddToNowPlaying = 0x90, - - // Internal values - EGetPlayStatusUpdate = 0xff, - }; - -enum TMediaBrowsePDU - { - EMbSetBrowsedPlayer = 0x70, - EMbGetFolderItems = 0x71, - EMbChangePath = 0x72, - EMbGetItemAttributes = 0x73, - EMbSearch = 0x80, - }; - -// These RegisterNotification (PDU 0x31) event ids are defined -// in the AVRCP 1.3 specification in section 5.4. - -enum TRegisterNotificationEvent - { - ERegisterNotificationPlaybackStatusChanged = 0x1, - ERegisterNotificationTrackChanged = 0x2, - ERegisterNotificationTrackReachedEnd = 0x3, - ERegisterNotificationTrackReachedStart = 0x4, - ERegisterNotificationPlaybackPosChanged = 0x5, - ERegisterNotificationBatteryStatusChanged = 0x6, - ERegisterNotificationSystemStatusChanged_NotSupported= 0x7, // not supported - ERegisterNotificationPlayerApplicationSettingChanged = 0x8, - ERegisterNotificationNowPlayingContentChanged = 0x9, - ERegisterNotificationAvailablePlayersChanged = 0xa, - ERegisterNotificationAddressedPlayerChanged = 0xb, - ERegisterNotificationUidsChanged = 0xc, - ERegisterNotificationVolumeChanged = 0xd, - ERegisterNotificationReservedLast = 0xf, - }; - -// These are the allowed values for GetCapabilities (PDU 0x10) -// and are specified in the AVRCP 1.3 specification, section 5.1.1 - -enum TGetCapabilityValues - { - ECapabilityIdCompanyID = 2, - ECapabilityIdEventsSupported = 3, - }; - -// Pass Through command values for Group Navigation, as -// defined in the AVRCP 1.3 specification, in section 4.7.9 - -enum TGroupNavigationPassthroughOperationIds - { - ENextGroup = 0x0, - EPreviousGroup = 0x1, - }; - -// Error numbers allocated to the AVRCP component, for use in -// IPC communication between the client APIs and the AVRCP bearer - -const TInt KErrAvrcpBaseError = -6751; // Base error number -const TInt KErrAvrcpInvalidCType = KErrAvrcpBaseError - 1; // -6752 -const TInt KErrAvrcpInvalidOperationId = KErrAvrcpBaseError - 2; // -6753 -const TInt KErrAvrcpMetadataInvalidCommand = KErrAvrcpBaseError - 3; // -6754 -const TInt KErrAvrcpMetadataInvalidParameter = KErrAvrcpBaseError - 4; // -6755 -const TInt KErrAvrcpMetadataParameterNotFound = KErrAvrcpBaseError - 5; // -6756 -const TInt KErrAvrcpMetadataInternalError = KErrAvrcpBaseError - 6; // -6757 -const TInt KErrAvrcpHandledInternallyRespondNow = KErrAvrcpBaseError - 7; // -6758 -const TInt KErrAvrcpHandledInternallyInformRemCon = KErrAvrcpBaseError - 8; // -6759 -const TInt KErrAvrcpInternalCommand = KErrAvrcpBaseError - 9; // -6760 -const TInt KErrAvrcpFurtherProcessingRequired = KErrAvrcpBaseError - 10; // -6791 - -const TInt KErrAvrcpAirBase = -6780; -const TInt KErrAvrcpAirInvalidCommand = KErrAvrcpAirBase - 0; -const TInt KErrAvrcpAirInvalidParameter = KErrAvrcpAirBase - 1; -const TInt KErrAvrcpAirParameterNotFound = KErrAvrcpAirBase - 2; -const TInt KErrAvrcpAirInternalError = KErrAvrcpAirBase - 3; -const TInt KErrAvrcpAirSuccess = KErrAvrcpAirBase - 4; -const TInt KErrAvrcpAirUidChanged = KErrAvrcpAirBase - 5; -const TInt KErrAvrcpAirReserved = KErrAvrcpAirBase - 6; -const TInt KErrAvrcpAirInvalidDirection = KErrAvrcpAirBase - 7; -const TInt KErrAvrcpAirNotADirectory = KErrAvrcpAirBase - 8; -const TInt KErrAvrcpAirDoesNotExist = KErrAvrcpAirBase - 9; -const TInt KErrAvrcpAirInvalidScope = KErrAvrcpAirBase - 0xa; -const TInt KErrAvrcpAirRangeOutOfBounds = KErrAvrcpAirBase - 0xb; -const TInt KErrAvrcpAirUidIsADirectory = KErrAvrcpAirBase - 0xc; -const TInt KErrAvrcpAirMediaInUse = KErrAvrcpAirBase - 0xd; -const TInt KErrAvrcpAirNowPlayingListFull = KErrAvrcpAirBase - 0xe; -const TInt KErrAvrcpAirSearchNotSupported = KErrAvrcpAirBase - 0xf; -const TInt KErrAvrcpAirSearchInProgress = KErrAvrcpAirBase - 0x10; -const TInt KErrAvrcpAirInvalidPlayerId = KErrAvrcpAirBase - 0x11; -const TInt KErrAvrcpAirPlayerNotBrowesable = KErrAvrcpAirBase - 0x12; -const TInt KErrAvrcpAirPlayerNotAddressed = KErrAvrcpAirBase - 0x13; -const TInt KErrAvrcpAirNoValidSearchResults = KErrAvrcpAirBase - 0x14; -const TInt KErrAvrcpAirNoAvailablePlayers = KErrAvrcpAirBase - 0x15; -const TInt KErrAvrcpAirAddressedPlayerChanged = KErrAvrcpAirBase - 0x16; -const TInt KErrAvrcpInvalidScope = KErrAvrcpAirBase - 0x17; - -#endif // AVRCPSPEC_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/src/avrcpipc.cpp --- a/bluetoothappprofiles/avrcp/avrcpipc/src/avrcpipc.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +0,0 @@ -// Copyright (c) 2008-2009 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: -// This file contains structures shared by the AVRCP API with the AVRCP bearer. -// -// - -/** - @file - @internalTechnology - @released -*/ - -#include -#include -#include "avrcpipc.h" - - -EXPORT_C TMetadataTransferPDU RAvrcpIPC::GetPDUIdFromIPCOperationId(TInt aOperationId) - { - // We send the PDU id through IPC to the playerinformationapi, mediainformationapi - // groupnavigationapi or batterystatusapi. However, PDU 0x31 (Register Notification - // also requires sending an event id. We encode this as the top byte, and the PDU - // id as the lower byte, so mask off the top-byte and return just the PDU id. - return static_cast(aOperationId & 0x00FF); - } - -EXPORT_C TRegisterNotificationEvent RAvrcpIPC::GetEventIdFromIPCOperationId(TInt aOperationId) - { - // See the above comment in GetPDUIdFromIPCOperationId. This performs the opposite operation - return static_cast((aOperationId & 0xFF00) >> 8); - } - -EXPORT_C TInt RAvrcpIPC::SetIPCOperationIdFromEventId(TRegisterNotificationEvent aEventId) - { - // See the comment in GetPDUIdFromIPCOperationId. This sets the PDU id - // as the lower byte to RegisterNotification (0x31) and the eventId as - // the top byte. - return (ERegisterNotification + (aEventId << 8)); - } - -// Big-endian methods; Symbian native methods are little-endian -// This means that we can directly send these packets into the -// wire in the bearer, since they're big-endian. We could have -// used the BigEndian class, but that requires a dependency on -// the esock.lib library, so do it ourselves. - -TUint8 RAvrcpIPC::Read8L() - { - return iReadStream.ReadUint8L(); - } - -TUint16 RAvrcpIPC::Read16L() - { - TUint16 val = 0; - val = (static_cast(iReadStream.ReadUint8L()) << 8); - val += iReadStream.ReadUint8L(); - return val; - } - -TUint32 RAvrcpIPC::Read24L() - { - TUint32 val = 0; - val += (static_cast(iReadStream.ReadUint8L()) << 16); - val += (static_cast(iReadStream.ReadUint8L()) << 8); - val += iReadStream.ReadUint8L(); - return val; - } - -TUint32 RAvrcpIPC::Read32L() - { - TUint32 val = 0; - val = (static_cast(iReadStream.ReadUint8L()) << 24); - val += (static_cast(iReadStream.ReadUint8L()) << 16); - val += (static_cast(iReadStream.ReadUint8L()) << 8); - val += iReadStream.ReadUint8L(); - return val; - } - -TUint64 RAvrcpIPC::Read64L() - { - TUint64 val; - val = (static_cast(iReadStream.ReadUint8L()) << 56); - val += (static_cast(iReadStream.ReadUint8L()) << 48); - val += (static_cast(iReadStream.ReadUint8L()) << 40); - val += (static_cast(iReadStream.ReadUint8L()) << 32); - val += (static_cast(iReadStream.ReadUint8L()) << 24); - val += (static_cast(iReadStream.ReadUint8L()) << 16); - val += (static_cast(iReadStream.ReadUint8L()) << 8); - val += iReadStream.ReadUint8L(); - return val; - } - -void RAvrcpIPC::Write8L(TUint8 aVal) - { - iStream.WriteUint8L(aVal); - } - -void RAvrcpIPC::Write16L(TUint16 aVal) - { - iStream.WriteUint8L(static_cast(aVal >> 8)); - iStream.WriteUint8L(static_cast(aVal)); - } - -void RAvrcpIPC::Write24L(TUint32 aVal) - { - iStream.WriteUint8L(static_cast(aVal >> 16)); - iStream.WriteUint8L(static_cast(aVal >> 8)); - iStream.WriteUint8L(static_cast(aVal)); - } - -void RAvrcpIPC::Write32L(TUint32 aVal) - { - iStream.WriteUint8L(static_cast(aVal >> 24)); - iStream.WriteUint8L(static_cast(aVal >> 16)); - iStream.WriteUint8L(static_cast(aVal >> 8)); - iStream.WriteUint8L(static_cast(aVal)); - } - -void RAvrcpIPC::Write64L(TUint64 aVal) - { - iStream.WriteUint8L(static_cast(aVal >> 56)); - iStream.WriteUint8L(static_cast(aVal >> 48)); - iStream.WriteUint8L(static_cast(aVal >> 40)); - iStream.WriteUint8L(static_cast(aVal >> 32)); - iStream.WriteUint8L(static_cast(aVal >> 24)); - iStream.WriteUint8L(static_cast(aVal >> 16)); - iStream.WriteUint8L(static_cast(aVal >> 8)); - iStream.WriteUint8L(static_cast(aVal)); - } -void RAvrcpIPC::Close() - { - iReadStream.Close(); - iStream.Close(); - } - -EXPORT_C void RAvrcpIPCError::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iError = Read32L(); // Read Big-Endian error code - iReadStream.Close(); - } - -EXPORT_C void RAvrcpIPCError::WriteL(TDes8& aOutData) - { - aOutData.Zero(); // Error code is always before any other data - iStream.Open(aOutData); - Write32L(iError); - iStream.CommitL(); - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/src/ipc.cpp --- a/bluetoothappprofiles/avrcp/avrcpipc/src/ipc.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1541 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalTechnology - @released -*/ - -#include -#include -#include "avrcpipcutils.h" -#include "avrcpinternalinterface.h" -#include "mediabrowse.h" -#include "mediainformation.h" -#include "nowplaying.h" -#include "playerinformation.h" - -/* - * These methods are intended to provide structured IPC communication between - * the AVRCP bearer, and the client API DLLs. They are intended to be 'simple' - * classes, in which the basic operation are as follows: - * - * reading: call ReadL(request) and pull information out of member variables - * writing: put information into member variables, then call WriteL(request) - * - * The ReadL() and WriteL() methods effectively just serialize the information - * already stored in the member varables. However, they serialize in Big-Endian - * format, so that after calling WriteL() and then sending the response back to - * the AVRCP bearer via IPC, the bearer can just append the response straight - * into an AVC frame; no bit-twiddling is necessary. - * - * Therefore it is important that these classes _ALWAYS_ write in Big-Endian - * format, and write out responses that conform to the AVRCP specification for - * PDUs listed in sections 5.1 - 5.4 of the AVRCP 1.3 specification. The ReadL() - * operation is the inverse of the WriteL() operation and reads an AVRCP request - * in the format listed in the AVRCP specification. - * - * There's also a Size() method, which will return the size of the response - * before WriteL() is called. This is required particularly for responses with - * text strings so that the correct-sized buffer can be allocated, as these - * could be very large responses (theoretically up to 16 megabytes!) sent via - * IPC (just once) and then kept and fragmented in the AVRCP bearer. The Close() - * method frees up any memory allocated with these classes. - */ - - -// -------------------------------------------------------------------------------- -// Used for constructing PDU 0x30 responses - -EXPORT_C void RRemConPlayerInformationGetPlayStatusResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iTrackLength = Read32L(); - iPlayPos = Read32L(); - iStatus = (MPlayerEventsObserver::TPlaybackStatus) Read8L(); - iReadStream.Close(); - } - -EXPORT_C void RRemConPlayerInformationGetPlayStatusResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - Write32L(iTrackLength); - Write32L(iPlayPos); - Write8L(iStatus); - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for constructing PDU 0xff requests - -EXPORT_C void RRemConPlayerInformationGetPlayStatusUpdateRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iStatus = (MPlayerEventsObserver::TPlaybackStatus) Read8L(); - iReadStream.Close(); - } - -EXPORT_C void RRemConPlayerInformationGetPlayStatusUpdateRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write8L(iStatus); - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for constructing PDU 0xff responses - -EXPORT_C void RRemConPlayerInformationGetPlayStatusUpdateResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iStatus = (MPlayerEventsObserver::TPlaybackStatus) Read8L(); - iReadStream.Close(); - } - -EXPORT_C void RRemConPlayerInformationGetPlayStatusUpdateResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - Write8L(iStatus); - iStream.CommitL(); - } -// -------------------------------------------------------------------------------- -// Used for constructing PDU 0x15 and PDU 0x16 responses - -EXPORT_C void RRemConGetPlayerApplicationTextResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iNumberAttributes = Read8L(); - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - RSettingWithCharset setting; - CleanupClosePushL(setting); - setting.iAttributeId = Read8L(); - setting.iCharset = Read16L(); - setting.iStringLen = Read8L(); - setting.iString = HBufC8::NewL(setting.iStringLen); - TPtr8 ptr = setting.iString->Des(); - iReadStream.ReadL(ptr); - iAttributes.AppendL(setting); - CleanupStack::Pop(&setting); - } - - } - -EXPORT_C void RRemConGetPlayerApplicationTextResponse::WriteL(TDes8& aOutData) - { - // The caller should have called Size() to pre-allocate enough buffer space - __ASSERT_DEBUG(aOutData.MaxLength() >= Size(), AvrcpIpcUtils::Panic(EAvrcpIpcCommandDataTooLong)); - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - Write8L(iNumberAttributes); - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - Write8L(iAttributes[i].iAttributeId); - Write16L(iAttributes[i].iCharset); - Write8L(iAttributes[i].iStringLen); - iStream.WriteL(iAttributes[i].iString->Des()); - } - iStream.CommitL(); - } - -EXPORT_C TInt RRemConGetPlayerApplicationTextResponse::Size() - { - // Return the size that a buffer needs to be allocated to - // serialise the data encapsulated within this data structure. - - TInt size = 5; // 5 bytes: status code + number attributes - for (TInt i = 0; i < iNumberAttributes; i++) - { - size += 4; // 4 bytes: attribute id + charset + stringlen - size += iAttributes[i].iString->Length(); - } - return size; - } - -EXPORT_C void RRemConGetPlayerApplicationTextResponse::Close() - { - for (TInt i = 0; i < iAttributes.Count(); i++) - { - iAttributes[i].Close(); - } - iAttributes.Close(); - RAvrcpIPC::Close(); - } - -// -------------------------------------------------------------------------------- -// Used for constructing PDU 0x10 responses - -EXPORT_C void RRemConGetCapabilitiesResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iCapabilityId = Read8L(); - if ( iCapabilityId != ECapabilityIdCompanyID - && iCapabilityId != ECapabilityIdEventsSupported) - { - iReadStream.Close(); - User::Leave(KErrNotSupported); - } - - iCapabilityCount = Read8L(); - for (TInt i = 0; i < iCapabilityCount; i++ ) - { - if (iCapabilityId == ECapabilityIdCompanyID) - { - iCapabilities.AppendL(Read24L()); // Read 3 bytes - } - else - { - iCapabilities.AppendL(Read8L()); // Read 1 byte - } - } - iReadStream.Close(); - } - -EXPORT_C void RRemConGetCapabilitiesResponse::WriteL(TDes8& aOutData) - { - if ( iCapabilityId != ECapabilityIdCompanyID - && iCapabilityId != ECapabilityIdEventsSupported) - { - User::Leave(KErrNotSupported); - } - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - Write8L(iCapabilityId); - Write8L(iCapabilityCount); - for (TInt i = 0; i < iCapabilityCount; i++ ) - { - if (iCapabilityId == ECapabilityIdCompanyID) - { - Write24L(iCapabilities[i]); // Write 3 bytes - } - else - { - Write8L(iCapabilities[i]); // Write 1 byte - } - } - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for constructing and parsing PDU 0x13 (response) and PDU 0x14 (request) - -EXPORT_C void RRemConPlayerAttributeIdsAndValues::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iNumberAttributes = Read8L(); - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - TInt attributeId = Read8L(); - TInt attributeValue = Read8L(); - iAttributeId.AppendL(attributeId); - iAttributeValue.AppendL(attributeValue); - } - iReadStream.Close(); - } - -EXPORT_C void RRemConPlayerAttributeIdsAndValues::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - Write8L(iNumberAttributes); - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - Write8L(iAttributeId[i]); - Write8L(iAttributeValue[i]); - } - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for constructing PDU 0x11 and PDU 0x12 responses - -EXPORT_C void RRemConPlayerListOfAttributes::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iNumberAttributes = Read8L(); - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - TInt attribute = Read8L(); - iAttributes.AppendL(attribute); - } - iReadStream.Close(); - } - -EXPORT_C void RRemConPlayerListOfAttributes::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - iAttributes.Sort(); - Write32L(KErrNone); // Successful operation - Write8L(iNumberAttributes); - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - Write8L(iAttributes[i]); - } - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for parsing PDU 0x20 requests - -EXPORT_C void RRemConGetElementAttributesRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iElement = Read64L(); - iNumberAttributes = Read8L(); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - TInt attribute = Read32L(); - iAttributes.AppendL(attribute); - } - iReadStream.Close(); - } - -EXPORT_C void RRemConGetElementAttributesRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - iAttributes.Sort(); - Write32L(KErrNone); // Successful operation - - // 64 bits of data - Write64L(iElement); - Write8L(iNumberAttributes); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - Write32L(iAttributes[i]); - } - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for PDU 0x20 responses - -EXPORT_C void RRemConGetElementAttributesResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iNumberAttributes = Read8L(); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - REAResponse eattr; - CleanupClosePushL(eattr); - eattr.iAttributeId = Read32L(); - eattr.iCharset = Read16L(); - eattr.iStringLen = Read16L(); - eattr.iString = HBufC8::NewL(eattr.iStringLen); - TPtr8 ptr = eattr.iString->Des(); - iReadStream.ReadL(ptr); - iAttributes.AppendL(eattr); - CleanupStack::Pop(&eattr); - } - - } - -EXPORT_C void RRemConGetElementAttributesResponse::WriteL(TDes8& aOutData) - { - __ASSERT_DEBUG(aOutData.MaxLength() >= Size(), AvrcpIpcUtils::Panic(EAvrcpIpcCommandDataTooLong)); - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - - Write8L(iNumberAttributes); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - Write32L(iAttributes[i].iAttributeId); - Write16L(iAttributes[i].iCharset); - Write16L(iAttributes[i].iStringLen); - iStream.WriteL(iAttributes[i].iString->Des()); - } - iStream.CommitL(); - } - -EXPORT_C TInt RRemConGetElementAttributesResponse::Size() - { - // Return the size that a buffer needs to be allocated to - // serialise the data encapsulated within this data structure. - - TInt size = 5; // 5 bytes: status code + number attributes - for (TInt i = 0; i < iNumberAttributes; i++) - { - size += 4+2+2; // 8 bytes: attrId (4 bytes) + charset (2 bytes) + stringlen (2 bytes) - size += iAttributes[i].iString->Length(); - } - return size; - } - -EXPORT_C void RRemConGetElementAttributesResponse::Close() - { - for (TInt i = 0; i < iAttributes.Count(); i++) - { - iAttributes[i].Close(); - } - iAttributes.Close(); - RAvrcpIPC::Close(); - } - -// -------------------------------------------------------------------------------- - -EXPORT_C void RRemConPlayerInformation8BitResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iValue = Read8L(); - iReadStream.Close(); - } - -EXPORT_C void RRemConPlayerInformation8BitResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - - Write8L(iValue); - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- - -EXPORT_C void RRemConPlayerInformation32BitResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iValue = Read32L(); - iReadStream.Close(); - } - -EXPORT_C void RRemConPlayerInformation32BitResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - - Write32L(iValue); - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- - -EXPORT_C void RRemConPlayerInformation64BitResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iValue = Read64L(); - iReadStream.Close(); - } - -EXPORT_C void RRemConPlayerInformation64BitResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - - Write64L(iValue); - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- - -EXPORT_C void RSettingWithCharset::Close() - { - delete iString; - iString = NULL; - } - -EXPORT_C void REAResponse::Close() - { - delete iString; - iString = NULL; - } - -EXPORT_C void RRemConGetCapabilitiesResponse::Close() - { - iCapabilities.Close(); - } - -EXPORT_C void RRemConPlayerListOfAttributes::Close() - { - iAttributes.Close(); - } - -EXPORT_C void RRemConGetElementAttributesRequest::Close() - { - iAttributes.Close(); - } - -EXPORT_C void RRemConPlayerAttributeIdsAndValues::Close() - { - iAttributeId.Close(); - iAttributeValue.Close(); - } - -EXPORT_C void RItem::Close() - { - delete iName; - for(TInt i = 0; i(Read8L()); - iElement = Read64L(); - iUidCounter = Read16L(); - } - -/** -Constructs PDU 0x74 and 0x90 requests. -*/ -EXPORT_C void RRemConNowPlayingRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - Write8L(iScope); - Write64L(iElement); - Write16L(iUidCounter); - iStream.CommitL(); - } - -/** -Parses PDU 0x74 and 0x90 responses -*/ -EXPORT_C void RRemConNowPlayingResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iStatus = Read8L(); - } - -/** -Constructs PDU 0x74 and 0x90 responses. -*/ -EXPORT_C void RRemConNowPlayingResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - if ((KErrAvrcpAirBase - KErrAvrcpAirSuccess) == iStatus) - { - Write32L(KErrNone); // Successful operation - Write8L(iStatus); - } - else - { - Write32L(KErrAvrcpAirBase - iStatus); - } - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for parsing PDU 0x71 requests -EXPORT_C void RRemConGetFolderItemsRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iScope = Read8L(); - iStartItem = Read32L(); - iEndItem = Read32L(); - iNumberAttributes = Read8L(); - - if (iNumberAttributes == 0) - { - // spec says this is a request for all attribs - // current spec has 7 specified (0x01 to 0x07) - for (TInt i = 1; i <= KMaxMediaAttributeValue; i++) - { - iAttributes.AppendL(i); - } - } - else if (iNumberAttributes == 0xff) - { - // No attributes requested - } - else - { - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - TInt attribute = Read32L(); - if (attribute > 0 && attribute <= KMaxMediaAttributeValue ) - { - iAttributes.AppendL(attribute); - } - } - } - - iReadStream.Close(); - } - -EXPORT_C void RRemConGetFolderItemsRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - iAttributes.Sort(); - Write32L(KErrNone); // Successful operation - - Write8L(iScope); - Write32L(iStartItem); - Write32L(iEndItem); - Write8L(iNumberAttributes); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - Write32L(iAttributes[i]); - } - - iStream.CommitL(); - } - -EXPORT_C void RRemConGetFolderItemsRequest::Close() - { - iAttributes.Close(); - } - -EXPORT_C TInt RRemConGetFolderItemsRequest::CopyAttributes(RArray& aOutAttributes) - { - TInt result = KErrNone; - TMediaAttributeId attributeId; - TInt attributeCount = iAttributes.Count(); - for (TInt i = 0; i < attributeCount; i++) - { - attributeId = static_cast(iAttributes[i]); - result = aOutAttributes.Append(attributeId); - if (result != KErrNone) - { - break; - } - } - return result; - } -// -------------------------------------------------------------------------------- -// Used for PDU 0x71 responses - -EXPORT_C void RRemConGetFolderItemsResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iPduId = Read8L(); - iParamLength = Read16L(); - iStatus = Read8L(); - iUidCounter = Read16L(); - iNumberItems = Read16L(); - - for(TInt i = 0; i < iNumberItems; i++) - { - ReadItemL(); - } - - iReadStream.Close(); - } - -void RRemConGetFolderItemsResponse::ReadItemL() - { - RItem item; - CleanupClosePushL(item); - - item.iType = static_cast(Read8L()); - item.iLength = Read16L(); - item.iUid = Read64L(); - - if(item.iType == AvrcpBrowsing::EFolderItem) - { - item.iFolderType = static_cast(Read8L()); - item.iPlayable = Read8L(); - } - else - { - item.iMediaType = Read8L(); - } - - item.iCharset = Read16L(); - item.iNameLength = Read16L(); - item.iName = HBufC8::NewL(item.iNameLength); - TPtr8 ptr = item.iName->Des(); - iReadStream.ReadL(ptr); - - if(item.iType == AvrcpBrowsing::EMediaElement) - { - item.iNumberAttributes = Read32L(); - - for (TInt i = 0; i < item.iNumberAttributes; i++ ) - { - REAResponse eattr; - CleanupClosePushL(eattr); - - eattr.iAttributeId = Read32L(); - eattr.iCharset = Read16L(); - eattr.iStringLen = Read16L(); - eattr.iString = HBufC8::NewL(eattr.iStringLen); - TPtr8 ptr = eattr.iString->Des(); - iReadStream.ReadL(ptr); - - item.iAttributes.AppendL(eattr); - CleanupStack::Pop(&eattr); - } - } - - iItems.AppendL(item); - CleanupStack::Pop(&item); - } - -EXPORT_C void RRemConGetFolderItemsResponse::WriteL(TDes8& aOutData) - { - __ASSERT_DEBUG(aOutData.MaxLength() >= Size(), AvrcpIpcUtils::Panic(EAvrcpIpcCommandDataTooLong)); - aOutData.Zero(); - iStream.Open(aOutData); - - Write8L(iPduId); - Write16L(iParamLength); - Write8L(iStatus); - - if(iStatus == 0x4) - { - Write16L(iUidCounter); - Write16L(iNumberItems); - - for (TInt i = 0; i < iNumberItems; i++ ) - { - WriteItemL(i); - } - } - - iStream.CommitL(); - } - -void RRemConGetFolderItemsResponse::WriteItemL(TInt aIndex) - { - RItem& item = iItems[aIndex]; - - Write8L(item.iType); - Write16L(item.iLength); - Write64L(item.iUid); - - if(item.iType == AvrcpBrowsing::EFolderItem) - { - Write8L(item.iFolderType); - Write8L(item.iPlayable); - } - else - { - Write8L(item.iMediaType); - } - - Write16L(item.iCharset); - Write16L(item.iNameLength); - iStream.WriteL(item.iName->Des()); - - if(item.iType == AvrcpBrowsing::EMediaElement) - { - Write8L(item.iNumberAttributes); - - for(TInt i = 0; i < item.iNumberAttributes; i++) - { - Write32L(item.iAttributes[i].iAttributeId); - Write16L(item.iAttributes[i].iCharset); - Write16L(item.iAttributes[i].iStringLen); - iStream.WriteL(item.iAttributes[i].iString->Des()); - } - } - } - -EXPORT_C TInt RRemConGetFolderItemsResponse::Size() - { - // Return the size that a buffer needs to be allocated to - // serialise the data encapsulated within this data structure. - - // base size - // pduid + paramlength + status + uidcount + number items - TInt size = KGetFolderItemsResponseBaseSize; - - for (TInt i = 0; i < iNumberItems; i++) - { - size += iItems[i].Size(); - } - return size; - } - -EXPORT_C void RRemConGetFolderItemsResponse::Close() - { - for (TInt i = 0; i < iItems.Count(); i++) - { - iItems[i].Close(); - } - iItems.Reset(); - } - -EXPORT_C TInt RRemConGetFolderItemsResponse::CopyItems( - const TArray& aItems) - { - TInt err = KErrNone; - for(TInt i = 0; i < aItems.Count(); i++) - { - RItem item; - item.iName = NULL; - item.iUid = aItems[i].iUid; - item.iType = static_cast(aItems[i].iType); - - err = iItems.Append(item); - if(err) - { - break; - } - } - return err; - } - -EXPORT_C TBool RRemConGetFolderItemsResponse::RequestNextItem(TInt& aError, - RBuf8& aOutBuf, TUint16 aCookie) - { - aError = KErrNone; - // Work out if we have as many items as fit - TBool getMoreItems = ETrue; - iCurrentListingSize += (iCurrentItem + 1) ? iItems[iCurrentItem].Size() : 0; - if(iCurrentListingSize > iMaxResponse) - { - // We can't fit this item in the listing - iItems[iCurrentItem].Close(); - getMoreItems = EFalse; - iItems.Remove(iCurrentItem); - } - - if(getMoreItems && ++iCurrentItem < iItems.Count()) - { - return ETrue; - } - else - { - // We have all items, send the response - iNumberItems = iCurrentItem; - if(aOutBuf.Create(Size()) != KErrNone) - { - aError = KErrGeneral; - return EFalse; - } - - iPduId = AvrcpBrowsing::EGetFolderItems; - iStatus = KErrAvrcpAirBase - KErrAvrcpAirSuccess;//0x4 - iUidCounter = aCookie; - TRAP(aError, WriteL(aOutBuf)); - } - return EFalse; - } -// -------------------------------------------------------------------------------- -// Used for parsing PDU 0x72 requests - -EXPORT_C void RRemConChangePathRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iUidCounter = Read16L(); - iDirection = Read8L(); - - if(iDirection == AvrcpBrowsing::KDown) - { - iElement = Read64L(); - } - - iReadStream.Close(); - } - -EXPORT_C void RRemConChangePathRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - Write16L(iUidCounter); - Write8L(iDirection); - Write64L(iElement); - - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for PDU 0x72 responses - -EXPORT_C void RRemConChangePathResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iStatus = Read8L(); - iNumberItems = Read32L(); - - iReadStream.Close(); - } - -EXPORT_C void RRemConChangePathResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - Write8L(iPduId); - Write16L(iParamLength); - Write8L(iStatus); - - if(iStatus == 0x4) - { - Write32L(iNumberItems); - } - - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for parsing PDU 0x73 requests - -EXPORT_C void RRemConGetItemAttributesRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iScope = Read8L(); - iElement = Read64L(); - iUidCounter = Read16L(); - iNumberAttributes = Read8L(); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - TInt attribute = Read32L(); - iAttributes.AppendL(attribute); - } - - iReadStream.Close(); - } - -EXPORT_C void RRemConGetItemAttributesRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - iAttributes.Sort(); - Write32L(KErrNone); // Successful operation - - Write8L(iScope); - // 64 bits of data - Write64L(iElement); - Write16L(iUidCounter); - Write8L(iNumberAttributes); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - Write32L(iAttributes[i]); - } - iStream.CommitL(); - } - -EXPORT_C void RRemConGetItemAttributesRequest::Close() - { - iAttributes.Close(); - } - -// -------------------------------------------------------------------------------- -// Used for PDU 0x73 responses - -EXPORT_C void RRemConGetItemAttributesResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iStatus = Read8L(); - iNumberAttributes = Read8L(); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - REAResponse eattr; - eattr.iAttributeId = Read32L(); - eattr.iCharset = Read16L(); - eattr.iStringLen = Read16L(); - eattr.iString = HBufC8::NewL(eattr.iStringLen); - TPtr8 ptr = eattr.iString->Des(); - iReadStream.ReadL(ptr); - iAttributes.AppendL(eattr); - } - iReadStream.Close(); - } - -EXPORT_C void RRemConGetItemAttributesResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - Write8L(iPduId); - Write16L(iParamLength); - Write8L(iStatus); - - if(iStatus == 0x4) - { - Write8L(iNumberAttributes); - - for (TInt i = 0; i < iNumberAttributes; i++ ) - { - Write32L(iAttributes[i].iAttributeId); - Write16L(iAttributes[i].iCharset); - Write16L(iAttributes[i].iStringLen); - iStream.WriteL(iAttributes[i].iString->Des()); - } - } - iStream.CommitL(); - } - -EXPORT_C TInt RRemConGetItemAttributesResponse::Size() - { - // Return the size that a buffer needs to be allocated to - // serialise the data encapsulated within this data structure. - - TInt size = 9; // 6 bytes: error + pduid + paramlength + status code + number attributes - for (TInt i = 0; i < iAttributes.Count(); i++) - { - size += 4+2+2; // 8 bytes: attrId (4 bytes) + charset (2 bytes) + stringlen (2 bytes) - size += iAttributes[i].iString->Length(); - } - return size; - } - -EXPORT_C void RRemConGetItemAttributesResponse::Close() - { - for (TInt i = 0; i < iAttributes.Count(); i++) - { - iAttributes[i].Close(); - } - iAttributes.Close(); - } - -// -------------------------------------------------------------------------------- -// Used for parsing PDU 0x80 requests - -EXPORT_C void RRemConSearchRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iCharset = Read16L(); - iStringLen = Read16L(); - - TInt dataLength = aData.Length(); - TPtrC8 pString = aData.Right(dataLength - 2*sizeof(TUint16)); - if (pString.Length() != iStringLen) - { - User::Leave(KErrArgument); - } - - RBuf8 searchBuf; - searchBuf.CreateL(iStringLen); - CleanupClosePushL(searchBuf); - - iReadStream.ReadL(searchBuf); - - CleanupStack::Pop(&searchBuf); - iSearchString.Assign(searchBuf); - - iReadStream.Close(); - } - -EXPORT_C void RRemConSearchRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - Write16L(iCharset); - Write16L(iStringLen); - WriteL(iSearchString); - - iStream.CommitL(); - } - -EXPORT_C TInt RRemConSearchRequest::Size() - { - // Return the size that a buffer needs to be allocated to - // serialise the data encapsulated within this data structure. - TInt size = sizeof(iCharset) + sizeof(iStringLen) + iSearchString.Length(); - - return size; - } - -EXPORT_C void RRemConSearchRequest::Close() - { - iSearchString.Close(); - } - -// -------------------------------------------------------------------------------- -// Used for PDU 0x80 responses - -EXPORT_C void RRemConSearchResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iStatus = Read8L(); - iUidCounter = Read16L(); - iNumberItems = Read32L(); - - iReadStream.Close(); - } - -EXPORT_C void RRemConSearchResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - Write8L(iPduId); - Write16L(iParamLength); - Write8L(iStatus); - - if(iStatus == 0x4) - { - Write16L(iUidCounter); - Write32L(iNumberItems); - } - - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for parsing SetBrowsedPlayer requests - -EXPORT_C void RRemConSetBrowsedPlayerRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - // iMaxResponse is little endian - iMaxResponse = iReadStream.ReadInt32L(); - iPlayerId = Read16L(); - - iReadStream.Close(); - } - -EXPORT_C void RRemConSetBrowsedPlayerRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - // Use little endian on iMaxResponse - iStream.WriteInt32L(iMaxResponse); - Write16L(iPlayerId); - - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for SetBrowsedPlayer responses - -EXPORT_C void RRemConGetPathResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iStatus = Read8L(); - iUidCounter = Read16L(); - iNumberItems = Read32L(); - - iReadStream.Close(); - } - -EXPORT_C void RRemConGetPathResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - Write8L(iPduId); - Write16L(iParamLength); - Write8L(iStatus); - - if(iStatus != 0x4) - { - iStream.CommitL(); - return; - } - - // The depth is equal to the number of items in the array. - iFolderDepth = iPath.Count(); - Write16L(iUidCounter); - Write32L(iNumberItems); - Write16L(KUtf8MibEnum); - Write8L(iFolderDepth); - - for(TInt i = 0; i < iFolderDepth; i++) - { - Write16L((iPath[i])->Length()); - iStream.WriteL(*(iPath[i])); - } - - iStream.CommitL(); - } - -EXPORT_C TInt RRemConGetPathResponse::Size() - { - // Return the size that a buffer needs to be allocated to - // serialise the data encapsulated within this data structure. - iFolderDepth = iPath.Count(); - TInt size = 13 + (iFolderDepth*2); - - for(TInt i = 0; i < iFolderDepth; i++) - { - size += (iPath[i])->Length(); - } - - return size; - } - -EXPORT_C void RRemConGetPathResponse::Close() - { - iPath.ResetAndDestroy(); - } - -// -------------------------------------------------------------------------------- -// Used for parsing SetAddressedPlayer requests - -EXPORT_C void RAvrcpSetAddressedPlayerRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iPlayerId = Read16L(); - - iReadStream.Close(); - } - -EXPORT_C void RAvrcpSetAddressedPlayerRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - Write16L(iPlayerId); - - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for SetAddressedPlayer responses - -EXPORT_C void RAvrcpSetAddressedPlayerResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iStatus = Read8L(); - - iReadStream.Close(); - } - -EXPORT_C void RAvrcpSetAddressedPlayerResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - - Write32L(KErrNone); // Successful operation - Write8L(iStatus); - - iStream.CommitL(); - } - -// -------------------------------------------------------------------------------- -// Used for parsing PDU 0x71 requests with media player list scope - -EXPORT_C void RAvrcpGetFolderItemsRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iScope = Read8L(); - iStartItem = Read32L(); - iEndItem = Read32L(); - } - -EXPORT_C void RAvrcpGetFolderItemsRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - - Write8L(iScope); - Write32L(iStartItem); - Write32L(iEndItem); - - iStream.CommitL(); - } - -EXPORT_C void RAvrcpGetFolderItemsRequest::Close() - { - RAvrcpIPC::Close(); - } - -// -------------------------------------------------------------------------------- -// Used for PDU 0x71 responses with media player list scope - -EXPORT_C void RAvrcpGetFolderItemsResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - - iPduId = Read8L(); - iParamLength = Read16L(); - iStatus = Read8L(); - iUidCounter = Read16L(); - iNumberItems = Read16L(); - - for(TInt i = 0; i < iNumberItems; i++) - { - ReadItemL(); - } - - iReadStream.Close(); - } - -void RAvrcpGetFolderItemsResponse::ReadItemL() - { - RMediaPlayerItem item; - CleanupClosePushL(item); - - item.iType = static_cast(Read8L()); - item.iLength = Read16L(); - item.iPlayerId = Read16L(); - - item.iPlayerType = Read8L(); - item.iPlayerSubType = Read32L(); - item.iPlayStatus = Read8L(); - iReadStream.ReadL(item.iFeatureBitmask); - - item.iCharset = Read16L(); - item.iNameLength = Read16L(); - - item.iName.CreateL(item.iNameLength); - iReadStream.ReadL(item.iName); - - iItems.AppendL(item); - CleanupStack::Pop(&item); - } - -EXPORT_C void RAvrcpGetFolderItemsResponse::WriteL(TDes8& aOutData) - { - __ASSERT_DEBUG(aOutData.MaxLength() >= Size(), AvrcpIpcUtils::Panic(EAvrcpIpcCommandDataTooLong)); - aOutData.Zero(); - iStream.Open(aOutData); - - Write8L(iPduId); - Write16L(iParamLength); - Write8L(iStatus); - - if(iStatus == 0x4) - { - Write16L(iUidCounter); - Write16L(iNumberItems); - - for (TInt i = 0; i < iNumberItems; i++ ) - { - WriteItemL(i); - } - } - - iStream.CommitL(); - } - -void RAvrcpGetFolderItemsResponse::WriteItemL(TInt aIndex) - { - RMediaPlayerItem& item = iItems[aIndex]; - - Write8L(item.iType); - Write16L(item.iLength); - Write16L(item.iPlayerId); - - Write8L(item.iPlayerType); - Write32L(item.iPlayerSubType); - Write8L(item.iPlayStatus); - iStream.WriteL(item.iFeatureBitmask); - - Write16L(item.iCharset); - Write16L(item.iNameLength); - iStream.WriteL(item.iName); - } - -EXPORT_C TInt RAvrcpGetFolderItemsResponse::Size() - { - // Return the size that a buffer needs to be allocated to - // serialise the data encapsulated within this data structure. - - // base size - // pduid + paramlength + status + uidcount + number items - TInt size = KGetFolderItemsResponseBaseSize; - - for (TInt i = 0; i < iNumberItems; i++) - { - size += iItems[i].Size(); - } - return size; - } - -EXPORT_C void RAvrcpGetFolderItemsResponse::Close() - { - for (TInt i = 0; i < iNumberItems; i++) - { - iItems[i].Close(); - } - iItems.Reset(); - } - -// -------------------------------------------------------------------------------- -// Used for PDU 0x30 responses with event addressed player changed - -EXPORT_C void RAvrcpAddressedPlayerNotificationResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iPlayerId = Read16L(); - iUidCounter = Read16L(); - iReadStream.Close(); - } - -EXPORT_C void RAvrcpAddressedPlayerNotificationResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - - Write16L(iPlayerId); - Write16L(iUidCounter); - iStream.CommitL(); - } - -EXPORT_C void RAvrcpUidCounterNotificationResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iUidCounter = Read16L(); - iReadStream.Close(); - } - -EXPORT_C void RAvrcpUidCounterNotificationResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write32L(KErrNone); // Successful operation - - Write16L(iUidCounter); - iStream.CommitL(); - } - -EXPORT_C void RRemConMediaErrorResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iPduId = Read8L(); - iLength = Read16L(); - iStatus = Read8L(); - iReadStream.Close(); - } - -EXPORT_C void RRemConMediaErrorResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write8L(iPduId); - Write16L(KErrResponseParameterLength); - Write8L(iStatus); - iStream.CommitL(); - } - -EXPORT_C TUint8 RAvrcpIPC::SymbianErrToStatus(TInt aErr) - { - return KErrAvrcpAirBase - SymbianErrorCheck(aErr); - } - -/** -Ensure we get a known error. -*/ -EXPORT_C TInt RAvrcpIPC::SymbianErrorCheck(TInt aError) - { - TInt error = aError; - - switch (error) - { - case KErrNone: - error = KErrAvrcpAirSuccess; - break; - case KErrAvrcpAirInvalidCommand: - case KErrAvrcpAirInvalidParameter: - case KErrAvrcpAirParameterNotFound: - case KErrAvrcpAirInternalError: - case KErrAvrcpAirSuccess: - case KErrAvrcpAirUidChanged: - case KErrAvrcpAirReserved: - case KErrAvrcpAirInvalidDirection: - case KErrAvrcpAirNotADirectory: - case KErrAvrcpAirDoesNotExist: - case KErrAvrcpAirInvalidScope: - case KErrAvrcpAirRangeOutOfBounds: - case KErrAvrcpAirUidIsADirectory: - case KErrAvrcpAirMediaInUse: - case KErrAvrcpAirNowPlayingListFull: - case KErrAvrcpAirSearchNotSupported: - case KErrAvrcpAirSearchInProgress: - case KErrAvrcpAirInvalidPlayerId: - case KErrAvrcpAirPlayerNotBrowesable: - case KErrAvrcpAirPlayerNotAddressed: - case KErrAvrcpAirNoValidSearchResults: - case KErrAvrcpAirNoAvailablePlayers: - case KErrAvrcpAirAddressedPlayerChanged: - case KErrAvrcpInvalidScope: - break; - default: - error = KErrAvrcpAirInternalError; - } - - return error; - } - -EXPORT_C void RRemConUidsChangedRequest::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iInitialUidCounter = Read16L(); - } - -EXPORT_C void RRemConUidsChangedRequest::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write16L(iInitialUidCounter); - iStream.CommitL(); - } - -EXPORT_C void RRemConUidsChangedResponse::ReadL(const TDesC8& aData) - { - iReadStream.Open(aData); - iUidCounter = Read16L(); - } - -EXPORT_C void RRemConUidsChangedResponse::WriteL(TDes8& aOutData) - { - aOutData.Zero(); - iStream.Open(aOutData); - Write16L(iUidCounter); - iStream.CommitL(); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/avrcpipc/src/remconqueuemessage.cpp --- a/bluetoothappprofiles/avrcp/avrcpipc/src/remconqueuemessage.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalTechnology - @released -*/ - -#include "remconqueuemessage.h" -#include - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BEARER); -#endif - -EXPORT_C CRemConQueuedMessage* CRemConQueuedMessage::NewL(TUid aInterfaceUid - ,const TDesC8& aData - ,TInt aOperationId - ) - { - LOG_STATIC_FUNC - CRemConQueuedMessage* self = new(ELeave) CRemConQueuedMessage( - aInterfaceUid - ,aOperationId - ); - - CleanupStack::PushL(self); - self->ConstructL(aData); - CleanupStack::Pop(self); - return self; - } - -CRemConQueuedMessage::CRemConQueuedMessage(TUid aInterfaceUid - ,TInt aOperationId - ) -: iInterfaceUid(aInterfaceUid), iOperationId(aOperationId) - { - LOG_FUNC - } - -void CRemConQueuedMessage::ConstructL(const TDesC8& aData) - { - iData.CreateL(aData); - } - -EXPORT_C CRemConQueuedMessage::~CRemConQueuedMessage() - { - LOG_FUNC - iData.Close(); - } - -EXPORT_C const TDesC8& CRemConQueuedMessage::Data() - { - return iData; - } - -EXPORT_C const CRemConQueuedMessage* TRemConMessageQueue::Find( - TUid aInterfaceUid - ,TInt aOperationId - ) - { - CRemConQueuedMessage* request = NULL; - while (iIter) - { - request = iIter++; - if(request->iInterfaceUid == aInterfaceUid - && request->iOperationId == aOperationId - ) - { - return request; - } - } - - return NULL; - } - -EXPORT_C TRemConMessageQueue::TRemConMessageQueue() - :iQueue(_FOFF(CRemConQueuedMessage, iLink)) - , iIter(iQueue) - { - - } - -EXPORT_C void TRemConMessageQueue::Reset() - { - CRemConQueuedMessage* msg; - iIter.SetToFirst(); - while (NULL != (msg = iIter++)) - { - iQueue.Remove(*msg); - delete msg; - } - } - -EXPORT_C void TRemConMessageQueue::AddLast(CRemConQueuedMessage& aMsg) - { - iQueue.AddLast(aMsg); - } - -EXPORT_C TBool TRemConMessageQueue::IsEmpty() - { - return iQueue.IsEmpty(); - } - -EXPORT_C CRemConQueuedMessage* TRemConMessageQueue::First() const - { - return iQueue.First(); - } - -EXPORT_C void TRemConMessageQueue::Remove(CRemConQueuedMessage& aMsg) - { - iQueue.Remove(aMsg); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/batterystatusapi/bwins/remconbatterystatusapiu.def --- a/bluetoothappprofiles/avrcp/batterystatusapi/bwins/remconbatterystatusapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ??1CRemConBatteryApiTarget@@UAE@XZ @1 - ?NewL@CRemConBatteryApiTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConBatteryTargetObserver@@@Z @2 diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/batterystatusapi/eabi/remconbatterystatusapiu.def --- a/bluetoothappprofiles/avrcp/batterystatusapi/eabi/remconbatterystatusapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _ZN23CRemConBatteryApiTarget4NewLER24CRemConInterfaceSelectorR28MRemConBatteryTargetObserver @1 NONAME - _ZN23CRemConBatteryApiTargetD0Ev @2 NONAME - _ZN23CRemConBatteryApiTargetD1Ev @3 NONAME - _ZN23CRemConBatteryApiTargetD2Ev @4 NONAME diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/batterystatusapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/batterystatusapi/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remconbatterystatusapi.mmp - -PRJ_EXPORTS -../public/remconbatterytarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconbatterytarget.h) -../public/remconbatterytargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconbatterytargetobserver.h) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/batterystatusapi/group/remconbatterystatusapi.mmp --- a/bluetoothappprofiles/avrcp/batterystatusapi/group/remconbatterystatusapi.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -// Copyright (c) 2004-2009 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: -// remconbatterystatusapi.dll Remote Control Battery Status API - an outer-layer client side library. -// -// - -/** - @file - @internalComponent -*/ - -TARGET remconbatterystatusapi.dll -TARGETPATH /system/libs - -// We need all these caps because we don't know anything about the process -// we'll be running in. -CAPABILITY All -Tcb -TARGETTYPE dll - -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x101f9067 -VENDORID 0x70000001 - -SOURCEPATH ../src -SOURCE batterystatusapi.cpp - -USERINCLUDE ../../common -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -LIBRARY euser.lib -LIBRARY remconinterfacebase.lib - -#include - -UNPAGED - -SMPSAFE diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/batterystatusapi/public/remconbatterytarget.h --- a/bluetoothappprofiles/avrcp/batterystatusapi/public/remconbatterytarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONBATTERYTARGET_H -#define REMCONBATTERYTARGET_H - -#include -#include -#include - -class MRemConBatteryTargetObserver; -class MRemConCoreApiTargetObserver; -class CRemConInterfaceSelector; - -/** -Client-instantiable type supporting sending Battery Status responses. -*/ -NONSHARABLE_CLASS(CRemConBatteryApiTarget) : public CRemConInterfaceBase, - public MRemConInterfaceIf - { -public: - /** - Factory function. - @see CRemConInterfaceSelector - @see MRemConBatteryTargetObserver - @param aInterfaceSelector The interface selector. The client must have - created one of these first. - @param aObserver The observer of this interface. - @return A new CRemConBatteryApiTarget, owned by the interface selector. - */ - IMPORT_C static CRemConBatteryApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConBatteryTargetObserver& aObserver); - - /** Destructor */ - IMPORT_C ~CRemConBatteryApiTarget(); - -private: - /** - Constructor. - @param aInterfaceSelector The interface selector. - @param aObserver The observer of this interface. - */ - CRemConBatteryApiTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConBatteryTargetObserver& aObserver); - - void ConstructL(); - -private: // from CRemConInterfaceBase - TAny* GetInterfaceIf(TUid aUid); - -private: // from MRemConInterfaceIf - void MrcibNewMessage(TUint aOperationId, const TDesC8& aData); - -private: // unowned - MRemConBatteryTargetObserver& iObserver; - -private: // owned - CBufFlat* iOutData; - - - }; - -#endif // REMCONBATTERYTARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/batterystatusapi/public/remconbatterytargetobserver.h --- a/bluetoothappprofiles/avrcp/batterystatusapi/public/remconbatterytargetobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONBATTERYTARGETOBSERVER_H -#define REMCONBATTERYTARGETOBSERVER_H - -#include - -enum TControllerBatteryStatus - { - ENormal = 0, - EWarning = 1, - ECritical = 2, - EExternal = 3, - EFullCharge = 4, - }; - -/** -Clients must implement this interface in order to instantiate objects of type -CRemConBatteryTarget. This interface passes incoming commands from RemCon to -the client. -*/ -class MRemConBatteryTargetObserver - { -public: - /** - A 'InformBatteryStatusOfCT' has been received. - @param aBatteryStatus The current battery status. - */ - virtual void MrcbstoBatteryStatus(TControllerBatteryStatus& aBatteryStatus) = 0; - - }; - -#endif // REMCONBATTERYSTATUSTARGETOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/batterystatusapi/src/batterystatusapi.cpp --- a/bluetoothappprofiles/avrcp/batterystatusapi/src/batterystatusapi.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include -#include -#include - -#include "remconbattery.h" - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BATTERY_STATUS); -#endif - -EXPORT_C CRemConBatteryApiTarget* CRemConBatteryApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConBatteryTargetObserver& aObserver) - { - LOG_STATIC_FUNC - - CRemConBatteryApiTarget* self = new(ELeave) CRemConBatteryApiTarget(aInterfaceSelector, aObserver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CRemConBatteryApiTarget::CRemConBatteryApiTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConBatteryTargetObserver& aObserver) -: CRemConInterfaceBase(TUid::Uid(KRemConBatteryApiUid), - KLengthBatteryStatusMsg, - aInterfaceSelector, - ERemConClientTypeTarget), - iObserver(aObserver) - { - } - -void CRemConBatteryApiTarget::ConstructL() - { - // Create a output buffer (arbitrary value of 32 for granularity of buffer expansion) - iOutData = CBufFlat::NewL(32); - - // allocate a output buffer big enough for a TRemConBatteryApiResponse - iOutData->SetReserveL(sizeof(TPckg)); //do this now for easier writing to buffer - BaseConstructL(); - } - -EXPORT_C CRemConBatteryApiTarget::~CRemConBatteryApiTarget() - { - delete iOutData; - } - -/** Gets a pointer to a specific interface version. -@return A pointer to the interface, NULL if not supported. -@internalComponent -@released -*/ -TAny* CRemConBatteryApiTarget::GetInterfaceIf(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf1) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -// from MRemConInterfaceIf -void CRemConBatteryApiTarget::MrcibNewMessage(TUint /* aOperationId */, const TDesC8& aData) - { - // don't bother to log the operation ID as this was causing a build warning - LOG1(_L("\taInformBatteryStatusOfCT Data.Length = %d"), aData.Length()); - - TRemConBatteryApiResponse batteryApiResponse; - batteryApiResponse.iError = KErrNone; - iOutData->Reset(); - - // check for malformed messages, there should be 1 byte of data - if ( aData.Length() == 1 ) - { - // check the battery status is validvalue to the client observer - if ( aData[0] <= EFullCharge ) - { - TControllerBatteryStatus value = (TControllerBatteryStatus)aData[0]; - iObserver.MrcbstoBatteryStatus(value); - } - else - { - LOG(_L("\tMalformed message, data out range")); - batteryApiResponse.iError = KErrAvrcpMetadataInvalidParameter; - } - } - else - { - LOG(_L("\tMalformed message, data missing")); - batteryApiResponse.iError = KErrAvrcpMetadataParameterNotFound; - } - - // send a response to remcon (if OOM silently drop message) - TRAPD(error, iOutData->ResizeL(sizeof(TRemConBatteryApiResponse))); - if (error == KErrNone) - { - iOutData->Write(0,TPckg(batteryApiResponse)); - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConBatteryApiUid), - EInformBatteryStatusOfCT, ERemConResponse, iOutData->Ptr(0)); - } - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/bld.inf --- a/bluetoothappprofiles/avrcp/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent -*/ - -#include "avrcpipc/group/bld.inf" -#include "avc/bld.inf" -#include "batterystatusapi/group/bld.inf" -#include "groupnavigationapi/group/bld.inf" -#include "mediainformationapi/group/bld.inf" -#include "playerinformation/group/bld.inf" -#include "mediabrowseapi/group/bld.inf" -#include "nowplayingapi/group/bld.inf" -#include "remconbeareravrcp/group/bld.inf" -#include "statusclient/bld.inf" -#include "statusconverter/bld.inf" -#include "absolutevolumeapi/group/bld.inf" diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/bluetooth_avrcp.history.xml --- a/bluetoothappprofiles/avrcp/bluetooth_avrcp.history.xml Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ - - - - Audio/Video Remote Control Profile - - - - MetadataTransferCommands timer cancelled properly and put some delays in the ctrl scripts. - - - - Added copyright headers - - - - Set button action for all passthrough commands, including EVendorUnique ones. - - - - Fixed non-leavesafe automatic RArray. - - - - Some refactoring of HandleSetAddressedPlayer method. - - - - Initialise CPlayerInfoTarget::iBatteryStatus to the best value that can be retrieved from hardware P & S properties. Modify CPlayerInfoTarget::DoSetBatteryStatus() to filter out invalid values - - - - Ignore passthrough responses. - - - - Add IMPORT_C to ~CRemConNowPlayingTargetBase. - - - - Remove IMPORT_C from CPlayerApplicationSettings::NewL and NewLC. - - - - Fix to prevent memory leak in remconbeareravrcp caused when CAVCFrame* frame is allocated on the heap but Not deallocated when it goes out of scope. - - - - Change all logging over to Bluetooth logger. - - - - Added a static function -OpcodeL- which checks the Descriptor against the given opcode. - - - - Now its triggered if it exceed or equal the interval. - - - - Evaulation order clarified in avrcpoutgoingcommandhandler.cpp. - - - - Placed the leaving function on cleaup stack to handle unsafe leave. - - - - Split avrcp-settings.rss into avrcp-setting.rss and avrcp-settings.rls - - - - The PASS THROUGH commands with a non PANEL subunit_type should have a NOT IMPLEMENTED response. - - - - Modified the error code. - - - - Notify remcon of commands that have expired when a remote device disconnects - - - - calculated the Play Back Interval value between current and when last notification was sent and if it greater then iPlayerIntervalInMilliseconds,then send notification i.e. sent notification even in rewound case. - - - - Handled the unsafe leave by placing the concerned values and valueTexts in function playerApplicationSettingsResourceInit::DefineAttributesL(..) on cleanupstack. - - - - Method renamed to show it can leave. - - - - RArray replaced with a new class to store supported events in a bit mask. - - - - RAvrcpIPC::SetIPCOperationIdFromEventId(aEvent) is called to populate the correct operation Id for senderror(). - - - - Convert the playback interval to milliseconds. - - - - Codes added to handle the processing of Changed Play Status,Changed Current Track and Reached end or beginning of track. - - - - RemCon bearer changes to prevent panic. - - - - CleanupStack::PushL and CleanupStack::Pop are used to avoid memory leak. - - - - Make numRemotes a member variable so it's guaranteed to be there whenever the server writes to it. - - - - Add the boundary check for the number of attribute and the value of an attribute - - - - Now sending the response for EVENT_PLAYER_APPLICATION_SETTING_CHANGED i.e. PDU14 - - - - Add the boundary check for the numbers of player application setting values and value texts - - - - MPlayerCapabilitiesObserver::AddCompanyId() now fails with KErrOverflow if 255 company IDs are already listed. - - - - Non relevant comments are removed. - - - - Leave in a non-leaving function now handled - - - - Force disconnections of controller by transport now handled correctly - - - - Return value has been changed to KErrNone, instead of the position of the event - - - - API added to get inbound MTU for AVDTP media socket - - - - CPlayerInfoTarget::ProcessListPlayerApplicationAttributes does not return error when called without defined attributes. - - - - Interface access tags corrected for AVRCP APIs. - - - - removing the event from the pending notification list, if RemoveEvent is called. - - - - Appropriate level of Doxygen comments added - - - - Unwanted system INC file path is removed from mmp file - - - - Fixes key press problems - - - - - Changed the function call to get the Transaction ID - - - - Corrected filenames to enable building of Symbian OS in Linux - - - - Fixing CAVCFrame::FrameType(const TDesC8& aFrame) API so that it returns the type of the frame. This change has required a BR. - - - - AVRCP now sets message type to Response in CRcpCommand::ProcessOutgoingResponse. - - - - Handling memory leaks in AVRCP - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/bluetooth_avrcp.mrp --- a/bluetoothappprofiles/avrcp/bluetooth_avrcp.mrp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -# Copyright (c) 2004-2009 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: -# - -component bluetooth_avrcp -source \sf\mw\btservices\bluetoothappprofiles\avrcp - -binary \sf\mw\btservices\bluetoothappprofiles\avrcp all -exports \sf\mw\btservices\bluetoothappprofiles\avrcp -notes_source \component_defs\release.src - - -ipr E - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/bwins/avcU.def --- a/bluetoothappprofiles/avrcp/bwins/avcU.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -EXPORTS - ??1CAVCFrame@@UAE@XZ @ 1 NONAME ; CAVCFrame::~CAVCFrame(void) - ??ACAVCFrame@@QBEABEH@Z @ 2 NONAME ; unsigned char const & CAVCFrame::operator[](int) const - ?Append@CAVCFrame@@QAEXABVTDesC8@@@Z @ 3 NONAME ; void CAVCFrame::Append(class TDesC8 const &) - ?Append@CAVCFrame@@QAEXVTChar@@@Z @ 4 NONAME ; void CAVCFrame::Append(class TChar) - ?ButtonAct@CAVCFrame@@QBEHAAW4TButtonAction@AVCPanel@@@Z @ 5 NONAME ; int CAVCFrame::ButtonAct(enum AVCPanel::TButtonAction &) const - ?Data@CAVCFrame@@QBEABVTDesC8@@XZ @ 6 NONAME ; class TDesC8 const & CAVCFrame::Data(void) const - ?FrameType@CAVCFrame@@QBE?AW4TFrameType@AVC@@XZ @ 7 NONAME ; enum AVC::TFrameType CAVCFrame::FrameType(void) const - ?FrameType@CAVCFrame@@SA?AW4TFrameType@AVC@@ABVTDesC8@@@Z @ 8 NONAME ; enum AVC::TFrameType CAVCFrame::FrameType(class TDesC8 const &) - ?NewL@CAVCFrame@@SAPAV1@ABVTDesC8@@W4TFrameType@AVC@@@Z @ 9 NONAME ; class CAVCFrame * CAVCFrame::NewL(class TDesC8 const &, enum AVC::TFrameType) - ?NewL@CAVCFrame@@SAPAV1@W4TFrameType@AVC@@W4TCType@3@W4TSubunitType@3@W4TSubunitID@3@@Z @ 10 NONAME ; class CAVCFrame * CAVCFrame::NewL(enum AVC::TFrameType, enum AVC::TCType, enum AVC::TSubunitType, enum AVC::TSubunitID) - ?Opcode@CAVCFrame@@QBEEXZ @ 11 NONAME ; unsigned char CAVCFrame::Opcode(void) const - ?OperationId@CAVCFrame@@QBEHAAE@Z @ 12 NONAME ; int CAVCFrame::OperationId(unsigned char &) const - ?SetFrameType@CAVCFrame@@QAEXW4TFrameType@AVC@@@Z @ 13 NONAME ; void CAVCFrame::SetFrameType(enum AVC::TFrameType) - ?SetType@CAVCFrame@@QAEXW4TCType@AVC@@@Z @ 14 NONAME ; void CAVCFrame::SetType(enum AVC::TCType) - ?SubunitID@CAVCFrame@@QBE?AW4TSubunitID@AVC@@XZ @ 15 NONAME ; enum AVC::TSubunitID CAVCFrame::SubunitID(void) const - ?SubunitType@CAVCFrame@@QBE?AW4TSubunitType@AVC@@XZ @ 16 NONAME ; enum AVC::TSubunitType CAVCFrame::SubunitType(void) const - ?Type@CAVCFrame@@QBE?AW4TCType@AVC@@XZ @ 17 NONAME ; enum AVC::TCType CAVCFrame::Type(void) const - ?DataLength@CAVCFrame@@QBEHXZ @ 18 NONAME ; int CAVCFrame::DataLength(void) const - ?GetPayloadAndVID@CAVCVendorDependentCommand@@SA?AVTPtrC8@@ABVCAVCFrame@@AAI@Z @19 - ?GetPayloadAndVID@CAVCVendorUniquePassthroughCommand@@SA?AVTPtrC8@@ABVCAVCFrame@@AAI@Z @20 - ?NewL@CAVCPassthroughResponse@@SAPAVCAVCFrame@@XZ @21 ABSENT - ?NewL@CAVCVendorDependentResponse@@SAPAVCAVCFrame@@I@Z @22 - ?OpcodeL@CAVCFrame@@SA?AW4TOpcode@AVC@@ABVTDesC8@@@Z @ 23 NONAME ; enum AVC::TOpcode CAVCFrame::OpcodeL(class TDesC8 const &) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/bwins/remconstatusapiU.DEF --- a/bluetoothappprofiles/avrcp/bwins/remconstatusapiU.DEF Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - ??1CRemConStatusApiController@@UAE@XZ @ 1 NONAME ; CRemConStatusApiController::~CRemConStatusApiController(void) - ?Mrcsaco_ExtensionInterfaceL@MRemConStatusApiControllerObserver@@UAEXVTUid@@AAPAX@Z @ 2 NONAME ; void MRemConStatusApiControllerObserver::Mrcsaco_ExtensionInterfaceL(class TUid, void * &) - ?NewL@CRemConStatusApiController@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConStatusApiControllerObserver@@@Z @ 3 NONAME ; class CRemConStatusApiController * CRemConStatusApiController::NewL(class CRemConInterfaceSelector &, class MRemConStatusApiControllerObserver &) - ?SubunitInfo@CRemConStatusApiController@@QAEXAAVTRequestStatus@@AAI@Z @ 4 NONAME ; void CRemConStatusApiController::SubunitInfo(class TRequestStatus &, unsigned int &) - ?UnitInfo@CRemConStatusApiController@@QAEXAAVTRequestStatus@@AAI@Z @ 5 NONAME ; void CRemConStatusApiController::UnitInfo(class TRequestStatus &, unsigned int &) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/avrcpinternalinterface.h --- a/bluetoothappprofiles/avrcp/common/avrcpinternalinterface.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#ifndef AVRCPINTERNALINTERFACE_H -#define AVRCPINTERNALINTERFACE_H - -/** -@file -@internalTechnology -@prototype -*/ - -#include -#include "avrcpipc.h" -#include "browsingframe.h" - -const TInt KUidAvrcpInternalInterface = 0x10285eef; - -enum TAvrcpInternalInterfaceOperationId - { - EAvrcpInternalGetFolderItems = 0x0, - EAvrcpInternalAvailablePlayersNotification = 0xa31, - EAvrcpInternalAddressedPlayerNotification = 0xb31, - EAvrcpInternalUidChangedNotification = 0xc31, - EAvrcpInternalSetAddressedPlayer = 0x60, - }; - -const TInt KSetAddressedPlayerResponseSize = 8; -const TInt KRegisterNotificationEmptyResponseSize = 4; -const TInt KRegisterNotificationAddressedPlayerResponseSize = 8; -const TInt KRegisterNotificationUidChangedResponseSize = 6; -const TUint16 KMediaPlayerListUidCounter = 0; - -class RMediaPlayerItem - { -public: - IMPORT_C void Close(); - IMPORT_C TInt Size(); - -public: - AvrcpBrowsing::TItemType iType; - TUint16 iLength; - TUint16 iPlayerId; - - TUint8 iPlayerType; - TUint32 iPlayerSubType; - TUint8 iPlayStatus; - TBuf8<16> iFeatureBitmask; - - TUint16 iCharset; - TUint16 iNameLength; - RBuf8 iName; - }; - -//-------------------------------------------------- -// SetAddressedPlayer 0x60 -//-------------------------------------------------- -class RAvrcpSetAddressedPlayerRequest : public RAvrcpIPC - { -public: - TUint16 iPlayerId; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -class RAvrcpSetAddressedPlayerResponse : public RAvrcpIPC - { -public: - TUint8 iStatus; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -//-------------------------------------------------- -// GetFolderItems Media Player Scope 0x71 -//-------------------------------------------------- -class RAvrcpGetFolderItemsRequest : public RAvrcpIPC - { -public: - AvrcpBrowsing::TScope iScope; - TUint iStartItem; - TUint iEndItem; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C void Close(); - }; - -class RAvrcpGetFolderItemsResponse : public RAvrcpIPC - { -public: - TUint8 iPduId; - TUint16 iParamLength; - TUint8 iStatus; - TUint16 iUidCounter; - TUint16 iNumberItems; - RArray iItems; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C TInt Size(); - IMPORT_C void Close(); - -private: - void ReadItemL(); - void WriteItemL(TInt aIndex); - }; - -//-------------------------------------------------- -// Register Notification Addressed Player -//-------------------------------------------------- -class RAvrcpAddressedPlayerNotificationResponse : public RAvrcpIPC - { -public: - TUint16 iPlayerId; - TUint16 iUidCounter; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8&); - }; - -//-------------------------------------------------- -// Register Notification Uid Counter -//-------------------------------------------------- -class RAvrcpUidCounterNotificationResponse : public RAvrcpIPC - { -public: - TUint16 iUidCounter; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8&); - }; - - -#endif //AVRCPINTERNALINTERFACE_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/avrcpipc.h --- a/bluetoothappprofiles/avrcp/common/avrcpipc.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -// Copyright (c) 2007-2009 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: -// This file contains structures shared by the AVRCP API with the AVRCP bearer. -// -// - -/** - @file - @internalTechnology - @released -*/ - -#ifndef AVRCPIPC_H -#define AVRCPIPC_H - -#include -#include - -// Structure of commands for AVRCP player information requests via IPC -class RAvrcpIPC -{ -public: - IMPORT_C static TMetadataTransferPDU GetPDUIdFromIPCOperationId(TInt aOperationId); - IMPORT_C static TRegisterNotificationEvent GetEventIdFromIPCOperationId(TInt aOperationId); - IMPORT_C static TInt SetIPCOperationIdFromEventId(TRegisterNotificationEvent aEventId); - IMPORT_C static TUint8 SymbianErrToStatus(TInt aErr); - IMPORT_C static TInt SymbianErrorCheck(TInt aError); - -public: - virtual void ReadL(const TDesC8& aData) = 0; - virtual void WriteL(TDes8& aOutData) = 0; - -protected: - // Big-endian methods; Symbian native methods are little-endian - TUint8 Read8L(); - TUint16 Read16L(); - TUint32 Read32L(); - TUint32 Read24L(); // Required for PDU 0x10 - TUint64 Read64L(); - void Write8L(TUint8 aVal); - void Write16L(TUint16 aVal); - void Write24L(TUint32 aVal); // Required for PDU 0x10 - void Write32L(TUint32 aVal); - void Write64L(TUint64 aVal); - void Close(); - -public: - RDesWriteStream iStream; - RDesReadStream iReadStream; -}; - -const TUint8 KLengthErrorResponse = 4; // 4 bytes for errors returned via IPC -class RAvrcpIPCError : public RAvrcpIPC -{ -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - -public: - TInt iError; -}; - -#endif // AVRCPIPC_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/browsingframe.h --- a/bluetoothappprofiles/avrcp/common/browsingframe.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -// Copyright (c) 2008-2009 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: -// browisngframe.h -// - -#ifndef BROWSINGFRAME_H -#define BROWSINGFRAME_H - -/** -@file -@internalComponent -@released -*/ - -#include - -const TInt KUidCounter = 0; - -namespace AvrcpBrowsing - { -const TInt KHeaderLength = 3; -typedef TUint8 TPduId; -typedef TUint8 TScope; -typedef TUint8 TDirection; -typedef TUint8 TPlayable; -typedef TUint8 TMediaType; - -const TScope KMediaPlayerScope = 0x0; -const TScope KVirtualFilesystemScope = 0x1; -const TScope KSearchScope = 0x2; -const TScope KNowPlayingScope = 0x3; - -const TDirection KUp = 0x00; -const TDirection KDown = 0x01; - -const TPlayable KPlayable = 1; -const TPlayable KNotPlayable = 0; -const TPlayable KPlayableReserved = 2; - -const TMediaType KAudio = 0; -const TMediaType KVideo = 1; -const TMediaType KMediaTypeReserved = 2; - -enum TPdu - { - ESetBrowsedPlayer = 0x70, - EGetFolderItems = 0x71, - EChangePath = 0x72, - EGetItemAttributes = 0x73, - ESearch = 0x80, - EGeneralReject = 0xa0, - }; - -enum TItemType - { - EMediaPlayer = 0x01, - EFolderItem = 0x02, - EMediaElement = 0x03, - }; - -enum TFolderType - { - EMixed = 0, - ETitles = 1, - EAlbums = 2, - EArtists = 3, - EGenres = 4, - EPlaylists = 5, - EYears = 6, - EFolderTypeReserved = 7, - }; - -class BrowsingFrame - { -public: - static void VerifyFrameL(const TDesC8& aFrame); - static TPduId PduId(const TDesC8& aFrame); - static TInt ParamLength(const TDesC8& aFrame); - static void Payload(const TDesC8& aFrame, TPtrC8& aPayload); - }; - - } // end namespace BrowsingFrame - -#endif //BROWSINGFRAME_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/mediabrowse.h --- a/bluetoothappprofiles/avrcp/common/mediabrowse.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,315 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalTechnology - @released -*/ - -#ifndef MEDIABROWSE_H -#define MEDIABROWSE_H - -#include -#include -#include -#include "avrcpipc.h" -#include "browsingframe.h" -#include "mediainformation.h" - -//-------------------------------------------------------------------------- -// Interface Data -//-------------------------------------------------------------------------- - -enum TRemConMediaBrowseOperationId - { - EGetFolderItemsOperationId, - EChangePathOperationId, - EGetItemAttributesOperationId, - ESearchOperationId, - ESetMaxResponseOperationId, - ESetBrowsedPlayerOperationId, - EUIDPersistency, - EMediaLibraryStateCookieUpdateOperationId, - }; - -/** - * The UID identifying the RemCon NowPlaying interface. - */ -const TInt KRemConMediaBrowseApiUid = 0x10285bbb; - -// identifier (8bytes) NumAttributes (1) AttributeID (max is 4*7) = 37 + UID Counter + scope -const TInt KMaxLengthMediaBrowseMsg = 400; - -//PDU ID(1 byte) + Parameter length(2 bytes) + Status(1 byte), -//the total of which is 4 bytes -const TInt KBrowseResponseBaseLength = 4; - -//KBrowseResponseBaseLength(4 bytes) + UID Counter(2 bytes) + Number of Items(2 bytes) -//the total of which is 8 -const TInt KGetFolderItemsResponseBaseSize = 8; - -//UID 8 + FolderType 1 + Is Playable 1 + Character set ID 2 + Name length 2 -const TInt KFolderItemBaseLength = 14; - -//UID 8 + Type 1 + Character Set 2 + Name Length 2 + Number of attributes 1 -const TInt KMediaElementItemBaseLength = 14; - -//ID 4 + Character Set 2 + Length filed 2 -const TInt KAttributeBaseLength = 8; - -//Status 1 -const TInt KErrResponseParameterLength = 1; - -/** -This is the max length of a response used in media browse API for fix-length responses. -For the response which have a fix-length the Search(PDU 0x80) has the maximum response -which is KBrowseResponseBaseLength(4 bytes)+ UID Counter(2 bytes) + Number of Items(4 bytes) -the total of which is 10 -*/ -const TInt KMediaBrowseOutBufMaxLength = 10; - -class RItem - { -public: - IMPORT_C void Close(); - IMPORT_C TInt Size(); - -public: - AvrcpBrowsing::TItemType iType; - TUint16 iLength; - TUint64 iUid; - - TUint16 iCharset; - TUint16 iNameLength; - HBufC8* iName; - - // Folder attributes - AvrcpBrowsing::TFolderType iFolderType; - AvrcpBrowsing::TPlayable iPlayable; - - // Media element attributes - AvrcpBrowsing::TMediaType iMediaType; - TInt iNumberAttributes; - RArray iAttributes; - }; - -//-------------------------------------------------- -// GetFolderItems 0x71 -//-------------------------------------------------- -class RRemConGetFolderItemsRequest : public RAvrcpIPC - { -public: - AvrcpBrowsing::TScope iScope; - TUint iStartItem; - TUint iEndItem; - TInt iNumberAttributes; - RArray iAttributes; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C void Close(); - IMPORT_C TInt CopyAttributes(RArray& aOutAttributes); - }; - -class RRemConGetFolderItemsResponse : public RAvrcpIPC - { -public: - TUint8 iPduId; - TUint16 iParamLength; - TUint8 iStatus; - TUint16 iUidCounter; - TUint16 iNumberItems; - RArray iItems; - - TInt iMaxResponse; - TInt iCurrentItem; - TInt iCurrentListingSize; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C TInt Size(); - IMPORT_C void Close(); - IMPORT_C TInt CopyItems(const TArray& aItems); - IMPORT_C TBool RequestNextItem(TInt& aError, RBuf8& aOutBuf, TUint16 aCookie); - -private: - void ReadItemL(); - void WriteItemL(TInt aIndex); - }; - -//-------------------------------------------------- -// ChangePath 0x72 -//-------------------------------------------------- -class RRemConChangePathRequest : public RAvrcpIPC - { -public: - TUint16 iUidCounter; - AvrcpBrowsing::TDirection iDirection; - TUint64 iElement; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - - -class RRemConChangePathResponse : public RAvrcpIPC - { -public: - TUint8 iPduId; - TUint16 iParamLength; - TUint8 iStatus; - TInt iNumberItems; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -//-------------------------------------------------- -// GetItemAttributes 0x73 -//-------------------------------------------------- -class RRemConGetItemAttributesRequest : public RAvrcpIPC - { -public: - AvrcpBrowsing::TScope iScope; - TUint64 iElement; - TUint16 iUidCounter; - TInt iNumberAttributes; - RArray iAttributes; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C void Close(); - }; - - -class RRemConGetItemAttributesResponse : public RAvrcpIPC - { -public: - TUint8 iPduId; - TUint16 iParamLength; - TUint8 iStatus; - TInt iNumberAttributes; - RArray iAttributes; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C TInt Size(); - IMPORT_C void Close(); - }; - -//-------------------------------------------------- -// Search 0x80 -//-------------------------------------------------- -class RRemConSearchRequest : public RAvrcpIPC - { -public: - TUint16 iCharset; - TUint16 iStringLen; - RBuf8 iSearchString; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C TInt Size(); - IMPORT_C void Close(); - }; - -class RRemConSearchResponse : public RAvrcpIPC - { -public: - TUint8 iPduId; - TUint16 iParamLength; - TUint8 iStatus; - TUint16 iUidCounter; - TUint iNumberItems; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -//-------------------------------------------------- -// SetBrowsedPlayer -//-------------------------------------------------- -class RRemConSetBrowsedPlayerRequest : public RAvrcpIPC - { -public: - TInt iMaxResponse; - TUint16 iPlayerId; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -class RRemConGetPathResponse : public RAvrcpIPC - { -public: - TUint8 iPduId; - TUint16 iParamLength; - TUint8 iStatus; - TUint16 iUidCounter; - TUint iNumberItems; - TUint16 iCharset; - TUint8 iFolderDepth; - RPointerArray iPath; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C TInt Size(); - IMPORT_C void Close(); - }; - -class RRemConMediaErrorResponse : public RAvrcpIPC - { -public: - TUint8 iPduId; - TUint16 iLength; - TUint8 iStatus; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -class RRemConUidsChangedRequest : public RAvrcpIPC - { -public: - TUint16 iInitialUidCounter; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -class RRemConUidsChangedResponse : public RAvrcpIPC - { -public: - TUint16 iUidCounter; -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; -#endif //MEDIABROWSE_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/mediainformation.h --- a/bluetoothappprofiles/avrcp/common/mediainformation.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @internalTechnology - @released -*/ - -#ifndef REMCONMEDIAINFORMATION_H -#define REMCONMEDIAINFORMATION_H - -#include "avrcpipc.h" - -//-------------------------------------------------------------------------- -// Interface Data -//-------------------------------------------------------------------------- - -/** - * The UID identifying the RemCon MediaInformation interface. - */ -const TInt KRemConMediaInformationApiUid = 0x10285B20; - -// identifier (8bytes) NumAttributes (1) AttributeID (max is 4*7) = 37 -const TInt KMaxLengthMediaInformationMsg = 37; -const TInt KMaxMediaAttributeValue = 7; - -class RRemConGetElementAttributesRequest : public RAvrcpIPC - { -public: - TUint64 iElement; - TInt iNumberAttributes; - RArray iAttributes; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C void Close(); - }; - - -class REAResponse - { -public: - IMPORT_C void Close(); -public: - TInt iAttributeId; - TUint16 iCharset; - TUint16 iStringLen; - HBufC8* iString; - }; - - -class RRemConGetElementAttributesResponse : public RAvrcpIPC - { -public: - TInt iNumberAttributes; - RArray iAttributes; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C TInt Size(); - IMPORT_C void Close(); - }; - -#endif // REMCONMEDIAINFORMATION_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/nowplaying.h --- a/bluetoothappprofiles/avrcp/common/nowplaying.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalTechnology - @released -*/ - -#ifndef NOWPLAYING_H -#define NOWPLAYING_H - -#include -#include -#include "avrcpipc.h" - -//The UID identifying the RemCon NowPlaying interface. -const TInt KRemConNowPlayingApiUid = 0x10285bbc; - -/** -This is the maximum length of a request that can be received -Play Item(0x74) and AddToNowPlaying(0x90) have the largest possible request -which is Scope (1 byte) + UID (8 bytes) + UID Counter (2 bytes) -the total of which is 11 -*/ -const TInt KMaxLengthNowPlayingMsg = 11; - - -class RRemConNowPlayingRequest : public RAvrcpIPC - { -public: - TRemConFolderScope iScope; - TUint64 iElement; - TUint16 iUidCounter; -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -class RRemConNowPlayingResponse : public RAvrcpIPC - { -public: - TUint8 iStatus; -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - }; - -#endif //NOWPLAYING_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/playerinformation.h --- a/bluetoothappprofiles/avrcp/common/playerinformation.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -// Copyright (c) 2008-2009 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: -// playerinformation.h This file contains structures shared by the AVRCP API with the AVRCP bearer. -// -// - -/** - @file - @internalTechnology - @released -*/ - -#ifndef REMCONPLAYERINFORMATION_H -#define REMCONPLAYERINFORMATION_H - -#include "playerinformationtarget.h" -#include "avrcpipc.h" -#include - -/** - * The UID identifying the RemCon PlayerInformation interface. - */ -const TInt KRemConPlayerInformationUid = 0x10285B21; - -// The Bluetooth SIG registered VendorId, see table 4.7 -const AVC::TAVCVendorId KBluetoothSIGVendorId = 0x001958; - -// This is the maximum length of a request that can be received -// GetElementAttributes (PDU 0x20) has the largest possible request -// which is identifier (8 bytes) + numAttr (1 byte) + attributes -// (255 * 4 bytes) the total of which is 1029 bytes. -const TInt KMaxLengthPlayerInformationMsg = 1029; - - -// Used by PDU 0x11 and PDU 0x12 -class RRemConPlayerListOfAttributes : public RAvrcpIPC -{ -public: - TInt iNumberAttributes; - RArray iAttributes; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C void Close(); -}; - -// Used by PDU 0x13 (response) and PDU 0x14 (request) -class RRemConPlayerAttributeIdsAndValues : public RAvrcpIPC -{ -public: - TInt iNumberAttributes; - RArray iAttributeId; - RArray iAttributeValue; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C void Close(); -}; - -class RSettingWithCharset - { -public: - IMPORT_C void Close(); - -public: - TInt iAttributeId; - TUint16 iCharset; - TInt iStringLen; - HBufC8* iString; -}; - -// Used by PDU 0x15 and PDU 0x16 -class RRemConGetPlayerApplicationTextResponse : public RAvrcpIPC -{ -public: - TInt iNumberAttributes; - RArray iAttributes; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C void Close(); - IMPORT_C TInt Size(); -}; - -// Used by PDU 0x10 -class RRemConGetCapabilitiesResponse : public RAvrcpIPC -{ -public: - TUint16 iCapabilityId; - TUint16 iCapabilityCount; - RArray iCapabilities; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8& aOutData); - IMPORT_C void Close(); -}; - -// Used by PDU 0x30 -class RRemConPlayerInformationGetPlayStatusResponse : public RAvrcpIPC - { -public: - TUint iPlayPos; - TUint iTrackLength; - MPlayerEventsObserver::TPlaybackStatus iStatus; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8&); - }; - -// Used by PDU 0xff -class RRemConPlayerInformationGetPlayStatusUpdateRequest : public RAvrcpIPC - { -public: - MPlayerEventsObserver::TPlaybackStatus iStatus; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8&); - }; - -// Used by PDU 0xff -class RRemConPlayerInformationGetPlayStatusUpdateResponse : public RAvrcpIPC - { -public: - MPlayerEventsObserver::TPlaybackStatus iStatus; - -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8&); - }; - -class RRemConPlayerInformation8BitResponse : public RAvrcpIPC - { -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8&); - TUint8 iValue; - }; - -class RRemConPlayerInformation32BitResponse : public RAvrcpIPC - { -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8&); - TInt iValue; - }; - -class RRemConPlayerInformation64BitResponse : public RAvrcpIPC - { -public: - IMPORT_C void ReadL(const TDesC8& aData); - IMPORT_C void WriteL(TDes8&); - TUint64 iValue; - }; - -#endif // REMCONPLAYERINFORMATION_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/remconbattery.h --- a/bluetoothappprofiles/avrcp/common/remconbattery.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalTechnology -*/ - -#ifndef REMCONBATTERY_H -#define REMCONBATTERY_H - -#include - - -//-------------------------------------------------------------------------- -// Interface Data -//-------------------------------------------------------------------------- - -/** -The UID identifying this outer-layer RemCon interface. -*/ -const TInt KRemConBatteryApiUid = 0x10285AE7; - -struct TRemConBatteryApiResponse - { - // Error code - TInt iError; - }; - -const TInt KLengthBatteryStatusMsg = 1; - - -#endif // REMCONBATTERY_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/remcongroupnavigation.h --- a/bluetoothappprofiles/avrcp/common/remcongroupnavigation.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @internalTechnology -*/ - -#ifndef REMCONGROUPNAVIGATION_H -#define REMCONGROUPNAVIGATION_H - -#include - -//-------------------------------------------------------------------------- -// Interface Data -//-------------------------------------------------------------------------- - -/** -The UID identifying the RemCon Group Navigation interface. -*/ -const TInt KRemConGroupNavigationApiUid = 0x10285B01; - -const TInt KMaxSizeRemConGroupNavigationMsg =1; - -struct TRemConGroupNavigationResponse - { - // Error code - TInt iError; - }; - -#endif // REMCONGROUPNAVIGATION_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/remconqueuemessage.h --- a/bluetoothappprofiles/avrcp/common/remconqueuemessage.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalTechnology - @released -*/ - -#ifndef REMCONQUEUEMESSAGE_H_ -#define REMCONQUEUEMESSAGE_H_ - -#include - -class CRemConQueuedMessage; - -/** -A queue for RemCon request command messages. -*/ -NONSHARABLE_CLASS(TRemConMessageQueue) - { -public: - IMPORT_C TRemConMessageQueue(); - IMPORT_C void Reset(); - IMPORT_C void AddLast(CRemConQueuedMessage& aMsg); - IMPORT_C TBool IsEmpty(); - IMPORT_C CRemConQueuedMessage* First() const; - IMPORT_C void Remove(CRemConQueuedMessage& aMsg); - IMPORT_C const CRemConQueuedMessage* Find(TUid aInterfaceUid - ,TInt aOperationId - ); -private: - TSglQue iQueue; - TSglQueIter iIter; - }; - -/** -A data encapsulation class for a request. - -The object contains the data of the request and the type of the request, which -will be put in a queue. -*/ -NONSHARABLE_CLASS(CRemConQueuedMessage) : public CBase - { -public: - IMPORT_C static CRemConQueuedMessage* NewL(TUid aInterfaceUid - ,const TDesC8& aData - ,TInt aOperationId - ); - - IMPORT_C ~CRemConQueuedMessage(); - IMPORT_C const TDesC8& Data(); - -private: - CRemConQueuedMessage(TUid aInterfaceUid, TInt aOperationId); - void ConstructL(const TDesC8& aData); - -public: - TSglQueLink iLink; - TUid iInterfaceUid; - TInt iOperationId; - -private: - RBuf8 iData; - }; - - -#endif /*REMCONQUEUEMESSAGE_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/common/remconstatusapi.h --- a/bluetoothappprofiles/avrcp/common/remconstatusapi.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent - @released -*/ - -#ifndef REMCONSTATUSAPI_H -#define REMCONSTATUSAPI_H - -#include - -const TUint KRemConStatusApiMaxOperationSpecificDataSize = 10; - -//-------------------------------------------------------------------------- -// Unit info response data format -//-------------------------------------------------------------------------- - -/** Length of the VendorId field in bytes. */ -const TUint KRemConStatusApiVendorIdLength = 3; - -/** Offset for VendorId field */ -const TUint KRemConStatusApiVendorIdOffset = 0; - -/** Length of the Unit field in bytes. */ -const TUint KRemConStatusApiUnitLength = 1; - -/** Offset for Unit field */ -const TUint KRemConStatusApiUnitOffset = KRemConStatusApiVendorIdLength; - -/** Length of the Unit type field in bytes. */ -const TUint KRemConStatusApiUnitTypeLength = 1; - -/** Offset for Unit type field */ -const TUint KRemConStatusApiUnitTypeOffset = KRemConStatusApiVendorIdLength + KRemConStatusApiUnitLength; - -/** Length of the Extended Unit type field in bytes. */ -const TUint KRemConStatusApiExtendedUnitTypeLength = 2; - -/** Offset for Extended Unit type field. - -This data is only valid if Unit type is 0x1e. -The second byte is only valid if the first byte is 0xff. -See AV/C general specification for details. -*/ -const TUint KRemConStatusApiExtendedUnitTypeOffset = - KRemConStatusApiVendorIdLength + KRemConStatusApiUnitLength +KRemConStatusApiUnitTypeLength; - -//-------------------------------------------------------------------------- -// SubUnit info response data format -//-------------------------------------------------------------------------- - -/** Length of the page field in bytes. */ -const TUint KRemConStatusApiPageLength = 1; - -/** Offset for page field */ -const TUint KRemConStatusApiPageOffset = 0; - -/** Length of the extension field in bytes. */ -const TUint KRemConStatusApiExtensionLength = 1; - -/** Offset for extension field */ -const TUint KRemConStatusApiExtensionOffset = KRemConStatusApiPageLength; - -/** Length of the page data field in bytes. - -This is defined as being all data from KRemConStatusApiPageDataOffset -to the end of the response data. -*/ - -/** Offset for page data field */ -const TUint KRemConStatusApiPageDataOffset = KRemConStatusApiPageLength + KRemConStatusApiExtensionLength; - -//-------------------------------------------------------------------------- -// Interface Data -//-------------------------------------------------------------------------- - -/** -The UID identifying this outer-layer RemCon interface. -*/ -const TInt KRemConStatusApiUid = 0x10207ea5; - -/** -Operation ids belonging to the Status API. -*/ -enum TRemConStatusApiOperationId - { - ERemConStatusApiUnitInfo = 0x00, - ERemConStatusApiSubunitInfo = 0x01, - }; - -#endif // REMCONSTATUSAPI_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/eabi/avcU.def --- a/bluetoothappprofiles/avrcp/eabi/avcU.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -EXPORTS - _ZN9CAVCFrame12SetFrameTypeEN3AVC10TFrameTypeE @ 1 NONAME - _ZN9CAVCFrame4NewLEN3AVC10TFrameTypeENS0_6TCTypeENS0_12TSubunitTypeENS0_10TSubunitIDE @ 2 NONAME - _ZN9CAVCFrame4NewLERK6TDesC8N3AVC10TFrameTypeE @ 3 NONAME - _ZN9CAVCFrame6AppendE5TChar @ 4 NONAME - _ZN9CAVCFrame6AppendERK6TDesC8 @ 5 NONAME - _ZN9CAVCFrame7SetTypeEN3AVC6TCTypeE @ 6 NONAME - _ZN9CAVCFrame9FrameTypeERK6TDesC8 @ 7 NONAME - _ZN9CAVCFrameD0Ev @ 8 NONAME - _ZN9CAVCFrameD1Ev @ 9 NONAME - _ZN9CAVCFrameD2Ev @ 10 NONAME - _ZNK9CAVCFrame11OperationIdERh @ 11 NONAME - _ZNK9CAVCFrame11SubunitTypeEv @ 12 NONAME - _ZNK9CAVCFrame4DataEv @ 13 NONAME - _ZNK9CAVCFrame4TypeEv @ 14 NONAME - _ZNK9CAVCFrame6OpcodeEv @ 15 NONAME - _ZNK9CAVCFrame9ButtonActERN8AVCPanel13TButtonActionE @ 16 NONAME - _ZNK9CAVCFrame9FrameTypeEv @ 17 NONAME - _ZNK9CAVCFrame9SubunitIDEv @ 18 NONAME - _ZNK9CAVCFrameixEi @ 19 NONAME - _ZNK9CAVCFrame10DataLengthEv @ 20 NONAME - _ZN23CAVCPassthroughResponse4NewLEv @21 NONAME ABSENT - _ZN26CAVCVendorDependentCommand16GetPayloadAndVIDERK9CAVCFrameRj @22 NONAME - _ZN27CAVCVendorDependentResponse4NewLEj @23 NONAME - _ZN34CAVCVendorUniquePassthroughCommand16GetPayloadAndVIDERK9CAVCFrameRj @24 NONAME - _ZN9CAVCFrame7OpcodeLERK6TDesC8 @ 25 NONAME diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/eabi/remconstatusapiU.DEF --- a/bluetoothappprofiles/avrcp/eabi/remconstatusapiU.DEF Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - _ZN26CRemConStatusApiController11SubunitInfoER14TRequestStatusRj @ 1 NONAME - _ZN26CRemConStatusApiController4NewLER24CRemConInterfaceSelectorR34MRemConStatusApiControllerObserver @ 2 NONAME - _ZN26CRemConStatusApiController8UnitInfoER14TRequestStatusRj @ 3 NONAME - _ZN26CRemConStatusApiControllerD0Ev @ 4 NONAME - _ZN26CRemConStatusApiControllerD1Ev @ 5 NONAME - _ZN26CRemConStatusApiControllerD2Ev @ 6 NONAME - _ZN34MRemConStatusApiControllerObserver27Mrcsaco_ExtensionInterfaceLE4TUidRPv @ 7 NONAME - _ZTI34MRemConStatusApiControllerObserver @ 8 NONAME ; ## - _ZTV34MRemConStatusApiControllerObserver @ 9 NONAME ; ## - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/groupnavigationapi/bwins/remcongroupnavigationapiu.def --- a/bluetoothappprofiles/avrcp/groupnavigationapi/bwins/remcongroupnavigationapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - ??1CRemConGroupNavigationApiTarget@@UAE@XZ @ 1 NONAME ; CRemConGroupNavigationApiTarget::~CRemConGroupNavigationApiTarget(void) - ?NewL@CRemConGroupNavigationApiTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConGroupNavigationTargetObserver@@@Z @ 2 NONAME ; class CRemConGroupNavigationApiTarget * CRemConGroupNavigationApiTarget::NewL(class CRemConInterfaceSelector &, class MRemConGroupNavigationTargetObserver &) - ?NextGroupResponse@CRemConGroupNavigationApiTarget@@QAEXAAPAVTRequestStatus@@H@Z @ 3 NONAME ; void CRemConGroupNavigationApiTarget::NextGroupResponse(class TRequestStatus * &, int) - ?PreviousGroupResponse@CRemConGroupNavigationApiTarget@@QAEXAAPAVTRequestStatus@@H@Z @ 4 NONAME ; void CRemConGroupNavigationApiTarget::PreviousGroupResponse(class TRequestStatus * &, int) - ?NewL@CRemConGroupNavigationApiTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConGroupNavigationTargetObserver@@HH@Z @ 5 NONAME ; class CRemConGroupNavigationApiTarget * CRemConGroupNavigationApiTarget::NewL(class CRemConInterfaceSelector &, class MRemConGroupNavigationTargetObserver &, int, int) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/groupnavigationapi/eabi/remcongroupnavigationapiu.def --- a/bluetoothappprofiles/avrcp/groupnavigationapi/eabi/remcongroupnavigationapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - _ZN31CRemConGroupNavigationApiTarget17NextGroupResponseERP14TRequestStatusi @ 1 NONAME - _ZN31CRemConGroupNavigationApiTarget21PreviousGroupResponseERP14TRequestStatusi @ 2 NONAME - _ZN31CRemConGroupNavigationApiTarget4NewLER24CRemConInterfaceSelectorR36MRemConGroupNavigationTargetObserver @ 3 NONAME - _ZN31CRemConGroupNavigationApiTargetD0Ev @ 4 NONAME - _ZN31CRemConGroupNavigationApiTargetD1Ev @ 5 NONAME - _ZN31CRemConGroupNavigationApiTargetD2Ev @ 6 NONAME - _ZN31CRemConGroupNavigationApiTarget4NewLER24CRemConInterfaceSelectorR36MRemConGroupNavigationTargetObserverii @ 7 NONAME - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/groupnavigationapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/groupnavigationapi/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remcongroupnavigationapi.mmp - -PRJ_EXPORTS -../public/remcongroupnavigationtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcongroupnavigationtarget.h) -../public/remcongroupnavigationtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcongroupnavigationtargetobserver.h) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/groupnavigationapi/group/remcongroupnavigationapi.mmp --- a/bluetoothappprofiles/avrcp/groupnavigationapi/group/remcongroupnavigationapi.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -// Copyright (c) 2007-2009 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: -// remcongroupnavigationapi.dll Remote Control Group Navigation API - an outer-layer client side library. -// -// - -/** - @file - @internalComponent -*/ - -TARGET remcongroupnavigationapi.dll -TARGETPATH /system/libs - -// We need all these caps because we don't know anything about the process -// we'll be running in. -CAPABILITY All -Tcb -TARGETTYPE dll - -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x101f9067 -VENDORID 0x70000001 - -SOURCEPATH ../src -SOURCE groupnavigationapi.cpp - -USERINCLUDE ../../common -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -LIBRARY euser.lib -LIBRARY remconinterfacebase.lib -LIBRARY estor.lib - -#include - -UNPAGED - -SMPSAFE diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/groupnavigationapi/public/remcongroupnavigationtarget.h --- a/bluetoothappprofiles/avrcp/groupnavigationapi/public/remcongroupnavigationtarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONGROUPNAVIGATIONTARGET_H -#define REMCONGROUPNAVIGATIONTARGET_H - -#include -#include -#include -#include - -#include -#include - -class MRemConGroupNavigationTargetObserver; -class CRemConInterfaceSelector; - -/** -Client-instantiable type supporting sending Battery Status responses. -*/ -NONSHARABLE_CLASS(CRemConGroupNavigationApiTarget) : public CRemConInterfaceBase, - public MRemConInterfaceIf - { -public: - /** - Factory function. - @see CRemConInterfaceSelector - @param aInterfaceSelector The interface selector. The client must have - created one of these first. - @param aObserver The observer of this interface. - @return A new CRemConGroupNavigationApiTarget, owned by the interface selector. - */ - IMPORT_C static CRemConGroupNavigationApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConGroupNavigationTargetObserver& aObserver); - /** - Factory function. - @see CRemConInterfaceSelector - @param aInterfaceSelector The interface selector. The client must have - created one of these first. - @param aObserver The observer of this interface. - @param aNextGroupSupported Whether the Client support the next Group functionality. - @param aPreviousGroupSupported Whether the Client support the previous Group functionality. - @return A new CRemConGroupNavigationApiTarget, owned by the interface selector. - */ - IMPORT_C static CRemConGroupNavigationApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConGroupNavigationTargetObserver& aObserver, TBool aNextGroupSupported, TBool aPreviousGroupSupported); - - /** Destructor */ - IMPORT_C ~CRemConGroupNavigationApiTarget(); - -public: - /** Send a 'next group' response. - Called by the client after receiving a MRemConGroupNavigationTargetObserver::MrcgntoNextGroup(). - @param aStatus Used by RemCon to indicate completion of the send request. - aStatus may be NULL if no completion indication required. - @param aError The response error. - */ - IMPORT_C void NextGroupResponse(TRequestStatus*& aStatus, TInt aError); - - /** Send a 'previous group' response. - Called by the client after receiving a MRemConGroupNavigationTargetObserver::MrcgntoPreviousGroup(). - @param aStatus Used by RemCon to indicate completion of the send request. - aStatus may be NULL if no completion indication required. - @param aError The response error. - */ - IMPORT_C void PreviousGroupResponse(TRequestStatus*& aStatus, TInt aError); - -private: - /** - Constructor. - @param aInterfaceSelector The interface selector. - @param aObserver The observer of this interface. - */ - CRemConGroupNavigationApiTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConGroupNavigationTargetObserver& aObserver); - - void SendGroupResponse(TGroupNavigationPassthroughOperationIds aId, TRequestStatus*& aStatus, TInt aError); - - void ConstructL(); - - void ConstructL(TBool aNextGroupSupported, TBool aPreviousGroupSupported); -private: // from CRemConInterfaceBase - TAny* GetInterfaceIf(TUid aUid); - -private: // from MRemConInterfaceIf - void MrcibNewMessage(TUint aOperationId, const TDesC8& aData); - -private: // unowned - MRemConGroupNavigationTargetObserver& iObserver; - -private: // owned - CBufFlat* iOutData; - TPtr8 iPtr; - RBufWriteStream iStream; - TUint iNumRemotes; - }; - -#endif // REMCONGROUPNAVIGATIONTARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/groupnavigationapi/public/remcongroupnavigationtargetobserver.h --- a/bluetoothappprofiles/avrcp/groupnavigationapi/public/remcongroupnavigationtargetobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONGROUPNAVIGATIONTARGETOBSERVER_H -#define REMCONGROUPNAVIGATIONTARGETOBSERVER_H - -#include -#include - -/** -Clients must implement this interface in order to instantiate objects of type -CRemConGroupNavigation. This interface passes incoming commands from RemCon to -the client. -*/ -class MRemConGroupNavigationTargetObserver - { -public: - /** - A 'Next Group' has been received. - @see TRemConCoreApiButtonAction - @param aButtonAct The button action associated with the command. - */ - virtual void MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct) = 0; - - /** - A 'Previous Group' has been received. - @see TRemConCoreApiButtonAction - @param aButtonAct The button action associated with the command. - */ - virtual void MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct) =0; - - }; - -#endif // REMCONGROUPNAVIGATIONTARGETOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/groupnavigationapi/src/groupnavigationapi.cpp --- a/bluetoothappprofiles/avrcp/groupnavigationapi/src/groupnavigationapi.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include - -#include - -#include - -#include "remcongroupnavigation.h" - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_GROUP_NAVIGATION); -#endif - -EXPORT_C CRemConGroupNavigationApiTarget* CRemConGroupNavigationApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConGroupNavigationTargetObserver& aObserver) - { - LOG_STATIC_FUNC - - CRemConGroupNavigationApiTarget* self = new(ELeave) CRemConGroupNavigationApiTarget(aInterfaceSelector, aObserver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -EXPORT_C CRemConGroupNavigationApiTarget* CRemConGroupNavigationApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConGroupNavigationTargetObserver& aObserver,TBool aNextGroupSupported, TBool aPreviousGroupSupported) - { - LOG_STATIC_FUNC - - CRemConGroupNavigationApiTarget* self = new(ELeave) CRemConGroupNavigationApiTarget(aInterfaceSelector, aObserver); - CleanupStack::PushL(self); - self->ConstructL(aNextGroupSupported,aPreviousGroupSupported); - CleanupStack::Pop(self); - return self; - } -CRemConGroupNavigationApiTarget::CRemConGroupNavigationApiTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConGroupNavigationTargetObserver& aObserver) -: CRemConInterfaceBase(TUid::Uid(KRemConGroupNavigationApiUid), - KMaxSizeRemConGroupNavigationMsg, - aInterfaceSelector, - ERemConClientTypeTarget), - iObserver(aObserver), iPtr(0,0,0) - { - } - -void CRemConGroupNavigationApiTarget::ConstructL() - { - // Create a output buffer (arbitrary value of 32 for granularity of buffer expansion) - iOutData = CBufFlat::NewL(32); - iOutData->SetReserveL(sizeof(TPckg)); - BaseConstructL(); - } -void CRemConGroupNavigationApiTarget::ConstructL(TBool aNextGroupSupported, TBool aPreviousGroupSupported) - { - // Create a output buffer (arbitrary value of 32 for granularity of buffer expansion) - iOutData = CBufFlat::NewL(32); - iOutData->SetReserveL(sizeof(TPckg)); - - RRemConInterfaceFeatures features; - User::LeaveIfError(features.Open()); - CleanupClosePushL(features); - - if(aNextGroupSupported) - { - features.AddOperationL(ENextGroup); - } - - if(aPreviousGroupSupported) - { - features.AddOperationL(EPreviousGroup); - } - - BaseConstructL(features); - CleanupStack::PopAndDestroy(&features); - } - - -/** Destructor. - -@publishedAll -@released -*/ -EXPORT_C CRemConGroupNavigationApiTarget::~CRemConGroupNavigationApiTarget() - { - delete iOutData; - iStream.Close(); - } - -/** Gets a pointer to a specific interface version. - -@return A pointer to the interface, NULL if not supported. -@internalComponent -@released -*/ -TAny* CRemConGroupNavigationApiTarget::GetInterfaceIf(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf1) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -EXPORT_C void CRemConGroupNavigationApiTarget::NextGroupResponse(TRequestStatus*& aStatus, TInt aError) - { - SendGroupResponse(ENextGroup, aStatus, aError); - } - -EXPORT_C void CRemConGroupNavigationApiTarget::PreviousGroupResponse(TRequestStatus*& aStatus, TInt aError) - { - SendGroupResponse(EPreviousGroup, aStatus, aError); - } - -void CRemConGroupNavigationApiTarget::SendGroupResponse(TGroupNavigationPassthroughOperationIds aId, TRequestStatus*& aStatus, TInt aError) - { - // format data to be sent - TRAPD(error, iOutData->ResizeL(sizeof(TRemConGroupNavigationResponse))); - if (error != KErrNone) - { - // if this fails, then silently drop response - return; - } - - TRemConGroupNavigationResponse response; - response.iError = aError; - iOutData->Write(0,TPckg(response)); - iPtr.Set(iOutData->Ptr(0)); - - // if a TRequestStatus has been supplied - if (aStatus) - { - InterfaceSelector().Send(*aStatus, TUid::Uid(KRemConGroupNavigationApiUid), aId, iNumRemotes, ERemConResponse, iPtr); - } - else - { - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConGroupNavigationApiUid), aId, ERemConResponse, iPtr); - } - } - -// from MRemConInterfaceIf -void CRemConGroupNavigationApiTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData) - { - LOG1(_L("\taOperationId = 0x%02x"), aOperationId); - LOG1(_L("\taData.Length = %d"), aData.Length()); - - /* Decode the get GroupNavigation message */ - TGroupNavigationPassthroughOperationIds currentOp = static_cast(aOperationId); - TRemConCoreApiButtonAction button = static_cast(aData.Ptr()[0]); - - switch (currentOp) - { - case ENextGroup: - { - iObserver.MrcgntoNextGroup( button ); - break; - } - case EPreviousGroup: - { - iObserver.MrcgntoPreviousGroup( button ); - break; - } - default: - break; - - } - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/bwins/remconmediabrowseapiu.def --- a/bluetoothappprofiles/avrcp/mediabrowseapi/bwins/remconmediabrowseapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -EXPORTS - ?MrcdumlbFolderListing@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXABV?$TArray@VTRemConItem@@@@I@Z @ 1 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderListing(class TArray const &, unsigned int) - ?MrcdamlbMediaLibraryStateChange@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXG@Z @ 2 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaLibraryStateChange(unsigned short) - ?MrcdumlbSearchResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXIH@Z @ 3 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbSearchResult(unsigned int, int) - ?MrcdumlbMediaElementItemResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXAB_KABVTDesC8@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 4 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaElementItemResult(unsigned long long const &, class TDesC8 const &, unsigned char, class TArray const &, int) - ?MrcdumlbMediaLibraryStateChange@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXXZ @ 5 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaLibraryStateChange(void) - ?MrcdamlbMediaElementItemResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXAB_KABVTDesC8@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 6 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaElementItemResult(unsigned long long const &, class TDesC8 const &, unsigned char, class TArray const &, int) - ?MrcdunpbFolderListing@MRemConDatabaseUnawareNowPlayingBrowse@@QAEXABV?$TArray@VTRemConItem@@@@I@Z @ 7 NONAME ; void MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbFolderListing(class TArray const &, unsigned int) - ?MrcdumlbGetPathResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXIH@Z @ 8 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbGetPathResult(unsigned int, int) - ?MrcdumlbFolderUpResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXIH@Z @ 9 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderUpResult(unsigned int, int) - ?MrcdamlbFolderDownResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXIH@Z @ 10 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderDownResult(unsigned int, int) - ?MrcdumlbFolderDownResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXIH@Z @ 11 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderDownResult(unsigned int, int) - ?MrcdamlbFolderItemResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXAB_KABVTDesC8@@W4TFolderItemType@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 12 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderItemResult(unsigned long long const &, class TDesC8 const &, enum TFolderItemType, unsigned char, class TArray const &, int) - ?MrcdumlbFolderItemResult@MRemConDatabaseUnawareMediaLibraryBrowse@@QAEXAB_KABVTDesC8@@W4TFolderItemType@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 13 NONAME ; void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderItemResult(unsigned long long const &, class TDesC8 const &, enum TFolderItemType, unsigned char, class TArray const &, int) - ?MrcdamlbFolderListing@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXABV?$TArray@VTRemConItem@@@@GI@Z @ 14 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderListing(class TArray const &, unsigned short, unsigned int) - ?MrcdamlbGetPathResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXIGH@Z @ 15 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbGetPathResult(unsigned int, unsigned short, int) - ?MrcdamlbSearchResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXIGH@Z @ 16 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbSearchResult(unsigned int, unsigned short, int) - ?MrcdanpbFolderListing@MRemConDatabaseAwareNowPlayingBrowse@@QAEXABV?$TArray@VTRemConItem@@@@GI@Z @ 17 NONAME ; void MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbFolderListing(class TArray const &, unsigned short, unsigned int) - ?MrcdamlbFolderUpResult@MRemConDatabaseAwareMediaLibraryBrowse@@QAEXIH@Z @ 18 NONAME ; void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderUpResult(unsigned int, int) - ?MrcdunpbMediaElementItemResult@MRemConDatabaseUnawareNowPlayingBrowse@@QAEXAB_KABVTDesC8@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 19 NONAME ; void MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbMediaElementItemResult(unsigned long long const &, class TDesC8 const &, unsigned char, class TArray const &, int) - ?NewL@CRemConDatabaseUnawareMediaBrowseTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConDatabaseUnawareMediaLibraryBrowseObserver@@AAVMRemConDatabaseUnawareNowPlayingBrowseObserver@@HAAPAVMRemConDatabaseUnawareMediaLibraryBrowse@@AAPAVMRemConDatabaseUnawareNowPlayingBrowse@@@Z @ 20 NONAME ; class CRemConDatabaseUnawareMediaBrowseTarget * CRemConDatabaseUnawareMediaBrowseTarget::NewL(class CRemConInterfaceSelector &, class MRemConDatabaseUnawareMediaLibraryBrowseObserver &, class MRemConDatabaseUnawareNowPlayingBrowseObserver &, int, class MRemConDatabaseUnawareMediaLibraryBrowse * &, class MRemConDatabaseUnawareNowPlayingBrowse * &) - ?NewL@CRemConDatabaseAwareMediaBrowseTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConDatabaseAwareMediaLibraryBrowseObserver@@AAVMRemConDatabaseAwareNowPlayingBrowseObserver@@HAAPAVMRemConDatabaseAwareMediaLibraryBrowse@@AAPAVMRemConDatabaseAwareNowPlayingBrowse@@G@Z @ 21 NONAME ; class CRemConDatabaseAwareMediaBrowseTarget * CRemConDatabaseAwareMediaBrowseTarget::NewL(class CRemConInterfaceSelector &, class MRemConDatabaseAwareMediaLibraryBrowseObserver &, class MRemConDatabaseAwareNowPlayingBrowseObserver &, int, class MRemConDatabaseAwareMediaLibraryBrowse * &, class MRemConDatabaseAwareNowPlayingBrowse * &, unsigned short) - ?MrcdanpbMediaElementItemResult@MRemConDatabaseAwareNowPlayingBrowse@@QAEXAB_KABVTDesC8@@EABV?$TArray@VTMediaElementAttribute@@@@H@Z @ 22 NONAME ; void MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbMediaElementItemResult(unsigned long long const &, class TDesC8 const &, unsigned char, class TArray const &, int) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/eabi/remconmediabrowseapiu.def --- a/bluetoothappprofiles/avrcp/mediabrowseapi/eabi/remconmediabrowseapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -EXPORTS - _ZN36MRemConDatabaseAwareNowPlayingBrowse21MrcdanpbFolderListingERK6TArrayI11TRemConItemEtj @ 1 NONAME - _ZN36MRemConDatabaseAwareNowPlayingBrowse30MrcdanpbMediaElementItemResultERKyRK6TDesC8hRK6TArrayI22TMediaElementAttributeEi @ 2 NONAME - _ZN37CRemConDatabaseAwareMediaBrowseTarget4NewLER24CRemConInterfaceSelectorR46MRemConDatabaseAwareMediaLibraryBrowseObserverR44MRemConDatabaseAwareNowPlayingBrowseObserveriRP38MRemConDatabaseAwareMediaLibraryBrowseRP36MRemConDatabaseAwareNowPlayingBrowset @ 3 NONAME - _ZN38MRemConDatabaseAwareMediaLibraryBrowse20MrcdamlbSearchResultEjti @ 4 NONAME - _ZN38MRemConDatabaseAwareMediaLibraryBrowse21MrcdamlbFolderListingERK6TArrayI11TRemConItemEtj @ 5 NONAME - _ZN38MRemConDatabaseAwareMediaLibraryBrowse21MrcdamlbGetPathResultEjti @ 6 NONAME - _ZN38MRemConDatabaseAwareMediaLibraryBrowse22MrcdamlbFolderUpResultEji @ 7 NONAME - _ZN38MRemConDatabaseAwareMediaLibraryBrowse24MrcdamlbFolderDownResultEji @ 8 NONAME - _ZN38MRemConDatabaseAwareMediaLibraryBrowse24MrcdamlbFolderItemResultERKyRK6TDesC815TFolderItemTypehRK6TArrayI22TMediaElementAttributeEi @ 9 NONAME - _ZN38MRemConDatabaseAwareMediaLibraryBrowse30MrcdamlbMediaElementItemResultERKyRK6TDesC8hRK6TArrayI22TMediaElementAttributeEi @ 10 NONAME - _ZN38MRemConDatabaseAwareMediaLibraryBrowse31MrcdamlbMediaLibraryStateChangeEt @ 11 NONAME - _ZN38MRemConDatabaseUnawareNowPlayingBrowse21MrcdunpbFolderListingERK6TArrayI11TRemConItemEj @ 12 NONAME - _ZN38MRemConDatabaseUnawareNowPlayingBrowse30MrcdunpbMediaElementItemResultERKyRK6TDesC8hRK6TArrayI22TMediaElementAttributeEi @ 13 NONAME - _ZN39CRemConDatabaseUnawareMediaBrowseTarget4NewLER24CRemConInterfaceSelectorR48MRemConDatabaseUnawareMediaLibraryBrowseObserverR46MRemConDatabaseUnawareNowPlayingBrowseObserveriRP40MRemConDatabaseUnawareMediaLibraryBrowseRP38MRemConDatabaseUnawareNowPlayingBrowse @ 14 NONAME - _ZN40MRemConDatabaseUnawareMediaLibraryBrowse20MrcdumlbSearchResultEji @ 15 NONAME - _ZN40MRemConDatabaseUnawareMediaLibraryBrowse21MrcdumlbFolderListingERK6TArrayI11TRemConItemEj @ 16 NONAME - _ZN40MRemConDatabaseUnawareMediaLibraryBrowse21MrcdumlbGetPathResultEji @ 17 NONAME - _ZN40MRemConDatabaseUnawareMediaLibraryBrowse22MrcdumlbFolderUpResultEji @ 18 NONAME - _ZN40MRemConDatabaseUnawareMediaLibraryBrowse24MrcdumlbFolderDownResultEji @ 19 NONAME - _ZN40MRemConDatabaseUnawareMediaLibraryBrowse24MrcdumlbFolderItemResultERKyRK6TDesC815TFolderItemTypehRK6TArrayI22TMediaElementAttributeEi @ 20 NONAME - _ZN40MRemConDatabaseUnawareMediaLibraryBrowse30MrcdumlbMediaElementItemResultERKyRK6TDesC8hRK6TArrayI22TMediaElementAttributeEi @ 21 NONAME - _ZN40MRemConDatabaseUnawareMediaLibraryBrowse31MrcdumlbMediaLibraryStateChangeEv @ 22 NONAME - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/mediabrowseapi/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remconmediabrowseapi.mmp - -PRJ_EXPORTS -../public/remcondatabaseawaremediabrowsetarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawaremediabrowsetarget.h) -../public/remcondatabaseawaremedialibrarybrowse.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawaremedialibrarybrowse.h) -../public/remcondatabaseawaremedialibrarybrowseobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawaremedialibrarybrowseobserver.h) -../public/remcondatabaseawarenowplayingbrowse.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawarenowplayingbrowse.h) -../public/remcondatabaseawarenowplayingbrowseobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawarenowplayingbrowseobserver.h) - -../public/remcondatabaseunawaremediabrowsetarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawaremediabrowsetarget.h) -../public/remcondatabaseunawaremedialibrarybrowse.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawaremedialibrarybrowse.h) -../public/remcondatabaseunawaremedialibrarybrowseobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawaremedialibrarybrowseobserver.h) -../public/remcondatabaseunawarenowplayingbrowse.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingbrowse.h) -../public/remcondatabaseunawarenowplayingbrowseobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingbrowseobserver.h) - -../public/remconmediaerror.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediaerror.h) -../public/remconmediabrowsetypes.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediabrowsetypes.h) -../public/remconmediabrowsepanic.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediabrowsepanic.h) - -../public/remconmediabrowsetargetbase.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(remcon/remconmediabrowsetargetbase.h) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/group/remconmediabrowseapi.mmp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/group/remconmediabrowseapi.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -// Copyright (c) 2008-2009 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: -// remconmediainformationapi.dll Remote Control Media Information API - an outer-layer client side library. -// - - - -/** - @file - @internalComponent -*/ - -TARGET remconmediabrowseapi.dll -TARGETPATH /system/libs - -// We need all these caps because we don't know anything about the process -// we'll be running in. -CAPABILITY All -Tcb -TARGETTYPE dll - -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x10285bbb -VENDORID 0x70000001 - -SOURCEPATH ../src - -SOURCE remcondatabaseawaremediabrowsetarget.cpp -SOURCE remcondatabaseawaremedialibrarybrowse.cpp -SOURCE remcondatabaseawarenowplayingbrowse.cpp - -SOURCE remcondatabaseunawaremediabrowsetarget.cpp -SOURCE remcondatabaseunawaremedialibrarybrowse.cpp -SOURCE remcondatabaseunawarenowplayingbrowse.cpp - -SOURCE remconmediabrowsetargetbase.cpp -SOURCE remconmediabrowseutils.cpp - -MW_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE ../inc -USERINCLUDE ../../common - -LIBRARY euser.lib -LIBRARY remconinterfacebase.lib -LIBRARY avrcpipc.lib -LIBRARY estor.lib -LIBRARY remconmediainformationapi.lib - -#include -#include - -UNPAGED - -SMPSAFE - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/inc/remconmediabrowsefault.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/inc/remconmediabrowsefault.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#ifndef REMCONMEDIABROWSEFAULT_H -#define REMCONMEDIABROWSEFAULT_H - -#include - -_LIT(KMediaBrowseFaultName, "RcMbFault"); - -enum TRemConMediaBrowseFault - { - EInvalidEventId = 0, - EUnexpectedNextMessageCallback = 1, - EResultErrorCodeMismatch = 2, - EUnexpectedOperationId = 3, - ERequestWithoutMaxResponseBeingSet = 4, - // The cookie update request is only generated by the - // bearer and so should always be correctly formatted - EBadlyFormattedMediaLibraryStateCookieUpdate = 5, - ENonZeroMediaLibraryStateCookie = 6, - }; - -class MediaBrowseFault - { -public: - static void Fault(TRemConMediaBrowseFault aFault); - }; - -#endif //REMCONMEDIABROWSEFAULT_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawaremediabrowsetarget.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawaremediabrowsetarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEAWAREMEDIABROWSETARGET_H -#define REMCONDATABASEAWAREMEDIABROWSETARGET_H - -#include -#include -#include -#include -#include -#include - -NONSHARABLE_CLASS(CRemConDatabaseAwareMediaBrowseTarget) : public CRemConMediaBrowseTargetBase, - private MRemConDatabaseAwareMediaLibraryBrowse, private MRemConDatabaseAwareNowPlayingBrowse - { -public: - IMPORT_C static CRemConDatabaseAwareMediaBrowseTarget* NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver, - TBool aSearchSupported, - MRemConDatabaseAwareMediaLibraryBrowse*& aMlInterface, - MRemConDatabaseAwareNowPlayingBrowse*& aNpInterface, - TUint16 aMediaLibraryStateCookie); - virtual ~CRemConDatabaseAwareMediaBrowseTarget(); - -private: - // from MRemConDatabaseAwareMediaLibraryBrowse - virtual void MrcdamlbDoFolderListing(const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult); - - virtual void MrcdamlbDoFolderUpResult(TUint aItemCount, TInt aResult); - virtual void MrcdamlbDoFolderDownResult(TUint aItemCount, TInt aResult); - - virtual void MrcdamlbDoGetPathResult(TUint aItemCount, - TUint16 aMediaLibraryStateCookie, - TInt aResult); - - virtual void MrcdamlbDoSearchResult(TUint aNumberItemsFound, - TUint16 aMediaLibraryStateCookie, - TInt aResult); - - virtual void MrcdamlbDoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie); - - virtual void MrcdamlbDoFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult); - - virtual void MrcdamlbDoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - - // from MRemConDatabaseAwareNowPlayingBrowse - virtual void MrcdanpbDoFolderListing(const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult); - - virtual void MrcdanpbDoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - -private: - CRemConDatabaseAwareMediaBrowseTarget( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver, - MRemConDatabaseAwareMediaLibraryBrowse*& aMlInterface, - MRemConDatabaseAwareNowPlayingBrowse*& aNpInterface, - TUint16 aMediaLibraryStateCookie); - void ConstructL(TBool aSearchSupported); - }; - -#endif //REMCONDATABASEAWAREMEDIABROWSETARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawaremedialibrarybrowse.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawaremedialibrarybrowse.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include -#include - -#ifndef REMCONDATABASEAWAREMEDIALIBRARYBROWSE_H -#define REMCONDATABASEAWAREMEDIALIBRARYBROWSE_H - -NONSHARABLE_CLASS(MRemConDatabaseAwareMediaLibraryBrowse) - { -public: - IMPORT_C void MrcdamlbFolderListing(const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult); - - IMPORT_C void MrcdamlbFolderUpResult(TUint aItemCount, TInt aResult); - IMPORT_C void MrcdamlbFolderDownResult(TUint aItemCount, TInt aResult); - - IMPORT_C void MrcdamlbGetPathResult(TUint aItemCount, - TUint16 aMediaLibraryStateCookie, - TInt aResult); - - IMPORT_C void MrcdamlbSearchResult(TUint aNumberItemsFound, - TUint16 aMediaLibraryStateCookie, - TInt aResult); - - IMPORT_C void MrcdamlbMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie); - - IMPORT_C void MrcdamlbFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult); - - IMPORT_C void MrcdamlbMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - -private: - virtual void MrcdamlbDoFolderListing(const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult) = 0; - - virtual void MrcdamlbDoFolderUpResult(TUint aItemCount, TInt aResult) = 0; - virtual void MrcdamlbDoFolderDownResult(TUint aItemCount, TInt aResult) = 0; - - virtual void MrcdamlbDoGetPathResult(TUint aItemCount, - TUint16 aMediaLibraryStateCookie, - TInt aResult) = 0; - - virtual void MrcdamlbDoSearchResult(TUint aNumberItemsFound, - TUint16 aMediaLibraryStateCookie, - TInt aResult) = 0; - - virtual void MrcdamlbDoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie) = 0; - - virtual void MrcdamlbDoFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult) = 0; - - virtual void MrcdamlbDoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) = 0; - }; - -#endif // REMCONDATABASEAWAREMEDIALIBRARYBROWSE_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawaremedialibrarybrowseobserver.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawaremedialibrarybrowseobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include -#include - -#ifndef REMCONDATABASEAWAREMEDIALIBRARYBROWSEOBSERVER_H -#define REMCONDATABASEAWAREMEDIALIBRARYBROWSEOBSERVER_H - -NONSHARABLE_CLASS(MRemConDatabaseAwareMediaLibraryBrowseObserver) - { -public: - /** - This requests a list of the items present in a folder. No metadata is - requested, that can be retrieved separately on a per item basis. - - The result should be returned via a call to - MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderListing(). And - the ordering should be as shown locally, but should list folders before - media element items. - - @param aScope The scope in which the folder listing is made. - This indicates which listing should be returned. If the scope is - EBrowseFolder then the contents of the current browsed folder - should be returned. If it is the ESearchResultFolder scope then - the contents of the folder populated by the last search should be - returned. - - @param aStartItem The offset into the folder listing of the first item to - retrieve. If there is no media available at this offset the error - KErrMediaBrowseInvalidOffset should be returned via the result call - to MrcdamlbFolderListing(). - - @param aEndItem The offset into the folder listing of the final item to - retrieve. If this is beyond the end of the folder listing then the - items from the aStartItem offset to the end of the listing should - be returned via the result call to MrcdamlbFolderListing(). - */ - virtual void MrcdamlboGetFolderListing(TRemConFolderScope aScope, - TUint aStartItem, - TUint aEndItem) = 0; - - /** - Requests a specific item which may be a folder item or a media element - item. - - If it returns KErrNone the client must return the metadata for the - requested item through the response function either - MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderItemResult() - or - MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaElementItemResult() - according to the item type which is a folder item or media element item. - If it is unable to process this call then it can return error but not - call the response function. - - @param aScope The scope in which the item is present. If the scope is - EBrowseFolder then the item is present in the media library's - virtual filesystem. If it is the ESearchResultFolder scope then the - item is present in the current set of search results. - - @param aItemId The UID for the requested Item. - - @param aIter An iterator for TMediaAttributeIds containing a list of - TMediaAttributeIds requested by the controller. It is intended for - the media element item, so omit it if the item is a folder item. - - @param aMediaLibraryStateCookie The cookie which the remote device - believes refers to the current state of the media library. If this - does not match the current state according to the client then the - client shall call - MrcdamlbFolderItemResult() or MrcdamlbMediaElementItemResult() to - return the error KErrInvalidMediaLibraryStateCookie according it - is a folder item or a media element item. - @return The call back result. - - KErrNone If success. - - The appropriate error code. - */ - virtual TInt MrcdamlboGetItem(TRemConFolderScope aScope, - const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter, - TUint16 aMediaLibraryStateCookie) = 0; - - /** - This requests that the current position within the folder heirarchy is - moved to the next folder up. - - The result of this operation must be returned via a call to - MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderUpResult. - - @param aMediaLibraryStateCookie The cookie which the remote device - believes refers to the current state of the media library. If this - does not match the current state according to the client then the - client should call - MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderUpResult with - the error KErrInvalidMediaLibraryStateCookie. - */ - virtual void MrcdamlboFolderUp(TUint16 aMediaLibraryStateCookie) = 0; - - /** - This requests that the current position within the folder hierarchy is - moved to the child folder of the current folder specified by aFolder. - - The result of this operation must be returned via a call to - MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderDownResult. - - @param aFolder The child folder to change into. - - @param aMediaLibraryStateCookie The cookie which the remote device - believes refers to the current state of the media library. If this - does not match the current state according to the client then the - client should call - MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderDownResult() - with the error KErrInvalidMediaLibraryStateCookie. - */ - virtual void MrcdamlboFolderDown(const TRemConItemUid& aFolder, - TUint16 aMediaLibraryStateCookie) = 0; - - /** - This requests the current path. - - The client is responsible for appending items to the array then call - MrcdamlbGetPathResult() when completed. Once the item is appended in the - array the ownership of the item is taken so the client should keep the - item valid and never destroy the item. If the client can append the items - successfully then it should return a result via MrcdamlbGetPathResult(). - If the client appends some items to the array but then fails to append all - the items then it should return an error via MrcdamlbGetPathResult(). - - @see MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbGetPathResult() - - @param aPath The current path. - Each entry in the array in one level of the path. For example the - path /A/B/C would be provided as: - aPath[0] 'A' - aPath[1] 'B' - aPath[2] 'C' - All string are in UTF-8. - */ - virtual void MrcdamlboGetPath(RPointerArray& aPath) = 0; - - /** - Perform a search in the current location for items - matching the search string. - - @param aSearch The string to search on in UTF-8. The client can use it until - the client has called MrcdamlbSearchResult(). - - @see MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbSearchResult() - */ - virtual void MrcdamlboSearch(const TDesC8& aSearch) = 0; - }; - - -#endif // REMCONDATABASEAWAREMEDIALIBRARYBROWSEOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawarenowplayingbrowse.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawarenowplayingbrowse.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include -#include - -#ifndef REMCONDATABASEAWARENOWPLAYINGBROWSE_H -#define REMCONDATABASEAWARENOWPLAYINGBROWSE_H - -NONSHARABLE_CLASS(MRemConDatabaseAwareNowPlayingBrowse) - { -public: - IMPORT_C void MrcdanpbFolderListing(const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult); - - IMPORT_C void MrcdanpbMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - -private: - virtual void MrcdanpbDoFolderListing(const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult) = 0; - - virtual void MrcdanpbDoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) = 0; - }; - -#endif //REMCONDATABASEAWARENOWPLAYINGBROWSE_H - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawarenowplayingbrowseobserver.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseawarenowplayingbrowseobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEAWARENOWPLAYINGBROWSEOBSERVER_H -#define REMCONDATABASEAWARENOWPLAYINGBROWSEOBSERVER_H - -NONSHARABLE_CLASS(MRemConDatabaseAwareNowPlayingBrowseObserver) - { -public: - /** - Requests a listing of the items present in the Now Playing folder. If the - media player does not natively support a Now Plyaing folder the client - shall return a listing of one item which is the currently playing media - element. - - No metadata is requested, that can be retrieved separately on a per item - basis. Trying this out for now as it fits in with the existing metadata - attribute collection, and means that we would also separate out the - listing from the metadata. This means that we can retrieve a NowPlaying - list and then request the metadata from the observer. - - The result shall be returned via a call to - MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbFolderListing() - - @param aStartItem The offset into the folder listing of the first item to - retrieve. If there is no media available at this offset the error - KErrMediaBrowseInvalidOffset shall be returned via the result call - to MrcdanpbFolderListing(). - - @param aEndItem The offset into the folder listing of the final item to - retrieve. If this is beyond the end of the folder listing then the - items from the aStartItem offset to the end of the listing shall - be returned via the result call to MrcdanpbFolderListing(). - */ - virtual void MrcdanpboGetFolderListing(TUint aStartItem, - TUint aEndItem) = 0; - - /** - Requests a set of metadata corresponding to a specific media element item. - - The client must return the metadata for the requested item via using - MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbMediaElementItemResult() if - it returns KErrNone, if it is unable to to process this call then it can - return error but not call the response function - MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbMediaElementItemResult(). - - @param aItemId The UID for the requested media element item. - - @param aIter An iterator for TMediaAttributeIds containing a list of - TMediaAttributeIds requested by the controller. - - @param aMediaLibraryStateCookie The cookie which the remote device - believes refers to the current state of the media library. If this - does not match the current state according to the client then the - client should call MrcdanpbMediaElementItemResult() with the error - KErrInvalidMediaLibraryStateCookie. - - @return The call back result. - - KErrNone If success. - - The appropriate error code. - */ - virtual TInt MrcdanpboGetItem(const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter, - TUint16 aMediaLibraryStateCookie) = 0; - }; - -#endif //REMCONDATABASEAWARENOWPLAYINGBROWSEOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawaremediabrowsetarget.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawaremediabrowsetarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEUNAWAREMEDIABROWSETARGET_H -#define REMCONDATABASEUNAWAREMEDIABROWSETARGET_H - -#include -#include -#include -#include -#include -#include - -NONSHARABLE_CLASS(CRemConDatabaseUnawareMediaBrowseTarget) : public CRemConMediaBrowseTargetBase, -private MRemConDatabaseUnawareMediaLibraryBrowse, private MRemConDatabaseUnawareNowPlayingBrowse - { -public: - IMPORT_C static CRemConDatabaseUnawareMediaBrowseTarget* NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver, - TBool aSearchSupported, - MRemConDatabaseUnawareMediaLibraryBrowse*& aMlInterface, - MRemConDatabaseUnawareNowPlayingBrowse*& aNpInterface); - - virtual ~CRemConDatabaseUnawareMediaBrowseTarget(); - -private: - // from MRemConDatabaseUnawareMediaLibraryBrowse - virtual void MrcdumlbDoFolderListing(const TArray& aFolderListing, - TUint aResult); - - virtual void MrcdumlbDoFolderUpResult(TUint aItemCount, TInt aResult); - virtual void MrcdumlbDoFolderDownResult(TUint aItemCount, TInt aResult); - - virtual void MrcdumlbDoGetPathResult(TUint aItemCount, - TInt aResult); - - virtual void MrcdumlbDoSearchResult(TUint aNumberItemsFound, - TInt aResult); - - virtual void MrcdumlbDoMediaLibraryStateChange(); - - virtual void MrcdumlbDoFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult); - - virtual void MrcdumlbDoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - - // from MRemConDatabaseUnawareNowPlayingBrowse - virtual void MrcdunpbDoFolderListing(const TArray& aFolderListing, - TUint aResult); - - virtual void MrcdunpbDoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - -private: - CRemConDatabaseUnawareMediaBrowseTarget( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver, - MRemConDatabaseUnawareMediaLibraryBrowse*& aMlInterface, - MRemConDatabaseUnawareNowPlayingBrowse*& aNpInterface); - - void ConstructL(TBool aSearchSupported); - }; - -#endif //REMCONDATABASEUNAWAREMEDIABROWSETARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawaremedialibrarybrowse.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawaremedialibrarybrowse.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include -#include - -#ifndef REMCONDATABASEUNAWAREMEDIALIBRARYBROWSE_H -#define REMCONDATABASEUNAWAREMEDIALIBRARYBROWSE_H - -NONSHARABLE_CLASS(MRemConDatabaseUnawareMediaLibraryBrowse) - { -public: - IMPORT_C void MrcdumlbFolderListing(const TArray& aFolderListing, - TUint aResult); - - IMPORT_C void MrcdumlbFolderUpResult(TUint aItemCount, TInt aResult); - IMPORT_C void MrcdumlbFolderDownResult(TUint aItemCount, TInt aResult); - - IMPORT_C void MrcdumlbGetPathResult(TUint aItemCount, - TInt aResult); - - IMPORT_C void MrcdumlbSearchResult(TUint aNumberItemsFound, - TInt aResult); - - IMPORT_C void MrcdumlbMediaLibraryStateChange(); - - IMPORT_C void MrcdumlbFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult); - - IMPORT_C void MrcdumlbMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - -private: - virtual void MrcdumlbDoFolderListing(const TArray& aFolderListing, - TUint aResult) = 0; - - virtual void MrcdumlbDoFolderUpResult(TUint aItemCount, TInt aResult) = 0; - virtual void MrcdumlbDoFolderDownResult(TUint aItemCount, TInt aResult) = 0; - - virtual void MrcdumlbDoGetPathResult(TUint aItemCount, - TInt aResult) = 0; - - virtual void MrcdumlbDoSearchResult(TUint aNumberItemsFound, - TInt aResult) = 0; - - virtual void MrcdumlbDoMediaLibraryStateChange() = 0; - - virtual void MrcdumlbDoFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult) = 0; - - virtual void MrcdumlbDoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) = 0; - }; - -#endif //REMCONDATABASEUNAWAREMEDIALIBRARYBROWSE_H - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawaremedialibrarybrowseobserver.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawaremedialibrarybrowseobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEUNAWAREMEDIALIBRARYBROWSEOBSERVER_H -#define REMCONDATABASEUNAWAREMEDIALIBRARYBROWSEOBSERVER_H - -NONSHARABLE_CLASS(MRemConDatabaseUnawareMediaLibraryBrowseObserver) - { -public: - /** - This requests a list of the items present in a folder. No metadata is - requested, that can be retrieved separately on a per item basis. - - The result should be returned via a call to - MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderListing(). And - the ordering should be as shown locally, but should list folders before - media element items. - - @param aScope The scope in which the folder listing is made. - This indicates which listing should be returned. If the scope is - EBrowseFolder then the contents of the current browsed - folder should be returned. If it is the ESearchResultFolder scope - then the contents of the folder populated by the last search - should be returned. - - @param aStartItem The offset into the folder listing of the first item to - retrieve. If there is no media available at this offset the error - KErrMediaBrowseInvalidOffset should be returned via the result call - to MrcdumlbFolderListing(). - - @param aEndItem The offset into the folder listing of the final item to - retrieve. If this is beyond the end of the folder listing then the - items from the aStartItem offset to the end of the listing should - be returned via the result call to MrcdumlbFolderListing(). - */ - virtual void MrcdumlboGetFolderListing(TRemConFolderScope aScope, - TUint aStartItem, - TUint aEndItem) = 0; - - /** - Requests a specific item which may be a folder item or a media element - item. - - If it returns KErrNone the client must return the metadata for the - requested item through the response function either - MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderItemResult() - or - MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaElementItemResult() - according to the item type which is a folder item or media element item. - If it is unable to process this call then it can return error but not - call the response function. - - @param aScope The scope in which the item is present. If the scope is - EBrowseFolder then the item is present in the media library's - virtual filesystem. If it is the ESearchResultFolder scope then the - item is present in the current set of search results. - - @param aItemId The UID for the requested Item. - - @param aIter An iterator for TMediaAttributeIds containing a list of - TMediaAttributeIds requested by the controller. It is intended for - the media element item, so omit it if the item is a folder item. - - @return The call back result. - - KErrNone If success. - - The appropriate error code. - */ - virtual TInt MrcdumlboGetItem(TRemConFolderScope aScope, - const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter) = 0; - - /** - This requests that the current position within the folder heirarchy is - moved to the next folder up. - - The result of this operation must be returned via a call to - MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderUpResult(). - */ - virtual void MrcdumlboFolderUp() = 0; - - /** - This requests that the current position within the folder hierarchy is - moved to the child folder of the current folder specified by aFolder. - - The result of this operation must be returned via a call to - MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderDownResult(). - - @param aFolder The child folder to change into. - */ - virtual void MrcdumlboFolderDown(const TRemConItemUid& aFolder) = 0; - - /** - This requests the current path. - - The client is responsible for appending items to the array then call - MrcdumlbGetPathResult() when completed. Once the item is appended in the - array the ownership of the item is taken so the client should keep the - item valid and never destroy the item. If the client can append the items - successfully then it must return a result via MrcdumlbGetPathResult(). - If the client appends some items to the array but then fails to append all - the items then it must return an error via MrcdumlbGetPathResult(). - - @see MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbGetPathResult() - - @param aPath The current path. - Each entry in the array in one level of the path. For example the - path /A/B/C would be provided as: - aPath[0] 'A' - aPath[1] 'B' - aPath[2] 'C' - All string are in UTF-8. - */ - virtual void MrcdumlboGetPath(RPointerArray& aPath) = 0; - - /** - Perform a search in the current location for items - matching the search string. - - @param aSearch The string to search on in UTF-8. The client can use it until - the client has called MrcdumlbSearchResult(). - - @see MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbSearchResult() - */ - virtual void MrcdumlboSearch(const TDesC8& aSearch) = 0; - }; - -#endif //REMCONDATABASEUNAWAREMEDIALIBRARYBROWSEOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawarenowplayingbrowse.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawarenowplayingbrowse.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include -#include - -#ifndef REMCONDATABASEUNAWARENOWPLAYINGBROWSE_H -#define REMCONDATABASEUNAWARENOWPLAYINGBROWSE_H - -NONSHARABLE_CLASS(MRemConDatabaseUnawareNowPlayingBrowse) - { -public: - IMPORT_C void MrcdunpbFolderListing(const TArray& aFolderListing, - TUint aResult); - - IMPORT_C void MrcdunpbMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - -private: - virtual void MrcdunpbDoFolderListing(const TArray& aFolderListing, - TUint aResult) = 0; - - virtual void MrcdunpbDoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) = 0; - }; - -#endif //REMCONDATABASEUNAWARENOWPLAYINGBROWSE_H - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawarenowplayingbrowseobserver.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remcondatabaseunawarenowplayingbrowseobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEUNAWARENOWPLAYINGBROWSEOBSERVER_H -#define REMCONDATABASEUNAWARENOWPLAYINGBROWSEOBSERVER_H - -NONSHARABLE_CLASS(MRemConDatabaseUnawareNowPlayingBrowseObserver) - { -public: - /** - Requests a listing of the items present in the Now Playing folder. If the - media player does not natively support a Now Plyaing folder the client - shall return a listing of one item which is the currently playing media - element. - - No metadata is requested, that can be retrieved separately on a per item - basis. Trying this out for now as it fits in with the existing metadata - attribute collection, and means that we would also separate out the - listing from the metadata. This means that we can retrieve a NowPlaying - list and then request the metadata from the observer. - - The result should be returned via a call to - MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbFolderListing(). - - @param aStartItem The offset into the folder listing of the first item to - retrieve. If there is no media available at this offset the error - KErrMediaBrowseInvalidOffset should be returned via the result call - to MrcdunpbFolderListing(). - - @param aEndItem The offset into the folder listing of the final item to - retrieve. If this is beyond the end of the folder listing then the - items from the aStartItem offset to the end of the listing should - be returned via the result call to MrcdunpbFolderListing(). - */ - virtual void MrcdunpboGetFolderListing(TUint aStartItem, - TUint aEndItem) = 0; - - /** - Requests a set of metadata corresponding to a specific media element item. - - The client must return the metadata for the requested item via using - MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbMediaElementItemResult() - if it returns KErrNone, if it is unable to process this call then it can - return error but not call the response function - MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbMediaElementItemResult(). - - @param aItemId The UID for the requested media element item. - - @param aIter An iterator for TMediaAttributeIds containing a list of - TMediaAttributeIds requested by the controller. - - @return The call back result. - - KErrNone If success. - - The appropriate error code. - */ - virtual TInt MrcdunpboGetItem(const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter) = 0; - }; - -#endif //REMCONDATABASEUNAWARENOWPLAYINGBROWSEOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remconmediabrowsepanic.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remconmediabrowsepanic.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -// 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" -// 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONMEDIABROWSEPANIC_H -#define REMCONMEDIABROWSEPANIC_H - -#include - -_LIT(KMediaBrowsePanicName, "RcMediaBrowse"); - -enum TRemConMediaBrowsePanic - { - EFolderListingProvidedTwice = 0, - EFolderItemResultWithoutRequest = 1, - EInvalidFolderType = 2, - EInvalidPlayableValue = 3, - EInvalidMediaType = 4, - EMediaElementItemResultWithoutRequest = 5, - ESearchResultWithoutRequest = 6, - /** The value of the media library state cookie must not be zero. */ - EZeroMediaLibraryStateCookie = 7, - EUnexpectedNullMemberField = 8, - }; - -class MediaBrowsePanic - { -public: - static void Panic(TRemConMediaBrowsePanic aPanic); - }; - -#endif //REMCONMEDIABROWSEPANIC_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remconmediabrowsetargetbase.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remconmediabrowsetargetbase.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONMEDIABROWSETARGETBASE_H -#define REMCONMEDIABROWSETARGETBASE_H - -#include -#include -#include -#include -#include -#include -#include - -class RRemConGetFolderItemsResponse; -class RRemConGetItemAttributesResponse; -class RRemConGetPathResponse; -class TRemConMessageQueue; -/** -This interface enables the client to present a heirarchical view -of the local media library for browsing by a remote entity. - -The view is a virtual filesystem and does not need to correspond -directly to any structure on local storage. It could for example -map onto a database of media content. - -Each item in the media library is identified by a UID. At a -minimum this must uniquely identify an element within a folder. -For clients that support it the UID can be persistant accross -the entire virtual filesystem. In this case a media library -state cookie is used to ensure that that state is consistent -between the client and the remote device. - -This interface does not have NewL()/NewLC, so the client should -use the object CRemConDatabaseAwareMediaBrowseTarget or -CRemConDatabaseUnawareMediaBrowseTarget to use its exported functions. - -This class is only to be used by classes currently derived from it. - -@see CRemConDatabaseAwareMediaBrowseTarget -@see CRemConDatabaseUnawareMediaBrowseTarget -*/ -NONSHARABLE_CLASS(CRemConMediaBrowseTargetBase) : public CRemConInterfaceBase, public MRemConInterfaceIf - { -protected: - CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver, - TUint16 aMediaLibraryStateCookie); - - CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver); - - virtual ~CRemConMediaBrowseTargetBase(); - - virtual void BaseConstructL(TBool aSearchSupported); - - void DoFolderListing(const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TInt aResult); - - void DoFolderUpResult(TUint aItemCount, TInt aResult); - void DoFolderDownResult(TUint aItemCount, TInt aResult); - - void DoGetPathResult(TUint aItemCount, - TUint16 aMediaLibraryStateCookie, - TInt aResult); - - void DoSearchResult(TUint aNumberItemsFound, - TUint16 aMediaLibraryStateCookie, - TInt aResult); - - void DoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie); - - void DoFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult); - - void DoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - -private: // From CRemConInterfaceBase - TAny* GetInterfaceIf(TUid aUid); - -private: // From MRemConInterfaceIf - void MrcibNewMessage(TUint aOperationId, - const TDesC8& aData); - -private: // Utility - void ProcessGetFolderItems(const TDesC8& aData); - void ProcessChangePath(const TDesC8& aData); - void ProcessGetItemAttributes(const TDesC8& aData); - void ProcessSearch(const TDesC8& aData); - void ProcessGetPath(const TDesC8& aData); - void ProcessMediaLibraryStateCookieUpdate(const TDesC8& aData); - - void SendGetItemAttributesResponse(TInt aResult, const TDesC8& aData); - void SendGetFolderItemsResponse(TInt aResult, const TDesC8& aData); - void SendChangePathResponse(TUint aItemCount, TInt aResult); - void SendInternalNotificationResponse(TRemConMessageSubType aMsgSubType); - void SendNotificationResponse(TRemConMessageSubType aMsgSubType); - void SendSearchResponse(TInt aResult, TUint aNumberItemsFound, TUint16 aMediaLibraryStateCookie); - void SendMediaLibraryStateCookieUpdateResponse(TUint16 aMediaLibraryStateCookie); - - static TInt NextMessageCb(TAny* aThis); - void DoNextMessage(); - - static TInt NextItemCallBack(TAny* aThis); - void RequestNextItem(); - void DoItemComplete(TInt aResult); - - void SendError(TUint8 aPduId, - TUint aOperationId, - TInt aError); - - // Used for Gia - TInt ItemAttributesResult(const TArray& aAttributes); - TInt DoAttributeValue(TMediaAttributeId aAttributeId, const TDesC8& aAttributeData); - void DoAllAttributesCompleted(TInt aResult); - - void AddToOperationQueue(TUint8 aPduId, - TInt aOperationId, - const TDesC8& aData); - TInt ParseGetItemAttributesRequest(const TDesC8& aData, - TRemConFolderScope& aScope, - TRemConItemUid& aItemUid, - TUint16& aMediaLibraryStateCookie); - void ProcessMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult); - void ProcessFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - TInt aResult); - void ProcessGetItemAttributesResult( - const TArray& aAttributes, - TInt aResult); - - inline TBool DatabaseAware() const; - -private: - // Unowned - CRemConInterfaceSelector& iInterfaceSelector; - - MRemConDatabaseAwareMediaLibraryBrowseObserver* iRcdamlbo; - MRemConDatabaseUnawareMediaLibraryBrowseObserver* iRcdumlbo; - - MRemConDatabaseAwareNowPlayingBrowseObserver* iRcdanpbo; - MRemConDatabaseUnawareNowPlayingBrowseObserver* iRcdunpbo; - - // Owned - CAsyncCallBack* iNextMessageCallBack; - CAsyncCallBack* iNextItemCallBack; - - RBuf8 iOutBuf; - - TUint16 iMediaLibraryStateCookie; - - TBool iInProgress; // used internally to see if any operation is in progress - TRemConMessageQueue* iMsgQueue; // used to queue messages if another operation is in progress - - RArray iMediaAttributeIds; // used for Gfl and Gia to store requested attributes - TMediaAttributeIter iAttributeIterator; // provided to the client on requesting item attributes for Gfl and Gia - - RArray iNullArray; - TMediaAttributeIter iNullIterator; // Used for getting a folder item to perform a folder listing - - TBool iGetFolderListing; // used to check Gfl is in progress - RRemConGetFolderItemsResponse* iGflResponse; // used to build up Gfl response from client - TRemConFolderScope iScope; // stored for use in async callbacks to get folder items - - TBool iGetItemAttributes; // used to check Gia is in progress - TBool iSetAttributeValue; // used to check that client has set response if it returns KErrNone - RRemConGetItemAttributesResponse* iGiaResponse; // used to build up Gia response from client - - TBool iSearchSupported; - TBool iSearchInProgress; // used to check Search is in progress - RBuf8 iSearchString; // used to store search string until request is complete - - RRemConGetPathResponse* iGetPathResponse; // used to build up get path response - - TBool iMlscUpdatePending; - TUint16 iLastMlscUpdate; - }; - -#endif // REMCONMEDIABROWSETARGETBASE_H - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remconmediabrowsetypes.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remconmediabrowsetypes.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONMEDIABROWSETYPES_H -#define REMCONMEDIABROWSETYPES_H - -#include -#include - -/** -Defines a type representing a UID which is 8 octet and uniquely identifys -a folder or media element in the media library. -*/ -typedef TUint64 TRemConItemUid; - -/** -Defines item types to indicate the item is a folder item or media item. -*/ -enum TRemConItemType - { - ERemConFolderItem = 2, - ERemConMediaItem = 3, - }; - -class TRemConItem - { -public: - TRemConItemUid iUid; - TRemConItemType iType; - }; - -/** -Defines a type which indicates whether a folder item is playable. -*/ -typedef TUint8 TFolderItemPlayable; - -/** -Defines a type to indicate a media item type. -*/ -typedef TUint8 TMediaItemType; - -const TFolderItemPlayable KFolderNotPlayable = 0; -const TFolderItemPlayable KFolderPlayable = 1; - -const TMediaItemType KMediaAudio = 0; -const TMediaItemType KMediaVideo = 1; - -enum TFolderItemType - { - EFolderMixed = 0, - EFolderTitles = 1, - EFolderAlbums = 2, - EFolderArtists = 3, - EFolderGenres = 4, - EFolderPlaylists = 5, - EFolderYears = 6, - }; - -/** -Defines folder scopes in which media content navigaition may take place. -*/ -enum TRemConFolderScope - { - /** - Applicable in browsed player. - Valid browseable items are foler item and media element item. - */ - EBrowseFolder = 0x1, - - /** - Applicable in browsed player. - Valid browseable items are media element items. - */ - ESearchResultFolder = 0x2, - - /** - Applicable in addressed player. - Valid browseable items are media element items. - */ - ENowPlayingFolder = 0x3 - }; - -/** -A data container of a media element attribute. - -*/ -class TMediaElementAttribute - { -public: - TMediaAttributeId iAttributeId; - - /** - The value of the attribute in UTF-8. - */ - HBufC8* iString; - }; - -#endif //REMCONMEDIABROWSETYPES_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/public/remconmediaerror.h --- a/bluetoothappprofiles/avrcp/mediabrowseapi/public/remconmediaerror.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONMEDIAERROR_H_ -#define REMCONMEDIAERROR_H_ - -#include - -const TInt KErrRemConMediaBase = -6780; - -/** -Invalid media library state cookie. - -This error only occurs in the database aware clients. -*/ -const TInt KErrInvalidMediaLibraryStateCookie = KErrRemConMediaBase - 0x5; - -/** -The direction parameter is invalid - -@see MrcdamlbFolderDownResult() -@see MrcdumlbFolderDownResult() -*/ -const TInt KErrMediaBrowseInvalidDirection = KErrRemConMediaBase - 0x7; - -/** -The UID provided does not refer to a folder item - -@see MrcdamlbFolderDownResult() -@see MrcdumlbFolderDownResult() -*/ -const TInt KErrMediaBrowseNotADirectory = KErrRemConMediaBase - 0x8; - -/** -The UID provided does not refer to any currently valid item - -@see MrcdamlbFolderDownResult() -@see MrcdumlbFolderDownResult() -@see MrcdamlbFolderItemResult() -@see MrcdumlbFolderItemResult() -@see MrcdamlbMediaElementItemResult() -@see MrcdumlbMediaElementItemResult() -@see MrcdanpbMediaElementItemResult() -@see MrcdunpbMediaElementItemResult() -*/ -const TInt KErrInvalidUid = KErrRemConMediaBase - 0x9; - -/** -The start of range provided is not valid - -@see MrcdamlbFolderListing() -@see MrcdumlbFolderListing() -@see MrcdanpbFolderListing() -@see MrcdunpbFolderListing() -*/ -const TInt KErrMediaBrowseInvalidOffset = KErrRemConMediaBase - 0xb; - -/** -The UID provided refers to a directory -which cannot be handled by this media player. - -*/ -const TInt KErrNowPlayingUidIsADirectory = KErrRemConMediaBase - 0xc; - -/** -The media is not able to be used for this operation at this time - -*/ -const TInt KErrNowPlayingMediaInUse = KErrRemConMediaBase - 0xd; - -/** -No more items can be added to the now playing list because it is full - -*/ -const TInt KErrNowPlayingListFull = KErrRemConMediaBase - 0xe; - -#endif /*REMCONMEDIAERROR_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseawaremediabrowsetarget.cpp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseawaremediabrowsetarget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include - -EXPORT_C CRemConDatabaseAwareMediaBrowseTarget* CRemConDatabaseAwareMediaBrowseTarget::NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver, - TBool aSearchSupported, - MRemConDatabaseAwareMediaLibraryBrowse*& aMlInterface, - MRemConDatabaseAwareNowPlayingBrowse*& aNpInterface, - TUint16 aMediaLibraryStateCookie) - { - CRemConDatabaseAwareMediaBrowseTarget* self = new(ELeave)CRemConDatabaseAwareMediaBrowseTarget( - aInterfaceSelector, aMlObserver, aNpObserver, aMlInterface, aNpInterface, aMediaLibraryStateCookie); - CleanupStack::PushL(self); - self->ConstructL(aSearchSupported); - CleanupStack::Pop(self); - return self; - } - -CRemConDatabaseAwareMediaBrowseTarget::CRemConDatabaseAwareMediaBrowseTarget( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver, - MRemConDatabaseAwareMediaLibraryBrowse*& aMlInterface, - MRemConDatabaseAwareNowPlayingBrowse*& aNpInterface, - TUint16 aMediaLibraryStateCookie) - : CRemConMediaBrowseTargetBase(aInterfaceSelector, aMlObserver, aNpObserver, aMediaLibraryStateCookie) - { - aMlInterface = static_cast(this); - aNpInterface = static_cast(this); - } - -void CRemConDatabaseAwareMediaBrowseTarget::ConstructL( - TBool aSearchSupported) - { - BaseConstructL(aSearchSupported); - } - -CRemConDatabaseAwareMediaBrowseTarget::~CRemConDatabaseAwareMediaBrowseTarget() - { - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoFolderListing( - const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult) - { - DoFolderListing(aFolderListing, aMediaLibraryStateCookie, aResult); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoFolderUpResult( - TUint aItemCount, TInt aResult) - { - DoFolderUpResult(aItemCount, aResult); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoFolderDownResult( - TUint aItemCount, TInt aResult) - { - DoFolderDownResult(aItemCount, aResult); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoGetPathResult( - TUint aItemCount, - TUint16 aMediaLibraryStateCookie, - TInt aResult) - { - DoGetPathResult(aItemCount, aMediaLibraryStateCookie, aResult); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoSearchResult( - TUint aNumberItemsFound, - TUint16 aMediaLibraryStateCookie, - TInt aResult) - { - DoSearchResult(aNumberItemsFound, aMediaLibraryStateCookie, aResult); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoMediaLibraryStateChange( - TUint16 aMediaLibraryStateCookie) - { - DoMediaLibraryStateChange(aMediaLibraryStateCookie); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoFolderItemResult( - const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult) - { - DoFolderItemResult(aFolderID,aFolderName, aFolderType, aPlayable, aAttributes, aResult); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdamlbDoMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - DoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdanpbDoFolderListing( - const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult) - { - DoFolderListing(aFolderListing, aMediaLibraryStateCookie, aResult); - } - -void CRemConDatabaseAwareMediaBrowseTarget::MrcdanpbDoMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - DoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseawaremedialibrarybrowse.cpp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseawaremedialibrarybrowse.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include - -/** -Called by the client in response to a MrcdamlboGetFolderListing() call. - -@param aFolderListing A listing of the items that are - in the range requested by the MrcdamlboGetFolderListing() call. - -@param aMediaLibraryStateCookie The current value of the state cookie. - -@param aResult The result of the MrcdamlboGetFolderListing() operation. - - KErrNone if the operation was successful. - - KErrMediaBrowseInvalidOffset if there is no media available at the - offset of the start item, i.e. the start of range provided via - MrcdamlboGetFolderListing() is not valid. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderListing( - const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult) - { - MrcdamlbDoFolderListing(aFolderListing, aMediaLibraryStateCookie, aResult); - } - -/** -Called by the client in response to a MrcdamlboFolderUp call. - -@param aItemCount The number of items present in this folder. -@param aResult The result of the MrcdamlboFolderUp operation. - - KErrNone if the operation was successful. - - KErrInvalidMediaLibraryStateCookie if the media library state cookie - provided does not match the client's state cookie - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderUpResult( - TUint aItemCount, TInt aResult) - { - MrcdamlbDoFolderUpResult(aItemCount, aResult); - } - -/** -Called by the client in response to a MrcdamlboFolderDown() call. - -@param aItemCount The number of items present in this folder. - -@param aResult The result of the MrcdamlboFolderDown() operation - - KErrNone if the operation was successful. - - KErrInvalidMediaLibraryStateCookie if the media library state cookie - provided does not match the client's state cookie - - KErrMediaBrowseInvalidDirection if the folder provided is not a valid - folder e.g. path A/B/C, the current dirctory is B, and the param - provided with MrcdamlboFolderDown()is A, obviously you can not change - folder down to A, so A is invalid. - - KErrMediaBrowseNotADirectory if the UID provided does not refer to a - folder item, e.g. it is a media element. - - KErrInvalidUid if the UID provided is invalid. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderDownResult( - TUint aItemCount, TInt aResult) - { - MrcdamlbDoFolderDownResult(aItemCount, aResult); - } - -/** -Called by the client in response to a MrcdamlboGetPath() call. - -@param aItemCount The number of items present in this folder. - -@param aMediaLibraryStateCookie The current value of the state cookie. - -@param aResult The result of the MrcdamlboGetPath() operation - - KErrNone if the operation is successful. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbGetPathResult( - TUint aItemCount, - TUint16 aMediaLibraryStateCookie, - TInt aResult) - { - MrcdamlbDoGetPathResult(aItemCount, aMediaLibraryStateCookie, aResult); - } - -/** -Called by the client in response to a MrcdamlboSearch() call to indicate -that a search has completed. - -@param aNumberItemsFound The number of items found by the search. -@param aMediaLibraryStateCookie The current of the state cookie. -@param aResult The result of the search. - - KErrNone if the search completed successfully - - System wide error otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbSearchResult( - TUint aNumberItemsFound, - TUint16 aMediaLibraryStateCookie, - TInt aResult) - { - MrcdamlbDoSearchResult(aNumberItemsFound, aMediaLibraryStateCookie, aResult); - } - -/** -Called by the client in the case that the state of the media library has -changed. This means that the media library state cookie provided prior to -this call by the client may no longer be valid. Typical causes for this -would be items added or removed from the media library. - -This function shall be called by any client any time it believes that media -library state cookie has ceased to be valid, for example if the current -directory is on removable media, and that media has been removed. -That includes clients that are only able to offer state cookie that are -limited to one directory. - -@param aMediaLibraryStateCookie The current value of the state cookie which - enables state mismatches between the client and the remote controller - device to be detected. -*/ -EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaLibraryStateChange( - TUint16 aMediaLibraryStateCookie) - { - MrcdamlbDoMediaLibraryStateChange(aMediaLibraryStateCookie); - } - -/** -Called by the client in response to MrcdamlboGetItem() call in the case the -requested item is a folder item. - -@param aFolderID The folder UID. -@param aFolderName The folder name. Takes a copy of it. -@param aFolderType The folder type. -@param aPlayable Indicaties whether the folder is playable - - KFolderNotPlayable the folder can not be played - - KFolderPlayable the folder can be played -@param aAttributes The attributes of the folder item requested by - MrcdamlboGetItem() -@param aResult The result of the MrcdamlboGetItem() operation. - - KErrNone if the operation was successful. - - KErrInvalidMediaLibraryStateCookie if the media library state cookie - provided does not match the client's state cookie. - - KErrInvalidUid if the uid of the item requested is invalid, - e.g. the client removed the item before the request - MrcdamlboGetItem() coming. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbFolderItemResult( - const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult) - { - MrcdamlbDoFolderItemResult(aFolderID, aFolderName, aFolderType, aPlayable, aAttributes, aResult); - } - -/** -Called by the client in response to MrcdamlboGetItem() call in the case the -requested item is a media element item. - -@param aMediaID The media element UID. -@param aMediaName The media name. Takes a copy of it. -@param aMediaType The media type. -@param aAttributes The attributes list. Takes a copy of it. -@param aResult The result of the MrcdamlboGetItem() operation. - - KErrNone if the operation was successful. - - KErrInvalidMediaLibraryStateCookie if the media library state cookie - provided does not match the client's state cookie. - - KErrInvalidUid if the uid of the item requested is invalid, - e.g. the client removed the item before the request - MrcdamlboGetItem() coming. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareMediaLibraryBrowse::MrcdamlbMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - MrcdamlbDoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes,aResult); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseawarenowplayingbrowse.cpp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseawarenowplayingbrowse.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include - -/** -Called by the client in response to a MrcdanpboGetFolderListing() call. - -@param aFolderListing A listing of the items that are - in the range requested by the MrcdanpboGetFolderListing() call. If the - media player does not natively support a Now Playing folder the listing - will only contain one item which is the currently playing media element - -@param aMediaLibraryStateCookie The current value of the state cookie. -@param aResult The result of the MrcdanpboGetFolderListing() operation. - - KErrNone if the operation was successful. - - KErrMediaBrowseInvalidOffset if there is no media available at the - offset of the start item, i.e. the start of range provided via - MrcdanpboGetFolderListing() is not valid. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbFolderListing( - const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TUint aResult) - { - MrcdanpbDoFolderListing(aFolderListing, aMediaLibraryStateCookie, aResult); - } - -/** -Called by the client in response to MrcdanpboGetItem() call - -@param aMediaID The media element UID. -@param aMediaName The media name. Takes a copy of it. -@param aMediaType The media type. -@param aAttributes The attributes list. Takes a copy of it. -@param aResult The result of the MrcdanpboGetItem() operation. - - KErrNone if the operation was successful. - - KErrInvalidMediaLibraryStateCookie if the media library state cookie - does not match the client's state cookie. - - KErrInvalidUid if the uid of the item requested is invalid, - e.g. the client removed the item before the request - MrcdanpboGetItem() coming. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseAwareNowPlayingBrowse::MrcdanpbMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - MrcdanpbDoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseunawaremediabrowsetarget.cpp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseunawaremediabrowsetarget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include - -EXPORT_C CRemConDatabaseUnawareMediaBrowseTarget* CRemConDatabaseUnawareMediaBrowseTarget::NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver, - TBool aSearchSupported, - MRemConDatabaseUnawareMediaLibraryBrowse*& aMlInterface, - MRemConDatabaseUnawareNowPlayingBrowse*& aNpInterface) - { - CRemConDatabaseUnawareMediaBrowseTarget* self = new(ELeave)CRemConDatabaseUnawareMediaBrowseTarget( - aInterfaceSelector, aMlObserver, aNpObserver, aMlInterface, aNpInterface); - CleanupStack::PushL(self); - self->ConstructL(aSearchSupported); - CleanupStack::Pop(self); - return self; - } - -CRemConDatabaseUnawareMediaBrowseTarget::CRemConDatabaseUnawareMediaBrowseTarget( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver, - MRemConDatabaseUnawareMediaLibraryBrowse*& aMlInterface, - MRemConDatabaseUnawareNowPlayingBrowse*& aNpInterface) - : CRemConMediaBrowseTargetBase(aInterfaceSelector, aMlObserver, aNpObserver) - { - aMlInterface = this; - aNpInterface = this; - } - -void CRemConDatabaseUnawareMediaBrowseTarget::ConstructL( - TBool aSearchSupported) - { - BaseConstructL(aSearchSupported); - } - -CRemConDatabaseUnawareMediaBrowseTarget::~CRemConDatabaseUnawareMediaBrowseTarget() - { - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoFolderListing( - const TArray& aFolderListing, - TUint aResult) - { - DoFolderListing(aFolderListing, 0, aResult); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoFolderUpResult( - TUint aItemCount, TInt aResult) - { - DoFolderUpResult(aItemCount, aResult); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoFolderDownResult( - TUint aItemCount, TInt aResult) - { - DoFolderDownResult(aItemCount, aResult); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoGetPathResult( - TUint aItemCount, - TInt aResult) - { - DoGetPathResult(aItemCount, 0, aResult); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoSearchResult( - TUint aNumberItemsFound, - TInt aResult) - { - DoSearchResult(aNumberItemsFound, 0, aResult); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoMediaLibraryStateChange() - { - DoMediaLibraryStateChange(0); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoFolderItemResult( - const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult) - { - DoFolderItemResult(aFolderID,aFolderName, aFolderType, aPlayable, aAttributes, aResult); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdumlbDoMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - DoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdunpbDoFolderListing( - const TArray& aFolderListing, - TUint aResult) - { - DoFolderListing(aFolderListing, 0, aResult); - } - -void CRemConDatabaseUnawareMediaBrowseTarget::MrcdunpbDoMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - DoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult); - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseunawaremedialibrarybrowse.cpp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseunawaremedialibrarybrowse.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include - -/** -Called by the client in response to a MrcdumlboGetFolderListing() call. - -@param aFolderListing A listing of the items that are - in the range requested by the MrcdumlboGetFolderListing() call. - -@param aResult The result of the MrcdumlboGetFolderListing() operation. - - KErrNone if the operation was successful. - - KErrMediaBrowseInvalidOffset if there is no media available at the - offset of the start item, i.e. the start of range provided via - MrcdumlboGetFolderListing() is not valid. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderListing( - const TArray& aFolderListing, - TUint aResult) - { - MrcdumlbDoFolderListing(aFolderListing, aResult); - } - -/** -Called by the client in response to a MrcdumlboFolderUp call. - -@param aItemCount The number of items present in this folder. -@param aResult The result of the MrcdumlboFolderUp operation. - - KErrNone if the operation was successful. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderUpResult( - TUint aItemCount, TInt aResult) - { - MrcdumlbDoFolderUpResult(aItemCount, aResult); - } - -/** -Called by the client in response to a MrcdumlboFolderDown() call. - -@param aItemCount The number of items present in this folder. - -@param aResult The result of the MrcdumlboFolderDown() operation - - KErrNone if the operation was successful. - - KErrMediaBrowseInvalidDirection if the folder provided is not a valid - folder e.g. path A/B/C, the current dirctory is B, and the param - provided with MrcdumlboFolderDown()is A, obviously you can not change - folder down to A, so A is invalid. - - KErrMediaBrowseNotADirectory if the UID provided does not refer to a - folder item, e.g. it is a media element. - - KErrInvalidUid if the UID provided is invalid. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderDownResult( - TUint aItemCount, TInt aResult) - { - MrcdumlbDoFolderDownResult(aItemCount, aResult); - } - -/** -Called by the client in response to a MrcdumlboGetPath() call. - -@param aItemCount The number of items present in this folder. - -@param aResult The result of the MrcdumlboGetPath() operation - - KErrNone if the operation is successful. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbGetPathResult( - TUint aItemCount, - TInt aResult) - { - MrcdumlbDoGetPathResult(aItemCount, aResult); - } - -/** -Called by the client in response to a MrcdumlboSearch() call to indicate -that a search has completed. - -@param aNumberItemsFound The number of items found by the search. -@param aResult The result of the search. - - KErrNone if the search completed successfully - - System wide error otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbSearchResult( - TUint aNumberItemsFound, - TInt aResult) - { - MrcdumlbDoSearchResult(aNumberItemsFound, aResult); - } - -/** -Called by the client to indicate changes to the media database in the client. -*/ -EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaLibraryStateChange() - { - MrcdumlbDoMediaLibraryStateChange(); - } - -/** -Called by the client in response to MrcdumlboGetItem() call in the case the -requested item is a folder item. - -@param aFolderID The folder UID. -@param aFolderName The folder name. Takes a copy of it. -@param aFolderType The folder type. -@param aPlayable Indicaties whether the folder is playable - - KFolderNotPlayable the folder can not be played - - KFolderPlayable the folder can be played -@param aAttributes The attributes of the folder item requested by - MrcdumlboGetItem() -@param aResult The result of the MrcdumlboGetItem() operation. - - KErrNone if the operation was successful. - - KErrInvalidUid if the uid of the item requested is invalid, - e.g. the client removed the item before the request - MrcdumlboGetItem() coming. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbFolderItemResult( - const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult) - { - MrcdumlbDoFolderItemResult(aFolderID, aFolderName, aFolderType, aPlayable, aAttributes, aResult); - } - -/** -Called by the client in response to MrcdumlboGetItem() call in the case the -requested item is a media element item. - -@param aMediaID The media element UID. -@param aMediaName The media name. Takes a copy of it. -@param aMediaType The media type. -@param aAttributes The attributes list. Takes a copy of it. -@param aResult The result of the MrcdumlboGetItem() operation. - - KErrNone if the operation was successful. - - KErrInvalidUid if the uid of the item requested is invalid, - e.g. the client removed the item before the request - MrcdumlboGetItem() coming. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareMediaLibraryBrowse::MrcdumlbMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - MrcdumlbDoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult); - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseunawarenowplayingbrowse.cpp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/src/remcondatabaseunawarenowplayingbrowse.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include - -/** -Called by the client in response to a MrcdunpboGetFolderListing() call. - -@param aFolderListing A listing of the items that are - in the range requested by the MrcdunpboGetFolderListing() call. If the - media player does not natively support a Now Playing folder the listing - will only contain one item which is the currently playing media element - -@param aResult The result of the MrcdunpboGetFolderListing() operation. - - KErrNone if the operation was successful. - - KErrMediaBrowseInvalidOffset if there is no media available at the - offset of the start item, that is the start of range provided via - MrcnptoGetFolderListing() is not valid. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbFolderListing( - const TArray& aFolderListing, - TUint aResult) - { - MrcdunpbDoFolderListing(aFolderListing, aResult); - } - -/** -Called by the client in response to MrcdunpboGetItem() call - -@param aMediaID The media element UID. -@param aMediaName The media name. Takes a copy of it. -@param aMediaType The media type. -@param aAttributes The attributes list. Takes a copy of it. -@param aResult The result of the MrcdunpboGetItem() operation. - - KErrNone if the operation was successful. - - KErrInvalidUid if the uid of the item requested is invalid, - e.g. the client removed the item before the request - MrcdunpboGetItem() coming. - - System wide error code otherwise. -*/ -EXPORT_C void MRemConDatabaseUnawareNowPlayingBrowse::MrcdunpbMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - MrcdunpbDoMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/src/remconmediabrowsetargetbase.cpp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/src/remconmediabrowsetargetbase.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1295 +0,0 @@ -// 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" -// 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include -#include -#include -#include -#include -#include "mediabrowse.h" -#include "remconmediabrowsefault.h" -#include "remconqueuemessage.h" - -const TInt KDatabaseUnawareUidCounter = 0; -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_REMCONMEDIABROWSEAPI); -_LIT8(KLogFormat, "Operation Id = 0x%x, Data Lengh = %d"); -#endif -//========================================================================================= -// Construction/Destruction -//========================================================================================= -CRemConMediaBrowseTargetBase::CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver, - TUint16 aMediaLibraryStateCookie) - : CRemConInterfaceBase(TUid::Uid(KRemConMediaBrowseApiUid), - KMaxLengthMediaBrowseMsg, - aInterfaceSelector, - ERemConClientTypeTarget), - iInterfaceSelector(aInterfaceSelector), - iRcdamlbo(&aMlObserver), - iRcdanpbo(&aNpObserver), - iMediaLibraryStateCookie(aMediaLibraryStateCookie), - iAttributeIterator(iMediaAttributeIds), - iNullIterator(iNullArray), - iSearchInProgress(EFalse), - iLastMlscUpdate(aMediaLibraryStateCookie) - { - } - -CRemConMediaBrowseTargetBase::CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver, - MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver) - : CRemConInterfaceBase(TUid::Uid(KRemConMediaBrowseApiUid), - KMaxLengthMediaBrowseMsg, - aInterfaceSelector, - ERemConClientTypeTarget), - iInterfaceSelector(aInterfaceSelector), - iRcdumlbo(&aMlObserver), - iRcdunpbo(&aNpObserver), - iAttributeIterator(iMediaAttributeIds), - iNullIterator(iNullArray), - iSearchInProgress(EFalse) - { - } - -CRemConMediaBrowseTargetBase::~CRemConMediaBrowseTargetBase() // codescanner::destructor - { - iMediaAttributeIds.Close(); - iNullArray.Close(); - iOutBuf.Close(); - iSearchString.Close(); - - // iGetPathResponse, iGiaResponse and iGflResponse are instantiated in CRemConMediaBrowseTargetBase::BaseConstructL() and - // so should have the same lifetime as this CRemConMediaBrowseTargetBase instance - __ASSERT_DEBUG(iGetPathResponse && iGiaResponse && iGflResponse, MediaBrowsePanic::Panic(EUnexpectedNullMemberField)); - iGetPathResponse->Close(); - iGiaResponse->Close(); - iGflResponse->Close(); - delete iGetPathResponse; - delete iGiaResponse; - delete iGflResponse; - - if (iNextMessageCallBack) - { - iNextMessageCallBack->Cancel(); - delete iNextMessageCallBack; - } - if (iNextItemCallBack) - { - iNextItemCallBack->Cancel(); - delete iNextItemCallBack; - } - - iMsgQueue->Reset(); - delete iMsgQueue; - } - -void CRemConMediaBrowseTargetBase::BaseConstructL(TBool aSearchSupported) - { - iMsgQueue = new(ELeave)TRemConMessageQueue(); - - iGetPathResponse = new(ELeave)RRemConGetPathResponse(); - iGiaResponse = new(ELeave)RRemConGetItemAttributesResponse(); - iGflResponse = new(ELeave)RRemConGetFolderItemsResponse(); - - TCallBack cb(&NextMessageCb, this); - iNextMessageCallBack = new(ELeave)CAsyncCallBack(cb, CActive::EPriorityStandard); - - TCallBack itemCallBack(&NextItemCallBack, this); - iNextItemCallBack = new(ELeave)CAsyncCallBack(itemCallBack, CActive::EPriorityStandard); - - RRemConInterfaceFeatures features; - User::LeaveIfError(features.Open()); - CleanupClosePushL(features); - - if(aSearchSupported) - { - features.AddOperationL(ESearchOperationId); - iSearchSupported = ETrue; - } - - if(DatabaseAware()) - { - features.AddOperationL(EUIDPersistency); - } - - //Mandate the following operationIds to be supported in the client - features.AddOperationL(EGetFolderItemsOperationId); - features.AddOperationL(EChangePathOperationId); - features.AddOperationL(EGetItemAttributesOperationId); - features.AddOperationL(ESetBrowsedPlayerOperationId); - - iOutBuf.CreateL(KMediaBrowseOutBufMaxLength); - - CRemConInterfaceBase::BaseConstructL(features, ETrue); // it's true, this interface is a bulk interface - CleanupStack::PopAndDestroy(&features); - } - -//========================================================================================= -// RemCon interface stuff, called from interface selector -//========================================================================================= - -/** -@internalComponent -@released - -Gets a pointer to a specific interface version. - -@return A pointer to the interface, NULL if not supported. -*/ -TAny* CRemConMediaBrowseTargetBase::GetInterfaceIf(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf1) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -void CRemConMediaBrowseTargetBase::MrcibNewMessage(TUint aOperationId, - const TDesC8& aData) - { - LOG_FUNC - LOG2(KLogFormat, aOperationId, aData.Length()); - - TMetadataTransferPDU currentOp = RAvrcpIPC::GetPDUIdFromIPCOperationId(aOperationId); - switch(currentOp) - { - case EGetFolderItemsOperationId: - AddToOperationQueue(EMbGetFolderItems, - EGetFolderItemsOperationId, aData); - if (!iMsgQueue->IsEmpty() && !iInProgress && !iMsgQueue->Find( - TUid::Uid(KRemConMediaBrowseApiUid) - ,EGetFolderItemsOperationId)) - { - iNextMessageCallBack->CallBack(); - } - break; - case EChangePathOperationId: - ProcessChangePath(aData); - break; - case EGetItemAttributesOperationId: - { - AddToOperationQueue(EMbGetItemAttributes, - EGetItemAttributesOperationId, aData); - if (!iMsgQueue->IsEmpty() && !iInProgress && !iMsgQueue->Find( - TUid::Uid(KRemConMediaBrowseApiUid) - ,EGetItemAttributesOperationId)) - { - iNextMessageCallBack->CallBack(); - } - break; - } - case ESearchOperationId: - ProcessSearch(aData); - break; - case ESetBrowsedPlayerOperationId: - ProcessGetPath(aData); - break; - case EMediaLibraryStateCookieUpdateOperationId: - ProcessMediaLibraryStateCookieUpdate(aData); - break; - default: - __ASSERT_DEBUG(EFalse, MediaBrowseFault::Fault(EUnexpectedOperationId)); - break; - }; - } - -//========================================================================================= -// Browse Interface functions, called from derived classes -//========================================================================================= -void CRemConMediaBrowseTargetBase::DoFolderListing(const TArray& aFolderListing, - TUint16 aMediaLibraryStateCookie, - TInt aResult) - { - if (aResult != KErrNone) - { - SendGetFolderItemsResponse(aResult, KNullDesC8); - return; - } - - // If asserted here, means the client calls the interface FolderListing() - // more than once corresponding to the only once call - // MrcmbtoGetFolderListing() - __ASSERT_DEBUG(iGflResponse->iItems.Count() == 0, MediaBrowsePanic::Panic(EFolderListingProvidedTwice)); - - // Store clients state cookie to pass it back when requesting each item. - // This will ensure that we don't miss state change during the course of - // the non-atomic GetFolderListing operation - iGflResponse->iUidCounter = aMediaLibraryStateCookie; - - // Store these UIDs, then ask for info about them - if (iGflResponse->CopyItems(aFolderListing) != KErrNone) - { - SendGetFolderItemsResponse(KErrAvrcpAirInternalError, KNullDesC8); - return; - } - - iGflResponse->iCurrentListingSize = KGetFolderItemsResponseBaseSize; - iGflResponse->iCurrentItem = -1; - RequestNextItem(); - } - -void CRemConMediaBrowseTargetBase::DoFolderUpResult(TUint aItemCount, TInt aResult) - { - SendChangePathResponse(aItemCount, aResult); - } - -void CRemConMediaBrowseTargetBase::DoFolderDownResult(TUint aItemCount, TInt aResult) - { - SendChangePathResponse(aItemCount, aResult); - } - -void CRemConMediaBrowseTargetBase::DoGetPathResult(TUint aItemCount, - TUint16 aMediaLibraryStateCookie, - TInt aResult) - { - if (aResult != KErrNone) - { - iGetPathResponse->Close(); - return SendError(EMbSetBrowsedPlayer, - ESetBrowsedPlayerOperationId, aResult); - } - - // Store the current UIDs counter. - iMediaLibraryStateCookie = aMediaLibraryStateCookie; - - TInt status = KErrAvrcpAirBase - KErrAvrcpAirSuccess; - iGetPathResponse->iStatus = status; - iGetPathResponse->iUidCounter = aMediaLibraryStateCookie; - iGetPathResponse->iNumberItems = aItemCount; - - RBuf8 responseBuf; - TInt error = responseBuf.Create(iGetPathResponse->Size()); - if (error != KErrNone) - { - iGetPathResponse->Close(); - return SendError(EMbSetBrowsedPlayer, - ESetBrowsedPlayerOperationId, KErrAvrcpAirInternalError); - } - - iGetPathResponse->iPduId = AvrcpBrowsing::ESetBrowsedPlayer; - TRAP(error, iGetPathResponse->WriteL(responseBuf)); - if (error == KErrNone) - { - // Send the response back to the CT - error = InterfaceSelector().SendBulkUnreliable( - TUid::Uid(KRemConMediaBrowseApiUid), - ESetBrowsedPlayerOperationId, responseBuf ); - } - - iGetPathResponse->Close(); - responseBuf.Close(); - } - -void CRemConMediaBrowseTargetBase::DoSearchResult(TUint aNumberItemsFound, - TUint16 aMediaLibraryStateCookie, - TInt aResult) - { - // GetFoldItems should in progress When this interface is called. - __ASSERT_DEBUG(iSearchInProgress, MediaBrowsePanic::Panic(ESearchResultWithoutRequest)); - - SendSearchResponse(aResult, aNumberItemsFound, aMediaLibraryStateCookie); - } - -void CRemConMediaBrowseTargetBase::DoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie) - { - if(DatabaseAware()) - { - __ASSERT_DEBUG(aMediaLibraryStateCookie != KDatabaseUnawareUidCounter, MediaBrowsePanic::Panic(EZeroMediaLibraryStateCookie)); - - // For database aware players we need to update if we have a pending update and - // the new value is different to what we last - if(iMlscUpdatePending && (aMediaLibraryStateCookie != iLastMlscUpdate)) - { - // Send update with new value - SendMediaLibraryStateCookieUpdateResponse(aMediaLibraryStateCookie); - } - - // Always store the last value here. When we are asked for an update - // we will be provided with the value the update should be relative - // to, so we will compare to this. - iLastMlscUpdate = aMediaLibraryStateCookie; - } - else - { - __ASSERT_DEBUG(aMediaLibraryStateCookie == KDatabaseUnawareUidCounter, MediaBrowseFault::Fault(ENonZeroMediaLibraryStateCookie)); - - if(iMlscUpdatePending) - { - SendMediaLibraryStateCookieUpdateResponse(aMediaLibraryStateCookie); - } - else - { - // For database aware clients the value can never change. Indicate that - // the client has informed us of the state change by incrementing our - // update value so that we know there's been a change. The value doesn't - // matter, we just have to make it something other than zero. - iLastMlscUpdate = 1; - } - } - } - -void CRemConMediaBrowseTargetBase::DoFolderItemResult(const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - const TArray& aAttributes, - TInt aResult) - { - // GetFolderItems should in progress When this interface is called. - __ASSERT_DEBUG(iGetFolderListing || iGetItemAttributes, MediaBrowsePanic::Panic(EFolderItemResultWithoutRequest)); - - if(iGetFolderListing) - { - ProcessFolderItemResult(aFolderID, aFolderName, aFolderType, aPlayable, aResult); - } - - if (iGetItemAttributes) - { - ProcessGetItemAttributesResult(aAttributes, aResult); - } - } - -void CRemConMediaBrowseTargetBase::DoMediaElementItemResult(const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - __ASSERT_DEBUG((iGetFolderListing || iGetItemAttributes), MediaBrowsePanic::Panic(EMediaElementItemResultWithoutRequest)); - - if (iGetFolderListing) - { - ProcessMediaElementItemResult(aMediaID, aMediaName, aMediaType, aAttributes, aResult); - } - - if (iGetItemAttributes) - { - ProcessGetItemAttributesResult(aAttributes, aResult); - } - } - -//========================================================================================= -// Utility functions, called internally -//========================================================================================= - -void CRemConMediaBrowseTargetBase::ProcessMediaLibraryStateCookieUpdate(const TDesC8& aData) - { - // Try to read the incoming request - RRemConUidsChangedRequest request; - TRAPD(error, request.ReadL(aData)); - __ASSERT_DEBUG(error == KErrNone, MediaBrowseFault::Fault(EBadlyFormattedMediaLibraryStateCookieUpdate)); - static_cast(error == error); // stops compiler warnings (assert above indicates design contract). - - if(request.iInitialUidCounter != iLastMlscUpdate) - { - // The client has updated the uid counter since the bearer - // last asked. Tell it the new value. The Send..Response - // function deals with all the state management necessary, - // including whether we are database aware or unaware - SendMediaLibraryStateCookieUpdateResponse(iLastMlscUpdate); - } - else - { - // Bearer still up to date. Remember that it's waiting for - // an update. - iMlscUpdatePending = ETrue; - } - } - -void CRemConMediaBrowseTargetBase::ProcessGetItemAttributes(const TDesC8& aData) - { - TRemConFolderScope scope; - TRemConItemUid item; - TUint16 uidCounter; - TInt err = ParseGetItemAttributesRequest(aData, scope, item, uidCounter); - if (err != KErrNone) - { - SendGetItemAttributesResponse(err, KNullDesC8); - return; - } - - iAttributeIterator.Start(); - iInProgress = ETrue; - iGetItemAttributes = ETrue; - TInt result = KErrNone; - if(scope == ENowPlayingFolder) - { - if (!DatabaseAware() && (0 == uidCounter))//Database UnAware - { - result = iRcdunpbo->MrcdunpboGetItem(item, iAttributeIterator); - } - else if (DatabaseAware() && (uidCounter > 0)) - { - result = iRcdanpbo->MrcdanpboGetItem(item, iAttributeIterator, uidCounter); - } - else - { - result = KErrAvrcpAirInvalidParameter; - } - } - else - { - if (!DatabaseAware() && (0 == uidCounter))//Database UnAware - { - result = iRcdumlbo->MrcdumlboGetItem(scope, item, iAttributeIterator); - } - else if (DatabaseAware() && (uidCounter > 0)) - { - result = iRcdamlbo->MrcdamlboGetItem(scope, item, iAttributeIterator, - uidCounter); - } - else - { - result = KErrAvrcpAirInvalidParameter; - } - } - - // The call back function returns error. - if (result != KErrNone) - { - SendGetItemAttributesResponse(result, KNullDesC8); - } - } - -void CRemConMediaBrowseTargetBase::SendGetItemAttributesResponse(TInt aResult, const TDesC8& aData) - { - if(aResult != KErrNone) - { - SendError(EMbGetItemAttributes, EGetItemAttributesOperationId, aResult); - } - else - { - InterfaceSelector().SendBulkUnreliable( - TUid::Uid(KRemConMediaBrowseApiUid), - EGetItemAttributesOperationId, aData); - } - - iInProgress = EFalse; - iGetItemAttributes = EFalse; - iMediaAttributeIds.Reset(); - iGiaResponse->Close(); - - if (!iMsgQueue->IsEmpty()) - { - iNextMessageCallBack->CallBack(); - } - } - -void CRemConMediaBrowseTargetBase::ProcessChangePath(const TDesC8& aData) - { - // Try to read the incoming request - TInt error = KErrNone; - RRemConChangePathRequest request; - TRAP(error, request.ReadL(aData)); - - // Couldn't parse the request; tell them it was invalid - if (error != KErrNone) - { - SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInvalidParameter); - return; - } - - if(request.iDirection == AvrcpBrowsing::KUp) - { - if (DatabaseAware() && (request.iUidCounter > 0)) - { - iRcdamlbo->MrcdamlboFolderUp(request.iUidCounter); - } - else if (!DatabaseAware() && (0 == request.iUidCounter)) - { - iRcdumlbo->MrcdumlboFolderUp(); - } - else - { - SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInvalidParameter); - } - } - else if(request.iDirection == AvrcpBrowsing::KDown) - { - if (DatabaseAware() && (request.iUidCounter > 0)) - { - iRcdamlbo->MrcdamlboFolderDown(request.iElement, request.iUidCounter); - } - else if (!DatabaseAware() && (0 == request.iUidCounter)) - { - iRcdumlbo->MrcdumlboFolderDown(request.iElement); - } - else - { - SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInvalidParameter); - } - } - else - { - SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInvalidDirection); - } - } - -void CRemConMediaBrowseTargetBase::SendSearchResponse(TInt aResult, TUint aNumberItemsFound, TUint16 aMediaLibraryStateCookie) - { - iSearchString.Close(); - - // format the response in a RRemConSearchResponse - RRemConMediaErrorResponse errResponse; - RRemConSearchResponse response; - TInt symbianError = errResponse.SymbianErrorCheck(aResult); - - response.iStatus = errResponse.SymbianErrToStatus(symbianError); - response.iPduId = AvrcpBrowsing::ESearch;//0x80 - response.iUidCounter = aMediaLibraryStateCookie; - response.iNumberItems = aNumberItemsFound; - TRAPD(error, response.WriteL(iOutBuf)); - if (error == KErrNone) - { - // send the response back to the CT - error = InterfaceSelector().SendBulkUnreliable( - TUid::Uid(KRemConMediaBrowseApiUid), - ESearchOperationId, iOutBuf ); - } - - //Search operatin complete. - iSearchInProgress = EFalse; - } - -void CRemConMediaBrowseTargetBase::ProcessSearch(const TDesC8& aData) - { - // Don't trouble the client with this if they've informed us they don't - // support it - if (!iSearchSupported) - { - return SendSearchResponse(KErrAvrcpAirSearchNotSupported, 0, 0); - } - - // We know a search operation is in progress - if (iSearchInProgress) - { - return SendSearchResponse(KErrAvrcpAirSearchInProgress, 0, 0); - } - - // Try to read the incoming request - TInt error = KErrNone; - RRemConSearchRequest request; - TRAP(error, request.ReadL(aData)); - - // Couldn't parse the request; tell them it was invalid - if (error != KErrNone) - { - error = (error == KErrNoMemory) ? - KErrAvrcpAirInternalError : KErrAvrcpAirInvalidParameter; - - return SendSearchResponse(error, 0, 0); - } - - // Check the character set - if (request.iCharset != KUtf8MibEnum) - { - iSearchInProgress = EFalse; - return SendSearchResponse(KErrAvrcpAirInvalidParameter, 0, 0); - } - - iSearchString.Close(); - iSearchString.Assign(request.iSearchString); - //iSearchString has taken ownership of request's search string. - request.iSearchString.Assign(NULL); - - iSearchInProgress = ETrue; - - if(DatabaseAware()) - { - iRcdamlbo->MrcdamlboSearch(iSearchString); - } - else - { - iRcdumlbo->MrcdumlboSearch(iSearchString); - } - - request.Close(); - } - -void CRemConMediaBrowseTargetBase::ProcessGetPath(const TDesC8& aData) - { - iGflResponse->iMaxResponse = *(reinterpret_cast(aData.Ptr())); - - if(DatabaseAware()) - { - iRcdamlbo->MrcdamlboGetPath(iGetPathResponse->iPath); - } - else - { - iRcdumlbo->MrcdumlboGetPath(iGetPathResponse->iPath); - } - } - -void CRemConMediaBrowseTargetBase::ProcessGetFolderItems(const TDesC8& aData) - { - // The bearer is responsible for ensuring we have been supplied with response - // max size before sending us any requests - __ASSERT_DEBUG(iGflResponse->iMaxResponse != 0, MediaBrowseFault::Fault(ERequestWithoutMaxResponseBeingSet)); - - iInProgress = ETrue; - iGetFolderListing = ETrue; - - RRemConGetFolderItemsRequest request; - TRAPD(err, request.ReadL(aData)); - if(err != KErrNone) - { - request.Close(); - SendGetFolderItemsResponse(KErrAvrcpAirInvalidParameter, KNullDesC8); - return; - } - - if(request.iScope == AvrcpBrowsing::KSearchScope && !iSearchSupported) - { - request.Close(); - SendGetFolderItemsResponse(KErrAvrcpAirSearchNotSupported, KNullDesC8); - return; - } - - if (request.CopyAttributes(iMediaAttributeIds) != KErrNone) - { - request.Close(); - SendGetFolderItemsResponse(KErrAvrcpAirInternalError, KNullDesC8); - return; - } - iAttributeIterator.Start(); - - if(request.iScope == AvrcpBrowsing::KVirtualFilesystemScope) - { - iScope = EBrowseFolder; - } - else if(request.iScope == AvrcpBrowsing::KNowPlayingScope) - { - iScope = ENowPlayingFolder; - } - else if(request.iScope == AvrcpBrowsing::KSearchScope) - { - iScope = ESearchResultFolder; - } - else - { - request.Close(); - SendGetFolderItemsResponse(KErrAvrcpAirInvalidScope, KNullDesC8); - return; - } - - if (request.iStartItem > request.iEndItem) - { - request.Close(); - SendGetFolderItemsResponse(KErrAvrcpAirRangeOutOfBounds, KNullDesC8); - return; - } - - if(iScope == ENowPlayingFolder) - { - if(DatabaseAware()) - { - iRcdanpbo->MrcdanpboGetFolderListing(request.iStartItem, request.iEndItem); - } - else - { - iRcdunpbo->MrcdunpboGetFolderListing(request.iStartItem, request.iEndItem); - } - } - else - { - if(DatabaseAware()) - { - iRcdamlbo->MrcdamlboGetFolderListing(iScope,request.iStartItem, request.iEndItem); - } - else - { - iRcdumlbo->MrcdumlboGetFolderListing(iScope,request.iStartItem, request.iEndItem); - } - } - - request.Close(); - } - -void CRemConMediaBrowseTargetBase::SendGetFolderItemsResponse(TInt aResult, const TDesC8& aData) - { - if(aResult != KErrNone) - { - SendError(EMbGetFolderItems, EGetFolderItemsOperationId, aResult); - } - else - { - InterfaceSelector().SendBulkUnreliable( - TUid::Uid(KRemConMediaBrowseApiUid), - EGetFolderItemsOperationId, aData); - } - - iInProgress = EFalse; - iGetFolderListing = EFalse; - iMediaAttributeIds.Reset(); - iGflResponse->Close(); - - iNextItemCallBack->Cancel(); - - if (!iMsgQueue->IsEmpty()) - { - iNextMessageCallBack->CallBack(); - } - } - -TInt CRemConMediaBrowseTargetBase::NextMessageCb(TAny* aThis) - { - static_cast(aThis)->DoNextMessage(); - return KErrNone; - } - -void CRemConMediaBrowseTargetBase::DoNextMessage() - { - __ASSERT_DEBUG(!iMsgQueue->IsEmpty(), MediaBrowseFault::Fault(EUnexpectedNextMessageCallback)); - CRemConQueuedMessage* msg = iMsgQueue->First(); - iMsgQueue->Remove(*msg); - - switch (msg->iOperationId) - { - case EGetFolderItemsOperationId: - ProcessGetFolderItems(msg->Data()); - break; - case EGetItemAttributesOperationId: - ProcessGetItemAttributes(msg->Data()); - break; - default: - __ASSERT_DEBUG(EFalse, MediaBrowseFault::Fault(EUnexpectedNextMessageCallback)); - break; - } - delete msg; - } - -void CRemConMediaBrowseTargetBase::SendMediaLibraryStateCookieUpdateResponse(TUint16 aMediaLibraryStateCookie) - { - LOG_FUNC - - TUint16 newValue = DatabaseAware() ? aMediaLibraryStateCookie : KDatabaseUnawareUidCounter; - - TInt error = KErrNone; - RRemConUidsChangedResponse response; - response.iUidCounter = newValue; - TRAP(error, response.WriteL(iOutBuf)); - - if (error == KErrNone) - { - // send the response back to the CT - error = InterfaceSelector().SendBulkUnreliable( - TUid::Uid(KRemConMediaBrowseApiUid), - EMediaLibraryStateCookieUpdateOperationId, iOutBuf); - - iLastMlscUpdate = newValue; - iMlscUpdatePending = EFalse; - } - // otherwise we couldn't update the client. Leave our state with the update - // pending then we'll try again next time the client tells us state has - // changed. - } - -void CRemConMediaBrowseTargetBase::SendChangePathResponse(TUint aItemCount, - TInt aResult) - { - if (aResult != KErrNone) - { - return SendError(EMbChangePath, EChangePathOperationId, aResult); - } - - TInt error = KErrNone; - - // Format the response in a RRemConChangePathResponse - RRemConChangePathResponse response; - response.iStatus = KErrAvrcpAirBase - KErrAvrcpAirSuccess;//0x4 - response.iNumberItems = aItemCount; - - RBuf8 responseBuf; - error = responseBuf.Create(KMediaBrowseOutBufMaxLength); - if (error != KErrNone) - { - responseBuf.Close(); - SendError(EMbChangePath, EChangePathOperationId, KErrAvrcpAirInternalError); - return; - } - - response.iPduId = AvrcpBrowsing::EChangePath; - TRAP(error, response.WriteL(responseBuf)); - if (error == KErrNone) - { - // send the response back to the CT - error = InterfaceSelector().SendBulkUnreliable( - TUid::Uid(KRemConMediaBrowseApiUid), - EChangePathOperationId, responseBuf ); - } - - responseBuf.Close(); - } - -TInt CRemConMediaBrowseTargetBase::NextItemCallBack(TAny* aThis) - { - static_cast(aThis)->RequestNextItem(); - return KErrNone; - } - -void CRemConMediaBrowseTargetBase::RequestNextItem() - { - TInt err = KErrNone; - TInt result = KErrNone; - RBuf8 responseBuf; - - // If true, indicate that we have not got all the items requested, - // so going on. - // There are some array elements accessed by [] as follows without - // checking range for it is done in RequestNextItem function. - if ( iGflResponse->RequestNextItem(err, responseBuf, - iGflResponse->iUidCounter) ) - { - TBool folderItem = EFalse; - if (AvrcpBrowsing::EFolderItem == iGflResponse->iItems[iGflResponse->iCurrentItem].iType) - { - folderItem = ETrue; - } - iAttributeIterator.Start(); - if(iScope == ENowPlayingFolder) - { - if(DatabaseAware()) - { - result = iRcdanpbo->MrcdanpboGetItem( - iGflResponse->iItems[iGflResponse->iCurrentItem].iUid, - folderItem ? iNullIterator : iAttributeIterator, - iGflResponse->iUidCounter); - } - else - { - result = iRcdunpbo->MrcdunpboGetItem( - iGflResponse->iItems[iGflResponse->iCurrentItem].iUid, - folderItem ? iNullIterator : iAttributeIterator); - } - } - else - { - if(DatabaseAware()) - { - result = iRcdamlbo->MrcdamlboGetItem(iScope, - iGflResponse->iItems[iGflResponse->iCurrentItem].iUid, - folderItem ? iNullIterator : iAttributeIterator, - iGflResponse->iUidCounter); - } - else - { - result = iRcdumlbo->MrcdumlboGetItem(iScope, - iGflResponse->iItems[iGflResponse->iCurrentItem].iUid, - folderItem ? iNullIterator : iAttributeIterator); - } - } - - // The call back function reutrns error. - if (result != KErrNone) - { - SendGetFolderItemsResponse(result, KNullDesC8); - } - } - // If comes here, indicate that we stop requesting the next item - // which means two possibilities: - // 1. Success: Have got all the items we want. - // 2. Error: Error occured internally. - else if ( err == KErrNone ) //Possibility 1. - { - SendGetFolderItemsResponse(KErrNone, responseBuf); - } - else // Possibility 2. - { - SendGetFolderItemsResponse(KErrAvrcpAirInternalError, KNullDesC8); - } - responseBuf.Close(); - } - -void CRemConMediaBrowseTargetBase::DoItemComplete(TInt aResult) - { - if (aResult != KErrNone) - { - SendGetFolderItemsResponse(aResult, KNullDesC8); - } - else - { - // We have to put an async break in here - otherwise if large - // numbers of items are requested we could overflow the stack - iNextItemCallBack->CallBack(); - } - } - -void CRemConMediaBrowseTargetBase::SendError(TUint8 aPduId, - TUint aOperationId, - TInt aError) - { - TInt error = KErrNone; - RRemConMediaErrorResponse response; - response.iPduId = aPduId; - response.iStatus = RAvrcpIPC::SymbianErrToStatus(aError); - TRAP(error, response.WriteL(iOutBuf)); - if (error == KErrNone) - { - InterfaceSelector().SendBulkUnreliable( - TUid::Uid(KRemConMediaBrowseApiUid), - aOperationId, iOutBuf); - } - } - -/** -Sets an attribute value for the requested item. -*/ -TInt CRemConMediaBrowseTargetBase::DoAttributeValue( - TMediaAttributeId aAttributeId, - const TDesC8& aAttributeData ) - { - iSetAttributeValue = ETrue; - - REAResponse resp; - resp.iAttributeId = aAttributeId; - resp.iCharset = KUtf8MibEnum; - resp.iStringLen = aAttributeData.Length(); - resp.iString = aAttributeData.Alloc(); - if (!resp.iString) - { - iSetAttributeValue = EFalse; - return KErrNoMemory; - } - TInt status = KErrNone; - if(iGiaResponse->Size() + resp.iStringLen < iGflResponse->iMaxResponse) - { - status = iGiaResponse->iAttributes.Append(resp); - if (status != KErrNone) - { - iSetAttributeValue = EFalse; - resp.Close(); // make sure heap string is de-allocated - } - } - - return status; - } - -/** -Signals that all attributes requested has been supplied. -*/ - void CRemConMediaBrowseTargetBase::DoAllAttributesCompleted(TInt aResult) - { - TInt error = KErrNone; - __ASSERT_DEBUG(((aResult != KErrNone) || ((aResult == KErrNone) && iSetAttributeValue)), - MediaBrowseFault::Fault(EResultErrorCodeMismatch)); - - if (aResult == KErrNone) - { - // Finalise response; update number of attributes returned - iGiaResponse->iNumberAttributes = iGiaResponse->iAttributes.Count(); - } - - // Allocate a buffer for the formatted message - RBuf8 messageBuffer; - TInt bufferSize = - (aResult == KErrNone) ? iGiaResponse->Size() : KBrowseResponseBaseLength; - - if ( messageBuffer.Create(bufferSize) != KErrNone ) - { - SendGetItemAttributesResponse(KErrAvrcpAirInternalError, KNullDesC8); - } - else - { - // Send the result back to the CT - iGiaResponse->iPduId = AvrcpBrowsing::EGetItemAttributes; // 0x73 - iGiaResponse->iStatus = RAvrcpIPC::SymbianErrToStatus(aResult); - - TRAP(error, iGiaResponse->WriteL(messageBuffer)); - if (error == KErrNone) - { - SendGetItemAttributesResponse(KErrNone, messageBuffer); - } - else - { - SendGetItemAttributesResponse(KErrAvrcpAirInternalError, KNullDesC8); - } - } - messageBuffer.Close(); - } - -TInt CRemConMediaBrowseTargetBase::ItemAttributesResult( - const TArray& aAttributes) - { - TInt error = KErrNone; - TMediaAttributeId attributeId; - for (TInt i = 0; i < aAttributes.Count(); i++) - { - // check that the values supplied were requested - attributeId = aAttributes[i].iAttributeId; - if ( KErrNotFound == iMediaAttributeIds.Find(attributeId) ) - { - //Omit the invalid ones - continue; - } - - error = DoAttributeValue(attributeId, *aAttributes[i].iString); - if (error != KErrNone) - { - break; - } - } - - return error; - } - -void CRemConMediaBrowseTargetBase::AddToOperationQueue(TUint8 aPduId, - TInt aOperationId, - const TDesC8& aData) - { - CRemConQueuedMessage* msg = NULL; - TRAPD(err, msg = CRemConQueuedMessage::NewL( - TUid::Uid(KRemConMediaBrowseApiUid), aData, aOperationId)); - if (err == KErrNone) - { - iMsgQueue->AddLast(*msg); - } - else - { - SendError(aPduId, aOperationId, KErrAvrcpAirInternalError); - } - } - -TInt CRemConMediaBrowseTargetBase::ParseGetItemAttributesRequest( - const TDesC8& aData, - TRemConFolderScope& aScope, - TRemConItemUid& aItemUid, - TUint16& aMediaLibraryStateCookie) - { - // Try to read the incoming request - TInt error = KErrNone; - RRemConGetItemAttributesRequest request; - TRAP(error, request.ReadL(aData)); - - // Couldn't parse the request;tell them it was invalid - // Specification says unique id must not be 0x0 - if (error != KErrNone || request.iElement == 0) - { - request.Close(); - return KErrAvrcpAirInvalidParameter; - } - - if (request.iNumberAttributes == 0) - { - // spec says this is a request for all attribs - // current spec has 7 specified (0x01 to 0x07) - for (TInt i = 1; i <= KMediaAttributeNum; i++) - { - if (iMediaAttributeIds.Append(static_cast(i)) - != KErrNone) - { - request.Close(); - return KErrAvrcpAirInternalError; - } - } - } - else - { - // No need to check - // request.iNumberAttributes == request.iAttributes.Count() - // as this must be correct or request.ReadL(aData) leaves - TUint8 value; - TMediaAttributeId attributeid; - for (TInt i = 0; i < request.iNumberAttributes; i++) - { - value = request.iAttributes[i]; - if (value > 0 && value <= KMaxMediaAttributeValue ) - { - attributeid = static_cast(value); - if (iMediaAttributeIds.Append(attributeid) != KErrNone) - { - request.Close(); - return KErrAvrcpAirInternalError; - } - } - } - } - // Check that some valid attribute ids have been found - if (iMediaAttributeIds.Count() == 0) - { - request.Close(); - return KErrAvrcpAirInvalidParameter; - } - - if(request.iScope == AvrcpBrowsing::KSearchScope) - { - aScope = ESearchResultFolder; - } - else if(request.iScope == AvrcpBrowsing::KVirtualFilesystemScope) - { - aScope = EBrowseFolder; - } - else if (request.iScope == AvrcpBrowsing::KNowPlayingScope) - { - aScope = ENowPlayingFolder; - } - else - { - request.Close(); - return KErrAvrcpAirInvalidScope; - } - - aItemUid = request.iElement; - aMediaLibraryStateCookie = request.iUidCounter; - - request.Close(); - return KErrNone; - } - -void CRemConMediaBrowseTargetBase::ProcessMediaElementItemResult( - const TRemConItemUid& aMediaID, - const TDesC8& aMediaName, - TMediaItemType aMediaType, - const TArray& aAttributes, - TInt aResult) - { - TInt internalError = KErrNone; - if (aResult == KErrNone) - { - __ASSERT_DEBUG(aMediaType < AvrcpBrowsing::KMediaTypeReserved, MediaBrowsePanic::Panic(EInvalidMediaType)); - - RItem& item = iGflResponse->iItems[iGflResponse->iCurrentItem]; - if (item.iUid == aMediaID) - { - item.iType = AvrcpBrowsing::EMediaElement; - item.iCharset = KUtf8MibEnum; - - item.iName = aMediaName.Alloc(); - internalError = (!item.iName) ? KErrNoMemory : internalError; - - if (internalError == KErrNone) - { - item.iNameLength = aMediaName.Length(); - item.iMediaType = static_cast(aMediaType); - item.iNumberAttributes = aAttributes.Count(); - item.iLength = KMediaElementItemBaseLength + item.iNameLength; - TInt attributeCount = aAttributes.Count(); - REAResponse attribute; - for (TInt i = 0; i < attributeCount; i++) - { - // Check that the values supplied were requested - if (KErrNotFound == iMediaAttributeIds.Find(aAttributes[i].iAttributeId)) - { - //Omit the invalid ones - continue; - } - - attribute.iAttributeId = aAttributes[i].iAttributeId; - attribute.iString = aAttributes[i].iString->Alloc(); - internalError = (!attribute.iString) ? KErrNoMemory : internalError; - if (internalError == KErrNone) - { - attribute.iCharset = KUtf8MibEnum; - attribute.iStringLen = attribute.iString->Length(); - item.iAttributes.Append(attribute); - - item.iLength += - KAttributeBaseLength + attribute.iString->Length(); - } - else - { - //it's useless to continue as there is an allocation issue - break; - } - } - } - } - else - { - internalError = KErrArgument; - } - } - - aResult = - (KErrNone == internalError)? aResult : KErrAvrcpAirInternalError; - - DoItemComplete(aResult); - } - -void CRemConMediaBrowseTargetBase::ProcessFolderItemResult( - const TRemConItemUid& aFolderID, - const TDesC8& aFolderName, - TFolderItemType aFolderType, - TFolderItemPlayable aPlayable, - TInt aResult) - { - TInt internalError = KErrNone; - if (aResult == KErrNone) - { - __ASSERT_DEBUG(aFolderType < AvrcpBrowsing::EFolderTypeReserved, MediaBrowsePanic::Panic(EInvalidFolderType)); - __ASSERT_DEBUG(aPlayable < AvrcpBrowsing::KPlayableReserved, MediaBrowsePanic::Panic(EInvalidPlayableValue)); - - RItem& item = iGflResponse->iItems[iGflResponse->iCurrentItem]; - if (item.iUid == aFolderID) - { - item.iType = AvrcpBrowsing::EFolderItem; - item.iCharset = KUtf8MibEnum; - - item.iName = aFolderName.Alloc(); - internalError = (!item.iName) ? KErrNoMemory : internalError; - - item.iNameLength = aFolderName.Length(); - - item.iFolderType = - static_cast(aFolderType); - - item.iPlayable = aPlayable; - item.iLength = KFolderItemBaseLength + item.iNameLength; - } - else - { - internalError = KErrArgument; - } - } - - aResult = (internalError == KErrNone) ? aResult : KErrAvrcpAirInternalError; - - DoItemComplete(aResult); - } - -void CRemConMediaBrowseTargetBase::ProcessGetItemAttributesResult( - const TArray& aAttributes, - TInt aResult) - { - TInt internalError = KErrNone; - if (aResult == KErrNone) - { - internalError = ItemAttributesResult(aAttributes); - } - - aResult = - (KErrNone == internalError)? aResult : KErrAvrcpAirInternalError; - - DoAllAttributesCompleted(aResult); - } - -inline TBool CRemConMediaBrowseTargetBase::DatabaseAware() const - { - return iRcdanpbo ? ETrue : EFalse; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediabrowseapi/src/remconmediabrowseutils.cpp --- a/bluetoothappprofiles/avrcp/mediabrowseapi/src/remconmediabrowseutils.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include -#include "remconmediabrowsefault.h" - -void MediaBrowsePanic::Panic(TRemConMediaBrowsePanic aPanic) - { - User::Panic(KMediaBrowsePanicName, aPanic); - } - -void MediaBrowseFault::Fault(TRemConMediaBrowseFault aFault) - { - User::Panic(KMediaBrowseFaultName, aFault); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediainformationapi/bwins/remconmediainformationapiu.def --- a/bluetoothappprofiles/avrcp/mediainformationapi/bwins/remconmediainformationapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - ??1CRemConMediaInformationTarget@@UAE@XZ @ 1 NONAME ; CRemConMediaInformationTarget::~CRemConMediaInformationTarget(void) - ?AttributeValue@CRemConMediaInformationTarget@@QAEHW4TMediaAttributeId@@AAVTDesC8@@@Z @ 2 NONAME ; void CRemConMediaInformationTarget::AttributeValue(enum TMediaAttributeID, class TDesC8 &) - ?Completed@CRemConMediaInformationTarget@@QAEXXZ @ 3 NONAME ; void CRemConMediaInformationTarget::Completed(void) - ?NewL@CRemConMediaInformationTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConMediaInformationTargetObserver@@@Z @ 4 NONAME ; class CRemConMediaInformationTarget * CRemConMediaInformationTarget::NewL(class CRemConInterfaceSelector &, class MRemConMediaInformationTargetObserver &) - ?Next@TMediaAttributeIter@@QAEHAAW4TMediaAttributeId@@@Z @ 5 NONAME - ?Start@TMediaAttributeIter@@QAEXXZ @ 6 NONAME - ??0TMediaAttributeIter@@QAE@AAV?$RArray@W4TMediaAttributeId@@@@@Z @ 7 NONAME ; TMediaAttributeIter::TMediaAttributeIter(class RArray &) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediainformationapi/eabi/remconmediainformationapiu.def --- a/bluetoothappprofiles/avrcp/mediainformationapi/eabi/remconmediainformationapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -EXPORTS - _ZN19TMediaAttributeIter4NextER17TMediaAttributeId @ 1 NONAME - _ZN19TMediaAttributeIter5StartEv @ 2 NONAME - _ZN29CRemConMediaInformationTarget4NewLER24CRemConInterfaceSelectorR37MRemConMediaInformationTargetObserver @ 3 NONAME - _ZN29CRemConMediaInformationTargetD0Ev @ 4 NONAME - _ZN29CRemConMediaInformationTargetD1Ev @ 5 NONAME - _ZN29CRemConMediaInformationTargetD2Ev @ 6 NONAME - _ZN29CRemConMediaInformationTarget14AttributeValueE17TMediaAttributeIdR6TDesC8 @ 7 NONAME - _ZN29CRemConMediaInformationTarget9CompletedEv @ 8 NONAME - _ZN19TMediaAttributeIterC1ER6RArrayI17TMediaAttributeIdE @ 9 NONAME - _ZN19TMediaAttributeIterC2ER6RArrayI17TMediaAttributeIdE @ 10 NONAME - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediainformationapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/mediainformationapi/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remconmediainformationapi.mmp - -PRJ_EXPORTS -../public/remconmediainformationtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediainformationtarget.h) -../public/remconmediainformationtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediainformationtargetobserver.h) -../public/remconmediaattributeid.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconmediaattributeid.h) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediainformationapi/group/remconmediainformationapi.mmp --- a/bluetoothappprofiles/avrcp/mediainformationapi/group/remconmediainformationapi.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -// Copyright (c) 2004-2009 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: -// remconmediainformationapi.dll Remote Control Media Information API - an outer-layer client side library. -// -// - -/** - @file - @internalComponent -*/ - -TARGET remconmediainformationapi.dll -TARGETPATH /system/libs - -// We need all these caps because we don't know anything about the process -// we'll be running in. -CAPABILITY All -Tcb -TARGETTYPE dll - -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x101f9067 -VENDORID 0x70000001 - -SOURCEPATH ../src -SOURCE mediainformationapi.cpp - -MW_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE ../../common - -LIBRARY euser.lib -LIBRARY remconinterfacebase.lib -LIBRARY avrcpipc.lib -LIBRARY estor.lib - -#include - -UNPAGED - -SMPSAFE diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediainformationapi/public/remconmediaattributeid.h --- a/bluetoothappprofiles/avrcp/mediainformationapi/public/remconmediaattributeid.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONMEDIAATTRIBUTEID_H_ -#define REMCONMEDIAATTRIBUTEID_H_ - -#include - -const TInt KMediaAttributeNum = 7; -enum TMediaAttributeId - { - ETitleOfMedia =0x1, - ENameOfArtist =0x2, - ENameOfAlbum =0x3, - ETrackNumber =0x4, /* for example the CD track number */ - ENumberOfTracks =0x5, /* for example the total track number of the CD */ - EGenre =0x6, - EPlayingTime =0x7 - }; - -/** - * Provide an iterator wrapper class - */ -class TMediaAttributeIter - { -public: - /** - @internalTechnology - */ - IMPORT_C TMediaAttributeIter(RArray& aMediaAttributeIDs); - IMPORT_C void Start(); - IMPORT_C TBool Next(TMediaAttributeId& aId); - -private: - RArray& iMediaAttributeIDs; - TInt iterator; - }; - -#endif /*REMCONMEDIAATTRIBUTEID_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediainformationapi/public/remconmediainformationtarget.h --- a/bluetoothappprofiles/avrcp/mediainformationapi/public/remconmediainformationtarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONMEDIAINFORMATIONTARGET_H -#define REMCONMEDIAINFORMATIONTARGET_H - -#include -#include -#include -#include - -class CRemConInterfaceSelector; -class RRemConGetElementAttributesResponse; - -NONSHARABLE_CLASS(CRemConMediaInformationQueuedMessage): public CBase - { -public: - static CRemConMediaInformationQueuedMessage* NewL(const TDesC8& aData); - ~CRemConMediaInformationQueuedMessage(); - - const TDesC8& Data(); -private: - CRemConMediaInformationQueuedMessage(); - void ConstructL(const TDesC8& aData); -public: - TSglQueLink iLink; -private: - RBuf8 iData; - }; - -/** -Client-instantiable type supporting sending media information. -*/ -NONSHARABLE_CLASS(CRemConMediaInformationTarget) : public CRemConInterfaceBase, - public MRemConInterfaceIf - { -public: - - /** - Factory function. - @param aInterfaceSelector The interface selector. The client must have - created one of these first. - @param aObserver The observer of this interface. - @return A new CRemConMediaInformationTarget, owned by the interface selector. - */ - IMPORT_C static CRemConMediaInformationTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConMediaInformationTargetObserver& aObserver); - - /** Destructor */ - IMPORT_C ~CRemConMediaInformationTarget(); - -public: - /** Called by the client in response to a MrcmitoGetCurrentlyPlayingMetadata() call. - Each call provides one of the attribute values requested. - This is repeatedly called until all attributes requested have been supplied and then followed by Completed(). - @param aAttribute The ID of the attribute supplied. - @param aValue A reference to a descriptor containing the attribute data. - This must be valid until Completed() has been called. - @see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata() - @see CRemConMediaInformationTarget::Completed() - */ - IMPORT_C TInt AttributeValue( TMediaAttributeId aAttributeId, TDesC8& aAttributeData); - - /** Signal that all attributes requested by MrcmitoGetCurrentlyPlayingMetadata() have been supplied - using the AttributeValue() method. - @see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata() - @see CRemConMediaInformationTarget::AttributeValue() - */ - IMPORT_C void Completed(); - -private: - /** - Constructor. - @param aInterfaceSelector The interface selector. - @param aObserver The observer of this interface. - */ - CRemConMediaInformationTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConMediaInformationTargetObserver& aObserver); - - void ConstructL(); - -private: // from CRemConInterfaceBase - TAny* GetInterfaceIf(TUid aUid); - -private: // from MRemConInterfaceIf - void MrcibNewMessage(TUint aOperationId, const TDesC8& aData); - -private: // utility - void SendError(TInt aError); - void ProcessMessage(const TDesC8& aData); - - static int NextMessageCb(TAny* aThis); - void DoNextMessage(); -private: // unowned - MRemConMediaInformationTargetObserver& iObserver; - -private: // owned - RRemConGetElementAttributesResponse* iResponse; - - RArray iMediaAttributeIDs; - TMediaAttributeIter iAttributeIterator; - TBool iInProgress; - TSglQue iMsgQueue; - - CAsyncCallBack* iNextMessageCallBack; - }; - -#endif // REMCONMEDIAINFORMATIONTARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediainformationapi/public/remconmediainformationtargetobserver.h --- a/bluetoothappprofiles/avrcp/mediainformationapi/public/remconmediainformationtargetobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONMEDIAINFORMATIONTARGETOBSERVER_H -#define REMCONMEDIAINFORMATIONTARGETOBSERVER_H - -#include -#include - -/** -Clients must implement this interface in order to instantiate objects of type -CRemConMediaInformationTarget. This interface passes incoming commands from RemCon to -the client. -*/ -NONSHARABLE_CLASS(MRemConMediaInformationTargetObserver) - { -public: - - /** - For each element in aAttributeList for which the requested Metadata is available, - the client shall respond by calling CRemConMediaInformationTarget::AttributeValue(). - After all attributes have been supplied the client shall call CRemConMediaInformationTarget::Completed(). - @param aAttributeIter A CMediaAttributeIDs containing a list of TMediaAttributeIds requested by the controller - @see CRemConMediaInformationTarget::AttributeValue() - @see CRemConMediaInformationTarget::Completed() - */ - virtual void MrcmitoGetCurrentlyPlayingMetadata( TMediaAttributeIter& aAttributeIter ) = 0; - - }; - -#endif // REMCONMEDIAINFORMATIONTARGETOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/mediainformationapi/src/mediainformationapi.cpp --- a/bluetoothappprofiles/avrcp/mediainformationapi/src/mediainformationapi.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,371 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include -#include -#include -#include - -#include "mediainformation.h" - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_MEDIA_INFO); -#endif - -EXPORT_C CRemConMediaInformationTarget* CRemConMediaInformationTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConMediaInformationTargetObserver& aObserver) - { - LOG_STATIC_FUNC - - CRemConMediaInformationTarget* self = new(ELeave) CRemConMediaInformationTarget(aInterfaceSelector, aObserver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CRemConMediaInformationTarget::CRemConMediaInformationTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConMediaInformationTargetObserver& aObserver) -: CRemConInterfaceBase(TUid::Uid(KRemConMediaInformationApiUid), - KMaxLengthMediaInformationMsg, - aInterfaceSelector, - ERemConClientTypeTarget), - iObserver(aObserver), - iAttributeIterator(iMediaAttributeIDs), - iMsgQueue(_FOFF(CRemConMediaInformationQueuedMessage, iLink)) - { - } - -void CRemConMediaInformationTarget::ConstructL() - { - iResponse = new(ELeave)RRemConGetElementAttributesResponse(); - TCallBack cb(&NextMessageCb, this); - iNextMessageCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard); - BaseConstructL(); - } - - -/** Destructor. - -@publishedAll -@released -*/ -EXPORT_C CRemConMediaInformationTarget::~CRemConMediaInformationTarget() - { - iMediaAttributeIDs.Close(); - iResponse->Close(); - delete iResponse; - iNextMessageCallBack->Cancel(); - delete iNextMessageCallBack; - TSglQueIter iter(iMsgQueue); - CRemConMediaInformationQueuedMessage* msg; - iter.SetToFirst(); - while ((msg = iter++) != NULL) - { - iMsgQueue.Remove(*msg); - delete msg; - } - } - -/** Gets a pointer to a specific interface version. - -@return A pointer to the interface, NULL if not supported. -@internalComponent -@released -*/ -TAny* CRemConMediaInformationTarget::GetInterfaceIf(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf1) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -EXPORT_C TInt CRemConMediaInformationTarget::AttributeValue( TMediaAttributeId aAttributeId, TDesC8& aAttributeData ) - { - // check that the values supplied were requested - if ( KErrNotFound == iMediaAttributeIDs.Find( aAttributeId ) ) - { - return KErrNotFound; - } - - REAResponse resp; - resp.iAttributeId = aAttributeId; - resp.iCharset = KUtf8MibEnum; - resp.iStringLen = aAttributeData.Length(); - resp.iString = aAttributeData.Alloc(); - if (resp.iString == NULL) - { - return KErrNoMemory; - } - TInt status = iResponse->iAttributes.Append(resp); - if (status != KErrNone) - { - resp.Close(); // make sure heap string is de-allocated - } - return status; - } - -// from MRemConInterfaceIf -void CRemConMediaInformationTarget::SendError(TInt aError) - { - RBuf8 outBuf; - if (outBuf.Create(KAVCFrameMaxLength) != KErrNone) - { - // On OOM drop the message - return; - } - - TInt error = 0; - RAvrcpIPCError response; - response.iError = aError; - TRAP(error, response.WriteL(outBuf)); // Don't send error if OOM - if (error == KErrNone) - { - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConMediaInformationApiUid), - EGetElementAttributes, ERemConResponse, outBuf); - } - outBuf.Close(); - } - -// from MRemConInterfaceIf -void CRemConMediaInformationTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData ) - { - LOG1(_L("\taOperationId = 0x%02x"), aOperationId); - LOG1(_L("\taData.Length = %d"), aData.Length()); - - (void) aOperationId; // ignore warning about this variable being unused - - if (!iInProgress && iMsgQueue.IsEmpty()) - { - ProcessMessage(aData); - } - else - { - CRemConMediaInformationQueuedMessage* msg = NULL; - TRAPD(err, msg = CRemConMediaInformationQueuedMessage::NewL(aData)); - if (err == KErrNone) - { - iMsgQueue.AddLast(*msg); - } - } - } - -void CRemConMediaInformationTarget::ProcessMessage(const TDesC8& aData) - { - iInProgress = ETrue; - // Try to read the incoming request - TInt error = KErrNone; - RRemConGetElementAttributesRequest request; - TRAP(error, request.ReadL(aData)); - - // Couldn't parse the request; tell them it was invalid - if (error != KErrNone) - { - request.Close(); - return SendError(KErrAvrcpMetadataParameterNotFound); - } - - // Specification section 5.3.1 (page 49) says unique id - // must be 0x0. All other values are currently reserved - if (request.iElement != 0) - { - request.Close(); - return SendError(KErrAvrcpMetadataInvalidParameter); - } - - // this may have been used by a previous GetElementAttributes, so - iMediaAttributeIDs.Reset(); - - if (request.iNumberAttributes == 0) - { - // spec says this is a request for all attribs - // current spec has 7 specified (0x01 to 0x07) - for (TInt i = 1; i <= 7; i++) - { - if (iMediaAttributeIDs.Append((TMediaAttributeId)i) != KErrNone) - { - request.Close(); - return SendError(KErrAvrcpMetadataInternalError); - } - } - } - else - { - // No need to check request.iNumberAttributes == request.iAttributes.Count() - // as this must be correct or request.ReadL(aData) leaves - for (TInt i = 0; i < request.iNumberAttributes; i++) - { - TUint8 value = request.iAttributes[i]; - if (value > 0 && value <= KMaxMediaAttributeValue ) - { - if (iMediaAttributeIDs.Append((TMediaAttributeId)value) != KErrNone) - { - request.Close(); - return SendError(KErrAvrcpMetadataInternalError); - } - } - } - } - request.Close(); - - // check that some valid attribute ids have been found - if (iMediaAttributeIDs.Count()) - { - // if the client has not yet called Completed() on the last request - // clear the the attributes from the previous response - iResponse->Close(); - - // reset the interator to the start, as it may have been used before - iAttributeIterator.Start(); - - // call the client API to get the client value. - iObserver.MrcmitoGetCurrentlyPlayingMetadata(iAttributeIterator); - } - else - { - // no valid attribute ids found so return an error to bearer - SendError(KErrAvrcpMetadataParameterNotFound); - } - } - -// The client application has signaled that all attributes have been returned so -// response can now be sent -EXPORT_C void CRemConMediaInformationTarget::Completed() - { - if (!iInProgress) - { - return; - } - // Finalise response; update number of attributes returned - iResponse->iNumberAttributes = iResponse->iAttributes.Count(); - - //Check the bound of the number of attributes, zero is not permitted - if (iResponse->iNumberAttributes == 0) - { - return SendError(KErrAvrcpMetadataInternalError); - } - - // Allocate a buffer for the formatted message - RBuf8 messageBuffer; - if ( messageBuffer.Create(iResponse->Size()) != KErrNone ) - { - // On OOM drop the message - iResponse->Close(); - return; - } - - // send the result back to the CT - TInt error = KErrNone; - TRAP(error, iResponse->WriteL(messageBuffer)); - if (error == KErrNone) - { - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConMediaInformationApiUid), - EGetElementAttributes, ERemConResponse, messageBuffer); - } - - // Make sure attribute list is reset for next time - iResponse->Close(); - messageBuffer.Close(); - - iInProgress = EFalse; - if (!iMsgQueue.IsEmpty()) - { - iNextMessageCallBack->CallBack(); - } - - } - -int CRemConMediaInformationTarget::NextMessageCb(TAny* aThis) - { - static_cast(aThis)->DoNextMessage(); - return KErrNone; - } - -void CRemConMediaInformationTarget::DoNextMessage() - { - CRemConMediaInformationQueuedMessage* msg = iMsgQueue.First(); - iMsgQueue.Remove(*msg); - ProcessMessage(msg->Data()); - delete msg; - } - -EXPORT_C TMediaAttributeIter::TMediaAttributeIter(RArray& aMediaAttributeIDs) : - iMediaAttributeIDs(aMediaAttributeIDs), - iterator(0) - { - } - -EXPORT_C void TMediaAttributeIter::Start() - { - iterator = 0; - } - -EXPORT_C TBool TMediaAttributeIter::Next(TMediaAttributeId& aId) - { - TInt count = iMediaAttributeIDs.Count(); - if (iterator > count - 1) - { - return EFalse; - } - aId = iMediaAttributeIDs[iterator]; - iterator++; - return ETrue; - } - -CRemConMediaInformationQueuedMessage* CRemConMediaInformationQueuedMessage::NewL(const TDesC8& aData) - { - CRemConMediaInformationQueuedMessage* self = new (ELeave) CRemConMediaInformationQueuedMessage(); - CleanupStack::PushL(self); - self->ConstructL(aData); - CleanupStack::Pop(self); - return self; - } - -CRemConMediaInformationQueuedMessage::CRemConMediaInformationQueuedMessage() - { - - } - -void CRemConMediaInformationQueuedMessage::ConstructL(const TDesC8& aData) - { - iData.CreateL(aData); - } - -CRemConMediaInformationQueuedMessage::~CRemConMediaInformationQueuedMessage() - { - iData.Close(); - } - -const TDesC8& CRemConMediaInformationQueuedMessage::Data() - { - return iData; - } - - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/bwins/remconnowplayingapiu.def --- a/bluetoothappprofiles/avrcp/nowplayingapi/bwins/remconnowplayingapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - ??1CRemConNowPlayingTargetBase@@MAE@XZ @ 1 NONAME ; CRemConNowPlayingTargetBase::~CRemConNowPlayingTargetBase(void) - ?NowPlayingContentChanged@CRemConNowPlayingTargetBase@@QAEXXZ @ 2 NONAME ; void CRemConNowPlayingTargetBase::NowPlayingContentChanged(void) - ?NewL@CRemConDatabaseAwareNowPlayingTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConDatabaseAwareNowPlayingTargetObserver@@@Z @ 3 NONAME ; class CRemConDatabaseAwareNowPlayingTarget * CRemConDatabaseAwareNowPlayingTarget::NewL(class CRemConInterfaceSelector &, class MRemConDatabaseAwareNowPlayingTargetObserver &) - ?AddToNowPlayingResponse@CRemConNowPlayingTargetBase@@QAEXH@Z @ 4 NONAME ; void CRemConNowPlayingTargetBase::AddToNowPlayingResponse(int) - ?NewL@CRemConDatabaseUnawareNowPlayingTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAVMRemConDatabaseUnawareNowPlayingTargetObserver@@@Z @ 5 NONAME ; class CRemConDatabaseUnawareNowPlayingTarget * CRemConDatabaseUnawareNowPlayingTarget::NewL(class CRemConInterfaceSelector &, class MRemConDatabaseUnawareNowPlayingTargetObserver &) - ?PlayItemResponse@CRemConNowPlayingTargetBase@@QAEXH@Z @ 6 NONAME ; void CRemConNowPlayingTargetBase::PlayItemResponse(int) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/eabi/remconnowplayingapiu.def --- a/bluetoothappprofiles/avrcp/nowplayingapi/eabi/remconnowplayingapiu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -EXPORTS - _ZN27CRemConNowPlayingTargetBase16PlayItemResponseEi @ 1 NONAME - _ZN27CRemConNowPlayingTargetBase23AddToNowPlayingResponseEi @ 2 NONAME - _ZN27CRemConNowPlayingTargetBase24NowPlayingContentChangedEv @ 3 NONAME - _ZN27CRemConNowPlayingTargetBaseD0Ev @ 4 NONAME - _ZN27CRemConNowPlayingTargetBaseD1Ev @ 5 NONAME - _ZN27CRemConNowPlayingTargetBaseD2Ev @ 6 NONAME - _ZN36CRemConDatabaseAwareNowPlayingTarget4NewLER24CRemConInterfaceSelectorR44MRemConDatabaseAwareNowPlayingTargetObserver @ 7 NONAME - _ZN38CRemConDatabaseUnawareNowPlayingTarget4NewLER24CRemConInterfaceSelectorR46MRemConDatabaseUnawareNowPlayingTargetObserver @ 8 NONAME - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/group/bld.inf --- a/bluetoothappprofiles/avrcp/nowplayingapi/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remconnowplayingapi.mmp - -PRJ_EXPORTS -../public/remcondatabaseawarenowplayingtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawarenowplayingtarget.h) -../public/remcondatabaseawarenowplayingtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseawarenowplayingtargetobserver.h) - -../public/remcondatabaseunawarenowplayingtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingtarget.h) -../public/remcondatabaseunawarenowplayingtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remcondatabaseunawarenowplayingtargetobserver.h) - -../public/remconnowplayingtargetbase.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(remcon/remconnowplayingtargetbase.h) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/group/remconnowplayingapi.mmp --- a/bluetoothappprofiles/avrcp/nowplayingapi/group/remconnowplayingapi.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -// Copyright (c) 2008-2009 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: -// remconmediainformationapi.dll Remote Control Media Information API - an outer-layer client side library. -// - - - -/** - @file - @internalComponent -*/ - -TARGET remconnowplayingapi.dll -TARGETPATH /system/libs - -// We need all these caps because we don't know anything about the process -// we'll be running in. -CAPABILITY All -Tcb -TARGETTYPE dll - -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x10285bbc -VENDORID 0x70000001 - -SOURCEPATH ../src -SOURCE remconnowplayingtargetbase.cpp -SOURCE remcondatabaseawarenowplayingtarget.cpp -SOURCE remcondatabaseunawarenowplayingtarget.cpp -SOURCE remconnowplayingutils.cpp - -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -USERINCLUDE ../inc -USERINCLUDE ../../common - -LIBRARY euser.lib -LIBRARY remconinterfacebase.lib -LIBRARY avrcpipc.lib -LIBRARY remconmediainformationapi.lib -LIBRARY remconmediabrowseapi.lib -LIBRARY estor.lib - -#include -#include - -UNPAGED - -SMPSAFE - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/inc/remconnowplayingfault.h --- a/bluetoothappprofiles/avrcp/nowplayingapi/inc/remconnowplayingfault.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#ifndef REMCONNOWPLAYINGFAULT_H_ -#define REMCONNOWPLAYINGFAULT_H_ - -#include - -_LIT(KNowPlayingFaultName, "RcNpFault"); - -enum TRemConNowPlayingFault - { - EInvalidEventId = 0, - }; - -class NowPlayingFault - { -public: - static void Fault(TRemConNowPlayingFault aFault); - }; - -#endif /*REMCONNOWPLAYINGFAULT_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/public/remcondatabaseawarenowplayingtarget.h --- a/bluetoothappprofiles/avrcp/nowplayingapi/public/remcondatabaseawarenowplayingtarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEAWARENOWPLAYINGTARGET_H -#define REMCONDATABASEAWARENOWPLAYINGTARGET_H - - -#include -#include - -class CRemConInterfaceSelector; - -NONSHARABLE_CLASS(CRemConDatabaseAwareNowPlayingTarget) : public CRemConNowPlayingTargetBase - { -public: - IMPORT_C static CRemConDatabaseAwareNowPlayingTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareNowPlayingTargetObserver& aObserver); - virtual ~CRemConDatabaseAwareNowPlayingTarget(); - - -private: - CRemConDatabaseAwareNowPlayingTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareNowPlayingTargetObserver& aObserver); - void ConstructL(); - }; - -#endif //REMCONDATABASEAWARENOWPLAYINGTARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/public/remcondatabaseawarenowplayingtargetobserver.h --- a/bluetoothappprofiles/avrcp/nowplayingapi/public/remcondatabaseawarenowplayingtargetobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEAWARENOWPLAYINGTARGETOBSERVER_H -#define REMCONDATABASEAWARENOWPLAYINGTARGETOBSERVER_H - -#include - -/** -It is intended for the client which is database aware. -Clients must implement this interface in order to instantiate objects of type -CRemConDatabaseAwareNowPlayingTarget. This interface passes incoming commands -from RemCon to the client. - -@see CRemConDatabaseAwareNowPlayingTarget -*/ -NONSHARABLE_CLASS(MRemConDatabaseAwareNowPlayingTargetObserver) - { -public: - /** - Requests to play an item. - - @param aItem The item requested to play. - - If it does not refer to any valid item, the client must call - CRemConNowPlayingTargetBase::PlayItemResponse() - with the error KErrInvalidUid; - - If it refers to a directory which can not be handled by this media - player, the client must call - CRemConNowPlayingTargetBase::PlayItemResponse() - with the error KErrNowPlayingUidIsADirectory; - - If it is in use and can not be played, the client must call - CRemConNowPlayingTargetBase::PlayItemResponse() - with the error KErrNowPlayingMediaInUse; - - @param aScope The scope in which the item was requested to play. - - @param aMediaLibraryStateCookie The cookie which the remote device - believes refers to the current state of the media library. If this - does not match the current state according to the client then the - client must call - CRemConNowPlayingTargetBase::PlayItemResponse() - with the error KErrInvalidMediaLibraryStateCookie. - - @see CRemConNowPlayingTargetBase::PlayItemResponse(). - */ - virtual void MrcdanptoPlayItem(const TRemConItemUid& aItem, - TRemConFolderScope aScope, - TUint16 aMediaLibraryStateCookie) = 0; - - /** - Requests to add an item to now playing list. - - @param aItem The item requested to play. - - If it does not refer to any valid item, the client must call - CRemConNowPlayingTargetBase::AddToNowPlayingResponse() - with the error KErrInvalidUid; - - If it refers to a directory which can not be handled by this media - player, the client must call - CRemConNowPlayingTargetBase::AddToNowPlayingResponse() - with the error KErrNowPlayingUidIsADirectory; - - If it is in use and can not be added to now playing list, the - client must call - CRemConNowPlayingTargetBase::AddToNowPlayingResponse() - with the error KErrNowPlayingMediaInUse; - - @param aScope The scope in which the item was requested to play. - - @param aMediaLibraryStateCookie The cookie which the remote device - believes refers to the current state of the media library. If this - does not match the current state according to the client then the - client must call - CRemConNowPlayingTargetBase::PlayItemResponse() - with the error KErrInvalidMediaLibraryStateCookie. - - @see CRemConNowPlayingTargetBase::AddToNowPlayingResponse(). - */ - virtual void MrcdanptoAddToNowPlaying(const TRemConItemUid& aItem, - TRemConFolderScope aScope, - TUint16 aMediaLibraryStateCookie) = 0; - }; - - -#endif //REMCONDATABASEAWARENOWPLAYINGTARGETOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/public/remcondatabaseunawarenowplayingtarget.h --- a/bluetoothappprofiles/avrcp/nowplayingapi/public/remcondatabaseunawarenowplayingtarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEUNAWARENOWPLAYINGTARGET_H -#define REMCONDATABASEUNAWARENOWPLAYINGTARGET_H - -#include -#include - -class CRemConInterfaceSelector; - -NONSHARABLE_CLASS(CRemConDatabaseUnawareNowPlayingTarget) : public CRemConNowPlayingTargetBase - { -public: - IMPORT_C static CRemConDatabaseUnawareNowPlayingTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver); - virtual ~CRemConDatabaseUnawareNowPlayingTarget(); - - -private: - CRemConDatabaseUnawareNowPlayingTarget(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver); - void ConstructL(); - }; - -#endif //REMCONDATABASEUNAWARENOWPLAYINGTARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/public/remcondatabaseunawarenowplayingtargetobserver.h --- a/bluetoothappprofiles/avrcp/nowplayingapi/public/remcondatabaseunawarenowplayingtargetobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONDATABASEUNAWARENOWPLAYINGTARGETOBSERVER_H -#define REMCONDATABASEUNAWARENOWPLAYINGTARGETOBSERVER_H - -#include - -/** -It is intended for the client which is database aware. -Clients must implement this interface in order to instantiate objects of type -CRemConDatabaseUnawareNowPlayingTarget. This interface passes incoming -commands from RemCon to the client. - -@see CRemConDatabaseUnawareNowPlayingTarget -*/ -NONSHARABLE_CLASS(MRemConDatabaseUnawareNowPlayingTargetObserver) - { -public: - /** - Requests to play an item. - - @param aItem The item requested to play. - - If it does not refer to any valid item, the client must call - CRemConNowPlayingTargetBase::PlayItemResponse() with the error - KErrInvalidUid; - - If it refers to a directory which can not be handled by this media - player, the client must call - CRemConNowPlayingTargetBase::PlayItemResponse() - with the error KErrNowPlayingUidIsADirectory; - - If it is in use and can not be played, the client must call - CRemConNowPlayingTargetBase::PlayItemResponse() - with the error KErrNowPlayingMediaInUse; - - @param aScope The scope in which the item was requested to play. - - @see CRemConNowPlayingTargetBase::PlayItemResponse(). - */ - virtual void MrcdunptoPlayItem(const TRemConItemUid& aItem, - TRemConFolderScope aScope) = 0; - - /** - Requests to add an item to now playing list. - - @param aItem The item requested to play. - - If it does not refer to any valid item, the client must call - CRemConNowPlayingTargetBase::AddToNowPlayingResponse() - with the error KErrInvalidUid; - - If it refers to a directory which can not be handled by this media - player, the client must call - CRemConNowPlayingTargetBase::AddToNowPlayingResponse() - with the error KErrNowPlayingUidIsADirectory; - - If it is in use and can not be added to now playing list, the - client must call - CRemConNowPlayingTargetBase::AddToNowPlayingResponse() - with the error KErrNowPlayingMediaInUse; - - @param aScope The scope in which the item was requested to play. - - @see CRemConNowPlayingTargetBase::AddToNowPlayingResponse(). - */ - virtual void MrcdunptoAddToNowPlaying(const TRemConItemUid& aItem, - TRemConFolderScope aScope) = 0; - }; - -#endif //REMCONDATABASEUNAWARENOWPLAYINGTARGETOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/public/remconnowplayingtargetbase.h --- a/bluetoothappprofiles/avrcp/nowplayingapi/public/remconnowplayingtargetbase.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONNOWPLAYINGTARGETBASE_H -#define REMCONNOWPLAYINGTARGETBASE_H - -#include -#include -#include -#include - -class CRemConInterfaceSelector; -class MRemConDatabaseAwareNowPlayingTargetObserver; -class MRemConDatabaseUnawareNowPlayingTargetObserver; -class TRemConMessageQueue; - -/** -A parent class for CRemConDatabaseAwareNowPlayingTarget and -CRemConDatabaseUnawareNowPlayingTarget. - -This class is not intended for instantiation. Clients should instead use the -appropriate derived class - either CRemConDatabaseAwareNowPlayingTarget or -CRemConDatabaseUnawareNowPlayingTarget. - -This class is only to be used by classes currently derived from it. - -@see CRemConDatabaseAwareNowPlayingTarget -@see CRemConDatabaseUnawareNowPlayingTarget -*/ -NONSHARABLE_CLASS(CRemConNowPlayingTargetBase) : public CRemConInterfaceBase, - public MRemConInterfaceIf2 - { -public: - IMPORT_C void PlayItemResponse(TInt aErr); - IMPORT_C void AddToNowPlayingResponse(TInt aErr); - IMPORT_C void NowPlayingContentChanged(); - -protected: - IMPORT_C virtual ~CRemConNowPlayingTargetBase(); - - CRemConNowPlayingTargetBase(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareNowPlayingTargetObserver& aObserver); - - CRemConNowPlayingTargetBase(CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver); - - virtual void BaseConstructL(); - -private: //From CRemConInterfaceBase - TAny* GetInterfaceIf(TUid aUid); - -private: //From MRemConInterfaceIf2 - void MrcibNewMessage(TUint aOperationId, - const TDesC8& aData, - TRemConMessageSubType aMsgSubType); - -private: //Utility functions - void SendResponse(TUint8 aStatus, TUint aOperationId); - void SendError(TInt aError, TUint aOperationId); - void SendNotificationResponse(TRemConMessageSubType aMsgSubType); - - void ProcessGetStatus(); - void ProcessGetStatusAndBeginObserving(); - void ProcessPlayItem(const TDesC8& aData); - void ProcessAddToNowPlaying(const TDesC8& aData); - - TBool ProcessNowPlaying(const TDesC8& aData, - TUint aOperationId, - TUint64& aItem, - TRemConFolderScope& aScope, - TUint16& aMediaLibraryStateCookie); - - static TInt NextMessageCb(TAny* aThis); - void DoNextMessage(); - void AddToOperationQueue(TInt aOperationId, const TDesC8& aData); - -private: //Unowned - MRemConDatabaseAwareNowPlayingTargetObserver* iDaObserver; - MRemConDatabaseUnawareNowPlayingTargetObserver* iDuObserver; - CRemConInterfaceSelector& iInterfaceSelector; - -private: //Owned - TBool iNotificationPending; - RBuf8 iOutBuf; - - TBool iInProgress; - TRemConMessageQueue* iMsgQueue; - CAsyncCallBack* iNextMessageCallBack; - }; - -#endif //REMCONNOWPLAYINGTARGETBASE_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/src/remcondatabaseawarenowplayingtarget.cpp --- a/bluetoothappprofiles/avrcp/nowplayingapi/src/remcondatabaseawarenowplayingtarget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include - -EXPORT_C CRemConDatabaseAwareNowPlayingTarget* CRemConDatabaseAwareNowPlayingTarget::NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareNowPlayingTargetObserver& aObserver) - { - CRemConDatabaseAwareNowPlayingTarget* self = new(ELeave)CRemConDatabaseAwareNowPlayingTarget(aInterfaceSelector, aObserver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CRemConDatabaseAwareNowPlayingTarget::~CRemConDatabaseAwareNowPlayingTarget() - { - } - -CRemConDatabaseAwareNowPlayingTarget::CRemConDatabaseAwareNowPlayingTarget( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareNowPlayingTargetObserver& aObserver) - : CRemConNowPlayingTargetBase(aInterfaceSelector, aObserver) - { - } - -void CRemConDatabaseAwareNowPlayingTarget::ConstructL() - { - BaseConstructL(); - } - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/src/remcondatabaseunawarenowplayingtarget.cpp --- a/bluetoothappprofiles/avrcp/nowplayingapi/src/remcondatabaseunawarenowplayingtarget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @publishedAll - @released -*/ - -#include - -EXPORT_C CRemConDatabaseUnawareNowPlayingTarget* CRemConDatabaseUnawareNowPlayingTarget::NewL( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver) - { - CRemConDatabaseUnawareNowPlayingTarget* self = new(ELeave)CRemConDatabaseUnawareNowPlayingTarget(aInterfaceSelector, aObserver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CRemConDatabaseUnawareNowPlayingTarget::~CRemConDatabaseUnawareNowPlayingTarget() - { - } - -CRemConDatabaseUnawareNowPlayingTarget::CRemConDatabaseUnawareNowPlayingTarget( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver) - : CRemConNowPlayingTargetBase(aInterfaceSelector, aObserver) - { - } - -void CRemConDatabaseUnawareNowPlayingTarget::ConstructL() - { - BaseConstructL(); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/src/remconnowplayingtargetbase.cpp --- a/bluetoothappprofiles/avrcp/nowplayingapi/src/remconnowplayingtargetbase.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,472 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include "mediabrowse.h" -#include "nowplaying.h" -#include "remconnowplayingfault.h" -#include "remconqueuemessage.h" - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_REMCONNOWPLAYINGAPI); -_LIT8(KLogFormat, "Operation Id = 0x%x, Data Lengh = %d"); -#endif - -CRemConNowPlayingTargetBase::CRemConNowPlayingTargetBase( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseAwareNowPlayingTargetObserver& aObserver) - : CRemConInterfaceBase( - TUid::Uid(KRemConNowPlayingApiUid), - KMaxLengthNowPlayingMsg, - aInterfaceSelector, - ERemConClientTypeTarget), - iDaObserver(&aObserver), - iInterfaceSelector(aInterfaceSelector), - iInProgress(EFalse) - { - } - -CRemConNowPlayingTargetBase::CRemConNowPlayingTargetBase( - CRemConInterfaceSelector& aInterfaceSelector, - MRemConDatabaseUnawareNowPlayingTargetObserver& aObserver) - : CRemConInterfaceBase( - TUid::Uid(KRemConNowPlayingApiUid), - KMaxLengthNowPlayingMsg, - aInterfaceSelector, - ERemConClientTypeTarget), - iDuObserver(&aObserver), - iInterfaceSelector(aInterfaceSelector), - iInProgress(EFalse) - { - } - -void CRemConNowPlayingTargetBase::BaseConstructL() - { - iMsgQueue = new(ELeave)TRemConMessageQueue; - TCallBack cb(&NextMessageCb, this); - iNextMessageCallBack = new (ELeave) CAsyncCallBack(cb, - CActive::EPriorityStandard); - - iOutBuf.CreateL(KMaxLengthNowPlayingMsg); - - // Mandate the following features supported. - RRemConInterfaceFeatures features; - User::LeaveIfError(features.Open()); - CleanupClosePushL(features); - - features.AddOperationL(EPlayItem); - features.AddOperationL(EAddToNowPlaying); - features.AddOperationL(ERegisterNotification); - - CRemConInterfaceBase::BaseConstructL(features); - CleanupStack::PopAndDestroy(&features); - } - - -EXPORT_C CRemConNowPlayingTargetBase::~CRemConNowPlayingTargetBase() - { - iOutBuf.Close(); - - iNextMessageCallBack->Cancel(); - delete iNextMessageCallBack; - - iMsgQueue->Reset(); - delete iMsgQueue; - } - -/** -@internalComponent -@released - -Gets a pointer to a specific interface version. - -@return A pointer to the interface, NULL if not supported. -*/ -TAny* CRemConNowPlayingTargetBase::GetInterfaceIf(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf2) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -/** -Provide a response to the play item command. For database aware clients this -would have been called via MrcdanptoPlayItem(). For database unaware client -this would have been called via MrcdunptoPlayItem() - -The client must call NowPlayingContentChanged() if the content of the now -playing list has been changed after the client successfully plays the item -and provides the response with KErrNone through this function. - -@param aErr The result of play item operation. - - KErrNone if the operation was successful. - - KErrInvalidMediaLibraryStateCookie if the client is able to maintain - unique UIDs accross the entire virtual filesystem, but the media - library state cookie provided does not match the client's state cookie. - - KErrInvalidUid if the uid of the item provided does not refer to any - valid item. - - KErrNowPlayingUidIsADirectory if the uid of the item provided refers to - a directory which can not be handled by this media player. - - KErrNowPlayingMediaInUse if the item is in use and can not be played. - - System wide error code otherwise. - -@see NowPlayingContentChanged() -*/ -EXPORT_C void CRemConNowPlayingTargetBase::PlayItemResponse(TInt aErr) - { - TUint8 status = RAvrcpIPC::SymbianErrToStatus(aErr); - SendResponse(status, EPlayItem); - - iInProgress = EFalse; - if (!iMsgQueue->IsEmpty()) - { - iNextMessageCallBack->CallBack(); - } - } - -/** -Sends the response for the request MrcnptoAddToNowPlaying() - -The client must call NowPlayingContentChanged() if the content of the now -playing list has been changed after the client successfully adds the item -to the now playing list and provides the response with KErrNone through -this function. - -param aErr The result of add to now playing operation. - - KErrNone if the operation was successful. - - KErrInvalidMediaLibraryStateCookie if the client is able to maintain - unique UIDs accross the entire virtual filesystem, but the media - library state cookie provided does not match the client's state cookie. - - KErrInvalidUid if the uid of the item provided does not - refer to any valid item. - - KErrNowPlayingUidIsADirectory if the uid of the item provided refers to - a directory which can not be handled by this media player. - - KErrNowPlayingMediaInUse if the item is in use and can not be added to - now playing list. - - KErrNowPlayingListFull if the now playing list if full and no more items - can be added. - - System wide error code otherwise. - -@see NowPlayingContentChanged() -*/ -EXPORT_C void CRemConNowPlayingTargetBase::AddToNowPlayingResponse(TInt aErr) - { - TUint8 status = RAvrcpIPC::SymbianErrToStatus(aErr); - SendResponse(status, EAddToNowPlaying); - - iInProgress = EFalse; - if (!iMsgQueue->IsEmpty()) - { - iNextMessageCallBack->CallBack(); - } - } - -/** -Called by the client in the case that the now playing content changed. - -@see PlayItemResponse() -@see AddToNowPlayingResponse() -*/ -EXPORT_C void CRemConNowPlayingTargetBase::NowPlayingContentChanged() - { - if(iNotificationPending) - { - iNotificationPending = EFalse; - SendNotificationResponse(ERemConNotifyResponseChanged); - } - } - -void CRemConNowPlayingTargetBase::SendResponse(TUint8 aStatus, TUint aOperationId) - { - TInt error = KErrNone; - - // Formats the response in a RRemConNowPlayingResponse - RRemConNowPlayingResponse response; - response.iStatus = aStatus; - - TRAP(error, response.WriteL(iOutBuf)); - if (error == KErrNone) - { - // Send the response back to the CT - error = InterfaceSelector().SendUnreliable( - TUid::Uid(KRemConNowPlayingApiUid), - aOperationId, ERemConResponse, iOutBuf ); - } - - } - -void CRemConNowPlayingTargetBase::SendError(TInt aError, TUint aOperationId) - { - TInt error = KErrNone; - RAvrcpIPCError response; - response.iError = RAvrcpIPC::SymbianErrorCheck(aError); - TRAP(error, response.WriteL(iOutBuf)); - if (error == KErrNone) - { - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConNowPlayingApiUid), - aOperationId, ERemConResponse, iOutBuf); - } - } - -// From MRemConInterfaceIf2 -void CRemConNowPlayingTargetBase::MrcibNewMessage( - TUint aOperationId, - const TDesC8& aData, - TRemConMessageSubType aMsgSubType) - { - LOG_FUNC - LOG2(KLogFormat, aOperationId, aData.Length()); - - TMetadataTransferPDU currentOp = - RAvrcpIPC::GetPDUIdFromIPCOperationId(aOperationId); - switch(currentOp) - { - case EPlayItem: - if ( !iInProgress && - !iMsgQueue->Find(TUid::Uid(KRemConNowPlayingApiUid), EPlayItem)) - { - ProcessPlayItem(aData); - } - else - { - AddToOperationQueue(EPlayItem, aData); - } - break; - case EAddToNowPlaying: - if ( !iInProgress && - !iMsgQueue->Find(TUid::Uid(KRemConNowPlayingApiUid), EAddToNowPlaying)) - { - ProcessAddToNowPlaying(aData); - } - else - { - AddToOperationQueue(EAddToNowPlaying, aData); - } - break; - case ERegisterNotification: - { - // obtain eventId from aOperationId - TRegisterNotificationEvent eventId = - RAvrcpIPC::GetEventIdFromIPCOperationId(aOperationId); - - // If asserted here, must something wrong occured in the - // remconbearer handling - __ASSERT_DEBUG(eventId == ERegisterNotificationNowPlayingContentChanged - , NowPlayingFault::Fault(EInvalidEventId)); - - // register for Notifications - if (aMsgSubType == ERemConNotifyCommandAwaitingInterim) - { - ProcessGetStatusAndBeginObserving(); - } - else if (aMsgSubType == ERemConNotifyCommandAwaitingChanged) - { - ProcessGetStatus(); - } - break; - } - default: - break; - }; - } - -void CRemConNowPlayingTargetBase::ProcessPlayItem(const TDesC8& aData) - { - TUint64 item; - TRemConFolderScope scope; - TUint16 uidCounter; - - if (!ProcessNowPlaying(aData, EPlayItem, item, scope, uidCounter)) - { - return; - } - - iInProgress = ETrue; - if (iDaObserver && (uidCounter > 0)) - { - iDaObserver->MrcdanptoPlayItem(item, scope, uidCounter); - } - else if (!iDaObserver && (0 == uidCounter)) - { - iDuObserver->MrcdunptoPlayItem(item, scope); - } - else - { - PlayItemResponse(KErrAvrcpAirInvalidParameter); - } - } - -void CRemConNowPlayingTargetBase::ProcessAddToNowPlaying(const TDesC8& aData) - { - TUint64 item; - TRemConFolderScope scope; - TUint16 uidCounter; - - if (!ProcessNowPlaying(aData, EAddToNowPlaying, item, scope, uidCounter)) - { - return; - } - - iInProgress = ETrue; - if (iDaObserver && (uidCounter > 0)) - { - iDaObserver->MrcdanptoAddToNowPlaying(item, scope, uidCounter); - } - else if (!iDaObserver && (0 == uidCounter)) - { - iDuObserver->MrcdunptoAddToNowPlaying(item, scope); - } - else - { - AddToNowPlayingResponse(KErrAvrcpAirInvalidParameter); - } - } - -TBool CRemConNowPlayingTargetBase::ProcessNowPlaying( - const TDesC8& aData, - TUint aOperationId, - TUint64& aItem, - TRemConFolderScope& aScope, - TUint16& aMediaLibraryStateCookie) - { - RRemConNowPlayingRequest request; - TRAPD(error, request.ReadL(aData)) - if (error != KErrNone) - { - // Nothing in packet - SendError(KErrAvrcpMetadataParameterNotFound, aOperationId); - return EFalse; - } - - aItem = request.iElement; - aScope = request.iScope; - aMediaLibraryStateCookie = request.iUidCounter; - - //Does not allow invalid scope - if ( aScope != EBrowseFolder - && aScope != ESearchResultFolder - && aScope != ENowPlayingFolder ) - { - SendError(KErrAvrcpAirInvalidScope, aOperationId); - return EFalse; - } - return ETrue; - } - -void CRemConNowPlayingTargetBase::ProcessGetStatusAndBeginObserving() - { - // and request another notification (if there is not one already pending) - // on the next state change - iNotificationPending = ETrue; - - // send the current status - SendNotificationResponse(ERemConNotifyResponseInterim); - } - -void CRemConNowPlayingTargetBase::ProcessGetStatus() - { - // send the current value - SendNotificationResponse(ERemConNotifyResponseChanged); - } - -void CRemConNowPlayingTargetBase::SendNotificationResponse( - TRemConMessageSubType aMsgSubType) - { - LOG_FUNC - - TInt error = KErrNone; - - // No extra data needed - RAvrcpIPCError response; - response.iError = KErrNone; - TRAP(error, response.WriteL(iOutBuf)); - - if (error == KErrNone) - { - // send the response back to the CT - TUint operationId = - RAvrcpIPC::SetIPCOperationIdFromEventId( - ERegisterNotificationNowPlayingContentChanged); - - error = InterfaceSelector().SendUnreliable( - TUid::Uid(KRemConNowPlayingApiUid), - operationId, ERemConResponse, aMsgSubType, iOutBuf); - } - } - -TInt CRemConNowPlayingTargetBase::NextMessageCb(TAny* aThis) - { - static_cast(aThis)->DoNextMessage(); - return KErrNone; - } - -void CRemConNowPlayingTargetBase::DoNextMessage() - { - CRemConQueuedMessage* msg = iMsgQueue->First(); - iMsgQueue->Remove(*msg); - - switch (msg->iOperationId) - { - case EPlayItem: - ProcessPlayItem(msg->Data()); - break; - case EAddToNowPlaying: - ProcessAddToNowPlaying(msg->Data()); - break; - default: - // Never come here. - ASSERT(NULL); - break; - } - delete msg; - } - -void CRemConNowPlayingTargetBase::AddToOperationQueue(TInt aOperationId, - const TDesC8& aData) - { - CRemConQueuedMessage* msg = NULL; - TRAPD(err, msg = CRemConQueuedMessage::NewL( - TUid::Uid(KRemConNowPlayingApiUid), aData, aOperationId)); - if (err == KErrNone) - { - iMsgQueue->AddLast(*msg); - } - else - { - SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/nowplayingapi/src/remconnowplayingutils.cpp --- a/bluetoothappprofiles/avrcp/nowplayingapi/src/remconnowplayingutils.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include "remconnowplayingfault.h" - -void NowPlayingFault::Fault(TRemConNowPlayingFault aFault) - { - User::Panic(KNowPlayingFaultName, aFault); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/bwins/remconplayerinformationu.def --- a/bluetoothappprofiles/avrcp/playerinformation/bwins/remconplayerinformationu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -EXPORTS - ??1CPlayerApplicationSettings@@UAE@XZ @ 1 NONAME ABSENT ; CPlayerApplicationSettings::~CPlayerApplicationSettings(void) - ??1CPlayerInfoTarget@@UAE@XZ @ 2 NONAME ; CPlayerInfoTarget::~CPlayerInfoTarget(void) - ?AddCompanyId@MPlayerCapabilitiesObserver@@QAEHH@Z @ 3 NONAME ; int MPlayerCapabilitiesObserver::AddCompanyId(int) - ?AddEvent@MPlayerCapabilitiesObserver@@QAEHW4TRegisterNotificationEvent@@@Z @ 4 NONAME ; int MPlayerCapabilitiesObserver::AddEvent(enum TRegisterNotificationEvent) - ?ClearCompanyIds@MPlayerCapabilitiesObserver@@QAEXXZ @ 5 NONAME ; void MPlayerCapabilitiesObserver::ClearCompanyIds(void) - ?ClearEvents@MPlayerCapabilitiesObserver@@QAEXXZ @ 6 NONAME ; void MPlayerCapabilitiesObserver::ClearEvents(void) - ?DefineAttributeL@MPlayerApplicationSettingsObserver@@QAEXIAAVTDesC8@@AAV?$RArray@I@@AAV?$RArray@VTPtrC8@@@@I@Z @ 7 NONAME ; void MPlayerApplicationSettingsObserver::DefineAttributeL(unsigned int, class TDesC8 &, class RArray &, class RArray &, unsigned int) - ?DefineAttributesL@PlayerApplicationSettingsResourceInit@@SAXAAVMPlayerApplicationSettingsObserver@@AAVCResourceFile@@@Z @ 8 NONAME ; void PlayerApplicationSettingsResourceInit::DefineAttributesL(class MPlayerApplicationSettingsObserver &, class CResourceFile &) - ?NewL@CPlayerApplicationSettings@@SAPAV1@IAAVTDesC8@@V?$RArray@I@@AAV?$RArray@VTPtrC8@@@@I@Z @ 9 NONAME ABSENT ; class CPlayerApplicationSettings * CPlayerApplicationSettings::NewL(unsigned int, class TDesC8 &, class RArray, class RArray &, unsigned int) - ?NewL@CPlayerInfoTarget@@SAPAV1@AAVCRemConInterfaceSelector@@AAPAVMPlayerCapabilitiesObserver@@AAPAVMPlayerApplicationSettingsObserver@@AAPAVMPlayerEventsObserver@@AAVMPlayerApplicationSettingsNotify@@@Z @ 10 NONAME ; class CPlayerInfoTarget * CPlayerInfoTarget::NewL(class CRemConInterfaceSelector &, class MPlayerCapabilitiesObserver * &, class MPlayerApplicationSettingsObserver * &, class MPlayerEventsObserver * &, class MPlayerApplicationSettingsNotify &) - ?PlaybackStatusChanged@MPlayerEventsObserver@@QAEXW4TPlaybackStatus@1@@Z @ 11 NONAME ; void MPlayerEventsObserver::PlaybackStatusChanged(enum MPlayerEventsObserver::TPlaybackStatus) - ?RemoveCompanyID@MPlayerCapabilitiesObserver@@QAEHH@Z @ 12 NONAME ; int MPlayerCapabilitiesObserver::RemoveCompanyID(int) - ?RemoveEvent@MPlayerCapabilitiesObserver@@QAEHW4TRegisterNotificationEvent@@@Z @ 13 NONAME ; int MPlayerCapabilitiesObserver::RemoveEvent(enum TRegisterNotificationEvent) - ?SetAttributeL@MPlayerApplicationSettingsObserver@@QAEXII@Z @ 14 NONAME ; void MPlayerApplicationSettingsObserver::SetAttributeL(unsigned int, unsigned int) - ?SetBatteryStatus@MPlayerEventsObserver@@QAEXW4TTargetBatteryStatus@1@@Z @ 15 NONAME ; void MPlayerEventsObserver::SetBatteryStatus(enum MPlayerEventsObserver::TTargetBatteryStatus) - ?SetPlaybackPosition@MPlayerEventsObserver@@QAEXK@Z @ 16 NONAME ; void MPlayerEventsObserver::SetPlaybackPosition(unsigned long) - ?TrackChanged@MPlayerEventsObserver@@QAEX_KK@Z @ 17 NONAME ; void MPlayerEventsObserver::TrackChanged(unsigned long long, unsigned long) - ?TrackReachedEnd@MPlayerEventsObserver@@QAEXXZ @ 18 NONAME ; void MPlayerEventsObserver::TrackReachedEnd(void) - ?TrackReachedStart@MPlayerEventsObserver@@QAEXXZ @ 19 NONAME ; void MPlayerEventsObserver::TrackReachedStart(void) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/eabi/remconplayerinformationu.def --- a/bluetoothappprofiles/avrcp/playerinformation/eabi/remconplayerinformationu.def Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -EXPORTS - _ZN17CPlayerInfoTarget4NewLER24CRemConInterfaceSelectorRP27MPlayerCapabilitiesObserverRP34MPlayerApplicationSettingsObserverRP21MPlayerEventsObserverR32MPlayerApplicationSettingsNotify @ 1 NONAME - _ZN17CPlayerInfoTargetD0Ev @ 2 NONAME - _ZN17CPlayerInfoTargetD1Ev @ 3 NONAME - _ZN17CPlayerInfoTargetD2Ev @ 4 NONAME - _ZN21MPlayerEventsObserver12TrackChangedEym @ 5 NONAME - _ZN21MPlayerEventsObserver15TrackReachedEndEv @ 6 NONAME - _ZN21MPlayerEventsObserver16SetBatteryStatusENS_20TTargetBatteryStatusE @ 7 NONAME - _ZN21MPlayerEventsObserver17TrackReachedStartEv @ 8 NONAME - _ZN21MPlayerEventsObserver19SetPlaybackPositionEm @ 9 NONAME - _ZN21MPlayerEventsObserver21PlaybackStatusChangedENS_15TPlaybackStatusE @ 10 NONAME - _ZN27MPlayerCapabilitiesObserver11ClearEventsEv @ 11 NONAME - _ZN27MPlayerCapabilitiesObserver11RemoveEventE26TRegisterNotificationEvent @12 NONAME - _ZN27MPlayerCapabilitiesObserver12AddCompanyIdEi @ 13 NONAME - _ZN27MPlayerCapabilitiesObserver15ClearCompanyIdsEv @ 14 NONAME - _ZN27MPlayerCapabilitiesObserver15RemoveCompanyIDEi @ 15 NONAME - _ZN27MPlayerCapabilitiesObserver8AddEventE26TRegisterNotificationEvent @16 NONAME - _ZN34MPlayerApplicationSettingsObserver13SetAttributeLEjj @ 17 NONAME - _ZN34MPlayerApplicationSettingsObserver16DefineAttributeLEjR6TDesC8R6RArrayIjERS2_I6TPtrC8Ej @ 18 NONAME - _ZN37PlayerApplicationSettingsResourceInit17DefineAttributesLER34MPlayerApplicationSettingsObserverR13CResourceFile @ 19 NONAME - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/group/bld.inf --- a/bluetoothappprofiles/avrcp/playerinformation/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remconplayerinformation.mmp - -PRJ_EXPORTS -../public/playerinformationtarget.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(playerinformationtarget.h) -../public/playerinformationtargetobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(playerinformationtargetobserver.h) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/group/remconplayerinformation.mmp --- a/bluetoothappprofiles/avrcp/playerinformation/group/remconplayerinformation.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -// Copyright (c) 2007-2009 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: -// remconcoreapi.dll Remote Control Core API- an outer-layer client -// side library. -// -// - -/** - @file - @internalComponent -*/ - -TARGET remconplayerinformation.dll -TARGETPATH /system/libs -// We need all these caps because we don't know anything about the process -// we'll be running in. -CAPABILITY All -Tcb -TARGETTYPE dll -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x101f9067 -VENDORID 0x70000001 - -SOURCEPATH ../src -SOURCE playerinformation.cpp -SOURCE settingsresource.cpp -SOURCE playersettings.cpp -SOURCE playercapabilities.cpp -SOURCE playerevents.cpp -SOURCE playerapplicationsetting.cpp -SOURCE eventsmask.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../common -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -LIBRARY bafl.lib -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY remconinterfacebase.lib -LIBRARY avrcpipc.lib -LIBRARY esock.lib - -SOURCEPATH ../resource -USERINCLUDE ../resource - -start resource avrcp-settings.rss -targetpath /bluetooth/avrcp/ -end - -#include - -UNPAGED - -SMPSAFE diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/inc/eventsmask.h --- a/bluetoothappprofiles/avrcp/playerinformation/inc/eventsmask.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalComponent - @released -*/ - -#ifndef EVENTSMASK_H -#define EVENTSMASK_H - -// INCLUDES -#include -#include - -/** -This class stores the supported events list in a bitmask. -The event ids are numbers from 0x01 to 0x09 (from specs). -A 1 in the 0xXX position means that the XX eventid event is supported, a 0 in -the same position means that it's not supported. - */ -NONSHARABLE_CLASS(TEventsMask) - { -public: - TEventsMask(); - void Reset(); - TBool Find(TRegisterNotificationEvent aEvent) const; - void Append(TRegisterNotificationEvent aEvent); - void Remove(TRegisterNotificationEvent aEvent); - void Begin(); - TBool Next(); - TRegisterNotificationEvent Get() const; -private: - TUint16 iMask; - TUint8 iNextSupportedEvent; - }; - -#endif // EVENTSMASK_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/inc/playereventsutils.h --- a/bluetoothappprofiles/avrcp/playerinformation/inc/playereventsutils.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -// Copyright (c) 2009 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: -// - -#ifndef PLAYEREVENTSUTILS_H -#define PLAYEREVENTSUTILS_H - -_LIT(KPlayerEventsPanicName, "PlayerEvents"); - -enum TPlayerEventsPanic - { - ETwoGetPlayStatusUpdatesQueued = 0, - EBadlyFormattedInternalData = 1, - }; - -class PlayerEventsUtils - { -public: - static void Panic(TPlayerEventsPanic aPanic); - }; - -/** Utility PlayerEvents panic function. - -@param aPanic The panic number. -*/ -void PlayerEventsUtils::Panic(TPlayerEventsPanic aPanic) - { - User::Panic(KPlayerEventsPanicName, aPanic); - } - -#endif // PLAYEREVENTSUTILS_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/inc/playersettingsutils.h --- a/bluetoothappprofiles/avrcp/playerinformation/inc/playersettingsutils.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -// Copyright (c) 2009 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: -// - -#ifndef PLAYERSETTTINGSUTILS_H -#define PLAYERSETTTINGSUTILS_H - -_LIT(KPlayerSettingsPanicName, "PlayerSettings"); - -enum TPlayerSettingsPanic - { - EPlayerSettingsFunnyLengthData = 0, - }; - -class PlayerSettingsUtils - { -public: - static void Panic(TPlayerSettingsPanic aPanic); // The macro is probably more useful so this can be removed - }; - -/** Utility PlayerSettings panic function. - -@param aPanic The panic number. -*/ -void PlayerSettingsUtils::Panic(TPlayerSettingsPanic aPanic) - { - User::Panic(KPlayerSettingsPanicName, aPanic); - } - -#endif //PLAYERSETTTINGSUTILS_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/public/playerinformationtarget.h --- a/bluetoothappprofiles/avrcp/playerinformation/public/playerinformationtarget.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONPLAYERINFORMATIONTARGET_H -#define REMCONPLAYERINFORMATIONTARGET_H - -#include -#include -#include - -#include -#include -#include -#include - -class CRemConInterfaceSelector; -class CPlayerApplicationSettings; -class TEventsMask; - -// This is the maximum length of the player application setting attribute and value strings -const TInt KMaxPlayerApplicationSettingsValue = 255 ; -// This is the minimum length of the player application setting attribute and value strings -const TInt KMinPlayerApplicationSettingsValue = 1 ; - -/** -Client-instantiable class supporting player information responses. -This is the container class for the three interface parts -*/ -NONSHARABLE_CLASS(CPlayerInfoTarget) : public CRemConInterfaceBase, - public MRemConInterfaceIf2, - private MPlayerCapabilitiesObserver, - private MPlayerApplicationSettingsObserver, - private MPlayerEventsObserver - - { -public: - /** - Factory function. - @param aInterfaceSelector The interface selector. The client must have - created one of these first. - @param aPlayerCapabilitiesObserver Returns a pointer to a MPlayerCapabilitiesObserver for this interface, owned by the CPlayerInfoTarget. - @param aPlayerApplicationSettingsObserver Returns a pointer to a MPlayerApplicationSettingsObserver for this interface, owned by the CPlayerInfoTarget - @param aPlayerEventsObserver Returns a pointer to a MPlayerEventsObserver for this interface, owned by the CPlayerInfoTarget - @return A new CPlayerInfoTarget, owned by the interface selector. - */ - IMPORT_C static CPlayerInfoTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, - MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver, - MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver, - MPlayerEventsObserver*& aPlayerEventsObserver, - MPlayerApplicationSettingsNotify& aApplicationSettingNotifier ); - - /** Destructor */ - IMPORT_C ~CPlayerInfoTarget(); - - - -private: - /** - Constructor. - @param aInterfaceSelector The interface selector. - */ - CPlayerInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, MPlayerApplicationSettingsNotify& aApplicationSettingNotifier ); - - void ConstructL(MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver, - MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver, - MPlayerEventsObserver*& aPlayerEventsObserver ); - -private: // from CRemConInterfaceBase - TAny* GetInterfaceIf(TUid aUid); - -private: // from MRemConInterfaceIf - void MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMsgSubType); - -private: - // Bearer attributes (settings) processing - void ProcessListPlayerApplicationAttributes( TInt aOperationId ); - void ProcessGetPlayerApplicationAttributeText( const TDesC8& aData, TInt aOperationId ); - void ProcessListPlayerApplicationValues( const TDesC8& aData, TInt aOperationId ); - void ProcessGetPlayerApplicationValueText( const TDesC8& aData, TInt aOperationId ); - void ProcessGetCurrentPlayerApplicationValue( const TDesC8& aData, TInt aOperationId ); - void ProcessSetPlayerApplicationValue( const TDesC8& aData, TInt aOperationId ); - - // Bearer attributes (settings) API implementation from MPlayerApplicationSettingsObserver - void DoDefineAttributeL(TUint aAttributeID, TDesC8& aAttributeText, RArray &aValues, RArray &aValueTexts, TUint aInitialValue); - void DoSetAttributeL(TUint aAttributeID, TUint aValue); - - // Notifier Events API implementation from MPlayerEventsObserver - void DoPlaybackStatusChanged(TPlaybackStatus aStatus); - void DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds); - void DoTrackReachedEnd(); - void DoTrackReachedStart(); - void DoSetPlaybackPosition(TUint32 aMilliseconds); - void DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus); - - // Notifier Events bearer processing - void ProcessGetPlayStatus(); - void ProcessGetStatusAndBeginObserving(TUint aOperationId, TRegisterNotificationEvent aEventId, const TDesC8& aData); - void ProcessGetStatus(TUint aOperationId, TRegisterNotificationEvent aEventId); - void SendNotificationResponse(TRegisterNotificationEvent aEventId, TRemConMessageSubType aMsgSubType); - void ProcessGetPlayStatusUpdate(const TDesC8& aData); - - // Capabilities API implementation from MPlayerCapabilitiesObserver - void DoClearEvents(); - TInt DoAddEvent(TRegisterNotificationEvent aEvent); - TInt DoRemoveEvent(TRegisterNotificationEvent aEvent); - void DoClearCompanyIds(); - TInt DoAddCompanyId(TInt aID); - TInt DoRemoveCompanyID(TInt aID); - - // Capabilities bearer processing - void ProcessGetCapabilities( const TDesC8& aData ); - - // Miscellaneous - TBool AttributeSettingExists(TUint anAttribute); - TBool IsValidAttributeValue(TUint anAttributeId, TUint aAttributeValue); - TBool AttributeValueCanBeSet(TUint anAttributeId, TUint aAttributeValue); - void SendError(TInt, TInt); - void SendError(TInt, TInt, TRemConMessageSubType aSubType); - CPlayerApplicationSettings* GetSetting(TUint anAttribute); - MPlayerEventsObserver::TTargetBatteryStatus DetectBatteryStatus(); - -private: // owned - RBuf8 iOutBuf; - - MPlayerApplicationSettingsNotify& iApplicationSettingNotifier; - - // data for MPlayerEventsObserver - TPlaybackStatus iPlayBackStatus; - TUint64 iTrackId; - TUint32 iLengthInMilliseconds; - TPlayPosition iTrackPosition; - - // The time interval (received as part if the RegisterNotification) - // in which the change in playback position will be notified - TUint32 iPlayBackIntervalInMilliseconds; - - TTargetBatteryStatus iBatteryStatus; - TUint32 iPlaybackPositionInMilliseconds; - TUint32 iLastNotifiedPlaybackPositionInMilliseconds; - - // data for MPlayerCapabilitiesObserver - TEventsMask* iSupportedNotificationEventList; - RArray iCompanyIdList; - - // list of events for which notifications have been request - RArray iPendingNotificationEventList; - - // Whether we've been asked for an update when the play status changes - TBool iPlaybackStatusUpdatePending; - - // Attribute (settings) data MPlayerApplicationSettingsObserver - RHashMap iPlayerApplicationSettings; - - }; - - -#endif // REMCONPLAYERINFORMATIONTARGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/public/playerinformationtargetobserver.h --- a/bluetoothappprofiles/avrcp/playerinformation/public/playerinformationtargetobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,298 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONPLAYERINFORMATIONTARGETOBSERVER_H -#define REMCONPLAYERINFORMATIONTARGETOBSERVER_H - -#include -#include -#include - - -/** -This class is used to define the capabilities of the current application, -and the implementation will generate AVRCP responses to the controller. -For the event part of the API, it is recommended to add all events which make -sense for the media player. In general, this will be everything except -ESystemStatusChanged. The company ID part of the API is only needed if -the media player needs to support vendor extensions other than bluetooth SIG. -The bluetooth SIG company ID is always included in responses to a COMPANY_ID request. -*/ -class MPlayerCapabilitiesObserver - { - public: - /** - Remove all notification events from the supported list - */ - IMPORT_C void ClearEvents(); - /** - Add a notification event to the supported list of events - The AVRCP 1.3 specification mandates that PlaybackStatusChanged - and TrackChanged events must be supported; KErrAlreadyExists will - be returned if AddEvent() is called with either of these events. - @param aEvent the event to add - @return KErrAlreadyExists if the event is already present. - KErrNotSupported if the event isn't supported by the implementation, e.g.. ESystemStatusChanged - */ - IMPORT_C TInt AddEvent(TRegisterNotificationEvent aEvent); - /** - Remove a notification event from the supported list of events - The AVRCP 1.3 specification mandates that PlaybackStatusChanged - and TrackChanged events must be supported; KErrNotSupported will - be returned if RemoveEvent() is called with either of these events. - @param aEvent the event to remove - @return KErrNone if this completes successfully, KErrNotFound if aID - was not in the list, or any other system wide error code. - */ - IMPORT_C TInt RemoveEvent(TRegisterNotificationEvent aEvent); - - const static TInt KMaxCompanyID = 0xFFFFFF; - const static TInt KMaxNrOfCompanyIDs = 255; - - /** - Remove all additional company IDs from the supported list - */ - IMPORT_C void ClearCompanyIds(); - /** - Add a company id to the supported list of company ids. - The AVRCP 1.3 specification mandates that the Bluetooth SIG vendor id - must be supported; KErrAlreadyExists will be returned if AddCompanyId() - is called with this company id. - @param aID the id to add - @return KErrNone if this completes successfully, - KErrAlreadyExists if aID is already present, - KErrOverflow if the maximum number of company ids are already listed, - or any other system wide error code. - */ - IMPORT_C TInt AddCompanyId(TInt aID); - /** - Remove a company id from the list of supported vendor extensions. - The Bluetooth SIG id can't be removed, as this must always be supported - @param aID the id to remove - @return KErrNone if this completes successfully, KErrNotFound if aID - was not in the list, or any other system wide error code. - */ - IMPORT_C TInt RemoveCompanyID(TInt aID); - - private: - virtual void DoClearEvents() = 0; - virtual TInt DoAddEvent(TRegisterNotificationEvent aEvent) = 0; - virtual TInt DoRemoveEvent(TRegisterNotificationEvent aEvent) = 0; - virtual void DoClearCompanyIds() = 0; - virtual TInt DoAddCompanyId(TInt aID) = 0; - virtual TInt DoRemoveCompanyID(TInt aID) = 0; - }; - -/** -This class is for supporting the player application settings PDUs in AVRCP1.3 -specification section 5.2. The RegisterNotification PDU for -EVENT_PLAYER_APPLICATION_SETTING_CHANGED is also supported through this API. - -The media player should first define all the attributes it supports, using -DefineAttributeL. When an attribute's value is changed by the media player, -it should call SetAttributeL to inform the controller. When the controller -changes a setting, the media player application receives a callback via the -MPlayerApplicationSettingsNotify interface -*/ -class MPlayerApplicationSettingsObserver - { - public: - /** - Define an attribute supported by this player. - It will be included in future responses to the following PDUs: - ListPlayerApplicationSettingAttributes, - ListPlayerApplicationSettingValues, - GetCurrentPlayerApplicationSettingValue, - GetPlayerApplicationSettingAttributeText, - GetPlayerApplicationSettingValueText, - @param aAttributeID The specification or player defined attribute - @param aAttributeText The UTF8 text name of the attribute(allowed text length is 1-255) - the API will take a copy - @param aValues The list of defined values - @param aValueTexts The UTF8 text for each defined value(allowed text length is 1-255) - The API will make copies. - @param aInitialValue The initial value for this attribute - @leave KErrNoMemory if memory could not be allocated to store the copies of aAttributeID and relative settings - @leave KErrNotSupported if attribute or value is out of specification defined range, - or aValueTexts is not equal length to aValues - */ - IMPORT_C void DefineAttributeL(TUint aAttributeID, - TDesC8& aAttributeText, - RArray &aValues, - RArray &aValueTexts, - TUint aInitialValue); - - /** - Set the current value of a previously defined attribute - This updates the cache and will cause completion of a - pending EVENT_PLAYER_APPLICATION_SETTING_CHANGED notification PDU - @param aAttributeID The specification or player defined attribute - @param aValue The current value - @leave KErrNotFound if the attribute is not defined, - KErrArgument if the value is not valid according to the definition - */ - IMPORT_C void SetAttributeL(TUint aAttributeID, TUint aValue); - - private: - virtual void DoDefineAttributeL(TUint aAttributeID, - TDesC8& aAttributeText, - RArray &aValues, - RArray &aValueTexts, - TUint aInitialValue) = 0; - virtual void DoSetAttributeL(TUint aAttributeID, TUint aValue) = 0; - - }; - -/** -This is a helper API allowing CPlayerApplicationSettings to be initialised -via a resource file. Using a resource file may help to provide localised text -for the attributes and values, according to current language setting of the phone. -*/ -class PlayerApplicationSettingsResourceInit - { - public: - /** - Defines multiple attributes supported by this player, which are listed in a resource file. - @param aSettings The CPlayerApplicationSettings object on which the attributes should be defined - @param aResource A fully constructed CResourceFile - @leave KErrNoMemory, or leave from CResourceFile functions - */ - IMPORT_C static void DefineAttributesL(MPlayerApplicationSettingsObserver& aSettings, CResourceFile &aResource); - }; - -/** -This class supports the notification PDUs in AVRCP1.3 specification section 5.4, -with the following exceptions: - EVENT_SYSTEM_STATUS_CHANGED is not supported, it is only for adaptors that plug into a media player - EVENT_PLAYER_APPLICATION_SETTING_CHANGED is supported through the CPlayerApplicationSettings API - -Events are pushed by the media player calling functions in this API, where they are -cached until the controller pulls them via a GetPlayStatus or RegisterNotification PDU -@see CPlayerApplicationSettings -*/ -class MPlayerEventsObserver - { - public: - enum TTargetBatteryStatus - { - ENormal = 0, - EWarning = 1, - ECritical = 2, - EExternal = 3, - EFullCharge = 4, - EUnknown = 5 - }; - - enum TPlaybackStatus - { - EStopped = 0, - EPlaying = 1, - EPaused = 2, - EFwdSeek = 3, - ERevSeek = 4, - EError = 0xFF - }; - - enum TPlayPosition - { - EStart = 0, - EMiddle = 1, - EEnd= 2, - }; - - static const TUint64 KNoTrackSelected = KMaxTUint64; - - static const TUint32 KPlaybackPositionUnknown = 0xFFFFFFFF; - - /** - Call this function whenever the playback status changes. - It will be used to complete pending EVENT_PLAYBACK_STATUS_CHANGED - and EVENT_PLAYBACK_POS_CHANGED notifications. - The value is used to generate the response to a GetPlayStatus PDU. - @param aStatus The specification defined playback status - */ - IMPORT_C void PlaybackStatusChanged(TPlaybackStatus aStatus); - /** - Call this function whenever the current media track is changed. - use KNoTrackSelected to indicate that there is no media selected. - This is the default value on construction. It will be used to - complete pending EVENT_TRACK_CHANGED and EVENT_PLAYBACK_POS_CHANGED notifications. - The values are used to generate the response to a GetPlayStatus PDU. - @param aTrackId A handle to the current track. - @param aLengthInMilliseconds The length of the current track. - */ - IMPORT_C void TrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds); - /** - Call this function whenever the current track reaches the end position, - e.g. due to playback or forward seek. It will be used to complete - pending EVENT_TRACK_REACHED_END and EVENT_PLAYBACK_POS_CHANGED notifications. - */ - IMPORT_C void TrackReachedEnd(); - /** - Call this function whenever the current track reaches the start position, - e.g. due to reverse seek (rewind). It will be used to complete pending - EVENT_TRACK_REACHED_START and EVENT_PLAYBACK_POS_CHANGED notifications. - */ - IMPORT_C void TrackReachedStart(); - /** - Call this function during playback or seek operations, to indicate the - current position within the track. It will be used to complete a pending - EVENT_PLAYBACK_POS_CHANGED notification. The value is used to generate the - response to a GetPlayStatus PDU. - @param aMilliseconds The current playback position. It is recommended to call - with a resolution <=1000ms to satisfy the 1s resolution of the notification - playback interval. - */ - IMPORT_C void SetPlaybackPosition(TUint32 aMilliseconds); - - /** - Call this function to report the current battery status - @param aBatteryStatus The current battery status. - */ - IMPORT_C void SetBatteryStatus(TTargetBatteryStatus aBatteryStatus); - - private: - virtual void DoPlaybackStatusChanged(TPlaybackStatus aStatus) = 0; - virtual void DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds) = 0; - virtual void DoTrackReachedEnd() = 0; - virtual void DoTrackReachedStart() = 0; - virtual void DoSetPlaybackPosition(TUint32 aMilliseconds) = 0; - virtual void DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus) = 0; - - - }; - -/** -Clients must implement this interface if they require callbacks -when the controller has changed the settings via a SetPASValue message -*/ -class MPlayerApplicationSettingsNotify - { - public: - /** - This is called when the controller has changed a setting - @param aAttributeID A list of attribute IDs whose value has changed. - @param aAttributeValue A list of new values for the attributes listed in aAttributeID. - */ - virtual void MpasnSetPlayerApplicationValueL(const RArray& aAttributeID, - const RArray& aAttributeValue)=0; - }; - - -#endif // REMCONPLAYERINFORMATIONTARGETOBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/resource/avrcp-settings.rls --- a/bluetoothappprofiles/avrcp/playerinformation/resource/avrcp-settings.rls Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -// Copyright (c) 2008-2009 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: -// @localize yes -// @description Text that will be displayed on the UI of a remote controller to duplicate -// the UI of the local media player. This text represents Equalizer Mode -// @uicontext notvisible -// -// - -rls_string8<255> STRING_EqualizerMode "Equalizer Mode" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Equalizer Mode Off -@uicontext notvisible -*/ -rls_string8<255> STRING_EqualizerOff "Off" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Equalizer Mode On -@uicontext notvisible -*/ -rls_string8<255> STRING_EqualizerOn "On" - - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Repeat Mode -@uicontext notvisible -*/ -rls_string8<255> STRING_RepeatMode "Repeat Mode" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Repeat Mode Off -@uicontext notvisible -*/ -rls_string8<255> STRING_RepeatOff "Off" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Single Track Repeat -@uicontext notvisible -*/ -rls_string8<255> STRING_RepeatSingle "Single Track Repeat" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents All Tracks Repeat -@uicontext notvisible -*/ -rls_string8<255> STRING_RepeatAll "All Tracks Repeat" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Group Repeat -@uicontext notvisible -*/ -rls_string8<255> STRING_RepeatGroup "Group Repeat" - - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Shuffle Mode -@uicontext notvisible -*/ -rls_string8<255> STRING_ShuffleMode "Shuffle Mode" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Shuffle Mode Off -@uicontext notvisible -*/ -rls_string8<255> STRING_ShuffleOff "Off" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents All Tracks Shuffle -@uicontext notvisible -*/ -rls_string8<255> STRING_ShuffleAll "All Tracks Shuffle" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Group Shuffle -@uicontext notvisible -*/ -rls_string8<255> STRING_ShuffleGroup "Group Shuffle" - - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Scan Mode -@uicontext notvisible -*/ -rls_string8<255> STRING_ScanMode "Scan Mode" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Scan Mode Off -@uicontext notvisible -*/ -rls_string8<255> STRING_ScanOff "Off" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents All Tracks Scan -@uicontext notvisible -*/ -rls_string8<255> STRING_ScanAll "All Tracks Scan" - -/*& -@localize yes -@description Text that will be displayed on the UI of a remote controller to duplicate -the UI of the local media player. This text represents Group Scan -@uicontext notvisible -*/ -rls_string8<255> STRING_ScanGroup "Group Scan" diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/resource/avrcp-settings.rss --- a/bluetoothappprofiles/avrcp/playerinformation/resource/avrcp-settings.rss Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -#include "settings.rh" -#include "avrcp-settings.rls" - -UID2 KUidAVRCPResourceFile - -// Test setting matching rules -RESOURCE SETTINGS avrcpsettings - { - settings = - { - SETTING - { // Equalizer mode - attribute = KEqualizerMode; - initialValue = KOff; - description = STRING_EqualizerMode; - definedValues = - { - VALUE - { - valueId = KOff; - description = STRING_EqualizerOff; - }, - VALUE - { - valueId = KOn; - description = STRING_EqualizerOn; - } - }; - }, - SETTING - { // Repeat mode - attribute = KRepeatMode; - initialValue = KAllTracksRepeat; - description = STRING_RepeatMode; - definedValues = - { - VALUE - { - valueId = KOff; - description = STRING_RepeatOff; - }, - VALUE - { - valueId = KSingleTrackRepeat; - description = STRING_RepeatSingle; - }, - VALUE - { - valueId = KAllTracksRepeat; - description = STRING_RepeatAll; - }, - VALUE - { - valueId = KGroupRepeat; - description = STRING_RepeatGroup; - } - }; - }, - SETTING - { // Shuffle mode - attribute = KShuffleMode; - initialValue = KAllTracksShuffle; - description = STRING_ShuffleMode; - definedValues = - { - VALUE - { - valueId = KOff; - description = STRING_ShuffleOff; - }, - VALUE - { - valueId = KAllTracksShuffle; - description = STRING_ShuffleAll; - }, - VALUE - { - valueId = KGroupShuffle; - description = STRING_ShuffleGroup; - } - }; - }, - SETTING - { // Scan mode - attribute = KScanMode; - initialValue = KAllTracksScan; - description = STRING_ScanMode; - definedValues = - { - VALUE - { - valueId = KOff; - description = STRING_ScanOff; - }, - VALUE - { - valueId = KAllTracksScan; - description = STRING_ScanAll; - }, - VALUE - { - valueId = KGroupScan; - description = STRING_ScanGroup; - } - }; - } - }; - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/resource/settings.rh --- a/bluetoothappprofiles/avrcp/playerinformation/resource/settings.rh Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -// Copyright (c) 2007-2009 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: -// Resource header for AVRCP resource files. -// -// - -/** - @file settings.rh - @publishedPartner - @released -*/ - -#ifndef SETTINGS_RH -#define SETTINGS_RH - -/** -This resource header file defines the structures and constants required -for the AVRCP Player Application Settings and Values, as defined in -Appendix F of the Bluetooth Specification (AVRCP), page 80. - -A setting file consists of an arbitrary number of settings. This file -will be parsed and used to set values for a media application at -startup time, to be queried through the AVRCP profile. - -A setting file has the following structure - -UID2 KUidAVRCPResourceFile // Identifies this as an AVRCP settings file - -RESOURCE SETTINGS mysettings - { - settings = - { - SETTING - { - // definition of setting 1 - }, - SETTING - { - // definition of setting 2 - }, - // etc - }; - } -*/ - -#define KUidAVRCPResourceFile 0x10285ACD - -#define KIllegal 0x00 -#define KEqualizerMode 0x01 -#define KRepeatMode 0x02 -#define KShuffleMode 0x03 -#define KScanMode 0x04 - -#define KOff 0x01 -#define KOn 0x02 - -// Off 0x01 -#define KSingleTrackRepeat 0x02 -#define KAllTracksRepeat 0x03 -#define KGroupRepeat 0x04 - -// Off 0x01 -#define KAllTracksShuffle 0x02 -#define KGroupShuffle 0x03 - -// Off 0x01 -#define KAllTracksScan 0x02 -#define KGroupScan 0x03 - -#define KUserDefined 0x80 - -// Defines a single setting -STRUCT SETTING - { - // The player application setting attribute - // e.g. 0x00 illegal, not to be used - // 0x01 equalizer status - // 0x02 repeat mode status - // 0x03 shuffle mode status - // 0x04 scan mode status - // 0x05 - 0x7f reserved for future use - // 0x80 - 0xff provided for TG driver static media player menu extension by CT - BYTE attribute = 0; - - // The defined settings for this attribute - BYTE initialValue = 0; - - // An string which describes this setting - // This can be localised into the target language - LTEXT8 description = ""; - - // The values and descriptions that this attribute can take - STRUCT definedValues[]; - } - -// Defines a single setting -STRUCT VALUE - { - // The setting value id in hex - BYTE valueId = 0; - - // An string which describes this value - // This can be localised into the target language - LTEXT8 description = ""; - } - -// Defines a set of settings and the implementations UIDs of the default -// setting evaluator and dialog creator plug-ins. -STRUCT SETTINGS - { - // Version of the AVRCP resource file. - // Settings files MUST NOT change this value. - // This must match with the number defined in settingsresource.cpp - WORD version = 1; - - // An array of SETTING structures - STRUCT settings[]; - } - -#endif diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/src/eventsmask.cpp --- a/bluetoothappprofiles/avrcp/playerinformation/src/eventsmask.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -/** - @file - @internalComponent - @released -*/ - -#include "eventsmask.h" - -#ifdef _DEBUG -_LIT(KEventsMask, "TEventsMask"); -#endif - -TEventsMask::TEventsMask () - { - Reset(); - } - -void TEventsMask::Reset() - { - iMask = 0x0000; - iNextSupportedEvent = 0x00; - } - -TBool TEventsMask::Find(TRegisterNotificationEvent aEvent) const - { - return ( (0x0001 << (aEvent -1)) & iMask ) ? ETrue : EFalse; - } - -void TEventsMask::Append(TRegisterNotificationEvent aEvent) - { - // the assertion assures that aEvent is a valid argument (in the range) - __ASSERT_DEBUG((aEvent >= ERegisterNotificationPlaybackStatusChanged) && - (aEvent < ERegisterNotificationReservedLast), - User::Panic(KEventsMask, KErrArgument)); - - iMask |= (0x0001 << (aEvent -1)); - } - -void TEventsMask::Remove(TRegisterNotificationEvent aEvent) - { - // the assertion assures that aEvent is a valid argument (in the range) - __ASSERT_DEBUG((aEvent >= ERegisterNotificationPlaybackStatusChanged) && - (aEvent < ERegisterNotificationReservedLast), - User::Panic(KEventsMask, KErrArgument)); - - iMask &= ~(0x0001 << (aEvent -1)); - } - -void TEventsMask::Begin() - { - iNextSupportedEvent = 0x00; - } - -TBool TEventsMask::Next() - { - TUint index = iNextSupportedEvent+1; - - if (index == ERegisterNotificationReservedLast) - { - return EFalse; - } - - while( (!Find((TRegisterNotificationEvent)index)) && (index < ERegisterNotificationReservedLast) ) - { - index++; - } - - if (index < ERegisterNotificationReservedLast) - { - iNextSupportedEvent = index; - return ETrue; - } - else - { - return EFalse; - } - } - -TRegisterNotificationEvent TEventsMask::Get() const - { - // if Get() is called before calling Begin() and at least one call to Next() - // it Panics because iNextSupportedEvent is invalid (equals to 0x00). - __ASSERT_DEBUG(iNextSupportedEvent >= ERegisterNotificationPlaybackStatusChanged, User::Panic(KEventsMask, KErrUnderflow)); - // this should never happen, it would mean that iNextSupport overtakes the - // last valid value - __ASSERT_DEBUG(iNextSupportedEvent < ERegisterNotificationReservedLast, User::Panic(KEventsMask, KErrOverflow)); - - return static_cast(iNextSupportedEvent); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/src/playerapplicationsetting.cpp --- a/bluetoothappprofiles/avrcp/playerinformation/src/playerapplicationsetting.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -// 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" -// 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: -// This file contains the CPlayerApplicationSettings class. -// This is used to contain the Player application Setting Attributes -// defined by the Bluetooth AVRCP 1.3 specification -// -// - -/** - @file - @internalComponent - @released -*/ - -#include - -#include "playerapplicationsetting.h" -#include "playerinformation.h" - -CPlayerApplicationSettings* CPlayerApplicationSettings::NewL( TUint aAttributeID, - TDesC8& aAttributeText, - const RArray& aValues, - RArray& aValueTexts, - TUint aInitialValue ) - { - CPlayerApplicationSettings* self = new(ELeave) CPlayerApplicationSettings(); - CleanupStack::PushL(self); - self->ConstructL( aAttributeID, aAttributeText, aValues, aValueTexts, aInitialValue); - CleanupStack::Pop(self); - return self; - } - - -CPlayerApplicationSettings::~CPlayerApplicationSettings() - { - delete iAttributeText; - iValues.Close(); - iValueText.ResetAndDestroy(); - } - -CPlayerApplicationSettings::CPlayerApplicationSettings( ) - { - } - -void CPlayerApplicationSettings::ConstructL(TUint aAttributeID, - TDesC8& aAttributeText, - const RArray& aValues, - RArray& aValueText, - TUint aInitialValue ) - { - iAttributeID = aAttributeID; - - // copy the attribute description - iAttributeText = aAttributeText.AllocL(); - - // copy the allowed values - for (TInt i=0; i < aValues.Count(); i++ ) - { - - // avoid duplicated defined values - if (iValues.Find(aValues[i]) != KErrNotFound) - { - User::Leave(KErrArgument); - } - - iValues.AppendL( aValues[i] ); - - // copy the value description into a HBuf and add pointer to iValueTexts - HBufC8 * valueText = aValueText[i].AllocL(); - CleanupStack::PushL(valueText); - iValueText.AppendL(valueText); - CleanupStack::Pop(valueText); - } - - TInt error = SetCurrentValue( aInitialValue ); - if ( error != KErrNone ) - { - User::Leave( error ); - } - } - -TUint CPlayerApplicationSettings::GetAttributeID() - { - return( iAttributeID ); - } - -TUint CPlayerApplicationSettings::GetCurrentValue() - { - return( iCurrentValue ); - } - -TPtrC8 CPlayerApplicationSettings::GetAttributeText() - { - return( *iAttributeText ); - } - -RArray* CPlayerApplicationSettings::GetValues() - { - return( &iValues ); - } - -RPointerArray* CPlayerApplicationSettings::GetValuesTexts() - { - return( &iValueText ); - } - -TInt CPlayerApplicationSettings::SetCurrentValue(TUint aValue) - { - // Only allow setting already defined values - for (TInt i=0; i < iValues.Count(); i++ ) - { - if ( aValue == iValues[i] ) - { - iCurrentValue = aValue; - return KErrNone; - } - } - - // value was not already defined, so return KErrArgument - return KErrArgument; - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/src/playerapplicationsetting.h --- a/bluetoothappprofiles/avrcp/playerinformation/src/playerapplicationsetting.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -// 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" -// 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: -// - -/** - @file - @internalComponent - @released -*/ - -#ifndef PLAYERAPPLICATIONSETTING_H -#define PLAYERAPPLICATIONSETTING_H - - -/** -Class containing all the information for one attribute. -All the attributes for a player are contained in a RHashMap -of CPlayerApplicationSettings in CPlayerInfoTarget -*/ -NONSHARABLE_CLASS(CPlayerApplicationSettings) : public CBase - { -public: - /** - Factory function. - @param aAttributeID The ID value - @param aAttributeText A text description of the attribute - @param aValues A list of valid values - @param aValueTexts A list of descriptions of the possible values - @param aInitialValue The starting value - @return A new CPlayerApplicationSettings - */ - static CPlayerApplicationSettings* NewL( TUint aAttributeID, - TDesC8& aAttributeText, - const RArray& aValues, - RArray& aValueTexts, - TUint aInitialValue ); - - /** Destructor */ - ~CPlayerApplicationSettings(); - - TUint GetAttributeID(); - TUint GetCurrentValue(); - TPtrC8 GetAttributeText(); - RArray* GetValues(); - RPointerArray* GetValuesTexts(); - TInt SetCurrentValue(TUint aValue); - -private: - /** - Constructor. - @param aInterfaceSelector The interface selector. - */ - CPlayerApplicationSettings( ); - - void ConstructL(TUint aAttributeID, - TDesC8& aAttributeText, - const RArray& aValues, - RArray& aValueText, - TUint aInitialValue ); - -private: - /* attribute ID */ - TUint iAttributeID; - - /* text description of the attribute */ - HBufC8* iAttributeText; - - /* array of allowed values */ - RArray iValues; - - /* array of text descriptions of allowed values */ - RPointerArray iValueText; - - /* the current value */ - TUint iCurrentValue; - }; - -#endif // PLAYERAPPLICATIONSETTING_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/src/playercapabilities.cpp --- a/bluetoothappprofiles/avrcp/playerinformation/src/playercapabilities.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +0,0 @@ -// Copyright (c) 2008-2009 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: -// This file contains the capabilites part of playerinformation. -// -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include -#include - -#include "eventsmask.h" -#include "playerinformation.h" - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_PLAYER_INFO); -#endif - -class TRemConMetadataTransferGetCapabilities - { -public: - TUint8 iCapabilityID; - }; - -EXPORT_C void MPlayerCapabilitiesObserver::ClearEvents() - { - DoClearEvents(); - } - -EXPORT_C TInt MPlayerCapabilitiesObserver::AddEvent(TRegisterNotificationEvent aEvent) - { - return DoAddEvent(aEvent); - } - -EXPORT_C TInt MPlayerCapabilitiesObserver::RemoveEvent(TRegisterNotificationEvent aEvent) - { - return DoRemoveEvent(aEvent); - } - -EXPORT_C void MPlayerCapabilitiesObserver::ClearCompanyIds() - { - DoClearCompanyIds(); - } - -EXPORT_C TInt MPlayerCapabilitiesObserver::AddCompanyId(TInt aID) - { - return DoAddCompanyId( aID ); - } - -EXPORT_C TInt MPlayerCapabilitiesObserver::RemoveCompanyID(TInt aID) - { - return DoRemoveCompanyID( aID ); - } - - -// from MPlayerCapabilitiesObserver -void CPlayerInfoTarget::DoClearEvents() - { - // AVRCP 1.3 specification, Appendix H says that PlaybackStatusChanged - // and TrackChanged event notification support is mandatory, so add these - - iSupportedNotificationEventList->Reset(); - iSupportedNotificationEventList->Append(ERegisterNotificationPlaybackStatusChanged); - iSupportedNotificationEventList->Append(ERegisterNotificationTrackChanged); - } - - -TInt CPlayerInfoTarget::DoAddEvent( TRegisterNotificationEvent aEvent ) - { - // check the event is supported (note system status is NOT supported) - if ( aEvent >= ERegisterNotificationReservedLast - || aEvent == ERegisterNotificationSystemStatusChanged_NotSupported) - { - return KErrNotSupported; - } - - // check if aEvent is already in the list of supported events - if (!iSupportedNotificationEventList->Find(aEvent)) - { - // not found so add it to the list - iSupportedNotificationEventList->Append(aEvent); - return KErrNone; - } - - // else return already in the list - return KErrAlreadyExists; - } - - -TInt CPlayerInfoTarget::DoRemoveEvent( TRegisterNotificationEvent aEvent ) - { - // AVRCP 1.3 specification, Appendix H says that PlaybackStatusChanged - // and TrackChanged event notification support is mandatory, so add these - TInt err = KErrNone; - if ( aEvent == ERegisterNotificationPlaybackStatusChanged - || aEvent == ERegisterNotificationTrackChanged) - { - return KErrNotSupported; - } - - // Find aEvent in the list of supported events - if (iSupportedNotificationEventList->Find(aEvent)) - { - // and then remove it - iSupportedNotificationEventList->Remove(aEvent); - TInt pendingPos = iPendingNotificationEventList.Find(aEvent); - if (pendingPos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pendingPos ); - - // Tell anyone waiting for a notification that an event has been - // removed. Alas, we can't specify _WHICH_ event has been removed - // since there's no way to indicate this in an INTERNAL_ERROR response - SendError(KErrAvrcpMetadataInternalError, - RAvrcpIPC::SetIPCOperationIdFromEventId(aEvent), - ERemConNotifyResponseChanged); - } - } - else - { - err = KErrNotFound; - } - return err; - } - - -void CPlayerInfoTarget::DoClearCompanyIds() - { - // The Bluetooth SIG vendor id must always be present - // See AVRCP 1.3 Specification, section 5.5.1, table 5.4 - iCompanyIdList.Reset(); - iCompanyIdList.Append(KBluetoothSIGVendorId); - } - - -TInt CPlayerInfoTarget::DoAddCompanyId( TInt aID ) - { - if ( aID > KMaxCompanyID ) - { - return KErrNotSupported; - } - - // check if the ID is already in the list - TInt pos = iCompanyIdList.Find( aID ); - - // add only if not present in list to avoid duplicates - if (pos != KErrNotFound) - { - return KErrAlreadyExists; - } - - // make sure the list cannot contain more than 255 items - if (iCompanyIdList.Count() >= KMaxNrOfCompanyIDs) - { - return KErrOverflow; - } - - return iCompanyIdList.Append( aID ); - } - - -TInt CPlayerInfoTarget::DoRemoveCompanyID( TInt aID ) - { - // The Bluetooth SIG vendor id must always be present - // See AVRCP 1.3 Specification, section 5.5.1, table 5.4 - if ( aID == KBluetoothSIGVendorId ) - { - return KErrNotSupported; - } - - // check if the ID is in the list - TInt pos = iCompanyIdList.Find( aID ); - - // if found remove else do nothing - if (pos != KErrNotFound) - { - iCompanyIdList.Remove( pos ); - return KErrNone; - } - return pos; - } - - -void CPlayerInfoTarget::ProcessGetCapabilities(const TDesC8& aData) - { - LOG_STATIC_FUNC - - /* Decode the get capability message */ - TRemConMetadataTransferGetCapabilities getCapability; - - // check there is at least 1 byte of data - if (!aData.Length()) - { - // Invalid packet - return SendError(KErrAvrcpMetadataInvalidParameter, EGetCapabilities); - } - - TPckgC data(*reinterpret_cast(aData.Ptr())); - getCapability = data(); - TGetCapabilityValues id = (TGetCapabilityValues) getCapability.iCapabilityID; - - // format the response in a TRemConGetCapabilitiesResponse - RRemConGetCapabilitiesResponse response; - - switch ( id ) - { - case ECapabilityIdCompanyID: - // respond with ECapabilityIdCompanyID - response.iCapabilityId = ECapabilityIdCompanyID; - - // followed by number of IDs - response.iCapabilityCount = iCompanyIdList.Count(); - - // and then list of company ids, - for (TInt i=0; i< iCompanyIdList.Count(); i++ ) - { - TInt x = iCompanyIdList[i]; - if (response.iCapabilities.Append(x) != KErrNone) - { - response.Close(); - return SendError(KErrAvrcpMetadataInternalError, EGetCapabilities); // Try to send internal error if OOM - } - } - break; - - case ECapabilityIdEventsSupported: - // respond with ECapabilityIdEventsSupported - response.iCapabilityId = ECapabilityIdEventsSupported; - - // followed by number of supported events, and then list of events - response.iCapabilityCount = 0; - iSupportedNotificationEventList->Begin(); - while(iSupportedNotificationEventList->Next()) - { - if (KErrNone != response.iCapabilities.Append(iSupportedNotificationEventList->Get())) - { - response.Close(); - return SendError(KErrAvrcpMetadataInternalError, EGetCapabilities); // Try to send internal error if OOM - } - response.iCapabilityCount++; - } - break; - - default: - /* other IDs are reserved */ - return SendError(KErrAvrcpMetadataInvalidParameter, EGetCapabilities); // Invalid packet - } - - TInt error = 0; - TRAP(error, response.WriteL(iOutBuf)); // Don't send error if OOM - response.Close(); - if (error == KErrNone) - // send the result back to the CT - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - EGetCapabilities, ERemConResponse, iOutBuf ); - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/src/playerevents.cpp --- a/bluetoothappprofiles/avrcp/playerinformation/src/playerevents.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,477 +0,0 @@ -// Copyright (c) 2008-2009 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: -// This file contains the events part of the PlayerInformation API. -// -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include -#include -#include - -#include "playerapplicationsetting.h" -#include "eventsmask.h" -#include "playereventsutils.h" -#include "playerinformation.h" - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_PLAYER_INFO); -#endif - -EXPORT_C void MPlayerEventsObserver::PlaybackStatusChanged(TPlaybackStatus aStatus) - { - DoPlaybackStatusChanged(aStatus); - } - -EXPORT_C void MPlayerEventsObserver::TrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds) - { - DoTrackChanged(aTrackId, aLengthInMilliseconds); - } - -EXPORT_C void MPlayerEventsObserver::TrackReachedEnd() - { - DoTrackReachedEnd(); - } - -EXPORT_C void MPlayerEventsObserver::TrackReachedStart() - { - DoTrackReachedStart(); - } - -EXPORT_C void MPlayerEventsObserver::SetPlaybackPosition(TUint32 aMilliseconds) - { - DoSetPlaybackPosition(aMilliseconds); - } - -EXPORT_C void MPlayerEventsObserver::SetBatteryStatus(TTargetBatteryStatus aBatteryStatus) - { - DoSetBatteryStatus(aBatteryStatus); - } - -void CPlayerInfoTarget::ProcessGetStatusAndBeginObserving( const TUint aOperationId, TRegisterNotificationEvent aEventId, const TDesC8& aData) - { - // check the event is in the supported list - if (!iSupportedNotificationEventList->Find(aEventId)) - { - // Not supported so return error - SendError(KErrAvrcpMetadataInvalidParameter, aOperationId, ERemConNotifyResponseInterim); - return; - } - - // if the event is EPlaybackPosChanged then the timeinterval is included in the RegisterNofication - if (aEventId == ERegisterNotificationPlaybackPosChanged) - { - // decode the playback interval from aData - TInt error = 0; - RRemConPlayerInformation32BitResponse request; - TRAP(error, request.ReadL(aData)); - - if (error != KErrNone) - { - // Not supported so return error - SendError(KErrAvrcpMetadataParameterNotFound, aOperationId, ERemConNotifyResponseInterim); - return; - } - - // save the playback interval - iPlayBackIntervalInMilliseconds = request.iValue * 1000; - - // and the current position - iLastNotifiedPlaybackPositionInMilliseconds = iPlaybackPositionInMilliseconds; - } - - // and request another notification (if there is not one already pending) - // on the next state change - if (KErrNotFound ==iPendingNotificationEventList.Find(aEventId)) - { - if (iPendingNotificationEventList.Append(aEventId) != KErrNone) - { - return SendError(KErrAvrcpMetadataInternalError, aOperationId); // Try to send internal error if OOM - } - } - - // send the current status - SendNotificationResponse(aEventId, ERemConNotifyResponseInterim ); - } - -void CPlayerInfoTarget::ProcessGetStatus( const TUint aOperationId, TRegisterNotificationEvent aEventId) - { - // send the current value - if (iSupportedNotificationEventList->Find(aEventId)) - { - SendNotificationResponse(aEventId, ERemConNotifyResponseChanged ); - } - else - { - // Not found so return error - SendError(KErrAvrcpMetadataInvalidParameter, aOperationId, ERemConNotifyResponseChanged); - } - } - -/* ProcessGetPlayStatus This returns the current values of SongLength, - SongPosition and PlayStatus. - Note if SongLength and SongPosition are not supported KPlaybackPositionUnknown is returned - */ -void CPlayerInfoTarget::ProcessGetPlayStatus() - { - LOG_FUNC - - TInt error =0; - - // format the response in a RRemConPlayerInformationGetPlayStatusResponse - RRemConPlayerInformationGetPlayStatusResponse response; - response.iTrackLength = iLengthInMilliseconds; - response.iPlayPos = iPlaybackPositionInMilliseconds; - response.iStatus = iPlayBackStatus; - - TRAP(error, response.WriteL(iOutBuf)); - if (error == KErrNone) - { - // send the response back to the CT - error = InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - EGetPlayStatus, ERemConResponse, iOutBuf ); - } - } - -/* ProcessGetPlayStatusUpdate returns the current play status if it has changed - * relative to the provided play status, otherwise the request is queued until - * the play status changes. - */ -void CPlayerInfoTarget::ProcessGetPlayStatusUpdate(const TDesC8& aData) - { - LOG_FUNC - - // Bearer should never send us more than one of these in parallel - __ASSERT_DEBUG(!iPlaybackStatusUpdatePending, PlayerEventsUtils::Panic(ETwoGetPlayStatusUpdatesQueued)); - - TInt error =0; - RRemConPlayerInformationGetPlayStatusUpdateRequest request; - TRAP(error, request.ReadL(aData)); - __ASSERT_DEBUG(error == KErrNone, PlayerEventsUtils::Panic(EBadlyFormattedInternalData)); - - if(request.iStatus != iPlayBackStatus) - { - // format the response in a RRemConPlayerInformationGetPlayStatusResponse - RRemConPlayerInformationGetPlayStatusUpdateResponse response; - response.iStatus = iPlayBackStatus; - - TRAP(error, response.WriteL(iOutBuf)); - if (error == KErrNone) - { - // send the response back to the CT - error = InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - EGetPlayStatusUpdate, ERemConResponse, iOutBuf ); - if(error != KErrNone) - { - // We will try and send the response again next time we get an update - iPlaybackStatusUpdatePending = ETrue; - } - } - } - else - { - iPlaybackStatusUpdatePending = ETrue; - } - } - -// Send a Notification message for aEventID -void CPlayerInfoTarget::SendNotificationResponse( TRegisterNotificationEvent aEventId, TRemConMessageSubType aMsgSubType ) - { - LOG_FUNC - - TInt error = 0; - iOutBuf.Zero(); - - if (!iSupportedNotificationEventList->Find(aEventId)) - { - return SendError(KErrAvrcpMetadataInvalidParameter, - RAvrcpIPC::SetIPCOperationIdFromEventId(aEventId), aMsgSubType); - } - - switch (aEventId) - { - case ERegisterNotificationTrackReachedEnd: - case ERegisterNotificationTrackReachedStart: - { - // no extra data for reached start or end - RAvrcpIPCError response; - response.iError = KErrNone; - TRAP(error, response.WriteL(iOutBuf)); - break; - } - - case ERegisterNotificationPlaybackStatusChanged: - { - // 8bit response -- current playback status - RRemConPlayerInformation8BitResponse response; - response.iValue = iPlayBackStatus; - TRAP(error, response.WriteL(iOutBuf)); - break; - } - - case ERegisterNotificationBatteryStatusChanged: - { - // 8bit response -- current battery status - RRemConPlayerInformation8BitResponse response; - response.iValue = iBatteryStatus; - TRAP(error, response.WriteL(iOutBuf)); - break; - } - - case ERegisterNotificationPlaybackPosChanged: - { - // 32bit response -- current playback position in millisecond - RRemConPlayerInformation32BitResponse response; - response.iValue = iPlaybackPositionInMilliseconds; - TRAP(error, response.WriteL(iOutBuf)); - break; - } - - case ERegisterNotificationTrackChanged: - { - // 64bit response -- index of the current track - RRemConPlayerInformation64BitResponse response; - response.iValue = iTrackId; - TRAP(error, response.WriteL(iOutBuf)); - break; - } - - case ERegisterNotificationPlayerApplicationSettingChanged: - { - // Send a list of the settings that have changed followed by their value - // starting with the number of attributes to be sent - RRemConPlayerAttributeIdsAndValues response; - response.iNumberAttributes = 0; - - // for every entry in the list - THashMapIter iter(iPlayerApplicationSettings); - CPlayerApplicationSettings* const* setting = iter.NextValue(); - while ( setting != NULL ) - { - TUint8 value = (*setting)->GetCurrentValue(); - TInt ret1 = response.iAttributeValue.Append(value); - TInt ret2 = response.iAttributeId.Append((*setting)->GetAttributeID()); - if (ret1 != KErrNone || ret2 != KErrNone) - { - response.Close(); - return SendError(KErrAvrcpMetadataInternalError, - RAvrcpIPC::SetIPCOperationIdFromEventId(aEventId), - aMsgSubType); // Try to send internal error if OOM - } - response.iNumberAttributes++; - setting = iter.NextValue(); - } - - TRAP(error, response.WriteL(iOutBuf)); - response.Close(); - break; - } - default: - return; - } - - if (error == KErrNone) - { - // send the response back to the CT - TUint operationId = RAvrcpIPC::SetIPCOperationIdFromEventId(aEventId); - error = InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - operationId, ERemConResponse, aMsgSubType, iOutBuf); - } - } - -// from MPlayerEventsObserver - void CPlayerInfoTarget::DoPlaybackStatusChanged(TPlaybackStatus aStatus) - { - LOG_FUNC - - iPlayBackStatus = aStatus; - - // if the playback status is in the current event list - TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackStatusChanged ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - SendNotificationResponse( ERegisterNotificationPlaybackStatusChanged, ERemConNotifyResponseChanged); - } - - pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged); - } - - if(iPlaybackStatusUpdatePending) - { - // format the response in a RRemConPlayerInformationGetPlayStatusResponse - RRemConPlayerInformationGetPlayStatusUpdateResponse response; - response.iStatus = iPlayBackStatus; - - TRAPD(error, response.WriteL(iOutBuf)); - if (error == KErrNone) - { - // send the response back to the CT - error = InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - EGetPlayStatusUpdate, ERemConResponse, iOutBuf ); - if(error == KErrNone) - { - iPlaybackStatusUpdatePending = EFalse; - } - // if we did error we will try and respond again next time the client's play status - // changes - } - } - } - -void CPlayerInfoTarget::DoTrackChanged(TUint64 aTrackId, TUint32 aLengthInMilliseconds) - { - LOG_FUNC - - iTrackId = aTrackId; - iLengthInMilliseconds = aLengthInMilliseconds; - - // if the playback status is in the current event list - TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationTrackChanged ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - SendNotificationResponse(ERegisterNotificationTrackChanged, ERemConNotifyResponseChanged); - } - - pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - iPlaybackPositionInMilliseconds = 0; //set 0 to current position for new track - SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged); - } - } - -void CPlayerInfoTarget::DoTrackReachedEnd() - { - LOG_FUNC - - iTrackPosition = EEnd; - - // if the ETrackReachedEnd status is in the current event list - TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationTrackReachedEnd ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - SendNotificationResponse(ERegisterNotificationTrackReachedEnd, ERemConNotifyResponseChanged); - } - - pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - iPlaybackPositionInMilliseconds = iLengthInMilliseconds; - SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged); - } - } - -void CPlayerInfoTarget::DoTrackReachedStart() - { - LOG_FUNC - - iTrackPosition = EStart; - - // if the ETrackReachedStart status is in the current event list - TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationTrackReachedStart ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - SendNotificationResponse(ERegisterNotificationTrackReachedStart, ERemConNotifyResponseChanged); - } - - pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - iPlaybackPositionInMilliseconds = 0; - SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged); - } - } - -void CPlayerInfoTarget::DoSetPlaybackPosition(TUint32 aMilliseconds) - { - LOG_FUNC - - iPlaybackPositionInMilliseconds = aMilliseconds; - - // if the playback position is in the current Notification event list - TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationPlaybackPosChanged ); - if (pos != KErrNotFound) - { - // a notification has been requested, now check if it is due - - TUint32 difference = (iPlaybackPositionInMilliseconds > iLastNotifiedPlaybackPositionInMilliseconds) ? - iPlaybackPositionInMilliseconds - iLastNotifiedPlaybackPositionInMilliseconds: - iLastNotifiedPlaybackPositionInMilliseconds - iPlaybackPositionInMilliseconds; - - if (difference >= iPlayBackIntervalInMilliseconds) - { - // Due now so send - iPendingNotificationEventList.Remove( pos ); - SendNotificationResponse(ERegisterNotificationPlaybackPosChanged, ERemConNotifyResponseChanged); - } - } - } - -void CPlayerInfoTarget::DoSetBatteryStatus(TTargetBatteryStatus aBatteryStatus) - { - LOG_FUNC - - TBool validStatus = ETrue; - if (aBatteryStatus < MPlayerEventsObserver::ENormal || - aBatteryStatus > MPlayerEventsObserver::EFullCharge) - { - LOG1(_L("Invalid battery status: %d"),aBatteryStatus); - validStatus = EFalse; - } - else - { - iBatteryStatus = aBatteryStatus; - } - - // if the battery status is in the current event list - TInt pos = iPendingNotificationEventList.Find( ERegisterNotificationBatteryStatusChanged ); - if (pos != KErrNotFound) - { - iPendingNotificationEventList.Remove( pos ); - if (validStatus) - { - SendNotificationResponse(ERegisterNotificationBatteryStatusChanged, ERemConNotifyResponseChanged); - } - } - } - -void CPlayerInfoTarget::SendError(TInt aError, TInt aOperationId, TRemConMessageSubType aSubType) - { - TInt error = 0; - RAvrcpIPCError response; - response.iError = aError; - TRAP(error, response.WriteL(iOutBuf)); // Don't send error if OOM - if (error == KErrNone) - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - aOperationId, ERemConResponse, aSubType, iOutBuf); - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/src/playerinformation.cpp --- a/bluetoothappprofiles/avrcp/playerinformation/src/playerinformation.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,293 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include -#include - -#include "playerapplicationsetting.h" -#include "eventsmask.h" -#include "playerinformation.h" - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_PLAYER_INFO); -#endif - -EXPORT_C CPlayerInfoTarget* CPlayerInfoTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, - MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver, - MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver, - MPlayerEventsObserver*& aPlayerEventsObserver, - MPlayerApplicationSettingsNotify& aApplicationSettingNotifier ) - { - LOG_STATIC_FUNC - - CPlayerInfoTarget* self = new(ELeave) CPlayerInfoTarget(aInterfaceSelector, aApplicationSettingNotifier); - CleanupStack::PushL(self); - self->ConstructL( aPlayerCapabilitiesObserver, aPlayerApplicationSettingsObserver, aPlayerEventsObserver ); - CleanupStack::Pop(self); - return self; - } - -/** -Constructs this interface. -@param aInterfaceSelector An interface selector for use with this interface. -@internalComponent -@released -*/ -CPlayerInfoTarget::CPlayerInfoTarget(CRemConInterfaceSelector& aInterfaceSelector, MPlayerApplicationSettingsNotify& aApplicationSettingNotifier) -: CRemConInterfaceBase(TUid::Uid(KRemConPlayerInformationUid), - KMaxLengthPlayerInformationMsg, - aInterfaceSelector, - ERemConClientTypeTarget), - iApplicationSettingNotifier(aApplicationSettingNotifier), - iPlaybackStatusUpdatePending(EFalse) - { - } - - -void CPlayerInfoTarget::ConstructL(MPlayerCapabilitiesObserver*& aPlayerCapabilitiesObserver, - MPlayerApplicationSettingsObserver*& aPlayerApplicationSettingsObserver, - MPlayerEventsObserver*& aPlayerEventsObserver ) - { - // reserve two AV/C frames, for this reasoning: - // GetCapabilities (PDU 0x10) can generate a response - // which is (255 * 3 bytes) + 2 bytes = 767 total and - // will fit into two AVC frames. Other PDUs generate - // less than this, except for PDUs 0x15 and 0x16 which - // use their own buffer pre-allocated by calling Size() - iOutBuf.CreateL(KAVCFrameMaxLength * 2); - - BaseConstructL(); - - aPlayerCapabilitiesObserver = this; - aPlayerApplicationSettingsObserver = this; - aPlayerEventsObserver = this; - - // default values for event notifiers - iPlayBackStatus = EStopped; - - // If no track currently selected - iTrackId = KNoTrackSelected; - - iLengthInMilliseconds = 0; - iTrackPosition = EStart; - - // If no track currently selected, then return KPlaybackPositionUnknown - iPlaybackPositionInMilliseconds = KPlaybackPositionUnknown; - iLastNotifiedPlaybackPositionInMilliseconds = KPlaybackPositionUnknown; - - // The time interval used for playback position notification - iPlayBackIntervalInMilliseconds = 0; - - // Try to detect battery status from hardware P&S properties - iBatteryStatus = DetectBatteryStatus(); - - // The Bluetooth SIG vendor id must always be present - // See AVRCP 1.3 Specification, section 5.5.1, table 5.4 - iCompanyIdList.AppendL(KBluetoothSIGVendorId); - - // AVRCP 1.3 specification, Appendix H says that PlaybackStatusChanged - // and TrackChanged event notification support is mandatory, so add these - iSupportedNotificationEventList = new (ELeave) TEventsMask(); - iSupportedNotificationEventList->Append(ERegisterNotificationPlaybackStatusChanged); - iSupportedNotificationEventList->Append(ERegisterNotificationTrackChanged); - } - -EXPORT_C CPlayerInfoTarget::~CPlayerInfoTarget() - { - iPendingNotificationEventList.Close(); - iCompanyIdList.Close(); - iOutBuf.Close(); - - // Free up all the settings memory - THashMapIter iter(iPlayerApplicationSettings); - CPlayerApplicationSettings* const* setting = iter.NextValue(); - while ( setting != NULL ) - { - delete *setting; - setting = iter.NextValue(); - } - - // Now close the hash table itself - iPlayerApplicationSettings.Close(); - delete iSupportedNotificationEventList; - } - - -TAny* CPlayerInfoTarget::GetInterfaceIf(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf2) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -// from MRemConInterfaceIf -void CPlayerInfoTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData, TRemConMessageSubType aMsgSubType) - { - LOG(_L("CPlayerInfoTarget::MrcibNewMessage")); - LOG1(_L("\taOperationId = 0x%02x"), aOperationId); - LOG1(_L("\taData.Length = %d"), aData.Length()); - LOG1(_L("\taMsgSubType = 0x%02x"), aMsgSubType); - - TMetadataTransferPDU currentOp = RAvrcpIPC::GetPDUIdFromIPCOperationId(aOperationId); - - switch (currentOp) - { - case EGetCapabilities: - { - /* process this in playercapabilities */ - ProcessGetCapabilities( aData ); - break; - } - case EListPlayerApplicationSettingAttributes: - { - /* respond with Player Application Attributes*/ - ProcessListPlayerApplicationAttributes( aOperationId ); - break; - } - case EGetPlayerApplicationSettingAttributeText: - { - /* respond with Player Application Attribute Text*/ - ProcessGetPlayerApplicationAttributeText( aData, aOperationId ); - break; - } - case EListPlayerApplicationSettingValues: - { - /* respond with Player Application Values*/ - ProcessListPlayerApplicationValues( aData, aOperationId ); - break; - } - case EGetPlayerApplicationSettingValueText: - { - /* respond with Application Value Text*/ - ProcessGetPlayerApplicationValueText( aData, aOperationId ); - break; - } - case EGetCurrentPlayerApplicationSettingValue: - { - /* respond with Current Player Application Value*/ - ProcessGetCurrentPlayerApplicationValue( aData, aOperationId ); - break; - } - case ESetPlayerApplicationSettingValue: - { - /* Set Player Application Value*/ - ProcessSetPlayerApplicationValue( aData, aOperationId ); - break; - } - case EGetPlayStatus: - { - // process in playerevents - ProcessGetPlayStatus(); - break; - } - case ERegisterNotification: - { - // obtain eventId from aOperationId - TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(aOperationId); - - // register for Notifications - if (aMsgSubType == ERemConNotifyCommandAwaitingInterim) - { - ProcessGetStatusAndBeginObserving(aOperationId, eventId, aData); - } - else if (aMsgSubType == ERemConNotifyCommandAwaitingChanged) - { - ProcessGetStatus(aOperationId, eventId); - } - break; - } - case EGetPlayStatusUpdate: - { - // process in playerevents - ProcessGetPlayStatusUpdate(aData); - break; - } - default: - break; - } - - } - -MPlayerEventsObserver::TTargetBatteryStatus CPlayerInfoTarget::DetectBatteryStatus() - { - MPlayerEventsObserver::TTargetBatteryStatus status = ECritical; - TInt err = KErrNone; - TInt batteryStatus = EBatteryStatusUnknown; - TInt chargingStatus = EChargingStatusNotConnected; - err = RProperty::Get(KPSUidHWRMPowerState,KHWRMBatteryStatus,batteryStatus); - if (!err) - { - err = RProperty::Get(KPSUidHWRMPowerState,KHWRMChargingStatus,chargingStatus); - } - - switch (batteryStatus) - { - // Normal or Charging - case EBatteryStatusOk: - { - if (chargingStatus == EChargingStatusCharging || - chargingStatus == EChargingStatusAlmostComplete || - chargingStatus == EChargingStatusChargingContinued) - { - iBatteryStatus = EExternal; - } - else - { - if (chargingStatus == EChargingStatusChargingComplete) - { - iBatteryStatus = EFullCharge; - } - else - { - iBatteryStatus = ENormal; - } - } - } - break; - // Warning - case EBatteryStatusLow: - { - iBatteryStatus = EWarning; - } - break; - // Critical - case EBatteryStatusEmpty: - { - iBatteryStatus = ECritical; - } - break; - // Unknown state, set as ECritical - case EBatteryStatusUnknown: - { - iBatteryStatus = ECritical; - } - break; - } - return status; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/src/playersettings.cpp --- a/bluetoothappprofiles/avrcp/playerinformation/src/playersettings.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,685 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include - -#include "playerapplicationsetting.h" -#include "playerinformation.h" -#include "playersettingsutils.h" - - -void CPlayerInfoTarget::SendError(TInt aError, TInt aOperationId) - { - TInt error = 0; - RAvrcpIPCError response; - response.iError = aError; - TRAP(error, response.WriteL(iOutBuf)); // Try to send internal error if OOM - if (error == KErrNone) - { - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - aOperationId, ERemConResponse, iOutBuf); - } - } - - -// PDU 0x11 -void CPlayerInfoTarget::ProcessListPlayerApplicationAttributes(TInt aOperationId) - { - RRemConPlayerListOfAttributes response; - response.iNumberAttributes = iPlayerApplicationSettings.Count(); - - THashMapIter iter(iPlayerApplicationSettings); - const TInt* attribute = iter.NextKey(); - while ( attribute != NULL ) - { - if (response.iAttributes.Append(*attribute) != KErrNone) - { - response.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); // Try to send internal error if OOM - } - attribute = iter.NextKey(); - } - - // send the response back to the CT - TInt error = 0; - TRAP(error, response.WriteL(iOutBuf)); // Try to send internal error if OOM - response.Close(); - if (error != KErrNone) - { - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - EListPlayerApplicationSettingAttributes, ERemConResponse, iOutBuf ); - } - -// PDU 0x12 -void CPlayerInfoTarget::ProcessListPlayerApplicationValues(const TDesC8& aData, TInt aOperationId) - { - TInt error =0; - RDesReadStream readStream; - readStream.Open(aData); - TInt attributeID = 0; - TRAP(error, attributeID = readStream.ReadUint8L()); - readStream.Close(); - if (error != KErrNone) - { - return SendError(KErrAvrcpMetadataParameterNotFound, aOperationId); // Nothing in packet - } - - // Send the number of values for this attribute (1 byte), - // followed by the defined values themselves (n x 1byte) - CPlayerApplicationSettings* thisSetting = GetSetting(attributeID); - if (thisSetting == NULL) - { - // Attribute Id not found - return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId); - } - - RRemConPlayerListOfAttributes response; - RArray* values = thisSetting->GetValues(); - TInt numValues = values->Count(); - response.iNumberAttributes = numValues; - - // Make sure that we always have at least one result to return - // Table 5.18 says that the number of results provided has an - // allowed value of 1-255, so we cannot return zero results. - if (response.iNumberAttributes == 0) - { - return SendError(KErrAvrcpMetadataParameterNotFound, aOperationId); // No attributes matched - } - - for ( TInt i = 0; i < numValues; i++ ) - { - TInt value = (*values)[i]; - if (response.iAttributes.Append(value) != KErrNone) - { - response.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); // Try to send internal error if OOM - } - } - - // send the response back to the CT - TRAP(error, response.WriteL(iOutBuf)); // Try to send internal error if OOM - response.Close(); - if (error != KErrNone) - { - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - aOperationId, ERemConResponse, iOutBuf ); - } - -// PDU 0x15 -void CPlayerInfoTarget::ProcessGetPlayerApplicationAttributeText(const TDesC8& aData, TInt aOperationId) - { - TInt error =0; - - // If we can't parse the request, then return an error - RRemConPlayerListOfAttributes request; - TRAP(error, request.ReadL(aData)); - if (error != KErrNone) - { - request.Close(); - return SendError(KErrAvrcpMetadataInvalidCommand, aOperationId); - } - - // Iterate through requested attributes and remove - // those which we don't have any settings for. - for (TInt i = 0; i < request.iNumberAttributes; i++) - { - if (! AttributeSettingExists(request.iAttributes[i])) - { - request.iAttributes.Remove(i); - request.iNumberAttributes--; - i--; - } - } - - // Make sure that we always have at least one result to return - // Table 5.18 says that the number of results provided has an - // allowed value of 1-255, so we cannot return zero results. - RRemConGetPlayerApplicationTextResponse response; - response.iNumberAttributes = request.iNumberAttributes; - if (response.iNumberAttributes == 0) - { - request.Close(); - return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId); // No attributes matched - } - - // for every attribute text requested - for (TInt i = 0; i < request.iNumberAttributes; i++) - { - // start with the attribute id requested and the character set - RSettingWithCharset setting; - TInt attId = request.iAttributes[i]; - CPlayerApplicationSettings* thisSetting = GetSetting(attId); - setting.iAttributeId = attId; - setting.iCharset = KUtf8MibEnum; - const TPtrC8 text = thisSetting->GetAttributeText(); - setting.iStringLen = text.Length(); - setting.iString = text.Alloc(); - - // If OOM, try to return an internal error. - if (setting.iString == NULL) - { - request.Close(); - response.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - // If OOM, try to return an internal error. - if (response.iAttributes.Append(setting) != KErrNone) - { - setting.Close(); - request.Close(); - response.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - } - request.Close(); - - // Allocate a buffer for the formatted message - RBuf8 messageBuffer; - if ( messageBuffer.Create(response.Size()) != KErrNone ) - { - // On OOM drop the message - response.Close(); - return; - } - - // send the response back to the CT - TRAP(error, response.WriteL(messageBuffer)); // Try to send internal error if OOM - response.Close(); - if (error != KErrNone) - { - messageBuffer.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - aOperationId, ERemConResponse, messageBuffer ); - - messageBuffer.Close(); - } - -// PDU 0x14 -void CPlayerInfoTarget::ProcessSetPlayerApplicationValue(const TDesC8& aData, TInt aOperationId) - { - RRemConPlayerAttributeIdsAndValues request; - TInt error = 0; - - // If we can't parse the request, then return an error - TRAP(error, request.ReadL(aData)); - if (error != KErrNone) - { - request.Close(); - return SendError(KErrAvrcpMetadataInvalidCommand, aOperationId); - } - - // Iterate through all the settings we're sent to update and set them - for (TInt i = 0; i < request.iNumberAttributes; i++) - { - if (! AttributeValueCanBeSet(request.iAttributeId[i], request.iAttributeValue[i])) - { - // remove this setting - request.iAttributeId.Remove(i); - request.iAttributeValue.Remove(i); - request.iNumberAttributes--; - i--; - } - } - __ASSERT_DEBUG(request.iAttributeId.Count() == request.iAttributeValue.Count(), PlayerSettingsUtils::Panic(EPlayerSettingsFunnyLengthData)); - - // Section 5.7 of the AVRCP specification (page 56) says: - // If CT sent a PDU with nonexistent PDU ID or a PDU containing - // only one parameter with nonexistent parameter ID, TG shall return - // REJECTED response with Error Status Code. If CT sent a PDU with - // multiple parameters where at least one ID is existent and the - // others are nonexistent, TG shall proceed with the existent ID and - // ignore the non-existent IDs. - // - // This means we return REJECTED if we have nothing to set - if (request.iNumberAttributes == 0) - { - request.Close(); - return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId); - } - - // If an application setting notifier has been requested then notify it - // If the notification succeeds, then set all the values - - TRAP(error, iApplicationSettingNotifier.MpasnSetPlayerApplicationValueL(request.iAttributeId, request.iAttributeValue)); - if ( error == KErrNone ) - { - for (TInt i = 0; i < request.iNumberAttributes; i++) - { - CPlayerApplicationSettings* thisSetting = GetSetting(request.iAttributeId[i]); - thisSetting->SetCurrentValue(request.iAttributeValue[i]); - } - } - else - { - // Return an AVRCP internal error via RemCon. See section 5.7.1 of specification. - request.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - request.Close(); - // Send a notification if one has been registered - if ( KErrNotFound != iPendingNotificationEventList.Find( ERegisterNotificationPlayerApplicationSettingChanged )) - { - SendNotificationResponse( ERegisterNotificationPlayerApplicationSettingChanged, ERemConNotifyResponseChanged ); - } - - - // SendError KErrNone is used to send a valid response - SendError(KErrNone, aOperationId); - } - -// PDU 0x13 -void CPlayerInfoTarget::ProcessGetCurrentPlayerApplicationValue(const TDesC8& aData, TInt aOperationId) - { - TInt error = 0; - - // If we can't parse the request, then return an error - RRemConPlayerListOfAttributes request; - TRAP(error, request.ReadL(aData)); - if (error != KErrNone) - { - request.Close(); - return SendError(KErrAvrcpMetadataInvalidCommand, aOperationId); - } - - // Look through requested attributes, and assemble a response - // for those which we posess. If none are found, return an error - RRemConPlayerAttributeIdsAndValues response; - response.iNumberAttributes = 0; - request.iAttributes.Sort(); - - for (TInt i = 0; i < request.iNumberAttributes; i++) - { - TInt attToSend = request.iAttributes[i]; - if (AttributeSettingExists(attToSend)) - { - TInt ret1 = response.iAttributeId.Append(attToSend); - TInt ret2 = response.iAttributeValue.Append(GetSetting(attToSend)->GetCurrentValue()); - if (ret1 != KErrNone || ret2 != KErrNone) - { - request.Close(); - response.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); // Try to send internal error if OOM - } - response.iNumberAttributes++; - } - } - request.Close(); - - // Make sure that we always have at least one result to return - // Table 5.18 says that the number of results provided has an - // allowed value of 1-255, so we cannot return zero results. - if (response.iNumberAttributes == 0) - { - response.Close(); - return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId); // No attributes matched - } - - // send the response back to the CT - TRAP(error, response.WriteL(iOutBuf)); // Try to send internal error if OOM - response.Close(); - if (error != KErrNone) - { - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - aOperationId, ERemConResponse, iOutBuf ); - } - -// PDU 0x16 -void CPlayerInfoTarget::ProcessGetPlayerApplicationValueText(const TDesC8& aData, TInt aOperationId) - { - RDesReadStream readStream; - readStream.Open(aData); - - TInt error = 0; - TInt reqAttribute = 0; - - // Read the attribute id - TRAP(error, reqAttribute = readStream.ReadUint8L()); - if (error != KErrNone) - { - readStream.Close(); - return SendError(KErrAvrcpMetadataParameterNotFound, aOperationId); // Nothing in packet - } - - // If we don't have settings for this attribute, return an error - CPlayerApplicationSettings* thisSetting = GetSetting(reqAttribute); - if (thisSetting == NULL) - { - readStream.Close(); - return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId); // Attribute not found - } - - // Read the number of PAS values - TInt numSettings = 0; - TRAP(error, numSettings = readStream.ReadUint8L()); - if (error != KErrNone) - { - readStream.Close(); - return SendError(KErrAvrcpMetadataParameterNotFound, aOperationId); // Nothing in packet - } - - RArray valueTextsRequested; - for (TInt i = 0; i < numSettings; i++) - { - TInt requestedValueText = 0; - TRAP(error, requestedValueText = readStream.ReadUint8L()); - if (error == KErrNone) - { - if (valueTextsRequested.Append(requestedValueText) != KErrNone) - { - readStream.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); // Try to send internal error if OOM - } - } - } - - readStream.Close(); - - // format the response in a RRemConGetPlayerApplicationTextResponse - RRemConGetPlayerApplicationTextResponse response; - response.iNumberAttributes = 0; - - // for every attribute text requested - RPointerArray* textValues = thisSetting->GetValuesTexts(); - RArray* values = thisSetting->GetValues(); - TInt numRequested = valueTextsRequested.Count(); - for (TInt i = 0; i < numRequested; i++) - { - // start with the attribute id requested and the character set - RSettingWithCharset setting; - TInt valueToSend = valueTextsRequested[i]; - setting.iAttributeId = valueToSend; - setting.iCharset = KUtf8MibEnum; - - // text length followed by the text - TInt found = values->Find(valueToSend); - if (found != KErrNotFound) - { - HBufC8* text = (*textValues)[found]; - setting.iStringLen = text->Length(); - setting.iString = text->Alloc(); - - // If OOM, try to return an internal error. - if (setting.iString == NULL) - { - response.Close(); - valueTextsRequested.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - // If OOM, try to return an internal error. Of course, this could fail too - if (response.iAttributes.Append(setting) != KErrNone) - { - response.Close(); - setting.Close(); - valueTextsRequested.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - response.iNumberAttributes++; - } - } - valueTextsRequested.Close(); - - // Make sure that we always have at least one result to return - // Table 5.18 says that the number of results provided has an - // allowed value of 1-255, so we cannot return zero results. - if (response.iNumberAttributes == 0) - { - response.Close(); - return SendError(KErrAvrcpMetadataInvalidParameter, aOperationId); - } - - // Allocate a buffer for the formatted message - RBuf8 messageBuffer; - if ( messageBuffer.Create(response.Size()) != KErrNone ) - { - // On OOM drop the message - response.Close(); - return; - } - - // send the response back to the CT - TRAP(error, response.WriteL(messageBuffer)); // Try to send internal error if OOM - response.Close(); - if (error != KErrNone) - { - messageBuffer.Close(); - return SendError(KErrAvrcpMetadataInternalError, aOperationId); - } - - InterfaceSelector().SendUnreliable(TUid::Uid(KRemConPlayerInformationUid), - aOperationId, ERemConResponse, messageBuffer ); - messageBuffer.Close(); - } - -TBool CPlayerInfoTarget::AttributeSettingExists(TUint anAttributeID) - { - if (GetSetting(anAttributeID) == NULL) - { - return EFalse; - } - else - { - return ETrue; - } - } - -TBool CPlayerInfoTarget::IsValidAttributeValue(TUint anAttributeID, TUint anAttributeValue) - { - // As defined in Appendix F of the AVRCP specification, page 81 - // Attribute 0x01 - range 0x01 to 0x02 - // Attribute 0x02 - range 0x01 to 0x04 - // Attribute 0x03 - range 0x01 to 0x03 - // Attribute 0x04 - range 0x01 to 0x03 - // Attribute 0x05 - 0x7f -- invalid; reserved for future use - // Attribute 0x80 - 0xff -- vendor dependent - if (anAttributeID >= 0x80 && anAttributeID <= 0xff && anAttributeValue <= 0xff ) - { - return ETrue; - } - - if (anAttributeID == 0x01 && anAttributeValue >= 0x01 && anAttributeValue <= 0x02) - { - return ETrue; - } - - if (anAttributeID == 0x02 && anAttributeValue >= 0x01 && anAttributeValue <= 0x04) - { - return ETrue; - } - - if ((anAttributeID == 0x03 || anAttributeID == 0x04) - && anAttributeValue >= 0x01 && anAttributeValue <= 0x03) - { - return ETrue; - } - - // Everything else is invalid, as defined by the specification - return EFalse; - } - -// Check that anAttributeValue is in the valid value list for anAttributeID -TBool CPlayerInfoTarget::AttributeValueCanBeSet(TUint anAttributeID, TUint anAttributeValue) - { - CPlayerApplicationSettings* thisSetting = GetSetting(anAttributeID); - if (thisSetting == NULL) - { - return EFalse; - } - - RArray* values = thisSetting->GetValues(); - if (values == NULL) - { - return EFalse; - } - - if (values->Find(anAttributeValue) == KErrNotFound) - { - return EFalse; - } - - // This attribute id and value has been already defined by the RSS - // file, and checked that it conforms to the specification when the - // RSS file was loaded. Now allow this value to be set over the air. - return ETrue; - } - -CPlayerApplicationSettings* CPlayerInfoTarget::GetSetting(TUint anAttributeID) - { - // Will return NULL if anAttributeID is not found - CPlayerApplicationSettings** settings = iPlayerApplicationSettings.Find(anAttributeID); - if (settings == NULL) - { - return NULL; - } - - return *settings; - } - - -// from MPlayerApplicationSettingsObserver -// exported function wrapper for internal pure virtual -EXPORT_C void MPlayerApplicationSettingsObserver::DefineAttributeL(TUint aAttributeID, - TDesC8& aAttributeText, - RArray& aValues, - RArray& aValueTexts, - TUint aInitialValue) - { - DoDefineAttributeL(aAttributeID, aAttributeText, aValues, aValueTexts, aInitialValue); - } - -EXPORT_C void MPlayerApplicationSettingsObserver::SetAttributeL(TUint aAttributeID, TUint aValue) - { - DoSetAttributeL(aAttributeID, aValue ); - } - -void CPlayerInfoTarget::DoDefineAttributeL(TUint aAttributeID, - TDesC8& aAttributeText, - RArray& aValues, - RArray& aValueTexts, - TUint aInitialValue) - { - //Check Length of the player application setting attribute string is 1-255 - if(aAttributeText.Length() > KMaxPlayerApplicationSettingsValue || - aAttributeText.Length() < KMinPlayerApplicationSettingsValue ) - { - User::Leave(KErrNotSupported); - } - - //Check the number of player application setting values is 1-255 - if(aValues.Count() > KMaxPlayerApplicationSettingsValue || - aValues.Count() < KMinPlayerApplicationSettingsValue ) - { - User::Leave(KErrNotSupported); - } - - //Check the numbers of player application setting values and - //player application setting value texts are equal - if(aValues.Count() != aValueTexts.Count()) - { - User::Leave(KErrNotSupported); - } - - //Check Length of the player application setting value string is 1-255 - for(TInt i = 0; i < aValueTexts.Count(); i++ ) - { - if(aValueTexts[i].Length() > KMaxPlayerApplicationSettingsValue || - aValueTexts[i].Length() < KMinPlayerApplicationSettingsValue ) - { - User::Leave (KErrNotSupported); - } - } - - for (TInt i = 0; i < aValues.Count(); i++) - { - // The user cannot define certain attribute ids or values; see Appendix F - if ( ! IsValidAttributeValue(aAttributeID, aValues[i])) - { - User::Leave(KErrNotSupported); - } - } - - // Check the initial value, too - if ( ! IsValidAttributeValue(aAttributeID, aInitialValue)) - { - User::Leave(KErrNotSupported); - } - - // check that aInitialValue is in aValues - if (aValues.Find(aInitialValue) == KErrNotFound) - { - User::Leave(KErrNotSupported); - } - - // create a new TPlayerApplicationSettings - CPlayerApplicationSettings* newSetting = CPlayerApplicationSettings::NewL(aAttributeID, aAttributeText, aValues, aValueTexts, aInitialValue); - CleanupStack::PushL(newSetting); - - // Backup the settings of aAttributeID if they exist, return NULL if the attribute ID cannot be found - CPlayerApplicationSettings* backupSetting = GetSetting(aAttributeID); - - // and save it - iPlayerApplicationSettings.InsertL(aAttributeID, newSetting); - - //Delete backupSetting, as the InsertL will replace the old objects by the provided objects - delete backupSetting; - - CleanupStack::Pop(newSetting); - } - -void CPlayerInfoTarget::DoSetAttributeL(TUint aAttributeID, TUint aValue) - { - // Will return NULL if the attribute ID cannot be found - CPlayerApplicationSettings* setting = GetSetting(aAttributeID); - if (setting == NULL) - { - User::Leave(KErrNotFound); - } - - if ( ! IsValidAttributeValue(aAttributeID, aValue)) - { - User::Leave(KErrNotSupported); - } - - setting->SetCurrentValue(aValue); - - if ( KErrNotFound != iPendingNotificationEventList.Find( ERegisterNotificationPlayerApplicationSettingChanged )) - { - // send response - SendNotificationResponse( ERegisterNotificationPlayerApplicationSettingChanged, ERemConNotifyResponseChanged ); - } - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/playerinformation/src/settingsresource.cpp --- a/bluetoothappprofiles/avrcp/playerinformation/src/settingsresource.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include - - -// AVRCP resource files must only contain one top level resource. -static const int KAVRCPResourceId = 1; -static const TInt KAVRCPFormatVersion = 1; - - -EXPORT_C void PlayerApplicationSettingsResourceInit::DefineAttributesL(MPlayerApplicationSettingsObserver& aSettings, - CResourceFile& aResourceFile) - { - // Read the settings from the resource file - RResourceReader reader; - reader.OpenLC(&aResourceFile, KAVRCPResourceId); - - // Check the version of this resource file - TUint16 formatVersion = reader.ReadUint16L(); - if (formatVersion != KAVRCPFormatVersion) - { - reader.Close(); - User::Leave(KErrCorrupt); - } - - // Find out how many settings this resource file contains - TInt settingsCount = reader.ReadUint16L(); - if (settingsCount < 0) - { - reader.Close(); - User::Leave(KErrCorrupt); - } - - // read the settings from aResource - RArray values; - RArray valueTexts; - CleanupClosePushL(values); - CleanupClosePushL(valueTexts); - - // Read each AVRCP attribute setting in turn - for (int i = 0; i < settingsCount; i++) - { - values.Reset(); - valueTexts.Reset(); - - // Read attribute, description text, initial value and defined values - TUint attributeID(reader.ReadUint8L()); - TUint initialValue(reader.ReadUint8L()); - TPtrC8 attributeText(reader.ReadTPtrC8L()); - TInt valuesCount(reader.ReadUint16L()); - - for (int j = 0; j < valuesCount; j++) - { - TUint thisValue = reader.ReadUint8L(); - TPtrC8 thisDescription = reader.ReadTPtrC8L(); - - values.AppendL(thisValue); - valueTexts.AppendL(thisDescription); - } - - // Now define this attribute, then continue to next attribute - aSettings.DefineAttributeL(attributeID, attributeText, values, valueTexts, initialValue); - } - // cleaning up values and valueTexts - CleanupStack::PopAndDestroy(3); // values, valueTexts, reader - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/group/bld.inf --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/group/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - - - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remconbeareravrcp.mmp - -PRJ_EXPORTS -../public/remconbeareravrcp.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconbeareravrcp.h) - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/group/remconbeareravrcp.mmp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/group/remconbeareravrcp.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -// Copyright (c) 2004-2009 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: -// remconbeareravrcp.dll and resource file. AVRCP bearer plugin for Rem Con server. -// - - - -/** - @file -*/ - -#include - -TARGET remconbeareravrcp.dll -TARGETTYPE plugin - -UID 0x10009d8d 0x1020685e -VENDORID 0x70000001 - -SOURCEPATH ../src -SOURCE avrcpcommandframer.cpp -SOURCE avrcpfragmenter.cpp -SOURCE avrcpimplementationproxy.cpp -SOURCE avrcpincomingcommandhandler.cpp -SOURCE avrcpoutgoingcommandhandler.cpp -SOURCE avrcpremotedevice.cpp -SOURCE avrcprouter.cpp -SOURCE avrcputils.cpp -SOURCE remconbeareravrcp.cpp -SOURCE avrcpMetadataTransfer.cpp -SOURCE avrcpbrowsingcommandhandler.cpp -SOURCE browsingframe.cpp -SOURCE browsecommand.cpp -SOURCE avrcpadvancedcontrol.cpp -SOURCE avrcpplayerinfomanager.cpp -SOURCE playerbitmasks.cpp -SOURCE avrcpsdputils.cpp -SOURCE bulkbearer.cpp -SOURCE avrcpcommand.cpp -SOURCE playerstatewatcher.cpp -SOURCE controlcommand.cpp -SOURCE internalcommand.cpp -SOURCE passthroughhelper.cpp - - -START RESOURCE 1020685e.rss -TARGET remconbeareravrcp.rsc -END - -USERINCLUDE ../inc -USERINCLUDE ../../common - -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -LIBRARY avc.lib -LIBRARY ecom.lib -LIBRARY estor.lib -LIBRARY euser.lib -LIBRARY bluetooth.lib -LIBRARY bluetoothav.lib -LIBRARY sdpdatabase.lib -LIBRARY avctpservices.lib -LIBRARY remconbearerplugin.lib -LIBRARY remcontypes.lib -LIBRARY avrcpipc.lib -LIBRARY remconabsolutevolume.lib - -#include - - -UNPAGED - -SMPSAFE - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcp.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcp.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - - -#ifndef AVRCP_H -#define AVRCP_H - -/** -@file -@internalComponent -@released -*/ - -namespace AvrcpStatus - { - enum TCode - { - EInvalidCommand = 0, - EInvalidParameter = 1, - EParameterNotFound = 2, - EInternalError = 3, - ESuccess = 4, - EUidChanged = 5, - EReserved = 6, - EInvalidDirection = 7, - ENotADirectory = 8, - EDoesNotExist = 9, - EInvalidScope = 0xa, - ERangeOutOfBounds = 0xb, - EUidIsADirectory = 0xc, - EMediaInUse = 0xd, - ENowPlayingListFull = 0xe, - ESearchNotSupported = 0xf, - ESearchInProgress = 0x10, - EInvalidPlayerId = 0x11, - EPlayerNotBrowesable = 0x12, - EPlayerNotAddressed = 0x13, - ENoValidSearchResults = 0x14, - ENoAvailablePlayers = 0x15, - EAddressedPlayerChanged = 0x16, - }; - } - - -#endif // AVRCP_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpbearerinterface.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpbearerinterface.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#ifndef AVRCPBEARERINTERFACE_H -#define AVRCPBEARERINTERFACE_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include - -class MIncomingCommandHandler; -class MOutgoingCommandHandler; -NONSHARABLE_CLASS(MAvrcpBearer) - { -public: - virtual MIncomingCommandHandler* IncomingHandler(const TBTDevAddr& aAddr) = 0; - virtual MOutgoingCommandHandler* OutgoingHandler(const TBTDevAddr& aAddr) = 0; - - virtual void ConnectIndicate(const TBTDevAddr& aBTDevice) = 0; - virtual void ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError) = 0; - virtual void DisconnectIndicate(const TBTDevAddr& aBTDevice) = 0; - virtual void DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError) = 0; - }; - -#endif //AVRCPBEARERINTERFACE_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpbrowsingcommandhandler.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpbrowsingcommandhandler.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -// Copyright (c) 2008-2009 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: -// avrcpbrowsingincomingcommandhandler.h -// - -#ifndef AVRCPBROWSINGINCOMINGCOMMANDHANDLER_H -#define AVRCPBROWSINGINCOMINGCOMMANDHANDLER_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include -#include "avrcpplayerinfomanager.h" -#include "commandhandlerinterface.h" -#include "remconcommandinterface.h" - -class CBulkRouter; -class CAvrcpBulkBearer; -class TBTDevAddr; -class CBrowseCommand; -NONSHARABLE_CLASS(CRcpBrowsingCommandHandler) : public CBase, public MIncomingCommandHandler - { -public: - static CRcpBrowsingCommandHandler* NewL(MRemConBulkCommandInterface& aCommandInterface, - CBulkRouter& aRouter, - CAvrcpPlayerInfoManager& aPlayerInfoManager, - const TBTDevAddr& aAddr); - ~CRcpBrowsingCommandHandler(); - - void Disconnect(); - const TBTDevAddr& BtAddr() const; - -private: // from MIncomingCommandHandler - void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult); - void MaxPacketSize(TInt aMtu); - void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr); - - TInt SendRemConResponse(TUid aInterfaceUid, TUint aId, RBuf8& aData); - void SendReject(TUid aInterfaceUid, TUint aTransactionId); - -private: - CRcpBrowsingCommandHandler(MRemConBulkCommandInterface& aCommandInterface, - CBulkRouter& aRouter, - CAvrcpPlayerInfoManager& aPlayerInfoManager, - const TBTDevAddr& aAddr); - - void Respond(CBrowseCommand& aCommand, TInt aErr); - void HandledCommand(CBrowseCommand& aCommand); - - void HandleInternalCommand(CBrowseCommand& aCommand); - TInt HandleGetFolderItems(TUint aId, RBuf8& aCommandData); - void DoHandleGetFolderItemsL(RBuf8& aCommandData, RBuf8& aResponseData); - - TInt SendInternalResponse(TUint aId, RBuf8& aData); - TInt SendResponse(TDblQue& aCommandQueue, TUint aId, RBuf8& aData); - - TBool HandleSetBrowsedPlayer(CBrowseCommand& aCommand); - -private: - TDblQue iCommandQueue; - TDblQue iInternalCommandQueue; - - MRemConBulkCommandInterface& iCommandInterface; - CBulkRouter& iRouter; - - TInt iMtu; - - CAvrcpPlayerInfoManager& iPlayerInfoManager; - TBTDevAddr iAddr; - }; - -#endif //AVRCPBROWSINGINCOMINGCOMMANDHANDLER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpcommand.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpcommand.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#ifndef AVRCPCOMMAND_H -#define AVRCPCOMMAND_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include -#include -#include "avrcputils.h" - -class CAvrcpPlayerInfoManager; -/** -This class is a base class for all AVRCP commands. It provides -the functionality that is common between the AV/C and Browse -commands. -*/ -NONSHARABLE_CLASS(CAvrcpCommand) : public CBase - { -public: - // called from Router - void Sent(); - virtual SymbianAvctp::TMessageType MessageType() const = 0; - - // Called by users of command - void DecrementUsers(); - void IncrementUsers(); - - // Called from bearer - void GetCommandInfo(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TBTDevAddr& aAddr); - - virtual const TDesC8& Data() const = 0; - - const TBTDevAddr& RemoteAddress() const; - SymbianAvctp::TTransactionLabel TransactionLabel() const; - TUint RemConCommandId() const; - - const TUid& RemConInterfaceUid() const; - TUint RemConOperationId() const; - - TBool KnownToBearer() const; - -protected: - explicit CAvrcpCommand(TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransactionLabel, - const TBTDevAddr& aAddr); - -public: - TAvrcpDblQueLink iHandlingLink; // Used to form handling queue in command handlers - TAvrcpDblQueLink iReadyLink; // Used to form ready command queue in CRemConBearerAvrcp - TAvrcpDblQueLink iSendLink; // Used to form send queue in CRcpRouter - -protected: - TUint iRemConId; - SymbianAvctp::TTransactionLabel iTransactionLabel; - - TBTDevAddr iRemoteAddr; - - TUid iInterfaceUid; - TUint iOperationId; - RBuf8 iCommandData; - - TUint iUsers; - TBool iKnownToBearer; - - CAvrcpPlayerInfoManager* iPlayerInfoManager; - }; - -#endif //AVRCPCOMMAND_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpcommandframer.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpcommandframer.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef AVRCPCOMMANDFRAMER_H -#define AVRCPCOMMANDFRAMER_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include - -class CAVCFrame; -NONSHARABLE_CLASS(AvrcpCommandFramer) - { -public: - static CAVCFrame* PassthroughL(AVCPanel::TOperationId aOperationId, - AVCPanel::TButtonAction aButtonAction); - - static CAVCFrame* UnitInfoResponseL(); - static CAVCFrame* SubunitInfoResponseL(); - static CAVCFrame* SetAbsoluteVolumeCommandL(TUint8 aAbsVol); - static CAVCFrame* NotifyVolumeChangeCommandL(); - }; - -#endif // AVRCPCOMMANDFRAMER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpfragmenter.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpfragmenter.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - -#ifndef AVRCPFRAGMENTER_H -#define AVRCPFRAGMENTER_H - -/** -@file -@internalComponent -@released -*/ - -#define KAVRCPMinVendorDependentResponseLen 4 - -#include - -NONSHARABLE_CLASS(CAVRCPFragmenter) : public CBase - { -public: - static CAVRCPFragmenter* NewL(); - void Reset(); - void AssignPayload(const RBuf8& aPayload); - TBool InFragmentedState(); - TPtr8 GetNextFragmentHeader(); - TPtr8 GetNextFragment(); - TBool LastFragment(); - TInt GetPDU(); - ~CAVRCPFragmenter() { iPayload.Close(); } - -private: - CAVRCPFragmenter() {} - void Construct(); - -private: - RBuf8 iPayload; - TBool iInFragmentedState; - TInt iStart; - }; - -#endif // AVRCPFRAGMENTER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpincomingcommandhandler.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpincomingcommandhandler.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef AVRCPINCOMINGCOMMANDHANDLER_H -#define AVRCPINCOMINGCOMMANDHANDLER_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include -#include - -#include "controlcommand.h" -#include "avrcpplayerinfomanager.h" -#include "commandhandlerinterface.h" - -class CPassthroughHelper; -class CRcpRouter; -class MRemConControlCommandInterface; -class CAVCFrame; -class TBTDevAddr; -NONSHARABLE_CLASS(CRcpIncomingCommandHandler) : public CBase, public MPlayerChangeObserver, public MIncomingCommandHandler - { -public: - static CRcpIncomingCommandHandler* NewL(MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CRcpRouter& aRouter, - CDeltaTimer& aTimer, - CAvrcpPlayerInfoManager& aPlayerInfoManager, TBTDevAddr& aDevice); - void ConstructL(); - ~CRcpIncomingCommandHandler(); - - void Disconnect(); - - inline CAvrcpPlayerInfoManager& AvrcpPlayerInfoManager() const; - -private: // from MIncomingCommandHandler - void MaxPacketSize(TInt aMtu); - void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr); - void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult); - - TInt SendRemConResponse(TUid aInterfaceUid, TUint aId, RBuf8& aData); - void SendReject(TUid aInterfaceUid, TUint aId); - -private: - CRcpIncomingCommandHandler(MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CRcpRouter& aRouter, - CDeltaTimer& aTimer, - CAvrcpPlayerInfoManager& aPlayerInfoManager, - TBTDevAddr& aDevice); - - // From MPlayerChangeObserver - void MpcoAvailablePlayersChanged(); - void MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId); - void MpcoUidCounterChanged(TRemConClientId aClientId); - - void Respond(CControlCommand& aCommand, TInt aErr); - void HandledCommand(CControlCommand& aCommand); - - void HandleInternalCommand(CControlCommand& aCommand); - void HandleRemConCommand(CControlCommand& aCommand); - - TInt HandleSetAddressedPlayer(TUint aId, RBuf8& aCommandData); - void DoHandleSetAddressedPlayerL(RBuf8& aCommandData); - void AddressedPlayerChangedL(TRemConClientId aClientId); - - TInt HandleRegisterAvailablePlayersNotification(CControlCommand& aCommand); - void DoHandleRegisterAvailablePlayersNotificationL(RBuf8& aResponseData, CControlCommand& aCommand); - - TInt HandleRegisterAddressedPlayerNotification(CControlCommand& aCommand); - void DoHandleRegisterAddressedPlayerNotificationL(RBuf8& aResponseData, CControlCommand& aCommand); - - TInt HandleUidChangedNotification( CControlCommand& aCommand); - void DoHandleUidChangedNotificationL(RBuf8& aResponseData, TUint16 aUidCounter); - - void SendInternalResponse(TUint aId, RBuf8& aData); - void SendResponse(TDblQue& aCommandQueue, TUint aId, RBuf8& aData); - - void EnterAddressedMode(); - - // Timer functions - TBool DuplicateNotify(TDblQue& aCommandQueue, const CControlCommand& aCommand) const; - CControlCommand* FindNotify(TDblQue& aCommandQueue, TUid aInterfaceUid, TUint aOperationId); -private: - TDblQue iCommandQueue; - TDblQue iInternalCommandQueue; - - CAVRCPFragmenter* iFragmenter; - MRemConControlCommandInterface& iCommandInterface; - MRemConBearerObserver& iObserver; - CRcpRouter& iRouter; - CDeltaTimer& iTimer; - TRemConClientId iClientId; // We store the client id even if we aren't - // in addressed mode as we may switch into - // it and need to know the current local - // addressed player - TBool iAddressedMode; - - CAvrcpPlayerInfoManager& iPlayerInfoManager; - TBTDevAddr& iDevice; - - CPassthroughHelper* iPassthroughHelper; - }; - -CAvrcpPlayerInfoManager& CRcpIncomingCommandHandler::AvrcpPlayerInfoManager() const - { - return iPlayerInfoManager; - } - -#endif // AVRCPINCOMINGCOMMANDHANDLER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcplog.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcplog.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -// Copyright (c) 2005-2009 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: -// Declares logging and instrumentation for avrcp (when flogging active) -// - - - -/** - @file - @internalComponent -*/ - -#ifndef AVRCPLOG_H -#define AVRCPLOG_H - -#include - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BEARER); -#endif // __FLOG_ACTIVE - -#define AVRCPLOG(A) LOG(A) -#define AVRCPLOG2(A,B) LOG1(A,B) -#define AVRCPLOG3(A,B,C) LOG2(A,B,C) -#define AVRCPLOG4(A,B,C,D) LOG3(A,B,C,D) -#define AVRCPLOG5(A,B,C,D,E) LOG4(A,B,C,D,E) - -#endif //AVRCPLOG_H - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpoutgoingcommandhandler.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpoutgoingcommandhandler.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef AVRCPOUTGOINGCOMMANDHANDLER_H -#define AVRCPOUTGOINGCOMMANDHANDLER_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include -#include "commandhandlerinterface.h" - -using namespace SymbianAvctp; - -class CControlCommand; -class CRcpRouter; -class MRemConControlCommandInterface; -class MRemConBearerObserver; -NONSHARABLE_CLASS(CRcpOutgoingCommandHandler) : public CBase, public MOutgoingCommandHandler - { -public: - // Construction/Destruction - static CRcpOutgoingCommandHandler* NewL(MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CRcpRouter& aRouter, - CDeltaTimer& aTimer); - ~CRcpOutgoingCommandHandler(); - - // Called from bearer - void Disconnect(TBool aClearQueue); - - // Delta timer callback functions - static TInt ResponseExpiry(TAny* aExpiryInfo); - static TInt ReleaseExpiry(TAny* aExpiryInfo); - -private: - // From MOutgoingCommandHandler - void MaxPacketSize(TInt aMtu); - void ReceiveResponse(const TDesC8& aMessageInformation, TTransactionLabel aTransLabel, TBool aIpidBitSet); - void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult); - - void SendCommandL(TUid aInterfaceUid, - TUint aCommand, - TUint aId, - RBuf8& aCommandData, - const TBTDevAddr& aAddr); - - void SendNotifyCommandL(TUid aInterfaceUid, - TUint aCommand, - TUint aId, - RBuf8& aCommandData, - const TBTDevAddr& aAddr); - -private: - CRcpOutgoingCommandHandler(MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CRcpRouter& aRouter, - CDeltaTimer& aTimer); - - // Internal send utility funcs - void CleanupUnreleased(); - CControlCommand& SendCommandL(TUid aInterfaceUid, - TUint aCommand, - TUint aId, - RBuf8& aCommandData, - TBool isClick, - const TBTDevAddr& aAddr, - TBool aKnownToBearer, - TBool aNotify); - - void HandleCoreApiCommandL(TUint aCommand, - TUint aId, - RBuf8& aCommandData, - const TBTDevAddr& aAddr); - - void GenerateFailureResult(CControlCommand& aCommand, TInt aResult); - void GenerateCommandL(CControlCommand& aCommand, TRemConCoreApiButtonAction aButtonAct); - - // Timer functions - void ResponseExpiry(CControlCommand& aCommand); - void ReleaseExpiry(CControlCommand& aCommand); - void StartResponseTimer(CControlCommand& aCommand); - void StartReleaseTimer(CControlCommand& aCommand); - void ClearQueue(TDblQue& aQue); - void ProcessDisconnect(TDblQue& aQue, TBool aClearQueue); - CControlCommand* FindInQueue(TDblQue& aQue, SymbianAvctp::TTransactionLabel aTransLabel); - void ProcessReceiveResponse(CAVCFrame* aFrame, - TBool aIpidBitSet, - CControlCommand* aCommand, - TBool aNotify); -private: - TTransactionLabel iCurrentTrans; - TDblQue iCommandQueue; - TDblQue iNotifyCommandQueue; - - MRemConControlCommandInterface& iCommandInterface; - MRemConBearerObserver& iObserver; - CRcpRouter& iRouter; - CDeltaTimer& iTimer; - - CControlCommand* iUnreleasedCommand; - TBool iUnreleasedHasResponse; - TInt iReleaseTimerExpiryCount; - }; - -#endif // AVRCPOUTGOINGCOMMANDHANDLER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpplayerinfomanager.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -// 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" -// 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#ifndef AVRCPPLAYERINFOMANAGER_H -#define AVRCPPLAYERINFOMANAGER_H - -#include -#include -#include -#include -#include -#include -#include -#include "avrcpinternalinterface.h" -#include "avrcputils.h" -#include "playerbitmasks.h" -#include "playerstatewatcher.h" - -const TInt KAvrcpMediaPlayerItemBaseSize = 28; - -NONSHARABLE_CLASS(MPlayerChangeObserver) - { -public: - virtual void MpcoAvailablePlayersChanged() = 0; - virtual void MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId) = 0; - virtual void MpcoUidCounterChanged(TRemConClientId aClientId) = 0; - }; - -NONSHARABLE_STRUCT(TAvrcpMediaPlayerItem) - { -public: - TRemConClientId iId; - TUint8 iPlayerType; - TUint32 iPlayerSubType; - TPlayerFeatureBitmask iFeatureBitmask; - TPtrC8 iName; - // iUidCounter is set from the bulk thread and read from the control thread - TUint16 iUidCounter; - // iLastUpdatedUidCounter is only accessed from the control thread to see if an update - // is needed - TUint16 iLastUpdatedUidCounter; - MPlayerEventsObserver::TPlaybackStatus iPlaybackStatus; - TUint8 iSdpFeatures; - TBool iBulkClientAvailable; - // We store absolute volume support because it's returned as part of - // a GetCapabilities(EventIds) response. Some implementations poll - // for changes to this value so it's probably worthwhile avoiding - // having to ask RemCon for it repeatedly. - TBool iAbsoluteVolumeSupport; - }; - -class MIncomingCommandHandler; -class MRemConCommandInterface; -class CUidWatcher; -NONSHARABLE_CLASS(CAvrcpPlayerInfoManager) - : public CBase, public MUidObserver, public MPlayStatusObserver - { -//--------------------------------------------------------- -// Control thread only functions -//--------------------------------------------------------- -public: - static CAvrcpPlayerInfoManager* NewL(MRemConBearerObserver& aObserver, MRemConCommandInterface& aCommandInterface); - ~CAvrcpPlayerInfoManager(); - - // Interface to bearer/remcon - void ClientAvailable(const TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName); - void ClientNotAvailable(const TRemConClientId& aId); - void ClientStatus(TBool aControllerPresent, TBool aTargetPresent); - TInt SetLocalAddressedClient(const TRemConClientId& aId); - void ControllerFeaturesUpdatedL(RArray& aSupportedInterfaces); - void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); - MIncomingCommandHandler& InternalCommandHandler(); - - // Interface to command handler - void AddObserverL(MPlayerChangeObserver& aObserver); - void RemoveObserver(MPlayerChangeObserver& aObserver); - TUint16 UidCounterL(const TRemConClientId& aClientId) const; - TBool AbsoluteVolumeSupportedL(const TRemConClientId& aClientId) const; - TBool BrowsingSupportedL(const TRemConClientId& aClientId) const; - -private: - // Interface to uid counter updates - static TInt PlayerUpdateCallBack(TAny* aPlayerInfoMgr); - void UidCounterUpdate(); - - // from MPlayStatusObserver - void MpsoPlayStatusChanged(TRemConClientId aId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus); - void MpsoError(TRemConClientId aId); - - // Helper function for ClientAvailable and TargetFeaturesUpdated - TInt SetItemDetails(TAvrcpMediaPlayerItem& aItem, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); - void UpdateSdpRecord(const TAvrcpMediaPlayerItem& aItem); - -//--------------------------------------------------------- -// Bulk thread only functions -//--------------------------------------------------------- -public: - // Interface to bearer/remcon - void BulkClientAvailable(const TRemConClientId& aId); - void BulkClientNotAvailable(const TRemConClientId& aId); - MIncomingCommandHandler* BulkStartedL(MRemConCommandInterface& aCommandInterface); - void BulkStopped(); - - // Interface to command handler - void MediaPlayerItemL(const TUint16& aAvrcpPlayerId, RMediaPlayerItem& aItem); - - -private: // from MUidObserver - void MuoUidChanged(TRemConClientId aId, TUint16 aUidCounter); - void MuoError(TRemConClientId aId); - - - -//--------------------------------------------------------- -// Common functions -//--------------------------------------------------------- -public: - // Used to map between AVRCP player ids and RemCon client ids - TRemConClientId ClientL(TUint16 aAvrcpPlayerId) const; - TRemConClientId Client(TUint16 aAvrcpPlayerId) const; - TUint16 PlayerL(const TRemConClientId& aClientId) const; - - // Used to retrieve list of current players - TInt PlayerListing(TUint aStartItem, TUint aEndItem, RArray& aPlayers); - TInt PlayerListing(RArray& aPlayers); - -private: - CAvrcpPlayerInfoManager(MRemConBearerObserver& aObserver); - void ConstructL(MRemConCommandInterface& aCommandInterface); - - TBool ValidPlayer(const TUint16& aAvrcpPlayerId) const; - TInt NextPlayerIndex(); - TInt SetPlayerFeatures(const TRemConClientId& aId, TPlayerFeatureBitmask& aBitmask, TUint8& aSdpFeatures, TBool& aAbsoluteVolumeSupported); - void UpdateTgServiceRecordL(); - -private: - RPointerArray iObservers; - RArray iPlayers; - CUidWatcher* iUidWatcher; - CPlayStatusWatcher* iPlayStatusWatcher; - MRemConBearerObserver& iControlBearerObserver; // unowned - used to determine features of players - RSpecificThreadCallBack iControlThreadCallBack; - - RSdp iSdp; - RSdpDatabase iSdpDatabase; - TSdpServRecordHandle iControllerRecord; - TSdpServRecordHandle iTargetRecord; - - mutable RFastLock iLock; // for use in const functions - }; - -// The lock is only used for the following members.... -// - -#endif //AVRCPPLAYERINFOMANAGER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpremotedevice.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpremotedevice.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef AVRCPREMOTEDEVICE_H -#define AVRCPREMOTEDEVICE_H - -/** -@file -@internalComponent -@released -*/ - -#include - -class MRemConControlCommandInterface; -class MIncomingCommandHandler; -class MOutgoingCommandHandler; -class CRcpIncomingCommandHandler; -class CRcpOutgoingCommandHandler; -class CRcpRouter; -class MRemConBearerObserver; -/** -CRcpRemoteDevice represents one remote RCP device. It manages -the sending and receiving of commands between that device and the -local device. -*/ -NONSHARABLE_CLASS(CRcpRemoteDevice) : public CBase - { -public: - static CRcpRemoteDevice* NewL(const TBTDevAddr& aAddr, - CRcpRouter& aRouter, - MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CDeltaTimer& aTimer, - CAvrcpPlayerInfoManager& aPlayerInfoManager); - - virtual ~CRcpRemoteDevice(); - - void Disconnect(TBool aClearQueue); - - // Utility - const TBTDevAddr& RemoteAddress() const; - MIncomingCommandHandler& IncomingHandler() const; - MOutgoingCommandHandler& OutgoingHandler() const; - -private: - CRcpRemoteDevice(const TBTDevAddr& aAddr, - CRcpRouter& aRouter, - MRemConControlCommandInterface& aCommandInterface, - CDeltaTimer& aTimer); - - void ConstructL(MRemConBearerObserver& aObserver, - CAvrcpPlayerInfoManager& aPlayerInfoManager); - -public: - TDblQueLink iLink; // Used by bearer and router to manage remotes -private: - TBTDevAddr iDevice; - - CRcpIncomingCommandHandler* iIncoming; - CRcpOutgoingCommandHandler* iOutgoing; - - CRcpRouter& iRouter; - MRemConControlCommandInterface& iCommandInterface; - CDeltaTimer& iTimer; - }; - - -#endif // AVRCPREMOTEDEVICE_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcprouter.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcprouter.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef AVRCPROUTER_H -#define AVRCPROUTER_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include -#include "avrcp.h" -#include "avrcpbearerinterface.h" - - -class CAvrcpCommand; -class CBrowseCommand; - -NONSHARABLE_CLASS(CRcpRouter) : public CBase, public MAvctpEventNotify - { -private: - enum TAvrcpRouterState - { - EAvrcpRouterSending, - EAvrcpRouterCanSend - }; - -public: - ~CRcpRouter(); - - // Data functions called from command handlers - void AddToSendQueue(CAvrcpCommand& aCommand); - void RemoveFromSendQueue(CAvrcpCommand& aCommand); - - // Control functions called from bearer - TInt ConnectRequest(const TBTDevAddr& aAddr); - TInt DisconnectRequest(const TBTDevAddr& aAddr); - - // MAvctpEventNotify functions - virtual void MaenAttachIndicate(const TBTDevAddr& aBTDevice, TInt aMtu, TBool& aAccept); - - virtual void MaenAttachConfirm(const TBTDevAddr& aBTDevice, TInt aMtu, TInt aConnectResult); - - virtual void MaenDetachIndicate(const TBTDevAddr& aBTDevice); - - virtual void MaenDetachConfirm(const TBTDevAddr& aBTDevice, TInt aDisconnectResult); - - virtual void MaenMessageReceivedIndicate(const TBTDevAddr& aBTDevice, - SymbianAvctp::TTransactionLabel aTransactionLabel, - SymbianAvctp::TMessageType aType, - TBool aIpidBitSet, - const TDesC8& aMessageInformation); - - virtual void MaenMessageSendComplete(const TBTDevAddr& aBTDevice, - SymbianAvctp::TTransactionLabel aTransactionLabel, - TInt aSendResult); - - virtual void MaenCloseComplete(); - - virtual void MaenErrorNotify(const TBTDevAddr& aBTDevice, TInt aError); - - virtual void MaenExtensionInterfaceL(TUid aInterface, void*& aObject); - -protected: - explicit CRcpRouter(MAvrcpBearer& aBearer); - -private: - // Utility functions - void Send(); - -protected: - MAvctpChannel* iChannel; - MAvrcpBearer& iBearer; - - TDblQue iSendQueue; - TAvrcpRouterState iState; -// TAvctpChannel iChannel; - - }; - -NONSHARABLE_CLASS(CControlRouter) : public CRcpRouter - { -public: - static CControlRouter* NewL(RAvctp& aAvctp, MAvrcpBearer& aBearer); - ~CControlRouter(); - -private: - explicit CControlRouter(RAvctp& aAvctp, MAvrcpBearer& aBearer); - void ConstructL(); - -private: - RAvctp& iAvctp; - }; - -NONSHARABLE_CLASS(CBulkRouter) : public CRcpRouter - { -public: - static CBulkRouter* NewL(RAvctp& aAvctp, MAvrcpBearer& aBearer); - ~CBulkRouter(); - -private: - explicit CBulkRouter(RAvctp& aAvctp, MAvrcpBearer& aBearer); - void ConstructL(); - -private: - RAvctp& iAvctp; - }; -#endif // AVRCPROUTER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpsdputils.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcpsdputils.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent -*/ - -#ifndef AVRCPSDPUTILS_H -#define AVRCPSDPUTILS_H - -#include -#include - -namespace AvrcpSdp - { - enum TRecordType - { - ERemoteControl, - ERemoteControlTarget, - }; - - _LIT8(KAvrcpProviderName, "Symbian OS"); - _LIT8(KAvrcpTargetServiceName, "AVRCP Target"); - _LIT8(KAvrcpControllerServiceName, "AVRCP Controller"); - _LIT8(KAvrcpServiceDescription, "Audio Video Remote Control"); - - const TUint16 KAvrcpProfileVersion14 = 0x0104; - const TUint16 KAvrcpProfileVersion13 = 0x0103; - const TUint16 KAvctpProtocolVersion13 = 0x103; - const TUint16 KAvctpProtocolVersion12 = 0x102; - - enum TAvrcpFeature - { - EPlayerRecorder = 1 << 0, - EMonitorAmplifier = 1 << 1, - ETuner = 1 << 2, - EMenu = 1 << 3, - EPlayer = 1 << 4, - EGroupNavigation = 1 << 5, - EBrowsing = 1 << 6, - EMultiplePlayers = 1 << 7, - }; - - const TUint16 KAvrcpBaseCtFeatures = EPlayerRecorder | - EMonitorAmplifier | - ETuner | - EMenu; - - const TUint16 KAvrcpBaseTgFeatures = EPlayerRecorder | - EMonitorAmplifier | - ETuner | - EMenu | - EMultiplePlayers; - } - -NONSHARABLE_CLASS(AvrcpSdpUtils) - { -public: - static void CreateServiceRecordL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TBool aTarget, TUint16 aProfileVersion); - static void UpdateProtocolDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProtocolVersion); - static void UpdateAdditionalProtocolDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle); - static void UpdateBrowseListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle); - static void UpdateProfileDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProfileVersion); - static void UpdateSupportedFeaturesL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, AvrcpSdp::TRecordType aType, TUint16 aFeatures); - }; - -#endif // AVRCPSDPUTILS_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcptimer.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcptimer.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef AVRCPTIMER_H -#define AVRCPTIMER_H - -/** -@file -@internalComponent -@released -*/ - -#include - -class CControlCommand; -NONSHARABLE_CLASS(TAvrcpTimerExpiryInfo) - { -public: - inline TAvrcpTimerExpiryInfo(CBase* aHandler, CControlCommand& aCommand); -public: - CBase* iHandler; - CControlCommand& iCommand; - }; - - -//------------------------------------------------------------------------------------ -// TAvrcpTimerEntry -//------------------------------------------------------------------------------------ - -/** Constructor. - -@param aHandler The CommandHandler to be informed on timer expiry. -@param aCommand The CControlCommand that this timer event relates to. -@return A fully constructed TAvrcpTimerExpiryInfo. -*/ -inline TAvrcpTimerExpiryInfo::TAvrcpTimerExpiryInfo(CBase* aHandler, CControlCommand& aCommand) - : iHandler(aHandler), iCommand(aCommand) - { - } - -#endif // AVRCPTIMER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcputils.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/avrcputils.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef AVRCPUTILS_H -#define AVRCPUTILS_H - -/** -@file -@internalComponent -@released -*/ - -_LIT(KAvrcpPanicName, "AVRCP Panic"); - -enum TAvrcpPanic - { - EAvrcpNoAVCFrame = 0, - EAvrcpNotConnected = 1, - EAvrcpNoOutstandingSend = 2, - EAvrcpHoldExpiryForRelease = 3, - EAvrcpReleaseExpiryForRelease = 4, - EAvrcpUnknownAvctpTransId = 5, - EAvrcpNoResponsesAvailable = 6, - EAvrcpResponseToUnknownCommand = 7, - EAvrcpBadBTAddr = 8, - EAvrcpCommandStillInUse = 9, - EAvrcpCommandDataTooLong = 10, - EAvrcpFunnyLengthData = 11, - EAvrcpTimerNotCancelled = 12, - EAvrcpNotVendorDependent = 13, - EAvrcpMismatchedConnectDisconnect = 14, - EAvrcpDummyCallbackCalled = 15, - EAvrcpUnknownButtonAction = 16, - EAvrcpPressHasPhantomResponse = 17, - EAvrcpReleaseTimerStartedWithoutResponse = 18, - EAvrcpReleaseExpiryForOldCommand = 19, - EAvrcpSendingMessageFailed = 20, - EAvrcpDisconnectRequestWhilePartiallyConstructed = 21, - EAvrcpReleaseExpiryForClick = 22, - EAvrcpIncomingCommandsNotHandled = 23, - EAvrcpCommandStillQueuedForHandling = 24, - EAvrcpCommandStillQueuedAsReady = 25, - EAvrcpCommandStillQueuedForSending = 26, - EAvrcpPressNotPreviousPassthroughCommand = 27, - EAvrcpInterfaceUidNotSet = 28, - EAvrcpCTypeNotSet = 29, - EAvrcpCompanyIDNotSet = 30, - EAvrcpNotFullyConstructed = 31, - EAvrcpInternalHandlingRequestedOnWrongInterface = 32, - EAvrcpVolumeBeyondMaxVolume = 33, - EAvrcpInvalidEventId = 34, - EAvrcpInvalidPlayerId = 35, - EAvrcpConnectConfirmOnBrowseChannel = 36, - EAvrcpDisconnectConfirmOnBrowseChannel = 37, - EAlreadyWatchingPlayer = 38, - ENotWatchingPlayer = 39, - EAvctpMessageTypeRequestedForInternalCommand = 40, - ELowerInterfaceUsedOnInternalHandler = 41, - EFurtherProcessingRequiredForNonSetBrowsedPlayer = 42, - ESetBrowsePlayerRequestCorruptedLocally = 43, - ESpecificAddressUsedForBrowsingCommand = 44, - EUidUpdateRequestWriteFailure = 45, - EUnmatchedResponseFromRemCon = 46, - EResponseForWrongInterface = 47, - EInvalidBtAddrInResponse = 48, - EInvalidPlayerId = 49, - EMysteryInternalResponse = 50, - ECommandAlreadyQueuedForSending = 52, - EPassthroughQueueNotEmptyAfterDisconnect = 53, - EPreviousPassthroughNonNullReplacing = 54, - ETooManyRemotesRegisterForLocalAddressedPlayerUpdates = 55, - ETooFewRemotesRegisterForLocalAddressedPlayerUpdates = 56, - }; - -template -struct TAvrcpPanicCodeTypeChecker - { - inline static void Check(XAny) { } - }; - -#define AVRCP_PANIC(CODE) \ - TAvrcpPanicCodeTypeChecker::Check(CODE), \ - PANIC(KAvrcpPanicName, CODE) - - -class TBTDevAddr; -class TRemConAddress; -class AvrcpUtils - { -public: - static void Panic(TAvrcpPanic aPanic); // The macro is probably more useful so this can be removed - - static void SetCommandDataFromInt(RBuf8& aCommandData, TInt aOffset, TInt aLength, TInt aValue); - static void ReadCommandDataToInt(const RBuf8& aCommandData, TInt aOffset, TInt aLength, TInt& aValue); - - static TInt RemConToBTAddr(const TRemConAddress& aRemoteAddress, TBTDevAddr& aBTAddr); - static void BTToRemConAddr(const TBTDevAddr& aBTAddr, TRemConAddress& aRemConAddress); - }; - -// -// Thread Assertions -// - -enum TAvrcpThreadId - { - EControlThread = 0x00000001, - EBulkThread = 0x00000002, - }; - -#define ASSERT_THREAD(aaa) ASSERT_DEBUG(reinterpret_cast(Dll::Tls()) == aaa) -#define WEAK_ASSERT_THREAD(aaa) if(Dll::Tls()) { ASSERT_THREAD(aaa); } -#define ASSERT_CONTROL_THREAD ASSERT_THREAD(EControlThread) -#define ASSERT_BULK_THREAD ASSERT_THREAD(EBulkThread) -#define WEAK_ASSERT_BULK_THREAD WEAK_ASSERT_THREAD(EBulkThread) - -// -// Cleanup Stack utils -// - -template -class CleanupSignal - { -public: - inline static void PushL(T& aRef) {CleanupStack::PushL(TCleanupItem(&Signal,&aRef));}; -private: - static void Signal(TAny *aPtr) {(static_cast(aPtr))->Signal();}; - }; - -template -inline void CleanupSignalPushL(T& aRef) - {CleanupSignal::PushL(aRef);} - -template -class CleanupDeleteAndNull - { -public: - inline static void PushL(T*& aRef) {CleanupStack::PushL(TCleanupItem(&DeleteAndNull,&aRef));}; -private: - static void DeleteAndNull(TAny *aPtr) {T*& ptr = *static_cast(aPtr); delete ptr; ptr = NULL;}; - }; - -template -inline void CleanupDeleteAndNullPushL(T*& aRef) - {CleanupDeleteAndNull::PushL(aRef);} - -class CSpecificThreadCallBackBody; -NONSHARABLE_CLASS(RSpecificThreadCallBack) - { -public: - RSpecificThreadCallBack(); - - TInt Create(const TCallBack& aCallBack, TInt aPriority); - void Close(); - - TInt Start(); - TInt CallBack(); - void Cancel(); - -private: - CSpecificThreadCallBackBody* iBody; - }; - -/** -An extended double queue link class to provide additional features. -*/ -NONSHARABLE_CLASS(TAvrcpDblQueLink) : public TDblQueLink - { - public: - inline TBool IsQueued() const; - }; - -/** -Indicates whether the queue link is attached to a queue. -@return True if the link is queued, false otherwise. -*/ -inline TBool TAvrcpDblQueLink::IsQueued() const - { - return iNext ? ETrue : EFalse; - } - -#endif // AVRCPUTILS_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/browsecommand.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/browsecommand.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#ifndef BROWSECOMMAND_H -#define BROWSECOMMAND_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include -#include -#include "avrcpcommand.h" -#include "avrcpplayerinfomanager.h" - -const TInt KMinLengthSetBrowsedPlayerPdu = 2; // PDU 0x70 -const TInt KMinLengthGetFolderItemsPdu = 10; // PDU 0x71 -const TInt KMinLengthChangePathPdu = 3; // PDU 0x72 -const TInt KMinLengthGetItemAttributesPdu = 12; // PDU 0x73 -const TInt KMinLengthSearchPdu = 4; // PDU 0x80 -const TInt KMinLengthGeneralReject = 4; // PDU 0xa0 - -class CRcpRemoteDevice; -class MRemConBearerObserver; -NONSHARABLE_CLASS(CBrowseCommand) : public CAvrcpCommand - { -public: - static CBrowseCommand* NewL(const TDesC8& aMessageInformation, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransLabel, - const TBTDevAddr& aAddr, - CAvrcpPlayerInfoManager* aPlayerInfoManager); - - // Called from handlers - TInt ProcessIncomingCommandL(TInt aMaxResponse); - void ProcessOutgoingResponse(RBuf8& aCommandData); - void SetResult(TInt aErr); - const TDesC8& CommandData() const; - - const TDesC8& Data() const; - virtual SymbianAvctp::TMessageType MessageType() const; - -private: - CBrowseCommand(TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransLabel, - const TBTDevAddr& aAddr, - CAvrcpPlayerInfoManager* aPlayerInfoManager); - - ~CBrowseCommand(); - void ConstructL(const TDesC8& aMessageInformation); - - TInt HandleSetBrowsedPlayer(); - TInt HandleGetFolderItems(); - TInt HandleChangePath(); - TInt HandleGetItemAttributes(); - TInt HandleSearch(); - TInt HandleUnknownPdu(); - - TInt AppendIncomingPayload(const TPtrC8& aPayload); - void GenerateRejectPayloadL(TInt aErr); - -private: - RBuf8 iFrame; - TInt iMaxResponse; - }; - -#endif //BROWSECOMMAND_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/bulkbearer.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/bulkbearer.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#ifndef BULKBEARER_H -#define BULKBEARER_H - -#include -#include - -#include "remconcommandinterface.h" - -class CBrowseCommand; -class CRcpBrowsingCommandHandler; -class TBTDevAddr; -class TRemConAddress; - -NONSHARABLE_CLASS(CAvrcpBulkBearer) : public CBase, public MRemConBearerBulkInterface, - public MAvrcpBearer, public MRemConBulkCommandInterface - { -public: - static CAvrcpBulkBearer* NewL(RAvctp& aAvctp, CAvrcpPlayerInfoManager& aPlayerInfoManager); - ~CAvrcpBulkBearer(); - -private: // Interface to command handlers, from MRemConCommandInterface - void MrcciNewCommand(CAvrcpCommand& aCommand); - void MrcciNewCommand(CAvrcpCommand& aCommand,const TRemConClientId& aClientId); - - TUint MrcciNewTransactionId(); - void MrcciCommandExpired(TUint aTransactionId); - - TInt MrcbciSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient); - void MrcbciRemoveAddressing(const TRemConAddress& aAddr); - -private: // Interface to router, from MAvrcpBearer - MIncomingCommandHandler* IncomingHandler(const TBTDevAddr& aAddr); - MOutgoingCommandHandler* OutgoingHandler(const TBTDevAddr& aAddr); - - void ConnectIndicate(const TBTDevAddr& aBTDevice); - void ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError); - void DisconnectIndicate(const TBTDevAddr& aBTDevice); - void DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError); - -private: // interface to RemCon, from MRemConBulkBearerInterface - virtual TInt MrcbbiGetCommand(TUid& aInterfaceUid, - TUint& aTransactionId, - TUint& aOperationId, - RBuf8& aData, - TRemConAddress& aAddr); - - virtual TInt MrcbbiSendResponse(TUid aInterfaceUid, - TUint aOperationId, - TUint aTransactionId, - RBuf8& aData, - const TRemConAddress& aAddr); - - virtual void MrcbbiSendReject(TUid aInterfaceUid, - TUint aOperationId, - TUint aTransactionId, - const TRemConAddress& aAddr); - - virtual TInt MrcbbiStartBulk(MRemConBearerBulkObserver& aObserver); - virtual void MrcbbiStopBulk(); - - virtual void MrcbbiBulkClientAvailable(const TRemConClientId& aId); - virtual void MrcbbiBulkClientNotAvailable(const TRemConClientId& aId); - -private: - explicit CAvrcpBulkBearer(CAvrcpPlayerInfoManager& aPlayerInfoManager, RAvctp& aAvctp); - - // utility functions - TBool Operational() const; - void DoConnectIndicateL(const TBTDevAddr& aBTDevice); - void DoStartBulkL(); - static TBool CompareBrowsingCommandHandlerByBDAddr(const TBTDevAddr* aKey, const CRcpBrowsingCommandHandler& aHandler); - void DoNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId); -private: // unowned - MRemConBearerBulkObserver* iObserver; - CAvrcpPlayerInfoManager& iPlayerInfoManager; - RAvctp& iAvctp; - MIncomingCommandHandler* iInternalHandler; - - TDblQue iReadyBrowseCommands; - -private: // owned - CBulkRouter* iRouter; - RPointerArray iBrowseHandlers; - - }; - -#endif //BULKBEARER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/commandhandlerinterface.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/commandhandlerinterface.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#ifndef COMMANDHANDLERINTERFACE_H -#define COMMANDHANDLERINTERFACE_H - -/** -@file -@internalComponent -@released -*/ - -#include - -class CAvrcpCommand; -NONSHARABLE_CLASS(MAvrcpCommandHandler) - { -public: - virtual void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult) = 0; - }; - -NONSHARABLE_CLASS(MIncomingCommandHandler) : public MAvrcpCommandHandler - { -public: - // lower interface - virtual void MaxPacketSize(TInt aMtu) = 0; - virtual void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr) = 0; - - // upper interface - virtual TInt SendRemConResponse(TUid aInterfaceUid, TUint aId, RBuf8& aData) = 0; - virtual void SendReject(TUid aInterfaceUid, TUint aTransactionId) = 0; - }; - -NONSHARABLE_CLASS(MOutgoingCommandHandler) : public MAvrcpCommandHandler - { -public: - // lower interface - virtual void ReceiveResponse(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, TBool aIpidBitSet) = 0; - - // upper interface - virtual void SendCommandL(TUid aInterfaceUid, - TUint aCommand, - TUint aId, - RBuf8& aCommandData, - const TBTDevAddr& aAddr) = 0; - - virtual void SendNotifyCommandL(TUid aInterfaceUid, - TUint aCommand, - TUint aId, - RBuf8& aCommandData, - const TBTDevAddr& aAddr) = 0; - }; - -#endif // COMMANDHANDLERINTERFACE_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlbearer.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -// 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" -// 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: -// - -#ifndef CONTROLBEARER_H -#define CONTROLBEARER_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "avrcpbearerinterface.h" -#include "remconcommandinterface.h" - -class CControlCommand; -class CRcpRemoteDevice; -class CControlRouter; -class TBTDevAddr; -class CBrowseCommand; -class CAvrcpPlayerInfoManager; -class CAvrcpBulkBearer; - -NONSHARABLE_CLASS(CRemConBearerAvrcp) : public CRemConBearerPlugin, public MRemConBearerInterfaceV3, - public MAvrcpBearer, public MRemConControlCommandInterface - { -public: - static CRemConBearerAvrcp* NewL(TBearerParams& aParams); - virtual ~CRemConBearerAvrcp(); - -public: // Interface to command handlers, from MRemConCommandInterface - void MrcciNewCommand(CAvrcpCommand& aCommand); - void MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId); - void MrccciNewNotifyCommand(CAvrcpCommand& aCommand); - void MrccciNewNotifyCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId); - - void MrccciNewResponse(CAvrcpCommand& aCommand); - void MrccciNewNotifyResponse(CControlCommand& aCommand); - - TUint MrcciNewTransactionId(); - void MrcciCommandExpired(TUint aTransactionId); - - void MrccciSetAddressedClient(const TRemConClientId& aClient); - void MrccciRegisterForLocalAddressedClientUpdates(); - void MrccciUnregisterForLocalAddressedClientUpdates(); - -private: // MRemConBearerInterfaceV3 functions called from RemCon - virtual TInt GetResponse(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr); - - virtual TInt SendCommand(TUid aInterfaceUid, - TUint aOperationId, - TUint aId, - RBuf8& aData, - const TRemConAddress& aAddr); - - virtual TInt GetCommand(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr); - - virtual TInt GetNotifyCommand(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr); - - virtual CAvrcpCommand* GetFirstCommand(TDblQue& aQue, - TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr); - - virtual TInt SendResponse(TUid aInterfaceUid, - TUint aOperationId, - TUint aId, - RBuf8& aData, - const TRemConAddress& aAddr); - - virtual void SendReject(TUid aInterfaceUid, - TUint aOperationId, - TUint aTransactionId, - const TRemConAddress& aAddr); - virtual void ConnectRequest(const TRemConAddress& aAddr); - virtual void DisconnectRequest(const TRemConAddress& aAddr); - - virtual TSecurityPolicy SecurityPolicy() const; - void ClientStatus(TBool aControllerPresent, TBool aTargetPresent); - virtual void ClientAvailable(TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName); - virtual void ClientNotAvailable(TRemConClientId& aId); - virtual void ControllerFeaturesUpdated(RArray& aSupportedInterfaces); - - virtual TInt SetLocalAddressedClient(TRemConClientId& aId); - - virtual void TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName); - -private: // from CRemConBearerPlugin - TAny* GetInterface(TUid aUid); - -private: - // from MAvrcpBearer called from router - void ConnectIndicate(const TBTDevAddr& aBTDevice); - void ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError); - void DisconnectIndicate(const TBTDevAddr& aBTDevice); - void DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError); - - MIncomingCommandHandler* IncomingHandler(const TBTDevAddr& aAddr); - MOutgoingCommandHandler* OutgoingHandler(const TBTDevAddr& aAddr); - -private: - // MRemConBearerInterfaceV3 plugin functions called from RemCon - virtual TInt SendNotifyCommand(TUid aInterfaceUid, - TUint aOperationId, - TUint aId, - RBuf8& aData, - const TRemConAddress& aAddr); - - virtual TInt GetNotifyResponse(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr, - TRemConMessageSubType& aSubMessageType); - -private: - enum TAvrcpRecordType - { - EAvrcpRemoteControlRecord, - EAvrcpRemoteControlTargetRecord, - }; - -private: - CRemConBearerAvrcp(TBearerParams& aParams); - void ConstructL(); - - // utility functions - CRcpRemoteDevice* RemoteDevice(const TBTDevAddr& aAddr); - - void UpdateServiceRecordL(RSdpDatabase& aSdpDatabase, - TBool aController, - TBool aTarget); - void RegisterServiceRecordL(RSdpDatabase& aSdpDatabase, - TAvrcpRecordType aType); - - void HandleUndeliveredCommand(CAvrcpCommand& aCommand, const TRemConAddress& aAddr); - -private: - TDblQue iRemotes; - TDblQue iReadyCommands; - TDblQue iReadyResponses; - TDblQue iReadyNotifyResponses; - TDblQue iReadyNotifyCommands; - CControlRouter* iRouter; - CDeltaTimer* iTimer; - RSdp iSdp; - TSdpServRecordHandle iControllerSdpRecordHandle; - TSdpServRecordHandle iTargetSdpRecordHandle; - TBool iConstructionComplete; - CAvrcpPlayerInfoManager* iPlayerInfoManager; - MIncomingCommandHandler* iInternalHandler; - - CAvrcpBulkBearer* iBulkBearer; - - RAvctp iAvctp; - - TInt iRemotesInterestedInLocalAddressedClient; - }; - -#endif //CONTROLBEARER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlcommand.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/controlcommand.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,276 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef CONTROLCOMMAND_H -#define CONTROLCOMMAND_H - -/** -@file -@internalComponent -@released -*/ - -#include -#include -#include -#include -#include - -#include - -#include "avrcpcommand.h" -#include "avrcptimer.h" -#include "avrcpfragmenter.h" - -const TInt KRcpResponseTimeOut = 30000000; // Allow remote 300ms to respond -const TInt KRcpHoldThreshold = 300000; // After 300ms we may assume an unreleased button - // action is a press and hold -const TInt KRcpIncomingButtonReleaseTimeout = 1700000; // 1.7s (ie 2s - 300ms), if a button press - // has not been released after 2s we assume the release - // has been lost (and generate one internally) -const TInt KRcpOutgoingButtonReleaseTimeout = 1000000; // The remote expects a press refresh within - // 2s, it's fine to send one before that. - -const TUint KRemConStatusApiDefaultPageDataLength = 4; -const TUint KRemConMetadataHeaderLength = 4; - -// Absolute lengths of Vendor Dependent PDU requests -const TUint8 KLengthGetCapabilitiesPdu = 1; // PDU 0x10 -const TUint8 KLengthListPASAttributesPdu = 0; // PDU 0x11 -const TUint8 KLengthListPASValuesPdu = 1; // PDU 0x12 -const TUint8 KLengthInformBatteryStatusOfCTPdu = 1; // PDU 0x18 -const TUint8 KLengthGetPlayStatusPdu = 0; // PDU 0x30 -const TUint8 KLengthRegisterNotification = 5; // PDU 0x31 -const TUint8 KLengthSetAddressedPlayerPdu = 2; // PDU 0x60 - -// Minimum lengths of Vendor Dependent PDU requests -const TUint8 KMinLengthGetCurrentPASValuePdu = 2; // PDU 0x13 -const TUint8 KMinLengthSetPASValuePdu = 1; // PDU 0x14 -const TUint8 KMinLengthGetPASAttributeTextPdu = 2; // PDU 0x15 -const TUint8 KMinLengthGetPASValueTextPdu = 3; // PDU 0x16 -const TUint8 KMinLengthGetElementAttributesPdu = 9; // PDU 0x20 -const TUint8 KMinLengthAddToNowPlayingPdu = 11; // PDU 0x90 - -// Other lengths -const TUint8 KLengthPlaybackPosChangedParam = 4; // Parameter length for this event (section 5.4.2) -const TUint8 KVendorDependentNumberAttributes = 0; // Index to Number of attributes (the first byte) -const TUint8 KVendorDependentNumberAttribsPdu16 = 1; // Index to Number of attributes for PDU 0x16 (the second byte) -const TUint8 KVendorDependentEventId = 0; // Index to Event Id (the first byte) - -enum TMetadataTransferErrorCodes - { - EInvalidCommand = 0x0, - EInvalidParameter = 0x1, - EParameterNotFound = 0x2, - EInternalError = 0x3, - }; - -enum TMetaDataTransferPacketType - { - EUnfragmented = 0x0, - EFragmentStart = 0x1, - EFragmentContinue = 0x2, - EFragmentEnd = 0x3, - }; - -// Format of the first 3 bytes of a Vendor Dependent Request -// See example packets in AVRCP Specification Appendix I (page 84) -const TUint8 KVendorDependentRequestPDUId = 0; -const TUint8 KVendorDependentRequestReservedByte = 1; -const TUint8 KVendorDependentRequestParamLenMSB = 2; -const TUint8 KVendorDependentRequestParamLenLSB = 3; - -//See example packets in AVRCP Specification Appendix D (Volume Change Notification) -const TUint8 KVendorDependentNotifyEventIdOffset = 4; - -// Format of the first 2 bytes of a Pass Through Request -// See example packets in AVRCP Specification Appendix I (page 89) -const TUint8 KPassThroughRequestOperationIdMSB = 0; -const TUint8 KPassThroughRequestOperationIdLSB = 1; - -const TInt KSetAddressedPlayerPlayerIdOffset = 0; - -const TInt KCapabilityIdOffset = 0; - -const TInt KNumberEventsNotInPlayerInfoApi = 5; - -typedef TUint8 TMetadataTransferPDUID; -typedef TUint8 TMetadataTransferNotifyEventID; - -class CRcpRemoteDevice; -class CAVRCPFragmenter; -class CRcpIncomingCommandHandler; -class MRemConBearerObserver; -class CAvrcpPlayerInfoManager; -class CAvrcpPlayerInfoManager; -NONSHARABLE_CLASS(CControlCommand) : public CAvrcpCommand - { -public: - static CControlCommand* NewL(TUid aInterfaceUid, - TUint aCommand, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransactionLabel, - RBuf8& aCommandData, - TBool aIsClick, - const TBTDevAddr& aAddr, - TBool aKnownToBearer); - - static CControlCommand* NewL(CAVCFrame* aFrame, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransLabel, - const TBTDevAddr& aAddr, - const TRemConClientId& aClientId, - CAvrcpPlayerInfoManager* aPlayerInfoManager); - - SymbianAvctp::TMessageType MessageType() const; - const TDesC8& Data() const; - - // Called from bearer - const TRemConClientId& ClientId() const; - - // Called from handlers - TInt ParseIncomingCommandL(MRemConBearerObserver& aObserver, CAVRCPFragmenter& aFragmenter); - void ProcessOutgoingCommandL(MRemConBearerObserver& aObserver); - TInt ParseIncomingResponse(MRemConBearerObserver& aObserver, const CAVCFrame& aFrame); - TInt ProcessOutgoingResponse(MRemConBearerObserver& aObserver, RBuf8& aCommandData, CAVRCPFragmenter& aFragmenter); - void SetResponseType(TInt aErr); - - TDeltaTimerEntry* TimerEntry(); - TAvrcpTimerExpiryInfo* TimerExpiryInfo(); - void CancelTimer(CDeltaTimer& aTimer); - - const CAVCFrame& Frame() const; - AVCPanel::TButtonAction ButtonAct() const; - TBool Click() const; - void SetClick(TBool aIsClick); - void ReSetCoreButtonActionL(TRemConCoreApiButtonAction aButtonAct, TBool aCommand); - - void SetCoreButtonAction(TRemConCoreApiButtonAction aButtonAct, TBool aCommand); - TInt InsertCoreResult(TInt aResult); - TBool IsAvrcpPassthrough() const; - TBool IsPassthrough() const; - TInt SetSetAbsoluteVolumeResult(const CAVCFrame& aFrame); - TInt SetNotifyVolumeChangeResult(const CAVCFrame& aFrame); - TBool PlayerSpecificNotify() const; - TBool NormalCommand(); - - CControlCommand* InterimResponseL(); - -private: - CControlCommand(TUid aInterfaceUid, - TUint aCommand, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransactionLabel, - RBuf8& aCommandData, - TBool aIsClick, - const TBTDevAddr& aAddr, - TBool aKnownToBearer); - - CControlCommand(CAVCFrame* aFrame, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransLabel, - const TBTDevAddr& aAddr, - const TRemConClientId& aClientId, - CAvrcpPlayerInfoManager* aPlayerInfoManager); - - void ConstructL(); - ~CControlCommand(); - - TInt ParseIncomingKnownOpcodeL(MRemConBearerObserver& aObserver); - TInt ParseIncomingVendorCommandL(MRemConBearerObserver& aObserver, CAVRCPFragmenter& aFragmenter); - - void ParseIncomingUnknownResponse(MRemConBearerObserver& aObserver, const CAVCFrame& aFrame); - - TInt ParseInformBatteryStatusOfCT( TPtrC8& mtPayload); - - TInt ParseContinuingResponse(TPtrC8& mtPayload, - CAVRCPFragmenter& aFragmenter); - - TInt ParseAbortContinuingResponse(TPtrC8& mtPayload, - CAVRCPFragmenter& aFragmenter); - - TInt ParseSetPlayerApplicationSettingValue(TPtrC8& mtPayload); - TInt ParseGetCapabilities(TPtrC8& aMtPayload); - TInt ParseGetPlayStatus(TPtrC8& aMtPayload); - TInt ParseListPlayerApplicationSettingAttributes(TPtrC8& aMtPayload); - TInt ParseListPlayerApplicationSettingValues(TPtrC8& aMtPayload); - TInt ParseGetCurrentPlayerApplicationSettingValue(TPtrC8& aMtPayload); - TInt ParseGetPlayerApplicationSettingAttributeText(TPtrC8& aMtPayload); - TInt ParseGetPlayerApplicationSettingValueText(TPtrC8& aMtPayload); - TInt ParseGetElementAttributes(TPtrC8& aMtPayload); - TInt ParseSetAddressedPlayer(TPtrC8& aMtPayload); - TInt ParsePlayItem(TPtrC8& aMtPayload); - TInt ParseAddToNowPlaying(TPtrC8& aMtPayload); - TInt ParseUidsChangedNotification(TPtrC8& aMtPayload); - TInt ParseInternalUidsChangedNotification(TPtrC8& aMtPayload); - TInt ParseVolumeChangedNotification(TPtrC8& aMtPayload); - TInt ParseSetAbsoluteVolume(TPtrC8& aMtPayload); - void DoParseSetAbsoluteVolumeL(const TPtrC8& aMtPayload, TDes8& aPayload); - - TInt ParseMetadataTransferVendorCommand(CAVRCPFragmenter& aFragmenter); - TInt ParseVendorUniquePassthroughCommand(MRemConBearerObserver& aObserver); - TInt ParseMetadataTransferPassthroughCommand(); - TInt GenerateMetadataResponsePayload(MRemConBearerObserver& aObserver, RBuf8& aFramePayload, const RBuf8& aResponseData); - TInt GenerateMetadataGetCapabilitiesResponsePayloadL(MRemConBearerObserver& aObserver, RBuf8& aFramePayload, const RBuf8& aResponseData); - void GenerateSetAbsoluteVolumeResponsePayloadL(RBuf8& aFramePayload, const TDesC8& responseData); - void DoGenerateNotifyVolumeChangeResponsePayloadL(RBuf8& aFramePayload, const TDesC8& responseData); - TInt GenerateNotificationResponsePayload(RBuf8& aFramePayload, const TDesC8& aResponseData); - void GenerateMetadataRejectPayloadL(TInt aError); - void SetVendorInfoL(TBool aIsPassthrough); - - void DoProcessOutgoingResponseL(MRemConBearerObserver& aObserver, RBuf8& aCommandData, - CAVRCPFragmenter& aFragmenter); - - TUint8 GetPDUIdFromIPCOperationId(TInt aOperationId); - TUint8 GetEventIdFromIPCOperationId(TInt aOperationId); - - TInt RespondToInforms(TMetadataTransferPDUID aMetadataPDUID); - TInt AppendIncomingPayload(const TPtrC8& aPayload); - - static TInt AvrcpToRemConOperation(TUint aAvrcpOp, TUint& aRemConOp, TUid& aRemConIf); - static TInt RemConToAvrcpOperation(TUint aRemConOp, AVCPanel::TOperationId& aAvrcpOp); - - TUint16 Get16(const TPtrC8& aPtr); - - static TInt DummyCallback(TAny*); - - void DoSetAbsoluteVolumeResultL(const CAVCFrame& aFrame); - void DoSetNotifyVolumeChangeResultL(const CAVCFrame& aFrame); - -private: - TBool iIsClick; - - TDeltaTimerEntry* iTimerEntry; - TAvrcpTimerExpiryInfo* iTimerExpiryInfo; - - CAVCFrame* iFrame; - AVC::TAVCVendorId iVendorId; - TPtrC8 iVendorPayloadData; // ptr to the vendor data in iFrame; - - TRemConClientId iClientId; - }; - -class MetadataTransferParser - { -public: - static AVC::TAVCVendorId GetVID(const CAVCFrame& aFrame); // could be elsewhere really! - static TMetadataTransferPDUID GetPDUID(const TPtrC8& aData); - static TUint16 GetParamLength(const TPtrC8& aData); - static TUint16 GetPassThroughOperationId(const TPtrC8& aData); - static TMetadataTransferPDUID GetNotifyEventID(const TPtrC8& aData); - }; - - -#endif // CONTROLCOMMAND_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/internalcommand.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/internalcommand.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -// Copyright (c) 2009 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: -// - -#ifndef INTERNALCOMMAND_H -#define INTERNALCOMMAND_H - -#include "avrcpcommand.h" - -const SymbianAvctp::TTransactionLabel KDummyTransactionLabel = 0; - -NONSHARABLE_CLASS(CInternalCommand) : public CAvrcpCommand - { -public: - static CInternalCommand* NewL(TUid aInterfaceUid, - TUint aId, - TUint aOperationId, - const TDesC8& aCommandData); - - void ResetL(TUint& aId, const TDesC8& aCommandData); - virtual SymbianAvctp::TMessageType MessageType() const; - virtual const TDesC8& Data() const; - -private: - CInternalCommand(TUid aInterfaceUid, - TUint aId, - TUint aOperationId); - ~CInternalCommand(); - void ConstructL(const TDesC8& aCommandData); - }; - -#endif //INTERNALCOMMAND_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/internalhelper.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/internalhelper.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -// Copyright (c) 2009 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: -// - -#ifndef INTERNALHELPER_H -#define INTERNALHELPER_H - -#include -#include "avrcpplayerinfomanager.h" - -class CControlCommand; -class CRemConBearerAvrcp; -class CRcpRouter; -NONSHARABLE_CLASS(CInternalCommandHelper) : public CBase, public MPlayerChangeObserver - { -public: - static CInternalCommandHelper* NewL(CRemConBearerAvrcp& aBearer, - CRcpRouter& aRouter, TRemConClientId& aClientId, - CAvrcpPlayerInfoManager& aPlayerInfoManager); - ~CInternalCommandHelper(); - - void Disconnect(); - void HandleInternalCommand(CControlCommand& aCommand); - -private: - CInternalCommandHelper(CRemConBearerAvrcp& aBearer, - CRcpRouter& aRouter, TRemConClientId& aClientId, - CAvrcpPlayerInfoManager& aPlayerInfoManager); - void ConstructL(); - - // From MPlayerChangeObserver - void MpcoAvailablePlayersChanged(); - void MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId); - void MpcoUidCounterChanged(TRemConClientId aClientId); - - void Respond(CControlCommand& aCommand, TInt aErr); - void HandledCommand(CControlCommand& aCommand); - - TInt HandleSetAddressedPlayer(TUint aId, RBuf8& aCommandData); - void DoHandleSetAddressedPlayerL(RBuf8& aCommandData); - void AddressedPlayerChangedL(TRemConClientId aClientId); - - TInt HandleRegisterAvailablePlayersNotification(CControlCommand& aCommand); - void DoHandleRegisterAvailablePlayersNotificationL(RBuf8& aResponseData, CControlCommand& aCommand); - - TInt HandleRegisterAddressedPlayerNotification(CControlCommand& aCommand); - void DoHandleRegisterAddressedPlayerNotificationL(RBuf8& aResponseData, CControlCommand& aCommand); - - TInt HandleUidChangedNotification( CControlCommand& aCommand); - void DoHandleUidChangedNotificationL(RBuf8& aResponseData, TUint16 aUidCounter); - - void SendResponse(TUint aId, RBuf8& aData); - -private: - CRemConBearerAvrcp& iBearer; - CRcpRouter& iRouter; - TRemConClientId& iClientId; - - CAvrcpPlayerInfoManager& iPlayerInfoManager; - - TDblQue iInternalCommandQueue; - }; - -#endif // INTERNALHELPER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/passthroughhelper.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/passthroughhelper.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -// Copyright (c) 2009 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: -// - -#ifndef PASSTHROUGHHELPER_H -#define PASSTHROUGHHELPER_H - -#include - -class CRcpRouter; -class MRemConControlCommandInterface; -class CControlCommand; -NONSHARABLE_CLASS(CPassthroughHelper) : public CBase - { -public: - static CPassthroughHelper* NewL(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer); - ~CPassthroughHelper(); - - void Disconnect(); - - void HandlePassthrough(CControlCommand& aCommand); // FIXME for now -private: - CPassthroughHelper(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer); - void ConstructL(); - - void Respond(CControlCommand& aCommand, TInt aErr); - void HandledCommand(CControlCommand& aCommand); - - void NewPress(CControlCommand& aCommand); - void BalanceHandledCommand(CControlCommand& aCommand); - - // Timer functions - void HoldExpiry(CControlCommand& aCommand); - void ReleaseExpiry(CControlCommand& aCommand); - void StartHoldTimer(CControlCommand& aCommand); - void StartReleaseTimer(CControlCommand& aCommand); - - // Delta timer callback functions - static TInt HoldExpiry(TAny* aExpiryInfo); - static TInt ReleaseExpiry(TAny* aExpiryInfo); - -private: - CRcpRouter& iRouter; - MRemConControlCommandInterface& iCommandInterface; - CDeltaTimer& iTimer; - CControlCommand* iPreviousPassthrough; - }; - -#endif // PASSTHROUGHHELPER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/playerbitmasks.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/playerbitmasks.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -// 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" -// 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: -// TPlayerFeatureBitmask.h -// - -#ifndef PLAYERBITMASKS_H_ -#define PLAYERBITMASKS_H_ - -/** -@file -@internalComponent -@released -*/ -#include - -const TInt KFeatureBitmaskLength = 16; - -enum TByteOffsets - { - ESelectByteOffset = 0, - EUpByteOffset = 0, - EDownByteOffset = 0, - ELeftByteOffset = 0, - ERightByteOffset = 0, - ERightUpByteOffset = 0, - ERightDownByteOffset = 0, - ELeftUpByteOffset = 0, - ELeftDownByteOffset = 1, - ERootMenuByteOffset = 1, - ESetupMenuByteOffset = 1, - EContentsMenuByteOffset = 1, - EFavoriteMenuByteOffset = 1, - EExitByteOffset = 1, - E0ByteOffset = 1, - E1ByteOffset = 1, - E2ByteOffset = 2, - E3ByteOffset = 2, - E4ByteOffset = 2, - E5ByteOffset = 2, - E6ByteOffset = 2, - E7ByteOffset = 2, - E8ByteOffset = 2, - E9ByteOffset = 2, - EDotByteOffset = 3, - EEnterByteOffset = 3, - EClearByteOffset = 3, - EChannelUpByteOffset = 3, - EChannelDownByteOffset = 3, - EPreviousChannelByteOffset = 3, - ESoundSelectByteOffset = 3, - EInputSelectByteOffset = 3, - EDisplayInformationByteOffset = 4, - EHelpByteOffset = 4, - EPageUpByteOffset = 4, - EPageDownByteOffset = 4, - EPowerByteOffset = 4, - EVolumeUpByteOffset = 4, - EVolumeDownByteOffset = 4, - EMuteByteOffset = 4, - EPlayByteOffset = 5, - EStopByteOffset = 5, - EPauseByteOffset = 5, - ERecordByteOffset = 5, - ERewindByteOffset = 5, - EFastForwardByteOffset = 5, - EEjectByteOffset = 5, - EForwardByteOffset = 5, - EBackwardByteOffset = 6, - EAngleByteOffset = 6, - ESubpictureByteOffset = 6, - EF1ByteOffset = 6, - EF2ByteOffset = 6, - EF3ByteOffset = 6, - EF4ByteOffset = 6, - EF5ByteOffset = 6, - EVendorUniqueByteOffset = 7, - EGroupNavigationByteOffset = 7, - EAdvancedControlPlayerByteOffset = 7, - EBrowsingByteOffset = 7, - ESearchByteOffset = 7, - EAddToNowPlayingByteOffset = 7, - EDatabaseAwareByteOffset = 7, - EBrowsableOnlyWhenAddressedByteOffset = 7, - ESearchableOnlyWhenAddressedByteOffset = 8, - ENowPlayingByteOffset = 8, - EUidPersistencyByteOffset = 8, - }; - -enum TBitOffset - { - ESelectBitOffset = 0, - EUpBitOffset = 1, - EDownBitOffset = 2, - ELeftBitOffset = 3, - ERightBitOffset = 4, - ERightUpBitOffset = 5, - ERightDownBitOffset = 6, - ELeftUpBitOffset = 7, - ELeftDownBitOffset = 0, - ERootMenuBitOffset = 1, - ESetupMenuBitOffset = 2, - EContentsMenuBitOffset = 3, - EFavoriteMenuBitOffset = 4, - EExitBitOffset = 5, - E0BitOffset = 6, - E1BitOffset = 7, - E2BitOffset = 0, - E3BitOffset = 1, - E4BitOffset = 2, - E5BitOffset = 3, - E6BitOffset = 4, - E7BitOffset = 5, - E8BitOffset = 6, - E9BitOffset = 7, - EDotBitOffset = 0, - EEnterBitOffset = 1, - EClearBitOffset = 2, - EChannelUpBitOffset = 3, - EChannelDownBitOffset = 4, - EPreviousChannelBitOffset = 5, - ESoundSelectBitOffset = 6, - EInputSelectBitOffset = 7, - EDisplayInformationBitOffset = 0, - EHelpBitOffset = 1, - EPageUpBitOffset = 2, - EPageDownBitOffset = 3, - EPowerBitOffset = 4, - EVolumeUpBitOffset = 5, - EVolumeDownBitOffset = 6, - EMuteBitOffset = 7, - EPlayBitOffset = 0, - EStopBitOffset = 1, - EPauseBitOffset = 2, - ERecordBitOffset = 3, - ERewindBitOffset = 4, - EFastForwardBitOffset = 5, - EEjectBitOffset = 6, - EForwardBitOffset = 7, - EBackwardBitOffset = 0, - EAngleBitOffset = 1, - ESubpictureBitOffset = 2, - EF1BitOffset = 3, - EF2BitOffset = 4, - EF3BitOffset = 5, - EF4BitOffset = 6, - EF5BitOffset = 7, - EVendorUniqueBitOffset = 0, - EGroupNavigationBitOffset = 1, - EAdvancedControlPlayerBitOffset = 2, - EBrowsingBitOffset = 3, - ESearchBitOffset = 4, - EAddToNowPlayingBitOffset = 5, - EDatabaseAwareBitOffset = 6, - EBrowsableOnlyWhenAddressedBitOffset = 7, - ESearchableOnlyWhenAddressedBitOffset = 0, - ENowPlayingBitOffset = 1, - EUidPersistencyBitOffset = 2, - }; - -class TPlayerFeatureBitmask - { -public: - TPlayerFeatureBitmask(); - TPlayerFeatureBitmask(const TPlayerFeatureBitmask& aFeatureBitmask); - - inline const TDesC8& FeatureBitmask() const; - - void SetCoreApiFeatures(const RArray& aOperation); - void SetAbsoluteVolumeApiFeatures(const RArray& aOperation); - void SetGroupNavigationApiFeatures(const RArray& aOperation); - void SetNowPlayingApiFeatures(const RArray& aOperation); - void SetMediaBrowseApiFeatures(const RArray& aOperation); - -private: - void SetCoreApiFeatures(); - -private: - TBuf8 iFeatureBitmask; - }; - -const TDesC8& TPlayerFeatureBitmask::FeatureBitmask() const - { - return iFeatureBitmask; - } -#endif /*PLAYERBITMASKS_H_*/ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/playerstatewatcher.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/playerstatewatcher.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#ifndef PLAYERSTATEWATCHER_H -#define PLAYERSTATEWATCHER_H - -#include -#include -#include -#include -#include "commandhandlerinterface.h" - -class MRemConCommandInterface; -class CInternalCommand; -class CAvrcpCommand; -NONSHARABLE_CLASS(CPlayerWatcherBase) : public CBase, public MIncomingCommandHandler - { -public: - virtual void StartWatchingPlayerL(TRemConClientId aClientId) = 0; - void StopWatchingPlayer(TRemConClientId aClientId); - -protected: - virtual void ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData) = 0; - virtual void ReceiveReject(TRemConClientId aClientId) = 0; - -private: // from MIncomingCommandHandler - - // lower interface - void MessageSent(CAvrcpCommand& aCommand, TInt aSendResult); - void MaxPacketSize(TInt aMtu); - void ReceiveCommandL(const TDesC8& aMessageInformation, SymbianAvctp::TTransactionLabel aTransLabel, const TBTDevAddr& aAddr); - - // upper interface - TInt SendRemConResponse(TUid aInterfaceUid, TUint aTransactionId, RBuf8& aData) ; - void SendReject(TUid aInterfaceUid, TUint aTransactionId); - void Disconnect(); - -protected: - CPlayerWatcherBase(MRemConCommandInterface& aCommandInterface); - ~CPlayerWatcherBase(); - -private: - CInternalCommand& FindCommand(TUid aInterfaceUid, TUint aTransactionId, - TRemConClientId& aFoundClientId); - - -protected: - MRemConCommandInterface& iCommandInterface; - RHashMap iCommands; - }; - -NONSHARABLE_CLASS(MPlayStatusObserver) - { -public: - virtual void MpsoPlayStatusChanged(TRemConClientId aId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus) = 0; - virtual void MpsoError(TRemConClientId aId) = 0; - }; - -NONSHARABLE_CLASS(CPlayStatusWatcher) : public CPlayerWatcherBase - { -public: - static CPlayStatusWatcher* NewL(MPlayStatusObserver& aObserver, - MRemConCommandInterface& aCommandInterface); - ~CPlayStatusWatcher(); - - void StartWatchingPlayerL(TRemConClientId aClientId); - -private: - CPlayStatusWatcher(MPlayStatusObserver& aObserver, - MRemConCommandInterface& aCommandInterface); - - void SendPlayStatusUpdateRequest(CInternalCommand& aCommand, TRemConClientId& aClientId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus); - void ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData); - void ReceiveReject(TRemConClientId aClientId); - -private: - MPlayStatusObserver& iObserver; - }; - - -NONSHARABLE_CLASS(MUidObserver) - { -public: - virtual void MuoUidChanged(TRemConClientId aId, TUint16 aUidCounter) = 0; - virtual void MuoError(TRemConClientId aId) = 0; - }; - -NONSHARABLE_CLASS(CUidWatcher) : public CPlayerWatcherBase - { -public: - static CUidWatcher* NewL(MUidObserver& aObserver, - MRemConCommandInterface& aCommandInterface); - ~CUidWatcher(); - - void StartWatchingPlayerL(TRemConClientId aClientId); - -private: - CUidWatcher(MUidObserver& aObserver, - MRemConCommandInterface& aCommandInterface); - - void SendUidUpdateRequest(CInternalCommand& aCommand, TRemConClientId& aClientId, TUint16 aUidCounter); - void ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData); - void ReceiveReject(TRemConClientId aClientId); - -private: - MUidObserver& iObserver; - }; - -#endif //PLAYERSTATEWATCHER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/inc/remconcommandinterface.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/inc/remconcommandinterface.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#ifndef REMCONCOMMANDINTERFACE_H -#define REMCONCOMMANDINTERFACE_H - -#include -#include - -class CControlCommand; -class CAvrcpCommand; -class TBTDevAddr; -class TRemConAddress; - -NONSHARABLE_CLASS(MRemConCommandInterface) - { -public: - virtual void MrcciNewCommand(CAvrcpCommand& aCommand) = 0; - virtual void MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId) = 0; - - virtual TUint MrcciNewTransactionId() = 0; - virtual void MrcciCommandExpired(TUint aTransactionId) = 0; - }; - -NONSHARABLE_CLASS(MRemConBulkCommandInterface) : public MRemConCommandInterface - { -public: - virtual TInt MrcbciSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient) = 0; - virtual void MrcbciRemoveAddressing(const TRemConAddress& aAddr) = 0; - }; - -NONSHARABLE_CLASS(MRemConControlCommandInterface) : public MRemConCommandInterface - { -public: - virtual void MrccciNewNotifyCommand(CAvrcpCommand& aCommand) = 0; - virtual void MrccciNewNotifyCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId) = 0; - - virtual void MrccciNewResponse(CAvrcpCommand& aCommand) = 0; - virtual void MrccciNewNotifyResponse(CControlCommand& aCommand) = 0; - - virtual void MrccciSetAddressedClient(const TRemConClientId& aClient) = 0; - virtual void MrccciRegisterForLocalAddressedClientUpdates() = 0; - virtual void MrccciUnregisterForLocalAddressedClientUpdates() = 0; - }; - -#endif //REMCONCOMMANDINTERFACE_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/public/remconbeareravrcp.h --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/public/remconbeareravrcp.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#ifndef REMCONBEARERAVRCP_H -#define REMCONBEARERAVRCP_H - -/** -@file -@internalComponent -@released -*/ - -#include - -const TInt KRemConBearerAvrcpImplementationUid = 0x1020685f; - -#endif // REMCONBEARERAVRCP_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/1020685e.rss --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/1020685e.rss Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - - - -/** - @file - @internalComponent -*/ - -#include - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x1020685E; - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x10204546; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x1020685F; - version_no = 1; - display_name = "RCP"; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpMetadataTransfer.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpMetadataTransfer.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1087 +0,0 @@ -// Copyright (c) 2006-2009 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: -// - - - -/** - @file - @internalComponent - @prototype -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "avrcp.h" -#include "controlcommand.h" -#include "avrcpcommandframer.h" -#include "avrcpinternalinterface.h" -#include "avrcpipc.h" -#include "avrcplog.h" -#include "avrcputils.h" -#include "avrcpincomingcommandhandler.h" -#include "mediabrowse.h" -#include "mediainformation.h" -#include "nowplaying.h" -#include "playerinformation.h" -#include "remconbattery.h" -#include "remcongroupnavigation.h" - -TInt CControlCommand::ParseMetadataTransferPassthroughCommand() - { - // company id and frame type should already be set before here - __ASSERT_DEBUG(iFrame->Type() == AVC::EControl, AvrcpUtils::Panic(EAvrcpCTypeNotSet)); - __ASSERT_DEBUG(iVendorId == KBluetoothSIGVendorId, AvrcpUtils::Panic(EAvrcpCompanyIDNotSet)); - - TInt ret = KErrNotSupported; - TUint16 operation = MetadataTransferParser::GetPassThroughOperationId(iVendorPayloadData); - if (operation == ENextGroup) - { - iOperationId = ENextGroup; - iInterfaceUid = TUid::Uid(KRemConGroupNavigationApiUid); - ret = KErrNone; - } - else if (operation == EPreviousGroup) - { - iOperationId = EPreviousGroup; - iInterfaceUid = TUid::Uid(KRemConGroupNavigationApiUid); - ret = KErrNone; - } - return ret; - } - -/* Before calling this method, the following MUST be set: - * - Vendor Payload data - * - Opcode == Vendor Dependent - * - Subunit Type == Panel - * - Subunit Id == 0 - */ - -TInt CControlCommand::ParseMetadataTransferVendorCommand(CAVRCPFragmenter& aFragmenter) - { - __ASSERT_DEBUG(iFrame->Opcode() == AVC::EVendorDependent, AvrcpUtils::Panic(EAvrcpNotFullyConstructed)); - __ASSERT_DEBUG(iFrame->SubunitType() == AVC::EPanel, AvrcpUtils::Panic(EAvrcpNotFullyConstructed)); - __ASSERT_DEBUG(iFrame->SubunitID() == 0, AvrcpUtils::Panic(EAvrcpNotFullyConstructed)); - - TInt ret = KErrNotSupported; - iInterfaceUid = TUid::Uid(0); - - TMetadataTransferPDUID metadataPDUID = MetadataTransferParser::GetPDUID(iVendorPayloadData); - - TPtrC8 mtPayload(iVendorPayloadData.Mid(KRemConMetadataHeaderLength)); - - TUint paramLength = MetadataTransferParser::GetParamLength(iVendorPayloadData); - - if (mtPayload.Length() != paramLength) - { - return KErrAvrcpMetadataInvalidCommand; - } - - // If we're in a fragmented state, and we receive an un-expected - // PDU (i.e. not CONTINUE or ABORT) then throw away the fragment - // and just process the request. The specification (section 5.5.1) - // isn't entirely clear as to what should happen, but Sian reckons - // this is probably the most polite thing to do (be liberal, etc) - if (aFragmenter.InFragmentedState()) - { - if ( metadataPDUID != ERequestContinuingResponse - && metadataPDUID != EAbortContinuingResponse) - { - aFragmenter.Reset(); - } - } - - switch (iFrame->Type()) - { - case AVC::EControl: - { - switch (metadataPDUID) - { - case ERequestContinuingResponse: - ret = ParseContinuingResponse(mtPayload, aFragmenter); - break; - case EAbortContinuingResponse: - ret = ParseAbortContinuingResponse(mtPayload, aFragmenter); - break; - case ESetPlayerApplicationSettingValue: - ret = ParseSetPlayerApplicationSettingValue(mtPayload); - break; - - case EInformBatteryStatusOfCT: - ret = ParseInformBatteryStatusOfCT(mtPayload); - break; - - case EInformDisplayableCharacterSet: - ret = KErrNotSupported; - break; - case ESetAddressedPlayer: - ret = ParseSetAddressedPlayer(mtPayload); - break; - case EPlayItem: - ret = ParsePlayItem(mtPayload); - break; - case EAddToNowPlaying: - ret = ParseAddToNowPlaying(mtPayload); - break; - - case ESetAbsoluteVolume: - ret =ParseSetAbsoluteVolume(mtPayload); - break; - default: - // not allowed PDUID for Control - ret = KErrAvrcpMetadataInvalidCommand; - } - break; - } - case AVC::EStatus: - { - switch (metadataPDUID) - { - case EGetCapabilities: - ret = ParseGetCapabilities( mtPayload ); - break; - - case EGetPlayStatus: - ret = ParseGetPlayStatus( mtPayload ); - break; - - case EListPlayerApplicationSettingAttributes: - ret = ParseListPlayerApplicationSettingAttributes( mtPayload ); - break; - - case EListPlayerApplicationSettingValues: - ret = ParseListPlayerApplicationSettingValues( mtPayload ); - break; - - case EGetCurrentPlayerApplicationSettingValue: - ret = ParseGetCurrentPlayerApplicationSettingValue( mtPayload ); - break; - - case EGetPlayerApplicationSettingAttributeText: - ret = ParseGetPlayerApplicationSettingAttributeText( mtPayload ); - break; - - case EGetPlayerApplicationSettingValueText: - ret = ParseGetPlayerApplicationSettingValueText( mtPayload ); - break; - - case EGetElementAttributes: - ret = ParseGetElementAttributes(mtPayload ); - break; - - case ESetAddressedPlayer: - ret = ParseSetAddressedPlayer(mtPayload ); - break; - - case EPlayItem: - ret = ParsePlayItem(mtPayload ); - break; - - case EAddToNowPlaying: - ret = ParseAddToNowPlaying(mtPayload ); - break; - default: - // not allowed PDUID for Status - ret = KErrAvrcpMetadataInvalidCommand; - } - - break; - } - case AVC::ENotify: - { - if (metadataPDUID==ERegisterNotification) - { - if (mtPayload.Length() != KLengthRegisterNotification) - { - ret = KErrAvrcpMetadataInvalidCommand; - } - else - { - ret = KErrNone; - TRegisterNotificationEvent eventId = static_cast(mtPayload[KVendorDependentEventId]); - switch (eventId) - { - case ERegisterNotificationPlaybackStatusChanged: - case ERegisterNotificationTrackChanged: - case ERegisterNotificationTrackReachedEnd: - case ERegisterNotificationTrackReachedStart: - case ERegisterNotificationBatteryStatusChanged: - case ERegisterNotificationPlayerApplicationSettingChanged: - { - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(eventId); - break; - } - // Note: ERegisterNotificationPlaybackPosChanged takes a 4 byte parameter - case ERegisterNotificationPlaybackPosChanged: - { - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(eventId); - iCommandData.Close(); - ret = iCommandData.Create(KLengthPlaybackPosChangedParam); - if (ret == KErrNone) - { - iCommandData.Append(mtPayload.Right(KLengthPlaybackPosChangedParam)); - } - else - { - ret = KErrAvrcpMetadataInternalError; - } - break; - } - - // Note ERegisterNotificationSystemStatusChanged is not supported - case ERegisterNotificationSystemStatusChanged_NotSupported: - { - ret = KErrNotSupported; - break; - } - - case ERegisterNotificationNowPlayingContentChanged: - { - iInterfaceUid = TUid::Uid(KRemConNowPlayingApiUid); - iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(eventId); - break; - } - case ERegisterNotificationAvailablePlayersChanged: - case ERegisterNotificationAddressedPlayerChanged: - case ERegisterNotificationUidsChanged: - { - iInterfaceUid = TUid::Uid(KUidAvrcpInternalInterface); - iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(eventId); - ret = KErrAvrcpInternalCommand; - break; - } - case ERegisterNotificationVolumeChanged : - { - ret = ParseVolumeChangedNotification(mtPayload); - break; - } - default: - { - ret = KErrAvrcpMetadataInvalidParameter; - } - } - } - } - else - { - ret = KErrAvrcpMetadataInvalidCommand; - } - break; - } - case AVC::EReserved1: - case AVC::EReserved2: - case AVC::EReserved3: - case AVC::EReserved4: - { - ret = KErrAvrcpInvalidCType; - break; - } - default: - ret = KErrAvrcpMetadataInvalidCommand; - } - - return ret; - } - -/** Allocate correct space and append the payload to iCommandData - */ -TInt CControlCommand::AppendIncomingPayload(const TPtrC8& aPayload) - { - iCommandData.Close(); - if (iCommandData.Create(aPayload.Length()) != KErrNone) - { - return KErrAvrcpMetadataInternalError; - } - iCommandData.Append(aPayload); - return KErrNone; - } - -/** Decode a InformBatteryStatusOfCT PDU ID: 0x18 and call the BatteryStatus API - */ -TInt CControlCommand::ParseInformBatteryStatusOfCT(TPtrC8& aMtPayload) - - { - if (aMtPayload.Length() != KLengthInformBatteryStatusOfCTPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - TUint8 batteryStatus = aMtPayload[0]; - if (batteryStatus > EFullCharge) - { - return KErrAvrcpMetadataInvalidParameter; - } - - if (AppendIncomingPayload(aMtPayload) != KErrNone) - { - return KErrAvrcpMetadataInvalidParameter; - } - - iOperationId = EInformBatteryStatusOfCT; - iInterfaceUid = TUid::Uid(KRemConBatteryApiUid); - - TInt ret = RespondToInforms(EInformBatteryStatusOfCT); - if (ret != KErrNone) - { - return ret; - } - - return KErrAvrcpHandledInternallyInformRemCon; - } - - -/** Decode PDU ID 0x40 - fragmentation support - */ -TInt CControlCommand::ParseContinuingResponse(TPtrC8& aMtPayload, - CAVRCPFragmenter& aFragmenter) - { - // Check if in fragmentation state, return error if not - if (! aFragmenter.InFragmentedState()) - { - return KErrAvrcpMetadataInvalidCommand; - } - - // Check if the parameter matches the fragmented response - TMetadataTransferPDUID pduId = MetadataTransferParser::GetPDUID(aMtPayload); - if (pduId != aFragmenter.GetPDU()) - { - return KErrAvrcpMetadataInvalidParameter; - } - - RBuf8 respPayload; - CAVCFrame* frame = NULL; - TRAPD(err, frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId)); - err = respPayload.Create(KAVCMaxVendorDependentPayload); //longest resp - if (err == KErrNone) - { - respPayload.Append(aFragmenter.GetNextFragmentHeader()); - respPayload.Append(aFragmenter.GetNextFragment()); - frame->SetType(AVC::EStable); - frame->Append(respPayload); - delete iFrame; - iFrame = frame; - respPayload.Close(); - } - else - return KErrAvrcpMetadataInternalError; - - return KErrAvrcpHandledInternallyRespondNow; - } - - -/** Decode PDU ID 0x41 - fragmentation support - */ -TInt CControlCommand::ParseAbortContinuingResponse(TPtrC8& aMtPayload, - CAVRCPFragmenter& aFragmenter) - { - // Check if in fragmentation state, return error if not - if (! aFragmenter.InFragmentedState()) - { - return KErrAvrcpMetadataInvalidCommand; - } - - // Check if the parameter matches the fragmented response - TMetadataTransferPDUID pduId = MetadataTransferParser::GetPDUID(aMtPayload); - if (pduId != aFragmenter.GetPDU()) - { - return KErrAvrcpMetadataInvalidParameter; - } - - aFragmenter.Reset(); - - CAVCFrame* frame = NULL; - TRAPD(err, frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId)); - if (err == KErrNone) - { - frame->Append(EAbortContinuingResponse); - frame->Append(EUnfragmented); - // the package length is 0 - frame->Append( 0 ); - frame->Append( 0 ); - frame->SetType(AVC::EStable); - delete iFrame; - iFrame = frame; - } - else - { - return KErrAvrcpMetadataInternalError; - } - - return KErrAvrcpHandledInternallyRespondNow; - } - - -/** Decode a SetPlayerApplicationSettingValue PDU ID: 0x14 and call the PlayerInformation API - */ -TInt CControlCommand::ParseSetPlayerApplicationSettingValue(TPtrC8& aMtPayload) - { - if (aMtPayload.Length() < KMinLengthSetPASValuePdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - // get the number of attributes contained - TUint8 numAttributes = aMtPayload[KVendorDependentNumberAttributes]; - - // Each attribute is 16 bits long - if (sizeof(numAttributes) + numAttributes*sizeof(TUint16) != aMtPayload.Length()) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = ESetPlayerApplicationSettingValue; - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - return AppendIncomingPayload(aMtPayload); - } - -/** Decode a GetCapabilities PDU ID: 0x10 and call the PlayerInformation API - */ -TInt CControlCommand::ParseGetCapabilities(TPtrC8& aMtPayload) - { - // check enough data available - if (aMtPayload.Length() != KLengthGetCapabilitiesPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - // pass one byte of data to Player Information API - iOperationId = EGetCapabilities; - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - return AppendIncomingPayload(aMtPayload); - } - -/** Decode a GetPlayStatus PDU ID: 0x30 and call the PlayerInformation API - */ -TInt CControlCommand::ParseGetPlayStatus(TPtrC8& aMtPayload) - { - // no payload in this command - if (aMtPayload.Length()!=KLengthGetPlayStatusPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EGetPlayStatus; - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - return KErrNone; - } - -/** Decode a ListPlayerApplicationSettingAttributes PDU ID: 0x11 and call the PlayerInformation API - */ -TInt CControlCommand::ParseListPlayerApplicationSettingAttributes(TPtrC8& aMtPayload) - { - // check length, there should be no parameters - if (aMtPayload.Length()!=KLengthListPASAttributesPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EListPlayerApplicationSettingAttributes; - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - return KErrNone; - } - -/** Decode a ListPlayerApplicationSettingValues PDU ID: 0x12 and call the PlayerInformation API - */ -TInt CControlCommand::ParseListPlayerApplicationSettingValues(TPtrC8& aMtPayload) - { - // check length, there should be 1 byte of data - if (aMtPayload.Length() != KLengthListPASValuesPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EListPlayerApplicationSettingValues; - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - return AppendIncomingPayload(aMtPayload); - } - -/** Decode a GetCurrentPlayerApplicationSettingValue PDU ID: 0x13 and call the PlayerInformation API - */ -TInt CControlCommand::ParseGetCurrentPlayerApplicationSettingValue(TPtrC8& aMtPayload) - { - // check the length - if (aMtPayload.Length() < KMinLengthGetCurrentPASValuePdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - TUint8 numAttributes = aMtPayload[KVendorDependentNumberAttributes]; - if (sizeof(numAttributes) + numAttributes != aMtPayload.Length()) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EGetCurrentPlayerApplicationSettingValue; - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - return AppendIncomingPayload(aMtPayload); - } - -/** Decode a GetPlayerApplicationSettingAttributeText PDU ID: 0x15 and call the PlayerInformation API - */ -TInt CControlCommand::ParseGetPlayerApplicationSettingAttributeText(TPtrC8& aMtPayload) - { - if (aMtPayload.Length() < KMinLengthGetPASAttributeTextPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - // get the number of attributes contained - TUint8 numAttributes = aMtPayload[KVendorDependentNumberAttributes]; - if (sizeof(numAttributes) + numAttributes != aMtPayload.Length()) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EGetPlayerApplicationSettingAttributeText; - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - return AppendIncomingPayload(aMtPayload); - } - -/** Decode a GetPlayerApplicationSettingValueText PDU ID: 0x16 and call the PlayerInformation API - */ -TInt CControlCommand::ParseGetPlayerApplicationSettingValueText(TPtrC8& aMtPayload) - { - if (aMtPayload.Length() < KMinLengthGetPASValueTextPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - // get number of values; preceded by attributeId (1byte) and numValues (1byte) - TUint8 numValues = aMtPayload[KVendorDependentNumberAttribsPdu16]; - if (sizeof(TUint8) + sizeof(numValues) + numValues != aMtPayload.Length()) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EGetPlayerApplicationSettingValueText; - iInterfaceUid = TUid::Uid(KRemConPlayerInformationUid); - return AppendIncomingPayload(aMtPayload); - } - -/** Decode a GetElementAttributes PDU ID: 0x20 and call the PlayerInformation API - */ -TInt CControlCommand::ParseGetElementAttributes(TPtrC8& aMtPayload) - { - LOG_FUNC - - if (aMtPayload.Length() < KMinLengthGetElementAttributesPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EGetElementAttributes; - iInterfaceUid = TUid::Uid(KRemConMediaInformationApiUid); - return AppendIncomingPayload(aMtPayload); - } - -TInt CControlCommand::ParseSetAddressedPlayer(TPtrC8& aMtPayload) - { - LOG_FUNC - - if (aMtPayload.Length() < KLengthSetAddressedPlayerPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EAvrcpInternalSetAddressedPlayer; - iInterfaceUid = TUid::Uid(KUidAvrcpInternalInterface); - TInt err = AppendIncomingPayload(aMtPayload); - - return err == KErrNone ? KErrAvrcpInternalCommand : err; - } - -TInt CControlCommand::ParsePlayItem(TPtrC8& aMtPayload) - { - LOG_FUNC - - if (aMtPayload.Length() < KMinLengthAddToNowPlayingPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EPlayItem; - iInterfaceUid = TUid::Uid(KRemConNowPlayingApiUid); - return AppendIncomingPayload(aMtPayload); - } - -TInt CControlCommand::ParseAddToNowPlaying(TPtrC8& aMtPayload) - { - LOG_FUNC - - if (aMtPayload.Length() < KMinLengthAddToNowPlayingPdu) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = EAddToNowPlaying; - iInterfaceUid = TUid::Uid(KRemConNowPlayingApiUid); - return AppendIncomingPayload(aMtPayload); - } - -TInt CControlCommand::ParseUidsChangedNotification(TPtrC8& /*aMtPayload*/) - { - LOG_FUNC - iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid); - iOperationId = RAvrcpIPC::SetIPCOperationIdFromEventId(ERegisterNotificationUidsChanged); - - return KErrAvrcpHandledInternallyRespondNow; - } - -TInt CControlCommand::ParseVolumeChangedNotification(TPtrC8& /*aMtPayload*/) - { - LOG_FUNC - iInterfaceUid = TUid::Uid(KRemConAbsoluteVolumeTargetApiUid); - iOperationId = KRemConAbsoluteVolumeNotification; - - return KErrNone; - } - -TInt CControlCommand::GenerateMetadataResponsePayload(MRemConBearerObserver& aObserver, RBuf8& aFramePayload, const RBuf8& aResponseData) - { - TInt err = KErrNone; - - // If it's a very large response; this requires re-allocating the buffer - if (aResponseData.Length() > KAVCFrameMaxLength) - { - aFramePayload.Close(); - if (aFramePayload.Create(aResponseData.Length()) != KErrNone) - return KErrAvrcpMetadataInternalError; - } - - // Obtain the PDU from the combined PDU + (possible) notification eventId - TMetadataTransferPDU pduId = RAvrcpIPC::GetPDUIdFromIPCOperationId(iOperationId); - aFramePayload.Zero(); - aFramePayload.Append(pduId); - aFramePayload.Append(EUnfragmented); - - //Check whether it is absolute volume response. - TBool absoluteVolumeResponse = EFalse; - if (pduId == ESetAbsoluteVolume) - { - absoluteVolumeResponse = ETrue; - } - else if (pduId == ERegisterNotification) - { - TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId); - if (eventId == ERegisterNotificationVolumeChanged) - { - absoluteVolumeResponse = ETrue; - } - } - - TPtr8 responseData(NULL, 0); - if (absoluteVolumeResponse) - { - responseData.Set(aResponseData.RightTPtr(aResponseData.Length())); - } - else - { - // Read 4 byte Big-Endian error code before the payload - RAvrcpIPCError response; - TRAP(err, response.ReadL(aResponseData)); - - // If we couldn't parse the response via IPC, send an internal error - if (err != KErrNone) - { - return KErrAvrcpMetadataInternalError; - } - - // If an error occurred, return it (now that we've filled in the PDU id) - if (response.iError != KErrNone) - { - return response.iError; - } - - // Pass the rest of the response (minus error code) to be parsed - responseData.Set(aResponseData.RightTPtr(aResponseData.Length() - KLengthErrorResponse)); - } - - switch (pduId) - { - case ESetPlayerApplicationSettingValue: - { - // the package length is 0 - aFramePayload.Append( 0 ); - aFramePayload.Append( 0 ); - break; - } - - case EGetCapabilities: - { - TRAP(err,GenerateMetadataGetCapabilitiesResponsePayloadL(aObserver, aFramePayload, aResponseData)); - if(err != KErrNone) - { - return KErrAvrcpMetadataInternalError; - } - break; - } - case EListPlayerApplicationSettingAttributes: - case EListPlayerApplicationSettingValues: - case EGetCurrentPlayerApplicationSettingValue: - case EGetPlayerApplicationSettingAttributeText: - case EGetPlayerApplicationSettingValueText: - case EGetElementAttributes: - case EGetPlayStatus: - case EPlayItem: - case EAddToNowPlaying: - case ESetAddressedPlayer: - { - // the package length is the response length - TInt packageLength = responseData.Length(); - aFramePayload.Append(packageLength>>8); - aFramePayload.Append(packageLength); - aFramePayload.Append(responseData); - break; - } - case ESetAbsoluteVolume: - { - TRAPD(err, GenerateSetAbsoluteVolumeResponsePayloadL(aFramePayload,responseData)); - if (err != KErrNone) - { - return KErrAvrcpMetadataInternalError; - } - break; - } - case ERegisterNotification: - { - GenerateNotificationResponsePayload(aFramePayload, responseData); - break; - } - default: - { - return KErrNotSupported; - } - } - - // Success. Error conditions have been handled previously - return KErrNone; - } - -void CControlCommand::GenerateSetAbsoluteVolumeResponsePayloadL( - RBuf8& aFramePayload, - const TDesC8& responseData) - { - RRemConAbsoluteVolumeResponse response; - CleanupClosePushL(response); - - response.ReadL(responseData); - if (response.iError != KErrNone) - { - User::Leave(response.iError); - } - TUint8 absVol = KAvrcpMaxAbsoluteVolume * response.iVolume / response.iMaxVolume; - TUint16 len = KLengthSetAbsoluteVolumeResponseParamter<<8 & 0xffff; - TPckgBuf parameterLength(len); - aFramePayload.Append(parameterLength); - aFramePayload.Append( absVol ); - - CleanupStack::PopAndDestroy(&response); - } - -void CControlCommand::DoGenerateNotifyVolumeChangeResponsePayloadL( - RBuf8& aFramePayload, - const TDesC8& responseData) - { - RRemConAbsoluteVolumeResponse response; - CleanupClosePushL(response); - - response.ReadL(responseData); - if (response.iError != KErrNone) - { - User::Leave(response.iError); - } - TUint8 absVol = KAvrcpMaxAbsoluteVolume * response.iVolume / response.iMaxVolume; - TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId); - TUint16 len = KLengthNotifyVolumeChangeResponseParameter<<8 & 0xffff; - TPckgBuf parameterLength(len); - aFramePayload.Append( parameterLength ); - aFramePayload.Append( eventId ); - aFramePayload.Append( absVol ); - - CleanupStack::PopAndDestroy(&response); - } - -TInt CControlCommand::GenerateNotificationResponsePayload(RBuf8& aFramePayload, const TDesC8& responseData) - { - TInt err = KErrNone; - - TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId); - switch(eventId) - { - case ERegisterNotificationVolumeChanged: - { - TRAPD(err, DoGenerateNotifyVolumeChangeResponsePayloadL(aFramePayload, responseData)); - if (err != KErrNone) - { - return KErrAvrcpMetadataInternalError; - } - break; - } - case ERegisterNotificationPlaybackStatusChanged: - case ERegisterNotificationTrackChanged: - case ERegisterNotificationTrackReachedEnd: - case ERegisterNotificationTrackReachedStart: - case ERegisterNotificationPlaybackPosChanged: - case ERegisterNotificationBatteryStatusChanged: - case ERegisterNotificationPlayerApplicationSettingChanged: - case ERegisterNotificationNowPlayingContentChanged: - case ERegisterNotificationAvailablePlayersChanged: - case ERegisterNotificationAddressedPlayerChanged: - case ERegisterNotificationUidsChanged: - { - TUint paramLength = responseData.Length() + 1; - aFramePayload.Append( paramLength >>8 ); - aFramePayload.Append( paramLength ); - aFramePayload.Append( eventId ); - aFramePayload.Append( responseData ); - break; - } - default: - { - err = KErrNotSupported; - break; - } - }; - - return err; - } - -TInt CControlCommand::GenerateMetadataGetCapabilitiesResponsePayloadL(MRemConBearerObserver& /* aObserver */, RBuf8& aFramePayload, const RBuf8& aResponseData) - { - LOG_FUNC - __ASSERT_DEBUG(iPlayerInfoManager, AVRCP_PANIC(EAvrcpNotFullyConstructed)); - TPtr8 responseData = aResponseData.RightTPtr(aResponseData.Length() - KLengthErrorResponse); - - if(responseData[KCapabilityIdOffset] == ECapabilityIdEventsSupported) - { - // Add supported events not handled in the player info API. - RBuf8 eventsBuf; - eventsBuf.CreateL(KNumberEventsNotInPlayerInfoApi); - CleanupClosePushL(eventsBuf); - TInt count = 0; - - // If a specific player (i.e. a specific client ID) has been indicated then - // we add support for the event if supported by the specific player. - // If no specific player has been indicated (i.e. an invalid client ID), then - // general support for the event is added if supported by any player. - // The player info manager APIs handles these different "support" semantics. - - if(iPlayerInfoManager->AbsoluteVolumeSupportedL(ClientId())) - { - count++; - eventsBuf.Append(ERegisterNotificationVolumeChanged ); - } - - if(iPlayerInfoManager->BrowsingSupportedL(ClientId())) - { - count += 2; - eventsBuf.Append(ERegisterNotificationNowPlayingContentChanged ); - eventsBuf.Append(ERegisterNotificationUidsChanged ); - } - - // If there are any browsing clients then mark support for the player addressing - // events. Without browsing support the remote will not be able to see the - // information about the players so it is better not to let them see events - // relating to the them - if(iPlayerInfoManager->BrowsingSupportedL(KNullClientId)) - { - count+= 2; - eventsBuf.Append(ERegisterNotificationAvailablePlayersChanged ); - eventsBuf.Append(ERegisterNotificationAddressedPlayerChanged ); - } - - responseData[1] += count; - - TInt packageLength = responseData.Length()+ count; - aFramePayload.Append(packageLength>>8); - aFramePayload.Append(packageLength); - aFramePayload.Append(responseData); - aFramePayload.Append(eventsBuf); - - CleanupStack::PopAndDestroy(&eventsBuf); - } - else - { - TInt packageLength = responseData.Length(); - aFramePayload.Append(packageLength>>8); - aFramePayload.Append(packageLength); - aFramePayload.Append(responseData); - } - return KErrNone; - } -TMetadataTransferPDUID MetadataTransferParser::GetNotifyEventID(const TPtrC8& aData) - { - return static_cast(aData[KVendorDependentNotifyEventIdOffset]); - } - -TMetadataTransferPDUID MetadataTransferParser::GetPDUID(const TPtrC8& aData) - { - return static_cast(aData[KVendorDependentRequestPDUId]); - } - -TUint16 MetadataTransferParser::GetParamLength(const TPtrC8& aData) - { - TUint16 paramLength; - paramLength = aData[KVendorDependentRequestParamLenMSB] << 8; - paramLength += aData[KVendorDependentRequestParamLenLSB]; - return paramLength; - } - -TUint16 MetadataTransferParser::GetPassThroughOperationId(const TPtrC8& aData) - { - TUint16 operation; - operation = aData[KPassThroughRequestOperationIdMSB] << 8; - operation += aData[KPassThroughRequestOperationIdLSB]; - return operation; - } - - -TInt CControlCommand::RespondToInforms(TMetadataTransferPDUID aMetadataPDUID) - { - CAVCFrame* frame = NULL; - TRAPD(err, frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId)); - - RBuf8 respPayload; - err = respPayload.Create(KAVRCPMinVendorDependentResponseLen); - if (err == KErrNone) - { - respPayload.Append(aMetadataPDUID); - respPayload.Append(EUnfragmented); // No fragmentation needed - respPayload.Append(0); // no params - respPayload.Append(0); // no params - - frame->SetType(AVC::EAccepted); - frame->Append(respPayload); - - delete iFrame; - iFrame = frame; - respPayload.Close(); - } - else - { - err = KErrAvrcpMetadataInternalError; - } - return err; - } - -void CControlCommand::GenerateMetadataRejectPayloadL(TInt aError) - { - CAVCFrame* frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId); - frame->SetType(AVC::ERejected); - - frame->Append(iFrame->Data()[6]); // PDU ID - frame->Append(EUnfragmented); - - // Param length - 2 bytes - frame->Append(0x0); - frame->Append(0x1); - - TUint8 avcError = 0; - switch (aError) - { - case KErrAvrcpMetadataInvalidCommand: - { - avcError = EInvalidCommand; - break; - } - case KErrAvrcpMetadataInvalidParameter: - { - avcError = EInvalidParameter; - break; - } - case KErrAvrcpMetadataParameterNotFound: - { - avcError = EParameterNotFound; - break; - } - case KErrAvrcpMetadataInternalError: - { - avcError = EInternalError; - break; - } - case KErrAvrcpAirInvalidCommand: - case KErrAvrcpAirInvalidParameter: - case KErrAvrcpAirParameterNotFound: - case KErrAvrcpAirInternalError: - case KErrAvrcpAirSuccess: - case KErrAvrcpAirUidChanged: - case KErrAvrcpAirReserved: - case KErrAvrcpAirInvalidDirection: - case KErrAvrcpAirNotADirectory: - case KErrAvrcpAirDoesNotExist: - case KErrAvrcpAirInvalidScope: - case KErrAvrcpAirRangeOutOfBounds: - case KErrAvrcpAirUidIsADirectory: - case KErrAvrcpAirMediaInUse: - case KErrAvrcpAirNowPlayingListFull: - case KErrAvrcpAirSearchNotSupported: - case KErrAvrcpAirSearchInProgress: - case KErrAvrcpAirInvalidPlayerId: - case KErrAvrcpAirPlayerNotBrowesable: - case KErrAvrcpAirPlayerNotAddressed: - case KErrAvrcpAirNoValidSearchResults: - case KErrAvrcpAirNoAvailablePlayers: - case KErrAvrcpAirAddressedPlayerChanged: - { - avcError = KErrAvrcpAirBase - aError; - break; - } - } - frame->Append(avcError); - delete iFrame; - iFrame = frame; - } - -/** Decode a SetAbsoluteVolume PDU ID: 0x50 and SetAbsoluteTarget call the API - */ -TInt CControlCommand::ParseSetAbsoluteVolume(TPtrC8& aMtPayload) - { - if (aMtPayload.Length() != KLengthSetAbsoluteVolumeRequestParameter) - { - return KErrAvrcpMetadataInvalidCommand; - } - - iOperationId = KRemConSetAbsoluteVolume; - iInterfaceUid = TUid::Uid(KRemConAbsoluteVolumeTargetApiUid); - - TBuf8 payload; - TRAPD(err, DoParseSetAbsoluteVolumeL(aMtPayload, payload)); - if (err != KErrNone) - { - return KErrAvrcpMetadataInternalError; - } - - return AppendIncomingPayload(payload); - } - -void CControlCommand::DoParseSetAbsoluteVolumeL(const TPtrC8& aMtPayload, TDes8& aPayload) - { - RRemConAbsoluteVolumeRequest request; - CleanupClosePushL(request); - request.iVolume = KAbsoluteVolumeMask & aMtPayload[KLengthSetAbsoluteVolumeRequestParameter - 1]; - request.iMaxVolume = KAvrcpMaxAbsoluteVolume; - request.WriteL(aPayload); - CleanupStack::PopAndDestroy(&request); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpadvancedcontrol.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpadvancedcontrol.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#include -#include -#include "avrcpinternalinterface.h" -#include "avrcplog.h" -#include "avrcputils.h" -#include "browsecommand.h" -#include "browsingframe.h" -#include "mediabrowse.h" -#include "nowplaying.h" - -TInt CBrowseCommand::HandleSetBrowsedPlayer() - { - LOG_FUNC - - TPtrC8 payload; - AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload); - if (payload.Length() < KMinLengthSetBrowsedPlayerPdu) - { - return KErrAvrcpAirInvalidCommand; - } - - iOperationId = ESetBrowsedPlayerOperationId; - iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid); - - RRemConSetBrowsedPlayerRequest request; - request.iPlayerId = static_cast(payload[0]) << 8; - request.iPlayerId |= payload[1]; - request.iMaxResponse = iMaxResponse; - TBuf8 buf; - // Only reason for WriteL to leave is insufficently large buffer - TRAP_IGNORE(request.WriteL(buf)); - TInt err = AppendIncomingPayload(buf); - return (err == KErrNone) ? KErrAvrcpFurtherProcessingRequired : err; - } - -TInt CBrowseCommand::HandleGetFolderItems() - { - LOG_FUNC - - TPtrC8 payload; - AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload); - if (payload.Length() < KMinLengthGetFolderItemsPdu) - { - return KErrAvrcpAirInvalidCommand; - } - - TInt err = KErrAvrcpInvalidScope; - switch(iFrame[3]) - { - case AvrcpBrowsing::KMediaPlayerScope: - { - iOperationId = EAvrcpInternalGetFolderItems; - iInterfaceUid = TUid::Uid(KUidAvrcpInternalInterface); - err = (AppendIncomingPayload(payload) == KErrNone) ? KErrAvrcpInternalCommand : err; - break; - } - case AvrcpBrowsing::KVirtualFilesystemScope: - case AvrcpBrowsing::KSearchScope: - case AvrcpBrowsing::KNowPlayingScope: - { - iOperationId = EGetFolderItemsOperationId; - iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid); - err = AppendIncomingPayload(payload); - break; - } - }; - - return err; - } - -TInt CBrowseCommand::HandleChangePath() - { - LOG_FUNC - - TPtrC8 payload; - AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload); - if (payload.Length() < KMinLengthChangePathPdu) - { - return KErrAvrcpAirInvalidCommand; - } - - iOperationId = EChangePathOperationId; - iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid); - return AppendIncomingPayload(payload); - } - -TInt CBrowseCommand::HandleGetItemAttributes() - { - LOG_FUNC - - TPtrC8 payload; - AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload); - if (payload.Length() < KMinLengthGetItemAttributesPdu) - { - return KErrAvrcpAirInvalidCommand; - } - - iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid); - iOperationId = EGetItemAttributesOperationId; - return AppendIncomingPayload(payload); - } - -TInt CBrowseCommand::HandleSearch() - { - LOG_FUNC - - TPtrC8 payload; - AvrcpBrowsing::BrowsingFrame::Payload(iFrame, payload); - if (payload.Length() < KMinLengthSearchPdu) - { - return KErrAvrcpAirInvalidCommand; - } - - iOperationId = ESearchOperationId; - iInterfaceUid = TUid::Uid(KRemConMediaBrowseApiUid); - return AppendIncomingPayload(payload); - } - -/** Allocate correct space and append the payload to iCommandData - */ -TInt CBrowseCommand::AppendIncomingPayload(const TPtrC8& aPayload) - { - iCommandData.Close(); - if (iCommandData.Create(aPayload.Length()) != KErrNone) - { - return KErrAvrcpAirInternalError; - } - - iCommandData.Append(aPayload); - - return KErrNone; - } - -TInt CBrowseCommand::HandleUnknownPdu() - { - iFrame.Close(); - TInt err = iFrame.CreateMax(KMinLengthGeneralReject); - if(!err) - { - iFrame[0] = AvrcpBrowsing::EGeneralReject; - iFrame[1] = (KMinLengthGeneralReject - AvrcpBrowsing::KHeaderLength) >> 8; - iFrame[2] = (KMinLengthGeneralReject - AvrcpBrowsing::KHeaderLength); - iFrame[3] = KErrAvrcpAirInvalidCommand - KErrAvrcpAirBase; - } - return err ? err : KErrAvrcpHandledInternallyRespondNow; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpbrowsingcommandhandler.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpbrowsingcommandhandler.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,489 +0,0 @@ -// Copyright (c) 2004-2009 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: -// avrcpincomingcommandhandler.cpp -// - - - -/** - @file - @internalComponent - @released -*/ -#include -#include -#include - -#include "browsecommand.h" -#include "avrcpbrowsingcommandhandler.h" -#include "avrcpinternalinterface.h" -#include "avrcplog.h" -#include "avrcprouter.h" -#include "avrcputils.h" -#include "browsingframe.h" -#include "bulkbearer.h" -#include "mediabrowse.h" -#include "remconcommandinterface.h" - -//------------------------------------------------------------------------------------ -// Construction/Destruction -//------------------------------------------------------------------------------------ - -/** Factory function. - -@param aCommandInterface The interface for providing commands that have been handled. -@param aRouter A CRcpRouter to use for communication with remote devices. -@param aPlayerInfoManager The central manager for player information. -@param aAddr The Bluetooth device address for the remote device handled by this handler. -@return A fully constructed CRcpBrowsingCommandHandler. -@leave System wide error codes. -*/ -CRcpBrowsingCommandHandler* CRcpBrowsingCommandHandler::NewL(MRemConBulkCommandInterface& aCommandInterface, - CBulkRouter& aRouter, - CAvrcpPlayerInfoManager& aPlayerInfoManager, - const TBTDevAddr& aAddr) - { - LOG_STATIC_FUNC - CRcpBrowsingCommandHandler* handler = new(ELeave) CRcpBrowsingCommandHandler(aCommandInterface, aRouter, aPlayerInfoManager, aAddr); - return handler; - } - -/** -@param aCommandInterface The interface for providing commands that have been handled. -@param aRouter A CRcpRouter to use for communication with remote devices. -@param aPlayerInfoManager The central manager for player information. -@param aAddr The Bluetooth device address for the remote device handled by this handler. -@return A partially constructed CRcpBrowsingCommandHandler. -*/ -CRcpBrowsingCommandHandler::CRcpBrowsingCommandHandler(MRemConBulkCommandInterface& aCommandInterface, - CBulkRouter& aRouter, - CAvrcpPlayerInfoManager& aPlayerInfoManager, - const TBTDevAddr& aAddr) - : iCommandQueue(_FOFF(CBrowseCommand, iHandlingLink)) - , iInternalCommandQueue(_FOFF(CBrowseCommand, iHandlingLink)) - , iCommandInterface(aCommandInterface) - , iRouter(aRouter) - , iMtu(335) // initialise to min for browse channel - , iPlayerInfoManager(aPlayerInfoManager) - , iAddr(aAddr) - { - LOG_FUNC - } - -CRcpBrowsingCommandHandler::~CRcpBrowsingCommandHandler() - { - LOG_FUNC - - while (!iCommandQueue.IsEmpty()) - { - CBrowseCommand *command = iCommandQueue.First(); - HandledCommand(*command); - } - - TRemConAddress remConAddr; - AvrcpUtils::BTToRemConAddr(iAddr, remConAddr); - iCommandInterface.MrcbciRemoveAddressing(remConAddr); - } - -//--------------------------------------------------------------------- -// Called from the bearer -//--------------------------------------------------------------------- - -/** Tell the handler to gracefully shutdown. - -*/ -void CRcpBrowsingCommandHandler::Disconnect() - { - LOG_FUNC - - while (!iCommandQueue.IsEmpty()) - { - CBrowseCommand* command = iCommandQueue.First(); - iRouter.RemoveFromSendQueue(*command); - - HandledCommand(*command); - } - } - -//------------------------------------------------------------------------------------ -// Called by router -//------------------------------------------------------------------------------------ - -/** Receive an incoming AVRCP browse command. - -@param aMessageInformation The command data from the AVCTP message. -@param aTransactionLabel AVCTP transaction label for this command. -@param aAddr The bluetooth device from which this command originated. -@leave System Wide Error code -*/ -void CRcpBrowsingCommandHandler::ReceiveCommandL(const TDesC8& aMessageInformation, - SymbianAvctp::TTransactionLabel aTransactionLabel, - const TBTDevAddr& aAddr) - { - LOG_FUNC - - // If there's nothing beyond a header this is bobs. Dump it now. - AvrcpBrowsing::BrowsingFrame::VerifyFrameL(aMessageInformation); - - TUint id = iCommandInterface.MrcciNewTransactionId(); - CBrowseCommand* command = CBrowseCommand::NewL(aMessageInformation, id, aTransactionLabel, aAddr, &iPlayerInfoManager); - CleanupStack::PushL(command); - - TInt result = command->ProcessIncomingCommandL(iMtu); - CleanupStack::Pop(command); - - command->IncrementUsers(); - - switch(result) - { - case KErrAvrcpFurtherProcessingRequired: - { - // The only command that we need to check out before sending on is - // SetBrowsedPlayer. Although it's been parsed to verify that it's - // a syntactically valid command we need to ensure that the selected - // player is available before sending it on. - - __ASSERT_DEBUG(command->RemConInterfaceUid() == TUid::Uid(KRemConMediaBrowseApiUid) && command->RemConOperationId() == ESetBrowsedPlayerOperationId, AVRCP_PANIC(EFurtherProcessingRequiredForNonSetBrowsedPlayer)); - TBool valid = HandleSetBrowsedPlayer(*command); - - if(!valid) - { - Respond(*command, result); - command->DecrementUsers(); - break; - } - else - { - result = KErrNone; - } - // valid case fallsthrough to be handled as normal - } - case KErrAvrcpHandledInternallyInformRemCon: // this case falls through - case KErrNone: - { - iCommandQueue.AddLast(*command); - iCommandInterface.MrcciNewCommand(*command); - - if (result == KErrNone) - { - break; - } - // KErrAvrcpHandledInternallyInformRemCon fallsthrough here - } - case KErrAvrcpHandledInternallyRespondNow: - { - // If the command has already set payload, just sent the command - iRouter.AddToSendQueue(*command); - command->DecrementUsers(); - break; - } - case KErrAvrcpInternalCommand: - { - iInternalCommandQueue.AddLast(*command); - HandleInternalCommand(*command); - break; - } - default: - { - Respond(*command, result); - command->DecrementUsers(); - break; - } - }; - } - -/** Called from the router to indicate send completion. - -@param aCommand The command that has been sent. -@param aSendResult KErrNone if the command was sent successfully. System wide - error code otherwise. -*/ -void CRcpBrowsingCommandHandler::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/) - { - LOG_FUNC - // We try and send the response, but if we fail there's not a lot we can do about - // it. Just let the remote assume the response. - } - -void CRcpBrowsingCommandHandler::MaxPacketSize(TInt aMtu) - { - iMtu = aMtu-AvrcpBrowsing::KHeaderLength; - } - -//------------------------------------------------------------------------------------ -// Called by bearer -//------------------------------------------------------------------------------------ - -/** Send a response. - -@param aInterfaceUid The RemCon interface this response is from. -@param aId The RemCon transaction label of the command to respond to. -@param aData The command response data. -@return KErrNotFound if the command was not found on the queue. - System wide error codes. -*/ -TInt CRcpBrowsingCommandHandler::SendRemConResponse(TUid /*aInterfaceUid*/, TUint aId, RBuf8& aData) - { - LOG_FUNC - - return SendResponse(iCommandQueue, aId, aData); - } - -//------------------------------------------------------------------------------------ -// Internal command handling functions -//------------------------------------------------------------------------------------ - - -/** Sends a response to the remote device. - -@param aCommand The command to respond to. -@param aErr The result of handling the command. -*/ -void CRcpBrowsingCommandHandler::Respond(CBrowseCommand& aCommand, TInt aErr) - { - LOG_FUNC - aCommand.SetResult(aErr); - iRouter.AddToSendQueue(aCommand); - } - -/** To be called on completion of command handling. - -This aggregates the handler's tidying up of a finished -command. - -@param aCommand The command to tidy up. -*/ -void CRcpBrowsingCommandHandler::HandledCommand(CBrowseCommand& aCommand) - { - LOG_FUNC - - aCommand.iHandlingLink.Deque(); - aCommand.DecrementUsers(); - } - -void CRcpBrowsingCommandHandler::HandleInternalCommand(CBrowseCommand& aCommand) - { - LOG_FUNC - - TUid interfaceUid; - TUint id; - TUint operationId; - RBuf8 commandData; - TBTDevAddr addr; - - aCommand.GetCommandInfo(interfaceUid, id, operationId, commandData, addr); - - __ASSERT_DEBUG(interfaceUid == TUid::Uid(KUidAvrcpInternalInterface), AvrcpUtils::Panic(EAvrcpInternalHandlingRequestedOnWrongInterface)); - - TInt err = KErrNone; - switch(operationId) - { - case EAvrcpInternalGetFolderItems: - { - err = HandleGetFolderItems(id, commandData); - break; - } - }; - - if(err) - { - HandledCommand(aCommand); - } - - commandData.Close(); - } - -TInt CRcpBrowsingCommandHandler::HandleGetFolderItems(TUint aId, RBuf8& aCommandData) - { - LOG_FUNC - - RBuf8 responseBuf; - TRAPD(err, DoHandleGetFolderItemsL(aCommandData, responseBuf)); - - if(!err) - { - err = SendInternalResponse(aId, responseBuf); - } - - return err; - } - -void CRcpBrowsingCommandHandler::DoHandleGetFolderItemsL(RBuf8& aCommandData, RBuf8& aResponseData) - { - LOG_FUNC - - __ASSERT_DEBUG( &iPlayerInfoManager != NULL, AvrcpUtils::Panic(EAvrcpNotFullyConstructed)); - RAvrcpGetFolderItemsRequest request; - CleanupClosePushL(request); - request.ReadL(aCommandData); - - // Use 4 bytes even though player ids are 2 bytes becuase of - // restrictions on RArray preventing use of non-word aligned types - RArray players; - TInt err = iPlayerInfoManager.PlayerListing(request.iStartItem, request.iEndItem, players); - CleanupStack::PopAndDestroy(&request); - - RRemConMediaErrorResponse errResponse; - if(err != KErrNone) - { - CleanupClosePushL(players); - errResponse.iPduId = AvrcpBrowsing::EGetFolderItems; - errResponse.iStatus = (err == KErrArgument) ? AvrcpStatus::ERangeOutOfBounds : AvrcpStatus::EInternalError; - aResponseData.CreateL(KBrowseResponseBaseLength); - CleanupClosePushL(aResponseData); - errResponse.WriteL(aResponseData); - CleanupStack::Pop(&aResponseData); - CleanupStack::PopAndDestroy(&players); - return; - } - - RAvrcpGetFolderItemsResponse response; - CleanupClosePushL(response); - CleanupClosePushL(players); - for(TInt i = 0; i < players.Count(); i++) - { - RMediaPlayerItem item; - CleanupClosePushL(item); - iPlayerInfoManager.MediaPlayerItemL(players[i], item); - response.iItems.AppendL(item); - CleanupStack::Pop(&item); - } - - response.iPduId = AvrcpBrowsing::EGetFolderItems; - response.iStatus = AvrcpStatus::ESuccess; - response.iUidCounter = KMediaPlayerListUidCounter; - response.iNumberItems = players.Count(); - CleanupStack::PopAndDestroy(&players); - - //check this fits within MTU, Leave if the response size is bigger than max size - CleanupClosePushL(aResponseData); - if(response.Size() > iMtu) - { - - errResponse.iPduId = AvrcpBrowsing::EGetFolderItems; - errResponse.iStatus = AvrcpStatus::EInternalError; - aResponseData.CreateL(KBrowseResponseBaseLength); - errResponse.WriteL(aResponseData); - } - else - { - aResponseData.CreateL(response.Size()); - response.WriteL(aResponseData); - } - CleanupStack::Pop(&aResponseData); - CleanupStack::PopAndDestroy(&response); - } - -TInt CRcpBrowsingCommandHandler::SendInternalResponse(TUint aId, RBuf8& aData) - { - LOG_FUNC - - return SendResponse(iInternalCommandQueue, aId, aData); - } - -TInt CRcpBrowsingCommandHandler::SendResponse(TDblQue& aCommandQueue, TUint aId, RBuf8& aData) - { - LOG_FUNC - - TInt err = KErrNotFound; - - TDblQueIter iter(aCommandQueue); - CBrowseCommand* command = NULL; - - while (iter) - { - command = iter++; - if(command->RemConCommandId() == aId) - { - err = KErrNone; - command->ProcessOutgoingResponse(aData); - - Respond(*command, err); - aData.Close(); - HandledCommand(*command); - - break; - } - } - - return err; - } - -void CRcpBrowsingCommandHandler::SendReject(TUid /*aInterfaceUid*/, TUint aTransactionId) - { - LOG_FUNC; - - TDblQueIter iter(iCommandQueue); - CBrowseCommand* command = NULL; - - while (iter) - { - command = iter++; - if(command->RemConCommandId() == aTransactionId) - { - Respond(*command, KErrAvrcpAirInternalError); - HandledCommand(*command); - } - } - } - -const TBTDevAddr& CRcpBrowsingCommandHandler::BtAddr() const - { - return iAddr; - } - -TBool CRcpBrowsingCommandHandler::HandleSetBrowsedPlayer(CBrowseCommand& aCommand) - { - TInt err = KErrNone; - RRemConSetBrowsedPlayerRequest request; - - TRAP(err, request.ReadL(aCommand.CommandData())); - __ASSERT_DEBUG(err == KErrNone, AvrcpUtils::Panic(ESetBrowsePlayerRequestCorruptedLocally)); - - // Check if selected player exists - TUint16 playerId = request.iPlayerId; - TRemConClientId clientId; - TRAP(err, clientId = iPlayerInfoManager.ClientL(playerId)); - - if(err == KErrNone) - { - // Selected player exists, check with RemCon if we can use it - TRemConAddress remConAddr; - AvrcpUtils::BTToRemConAddr(iAddr, remConAddr); - - TInt err = iCommandInterface.MrcbciSetAddressedClient(remConAddr, clientId); - } - - if(err != KErrNone) - { - // Either the player was incorrect or is already in use, form a RemCon - // format response, then ask the command to process it for sending out - // on the air. - RBuf8 buf; - TInt bufErr = buf.Create(KMediaBrowseOutBufMaxLength); - - if(bufErr == KErrNone) - { - RRemConMediaErrorResponse response; - response.iPduId = 0x70; - response.iStatus = RAvrcpIPC::SymbianErrToStatus(KErrAvrcpAirInvalidPlayerId); - TRAP(bufErr, response.WriteL(buf)); - aCommand.ProcessOutgoingResponse(buf); - buf.Close(); - } - } - // else we will continue processing this command as normal - - return err == KErrNone ? ETrue : EFalse; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpcommand.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpcommand.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#include "avrcpcommand.h" -#include "avrcplog.h" - -CAvrcpCommand::CAvrcpCommand(TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransactionLabel, - const TBTDevAddr& aAddr) - : iRemConId(aRemConId) - , iTransactionLabel(aTransactionLabel) - , iRemoteAddr(aAddr) - { - LOG_FUNC - } - -//------------------------------------------------------------------------------------ -// Called by handlers, router and bearer -//------------------------------------------------------------------------------------ - -/** Decrement the users of this command. - -This must be called by users of the command when they -no longer require the command to remain in existence. -When the number of users reaches zero, the command -is deleted. -*/ -void CAvrcpCommand::DecrementUsers() - { - LOG_FUNC - if(--iUsers < 1) - { - iHandlingLink.Deque(); - delete this; - } - } - -/** Increment the users of this command. - -This must be called by users of the command to signify -they require it to remain in existence. -*/ -void CAvrcpCommand::IncrementUsers() - { - LOG_FUNC - iUsers++; - } - -//------------------------------------------------------------------------------------ -// Called by bearer -//------------------------------------------------------------------------------------ - -/** Get info needed by RemCon for this command. - -@param aInterfaceUid On return, the RemCon interface of this command. -@param aId On return, the RemCon transaction id of this command. -@param aOperationId On return, the RemCon operation id of this command. -@param aCommandData On return, the command data for this operation. - Ownership is returned. -@param aAddr On return, the originating device for this command. -*/ -void CAvrcpCommand::GetCommandInfo(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TBTDevAddr& aAddr) - { - LOG_FUNC - aInterfaceUid = iInterfaceUid; - aId = iRemConId; - aOperationId = iOperationId; - - // RemCon will take ownership of command data - aCommandData.Assign(iCommandData); - iCommandData.Assign(NULL); - - aAddr = iRemoteAddr; - } - -//------------------------------------------------------------------------------------ -// Called by handlers -//------------------------------------------------------------------------------------ - -/** Gets the remote associated with this command. -This may be the source or the destination, depending -on if the originated locally or remotely. - -@return The BT address of the remote device. -*/ -const TBTDevAddr& CAvrcpCommand::RemoteAddress() const - { - LOG_FUNC - return iRemoteAddr; - } - -/** Gets the AVCTP transaction label for this command. -This is used to match commands with responses. - -@return The AVCTP transaction label for this command. -*/ -SymbianAvctp::TTransactionLabel CAvrcpCommand::TransactionLabel() const - { - LOG_FUNC - return iTransactionLabel; - } - -/** Gets the RemCon id of this command. -This is used to uniquely identify a transaction to RemCon. - -@return The RemCon command id. -*/ -TUint CAvrcpCommand::RemConCommandId() const - { - LOG_FUNC - return iRemConId; - } - -/** Gets the RemCon interface uid of this command. - -This is used with the operation id to uniquely identify an operation to RemCon. - -@param aOperation -@return The RemCon operation id. -*/ -const TUid& CAvrcpCommand::RemConInterfaceUid() const - { - LOG_FUNC - return iInterfaceUid; - } - -/** Gets the RemCon operation id of this command. - -This is used with the interface uid to uniquely identify an operation to RemCon. - -@param aOperation -@return The RemCon operation id. -*/ -TUint CAvrcpCommand::RemConOperationId() const - { - LOG_FUNC - return iOperationId; - } - - -/** -Whether the Bearer is aware of this command. If not we shouldn't -inform the bearer of responses. -*/ -TBool CAvrcpCommand::KnownToBearer() const - { - return iKnownToBearer; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpcommandframer.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpcommandframer.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include -#include "avrcpcommandframer.h" -#include "avcframe.h" -#include "avrcplog.h" -#include -#include - -// The Bluetooth SIG registered VendorId, see table 4.7 -const AVC::TAVCVendorId KBluetoothSIGVendorId = 0x001958; - -/** Returns a new CAVCFrame representing an AV/C passthrough command. -@param aOperationId The AV/C operation id of this command. -@param aButtonAction The AV/C button action. -@return An AV/C frame representing a passthrough command. -@leave error -*/ -CAVCFrame* AvrcpCommandFramer::PassthroughL(AVCPanel::TOperationId aOperationId, AVCPanel::TButtonAction aButtonAction) - { - LOG_STATIC_FUNC - CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::EControl, AVC::EPanel, AVC::EID0); - frame->Append(TChar(AVC::EPassThrough)); - frame->Append(TChar(aOperationId | aButtonAction)); - frame->Append(TChar(0)); - return frame; - } - -/** Returns a new CAVCFrame representing an AV/C Unit Info response. -@return An AV/C frame representing a Unit Info response. -@leave error -*/ -CAVCFrame* AvrcpCommandFramer::UnitInfoResponseL() - { - LOG_STATIC_FUNC - CAVCFrame* frame = CAVCFrame::NewL(AVC::EResponse, AVC::EStable, AVC::EUnit, AVC::EIgnore); - frame->Append(TChar(AVC::EUnitInfo)); - frame->Append(TChar(0x7)); - frame->Append(TChar(0x48)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - return frame; - } - -/** Returns a new CAVCFrame representing an AV/C Subunit Info response. -@return An AV/C frame representing a Subunit Info response. -@leave error -*/ -CAVCFrame* AvrcpCommandFramer::SubunitInfoResponseL() - { - LOG_STATIC_FUNC - CAVCFrame* frame = CAVCFrame::NewL(AVC::EResponse, AVC::EStable, AVC::EUnit, AVC::EIgnore); - frame->Append(TChar(AVC::ESubunitInfo)); - frame->Append(TChar(0x7)); - frame->Append(TChar(0x48)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - return frame; - } - -/** Returns a new CAVCFrame representing an AV/C 'set absolute volume' command -@return An AV/C frame representing a 'set absolute volume' command. -@leave error -*/ -CAVCFrame* AvrcpCommandFramer::SetAbsoluteVolumeCommandL(TUint8 aAbsVol) - { - LOG_STATIC_FUNC - CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::EControl, AVC::EPanel, AVC::EID0); - frame->Append(TChar(AVC::EVendorDependent)); - frame->Append(KBluetoothSIGVendorId>>16 & 0xff); - frame->Append(KBluetoothSIGVendorId>>8 & 0xff); - frame->Append(KBluetoothSIGVendorId & 0xff); - - frame->Append(ESetAbsoluteVolume); - frame->Append(TChar(AVC::EASingle)); - - TUint16 len = KLengthSetAbsoluteVolumeRequestParameter<<8 & 0xffff; - TPckgBuf parameterLength(len); - frame->Append(parameterLength); - frame->Append(aAbsVol); - return frame; - } - -/** Returns a new CAVCFrame representing an AV/C 'Register notification absolute volume changed' command. -@return An AV/C frame representing a 'Register notification absolute volume changed' command. -@leave error -*/ -CAVCFrame* AvrcpCommandFramer::NotifyVolumeChangeCommandL() - { - LOG_STATIC_FUNC - CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::ENotify, AVC::EPanel, AVC::EID0); - frame->Append(TChar(AVC::EVendorDependent)); - frame->Append(KBluetoothSIGVendorId>>16 & 0xff); - frame->Append(KBluetoothSIGVendorId>>8 & 0xff); - frame->Append(KBluetoothSIGVendorId & 0xff); - - frame->Append(ERegisterNotification); - frame->Append(TChar(AVC::EASingle)); - - TUint16 len = KLengthNotifyVolumeChangeRequestParameter<<8 & 0xffff; - TPckgBuf parameterLength(len); - frame->Append(parameterLength); - frame->Append(ERegisterNotificationVolumeChanged); - - TBuf8<4> reservedBuffer(KLengthNotifyVolumeChangeRequestParameter - 1); - reservedBuffer.FillZ(); - frame->Append(reservedBuffer); - return frame; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpfragmenter.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpfragmenter.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -// Copyright (c) 2007-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include "avrcpfragmenter.h" -#include "controlcommand.h" -#include - -// Maximum size of data in a fragment response -static const int KFragmentDataLength = KAVCMaxVendorDependentPayload - KAVRCPMinVendorDependentResponseLen; - - -CAVRCPFragmenter* CAVRCPFragmenter::NewL() - { - CAVRCPFragmenter* self = new (ELeave) CAVRCPFragmenter(); - self->Construct(); - return self; - } - -TBool CAVRCPFragmenter::InFragmentedState() - { - return iInFragmentedState; - } - -void CAVRCPFragmenter::Reset() - { - iStart = KAVRCPMinVendorDependentResponseLen; - iInFragmentedState = EFalse; - } - -void CAVRCPFragmenter::AssignPayload(const RBuf8& aPayload) - { - // Assign the allocated memory containing the reponse to - // this class, allowing the caller to Close() aPayload. - iPayload.Close(); - iPayload.Assign(aPayload); - iInFragmentedState = ETrue; - } - -TPtr8 CAVRCPFragmenter::GetNextFragmentHeader() - { - if (! InFragmentedState()) - return TPtr8(0,0,0); - - // Fragmentation byte is 2nd byte of response; poke this - // and set the length correctly - if (iStart == KAVRCPMinVendorDependentResponseLen) - { - iPayload[1] = EFragmentStart; - iPayload[2] = (KFragmentDataLength >> 8) & 0xff; - iPayload[3] = (KFragmentDataLength) & 0xff; - } - else if (LastFragment()) - { - iPayload[1] = EFragmentEnd; - TInt length = iPayload.Length() - iStart; - iPayload[2] = (length >> 8) & 0xff; - iPayload[3] = (length) & 0xff; - } - else - { - iPayload[1] = EFragmentContinue; - iPayload[2] = (KFragmentDataLength >> 8) & 0xff; - iPayload[3] = (KFragmentDataLength) & 0xff; - } - - // Return the first 4 bytes, which contain the PDU id, - // fragmentation status and parameter length (2 bytes) - return iPayload.MidTPtr(0, KAVRCPMinVendorDependentResponseLen); - } - -TPtr8 CAVRCPFragmenter::GetNextFragment() - { - if (! InFragmentedState()) - return TPtr8(0,0,0); - - // Sigh. MidTPtr() PANICs if the 2nd argument is too large. - // Other APIs (e.g. Java, STL) just return to end of string. - TInt fragmentSize = KFragmentDataLength; - if (LastFragment()) - fragmentSize = iPayload.Length() - iStart; - - TPtr8 fragment = iPayload.MidTPtr(iStart, fragmentSize); - - if (LastFragment()) - Reset(); - else - iStart += fragmentSize; - return fragment; - } - -TBool CAVRCPFragmenter::LastFragment() - { - if (iStart + KFragmentDataLength > iPayload.Length()) - return ETrue; - else - return EFalse; - } - -TInt CAVRCPFragmenter::GetPDU() - { - return iPayload[0]; - } - -void CAVRCPFragmenter::Construct() - { - Reset(); - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpimplementationproxy.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpimplementationproxy.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -// Copyright (c) 2004-2009 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: -// rcpimplementationproxy.cpp -// - -#include -#include -#include -#include "controlbearer.h" - -// __________________________________________________________________________ -// Exported proxy for instantiation method resolution -// Define the interface UIDs - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KRemConBearerAvrcpImplementationUid, CRemConBearerAvrcp::NewL) - }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpincomingcommandhandler.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,879 +0,0 @@ -// Copyright (c) 2004-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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include -#include -#include - -#include "controlcommand.h" -#include "avrcpcommandframer.h" -#include "avrcpincomingcommandhandler.h" -#include "avrcpinternalinterface.h" -#include "avrcplog.h" -#include "avrcprouter.h" -#include "avrcptimer.h" -#include "avrcputils.h" -#include "controlbearer.h" -#include "passthroughhelper.h" -#include "mediainformation.h" -#include "nowplaying.h" -#include "playerinformation.h" -#include "remconbattery.h" -#include "remcongroupnavigation.h" - -//------------------------------------------------------------------------------------ -// Construction/Destruction -//------------------------------------------------------------------------------------ - -/** Factory function. - -@param aBearer The CRemConBearerAvrcp this is to handle commands for. -@param aObserver The observer of the bearer. Used to acquire converters. -@param aRouter A CRcpRouter to use for communication with remote devices. -@param aTimer CDeltaTimer to use for queuing timed events. -@return A fully constructed CRcpIncomingCommandHandler. -@leave System wide error codes. -*/ -CRcpIncomingCommandHandler* CRcpIncomingCommandHandler::NewL(MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CRcpRouter& aRouter, - CDeltaTimer& aTimer, - CAvrcpPlayerInfoManager& aPlayerInfoManager, - TBTDevAddr& aDevice) - { - LOG_STATIC_FUNC - CRcpIncomingCommandHandler* handler = new(ELeave)CRcpIncomingCommandHandler(aCommandInterface, aObserver, aRouter, aTimer, aPlayerInfoManager, aDevice); - CleanupStack::PushL(handler); - handler->ConstructL(); - CleanupStack::Pop(handler); - return handler; - } - -/** Constructor. - -@param aBearer The CRemConBearerAvrcp this is to handle commands for. -@param aObserver The observer of the bearer. Used to aquire converters. -@param aRouter A CRcpRouter to use for communication with remote devices. -@param aTimer CDeltaTimer to use for queuing timed events. -@return A partially constructed CRcpIncomingCommandHandler. -@leave System wide error codes. -*/ -CRcpIncomingCommandHandler::CRcpIncomingCommandHandler(MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CRcpRouter& aRouter, - CDeltaTimer& aTimer, - CAvrcpPlayerInfoManager& aPlayerInfoManager, - TBTDevAddr& aDevice) - : iCommandQueue(_FOFF(CControlCommand, iHandlingLink)) - , iInternalCommandQueue(_FOFF(CControlCommand, iHandlingLink)) - , iFragmenter(NULL) - , iCommandInterface(aCommandInterface) - , iObserver(aObserver) - , iRouter(aRouter) - , iTimer(aTimer) - , iAddressedMode(EFalse) - , iPlayerInfoManager(aPlayerInfoManager) - , iDevice(aDevice) - { - LOG_FUNC - } - -void CRcpIncomingCommandHandler::ConstructL() - { - LOG_FUNC - - iFragmenter = CAVRCPFragmenter::NewL(); - iPlayerInfoManager.AddObserverL(*this); - - RArray players; - iPlayerInfoManager.PlayerListing(players); - CleanupClosePushL(players); - - if(players.Count()) - { - // Start out with the first player as default. TSP will need to update - // us if it wants to set a different one. Note that this wont be used - // unless we enter addressed mode anyway. - iClientId = iPlayerInfoManager.ClientL(0); - } - // if no player have yet been registered we'll set the default when the - // first one is - - CleanupStack::PopAndDestroy(&players); - - iPassthroughHelper = CPassthroughHelper::NewL(iRouter, iCommandInterface, iTimer); - } - -/** Destructor. -*/ -CRcpIncomingCommandHandler::~CRcpIncomingCommandHandler() - { - LOG_FUNC - - iCommandInterface.MrccciUnregisterForLocalAddressedClientUpdates(); - iPlayerInfoManager.RemoveObserver( *this ); - delete iFragmenter; - delete iPassthroughHelper; - - // All commands should have been handled by the time we reach here. - __ASSERT_ALWAYS(iCommandQueue.IsEmpty(), AvrcpUtils::Panic(EAvrcpIncomingCommandsNotHandled)); - __ASSERT_ALWAYS(iInternalCommandQueue.IsEmpty(), AvrcpUtils::Panic(EAvrcpIncomingCommandsNotHandled)); - } - -//--------------------------------------------------------------------- -// Called from the bearer -//--------------------------------------------------------------------- - -/** Tell the handler to gracefully shutdown. - -*/ -void CRcpIncomingCommandHandler::Disconnect() - { - LOG_FUNC - - iPassthroughHelper->Disconnect(); - - if(!iCommandQueue.IsEmpty()) - { - // Cleanup remaining commands - while(!iCommandQueue.IsEmpty()) - { - CControlCommand* command = iCommandQueue.First(); - // Tell RemCon the command is finished with - iObserver.CommandExpired(command->RemConCommandId()); - // And now remove the command from the bearer - iRouter.RemoveFromSendQueue(*command); - HandledCommand(*command); - } - } - if(!iInternalCommandQueue.IsEmpty()) - { - - // Cleanup remaining commands - while(!iInternalCommandQueue.IsEmpty()) - { - CControlCommand* command = iInternalCommandQueue.First(); - // Tell RemCon the command is finished with - iObserver.CommandExpired(command->RemConCommandId()); - // And now remove the command from the bearer - iRouter.RemoveFromSendQueue(*command); - HandledCommand(*command); - } - } - } - -//------------------------------------------------------------------------------------ -// Called by router -//------------------------------------------------------------------------------------ - -void CRcpIncomingCommandHandler::MaxPacketSize(TInt /*aMtu*/) - { - // ignore - we don't care if we use AVCTP fragmentation on the - // control channel - } - -/** Receive an incoming AVRCP command. - -The command is parsed from a CAVCFrame into a CControlCommand owned by the -command handler. - -@param aFrame The AVC frame contained within the AVCTP message. -@param aTransactionLabel AVCTP transaction label for this command. -@param aAddr The bluetooth device from which this command originated. -@leave System Wide Error code -*/ -void CRcpIncomingCommandHandler::ReceiveCommandL(const TDesC8& aMessageInformation, - SymbianAvctp::TTransactionLabel aTransactionLabel, - const TBTDevAddr& aAddr) - { - LOG_FUNC - - TUint id = iCommandInterface.MrcciNewTransactionId(); - - // If there's nothing beyond a header this is bobs. Dump it now. - if(aMessageInformation.Length() <= KAVCFrameHeaderLength) - { - User::Leave(KErrCorrupt); - } - - // Parse it out into an AV/C frame - CAVCFrame* frame = CAVCFrame::NewL(aMessageInformation, AVC::ECommand); - - CControlCommand* command = CControlCommand::NewL(frame, id, aTransactionLabel, aAddr, iAddressedMode ? iClientId : KNullClientId, &AvrcpPlayerInfoManager()); - CleanupStack::PushL(command); - - TInt result = command->ParseIncomingCommandL(iObserver, *iFragmenter); - CleanupStack::Pop(command); - - command->IncrementUsers(); - - switch(result) - { - case KErrAvrcpHandledInternallyInformRemCon: - { - HandleRemConCommand(*command); - iRouter.AddToSendQueue(*command); - command->DecrementUsers(); - break; - } - case KErrNone: - { - if(! command->IsPassthrough()) - { - // add to iCommandQueue for non-passthrough commands - iCommandQueue.AddLast(*command); - } - HandleRemConCommand(*command); - break; - } - case KErrAvrcpInternalCommand: - { - iInternalCommandQueue.AddLast(*command); - HandleInternalCommand(*command); - break; - } - case KErrAvrcpInvalidCType: - { - // We should ignore commands with invalid ctype (AV/C v4.0 8.3.1). - command->DecrementUsers(); - break; - } - default: - { - Respond(*command, result); - command->DecrementUsers(); - break; - } - } - } - -/** Called from the router to indicate send completion. - -@param aCommand The command that has been sent. -@param aSendResult KErrNone if the command was sent successfully. System wide - error code otherwise. -*/ -void CRcpIncomingCommandHandler::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/) - { - LOG_FUNC - // We try and send the response, but if we fail there's not a lot we can do about - // it. Just let the remote assume the response. - } - -//------------------------------------------------------------------------------------ -// Called by bearer -//------------------------------------------------------------------------------------ - -/** Send a response. - -@param aInterfaceUid The RemCon interface this response is from. -@param aId The RemCon transaction label of the command to respond to. -@param aData The command response data. -@return KErrNone. -*/ -TInt CRcpIncomingCommandHandler::SendRemConResponse(TUid /*aInterfaceUid*/, TUint aId, RBuf8& aData) - { - LOG_FUNC - - // We always take ownership of the response data in SendResponse, so we - // always return KErrNone. - SendResponse(iCommandQueue, aId, aData); - return KErrNone; - } - -void CRcpIncomingCommandHandler::SendReject(TUid aInterfaceUid, TUint aId) - { - LOG_FUNC - - TDblQueIter iter(iCommandQueue); - CControlCommand* command = NULL; - - while (iter) - { - command = iter++; - if(command->RemConCommandId() == aId) - { - TInt err = KErrGeneral; - if (aInterfaceUid.iUid == KRemConMediaInformationApiUid || aInterfaceUid.iUid == KRemConPlayerInformationUid) - { - err = KErrAvrcpMetadataInternalError; - } - - Respond(*command, err); - - HandledCommand(*command); - } - } - } - -//------------------------------------------------------------------------------------ -// MPlayerChangeObserver functions -//------------------------------------------------------------------------------------ -void CRcpIncomingCommandHandler::MpcoAvailablePlayersChanged() - { - LOG_FUNC - - TDblQueIter internalIter(iInternalCommandQueue); - CControlCommand* command = NULL; - TInt err = KErrNone; - - while(internalIter) - { - command = internalIter++; - if((command->RemConInterfaceUid() == TUid::Uid(KUidAvrcpInternalInterface)) && (command->RemConOperationId() == EAvrcpInternalAvailablePlayersNotification)) - { - // If this fails we cann't send the notification - just give up - err = HandleRegisterAvailablePlayersNotification(*command); - static_cast(err = err); // ignore this error (i.e. give up). - } - } - //register internal notification - //still need to optimize for avoid re-registering notification - RArray players; - err = iPlayerInfoManager.PlayerListing(players); - - if(err == KErrNone) - { - TBool currentClientAvailable = EFalse; - - for(TInt i = 0 ; i < players.Count() ; i++) - { - TRemConClientId clientId = 0; - clientId = iPlayerInfoManager.Client(players[i]); - if(clientId == iClientId) - { - currentClientAvailable = ETrue; - } - } - - if((iClientId == KNullClientId || !currentClientAvailable) && players.Count()) - { - // If this is the first target client we set our default client id - // to this - iClientId = iPlayerInfoManager.Client(players[0]); - } - } - - players.Close(); - } - -void CRcpIncomingCommandHandler::MpcoAddressedPlayerChangedLocally(TRemConClientId aClientId) - { - LOG_FUNC - - TRAP_IGNORE(AddressedPlayerChangedL(aClientId)); - } - -void CRcpIncomingCommandHandler::MpcoUidCounterChanged(TRemConClientId aClientId) - { - LOG_FUNC - - CControlCommand* command; - if(aClientId == iClientId) - { - command = FindNotify(iInternalCommandQueue, TUid::Uid(KUidAvrcpInternalInterface),EAvrcpInternalUidChangedNotification); - if(command) - { - // if we fail to send an update it is effectively the same condition - // as when the notification arrives after the controller uses the - // old UID counter - TInt err = HandleUidChangedNotification(*command); - - if(err != KErrNone) - { - Respond(*command, KErrAvrcpAirInternalError); - HandledCommand(*command); - } - } - } - } - -//------------------------------------------------------------------------------------ -// Internal command handling functions -//------------------------------------------------------------------------------------ - - -/** Sends a response to the remote device. - -Because of the 100ms timeout for responses we send a response to -passthrough commands as soon as we receive them. This means the real -response from RemCon is currently ignored. A real response is -only sent if this is a vendor dependent command. - -@param aCommand The command to respond to. -@param aErr The result of handling the command. KErrNone if successful. - KErrNotSupported if this operation is not supported. -*/ -void CRcpIncomingCommandHandler::Respond(CControlCommand& aCommand, TInt aErr) - { - LOG_FUNC - aCommand.SetResponseType(aErr); - iRouter.AddToSendQueue(aCommand); - } - -/** To be called on completion of command handling. - -This aggregates the handler's tidying up of a finished -command. - -@param aCommand The command to tidy up. -*/ -void CRcpIncomingCommandHandler::HandledCommand(CControlCommand& aCommand) - { - LOG_FUNC - aCommand.CancelTimer(iTimer); - aCommand.iHandlingLink.Deque(); - aCommand.DecrementUsers(); - } - -void CRcpIncomingCommandHandler::HandleInternalCommand(CControlCommand& aCommand) - { - LOG_FUNC - - TUid interfaceUid; - TUint id; - TUint operationId; - RBuf8 commandData; - TBTDevAddr addr; - - aCommand.GetCommandInfo(interfaceUid, id, operationId, commandData, addr); - - __ASSERT_DEBUG(interfaceUid == TUid::Uid(KUidAvrcpInternalInterface), AvrcpUtils::Panic(EAvrcpInternalHandlingRequestedOnWrongInterface)); - - TInt err = KErrNone; - switch(operationId) - { - case EAvrcpInternalSetAddressedPlayer: - { - err = HandleSetAddressedPlayer(id, commandData); - break; - } - case EAvrcpInternalAvailablePlayersNotification: - { - err = HandleRegisterAvailablePlayersNotification(aCommand); - break; - } - case EAvrcpInternalAddressedPlayerNotification: - { - err = HandleRegisterAddressedPlayerNotification(aCommand); - break; - } - case EAvrcpInternalUidChangedNotification: - { - err = HandleUidChangedNotification(aCommand); - break; - } - }; - - if(err != KErrNone) - { - Respond(aCommand, KErrAvrcpAirInternalError); - HandledCommand(aCommand); - } - - commandData.Close(); - } - -void CRcpIncomingCommandHandler::HandleRemConCommand(CControlCommand& aCommand) - { - LOG_FUNC - - if(aCommand.IsPassthrough()) - { - // This deals with button press/release stuff, - // queues the command and responds - iPassthroughHelper->HandlePassthrough(aCommand); - } - else - { - // can go directly to client (unlike passthrough which may need to map 2 commands to 1 click - if (aCommand.Frame().Type() == AVC::ENotify) - { - iCommandInterface.MrccciNewNotifyCommand(aCommand, aCommand.ClientId()); - } - else - { - iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); - } - } - } - -TInt CRcpIncomingCommandHandler::HandleSetAddressedPlayer(TUint aId, RBuf8& aCommandData) - { - LOG_FUNC - - // Once we respond to this we've told the remote that we're using a particular player - EnterAddressedMode(); - - // SetAddressedPlayer involves not just responding to this command but - // also rejecting a bunch of notifies and completing the addressed player - // changed notify. We try as hard as we can to ensure our state remains - // consistent with the view of the remote. - - // Allocate the response buffer for the SetAddressedPlayer command first - RBuf8 responseBuf; - TInt err = responseBuf.Create(KSetAddressedPlayerResponseSize); - if(err == KErrNone) - { - // Now we know we can at least try and send a response to the remote - // do the other gubbins, which we can cope with failing - TRAPD(setResult, DoHandleSetAddressedPlayerL(aCommandData)); - - switch(setResult) - { - case KErrNotFound: - { - RAvrcpIPCError errorResponse; - errorResponse.iError = KErrAvrcpAirInvalidPlayerId; - - // Can ignore this as we know we have allocated a big enough buffer - TRAP_IGNORE(errorResponse.WriteL(responseBuf)); - break; - } - case KErrNone: - default: - // For any result other than KErrNotFound we managed to set the - // addressed client. Other errors indicate a failure in sending - // a changed response to the AddressedPlayerChanged notify. Even - // if we failed sending a changed response we should have been - // able to reject the outstanding notify so we are in a consistent - // state - { - RAvrcpSetAddressedPlayerResponse response; - response.iStatus = AvrcpStatus::ESuccess; - - // Can ignore this as we know we have allocated a big enough buffer - TRAP_IGNORE(response.WriteL(responseBuf)); - - iCommandInterface.MrccciSetAddressedClient(iClientId); - break; - } - }; - - SendInternalResponse(aId, responseBuf); - responseBuf.Close(); - } - - return err; - } - -void CRcpIncomingCommandHandler::DoHandleSetAddressedPlayerL(RBuf8& aCommandData) - { - LOG_FUNC - - RAvrcpSetAddressedPlayerRequest request; - request.ReadL(aCommandData); - - TRemConClientId clientId = iPlayerInfoManager.ClientL(request.iPlayerId); - AddressedPlayerChangedL(clientId); - } - -void CRcpIncomingCommandHandler::AddressedPlayerChangedL(TRemConClientId aClientId) - { - LOG_FUNC - - if(aClientId == iClientId) - { - return; - } - - iClientId = aClientId; - - TDblQueIter iter(iCommandQueue); - CControlCommand* command = NULL; - - // Complete player specific notifications - while(iter) - { - command = iter++; - if(command->PlayerSpecificNotify()) - { - iObserver.CommandExpired(command->RemConCommandId()); - - Respond(*command, KErrAvrcpAirAddressedPlayerChanged); - - HandledCommand(*command); - } - } - - command = FindNotify(iInternalCommandQueue, TUid::Uid(KUidAvrcpInternalInterface),EAvrcpInternalAddressedPlayerNotification); - if(command) - { - User::LeaveIfError(HandleRegisterAddressedPlayerNotification(*command)); - } - } - -TInt CRcpIncomingCommandHandler::HandleRegisterAvailablePlayersNotification(CControlCommand& aCommand) - { - LOG_FUNC - - RBuf8 responseBuf; - TRAPD(err, DoHandleRegisterAvailablePlayersNotificationL(responseBuf, aCommand)); - - if(err == KErrNone) - { - SendInternalResponse(aCommand.RemConCommandId(), responseBuf); - } - - responseBuf.Close(); - return err; - } - -void CRcpIncomingCommandHandler::DoHandleRegisterAvailablePlayersNotificationL(RBuf8& aResponseData, CControlCommand& aCommand) - { - LOG_FUNC - - RAvrcpIPCError response; - response.iError = KErrNone; - - if(DuplicateNotify(iInternalCommandQueue, aCommand)) - { - response.iError = KErrAvrcpAirInvalidCommand; - } - - aResponseData.CreateL(KRegisterNotificationEmptyResponseSize); - CleanupClosePushL(aResponseData); - - response.WriteL(aResponseData); - CleanupStack::Pop(); - } - -TInt CRcpIncomingCommandHandler::HandleRegisterAddressedPlayerNotification(CControlCommand& aCommand) - { - LOG_FUNC - - // Once we respond to this we've told the remote that we're using a particular player - EnterAddressedMode(); - - RBuf8 responseBuf; - TRAPD(err, DoHandleRegisterAddressedPlayerNotificationL(responseBuf, aCommand)); - - if(!err) - { - SendInternalResponse(aCommand.RemConCommandId(), responseBuf); - } - - responseBuf.Close(); - return err; - } - -void CRcpIncomingCommandHandler::DoHandleRegisterAddressedPlayerNotificationL(RBuf8& aResponseData, CControlCommand& aCommand) - { - LOG_FUNC - - RAvrcpAddressedPlayerNotificationResponse response; - RAvrcpIPCError rejectResponse; - - if(DuplicateNotify(iInternalCommandQueue, aCommand)) - { - aResponseData.CreateL(KRegisterNotificationEmptyResponseSize); - rejectResponse.iError = KErrAvrcpAirInvalidCommand; - CleanupClosePushL(aResponseData); - rejectResponse.WriteL(aResponseData); - } - else - { - // Tricky situation thinking.Reject if at this moment the client just be shut down - TRAPD(err, response.iPlayerId = iPlayerInfoManager.PlayerL(iClientId)); - if(err != KErrNone) - { - aResponseData.CreateL(KRegisterNotificationEmptyResponseSize); - rejectResponse.iError = KErrAvrcpAirInvalidCommand; - CleanupClosePushL(aResponseData); - rejectResponse.WriteL(aResponseData); - } - else - { - // This line will never leave once the previous line pass - response.iUidCounter = iPlayerInfoManager.UidCounterL(iClientId); - aResponseData.CreateL(KRegisterNotificationAddressedPlayerResponseSize); - CleanupClosePushL(aResponseData); - response.WriteL(aResponseData); - } - } - - CleanupStack::Pop(); - } - -TInt CRcpIncomingCommandHandler::HandleUidChangedNotification(CControlCommand& aCommand) - { - LOG_FUNC - - // Although we haven't strictly told the remote which player we're using this is - // a 1.4 command, and implies use of a specific player so switch into addressed mode - EnterAddressedMode(); - - RBuf8 responseBuf; - TUint16 uidCounter = 0; - TRAPD(err, uidCounter = iPlayerInfoManager.UidCounterL(iClientId)); - - if(err == KErrNone && !DuplicateNotify(iInternalCommandQueue, aCommand)) - { - TRAP(err, DoHandleUidChangedNotificationL(responseBuf, uidCounter)); - } - - if(err == KErrNone) - { - SendInternalResponse(aCommand.RemConCommandId(), responseBuf); - } - - responseBuf.Close(); - return err; - } - -void CRcpIncomingCommandHandler::DoHandleUidChangedNotificationL(RBuf8& aResponseData, TUint16 aUidCounter) - { - LOG_FUNC - - RAvrcpUidCounterNotificationResponse response; - response.iUidCounter = aUidCounter; - aResponseData.CreateL(KRegisterNotificationUidChangedResponseSize); - CleanupClosePushL(aResponseData); - response.WriteL(aResponseData); - CleanupStack::Pop(); - } - -void CRcpIncomingCommandHandler::SendInternalResponse(TUint aId, RBuf8& aData) - { - LOG_FUNC - - SendResponse(iInternalCommandQueue, aId, aData); - } - -/** -This function always takes responsibility for the response. -*/ -void CRcpIncomingCommandHandler::SendResponse(TDblQue& aCommandQueue, TUint aId, RBuf8& aData) - { - LOG_FUNC - - TDblQueIter iter(aCommandQueue); - CControlCommand* command = NULL; - - while (iter) - { - command = iter++; - if(command->RemConCommandId() == aId) - { - TInt err = command->ProcessOutgoingResponse(iObserver, aData, *iFragmenter); - - if(command->Frame().Type() == AVC::ENotify) - { - // If the interim response was successful then create a new command - // to contain the final response when it arrives. The same command - // cannot be re-used as we may not have finished sending this before - // we get the final response. We won't have both the commands on - // the handling queue at one time though, so there is no ambiguity - // about which is which. We finish handling the interim response here. - if(err == KErrNone) - { - // Try creating the CControlCommand which will be used for the - // final response to the Notify. If it fails then we will just - // reject the notify straight away. - // - // To start with we set its AV/C frame to be an Interim response, - // since this will match the AV/C frame of the original CControlCommand - // once we send the interim response later in this function. - CControlCommand* finalResponse = NULL; - TRAP(err, finalResponse = command->InterimResponseL()); - - if(err == KErrNone) - { - finalResponse->IncrementUsers(); - aCommandQueue.AddLast(*finalResponse); - } - } - - if(err != KErrNone && command->NormalCommand()) - { - // If we had an unsuucessful interim response, we need to remove the command from remcon - iObserver.CommandExpired(aId); - } - } - - Respond(*command, err); - HandledCommand(*command); - break; // Exit while (iter) loop - } - } - - // Either we have created a response which took ownership of aData, or - // we didn't match a command, so this was a response to something we've - // already removed from our queue. We're telling RemCon that we dealt ok - // with this so we have resonsibility for tidying up the data. - aData.Close(); - } - -void CRcpIncomingCommandHandler::EnterAddressedMode() - { - iAddressedMode = ETrue; - iCommandInterface.MrccciRegisterForLocalAddressedClientUpdates(); - } - -TBool CRcpIncomingCommandHandler::DuplicateNotify(TDblQue& aCommandQueue, const CControlCommand& aCommand) const - { - TUid interfaceUid = aCommand.RemConInterfaceUid(); - TUint operationId = aCommand.RemConOperationId(); - - CControlCommand* command = NULL; - TDblQueIter iter(aCommandQueue); - TInt count = 0; - TBool duplicate = EFalse; - - while(iter) - { - command = iter++; - if((interfaceUid == command->RemConInterfaceUid())&&(operationId == command->RemConOperationId())) - { - count++; - // this should be a reject if we've already got a notification outstanding - if(count > 1) - { - duplicate = ETrue; - break; - } - } - } - - return duplicate; - } - -CControlCommand* CRcpIncomingCommandHandler::FindNotify(TDblQue& aCommandQueue, TUid aInterfaceUid, TUint aOperationId) - { - CControlCommand* command = NULL; - TDblQueIter iter(aCommandQueue); - TBool found = EFalse; - - while(iter) - { - command = iter++; - - if((command->RemConInterfaceUid() == aInterfaceUid)&&(command->RemConOperationId() == aOperationId)) - { - found = ETrue; - break; - } - } - - return found ? command : NULL; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpoutgoingcommandhandler.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpoutgoingcommandhandler.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,768 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include - -#include "avcpanel.h" -#include "controlcommand.h" -#include "avrcpoutgoingcommandhandler.h" -#include "avrcplog.h" -#include "avrcprouter.h" -#include "avrcptimer.h" -#include "avrcputils.h" -#include "controlbearer.h" - -//--------------------------------------------------------------------- -// Construction/Destruction -//--------------------------------------------------------------------- - -/** Factory function. - -@param aBearer The CRemConBearerAvrcp this is to handle commands for. -@param aObserver The observer of the bearer. Used to aquire converters. -@param aRouter A CRcpRouter to use for communication with remote devices. -@param aTimer CDeltaTimer to use for queuing timed events. -@return A fully constructed CRcpOutgoingCommandHandler. -@leave System wide error codes. -*/ -CRcpOutgoingCommandHandler* CRcpOutgoingCommandHandler::NewL(MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CRcpRouter& aRouter, - CDeltaTimer& aTimer) - { - LOG_STATIC_FUNC - CRcpOutgoingCommandHandler* handler = new(ELeave)CRcpOutgoingCommandHandler(aCommandInterface, aObserver, aRouter, aTimer); - return handler; - } - -/** Constructor. - -@param aBearer The CRemConBearerAvrcp this is to handle commands for. -@param aObserver The observer of the bearer. Used to aquire converters. -@param aRouter A CRcpRouter to use for communication with remote devices. -@param aTimer CDeltaTimer to use for queuing timed events. -@return A partially constructed CRcpIncomingCommandHandler. -@leave System wide error codes. -*/ -CRcpOutgoingCommandHandler::CRcpOutgoingCommandHandler(MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CRcpRouter& aRouter, - CDeltaTimer& aTimer) : iCommandQueue(_FOFF(CControlCommand, iHandlingLink)), - iNotifyCommandQueue(_FOFF(CControlCommand, iHandlingLink)), - iCommandInterface(aCommandInterface), iObserver(aObserver), iRouter(aRouter), iTimer(aTimer) - { - LOG_FUNC - } - -/** Destructor. -*/ -CRcpOutgoingCommandHandler::~CRcpOutgoingCommandHandler() - { - LOG_FUNC - - ClearQueue(iCommandQueue); - ClearQueue(iNotifyCommandQueue); - } - -void CRcpOutgoingCommandHandler::ClearQueue(TDblQue& aQue) - { - while(!aQue.IsEmpty()) - { - CControlCommand* command = aQue.First(); - command->CancelTimer(iTimer); - command->iHandlingLink.Deque(); - command->DecrementUsers(); - } - } -//--------------------------------------------------------------------- -// Called from the bearer -//--------------------------------------------------------------------- - -/** Tell the handler to gracefully shutdown. - -@param aClearQueue Whether to clear the queue without handling the things - on it. If this is true the commands will be deleted. - If this is false then pending commands will have responses - generated to RemCon. -*/ -void CRcpOutgoingCommandHandler::Disconnect(TBool aClearQueue) - { - LOG_FUNC - ProcessDisconnect(iCommandQueue, aClearQueue); - ProcessDisconnect(iNotifyCommandQueue, aClearQueue); - } - -void CRcpOutgoingCommandHandler::ProcessDisconnect(TDblQue& aQue, TBool aClearQueue) - { - while(!aQue.IsEmpty()) - { - CControlCommand* command = aQue.First(); - iRouter.RemoveFromSendQueue(*command); - command->CancelTimer(iTimer); - - if(aClearQueue) - { - GenerateFailureResult(*command, KErrDisconnected); - } - - command->iHandlingLink.Deque(); - command->DecrementUsers(); - } - } -/** Sends a new command. - -@param aInterfaceUid The RemCon client interface this command is from. -@param aCommand The operation id within aInterfaceUid. -@param aId A unique identifier provided by RemCon. -@param aCommandData Data associated with this command. -@param aAddr Bluetooth address of device to send this command to. -@leave KErrNoMemory or system wide error code. -@leave Command parsing error. -*/ -void CRcpOutgoingCommandHandler::SendCommandL(TUid aInterfaceUid, - TUint aCommand, - TUint aId, - RBuf8& aCommandData, - const TBTDevAddr& aAddr) - { - LOG_FUNC - - if(aInterfaceUid.iUid == KRemConCoreApiUid) - { - // Passthrough commands are stateful, so we need to examine the - // history - we can't just blindly wham it on the queue. - HandleCoreApiCommandL(aCommand, aId, aCommandData, aAddr); - } - else - { - SendCommandL(aInterfaceUid, aCommand, aId, aCommandData, EFalse, aAddr, ETrue, EFalse); - } - } - -/** Sends a new notify command. - -@param aInterfaceUid The RemCon client interface this command is from. -@param aCommand The operation id within aInterfaceUid. -@param aId A unique identifier provided by RemCon, the transaction ID. -@param aCommandData Data associated with this command. -@param aAddr Bluetooth address of device to send this command to. -@leave KErrNoMemory or system wide error code. -@leave Command parsing error. -*/ -void CRcpOutgoingCommandHandler::SendNotifyCommandL(TUid aInterfaceUid, - TUint aCommand, - TUint aId, - RBuf8& aCommandData, - const TBTDevAddr& aAddr) - { - LOG_FUNC - SendCommandL(aInterfaceUid, aCommand, aId, aCommandData, EFalse, aAddr, ETrue, ETrue); - } - -//--------------------------------------------------------------------- -// Data notifications from the router -//--------------------------------------------------------------------- - -/** Called by the router to provide a new response. - -@param aFrame The AV/C frame for this response. Ownership is taken. -@param aTransLabel The AVCTP transaction id of this response. This is used - to match it with its command. -@param aAddr The remote from which this response originated -*/ -void CRcpOutgoingCommandHandler::ReceiveResponse(const TDesC8& aMessageInformation, - SymbianAvctp::TTransactionLabel aTransLabel, - TBool aIpidBitSet) - { - LOG_FUNC - - CAVCFrame* frame = NULL; - TInt err = KErrNone; - if(!aIpidBitSet) - { - TRAP(err, frame = CAVCFrame::NewL(aMessageInformation, AVC::EResponse)); - } - - if(!err) - { - CControlCommand* command = NULL; - command = FindInQueue(iCommandQueue, aTransLabel); - if ( command != NULL ) - { - //Found, so it is a normal command response. - ProcessReceiveResponse(frame, aIpidBitSet, command, EFalse); - } - else - { - //Try to find in the notify command queue. - command = FindInQueue(iNotifyCommandQueue, aTransLabel); - if( command != NULL ) - { - //Found, so it is a notify command response. - ProcessReceiveResponse(frame, aIpidBitSet, command, ETrue); - } - } - - delete frame; - } - } - -CControlCommand* CRcpOutgoingCommandHandler::FindInQueue(TDblQue& aQue, - SymbianAvctp::TTransactionLabel aTransLabel) - { - CControlCommand* command = NULL; - TDblQueIter iter(aQue); - while (iter) - { - command = iter++; - if(command->TransactionLabel() == aTransLabel) - { - return command; - } - } - - return NULL; - } - -void CRcpOutgoingCommandHandler::ProcessReceiveResponse(CAVCFrame* aFrame, - TBool aIpidBitSet, - CControlCommand* aCommand, - TBool aNotify) - { - aCommand->CancelTimer(iTimer); - - TInt err = KErrNone; - // Inform the bearer if this is something it knows about - // ie not a click release - if(aCommand->KnownToBearer()) - { - if(!aIpidBitSet) - { - if(aFrame->Data().Length() < KAVCFrameHeaderLength) - { - // Drop corrupt frames - return; - } - - err = aCommand->ParseIncomingResponse(iObserver, *aFrame); - } - else - { - // If aIpidBitSet is true that means AVRCP is not supported - // by the remote end. We handle this in the same way as not - // supported commands, passing them up to RemCon as not - // supported, so just map the ctype here, rather than setting - // up another path for ipid handling, but we need pass as the - // frame the original because we don't get one from AVCTP if - // ipid is set. - aCommand->SetResponseType(KErrNotSupported); - err = aCommand->ParseIncomingResponse(iObserver, aCommand->Frame()); - } - - if ( aNotify ) - {//This is a notify command - iCommandInterface.MrccciNewNotifyResponse(*aCommand); - } - else - { - iCommandInterface.MrccciNewResponse(*aCommand); - } - } - - TBool doDeque = ETrue; - if ( (!aIpidBitSet) && (err == KErrNone) && (aNotify) && (aFrame->Type() == AVC::EInterim)) - { - doDeque = EFalse; - } - - // If this a passthrough press that hasn't yet been released, we need - // to wait for a release before getting rid of this, otherwise we're done. - if(aCommand == iUnreleasedCommand) - { - iUnreleasedHasResponse = ETrue; - StartReleaseTimer(*iUnreleasedCommand); - doDeque = EFalse; - } - - if ( doDeque ) - { - aCommand->iHandlingLink.Deque(); - aCommand->DecrementUsers(); - } - } -/** Called by the router to complete a send. - -@param aCommand The command which has been sent. -@param aSendResult The result of the send. KErrNone if successful. -*/ -void CRcpOutgoingCommandHandler::MessageSent(CAvrcpCommand& aCommand, TInt aSendResult) - { - LOG_FUNC - - if(aSendResult == KErrNone) - { - // Set off response timer - StartResponseTimer(static_cast(aCommand)); - } - else - { - CControlCommand* command = FindInQueue(iNotifyCommandQueue, aCommand.TransactionLabel()); - - if(command) - { - command->SetNotifyVolumeChangeResult(command->Frame()); - iCommandInterface.MrccciNewNotifyResponse(*command); - } - else - { - command = FindInQueue(iCommandQueue, aCommand.TransactionLabel()); - - // Generate error response up to RemCon - // if this is a core command we can set the result, - // otherwise we just return it as we got it. - if(command->Frame().Opcode() == AVC::EPassThrough) - { - // Need to insert before setting the button action so we have - // long enough data - if (!command->InsertCoreResult(aSendResult)) - { - if(command->Click()) - { - command->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue); - } - } - } - - iCommandInterface.MrccciNewResponse(*command); - } - - command->iHandlingLink.Deque(); - command->DecrementUsers(); - } - } - -//--------------------------------------------------------------------- -// Internal Utility functions -//--------------------------------------------------------------------- - -void CRcpOutgoingCommandHandler::CleanupUnreleased() - { - iUnreleasedCommand->CancelTimer(iTimer); - iUnreleasedCommand->iHandlingLink.Deque(); - iUnreleasedCommand->DecrementUsers(); - iUnreleasedHasResponse = EFalse; - } - -/** Handle a command that is part of the Core API. - -@param aCommand The operation id within aInterfaceUid. -@param aId A unique identifier provided by RemCon. -@param aCommandData Data associated with this command. -@param aAddr Bluetooth address of device to send this command to. -@leave KErrNoMemory or system wide error code. -@leave Command parsing error. -*/ -void CRcpOutgoingCommandHandler::HandleCoreApiCommandL(TUint aCommand, - TUint aId, - RBuf8& aCommandData, - const TBTDevAddr& aAddr) - { - if(aCommandData.Length() < KRemConCoreApiButtonDataLength) - { - User::Leave(KErrCorrupt); - } - - TInt buttonData; - AvrcpUtils::ReadCommandDataToInt(aCommandData, - KRemConCoreApiButtonDataOffset, KRemConCoreApiButtonDataLength, buttonData); - - // First check if there's anything we need to do before sending this command, - // mainly releasing a previous press. - if(iUnreleasedCommand) - { - TUint prevOpId = iUnreleasedCommand->RemConOperationId(); - - if(aCommand == prevOpId) - { - // Either we've received a release, or we've refreshed the press. - // If the unreleased press has already been responded too we can - // dispose of it now. - // If the unreleased press has not been responded too we can - // treat it like a normal command on reception of response, so just - // set iUnreleased to NULL. - if(iUnreleasedHasResponse) - { - CleanupUnreleased(); - } - - iUnreleasedCommand = NULL; - } - else - { - // A new operation! - if(buttonData != ERemConCoreApiButtonRelease) - { - // Try and generate the release for the previous command, if - // if fails then the remote will just have to assume it. - // There's no point leaving this to the release timer, because - // we want to send another command now, so even if we send the - // release later the remote should ignore it. - TRAP_IGNORE(GenerateCommandL(*iUnreleasedCommand, ERemConCoreApiButtonRelease)); - - if(iUnreleasedHasResponse) - { - CleanupUnreleased(); - } - - iUnreleasedCommand = NULL; - } - else - { - // A release for a command other than iUnreleased. We can't - // send this now. - User::Leave(KErrNotReady); - } - } - } - else if(buttonData == ERemConCoreApiButtonRelease) - { - // We don't have an unreleased command. We must have already - // released this, either via the timer, or because we've sent - // another command in the meantime. We can't send this now. - // Leaving synchronously means we don't need to worry about generating - // a fake response, which may mislead the application. - User::Leave(KErrNotReady); - } - - if(buttonData == ERemConCoreApiButtonClick) - { - // aCommandData is still owned by RemCon until we return successfully. - // If we try the operations with the new data first we won't end up - // in a situation where the new CControlCommand thinks that it owns - // aCommandData, then the release operation leaves, so RemCon also - // thinks it owns aCommandData. - - RBuf8 pressBuf; - pressBuf.CreateL(aCommandData); - CleanupClosePushL(pressBuf); - - AvrcpUtils::SetCommandDataFromInt(pressBuf, - KRemConCoreApiButtonDataOffset, KRemConCoreApiButtonDataLength, ERemConCoreApiButtonPress); - SendCommandL(TUid::Uid(KRemConCoreApiUid), aCommand, aId, pressBuf, ETrue, aAddr, ETrue, EFalse); - - // Data has been taken ownership of by SendCommandL, so can just let - // pressbuf go out of scope. - CleanupStack::Pop(&pressBuf); - - AvrcpUtils::SetCommandDataFromInt(aCommandData, - KRemConCoreApiButtonDataOffset, KRemConCoreApiButtonDataLength, ERemConCoreApiButtonRelease); - SendCommandL(TUid::Uid(KRemConCoreApiUid), aCommand, aId, aCommandData, ETrue, aAddr, EFalse, EFalse); - } - else if(buttonData == ERemConCoreApiButtonPress) - { - iUnreleasedCommand = &SendCommandL(TUid::Uid(KRemConCoreApiUid), aCommand, aId, aCommandData, EFalse, aAddr, ETrue, EFalse); - iReleaseTimerExpiryCount = 0; - } - else - { - // Must be release - __ASSERT_DEBUG(buttonData == ERemConCoreApiButtonRelease, AvrcpUtils::Panic(EAvrcpUnknownButtonAction)); - SendCommandL(TUid::Uid(KRemConCoreApiUid), aCommand, aId, aCommandData, EFalse, aAddr, ETrue, EFalse); - } - } - -/** Creates a command from the RemCon data. - -This is an internal utility function. - -A CControlCommand will be created. Calling ProcessOutgoingCommandL on -this creates a CAVCFrame from the provided data. If an AV/C frame -can be created the command will be added to the outgoing queue to -wait a response from the remote. Otherwise this function will -leave. - -@param aInterfaceUid The RemCon client interface this command is from. -@param aCommand The operation id within aInterfaceUid. -@param aId A unique identifier provided by RemCon. -@param aCommandData Data associated with this command. -@param aIsClick Whether this is a button click. -@param aAddr Bluetooth address of device to send this command to. -@return The generated command. -@leave KErrNoMemory or system wide error code. -@leave Command parsing error. -*/ -CControlCommand& CRcpOutgoingCommandHandler::SendCommandL(TUid aInterfaceUid, - TUint aCommand, - TUint aId, - RBuf8& aCommandData, - TBool aIsClick, - const TBTDevAddr& aAddr, - TBool aKnownToBearer, - TBool aNotify) - { - LOG_FUNC - // Create a command and wham it on our queue, so we can match it up with its response - // CControlCommand::NewL takes ownership of the data in aCommandData then NULLs aCommandData - // so a leave later in the function won't cause double deletion. - CControlCommand* command = CControlCommand::NewL(aInterfaceUid, aCommand, aId, iCurrentTrans, - aCommandData, aIsClick, aAddr, aKnownToBearer); - CleanupStack::PushL(command); - - command->ProcessOutgoingCommandL(iObserver); - CleanupStack::Pop(command); - command->IncrementUsers(); - - if ( aNotify ) - { - iNotifyCommandQueue.AddLast(*command); - } - else - { - iCommandQueue.AddLast(*command); - } - - // Increment our transaction id - iCurrentTrans = (iCurrentTrans + 1) % SymbianAvctp::KMaxTransactionLabel; - - // Command stays on the queue till we've got the response - iRouter.AddToSendQueue(*command); - - return *command; - } - -/** Generate a failure response to RemCon. - -This sets the result for a passthrough command. -It informs the bearer of the new response. - -@param aCommand The command to finish off. -@param aResult The result (only valid for passthrough) -*/ -void CRcpOutgoingCommandHandler::GenerateFailureResult(CControlCommand& aCommand, TInt aResult) - { - // Response is only necessary if the bearer knows about this command. - if(aCommand.KnownToBearer() && (aCommand.Frame().Opcode() == AVC::EPassThrough)) - { - if (aCommand.InsertCoreResult(aResult) == KErrNone) - { - if(aCommand.Click()) - { - aCommand.SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue); - } - else if(aCommand.ButtonAct() == AVCPanel::EButtonPress) - { - aCommand.SetCoreButtonAction(ERemConCoreApiButtonPress, ETrue); - } - else - { - aCommand.SetCoreButtonAction(ERemConCoreApiButtonRelease, ETrue); - } - - iCommandInterface.MrccciNewResponse(aCommand); - } - } - } - -/** Generate a command to the remote. - -This is needed in situations where the application has not met the avrcp -button refresh requirements so we need to internally generate something -to stop the remote getting a bad impression of us. - -@param aCommand The command to be issue again. -*/ -void CRcpOutgoingCommandHandler::GenerateCommandL(CControlCommand& aCommand, TRemConCoreApiButtonAction aButtonAct) - { - LOG_FUNC - - RBuf8 commandData; - commandData.CreateMaxL(KRemConCoreApiButtonDataLength); - - AvrcpUtils::SetCommandDataFromInt(commandData, - KRemConCoreApiButtonDataOffset, KRemConCoreApiButtonDataLength, aButtonAct); - - // This will not leave before taking ownership of commandData. - SendCommandL(aCommand.RemConInterfaceUid(), aCommand.RemConOperationId(), aCommand.RemConCommandId(), commandData, EFalse, - aCommand.RemoteAddress(), EFalse, EFalse); - } - -//------------------------------------------------------------------------------------ -// Timer functions -//------------------------------------------------------------------------------------ - -/** Starts the response timer. - -AVRCP mandates a remote respond within 100ms of receiving a command. -This is the timer for that, and is started when a command has -successfully been sent. - -@param aCommand The command to start the timer for. -*/ -void CRcpOutgoingCommandHandler::StartResponseTimer(CControlCommand& aCommand) - { - LOG_FUNC - // These use placement new, so cannot fail - TAvrcpTimerExpiryInfo* timerInfo = new(aCommand.TimerExpiryInfo())TAvrcpTimerExpiryInfo(this, aCommand); - - TCallBack callback(ResponseExpiry, timerInfo); - TDeltaTimerEntry* timerEntry = new(aCommand.TimerEntry())TDeltaTimerEntry(callback); - - iTimer.Queue(KRcpResponseTimeOut, *timerEntry); - } - -/** Callback when response timer expires. - -This is a static forwarding function. - -@param aExpiryInfo The information used by the real ResponseExpiry to - deal with the timer expiry. -*/ -TInt CRcpOutgoingCommandHandler::ResponseExpiry(TAny* aExpiryInfo) - { - LOG_STATIC_FUNC - TAvrcpTimerExpiryInfo *timerInfo = reinterpret_cast(aExpiryInfo); - (reinterpret_cast(timerInfo->iHandler))->ResponseExpiry(timerInfo->iCommand); - - return KErrNone; - } - -/** Deals with response timeout. - -This sends a timeout response to RemCon. - -@param aCommand The CControlCommand that has expired. -*/ -void CRcpOutgoingCommandHandler::ResponseExpiry(CControlCommand& aCommand) - { - LOG_FUNC - - GenerateFailureResult(aCommand, KErrTimedOut); - - // Failed to get a response to this, don't bother about trying - // to release it. - if(iUnreleasedCommand == &aCommand) - { - iUnreleasedCommand = NULL; - __ASSERT_DEBUG(!iUnreleasedHasResponse, AvrcpUtils::Panic(EAvrcpPressHasPhantomResponse)); - } - - aCommand.iHandlingLink.Deque(); - aCommand.DecrementUsers(); - } - -/** Starts the release timer. - -AVRCP requires a press to be refreshed less than 2s after the first -press, if it is not to be assumed to have been released. We pass -this requirement on to RemCon clients as we don't know when they might -go away and we don't want to keep buttons pressed forever. If the -release timer expires we will assume a release, and generate it to -the remote. - -@param aCommand The command to start the timer for. -*/ -void CRcpOutgoingCommandHandler::StartReleaseTimer(CControlCommand& aCommand) - { - LOG_FUNC - - // These cannot fail as we use placement new - TAvrcpTimerExpiryInfo* timerInfo = new(aCommand.TimerExpiryInfo())TAvrcpTimerExpiryInfo(this, aCommand); - - TCallBack callback(ReleaseExpiry, timerInfo); - TDeltaTimerEntry* timerEntry = new(aCommand.TimerEntry())TDeltaTimerEntry(callback); - - iTimer.Queue(KRcpOutgoingButtonReleaseTimeout, *timerEntry); - } - -/** Callback when release timer expires. - -This is a static forwarding function. - -@param aExpiryInfo The information used by the real ReleaseExpiry to - deal with the timer expiry. -*/ -TInt CRcpOutgoingCommandHandler::ReleaseExpiry(TAny* aExpiryInfo) - { - LOG_STATIC_FUNC - TAvrcpTimerExpiryInfo *timerInfo = reinterpret_cast(aExpiryInfo); - (reinterpret_cast(timerInfo->iHandler))->ReleaseExpiry(timerInfo->iCommand); - - return KErrNone; - } - -/** Deals with expiry of release timer. - -1) Generate release for this command. -2) Send release to remote. - -@param aCommand The CControlCommand that has expired. -*/ -void CRcpOutgoingCommandHandler::ReleaseExpiry(CControlCommand& aCommand) - { - LOG_FUNC - __ASSERT_DEBUG((aCommand.ButtonAct() == AVCPanel::EButtonPress), AvrcpUtils::Panic(EAvrcpReleaseExpiryForRelease)); - __ASSERT_DEBUG(&aCommand == iUnreleasedCommand, AvrcpUtils::Panic(EAvrcpReleaseExpiryForOldCommand)); - __ASSERT_DEBUG(iUnreleasedHasResponse, AvrcpUtils::Panic(EAvrcpReleaseTimerStartedWithoutResponse)); - - iReleaseTimerExpiryCount++; - - TBool commandCompleted = ETrue; - // If the client is not yet obliged to refresh this, then send another press. Otherwise generate - // the release for them. - if((iReleaseTimerExpiryCount * KRcpOutgoingButtonReleaseTimeout) < KRemConCoreApiPressRefreshInterval) - { - // This will try and generate a press that is identical to the original - // aCommand, but with a new AVCTP transaction id. - TRAPD(err, GenerateCommandL(aCommand, ERemConCoreApiButtonPress)); - - if(!err) - { - // Start the timer again on the original command - StartReleaseTimer(aCommand); - commandCompleted = EFalse; - } - } - else - { - // Try an generate a release, but if it fails we just have to let the - // remote assume it. - TRAP_IGNORE(GenerateCommandL(aCommand, ERemConCoreApiButtonRelease)); - } - - // This condition may be true because - // - we have failed to generate a press, in which case the remote is entitled - // to assume this is released, so we just give up on it. - // or - // - the client has not met its press refresh obligation (whether we've - // successfully generated a release or not. - // In either case we won't do anything more with this command. - if(commandCompleted) - { - aCommand.iHandlingLink.Deque(); - aCommand.DecrementUsers(); - - iUnreleasedCommand = NULL; - iUnreleasedHasResponse = EFalse; - iReleaseTimerExpiryCount = 0; - } - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpplayerinfomanager.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,869 +0,0 @@ -// 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" -// 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include // for AVCTP protocol version -#include // for PSM values -#include -#include -#include - -#include "avrcp.h" -#include "avrcpplayerinfomanager.h" -#include "avrcpsdputils.h" -#include "playerbitmasks.h" -#include "avrcputils.h" -#include "avrcplog.h" -#include "mediabrowse.h" -#include "nowplaying.h" -#include "playerinformation.h" -#include "remcongroupnavigation.h" - -#ifdef _DEBUG -PANICCATEGORY("playerinfo"); -#endif // _DEBUG - -static TBool PlayerCompare(const TRemConClientId* aId, const TAvrcpMediaPlayerItem& aItem) - { - LOG_STATIC_FUNC - return (aId && *aId == aItem.iId); - } - -enum TFirstAbsVolSupport { EFirstAbsVolSupport }; -static TBool FirstAbsVolSupport(const TFirstAbsVolSupport*, const TAvrcpMediaPlayerItem& aItem) - { - LOG_STATIC_FUNC - return aItem.iId != KNullClientId && aItem.iAbsoluteVolumeSupport; - } - -enum TFirstBrowsingSupport { EFirstBrowsingSupport }; -static TBool FirstBrowsingSupport(const TFirstBrowsingSupport*, const TAvrcpMediaPlayerItem& aItem) - { - LOG_STATIC_FUNC - return aItem.iId != KNullClientId && (aItem.iSdpFeatures & AvrcpSdp::EBrowsing); - } - -CAvrcpPlayerInfoManager* CAvrcpPlayerInfoManager::NewL(MRemConBearerObserver& aObserver, MRemConCommandInterface& aCommandInterface) - { - LOG_STATIC_FUNC - CAvrcpPlayerInfoManager* info = new(ELeave) CAvrcpPlayerInfoManager(aObserver); - CleanupStack::PushL(info); - info->ConstructL(aCommandInterface); - CleanupStack::Pop(info); - return info; - } - -void CAvrcpPlayerInfoManager::ConstructL(MRemConCommandInterface& aCommandInterface) - { - LOG_FUNC - LEAVEIFERRORL(iLock.CreateLocal()); - LEAVEIFERRORL(iSdp.Connect()); - LEAVEIFERRORL(iSdpDatabase.Open(iSdp)); - - iPlayStatusWatcher = CPlayStatusWatcher::NewL(*this, aCommandInterface); - - TCallBack cb(PlayerUpdateCallBack, this); - iControlThreadCallBack.Create(cb, CActive::EPriorityStandard); - iControlThreadCallBack.Start(); - } - -CAvrcpPlayerInfoManager::~CAvrcpPlayerInfoManager() - { - LOG_FUNC - ASSERT_CONTROL_THREAD - iLock.Wait();// serialise access... - iLock.Close(); - delete iPlayStatusWatcher; - ASSERT_DEBUG(!iUidWatcher); // created in bulk thread context... - iControlThreadCallBack.Close(); - iObservers.Close(); - iPlayers.Close(); - iSdpDatabase.Close(); - iSdp.Close(); - } - -CAvrcpPlayerInfoManager::CAvrcpPlayerInfoManager(MRemConBearerObserver& aObserver) - : iControlBearerObserver(aObserver) - { - LOG_FUNC - } - -/** -This function sets up the handling in the bulk thread. This involves creating the -player state watcher, which maintains an up to date view of the UID counter values -for each player with a bulk interface. It does this by acting as an internal -command handler. The bulk bearer expects the player info manager to provide it -with a command handling interface for commands on internal interfaces, so we provide -it with the interface for the state watcher, which is where all our internal commands -come from. -*/ -MIncomingCommandHandler* CAvrcpPlayerInfoManager::BulkStartedL(MRemConCommandInterface& aCommandInterface) - { - LOG_FUNC; - ASSERT_BULK_THREAD; - - iUidWatcher = CUidWatcher::NewL(*this, aCommandInterface); - return iUidWatcher; - } - -void CAvrcpPlayerInfoManager::BulkStopped() - { - LOG_FUNC; - ASSERT_BULK_THREAD; - delete iUidWatcher; - iUidWatcher = NULL; - } - -// Helper function for ClientAvailable and TargetFeaturesUpdated -TInt CAvrcpPlayerInfoManager::SetItemDetails(TAvrcpMediaPlayerItem& aItem, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - aItem.iPlayerType = aPlayerType; - aItem.iPlayerSubType = aPlayerSubType; - aItem.iName.Set(aName); - aItem.iFeatureBitmask = TPlayerFeatureBitmask(); - return SetPlayerFeatures(aItem.iId, aItem.iFeatureBitmask, aItem.iSdpFeatures, aItem.iAbsoluteVolumeSupport); - } - -// Helper function for ClientAvailable and TargetFeaturesUpdated -void CAvrcpPlayerInfoManager::UpdateSdpRecord(const TAvrcpMediaPlayerItem& aItem) - { - // Update SDP record, if this fails we carry on, it's non-fatal - TInt sdpErr = KErrNone; - if(!iTargetRecord) - { - TRAP(sdpErr, AvrcpSdpUtils::CreateServiceRecordL(iSdpDatabase, iTargetRecord, ETrue, - (aItem.iSdpFeatures & AvrcpSdp::EBrowsing) ? AvrcpSdp::KAvrcpProfileVersion14 : AvrcpSdp::KAvrcpProfileVersion13)); - } - if(sdpErr == KErrNone) - { - TRAP_IGNORE(UpdateTgServiceRecordL()); - } - } - -void CAvrcpPlayerInfoManager::ClientAvailable(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - LOG_FUNC; - ASSERT_CONTROL_THREAD; - iLock.Wait(); - // Add this to our client list, using any holes in the client id array - TInt index = NextPlayerIndex(); - if(index < 0) - { - // Couldn't allocate memory to store this player, remote will just - // have to make do with the current set - iLock.Signal(); - return; - } - - TAvrcpMediaPlayerItem& item = iPlayers[index]; - item.iId = aId; - item.iBulkClientAvailable = EFalse; - item.iUidCounter = 0; - item.iLastUpdatedUidCounter = 0; - item.iPlaybackStatus = MPlayerEventsObserver::EStopped; - TInt err = SetItemDetails(item, aPlayerType, aPlayerSubType, aName); - - // Release lock before calling out of player info manager in case - // anyone needs to call back in - we're finished updating the - // info now. - iLock.Signal(); - - if(!err) - { - TRAP(err, iPlayStatusWatcher->StartWatchingPlayerL(aId)); - if(!err) - { - UpdateSdpRecord(item); - for(TInt i = 0; iMpcoAvailablePlayersChanged(); - } - } - else - { - iLock.Wait(); - iPlayers[index].iId = KNullClientId; - iLock.Signal(); - } - } - } - -void CAvrcpPlayerInfoManager::ClientNotAvailable(const TRemConClientId& aId) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - iLock.Wait(); - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index < 0) - { - // May not be here if we couldn't allocate memory to store this - // when we were first told about it - iLock.Signal(); - return; - } - - iPlayStatusWatcher->StopWatchingPlayer(aId); - iPlayers[index].iId = KNullClientId; - - //Release lock as soon as we've stopped fiddling - iLock.Signal(); - - for(TInt i = 0; iMpcoAvailablePlayersChanged(); - } - - // Don't put requirement on ordering of ClientNotAvailable/ClientStatus calls - if(iTargetRecord) - { - TRAP_IGNORE(UpdateTgServiceRecordL()); - } - } - -void CAvrcpPlayerInfoManager::ClientStatus(TBool aControllerPresent, TBool aTargetPresent) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - // SDP only used in the control thread - - //If we have gone from 1->0 on either of these we can remove the record now, - // otherwise wait for more detail on ClientAvailable or ControllerFeaturesUpdatedL - if(!aControllerPresent && iControllerRecord) - { - iSdpDatabase.DeleteRecord(iControllerRecord); - iControllerRecord = 0; - } - - if(!aTargetPresent && iTargetRecord) - { - iSdpDatabase.DeleteRecord(iTargetRecord); - iTargetRecord = 0; - } - } - -TInt CAvrcpPlayerInfoManager::SetLocalAddressedClient(const TRemConClientId& aId) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - - TUint16 playerId = 0; - TRAPD(err, playerId = PlayerL(aId)); - static_cast(playerId==playerId); // We only want to check if the bearer knows about the client. - if(err == KErrNone) - { - for(TInt i = 0; iMpcoAddressedPlayerChangedLocally(aId); - } - } - - return err; - } - -void CAvrcpPlayerInfoManager::ControllerFeaturesUpdatedL(RArray& aSupportedInterfaces) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - // SDP only used in the control thread - - TUint16 avrcpVersion = AvrcpSdp::KAvrcpProfileVersion13; - TUint16 avctpVersion = AvrcpSdp::KAvctpProtocolVersion12; - - if(aSupportedInterfaces.Find(TUid::Uid(KRemConAbsoluteVolumeControllerApiUid)) >= 0) - { - avrcpVersion = AvrcpSdp::KAvrcpProfileVersion14; - avctpVersion = AvrcpSdp::KAvctpProtocolVersion13; - } - - if(!iControllerRecord) - { - AvrcpSdpUtils::CreateServiceRecordL(iSdpDatabase, iControllerRecord, EFalse, avrcpVersion); - AvrcpSdpUtils::UpdateBrowseListL(iSdpDatabase, iControllerRecord); - } - - AvrcpSdpUtils::UpdateProtocolDescriptorListL(iSdpDatabase, iControllerRecord, avctpVersion); - AvrcpSdpUtils::UpdateProfileDescriptorListL(iSdpDatabase, iControllerRecord, avrcpVersion); - AvrcpSdpUtils::UpdateSupportedFeaturesL(iSdpDatabase, iControllerRecord, AvrcpSdp::ERemoteControl, AvrcpSdp::KAvrcpBaseCtFeatures); - } - -void CAvrcpPlayerInfoManager::TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - LOG_FUNC; - ASSERT_CONTROL_THREAD; - iLock.Wait(); - // Find this client in our client list - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index < 0) - { - // Couldn't find client in client list, maybe we removed it after an earlier failure - iLock.Signal(); - return; - } - - TAvrcpMediaPlayerItem& item = iPlayers[index]; - TInt err = SetItemDetails(item, aPlayerType, aPlayerSubType, aName); - - // Release lock before calling out of player info manager in case - // anyone needs to call back in - we're finished updating the - // info now. - iLock.Signal(); - - if(!err) - { - UpdateSdpRecord(item); - } - else - { - // There was an error updating the features so remove this client from the client list - iLock.Wait(); - iPlayers[index].iId = KNullClientId; - iLock.Signal(); - } - - for(TInt i = 0; iMpcoAvailablePlayersChanged(); - } - } - -MIncomingCommandHandler& CAvrcpPlayerInfoManager::InternalCommandHandler() - { - LOG_FUNC - ASSERT_CONTROL_THREAD - - return *iPlayStatusWatcher; - } - -void CAvrcpPlayerInfoManager::BulkClientAvailable(const TRemConClientId& aId) - { - LOG_FUNC - ASSERT_BULK_THREAD - iLock.Wait(); - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index < 0) - { - iLock.Signal(); - return; - } - ASSERT(!iPlayers[index].iBulkClientAvailable); - - TRAPD(err, iUidWatcher->StartWatchingPlayerL(aId)); - - if(!err) - { - iPlayers[index].iBulkClientAvailable = ETrue; - } - - iLock.Signal(); - } - -void CAvrcpPlayerInfoManager::BulkClientNotAvailable(const TRemConClientId& aId) - { - LOG_FUNC - ASSERT_BULK_THREAD - iLock.Wait(); - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index >= 0) - { - ASSERT(iPlayers[index].iBulkClientAvailable); - iPlayers[index].iBulkClientAvailable = EFalse; - } - iLock.Signal(); - iUidWatcher->StopWatchingPlayer(aId); - } - -void CAvrcpPlayerInfoManager::AddObserverL(MPlayerChangeObserver& aObserver) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - iObservers.AppendL(&aObserver); - } - -void CAvrcpPlayerInfoManager::RemoveObserver(MPlayerChangeObserver& aObserver) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - TInt index = iObservers.Find(&aObserver); - if(index >= 0) - { - iObservers.Remove(index); - } - } - -TRemConClientId CAvrcpPlayerInfoManager::ClientL(TUint16 aAvrcpPlayerId) const - { - LOG_FUNC - // THREAD - Bulk and Control - - iLock.Wait(); - CleanupSignalPushL(iLock); - - TRemConClientId clientId = KNullClientId; - if(ValidPlayer(aAvrcpPlayerId)) - { - clientId = iPlayers[aAvrcpPlayerId].iId; - } - else - { - LEAVEL(KErrNotFound); - } - - CleanupStack::PopAndDestroy(&iLock); - - return clientId; - } - -TRemConClientId CAvrcpPlayerInfoManager::Client(TUint16 aAvrcpPlayerId) const - { - LOG_FUNC - // THREAD - Bulk and Control - - iLock.Wait(); - - TRemConClientId clientId = KNullClientId; - __ASSERT_DEBUG(ValidPlayer(aAvrcpPlayerId), AvrcpUtils::Panic(EInvalidPlayerId)); - - clientId = iPlayers[aAvrcpPlayerId].iId; - - iLock.Signal(); - return clientId; - } - -TUint16 CAvrcpPlayerInfoManager::PlayerL(const TRemConClientId& aClientId) const - { - LOG_FUNC - // THREAD - Bulk and Control - - iLock.Wait(); - - TUint16 player = 0; - TBool found = EFalse; - for(TInt i = 0; i < iPlayers.Count(); i++) - { - if(PlayerCompare(&aClientId, iPlayers[i])) - { - player = i; - found = ETrue; - } - } - - iLock.Signal(); - - if(!found) - { - LEAVEL(KErrNotFound); - } - - return player; - } - -TInt CAvrcpPlayerInfoManager::PlayerListing(TUint aStartItem, TUint aEndItem, RArray& aPlayers) - { - LOG_FUNC - ASSERT_BULK_THREAD - - if(aStartItem > aEndItem) - { - return KErrArgument; - } - - iLock.Wait(); - if(aStartItem >= iPlayers.Count()) - { - iLock.Signal(); - return KErrArgument; - } - - TInt err = KErrNone; - for(TUint i = aStartItem; i <= aEndItem && i < iPlayers.Count() && err == KErrNone; i++) - { - if(iPlayers[i].iId != KNullClientId) - { - err = aPlayers.Append(i); - } - } - - iLock.Signal(); - return err; - } - -TInt CAvrcpPlayerInfoManager::PlayerListing(RArray& aPlayers) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - iLock.Wait(); - TInt err = KErrNone; - for(TInt i = 0; i < iPlayers.Count() && err == KErrNone; i++) - { - if(iPlayers[i].iId != KNullClientId) - { - err = aPlayers.Append(i); - } - } - - iLock.Signal(); - return err; - } - -void CAvrcpPlayerInfoManager::MediaPlayerItemL(const TUint16& aAvrcpPlayerId, RMediaPlayerItem& aItem) - { - LOG_FUNC - ASSERT_BULK_THREAD - iLock.Wait(); - CleanupSignalPushL(iLock); - - if(ValidPlayer(aAvrcpPlayerId)) - { - aItem.iType = AvrcpBrowsing::EMediaPlayer; - aItem.iPlayerId = aAvrcpPlayerId; - aItem.iPlayerType = iPlayers[aAvrcpPlayerId].iPlayerType; - aItem.iPlayerSubType = iPlayers[aAvrcpPlayerId].iPlayerSubType; - aItem.iPlayStatus = iPlayers[aAvrcpPlayerId].iPlaybackStatus; - aItem.iFeatureBitmask = iPlayers[aAvrcpPlayerId].iFeatureBitmask.FeatureBitmask(); - aItem.iCharset = KUtf8MibEnum; - aItem.iNameLength = iPlayers[aAvrcpPlayerId].iName.Length(); - // Takes a copy of media player name - aItem.iName.CreateL(iPlayers[aAvrcpPlayerId].iName); - - aItem.iLength = 28 + aItem.iNameLength; - } - else - { - LEAVEL(KErrNotFound); - } - - CleanupStack::PopAndDestroy(&iLock); - } - -TBool CAvrcpPlayerInfoManager::ValidPlayer(const TUint16& aAvrcpPlayerId) const - { - LOG_FUNC - - if(aAvrcpPlayerId >= iPlayers.Count() || iPlayers[aAvrcpPlayerId].iId == KNullClientId) - { - return EFalse; - } - else - { - return ETrue; - } - } - -TInt CAvrcpPlayerInfoManager::NextPlayerIndex() - { - LOG_FUNC - - TRemConClientId nullId = KNullClientId; - TInt index = iPlayers.Find(nullId, PlayerCompare); - - if(index < 0) - { - // No gaps to fill, add another item to the player list - TAvrcpMediaPlayerItem item; - TInt err = iPlayers.Append(item); - if(!err) - { - index = iPlayers.Count() - 1; - } - } - - return index; - } - -void CAvrcpPlayerInfoManager::MuoUidChanged(TRemConClientId aId, TUint16 aUidCounter) - { - LOG_FUNC; - ASSERT_BULK_THREAD - iLock.Wait(); - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index >= 0) - { - iPlayers[index].iUidCounter = aUidCounter; - } - iLock.Signal(); - - iControlThreadCallBack.CallBack(); - } - -void CAvrcpPlayerInfoManager::MuoError(TRemConClientId aId) - { - // Narg. Tell everyone we can't use this player anymore - BulkClientNotAvailable(aId); - } - -void CAvrcpPlayerInfoManager::MpsoPlayStatusChanged(TRemConClientId aId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - iLock.Wait(); - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index >= 0) - { - iPlayers[index].iPlaybackStatus = static_cast(aPlaybackStatus); - } - iLock.Signal(); - } - -void CAvrcpPlayerInfoManager::MpsoError(TRemConClientId aId) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - iLock.Wait(); - TInt index = iPlayers.Find(aId, PlayerCompare); - if(index >= 0) - { - iPlayers[index].iPlaybackStatus = MPlayerEventsObserver::EError; - } - iLock.Signal(); - } - -TUint16 CAvrcpPlayerInfoManager::UidCounterL(const TRemConClientId& aClientId) const - { - LOG_FUNC - ASSERT_CONTROL_THREAD - iLock.Wait(); - CleanupSignalPushL(iLock); - TUint16 uidCounter = KErrNone; - TInt index = iPlayers.Find(aClientId, PlayerCompare); - if(index < 0) - { - LEAVEL(KErrNotFound); - } - uidCounter = iPlayers[index].iUidCounter; - CleanupStack::PopAndDestroy(&iLock); - return uidCounter; - } - -TInt CAvrcpPlayerInfoManager::SetPlayerFeatures(const TRemConClientId& aId, TPlayerFeatureBitmask& aBitmask, TUint8& aSdpFeatures, TBool& aAbsoluteVolumeSupported) - { - LOG_FUNC - ASSERT_CONTROL_THREAD - - TInt err; - RArray operations; - - aAbsoluteVolumeSupported = EFalse; - aSdpFeatures = 0; - err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConCoreApiUid), operations); - if(!err) - { - aBitmask.SetCoreApiFeatures(operations); - } - else if(err != KErrNotSupported) - { - operations.Close(); - return err; - } - - err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConPlayerInformationUid), operations); - if(!err) - { - aSdpFeatures |= AvrcpSdp::EPlayer; - } - else if(err != KErrNotSupported) - { - operations.Close(); - return err; - } - - err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConGroupNavigationApiUid), operations); - if(!err) - { - aSdpFeatures |= AvrcpSdp::EGroupNavigation; - aBitmask.SetGroupNavigationApiFeatures(operations); - } - else if(err != KErrNotSupported) - { - return err; - } - - err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConAbsoluteVolumeTargetApiUid), operations); - if(!err) - { - aBitmask.SetAbsoluteVolumeApiFeatures(operations); - aAbsoluteVolumeSupported = ETrue; - } - else if(err != KErrNotSupported) - { - operations.Close(); - return err; - } - - err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConNowPlayingApiUid), operations); - if(!err) - { - aBitmask.SetNowPlayingApiFeatures(operations); - } - else if(err != KErrNotSupported) - { - operations.Close(); - return err; - } - - err = iControlBearerObserver.SupportedOperations(aId, TUid::Uid(KRemConMediaBrowseApiUid), operations); - if(!err) - { - aSdpFeatures |= AvrcpSdp::EBrowsing; - aBitmask.SetMediaBrowseApiFeatures(operations); - } - - operations.Close(); - return err == KErrNotSupported ? KErrNone : err; - } - -void CAvrcpPlayerInfoManager::UpdateTgServiceRecordL() - { - LOG_FUNC - ASSERT_CONTROL_THREAD - - TUint16 features = AvrcpSdp::KAvrcpBaseTgFeatures; - for(TInt i=0; iMpcoUidCounterChanged(clientId); - } - } - } - } - } - -/** -If the client ID is set to a valid ID then we shall return the support -status for the specific player referenced by the ID. -Otherwise we shall return generic support which will indicate support across -the device. -@return whether absolute volume control is supported either by the specific player -associated with a client ID, or generally by the device if an invalid client ID is -provided. - */ -TBool CAvrcpPlayerInfoManager::AbsoluteVolumeSupportedL(const TRemConClientId& aClientId) const - { - LOG_FUNC - ASSERT_CONTROL_THREAD - - iLock.Wait(); - CleanupSignalPushL(iLock); - - TBool supported = EFalse; - // If we receive a "NULL" client ID then it means that we should - // return whether abs vol is generically supported by the device. - if(aClientId == KNullClientId) - { - // Try to find the first player supporting abs vol, if there is one then it is supported - TInt index = iPlayers.Find(EFirstAbsVolSupport, FirstAbsVolSupport); - supported = (index >= 0); - } - else - { - // The abs vol support for a specific player is required, so return that. - TInt index = iPlayers.Find(aClientId, PlayerCompare); - if(index < 0) - { - LEAVEL(KErrNotFound); - } - supported = iPlayers[index].iAbsoluteVolumeSupport; - } - - CleanupStack::PopAndDestroy(&iLock); - - return supported; - } - -TBool CAvrcpPlayerInfoManager::BrowsingSupportedL(const TRemConClientId& aClientId) const - { - LOG_FUNC - ASSERT_CONTROL_THREAD - - iLock.Wait(); - CleanupSignalPushL(iLock); - - TBool supported = EFalse; - // If we receive a "NULL" client ID then it means that we should - // return whether browsing is generically supported by the device. - if(aClientId == KNullClientId) - { - // Try to find the first player supporting browsing, if there is one then it is supported - TInt index = iPlayers.Find(EFirstBrowsingSupport, FirstBrowsingSupport); - supported = (index >= 0); - } - else - { - // The browsing support for a specific player is required, so return that. - TInt index = iPlayers.Find(aClientId, PlayerCompare); - if(index < 0) - { - LEAVEL(KErrNotFound); - } - supported = iPlayers[index].iSdpFeatures & AvrcpSdp::EBrowsing; - } - - CleanupStack::PopAndDestroy(&iLock); - - return supported; - } - -TInt CAvrcpPlayerInfoManager::PlayerUpdateCallBack(TAny* aPlayerInfoMgr) - { - static_cast(aPlayerInfoMgr)->UidCounterUpdate(); - return KErrNone; - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpremotedevice.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpremotedevice.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#include "avrcpincomingcommandhandler.h" -#include "avrcpoutgoingcommandhandler.h" -#include "avrcpremotedevice.h" - -#include "avrcplog.h" - -/** Factory function. - -@param aAddr The remote device this manages transactions with. -@param aRouter A CRcpRouter to use for communication with remote devices. -@param aBearer The CRemConBearerAvrcp this is to handle commands for. -@param aObserver The observer of the bearer. Used to acquire converters. -@param aTimer CDeltaTimer to use for queuing timed events. -@return A fully constructed CRcpRemoteDevice. -@leave System wide error codes. -*/ -CRcpRemoteDevice* CRcpRemoteDevice::NewL(const TBTDevAddr& aAddr, - CRcpRouter& aRouter, - MRemConControlCommandInterface& aCommandInterface, - MRemConBearerObserver& aObserver, - CDeltaTimer& aTimer, - CAvrcpPlayerInfoManager& aPlayerInfoManager) - { - LOG_STATIC_FUNC - CRcpRemoteDevice* engine = new(ELeave) CRcpRemoteDevice(aAddr, aRouter, aCommandInterface, aTimer); - CleanupStack::PushL(engine); - engine->ConstructL(aObserver, aPlayerInfoManager); - CleanupStack::Pop(engine); - return engine; - } - -/** Constructor. - -@param aAddr The remote device this manages transactions with. -@param aRouter A CRcpRouter to use for communication with remote devices. -@param aBearer The CRemConBearerAvrcp this is to handle commands for. -@param aObserver The observer of the bearer. Used to acquire converters. -@param aTimer CDeltaTimer to use for queuing timed events. -@return A partially constructed CRcpRemoteDevice. -@leave System wide error codes. -*/ -CRcpRemoteDevice::CRcpRemoteDevice(const TBTDevAddr& aAddr, - CRcpRouter& aRouter, - MRemConControlCommandInterface& aCommandInterface, - CDeltaTimer& aTimer) : - iDevice(aAddr), iRouter(aRouter), iCommandInterface(aCommandInterface), iTimer(aTimer) - { - LOG_FUNC - } - -/** Second phase construction. - -@param aObserver An observer to pass the handlers to allow them to - acquire converters. -*/ -void CRcpRemoteDevice::ConstructL(MRemConBearerObserver& aObserver, - CAvrcpPlayerInfoManager& aPlayerInfoManager) - { - LOG_FUNC - iIncoming = CRcpIncomingCommandHandler::NewL(iCommandInterface, aObserver, iRouter, iTimer, aPlayerInfoManager, iDevice); - iOutgoing = CRcpOutgoingCommandHandler::NewL(iCommandInterface, aObserver, iRouter, iTimer); - } - -/** Destructor. -*/ -CRcpRemoteDevice::~CRcpRemoteDevice() - { - LOG_FUNC - delete iIncoming; - delete iOutgoing; - } - -/** Stop handling for this remote device. - -@param aClearQueue Whether the outgoing queue should be cleared. -*/ -void CRcpRemoteDevice::Disconnect(TBool aClearQueue) - { - LOG_FUNC - iIncoming->Disconnect(); - iOutgoing->Disconnect(aClearQueue); - } - -/** Get the remote address of this device. - -@return the remote address of this device. -*/ -const TBTDevAddr& CRcpRemoteDevice::RemoteAddress() const - { - LOG_FUNC - return iDevice; - } - -/** Get the incoming handler for this device. - -@return The incoming handler for this device. -*/ -MIncomingCommandHandler& CRcpRemoteDevice::IncomingHandler() const - { - LOG_FUNC - return *iIncoming; - } - -/** Get the outgoing handler for this device. - -@return The outgoing handler for this device. -*/ -MOutgoingCommandHandler& CRcpRemoteDevice::OutgoingHandler() const - { - LOG_FUNC - return *iOutgoing; - } - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcprouter.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcprouter.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,499 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include - -#include "avrcpcommand.h" -#include "avrcplog.h" -#include "avrcprouter.h" -#include "avrcputils.h" -#include "commandhandlerinterface.h" - -using namespace SymbianAvctp; - -/** Constructor. - -@param aRemotes The list of remote devices known to AVRCP. -@param aBearer The bearer. -@return A partially constructed CRcpRouter. -*/ -CRcpRouter::CRcpRouter(MAvrcpBearer& aBearer) - : iChannel(NULL) - , iBearer(aBearer) - , iSendQueue(_FOFF(CAvrcpCommand, iSendLink)) - , iState(EAvrcpRouterCanSend) - { - LOG_FUNC - } - -/** Destructor. -*/ -CRcpRouter::~CRcpRouter() - { - LOG_FUNC - // The lifetime of the Router is the same as that of the bearer plugin. - // This means that there is no point worrying about the stuff on our - // send queue as we won't be around to pass the results up to RemCon. - while (!iSendQueue.IsEmpty()) - { - CAvrcpCommand *command = iSendQueue.First(); - command->iSendLink.Deque(); - command->DecrementUsers(); - } - } - -//------------------------------------------------------------------ -// Data functions called from command handlers -//------------------------------------------------------------------ - -/** Adds command to send queue. - -This message will be sent as soon as the iAvcp becomes -free for sending, unless the command is removed before -then. - -@param aCommand The command to send. -@see CRcpRouter::RemoveFromSendQueue -*/ -void CRcpRouter::AddToSendQueue(CAvrcpCommand& aCommand) - { - LOG_FUNC - - __ASSERT_ALWAYS(!aCommand.iSendLink.IsQueued(), AVRCP_PANIC(ECommandAlreadyQueuedForSending)); - - iSendQueue.AddLast(aCommand); - aCommand.IncrementUsers(); - - if(iState == EAvrcpRouterCanSend) - { - Send(); - } - } - -/** Remove command from send queue. - -@param aCommand The command that is not to be sent. -*/ -void CRcpRouter::RemoveFromSendQueue(CAvrcpCommand& aCommand) - { - LOG_FUNC - - if(iSendQueue.IsFirst(&aCommand)) - { - // If this is at the front of the queue it's currently being - // sent. Cancel that and start off the next thing. - iChannel->MacCancelSend(); - aCommand.iSendLink.Deque(); - iState = EAvrcpRouterCanSend; - if(!iSendQueue.IsEmpty()) - { - Send(); - } - } - else - { - // Still waiting to be sent so we can just sneak it out of - // the queue. - aCommand.iSendLink.Deque(); - } - } - -//------------------------------------------------------------------ -// Control functions called from bearer -//------------------------------------------------------------------ - -/** Try to bring up an explicit connection to a remote. - -@param aAddr The address of the remote. -@return System wide error. KErrNone if this request will be - attempted, and generate a ConnectConfirm. -*/ -TInt CRcpRouter::ConnectRequest(const TBTDevAddr& aAddr) - { - LOG_FUNC - return iChannel->MacAttachRequest(aAddr); - } - -/** Try to bring down an explicit connection to a remote. - -@param aAddr The address of the remote. -@return System wide error. KErrNone if the disconnect will be - attempted, and generate a DisconnectConfirm. -*/ -TInt CRcpRouter::DisconnectRequest(const TBTDevAddr& aAddr) - { - LOG_FUNC - return iChannel->MacDetachRequest(aAddr); - } - -//------------------------------------------------------------------ -// MAvctpEventNotify functions called from RAvctp -//------------------------------------------------------------------ - -/** AVCTP Connection Indicate. - -This is called when a remote device has connected -to us. NB we don't return the configuration status as -in Appendix A - AVCTP Upper Interface of [R2]. If aAccept -is not changed the connection will be refused however -this may not result in the actual disconnection of the -device if another RAvctp client did accept the connection. - -@param aBTDevice the address of the device connected to -@param aAccept this parameter is provided so that the client - of RAvctp can indicate whether they want to accept the - connection. The meaning of a refusal is that you don't - care whether or not the connection is there or not. -@see RAvctp -*/ -void CRcpRouter::MaenAttachIndicate(const TBTDevAddr& aBTDevice, TInt aMtu, TBool& aAccept) - { - LOG_FUNC - aAccept = ETrue; - - // if we have already received data from this device we will have - // informed RemCon about it already, so don't pass up the connection - // now - if(!iBearer.IncomingHandler(aBTDevice)) - { - iBearer.ConnectIndicate(aBTDevice); - } - - MIncomingCommandHandler* handler = iBearer.IncomingHandler(aBTDevice); - if(handler) - { - handler->MaxPacketSize(aMtu); - aAccept = ETrue; - } - else - { - aAccept = EFalse; - } - } - -/** AVCTP Connection Confirm. - -This is a response to RAvctp::ConnectRequest and passes on the -result of the Connection attempt. NB we don't return the -configuration status as in Appendix A - AVCTP Upper -Interface of [R2]. If the aConnectResult is KErrNone -then iAvctp is now connected. - -@param aBTDevice the address of the device connected to -@param aConnectResult connection result - one of the - system-wide error codes. -@see RAvctp -*/ -void CRcpRouter::MaenAttachConfirm(const TBTDevAddr& aBTDevice, TInt aMtu, TInt aConnectResult) - { - LOG_FUNC - iBearer.ConnectConfirm(aBTDevice, aConnectResult); - - MIncomingCommandHandler* handler = iBearer.IncomingHandler(aBTDevice); - if(handler) - { - handler->MaxPacketSize(aMtu); - } - } - -/** AVCTP Disconnection Indication. - -Indicates that a remote device has disconnected from us. -It is only called if the device had been explicitly Connected to. - -@param aBTDevice the address of the disconnecting device -@see RAvctp -*/ -void CRcpRouter::MaenDetachIndicate(const TBTDevAddr& aBTDevice) - { - LOG_FUNC - iBearer.DisconnectIndicate(aBTDevice); - } - -/** AVCTP Disconnection Confirm. - -@param aBTDevice the address of the disconnected device -@param aDisconnectResult will be one of the system-wide - error codes. If KErrTimedOut is - returned then the RAvctp will be - disconnected. -@see RAvctp -*/ -void CRcpRouter::MaenDetachConfirm(const TBTDevAddr& aBTDevice, TInt aDisconnectResult) - { - LOG_FUNC - iBearer.DisconnectConfirm(aBTDevice, aDisconnectResult); - } - -/** AVCTP Message received indication. - -This method is called when a message has been received from -the given device on the RAvctp's PID. - -Note that because AVCTP is a connectionless protocol, it is -perfectly possible to get a MaenMessageReceivedIndicate event -from a device that you have not either explicitly connected to. -For instance even if you don't accept a MaenConnectIndicate -you may still receive messages from that remote device. - -@param aBTDevice address of the device sending us an AVCTP message -@param aTransactionLabel message transaction label -@param aType type of message -@param aIpidBitSet this will be set to true only if a message has been received indicating - that the profile corresponding to the originally sent message is not valid. - If RAvctp was used to send the message then this response will have come from - the remote device aBTDevice. -@param aMessageInformation contains only the AVCTP Command / Response Message Information and not the whole packet. - Ownership transferred to client. -@see RAvctp -*/ -void CRcpRouter::MaenMessageReceivedIndicate(const TBTDevAddr& aBTDevice, - SymbianAvctp::TTransactionLabel aTransactionLabel, - SymbianAvctp::TMessageType aType, - TBool aIpidBitSet, - const TDesC8& aMessageInformation) - { - LOG_FUNC - AVRCPLOG(aMessageInformation) - - // Find the right handler - if(aType == ECommand) - { - MIncomingCommandHandler* handler = iBearer.IncomingHandler(aBTDevice); - - if(!handler) - { - iBearer.ConnectIndicate(aBTDevice); - - handler = iBearer.IncomingHandler(aBTDevice); - } - - if(handler) - { - // If this leaves the handler is rejecting handling this command, just - // ignore it. - TRAP_IGNORE(handler->ReceiveCommandL(aMessageInformation, aTransactionLabel, aBTDevice)); - } - } - else - { - MOutgoingCommandHandler* handler = iBearer.OutgoingHandler(aBTDevice); - if(handler) - { - handler->ReceiveResponse(aMessageInformation, aTransactionLabel, aIpidBitSet); - } - } - } - -/** AVCTP Message send complete. - -This method is called when a RAvctp has attempted to send -the message defined by aTransactionLabel and aBTDevice. -@param aTransactionLabel The transaction label of the message - that has been sent -@param aBTDevice the device to which the send has completed -@param aSendResult KErrNone if the send was successful or one - of the system-wide error codes -@see RAvctp -*/ -void CRcpRouter::MaenMessageSendComplete(const TBTDevAddr& aBTDevice, - SymbianAvctp::TTransactionLabel aTransactionLabel, - TInt aSendResult) - { - LOG_FUNC - __ASSERT_ALWAYS(!iSendQueue.IsEmpty(), AvrcpUtils::Panic(EAvrcpNoOutstandingSend)); - - CAvrcpCommand* command = iSendQueue.First(); - - __ASSERT_ALWAYS(command->TransactionLabel() == aTransactionLabel, AvrcpUtils::Panic(EAvrcpUnknownAvctpTransId)); - - MAvrcpCommandHandler* handler = NULL; - if(command->MessageType() == ECommand) - { - handler = iBearer.OutgoingHandler(aBTDevice); - } - else - { - handler = iBearer.IncomingHandler(aBTDevice); - } - - if(handler) - { - handler->MessageSent(*command, aSendResult); - } - - // Deque before calling Decrement because Decrement handling may involve - // deleting command - command->iSendLink.Deque(); - command->DecrementUsers(); - - // Now able to do another send. Toggle our state and check if there - // are any commands waiting. - iState = EAvrcpRouterCanSend; - if(!iSendQueue.IsEmpty()) - { - Send(); - } - } - -/** AVCTP Close Complete. - -This is the response to the CloseGracefully() that has been -called on a RAvctp object. It is the last event that will be -called until the RAvctp object is Open()'d again. -@see RAvctp -*/ -void CRcpRouter::MaenCloseComplete() - { - LOG_FUNC - } - -/** AVCTP error notification. - -Note an errored device does not indicate that the device has -been disconnected. If it has then a MaenDisconnectIndicate -event will be used to indicate this. - -@param aBTDevice the remote device associated with the error or TBTDevAddr(0) for a general error -@param aError system wide error -@see RAvctp -*/ -void CRcpRouter::MaenErrorNotify(const TBTDevAddr& /*aBTDevice*/, TInt /*aError*/) - { - LOG_FUNC - } - -/** -Returns a null aObject if the extension is not implemented, -or a pointer to another interface if it is. - -@param aInterface UID of the interface to return -@param aObject system wide error -@see RAvctp -*/ -void CRcpRouter::MaenExtensionInterfaceL(TUid /*aInterface*/, void*& aObject) - { - LOG_FUNC - aObject = NULL; - } - -//------------------------------------------------------------------ -// Utility functions -//------------------------------------------------------------------ - -/** Issue a send to AVCTP. - -This sends the first message on the command queue. -*/ -void CRcpRouter::Send() - { - LOG_FUNC - __ASSERT_ALWAYS(!iSendQueue.IsEmpty(), AvrcpUtils::Panic(EAvrcpNoOutstandingSend)); - - CAvrcpCommand* command = iSendQueue.First(); - -#ifdef _DEBUG - TInt err = -#endif // _DEBUG - iChannel->MacSendMessage(command->RemoteAddress(), - command->TransactionLabel(), - command->MessageType(), - command->Data()); - - __ASSERT_DEBUG(err == KErrNone, AvrcpUtils::Panic(EAvrcpSendingMessageFailed)); - - iState = EAvrcpRouterSending; - } - -/** Factory funtion. - -@param aAvctp An open RAvctp instance. -@param aBearer The bearer. -@return A fully constructed CRcpRouter. -@leave System wide error codes. -*/ -CControlRouter* CControlRouter::NewL(RAvctp& aAvctp, MAvrcpBearer& aBearer) - { - LOG_STATIC_FUNC - CControlRouter* router = new(ELeave) CControlRouter(aAvctp, aBearer); - CleanupStack::PushL(router); - router->ConstructL(); - CleanupStack::Pop(router); - return router; - } - -CControlRouter::~CControlRouter() - { - LOG_FUNC - iAvctp.Close(RAvctp::ENormal); - } - -CControlRouter::CControlRouter(RAvctp& aAvctp, MAvrcpBearer& aBearer) - : CRcpRouter(aBearer) - , iAvctp(aAvctp) - { - LOG_FUNC - } - -void CControlRouter::ConstructL() - { - LOG_FUNC - LEAVEIFERRORL(iAvctp.Open(*this, KAvrcpPid, iChannel)); - } - -/** Factory funtion. - -@param aAvctp An open RAvctp instance. -@param aBearer The bearer. -@return A fully constructed CRcpRouter. -@leave System wide error codes. -*/ -CBulkRouter* CBulkRouter::NewL(RAvctp& aAvctp, MAvrcpBearer& aBearer) - { - LOG_STATIC_FUNC - CBulkRouter* router = new(ELeave) CBulkRouter(aAvctp, aBearer); - CleanupStack::PushL(router); - router->ConstructL(); - CleanupStack::Pop(router); - return router; - } - -CBulkRouter::~CBulkRouter() - { - LOG_FUNC - iAvctp.UninstallSecondaryChannel(); - } - -CBulkRouter::CBulkRouter(RAvctp& aAvctp, MAvrcpBearer& aBearer) - : CRcpRouter(aBearer) - , iAvctp(aAvctp) - { - LOG_FUNC - } - -void CBulkRouter::ConstructL() - { - LOG_FUNC - LEAVEIFERRORL(iAvctp.InstallSecondaryChannel(*this, iChannel)); - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcpsdputils.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -// 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" -// 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: -// - -#include - -#include "avrcpsdputils.h" - -void AvrcpSdpUtils::CreateServiceRecordL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TBool aTarget, TUint16 aProfileVersion) - { - if(!aTarget) - { - // New service record with service class attribute containing - // 0x110e (for A/V Remote Control) - CSdpAttrValueDES* serviceClassUuids = CSdpAttrValueDES::NewDESL(NULL); - CleanupStack::PushL(serviceClassUuids); - - if(aProfileVersion == AvrcpSdp::KAvrcpProfileVersion13) - { - serviceClassUuids->StartListL() - ->BuildUUIDL(TUUID(TUint16(KAVRemoteControlUUID))) - ->EndListL(); - } - else - { - serviceClassUuids->StartListL() - ->BuildUUIDL(TUUID(TUint16(KAVRemoteControlUUID))) - ->BuildUUIDL(TUUID(TUint16(KAVRemoteControlControllerUUID))) - ->EndListL(); - } - - aSdpDatabase.CreateServiceRecordL(*serviceClassUuids, aRecHandle); - CleanupStack::PopAndDestroy(serviceClassUuids); - - aSdpDatabase.UpdateAttributeL(aRecHandle, - KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, - AvrcpSdp::KAvrcpControllerServiceName - ); - } - else - { - // New service record with service class attribute containing - // 0x110c (for A/V Remote Control Target) - aSdpDatabase.CreateServiceRecordL(KAVRemoteControlTargetUUID, aRecHandle); - - aSdpDatabase.UpdateAttributeL(aRecHandle, - KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, - AvrcpSdp::KAvrcpTargetServiceName - ); - } - - aSdpDatabase.UpdateAttributeL(aRecHandle, - KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, - AvrcpSdp::KAvrcpProviderName - ); - aSdpDatabase.UpdateAttributeL(aRecHandle, - KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, - AvrcpSdp::KAvrcpServiceDescription - ); - } - -void AvrcpSdpUtils::UpdateProtocolDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProtocolVersion) - { - CSdpAttrValueDES *attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - attrValDES->StartListL() - ->BuildDESL()->StartListL() - ->BuildUUIDL(TUUID(TUint16(KL2CAP))) // L2CAP - ->BuildUintL(TSdpIntBuf(KAVCTP)) // PSM = AVCTP - ->EndListL() - ->BuildDESL()->StartListL() - ->BuildUUIDL(TUUID(TUint16(KAVCTP))) // AVCTP - ->BuildUintL(TSdpIntBuf(aProtocolVersion)) - ->EndListL() - ->EndListL(); - aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - } - -void AvrcpSdpUtils::UpdateAdditionalProtocolDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle) - { - CSdpAttrValueDES *attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - attrValDES->StartListL() - ->BuildDESL()->StartListL() - ->BuildUUIDL(TUUID(TUint16(KL2CAP))) // L2CAP - ->BuildUintL(TSdpIntBuf(0x1b)) // PSM = AVCTP_browse - ->EndListL() - ->BuildDESL()->StartListL() - ->BuildUUIDL(TUUID(TUint16(KAVCTP))) // AVCTP - ->BuildUintL(TSdpIntBuf(AvrcpSdp::KAvctpProtocolVersion13))// 0x0103 - ->EndListL() - ->EndListL(); - aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdAdditionalProtocolDescriptorList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - } - -void AvrcpSdpUtils::UpdateBrowseListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle) - { - CSdpAttrValueDES *attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - attrValDES->StartListL() - ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group - ->EndListL(); - aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdBrowseGroupList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - } - -void AvrcpSdpUtils::UpdateProfileDescriptorListL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, TUint16 aProfileVersion) - { - CSdpAttrValueDES *attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - attrValDES->StartListL() - ->BuildDESL()->StartListL() - //In the profile descriptor list the Control UUID is used - //for BOTH controller and target - ->BuildUUIDL(KAVRemoteControlUUID) - ->BuildUintL(TSdpIntBuf(aProfileVersion)) - ->EndListL() - ->EndListL(); - aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - } - -void AvrcpSdpUtils::UpdateSupportedFeaturesL(RSdpDatabase& aSdpDatabase, TSdpServRecordHandle& aRecHandle, AvrcpSdp::TRecordType aType, TUint16 aFeatures) - { - // Supported Features - // For both target and controller roles if we support that role then - // indicate support for all categories that are available within that - // role. - CSdpAttrValue* attrVal = NULL; - TSdpIntBuf featureBuf = (aType==AvrcpSdp::ERemoteControl) ? AvrcpSdp::KAvrcpBaseCtFeatures | aFeatures : AvrcpSdp::KAvrcpBaseTgFeatures | aFeatures; - attrVal = CSdpAttrValueUint::NewUintL(featureBuf); - CleanupStack::PushL(attrVal); - aSdpDatabase.UpdateAttributeL(aRecHandle, KSdpAttrIdSupportedFeatures, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcputils.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/avrcputils.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,360 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -#include -#include -#include -#include -#include -#include "avrcplog.h" -#include "avrcputils.h" - -/** -@file -@internalComponent -@released -*/ - -/** Utility AVRCP panic function. - -@param aPanic The panic number. -*/ -void AvrcpUtils::Panic(TAvrcpPanic aPanic) - { - User::Panic(KAvrcpPanicName, aPanic); - } - - -/** Set the command data. This overwrites the current -contents of the data buffer. - -@param aCommandData The buffer in which to set the data. -@param aOffset The offset within aCommandData to set the data. -@param aLength The length of data to replace. -@param aValue The new value for the replaced data. -*/ -void AvrcpUtils::SetCommandDataFromInt(RBuf8& aCommandData, - TInt aOffset, TInt aLength, TInt aValue) - { - LOG_STATIC_FUNC - __ASSERT_DEBUG(aLength <= 4, Panic(EAvrcpCommandDataTooLong)); - - for(TInt i = 0; i < aLength; i++) - { - aCommandData[aOffset+i] = aValue >> (8*i); - } - } - -/** Reads command data from the buffer to an int. - -@param aCommandData The buffer from which to read the data. -@param aOffset The offset within aCommandData read from. -@param aLength The length of data to read. This must not be - more than 4. -@param aValue On return, the value of the specified data section. -*/ -void AvrcpUtils::ReadCommandDataToInt(const RBuf8& aCommandData, - TInt aOffset, TInt aLength, TInt& aValue) - { - LOG_STATIC_FUNC - __ASSERT_DEBUG(aLength <= 4, Panic(EAvrcpCommandDataTooLong)); - - aValue = 0; - - for(TInt i = 0 ; i < aLength; i++) - { - aValue |= aCommandData[aOffset+i]<<(8*i); - } - } - -/** Convert from a RemCon address to a bluetooth device address. - -@param aRemoteAddress The RemCon format address to convert. -@param aBTAddr On return, the bluetooth device address. -@return Whether the conversion could be performed successfully. -*/ -TInt AvrcpUtils::RemConToBTAddr(const TRemConAddress& aRemoteAddress, TBTDevAddr& aBTAddr) - { - LOG_STATIC_FUNC - TInt err = KErrArgument; - - // Check client has provided us a valid address - if(aRemoteAddress.Addr().Length() == KBTDevAddrSize) - { - aBTAddr = TBTDevAddr(aRemoteAddress.Addr()); - err = KErrNone; - } - else - { - __ASSERT_DEBUG(EFalse, AvrcpUtils::Panic(EAvrcpBadBTAddr)); - } - - return err; - } - -/** Convert from a bluetooth device address to a RemCon address. - -We assume this cannot fail, as bluetooth addresses are generated -internally rather than by a client, so they should always be -valid, and so convertible. - -@param aBTAddr The bluetooth device address to convert. -@param aRemoteAddress On return, the RemCon format address. -*/ -void AvrcpUtils::BTToRemConAddr(const TBTDevAddr& aBTAddr, TRemConAddress& aRemConAddress) - { - LOG_STATIC_FUNC - aRemConAddress.Addr() = aBTAddr.Des(); - aRemConAddress.BearerUid() = TUid::Uid(KRemConBearerAvrcpImplementationUid); - } - -NONSHARABLE_CLASS(CSpecificThreadCallBackBody) - : public CActive - { -public: - static CSpecificThreadCallBackBody* NewL(const TCallBack& aCallBack, TInt aPriority); - ~CSpecificThreadCallBackBody(); - - TInt Start(); - TInt CallBack(); - void HandleCancel(); - -private: - CSpecificThreadCallBackBody(const TCallBack& aCallBack, TInt aPriority); - void ConstructL(); - - TInt AsyncMessage(TInt aParam); - -private: // from CActive - void RunL(); - void DoCancel(); - -private: - TCallBack iCallBack; - - RThread iLocalThread; - - RMsgQueue iInbound; - RMsgQueue iOutbound; - }; - -RSpecificThreadCallBack::RSpecificThreadCallBack() - : iBody(NULL) - { - LOG_FUNC - } - -TInt RSpecificThreadCallBack::Create(const TCallBack& aCallBack, TInt aPriority) - { - TRAPD(err, iBody = CSpecificThreadCallBackBody::NewL(aCallBack, aPriority)); - return err; - } - -void RSpecificThreadCallBack::Close() - { - LOG_FUNC - delete iBody; - iBody = NULL; - } - -TInt RSpecificThreadCallBack::Start() - { - return iBody->Start(); - } - -TInt RSpecificThreadCallBack::CallBack() - { - return iBody->CallBack(); - } - -void RSpecificThreadCallBack::Cancel() - { - return iBody->HandleCancel(); - } - -CSpecificThreadCallBackBody* CSpecificThreadCallBackBody::NewL(const TCallBack& aCallBack, TInt aPriority) - { - CSpecificThreadCallBackBody* self = new(ELeave) CSpecificThreadCallBackBody(aCallBack, aPriority); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CSpecificThreadCallBackBody::CSpecificThreadCallBackBody(const TCallBack& aCallBack, TInt aPriority) - : CActive(aPriority) - , iCallBack(aCallBack) - { - LOG_FUNC - } - -void CSpecificThreadCallBackBody::ConstructL() - { - User::LeaveIfError(iInbound.CreateLocal(1)); - User::LeaveIfError(iOutbound.CreateLocal(1)); - } - -CSpecificThreadCallBackBody::~CSpecificThreadCallBackBody() - { - LOG_FUNC - HandleCancel(); - iInbound.Close(); - iOutbound.Close(); - iLocalThread.Close(); - } - -TInt CSpecificThreadCallBackBody::Start() - { - TInt err = KErrNone; - if(!IsAdded()) - { - err = iLocalThread.Duplicate(RThread()); - if(err == KErrNone) - { - CActiveScheduler::Add(this); - iInbound.NotifyDataAvailable(iStatus); - SetActive(); - } - } - return err; - } - -TInt CSpecificThreadCallBackBody::CallBack() - { - TInt err = KErrUnknown; - if(iLocalThread.Id() == RThread().Id()) - { - // Simple synchronous case. - err = iCallBack.CallBack(); - } - else - { - RThread thisThread; - err = thisThread.Duplicate(RThread()); - if(err == KErrNone) - { - err = AsyncMessage(thisThread.Handle()); - } - } - return err; - } - -TInt CSpecificThreadCallBackBody::AsyncMessage(TInt aParam) - { - TInt err = KErrNone; - TRequestStatus logonStatus; - iLocalThread.Logon(logonStatus); - if(logonStatus == KErrNoMemory) - { - // This seems kludgy, but I think it is the most reliable way. - User::WaitForRequest(logonStatus); // Ensure the all requests are correct... - err = KErrNoMemory; - } - else - { - iInbound.SendBlocking(aParam); - TRequestStatus status; - iOutbound.NotifyDataAvailable(status); - User::WaitForRequest(status, logonStatus); - if(status == KRequestPending) - { - // Remote thread is dead - iOutbound.CancelDataAvailable(); - User::WaitForRequest(status); - err = KErrDied; - } - else - { - // Success (the thread may have subsequently died, but we are only concerned with this call). - iLocalThread.LogonCancel(logonStatus); - User::WaitForRequest(logonStatus); - err = status.Int(); - if(err == KErrNone) - { - iOutbound.ReceiveBlocking(err); - } - } - } - return err; - } - - -void CSpecificThreadCallBackBody::RunL() - { - TInt threadHandle; - iInbound.ReceiveBlocking(threadHandle); - if(threadHandle == 0) - { - // 0 is a cancel message - // therefore don't do anything - iOutbound.SendBlocking(KErrNone); - } - else - { - RThread remoteThread; - remoteThread.SetHandleNC(threadHandle); - - TInt result = iCallBack.CallBack(); - - // There doesn't seem to be a safe way of handling when the other thread - // dies...... - iOutbound.SendBlocking(result); - - remoteThread.Close(); - - iInbound.NotifyDataAvailable(iStatus); - SetActive(); - } - } - -void CSpecificThreadCallBackBody::DoCancel() - { - if(RThread().Id() == iLocalThread.Id()) - { - iInbound.CancelDataAvailable(); - } - else - { - // other thread cancelling - so just complete the - // request - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrCancel); - } - } - -void CSpecificThreadCallBackBody::HandleCancel() - { - if(IsAdded()) - { - if(RThread().Id() == iLocalThread.Id()) - { - Cancel(); // synchronous cancel is fine in same thread... - } - else - { - // In a different thread - this is more interesting... - TInt err = AsyncMessage(0); // 0 is special as it means cancel. - if(err == KErrDied && IsActive()) - { - // Remote thread has already died so we need to tidy up the - // active object ourselves. - Cancel(); - } - } - } - // else shouldn't be active... - } - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/browsecommand.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/browsecommand.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,285 +0,0 @@ -// Copyright (c) 2004-2009 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: -// avrcpcommands.cpp -// - - - -/** - @file - @internalComponent - @released -*/ - -#include -#include -#include -#include -#include - -#include "browsecommand.h" -#include "avrcpinternalinterface.h" -#include "avrcplog.h" -#include "avrcputils.h" -#include "browsingframe.h" -#include "mediabrowse.h" -#include "nowplaying.h" - - -//--------------------------------------------------------------------- -// Incoming command construction -//--------------------------------------------------------------------- - -/** Factory function. - -@param aFrame The frame this command is to represent. -@param aRemConId The RemCon transaction label. -@param aTransLabel The AVCTP transaction label. -@param aAddr The bluetooth address to send this command to. -@return A fully constructed CBrowseCommand. -@leave System wide error codes. -*/ -CBrowseCommand* CBrowseCommand::NewL(const TDesC8& aMessageInformation, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransLabel, - const TBTDevAddr& aAddr, - CAvrcpPlayerInfoManager* aPlayerInfoManager) - { - LOG_STATIC_FUNC - CBrowseCommand* command = new(ELeave)CBrowseCommand(aRemConId, aTransLabel, aAddr, aPlayerInfoManager); - CleanupStack::PushL(command); - command->ConstructL(aMessageInformation); - CleanupStack::Pop(command); - return command; - } - -/** Constructor. - -@param aFrame The AV/C frame this command is to represent. -@param aRemConId The RemCon transaction label. -@param aTransLabel The AVCTP transaction label. -@param aAddr The bluetooth address to send this command to. -@return A partially constructed CBrowseCommand. -@leave System wide error codes. -*/ -CBrowseCommand::CBrowseCommand(TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransLabel, - const TBTDevAddr& aAddr, - CAvrcpPlayerInfoManager* aPlayerInfoManager) - : CAvrcpCommand(aRemConId, aTransLabel, aAddr) - { - LOG_FUNC - iPlayerInfoManager = aPlayerInfoManager; - } - -/** Destructor. -*/ -CBrowseCommand::~CBrowseCommand() - { - LOG_FUNC - __ASSERT_DEBUG(iUsers == 0, AvrcpUtils::Panic(EAvrcpCommandStillInUse)); - iFrame.Close(); - iCommandData.Close(); - } - -/** Second phase construction. -*/ -void CBrowseCommand::ConstructL(const TDesC8& aMessageInformation) - { - iFrame.CreateL(aMessageInformation); - } - -//------------------------------------------------------------------------------------ -// Called by router -//------------------------------------------------------------------------------------ - -SymbianAvctp::TMessageType CBrowseCommand::MessageType() const - { - return SymbianAvctp::EResponse; - } - -//------------------------------------------------------------------------------------ -// Called by handlers -//------------------------------------------------------------------------------------ - -/** Fills in command info from iFrame. - -This must be called by the command handler before processing this -command. - -This functions sets iInterfaceUid, iOperationId and iCommandData -to the correct values according to iFrame. The format of iCommandData -is defined by RemCon and is dependent on iInterfaceUid and iOperationId. - -@return KErrNone If the frame has been parsed successfully. -@return KErrNotSupported This frame represents a command for which a - RemCon converter or client side interface - cannot be found. -@return KErrAvrcpInvalidCType The CType specified in this frame is invalid. -@return KErrCorrupt If the frame is corrupted(e.g invalid Operation Id). -@return System wide error code. -*/ -TInt CBrowseCommand::ProcessIncomingCommandL(TInt aMaxResponse) - { - LOG_FUNC - TInt result = KErrNotSupported; - iMaxResponse = aMaxResponse-5; - - // This command has already been verified as containing at least a header - // and an accurate length field - switch(AvrcpBrowsing::BrowsingFrame::PduId(iFrame)) // PDU ID - { - case AvrcpBrowsing::ESetBrowsedPlayer: - { - result = HandleSetBrowsedPlayer(); - break; - } - case AvrcpBrowsing::EGetFolderItems: - { - result = HandleGetFolderItems(); - break; - } - case AvrcpBrowsing::EChangePath: - { - result = HandleChangePath(); - break; - } - case AvrcpBrowsing::EGetItemAttributes: - { - result = HandleGetItemAttributes(); - break; - } - case AvrcpBrowsing::ESearch: - { - result = HandleSearch(); - break; - } - case AvrcpBrowsing::EGeneralReject: - // We only support the target role for browsing, so we should - // never receive a General Reject - // fallthrough - default: - { - result = HandleUnknownPdu(); - } - }; - return result; - } - - -/** Processes an outgoing response. - -This should only be called for vendor dependent commands as -we respond to passthrough commands internally. - -@param aFrame The command data for the response. -*/ -void CBrowseCommand::ProcessOutgoingResponse(RBuf8& aCommandData) - { - __ASSERT_DEBUG(( (iInterfaceUid == TUid::Uid(KRemConMediaBrowseApiUid)) - || (iInterfaceUid == TUid::Uid(KRemConNowPlayingApiUid)) - || (iInterfaceUid == TUid::Uid(KUidAvrcpInternalInterface))), - AvrcpUtils::Panic(EAvrcpResponseToUnknownCommand)); - - iFrame.Close(); - iFrame.Assign(aCommandData); - TInt length = aCommandData.Length() - 3; - iFrame[1] = length >> 8; - iFrame[2] = length; - aCommandData.Assign(NULL); - } - -/** Set the response type in the AV/C frame. - -@param aErr The result of processing the operation. KErrNone if - successful. KErrNotsupported if this operation is not - implemented, eg because no converter was found. -*/ -void CBrowseCommand::SetResult(TInt aErr) - { - LOG_FUNC - switch(aErr) - { - case KErrNone: - break; - case KErrCorrupt: - case EAvrcpResponseToUnknownCommand: - case KErrAvrcpAirInvalidCommand: - case KErrAvrcpAirInvalidParameter: - case KErrAvrcpAirParameterNotFound: - case KErrAvrcpAirInternalError: - case KErrAvrcpAirSuccess: - case KErrAvrcpAirUidChanged: - case KErrAvrcpAirReserved: - case KErrAvrcpAirInvalidDirection: - case KErrAvrcpAirNotADirectory: - case KErrAvrcpAirDoesNotExist: - case KErrAvrcpAirInvalidScope: - case KErrAvrcpAirRangeOutOfBounds: - case KErrAvrcpAirUidIsADirectory: - case KErrAvrcpAirMediaInUse: - case KErrAvrcpAirNowPlayingListFull: - case KErrAvrcpAirSearchNotSupported: - case KErrAvrcpAirSearchInProgress: - case KErrAvrcpAirInvalidPlayerId: - case KErrAvrcpAirPlayerNotBrowesable: - case KErrAvrcpAirPlayerNotAddressed: - case KErrAvrcpAirNoValidSearchResults: - case KErrAvrcpAirNoAvailablePlayers: - case KErrAvrcpAirAddressedPlayerChanged: - case KErrAvrcpInvalidScope: - { - // If this fails we can't send the error response - just give up - TRAPD(err, GenerateRejectPayloadL(aErr)); - err = err; // Avoid warning about not using it. - break; - } - } - } - -/** Gets this command's frame. -@return the browse frame for this command -*/ -const TDesC8& CBrowseCommand::Data() const - { - LOG_FUNC - return iFrame; - } - -const TDesC8& CBrowseCommand::CommandData() const - { - LOG_FUNC - return iCommandData; - } - -void CBrowseCommand::GenerateRejectPayloadL(TInt aErr) - { - LOG_FUNC; - - TUint8 pduId = AvrcpBrowsing::BrowsingFrame::PduId(iFrame); - RRemConMediaErrorResponse errResponse; - errResponse.iPduId = pduId; - errResponse.iStatus = RAvrcpIPC::SymbianErrToStatus(aErr); - - RBuf8 frame; - frame.CreateL(KBrowseResponseBaseLength); - CleanupClosePushL(frame); - errResponse.WriteL(frame); - CleanupStack::Pop(&frame); - - iFrame.Close(); - iFrame.Assign(frame); - } - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/browsingframe.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/browsingframe.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - -#include "browsingframe.h" - - -/** Verifies the length of a frame is correct. Checking: -1) Header is present -2) Data length indicated is present - -This does not semantically check that the data expected for -the PDU ID is present. - -@param aFrame The frame to verify -@leave KErrCorrupt if the length of the frame is incorrect -*/ -void AvrcpBrowsing::BrowsingFrame::VerifyFrameL(const TDesC8& aFrame) - { - if((aFrame.Length() < AvrcpBrowsing::KHeaderLength) || - (aFrame.Length() < (AvrcpBrowsing::KHeaderLength + ParamLength(aFrame)))) - { - User::Leave(KErrCorrupt); - } - } - - -/** Retreives the PDU ID from this frame. - -@pre The integrity of the frame must have been verified (@see - BrowsingFrame::VerifyFrameL) as the length is not checked - before retrieving the PDU ID. -@param aFrame The frame to retrieve the PDU ID for. -@return The PDU ID of aFrame -*/ -AvrcpBrowsing::TPduId AvrcpBrowsing::BrowsingFrame::PduId(const TDesC8& aFrame) - { - return aFrame[0]; - } - -/** Retreives the parameter length from this frame. - -@pre The integrity of the frame must have been verified (@see - BrowsingFrame::VerifyFrameL) as the length is not checked - before retrieving the parameter length. -@param aFrame The frame to retrieve the parameter length for. -@return The parameter length of aFrame -*/ -TInt AvrcpBrowsing::BrowsingFrame::ParamLength(const TDesC8& aFrame) - { - TInt paramLength = 0; - paramLength += aFrame[2]; - paramLength += ((TUint)aFrame[1]) << 8; - - return paramLength; - } - -/** Retreives the payload from this frame. - -@pre The integrity of the frame must have been verified (@see - BrowsingFrame::VerifyFrameL) as the length is not checked - before retrieving the payload. -@param aFrame The frame to retrieve the payload for. -@param aPayload On return the payload of aFrame -*/ -void AvrcpBrowsing::BrowsingFrame::Payload(const TDesC8& aFrame, TPtrC8& aPayload) - { - aPayload.Set(aFrame.Mid(AvrcpBrowsing::KHeaderLength, AvrcpBrowsing::BrowsingFrame::ParamLength(aFrame))); - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/bulkbearer.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/bulkbearer.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,369 +0,0 @@ -// Copyright (c) 2008-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include -#include -#include - -#include "avrcpbrowsingcommandhandler.h" -#include "avrcprouter.h" -#include "avrcputils.h" -#include "browsecommand.h" -#include "bulkbearer.h" -#include "playerstatewatcher.h" - -#include "avrcplog.h" - -#ifdef _DEBUG -PANICCATEGORY("avrcpbulk"); -#endif // _DEBUG - -CAvrcpBulkBearer* CAvrcpBulkBearer::NewL(RAvctp& aAvctp, CAvrcpPlayerInfoManager& aPlayerInfoManager) - { - LOG_STATIC_FUNC - CAvrcpBulkBearer* bulkBearer = new(ELeave) CAvrcpBulkBearer(aPlayerInfoManager, aAvctp); - return bulkBearer; - } - -CAvrcpBulkBearer::~CAvrcpBulkBearer() - { - LOG_FUNC - ASSERT_DEBUG(!iRouter); // Should already be stopped... - } - -CAvrcpBulkBearer::CAvrcpBulkBearer(CAvrcpPlayerInfoManager& aPlayerInfoManager, RAvctp& aAvctp) - : iPlayerInfoManager(aPlayerInfoManager) - , iAvctp(aAvctp) - , iReadyBrowseCommands(_FOFF(CAvrcpCommand, iReadyLink)) - { - LOG_FUNC - } - -MIncomingCommandHandler* CAvrcpBulkBearer::IncomingHandler(const TBTDevAddr& aAddr) - { - LOG_FUNC - - MIncomingCommandHandler* handler = NULL; - TInt ix = iBrowseHandlers.Find(aAddr, CAvrcpBulkBearer::CompareBrowsingCommandHandlerByBDAddr); - if(ix >= 0) - { - handler = iBrowseHandlers[ix]; - } - - return handler; - } - -MOutgoingCommandHandler* CAvrcpBulkBearer::OutgoingHandler(const TBTDevAddr& /*aAddr*/) - { - LOG_FUNC - // We've received a response, but we haven't sent a command. Naughty remote, - // just ignore it. - return NULL; - } - -void CAvrcpBulkBearer::DoConnectIndicateL(const TBTDevAddr& aBTDevice) - { - LOG_FUNC - ASSERT_BULK_THREAD; - - ASSERT_DEBUG(Operational()); - - CRcpBrowsingCommandHandler* handler = CRcpBrowsingCommandHandler::NewL(*this, *iRouter, iPlayerInfoManager, aBTDevice); - CleanupStack::PushL(handler); - - iBrowseHandlers.AppendL(handler); - - CleanupStack::Pop(handler); - } - -void CAvrcpBulkBearer::ConnectIndicate(const TBTDevAddr& aBTDevice) - { - LOG_FUNC - // If we failed to allocate a handler for this connection the router will - // not be able to find it when it checks, and will tell AVCTP that we're - // not interested in this connection. - TRAP_IGNORE(DoConnectIndicateL(aBTDevice)); - } - -void CAvrcpBulkBearer::ConnectConfirm(const TBTDevAddr& IF_FLOGGING(aBTDevice), TInt IF_FLOGGING(aError)) - { - LOG_FUNC - LOGBTDEVADDR(aBTDevice); - LOG1(_L("\taError = %d"), aError); - - // Outlandish! We did not ask for this! - __ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpConnectConfirmOnBrowseChannel)); - } - -void CAvrcpBulkBearer::DisconnectIndicate(const TBTDevAddr& aBTDevice) - { - LOG_FUNC - ASSERT_BULK_THREAD; - - CRcpBrowsingCommandHandler* handler = NULL; - TInt ix = iBrowseHandlers.Find(aBTDevice, CAvrcpBulkBearer::CompareBrowsingCommandHandlerByBDAddr); - if(ix >= 0) - { - handler = iBrowseHandlers[ix]; - delete handler; - iBrowseHandlers.Remove(ix); - } - else - { - ASSERT_DEBUG(EFalse); - } - } - -void CAvrcpBulkBearer::DisconnectConfirm(const TBTDevAddr& IF_FLOGGING(aBTDevice), TInt IF_FLOGGING(aError)) - { - LOG_FUNC - LOGBTDEVADDR(aBTDevice); - LOG1(_L("\taError = %d"), aError); - - // Also outlandish! Connections on browse channel are all passive. - __ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpDisconnectConfirmOnBrowseChannel)); - } - -void CAvrcpBulkBearer::MrcciNewCommand(CAvrcpCommand& aCommand) - { - LOG_FUNC - - DoNewCommand(aCommand, KNullClientId); - } - -// This overload is used when we want to address a stateless command that may -// be interleaved with commands from other controllers. The only command -// this is currently used for is the internal UidCounterUpdate command. -void CAvrcpBulkBearer::MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId) - { - LOG_FUNC - // Verify that it's an internal command - __ASSERT_DEBUG(aCommand.RemoteAddress() == TBTDevAddr(0), AvrcpUtils::Panic(ESpecificAddressUsedForBrowsingCommand)); - - DoNewCommand(aCommand, aClientId); - } - -void CAvrcpBulkBearer::DoNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId) - { - LOG_FUNC - - // Need to put the command on the queue straight - // away in case RemCon collects it synchronously - iReadyBrowseCommands.AddLast(aCommand); - aCommand.IncrementUsers(); - - TRemConAddress remAddr; - AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr); - - TInt err = (aClientId == KNullClientId) ? iObserver->NewCommand(remAddr) : iObserver->NewCommand(remAddr, aClientId); - - if(err != KErrNone) - { - TUid interfaceUid; - TUint remconId, operationId; - RBuf8 commandData; - TBTDevAddr btAddr; - - // Calling GetCommandInfo transfers ownership of the command data. - aCommand.GetCommandInfo(interfaceUid, remconId, operationId, commandData, btAddr); - MrcbbiSendReject(interfaceUid, operationId, remconId, remAddr); - commandData.Close(); - - // RemCon is not going to pick this command up - aCommand.iReadyLink.Deque(); - aCommand.DecrementUsers(); - } - } - -TUint CAvrcpBulkBearer::MrcciNewTransactionId() - { - LOG_FUNC - return iObserver->NewTransactionId(); - } - -void CAvrcpBulkBearer::MrcciCommandExpired(TUint aTransactionId) - { - LOG_FUNC - iObserver->CommandExpired(aTransactionId); - } - -TInt CAvrcpBulkBearer::MrcbciSetAddressedClient(const TRemConAddress& aAddr, const TRemConClientId& aClient) - { - LOG_FUNC - return iObserver->SetAddressedClient(aAddr, aClient); - } - -void CAvrcpBulkBearer::MrcbciRemoveAddressing(const TRemConAddress& aAddr) - { - LOG_FUNC - iObserver->RemoveAddressing(aAddr); - } - -TInt CAvrcpBulkBearer::MrcbbiGetCommand(TUid& aInterfaceUid, - TUint& aTransactionId, - TUint& aOperationId, - RBuf8& aData, - TRemConAddress& aAddr) - { - LOG_FUNC - TInt result = KErrNotFound; - - if(!iReadyBrowseCommands.IsEmpty()) - { - CAvrcpCommand* command = iReadyBrowseCommands.First(); - - // Calling GetCommandInfo transfers the command data to RemCon. This means - // once we have called it we are committed to returning KErrNone. - TBTDevAddr btAddr; - command->GetCommandInfo(aInterfaceUid, aTransactionId, aOperationId, aData, btAddr); - AvrcpUtils::BTToRemConAddr(btAddr, aAddr); - - // Remove command from queue first because calling - // DecrementUsers() may delete command - command->iReadyLink.Deque(); - command->DecrementUsers(); - result = KErrNone; - } - else - { - __DEBUGGER(); - } - - return result; - } - -TInt CAvrcpBulkBearer::MrcbbiSendResponse(TUid aInterfaceUid, - TUint /*aOperationId*/, - TUint aTransactionId, - RBuf8& aData, - const TRemConAddress& aAddr) - { - LOG_FUNC - TBTDevAddr btAddr; - TInt err = KErrNone; - - err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr); - __ASSERT_DEBUG(err == KErrNone, AvrcpUtils::Panic(EInvalidBtAddrInResponse)); - - if(btAddr != TBTDevAddr(0)) - { - MIncomingCommandHandler* handler = IncomingHandler(btAddr); - __ASSERT_ALWAYS(handler, AVRCP_PANIC(EAvrcpNotConnected)); - - err = handler->SendRemConResponse(aInterfaceUid, aTransactionId, aData); - } - else - { - err = iInternalHandler->SendRemConResponse(aInterfaceUid, aTransactionId, aData); - } - - return err; - } - -void CAvrcpBulkBearer::MrcbbiSendReject(TUid aInterfaceUid, - TUint /*aOperationId*/, - TUint aTransactionId, - const TRemConAddress& aAddr) - { - LOG_FUNC - - TBTDevAddr btAddr; - TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr); - __ASSERT_DEBUG(err == KErrNone, AvrcpUtils::Panic(EInvalidBtAddrInResponse)); - - if(btAddr != TBTDevAddr(0)) - { - IncomingHandler(btAddr)->SendReject(aInterfaceUid, aTransactionId); - } - else - { - iInternalHandler->SendReject(aInterfaceUid, aTransactionId); - } - } - -TInt CAvrcpBulkBearer::MrcbbiStartBulk(MRemConBearerBulkObserver& aObserver) - { - LOG_FUNC - iObserver = &aObserver; - TRAPD(err, DoStartBulkL()); - if(err != KErrNone) - { - MrcbbiStopBulk(); - } - return err; - } - -void CAvrcpBulkBearer::DoStartBulkL() - { - LOG_FUNC - LEAVEIFERRORL(Dll::SetTls(reinterpret_cast(EBulkThread))); - iInternalHandler = iPlayerInfoManager.BulkStartedL(*this); - iRouter = CBulkRouter::NewL(iAvctp, *this); - } - -void CAvrcpBulkBearer::MrcbbiStopBulk() - { - LOG_FUNC - WEAK_ASSERT_BULK_THREAD; - - iPlayerInfoManager.BulkStopped(); - iInternalHandler = NULL; - - delete iRouter; - iRouter = NULL; - - iBrowseHandlers.ResetAndDestroy(); - - iObserver = NULL; // the observer is no longer valid. - - Dll::FreeTls(); - } - -TBool CAvrcpBulkBearer::Operational() const - { - LOG_FUNC - ASSERT_DEBUG(!iRouter == !iObserver); // internal consistency check - return !!iRouter; - } - -void CAvrcpBulkBearer::MrcbbiBulkClientAvailable(const TRemConClientId& aId) - { - LOG_FUNC - iPlayerInfoManager.BulkClientAvailable(aId); - } - -void CAvrcpBulkBearer::MrcbbiBulkClientNotAvailable(const TRemConClientId& aId) - { - LOG_FUNC - iPlayerInfoManager.BulkClientNotAvailable(aId); - } - - -TBool CAvrcpBulkBearer::CompareBrowsingCommandHandlerByBDAddr(const TBTDevAddr* aKey, const CRcpBrowsingCommandHandler& aHandler) - { - LOG_STATIC_FUNC - return aKey && aHandler.BtAddr() == *aKey; - } - - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/controlcommand.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/controlcommand.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1686 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - - - -/** - @file - @internalComponent - @released -*/ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "controlcommand.h" -#include "avrcpcommandframer.h" -#include "avrcpfragmenter.h" -#include "avrcpinternalinterface.h" -#include "avrcpipc.h" -#include "avrcplog.h" -#include "avrcputils.h" -#include "avrcpincomingcommandhandler.h" -#include "avrcp.h" -#include "mediabrowse.h" -#include "mediainformation.h" -#include "nowplaying.h" -#include "playerinformation.h" -#include "remconbattery.h" -#include "remcongroupnavigation.h" - -//--------------------------------------------------------------------- -// Outgoing command construction -//--------------------------------------------------------------------- - -/** Factory function. - -@param aInterfaceUid The RemCon interface uid of this command. -@param aCommand The operation id of this command within the interface defined - by aInterface Uid. -@param aRemConId The RemCon transaction label. -@param aTransactionLabel The AVCTP transaction label. -@param aCommandData The RemCon command data associated with this command. -@param aIsClick Whether this command is a button click (ie RemCon believes - that this and the other part of the click constitute one - command. -@param aAddr The bluetooth address to send this command to. -@return A fully constructed CControlCommand. -@leave System wide error codes. -*/ -CControlCommand* CControlCommand::NewL(TUid aInterfaceUid, - TUint aCommand, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransactionLabel, - RBuf8& aCommandData, - TBool aIsClick, - const TBTDevAddr& aAddr, - TBool aKnownToBearer) - { - LOG_STATIC_FUNC - CControlCommand* command = new (ELeave) CControlCommand(aInterfaceUid, aCommand, - aRemConId, aTransactionLabel, aCommandData, aIsClick, aAddr, aKnownToBearer); - CleanupStack::PushL(command); - command->ConstructL(); - CleanupStack::Pop(command); - return command; - } - -/** Constructor. - -@param aInterfaceUid The RemCon interface uid of this command. -@param aCommand The operation id of this command within the interface defined - by aInterface Uid. -@param aRemConId The RemCon transaction label. -@param aTransactionLabel The AVCTP transaction label. -@param aCommandData The RemCon command data associated with this command. -@param aIsClick Whether this command is a button click (ie RemCon believes - that this and the other part of the click constitute one - command. -@param aAddr The bluetooth address to send this command to. -@return A constructed CControlCommand. -@leave System wide error codes. -*/ -CControlCommand::CControlCommand(TUid aInterfaceUid, - TUint aCommand, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransactionLabel, - RBuf8& aCommandData, - TBool aIsClick, - const TBTDevAddr& aAddr, - TBool aKnownToBearer) - : CAvrcpCommand(aRemConId, aTransactionLabel, aAddr) - { - LOG_FUNC - - iIsClick = aIsClick; - iInterfaceUid = aInterfaceUid; - iOperationId = aCommand; - iKnownToBearer = aKnownToBearer; - - iCommandData.Assign(aCommandData); - aCommandData.Assign(NULL); - iPlayerInfoManager = NULL; - } - -//--------------------------------------------------------------------- -// Incoming command construction -//--------------------------------------------------------------------- - -/** Factory function. - -@param aMessageInformation A buffer containing AV/C frame this command is to represent. -@param aRemConId The RemCon transaction label. -@param aTransLabel The AVCTP transaction label. -@param aAddr The bluetooth address to send the response to. -@param aClientId The RemCon client that should receive this command -@return A fully constructed CControlCommand. -@leave System wide error codes. -*/ -CControlCommand* CControlCommand::NewL(CAVCFrame* aFrame, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransLabel, - const TBTDevAddr& aAddr, - const TRemConClientId& aClientId, - CAvrcpPlayerInfoManager* aPlayerInfoManager) - { - LOG_STATIC_FUNC - CControlCommand* command = new(ELeave)CControlCommand(aFrame, aRemConId, aTransLabel, aAddr, aClientId, aPlayerInfoManager); - CleanupStack::PushL(command); - command->ConstructL(); - CleanupStack::Pop(command); - return command; - } - -/** Constructor. - -@param aRemConId The RemCon transaction label. -@param aTransLabel The AVCTP transaction label. -@param aAddr The bluetooth address to send the response to. -@param aClientId The RemCon client that should receive this command -@return A partially constructed CControlCommand. -@leave System wide error codes. -*/ -CControlCommand::CControlCommand(CAVCFrame* aFrame, - TUint aRemConId, - SymbianAvctp::TTransactionLabel aTransLabel, - const TBTDevAddr& aAddr, - const TRemConClientId& aClientId, - CAvrcpPlayerInfoManager* aPlayerInfoManager) - : CAvrcpCommand(aRemConId, aTransLabel, aAddr) - , iFrame(aFrame) - , iClientId(aClientId) - { - LOG_FUNC - - iIsClick = ETrue; // Assume click until we know otherwise - iPlayerInfoManager = aPlayerInfoManager; - } - -//--------------------------------------------------------------------- -// Generic construction/destruction -//--------------------------------------------------------------------- - -/** Destructor. -*/ -CControlCommand::~CControlCommand() - { - LOG_FUNC - __ASSERT_DEBUG(iUsers == 0, AvrcpUtils::Panic(EAvrcpCommandStillInUse)); - __ASSERT_ALWAYS(!iHandlingLink.IsQueued(), AvrcpUtils::Panic(EAvrcpCommandStillQueuedForHandling)); - __ASSERT_ALWAYS(!iReadyLink.IsQueued(), AvrcpUtils::Panic(EAvrcpCommandStillQueuedAsReady)); - __ASSERT_ALWAYS(!iSendLink.IsQueued(), AvrcpUtils::Panic(EAvrcpCommandStillQueuedForSending)); - delete iFrame; - iCommandData.Close(); - delete iTimerEntry; - delete iTimerExpiryInfo; - } - -/** Second phase construction. - -@leave System wide error codes. -*/ -void CControlCommand::ConstructL() - { - LOG_FUNC - - // Allocate these now so we know we have the memory. Info is - // irrelevant as we won't add to the timer's queue without - // setting the true info. - TCallBack callback(DummyCallback, NULL); - iTimerEntry = new(ELeave)TDeltaTimerEntry(callback); - iTimerExpiryInfo = new(ELeave)TAvrcpTimerExpiryInfo(NULL, *this); - } - -//------------------------------------------------------------------------------------ -// From MRcpTimerNotify -//------------------------------------------------------------------------------------ - -/** Get the timer entry. - -@return Timer entry. -*/ -TDeltaTimerEntry* CControlCommand::TimerEntry() - { - return iTimerEntry; - } - -/** Get the timer expiry info. - -@return Timer expiry info. -*/ -TAvrcpTimerExpiryInfo* CControlCommand::TimerExpiryInfo() - { - return iTimerExpiryInfo; - } - -/** Remove this command's timer entry from the queue. - -@param aTimer The timer queue to remove this from. -*/ -void CControlCommand::CancelTimer(CDeltaTimer& aTimer) - { - LOG_FUNC - - aTimer.Remove(*iTimerEntry); - } - -//------------------------------------------------------------------------------------ -// Called by bearer -//------------------------------------------------------------------------------------ - -const TRemConClientId& CControlCommand::ClientId() const - { - return iClientId; - } -//------------------------------------------------------------------------------------ -// Called by handlers -//------------------------------------------------------------------------------------ - -/** Creates iFrame. - -This function must be called between creating this command and using it. - -@param aInterfaceUid The RemCon interface this command came from. -@param aCommand The command id within the interface identified by aInterfaceUid. -@param aCommandData Data supplied with this command by RemCon. The format of this - data is defined by RemCon and is dependent on aInterfaceUid and - aCommand. -@leave System wide error code if parsing could not complete. -*/ -void CControlCommand::ProcessOutgoingCommandL(MRemConBearerObserver& aObserver) - { - LOG_FUNC - - switch(iInterfaceUid.iUid) - { - //Process the absolute volume controller api - case KRemConAbsoluteVolumeControllerApiUid: - { - switch (iOperationId) - { - //Registers absolute volume changed - case KRemConAbsoluteVolumeNotification: - { - iFrame = AvrcpCommandFramer::NotifyVolumeChangeCommandL(); - break; - } - //Sets absolute volume. - case KRemConSetAbsoluteVolume: - { - //Gets the absolute volume to be set. - RRemConAbsoluteVolumeRequest setAbsVol; - CleanupClosePushL(setAbsVol); - setAbsVol.ReadL(iCommandData); - - __ASSERT_ALWAYS(setAbsVol.iVolume <= setAbsVol.iMaxVolume, - AvrcpUtils::Panic(EAvrcpVolumeBeyondMaxVolume)); - - TUint8 absVol = KAvrcpMaxAbsoluteVolume * setAbsVol.iVolume / setAbsVol.iMaxVolume; - iFrame = AvrcpCommandFramer::SetAbsoluteVolumeCommandL(absVol); - CleanupStack::PopAndDestroy(&setAbsVol); - break; - } - default: - { - User::Leave(KErrNotSupported); - } - - } - break; - } - case KRemConCoreApiUid: - { - // Default interface - all commands are passthrough - AVCPanel::TOperationId avrcpOp; - - if((RemConToAvrcpOperation(iOperationId, avrcpOp) != KErrNone) || - (iCommandData.Length() < KRemConCoreApiButtonDataLength)) - { - User::Leave(KErrCorrupt); - } - else - { - TInt remConButtonAct; - AvrcpUtils::ReadCommandDataToInt(iCommandData, - KRemConCoreApiCommandDataOffset + KRemConCoreApiButtonDataOffset, - KRemConCoreApiButtonDataLength, remConButtonAct); - - AVCPanel::TButtonAction buttonAct = (remConButtonAct == ERemConCoreApiButtonPress) ? - AVCPanel::EButtonPress : AVCPanel::EButtonRelease; - - iFrame = AvrcpCommandFramer::PassthroughL(avrcpOp, buttonAct); - if(iIsClick) - { - // restore our mangled command data - AvrcpUtils::SetCommandDataFromInt(iCommandData, - KRemConCoreApiCommandDataOffset + KRemConCoreApiButtonDataOffset, - KRemConCoreApiButtonDataLength, ERemConCoreApiButtonClick); - } - } - break; - } - default: - { - RBuf8 buf; - buf.CreateMaxL(KAVCFrameMaxLength); - User::LeaveIfError(aObserver.InterfaceToBearer(TUid::Uid(KRemConBearerAvrcpImplementationUid), - iInterfaceUid, iOperationId, iCommandData, ERemConCommand, buf)); - - CleanupClosePushL(buf); - iFrame = CAVCFrame::NewL(buf, AVC::ECommand); - CleanupStack::PopAndDestroy(&buf); - break; - } - }; - } - -/** Fills in command info from iFrame. - -This must be called by the command handler before handling this -command. - -This functions sets iInterfaceUid, iOperationId and iCommandData -to the correct values according to iFrame. The format of iCommandData -is defined by RemCon and is dependent on iInterfaceUid and iOperationId. - -@return KErrNone If the frame has been parsed successfully. -@return KErrNotSupported This frame represents a command for which a - RemCon converter or client side interface - cannot be found. -@return KErrAvrcpInvalidCType The CType specified in this frame is invalid. -@return KErrAvrcpMetadataInvalidCommand The AVRCP command is invalid. -@return KErrAvrcpMetadataInvalidParameter The AVRCP parameter is invalid. -@return KErrAvrcpMetadataParameterNotFound The AVRCP parameter was not found. -@return KErrAvrcpMetadataInternalError An AVRCP internal error occurred (such as out-of-memory, - or an inter-process communication error) -@return KErrCorrupt If the frame is corrupted(e.g invalid Operation Id). -@return System wide error code. -*/ -TInt CControlCommand::ParseIncomingCommandL(MRemConBearerObserver& aObserver, CAVRCPFragmenter& aFragmenter) - { - LOG_FUNC - TInt err = KErrNotSupported; - - switch(iFrame->Type()) - { - // check it isn't a reponse - case AVC::ENotImplemented: - case AVC::EAccepted: - case AVC::ERejected: - case AVC::EInTransition: - case AVC::EImplemented: - case AVC::EChanged: - case AVC::EInterim: - case 0x0E: // not given a enum for SC reasons; reserved response code in spec - { - // We were told this was a command, can't go using response - // CTypes here matey - err = KErrAvrcpInvalidCType; - break; - } - case AVC::EGeneralEnquiry: - case AVC::ESpecificEnquiry: - { - err = KErrNotSupported; - break; - } - default: - if (iFrame->Opcode() == AVC::EVendorDependent) - { - err = ParseIncomingVendorCommandL(aObserver, aFragmenter); - } - - else - { - // give off to the regular processor - err = ParseIncomingKnownOpcodeL(aObserver); - } - break; - }; - - - return err; - } - -/** Processes an incoming response. - -This function may not fail. We always need to generate something -to RemCon. - -@param aObserver Observer to use for retrieving converter. -@param aFrame The AV/C frame containing the response. -*/ -TInt CControlCommand::ParseIncomingResponse(MRemConBearerObserver& aObserver, const CAVCFrame& aFrame) - { - LOG_FUNC - TInt error = KErrNone; - - // Compare Opcode with that of the sent frame rather than the - // received one because we trust that more. Should be the same - // as this is matched by AVCTP transaction label, but who knows - // what those illicit remote devices could be up to. - if(iFrame->Opcode() == AVC::EPassThrough) - { - switch(aFrame.Type()) - { - case AVC::EAccepted: - { - InsertCoreResult(KErrNone); - break; - } - case AVC::ENotImplemented: - { - InsertCoreResult(KErrNotSupported); - break; - } - default: - { - InsertCoreResult(KErrGeneral); - break; - } - } - } - else if (iFrame->Opcode() == AVC::EVendorDependent) - { - TPtrC8 payloadData; - AVC::TAVCVendorId vID; - //Get the PDU ID with that of the sent frame rather than the received one, - //the reason is the same to above comments. - payloadData.Set(CAVCVendorDependentCommand::GetPayloadAndVID(*iFrame, vID)); - if (vID == KBluetoothSIGVendorId) - { - TMetadataTransferPDUID metadataPDUID = MetadataTransferParser::GetPDUID(payloadData); - switch ( metadataPDUID ) - { - case ESetAbsoluteVolume://Response for setting absolute volume. - { - error = SetSetAbsoluteVolumeResult(aFrame); - break; - } - case ERegisterNotification: - { - //Get notify event ID with the sent frame rather than the received one - //because there is a big possibility that the received one is an error response, e.g. rejected,notimplemented. - //In order to make sure this is an absolute volume response even if the response is an error response, - //we have to use the sent frame, and then we can process absolute volume specifically. - TMetadataTransferNotifyEventID eventID = MetadataTransferParser::GetNotifyEventID(payloadData); - - __ASSERT_ALWAYS(eventID == ERegisterNotificationVolumeChanged, - AvrcpUtils::Panic(EAvrcpInvalidEventId)); - - if (eventID == ERegisterNotificationVolumeChanged) - { - error = SetNotifyVolumeChangeResult(aFrame); - } - break; - } - default: - { - // Should never hit here - AvrcpUtils::Panic(EAvrcpResponseToUnknownCommand); - break; - } - } - } - else - { - ParseIncomingUnknownResponse(aObserver, aFrame); - } - } - else - { - ParseIncomingUnknownResponse(aObserver, aFrame); - } - - return error; - } - -/** Processes an outgoing response. - -This should only be called for vendor dependent commands as -we respond to passthrough commands internally. - -@param aObserver Observer to use for retrieving converter. -@param aFrame The command data for the response. -*/ -TInt CControlCommand::ProcessOutgoingResponse(MRemConBearerObserver& aObserver, -// TRemConMessageType aMessageType, - RBuf8& aResponseData, - CAVRCPFragmenter& aFragmenter) - { - TRAPD(err, DoProcessOutgoingResponseL(aObserver,aResponseData, aFragmenter)); - return err; - } - -void CControlCommand::DoProcessOutgoingResponseL(MRemConBearerObserver& aObserver, - RBuf8& aResponseData, - CAVRCPFragmenter& aFragmenter) - { - LOG_FUNC - - // Payload size may be increased in GenerateMetadataResponsePayload - // if there's a very large response which needs fragmenting - RBuf8 payload; - payload.CreateL(KAVCFrameMaxLength); - CleanupClosePushL(payload); - - if(( iInterfaceUid.iUid == KRemConMediaInformationApiUid ) - || ( iInterfaceUid.iUid == KRemConPlayerInformationUid ) - || ( iInterfaceUid.iUid == KRemConAbsoluteVolumeTargetApiUid ) - || ( iInterfaceUid.iUid == KRemConNowPlayingApiUid ) - || ( iInterfaceUid.iUid == KUidAvrcpInternalInterface)) - { - // metadata - // "this" is the command for which the response lurks in aCommandData - // GenerateMetadataResponsePayload() MUST set PDU id, fragmentation stauts - // and paramlen (4 bytes total) - check this in ASSERT_DEBUG - User::LeaveIfError(GenerateMetadataResponsePayload(aObserver, payload, aResponseData)); - __ASSERT_DEBUG(payload.Length() >= KAVRCPMinVendorDependentResponseLen, AvrcpUtils::Panic(EAvrcpFunnyLengthData)); - aResponseData.Close(); - - if (payload.Length() > KAVCMaxVendorDependentPayload) - { - // Fragment response (in payload) and queue fragments ready - // for sending when CT sends a CONTINUE request. If any other - // request is received (other than pass-through) then throw - // away our fragmented packet, as the CT has aborted. - aFragmenter.AssignPayload(payload); - payload.Assign(NULL); - payload.Close(); - - // Re-allocate this back to a sensible size - // from the much larger size, which has now been - // assigned to fragmenter (avoids copying payload) - payload.CreateL(KAVCFrameMaxLength); - payload.Append(aFragmenter.GetNextFragmentHeader()); - payload.Append(aFragmenter.GetNextFragment()); - } - - CAVCFrame* frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId); - frame->Append(payload); - frame->SetType(iFrame->Type()); - delete iFrame; - iFrame = frame; - } - else - { - User::LeaveIfError(aObserver.InterfaceToBearer(TUid::Uid(KRemConBearerAvrcpImplementationUid), - iInterfaceUid, iOperationId, - aResponseData, /*ERemConCommand*/ERemConResponse, payload)); - aResponseData.Close(); - CAVCFrame* frame = CAVCFrame::NewL(payload, AVC::EResponse); - delete iFrame; - iFrame = frame; - } - - CleanupStack::PopAndDestroy(&payload); - } - -/** Set the response type in the AV/C frame. - -@param aErr The result of processing the operation. KErrNone if - successful. KErrNotsupported if this operation is not - implemented, eg because no converter was found. -*/ -void CControlCommand::SetResponseType(TInt aErr) - { - LOG_FUNC - AVC::TCType cType = iFrame->Type(); - switch(aErr) - { - case KErrNone: - case KErrCompletion: - case KErrAvrcpHandledInternallyRespondNow: - if (cType == AVC::EControl) - { - iFrame->SetType(AVC::EAccepted); - } - else if (cType == AVC::ENotify) - { - iFrame->SetType(AVC::EInterim); - } - else if (cType == AVC::EInterim) - { - iFrame->SetType(AVC::EChanged); - } - else if (cType == AVC::EStatus) - { - iFrame->SetType(AVC::EStable); - } - else - { - iFrame->SetType(AVC::EImplemented); - } - break; - case KErrAvrcpMetadataInvalidCommand: - case KErrAvrcpMetadataInvalidParameter: - case KErrAvrcpMetadataParameterNotFound: - case KErrAvrcpMetadataInternalError: - case KErrAvrcpAirInvalidCommand: - case KErrAvrcpAirInvalidParameter: - case KErrAvrcpAirParameterNotFound: - case KErrAvrcpAirInternalError: - case KErrAvrcpAirSuccess: - case KErrAvrcpAirUidChanged: - case KErrAvrcpAirReserved: - case KErrAvrcpAirInvalidDirection: - case KErrAvrcpAirNotADirectory: - case KErrAvrcpAirDoesNotExist: - case KErrAvrcpAirInvalidScope: - case KErrAvrcpAirRangeOutOfBounds: - case KErrAvrcpAirUidIsADirectory: - case KErrAvrcpAirMediaInUse: - case KErrAvrcpAirNowPlayingListFull: - case KErrAvrcpAirSearchNotSupported: - case KErrAvrcpAirSearchInProgress: - case KErrAvrcpAirInvalidPlayerId: - case KErrAvrcpAirPlayerNotBrowesable: - case KErrAvrcpAirPlayerNotAddressed: - case KErrAvrcpAirNoValidSearchResults: - case KErrAvrcpAirNoAvailablePlayers: - case KErrAvrcpAirAddressedPlayerChanged: - { - // If this fails, we're OOM (it only contains a NewL) - // so we can't send the error response - just give up - TRAPD(err, GenerateMetadataRejectPayloadL(aErr)); - err = err; // avoid warning about not using this - break; - } - default: - iFrame->SetType(AVC::ENotImplemented); - } - iFrame->SetFrameType(AVC::EResponse); - } - -/** Gets this command's AV/C frame. -@return the AV/C frame for this command -*/ -const CAVCFrame& CControlCommand::Frame() const - { - LOG_FUNC - return *iFrame; - } - -const TDesC8& CControlCommand::Data() const - { - LOG_FUNC - return iFrame->Data(); - } - -SymbianAvctp::TMessageType CControlCommand::MessageType() const - { - LOG_FUNC - return (iFrame->FrameType() == AVC::ECommand) ? SymbianAvctp::ECommand : SymbianAvctp::EResponse; - } - -/** Gets the button action from this command's AV/C frame. -This is only valid on passthrough commands. - -@return The button action. -*/ -AVCPanel::TButtonAction CControlCommand::ButtonAct() const - { - LOG_FUNC - AVCPanel::TButtonAction act; - iFrame->ButtonAct(act); - return act; - } - -/** Gets whether this command is currently assumed to be a click. - -This is used to support the click facility offered by RemCon, which -is not offered by AVRCP. As such AVRCP internally simulates outgoing -clicks by generating a press and release for one RemCon click. When -responses are received we know that if a command is a click we should -send only one response up to RemCon. - -Incoming passthrough press commands are assumed to be click until -the hold timer expires. When a matching release is received we can -then tell whether we need to send a single click up to RemCon, or -a release to match the press that was sent when the hold timer expired. - -@return ETrue is this is a click. EFalse if not. -*/ -TBool CControlCommand::Click() const - { - LOG_FUNC - return iIsClick; - } - -/** Sets whether this command is currently assumed to be a click -or not. - -@see CRcpcommand::Click() -@param aIsClick ETrue to set this as click. EFalse to set this as - not click. -*/ -void CControlCommand::SetClick(TBool aIsClick) - { - LOG_FUNC - iIsClick = aIsClick; - } - -/** Sets the RemCon data to indicate what button action this -command is. This function is only valid for commands in the -core api. - -@param aButtonAct The RemCon button action for this command. -@param aCommand Whether this is a command. This is needed - because the command data is at a different offset for - commands and responses. -*/ -void CControlCommand::SetCoreButtonAction(TRemConCoreApiButtonAction aButtonAct, TBool aCommand) - { - LOG_FUNC - - TInt offset = aCommand ? KRemConCoreApiButtonDataOffset + KRemConCoreApiCommandDataOffset - : KRemConCoreApiButtonDataOffset + KRemConCoreApiResponseDataOffset; - - AvrcpUtils::SetCommandDataFromInt(iCommandData, offset, - KRemConCoreApiButtonDataLength, aButtonAct); - } -/** ReSets the RemCon data to indicate what button action this -command is. This function is called when we the command is being re-used to generate a -new command to remconServ. - -@param aButtonAct The RemCon button action for this command. -@param aCommand Whether this is a command. This is needed - because the command data is at a different offset for - commands and responses. -*/ -void CControlCommand::ReSetCoreButtonActionL(TRemConCoreApiButtonAction aButtonAct, TBool aCommand) - { - LOG_FUNC - - if (iCommandData.MaxLength() < KRemConCoreApiButtonDataLength) - { - iCommandData.Close(); - iCommandData.CreateMaxL(KRemConCoreApiButtonDataLength); - } - - SetCoreButtonAction(aButtonAct, aCommand); - } - -/** Inserts the results at the beginning of this command's data. -If the data buffer is not large enough it will be ReAlloced to -allow the insertion. - -@return The result to pass to RemCon. KErrNone for an AV/C accepted. - KErrNotSupported for an AV/C not implemented. KErrGeneral - for an AV/C rejected. -*/ -TInt CControlCommand::InsertCoreResult(TInt aResult) - { - LOG_FUNC - TInt err = KErrNone; - TInt requiredLength = KRemConCoreApiResultDataLength + iCommandData.Length(); - - if(iCommandData.Length() >= requiredLength) - { - // Insert data to write result into - iCommandData.Insert(0, KRemConCoreApiResultPad); - } - else - { - // need longer buffer - err = iCommandData.ReAlloc(requiredLength); - if(!err) - { - iCommandData.Insert(0, KRemConCoreApiResultPad); - } - else - { - return err; - } - } - - AvrcpUtils::SetCommandDataFromInt(iCommandData, 0, - KRemConCoreApiResultDataLength, aResult); - return err; - } - -/** -Sets the result of set absolute volume response into this command's data -*/ -TInt CControlCommand::SetSetAbsoluteVolumeResult(const CAVCFrame& aFrame) - { - TInt err = KErrNone; - TRAP(err, DoSetAbsoluteVolumeResultL(aFrame)); - if (err != KErrNone) - { - // Ensure the client can receive an error in case of - // DoSetAbsoluteVolumeResultL leaves out. - iCommandData.Zero(); - TPckgBuf errBuf(err); - iCommandData.Append(errBuf); - iCommandData.SetLength(iCommandData.MaxLength()); - } - return err; - } - -void CControlCommand::DoSetAbsoluteVolumeResultL(const CAVCFrame& aFrame) - { - RRemConAbsoluteVolumeResponse absVol; - absVol.iError = KErrGeneral; - absVol.iMaxVolume = KAvrcpMaxAbsoluteVolume; - - CleanupClosePushL(absVol); - - switch(aFrame.Type()) - { - case AVC::EAccepted: - { - if (aFrame.Data().Length() == KLengthSetAbsoluteVolumeResponse) - { - absVol.iError = KErrNone; - TUint volumeOffset = KLengthSetAbsoluteVolumeResponse - 1; - absVol.iVolume = KAbsoluteVolumeMask & aFrame.Data()[volumeOffset]; - } - break; - } - case AVC::ERejected: // fall through - case AVC::ENotImplemented: - break; - default: - break; - } - - absVol.WriteL(iCommandData); - CleanupStack::PopAndDestroy(&absVol); - } -/** -Sets the result of volume changed notification response into this command's -data. -*/ -TInt CControlCommand::SetNotifyVolumeChangeResult(const CAVCFrame& aFrame) - { - TInt err = KErrNone; - TRAP(err, DoSetNotifyVolumeChangeResultL(aFrame)); - if (err == KErrNone) - { - // Through AVC::TCType the RemCon sever can know whether the response - // is an Interim or Changed or any other responses, so the RemCon - // server can decide to remove the notify command from its - // outgoingsent queue or not. - iFrame->SetType(aFrame.Type()); - } - else - { - // Ensure the client can receive an error in case of - // DoSetNotifyVolumeChangeResultL leaves out. - iCommandData.Zero(); - TPckgBuf errBuf(KErrGeneral); - iCommandData.Append(errBuf); - iCommandData.SetLength(iCommandData.MaxLength()); - - // Setting AVC::TCType to ERejected is intended to let the RemCon - // server to remove the notify command from its outgoingsent queue - // in case of DoSetNotifyVolumeChangeResultL leaves out. - iFrame->SetType(AVC::ERejected); - } - - return err; - } - -void CControlCommand::DoSetNotifyVolumeChangeResultL(const CAVCFrame& aFrame) - { - if (iCommandData.MaxLength() < KAbsoluteVolumeResponseDataSize) - { - iCommandData.Close(); - iCommandData.CreateL(KAbsoluteVolumeResponseDataSize); - } - - RRemConAbsoluteVolumeResponse absVol; - absVol.iError = KErrGeneral; - absVol.iMaxVolume = KAvrcpMaxAbsoluteVolume; - - CleanupClosePushL(absVol); - - switch(aFrame.Type()) - { - case AVC::EInterim: - case AVC::EChanged: - { - if (aFrame.Data().Length() == KLengthNotifyVolumeChangeResponse) - { - absVol.iError = KErrNone; - TUint volumeOffset = KLengthNotifyVolumeChangeResponse - 1; - absVol.iVolume = KAbsoluteVolumeMask & aFrame.Data()[volumeOffset]; - } - break; - } - case AVC::ERejected: // fall through - case AVC::ENotImplemented: - break; - default: - break; - } - absVol.WriteL(iCommandData); - CleanupStack::PopAndDestroy(&absVol); - } -//------------------------------------------------------------------------------------ -// Internal utility functions -//------------------------------------------------------------------------------------ - -/** Fills in command info from an AVC Control. - -This functions sets iInterfaceUid, iOperationId and iCommandData -to the correct values according to iFrame. The format of iCommandData -is defined by RemCon and is dependent on iInterfaceUid and iOperationId. - -@return KErrNone If the frame has been parsed successfully. -@return KErrNotSupported This frame represents a command for which a - RemCon converter or client side interface - cannot be found. -@return System wide error code. -*/ -TInt CControlCommand::ParseIncomingKnownOpcodeL(MRemConBearerObserver& aObserver) - { - LOG_FUNC - TInt err = KErrNotSupported; - - AVC::TCType cType = iFrame->Type(); - - switch(iFrame->Opcode()) - { - case AVC::EPassThrough: - { - if(iFrame->Data().Length() < KAVCPassthroughFrameLength) - { - LEAVEL(KErrCorrupt); - } - if (iFrame->SubunitType() != AVC::EPanel) - { - LEAVEL(KErrNotSupported); - } - - TUint8 avrcpOp; - if (cType != AVC::EGeneralEnquiry && cType == AVC::EControl) - { - iCommandData.CreateMaxL(KRemConCoreApiButtonDataLength); - err = iFrame->OperationId(avrcpOp); - if (err == KErrNone) - { - if (avrcpOp!=AVCPanel::EVendorUnique) - { - err = AvrcpToRemConOperation(avrcpOp, iOperationId, iInterfaceUid); - } - else - { - err = ParseVendorUniquePassthroughCommand(aObserver); - } - } - - if (err!=KErrNone) - { - err = KErrAvrcpInvalidOperationId; - } - } - else - { - iCommandData.Close(); - iCommandData.CreateL(KAVCFrameMaxLength); - TRemConMessageType message = ERemConCommand; - err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid), - iFrame->Data(), - iFrame->Data(), - iInterfaceUid, - iOperationId, - message, - iCommandData); - } - break; - } - case AVC::EUnitInfo: - { - if (iFrame->Type() == AVC::EStatus) - { - CAVCFrame* resp = AvrcpCommandFramer::UnitInfoResponseL(); - delete iFrame; - iFrame = resp; - err = KErrCompletion; // since bearer has done its job without client needed - } - else - { - err = KErrAvrcpInvalidCType; - } - break; - } - case AVC::ESubunitInfo: - { - if (iFrame->Type() == AVC::EStatus) - { - CAVCFrame* resp = AvrcpCommandFramer::SubunitInfoResponseL(); - delete iFrame; - iFrame = resp; - err = KErrCompletion; // since bearer has done its job without client needed - } - else - { - err = KErrAvrcpInvalidCType; - } - break; - } - - default: - { - iCommandData.Close(); - iCommandData.CreateL(KAVCFrameMaxLength); - TRemConMessageType message = ERemConCommand; - err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid), - iFrame->Data(), - iFrame->Data(), - iInterfaceUid, - iOperationId, - message, - iCommandData); - break; - } - } - - return err; - } - - -/** Fills in command info from an AVC Vendor Dependent message. - -This functions sets iInterfaceUid, iOperationId and iCommandData -to the correct values according to iFrame. The format of iCommandData -is defined by RemCon and is dependent on iInterfaceUid and iOperationId. -The AVC frame's length is checked that it at least contains the vendor id. - -@param aObserver An observer to be used to obtain a converter. -@return KErrNone If the frame has been parsed successfully. -@return KErrNotSupported This frame represents a command for which a - RemCon converter or client side interface - cannot be found. -@return KErrAvrcpInvalidCType The CType specified in this frame is invalid. -@return KErrAvrcpMetadataInvalidCommand The AVRCP command is invalid. -@return KErrAvrcpMetadataInvalidParameter The AVRCP parameter is invalid. -@return KErrAvrcpMetadataParameterNotFound The AVRCP parameter was not found. -@return KErrAvrcpMetadataInternalError An AVRCP internal error occurred (such as out-of-memory, - or an inter-process communication error) -@return System wide error code. -*/ -TInt CControlCommand::ParseIncomingVendorCommandL(MRemConBearerObserver& aObserver, CAVRCPFragmenter& aFragmenter) - { - LOG_FUNC - TInt err = KErrNone; - - SetVendorInfoL(EFalse); // set id and payload; leaves if not enough space available - - if (iVendorId!=KBluetoothSIGVendorId) - { - iCommandData.Close(); - iCommandData.CreateL(KAVCFrameMaxLength); - - TRemConMessageType message = ERemConCommand; - - err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid), - iFrame->Data(), - iFrame->Data(), - iInterfaceUid, - iOperationId, - message, - iCommandData); - } - else - { - // process v>1.0 version of AVRCP - // which use vendor dependent frames to extend v1.0 of AVRCP - // the vendor code has the value for the BT SIG - if (iFrame->SubunitType() != AVC::EPanel) - { - // this is for Control not Metadata - return KErrNotSupported; - } - - err = ParseMetadataTransferVendorCommand(aFragmenter); - if (err == KErrNone) - { - // Check that the interface UID is non-zero - __ASSERT_DEBUG(iInterfaceUid != TUid::Uid(0), AvrcpUtils::Panic(EAvrcpInterfaceUidNotSet)); - } - } - return err; - } - - -/** Creates RemCon command information from iFrame. - -This functions sets iInterfaceUid, iOperationId and iCommandData -to the correct values according to iFrame. The format of iCommandData -is defined by the interface, iInterfaceUid and is dependent on -iOperationId. A converter should be able to be found as this response -is a result of an outgoing command on this interface. - -@param aObserver An observer used to get a converter. -@param aFrame The AV/C frame for this command. -*/ -void CControlCommand::ParseIncomingUnknownResponse(MRemConBearerObserver& aObserver, - const CAVCFrame& aFrame) - { - LOG_FUNC - // We need to pass a response up to RemCon even if we can't get a - // converter to generate a decent response so we don't - - iCommandData.Close(); - TInt err = iCommandData.Create(KAVCFrameMaxLength); - if(!err) - { - TRemConMessageType type = ERemConResponse; // output param - err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid), - aFrame.Data(), aFrame.Data(), iInterfaceUid, iOperationId, type, iCommandData); - } - } - -/** Translates from an AVC operation id to RemCon's core interface. - -@param aAvrcpOp The AVC passthrough operation id. -@param aRemConOp On return the RemCon operation id within the core interface. -@return KErrNone If the operation has been translated successfully. -@return KErrNotSupported If the operation does not correspond to one - in the RemCon core interface. -*/ -TInt CControlCommand::AvrcpToRemConOperation(TUint aAvrcpOp, TUint& aRemConOp, TUid& aRemConIf) - { - LOG_STATIC_FUNC - TInt err = KErrNone; - - //TBH setting here as most are for the Core API - //some cases will override - aRemConIf = TUid::Uid(KRemConCoreApiUid); - - switch(aAvrcpOp) - { - case AVCPanel::ESelect: - aRemConOp = ERemConCoreApiSelect; - break; - case AVCPanel::EUp: - aRemConOp = ERemConCoreApiUp; - break; - case AVCPanel::EDown: - aRemConOp = ERemConCoreApiDown; - break; - case AVCPanel::ELeft: - aRemConOp = ERemConCoreApiLeft; - break; - case AVCPanel::ERight: - aRemConOp = ERemConCoreApiRight; - break; - case AVCPanel::ERightUp: - aRemConOp = ERemConCoreApiRightUp; - break; - case AVCPanel::ERightDown: - aRemConOp = ERemConCoreApiRightDown; - break; - case AVCPanel::ELeftUp: - aRemConOp = ERemConCoreApiLeftUp; - break; - case AVCPanel::ELeftDown: - aRemConOp = ERemConCoreApiLeftDown; - break; - case AVCPanel::ERootMenu: - aRemConOp = ERemConCoreApiRootMenu; - break; - case AVCPanel::ESetupMenu: - aRemConOp = ERemConCoreApiSetupMenu; - break; - case AVCPanel::EContentsMenu: - aRemConOp = ERemConCoreApiContentsMenu; - break; - case AVCPanel::EFavoriteMenu: - aRemConOp = ERemConCoreApiFavoriteMenu; - break; - case AVCPanel::EExit: - aRemConOp = ERemConCoreApiExit; - break; - case AVCPanel::E0: - aRemConOp = ERemConCoreApi0; - break; - case AVCPanel::E1: - aRemConOp = ERemConCoreApi1; - break; - case AVCPanel::E2: - aRemConOp = ERemConCoreApi2; - break; - case AVCPanel::E3: - aRemConOp = ERemConCoreApi3; - break; - case AVCPanel::E4: - aRemConOp = ERemConCoreApi4; - break; - case AVCPanel::E5: - aRemConOp = ERemConCoreApi5; - break; - case AVCPanel::E6: - aRemConOp = ERemConCoreApi6; - break; - case AVCPanel::E7: - aRemConOp = ERemConCoreApi7; - break; - case AVCPanel::E8: - aRemConOp = ERemConCoreApi8; - break; - case AVCPanel::E9: - aRemConOp = ERemConCoreApi9; - break; - case AVCPanel::EDot: - aRemConOp = ERemConCoreApiDot; - break; - case AVCPanel::EEnter: - aRemConOp = ERemConCoreApiEnter; - break; - case AVCPanel::EClear: - aRemConOp = ERemConCoreApiClear; - break; - case AVCPanel::EChannelUp: - aRemConOp = ERemConCoreApiChannelUp; - break; - case AVCPanel::EChannelDown: - aRemConOp = ERemConCoreApiChannelDown; - break; - case AVCPanel::EPreviousChannel: - aRemConOp = ERemConCoreApiPreviousChannel; - break; - case AVCPanel::ESoundSelect: - aRemConOp = ERemConCoreApiSoundSelect; - break; - case AVCPanel::EInputSelect: - aRemConOp = ERemConCoreApiInputSelect; - break; - case AVCPanel::EDisplayInformation: - aRemConOp = ERemConCoreApiDisplayInformation; - break; - case AVCPanel::EHelp: - aRemConOp = ERemConCoreApiHelp; - break; - case AVCPanel::EPageUp: - aRemConOp = ERemConCoreApiPageUp; - break; - case AVCPanel::EPageDown: - aRemConOp = ERemConCoreApiPageDown; - break; - case AVCPanel::EPower: - aRemConOp = ERemConCoreApiPower; - break; - case AVCPanel::EVolumeUp: - aRemConOp = ERemConCoreApiVolumeUp; - break; - case AVCPanel::EVolumeDown: - aRemConOp = ERemConCoreApiVolumeDown; - break; - case AVCPanel::EMute: - aRemConOp = ERemConCoreApiMute; - break; - case AVCPanel::EPlay: - aRemConOp = ERemConCoreApiPlay; - break; - case AVCPanel::EStop: - aRemConOp = ERemConCoreApiStop; - break; - case AVCPanel::EPause: - aRemConOp = ERemConCoreApiPause; - break; - case AVCPanel::ERecord: - aRemConOp = ERemConCoreApiRecord; - break; - case AVCPanel::ERewind: - aRemConOp = ERemConCoreApiRewind; - break; - case AVCPanel::EFastForward: - aRemConOp = ERemConCoreApiFastForward; - break; - case AVCPanel::EEject: - aRemConOp = ERemConCoreApiEject; - break; - case AVCPanel::EForward: - aRemConOp = ERemConCoreApiForward; - break; - case AVCPanel::EBackward: - aRemConOp = ERemConCoreApiBackward; - break; - case AVCPanel::EAngle: - aRemConOp = ERemConCoreApiAngle; - break; - case AVCPanel::ESubpicture: - aRemConOp = ERemConCoreApiSubpicture; - break; - case AVCPanel::EF1: - aRemConOp = ERemConCoreApiF1; - break; - case AVCPanel::EF2: - aRemConOp = ERemConCoreApiF2; - break; - case AVCPanel::EF3: - aRemConOp = ERemConCoreApiF3; - break; - case AVCPanel::EF4: - aRemConOp = ERemConCoreApiF4; - break; - case AVCPanel::EF5: - aRemConOp = ERemConCoreApiF5; - break; - case AVCPanel::EVendorUnique: - default: - err = KErrNotSupported; - } - - return err; - } - - -TInt CControlCommand::ParseVendorUniquePassthroughCommand(MRemConBearerObserver& aObserver) - { - TInt err = KErrNone; - TRAP(err, SetVendorInfoL(ETrue)); // set id and payload; leaves if not enough space available - - if (err == KErrNone && iVendorId == KBluetoothSIGVendorId) - { - // it's one of the v1.3 (or later!) MT commands - err = ParseMetadataTransferPassthroughCommand(); - } - else - { - iCommandData.Close(); - TRAP(err, iCommandData.CreateL(KAVCFrameMaxLength)); - if(err == KErrNone) - { - TRemConMessageType message = ERemConCommand; - err = aObserver.BearerToInterface(TUid::Uid(KRemConBearerAvrcpImplementationUid), - iFrame->Data(), - iFrame->Data(), - iInterfaceUid, - iOperationId, - message, - iCommandData); - } - } - - return err; - } - -/** Translates from RemCon's core interface to an AVC operation id. - -@param aRemConOp The RemCon operation id within the core interface. -@param aAvrcpOp On return the AVC passthrough operation id. -@return KErrNone If the operation has been translated successfully. -@return KErrNotSupported If the operation does not correspond to one - provided by AVRCP. -*/ -TInt CControlCommand::RemConToAvrcpOperation(TUint aRemConOp, AVCPanel::TOperationId& aAvrcpOp) - { - LOG_STATIC_FUNC - TInt err = KErrNone; - switch(aRemConOp) - { - case ERemConCoreApiSelect: - aAvrcpOp = AVCPanel::ESelect; - break; - case ERemConCoreApiUp: - aAvrcpOp = AVCPanel::EUp; - break; - case ERemConCoreApiDown: - aAvrcpOp = AVCPanel::EDown; - break; - case ERemConCoreApiLeft: - aAvrcpOp = AVCPanel::ELeft; - break; - case ERemConCoreApiRight: - aAvrcpOp = AVCPanel::ERight; - break; - case ERemConCoreApiRightUp: - aAvrcpOp = AVCPanel::ERightUp; - break; - case ERemConCoreApiRightDown: - aAvrcpOp = AVCPanel::ERightDown; - break; - case ERemConCoreApiLeftUp: - aAvrcpOp = AVCPanel::ELeftUp; - break; - case ERemConCoreApiLeftDown: - aAvrcpOp = AVCPanel::ELeftDown; - break; - case ERemConCoreApiRootMenu: - aAvrcpOp = AVCPanel::ERootMenu; - break; - case ERemConCoreApiSetupMenu: - aAvrcpOp = AVCPanel::ESetupMenu; - break; - case ERemConCoreApiContentsMenu: - aAvrcpOp = AVCPanel::EContentsMenu; - break; - case ERemConCoreApiFavoriteMenu: - aAvrcpOp = AVCPanel::EFavoriteMenu; - break; - case ERemConCoreApiExit: - aAvrcpOp = AVCPanel::EExit; - break; - case ERemConCoreApi0: - aAvrcpOp = AVCPanel::E0; - break; - case ERemConCoreApi1: - aAvrcpOp = AVCPanel::E1; - break; - case ERemConCoreApi2: - aAvrcpOp = AVCPanel::E2; - break; - case ERemConCoreApi3: - aAvrcpOp = AVCPanel::E3; - break; - case ERemConCoreApi4: - aAvrcpOp = AVCPanel::E4; - break; - case ERemConCoreApi5: - aAvrcpOp = AVCPanel::E5; - break; - case ERemConCoreApi6: - aAvrcpOp = AVCPanel::E6; - break; - case ERemConCoreApi7: - aAvrcpOp = AVCPanel::E7; - break; - case ERemConCoreApi8: - aAvrcpOp = AVCPanel::E8; - break; - case ERemConCoreApi9: - aAvrcpOp = AVCPanel::E9; - break; - case ERemConCoreApiDot: - aAvrcpOp = AVCPanel::EDot; - break; - case ERemConCoreApiEnter: - aAvrcpOp = AVCPanel::EEnter; - break; - case ERemConCoreApiClear: - aAvrcpOp = AVCPanel::EClear; - break; - case ERemConCoreApiChannelUp: - aAvrcpOp = AVCPanel::EChannelUp; - break; - case ERemConCoreApiChannelDown: - aAvrcpOp = AVCPanel::EChannelDown; - break; - case ERemConCoreApiPreviousChannel: - aAvrcpOp = AVCPanel::EPreviousChannel; - break; - case ERemConCoreApiSoundSelect: - aAvrcpOp = AVCPanel::ESoundSelect; - break; - case ERemConCoreApiInputSelect: - aAvrcpOp = AVCPanel::EInputSelect; - break; - case ERemConCoreApiDisplayInformation: - aAvrcpOp = AVCPanel::EDisplayInformation; - break; - case ERemConCoreApiHelp: - aAvrcpOp = AVCPanel::EHelp; - break; - case ERemConCoreApiPageUp: - aAvrcpOp = AVCPanel::EPageUp; - break; - case ERemConCoreApiPageDown: - aAvrcpOp = AVCPanel::EPageDown; - break; - case ERemConCoreApiPower: - aAvrcpOp = AVCPanel::EPower; - break; - case ERemConCoreApiVolumeUp: - aAvrcpOp = AVCPanel::EVolumeUp; - break; - case ERemConCoreApiVolumeDown: - aAvrcpOp = AVCPanel::EVolumeDown; - break; - case ERemConCoreApiMute: - aAvrcpOp = AVCPanel::EMute; - break; - case ERemConCoreApiPlay: - aAvrcpOp = AVCPanel::EPlay; - break; - case ERemConCoreApiStop: - aAvrcpOp = AVCPanel::EStop; - break; - case ERemConCoreApiPause: - aAvrcpOp = AVCPanel::EPause; - break; - case ERemConCoreApiRecord: - aAvrcpOp = AVCPanel::ERecord; - break; - case ERemConCoreApiRewind: - aAvrcpOp = AVCPanel::ERewind; - break; - case ERemConCoreApiFastForward: - aAvrcpOp = AVCPanel::EFastForward; - break; - case ERemConCoreApiEject: - aAvrcpOp = AVCPanel::EEject; - break; - case ERemConCoreApiForward: - aAvrcpOp = AVCPanel::EForward; - break; - case ERemConCoreApiBackward: - aAvrcpOp = AVCPanel::EBackward; - break; - case ERemConCoreApiAngle: - aAvrcpOp = AVCPanel::EAngle; - break; - case ERemConCoreApiSubpicture: - aAvrcpOp = AVCPanel::ESubpicture; - break; - case ERemConCoreApiF1: - aAvrcpOp = AVCPanel::EF1; - break; - case ERemConCoreApiF2: - aAvrcpOp = AVCPanel::EF2; - break; - case ERemConCoreApiF3: - aAvrcpOp = AVCPanel::EF3; - break; - case ERemConCoreApiF4: - aAvrcpOp = AVCPanel::EF4; - break; - case ERemConCoreApiF5: - aAvrcpOp = AVCPanel::EF5; - break; - default: - err = KErrNotSupported; - } - return err; - } - -TUint16 CControlCommand::Get16(const TPtrC8& aPtr) - { - return (aPtr[0]<<8) | aPtr[1]; - } - -TInt CControlCommand::DummyCallback(TAny*) - { - // Should never be called- should be overwritten by a non-dummy callback - // before it's ever requested let alone called. - AvrcpUtils::Panic(EAvrcpDummyCallbackCalled); - return KErrNone; - } - -void CControlCommand::SetVendorInfoL(TBool aIsPassthrough) - { - if (aIsPassthrough) - { - if (iFrame->DataLength() < KAVCVendorUniquePassthroughHeader) - { - User::Leave(KErrCorrupt); - } - iVendorPayloadData.Set(CAVCVendorUniquePassthroughCommand::GetPayloadAndVID(*iFrame, iVendorId)); - } - else - { - if (iFrame->DataLength() < KAVCVendorIdLength) - { - User::Leave(KErrCorrupt); - } - iVendorPayloadData.Set(CAVCVendorDependentCommand::GetPayloadAndVID(*iFrame, iVendorId)); - } - } - -TBool CControlCommand::IsAvrcpPassthrough() const - { - TBool isAvrcpPassthrough = EFalse; - - if(iInterfaceUid.iUid == KRemConCoreApiUid || iInterfaceUid.iUid == KRemConGroupNavigationApiUid) - { - isAvrcpPassthrough = ETrue; - } - - return isAvrcpPassthrough; - } - -TBool CControlCommand::IsPassthrough() const - { - return ((iFrame->Opcode() == AVC::EPassThrough) && (iFrame->SubunitType() == AVC::EPanel)); - } - -TBool CControlCommand::PlayerSpecificNotify() const - { - TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId); - TMetadataTransferPDU pduId = RAvrcpIPC::GetPDUIdFromIPCOperationId(iOperationId); - - if(pduId != ERegisterNotification) - { - return EFalse; - } - - if(iInterfaceUid == TUid::Uid(KRemConPlayerInformationUid)) - { - if((eventId == ERegisterNotificationPlaybackStatusChanged) || - (eventId == ERegisterNotificationTrackChanged) || - (eventId == ERegisterNotificationTrackReachedEnd) || - (eventId == ERegisterNotificationTrackReachedStart) || - (eventId == ERegisterNotificationPlaybackPosChanged) || - (eventId == ERegisterNotificationPlayerApplicationSettingChanged)) - { - return ETrue; - } - } - else if(iInterfaceUid == TUid::Uid(KRemConNowPlayingApiUid)) - { - if (eventId == ERegisterNotificationNowPlayingContentChanged) - { - return ETrue; - } - } - else - { - return EFalse; - } - return EFalse; - } - -TBool CControlCommand::NormalCommand() - { - TBool ret = ETrue; - TRegisterNotificationEvent eventId = RAvrcpIPC::GetEventIdFromIPCOperationId(iOperationId); - TMetadataTransferPDU pduId = RAvrcpIPC::GetPDUIdFromIPCOperationId(iOperationId); - - if((eventId == ERegisterNotificationAvailablePlayersChanged) || - (eventId == ERegisterNotificationAddressedPlayerChanged)) - { - ret = EFalse; - } - return ret; - } -/** -@return Ownership of a CControlCommand representing an interim response to this command - */ -CControlCommand* CControlCommand::InterimResponseL() - { - CAVCFrame* frame = CAVCFrame::NewL(iFrame->Data(), AVC::EResponse); - CleanupStack::PushL(frame); - frame->SetType(AVC::EInterim); - - CControlCommand* finalResponse = CControlCommand::NewL(frame, iRemConId, - iTransactionLabel, iRemoteAddr, iClientId, iPlayerInfoManager); - CleanupStack::Pop(frame); - - finalResponse->iInterfaceUid = iInterfaceUid; - finalResponse->iOperationId = iOperationId; - - return finalResponse; - } - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/internalcommand.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/internalcommand.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -// Copyright (c) 2009 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: -// - -#include "internalcommand.h" -#include "avrcputils.h" -#include - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BEARER); -#endif - -/** Factory function. - -@param aFrame The frame this command is to represent. -@param aRemConId The RemCon transaction label. -@param aTransLabel The AVCTP transaction label. -@param aAddr The bluetooth address to send this command to. -@return A fully constructed CBrowseCommand. -@leave System wide error codes. -*/ -CInternalCommand* CInternalCommand::NewL(TUid aInterfaceUid, - TUint aId, - TUint aOperationId, - const TDesC8& aCommandData) - { - CInternalCommand* command = new(ELeave)CInternalCommand(aInterfaceUid, aId, aOperationId); - CleanupStack::PushL(command); - command->ConstructL(aCommandData); - CleanupStack::Pop(command); - return command; - } - -/** Constructor. - -@param aFrame The AV/C frame this command is to represent. -@param aRemConId The RemCon transaction label. -@param aTransLabel The AVCTP transaction label. -@param aAddr The bluetooth address to send this command to. -@return A partially constructed CBrowseCommand. -@leave System wide error codes. -*/ -CInternalCommand::CInternalCommand(TUid aInterfaceUid, - TUint aId, - TUint aOperationId) - : CAvrcpCommand(aId, KDummyTransactionLabel, NULL) - { - LOG_FUNC - iInterfaceUid = aInterfaceUid; - iOperationId = aOperationId; - } - -/** Destructor. -*/ -CInternalCommand::~CInternalCommand() - { - LOG_FUNC - __ASSERT_DEBUG(iUsers == 0, AvrcpUtils::Panic(EAvrcpCommandStillInUse)); - iCommandData.Close(); - } - -void CInternalCommand::ConstructL(const TDesC8& aCommandData) - { - iCommandData.CreateL(aCommandData); - } - -void CInternalCommand::ResetL(TUint& aId, const TDesC8& aCommandData) - { - iCommandData.Close(); - iCommandData.CreateL(aCommandData); - iRemConId = aId; - } - -SymbianAvctp::TMessageType CInternalCommand::MessageType() const - { - // Should never be going out AVCTPwards - __ASSERT_DEBUG(EFalse, AvrcpUtils::Panic(EAvctpMessageTypeRequestedForInternalCommand)); - - return SymbianAvctp::EUndefined; - } - -const TDesC8& CInternalCommand::Data() const - { - return iCommandData; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/passthroughhelper.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/passthroughhelper.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,443 +0,0 @@ -// Copyright (c) 2009 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: -// - -#include "avrcplog.h" -#include "avrcprouter.h" -#include "avrcputils.h" -#include "controlcommand.h" -#include "passthroughhelper.h" -#include "controlbearer.h" - - -CPassthroughHelper* CPassthroughHelper::NewL(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer) - { - CPassthroughHelper* helper = new(ELeave)CPassthroughHelper(aRouter, aCommandInterface, aTimer); - CleanupStack::PushL(helper); - helper->ConstructL(); - CleanupStack::Pop(helper); - return helper; - } - -CPassthroughHelper::~CPassthroughHelper() - { - } - -CPassthroughHelper::CPassthroughHelper(CRcpRouter& aRouter, MRemConControlCommandInterface& aCommandInterface, CDeltaTimer& aTimer) - : iRouter(aRouter) - , iCommandInterface(aCommandInterface) - , iTimer(aTimer) - { - } - -void CPassthroughHelper::ConstructL() - { - } - -void CPassthroughHelper::Disconnect() - { - LOG_FUNC - - // We handle the last command as a special case to ensure the presses and - // releases are balanced from a clients' point of view. - if(iPreviousPassthrough) - { - iRouter.RemoveFromSendQueue(*iPreviousPassthrough); - BalanceHandledCommand(*iPreviousPassthrough); - } - } - -/** Sends a response to the remote device. - -Because of the 100ms timeout for responses we send a response to -passthrough commands as soon as we receive them. This means the real -response from RemCon is currently ignored. A real response is -only sent if this is a vendor dependent command. - -@param aCommand The command to respond to. -@param aErr The result of handling the command. KErrNone if successful. - KErrNotSupported if this operation is not supported. -*/ -void CPassthroughHelper::Respond(CControlCommand& aCommand, TInt aErr) - { - LOG_FUNC - aCommand.SetResponseType(aErr); - iRouter.AddToSendQueue(aCommand); - } - -/** To be called on completion of command handling. - -This aggregates the handler's tidying up of a finished -command. - -@param aCommand The command to tidy up. -*/ -void CPassthroughHelper::HandledCommand(CControlCommand& aCommand) - { - LOG_FUNC - - // If this was the previous passthrough reset it to NULL - if(iPreviousPassthrough == &aCommand) - { - iPreviousPassthrough = NULL; - } - - aCommand.CancelTimer(iTimer); - aCommand.DecrementUsers(); - } - -/** Handles incoming passthrough command. - -How the command is handled is dependent on this and the previous command. - -Previous command This command Behaviour -Press_op1 Press_op1 discard -Press_op1 Release_op1 press_op1 hold timer not expired - generate click_op1 - press_op1 release timer not expired - generate release_op1 -Press_op1 Press_op2 generate release_op1, start hold timer for press_op2 -Press_op1 Release_op2 press_op1 hold timer not expired - generate click_op1, discard release_op2 - press_op1 release timer not expired - generate release_op1, discard release_op2 -Release_op1 Press_op1 start hold timer for press_op1 -Release_op1 Release_op1 discard -Release_op1 Press_op2 start hold timer for press_op2 -Release_op1 Release_op2 discard - -@param aCommand The command to handle. -@leave System wide error code. -*/ -void CPassthroughHelper::HandlePassthrough(CControlCommand& aCommand) - { - LOG_FUNC - - // We can't map Vendor Unique passthrough command to clicks as we do - // not know how the button action is conveyed to the API. All we can - // do is try and ensure that we try to generate a release if one is - // missing by asking the convert. We also need to consider them as - // part of the passthrough history for how other passthrough commands - // should be interpreted. - TUint8 thisOpId; - aCommand.Frame().OperationId(thisOpId); - if(!aCommand.IsAvrcpPassthrough()) - { - aCommand.SetClick(EFalse); - } - - // Behaviour depends on previous command - TUint8 prevOpId; - if(iPreviousPassthrough) - { - __ASSERT_ALWAYS(iPreviousPassthrough->ButtonAct() == AVCPanel::EButtonPress, - AvrcpUtils::Panic(EAvrcpPressNotPreviousPassthroughCommand)); - - iPreviousPassthrough->Frame().OperationId(prevOpId); - } - - if(aCommand.ButtonAct() == AVCPanel::EButtonPress) - { - // Respond now so we can decrement users of aCommand at will - Respond(aCommand, KErrNone); - - if(iPreviousPassthrough) - { - // previous is press, current is press - if(prevOpId == thisOpId) - { - // prevCommand is for same opId as this one. Drop this - // command and reset release timer for prevCommand. - aCommand.DecrementUsers(); - - iPreviousPassthrough->CancelTimer(iTimer); - // If still flagged as a click then the user won't have been notified - // of the press yet - so do it now. - if(iPreviousPassthrough->Click()) - { - iPreviousPassthrough->SetClick(EFalse); - iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonPress, ETrue); - iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); - } - StartReleaseTimer(*iPreviousPassthrough); - } - else if(iPreviousPassthrough->Click()) - { - // prevCommand is click, Hold timer not expired. Generate click - // to RemCon then start waiting for click. - iPreviousPassthrough->CancelTimer(iTimer); - iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue); - iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); - - HandledCommand(*iPreviousPassthrough); - - // Start waiting for click (core api) or release (vendor unique) - NewPress(aCommand); - } - else - { - // prevCommand is not click, Release timer not expired. Generate - // release to RemCon then start waiting for click. - BalanceHandledCommand(*iPreviousPassthrough); - - // Start waiting for click (core api) or release (vendor unique) - NewPress(aCommand); - } - } - else - { - // No previous command, current is press - - // Start waiting for click (core api) or release (vendor unique) - NewPress(aCommand); - } - } - else if(iPreviousPassthrough) - { - // previous is press, current is release - if(prevOpId == thisOpId) - { - Respond(aCommand, KErrNone); - - if(iPreviousPassthrough->Click()) - { - // Button release for same opId with hold timeout - aCommand.DecrementUsers(); // Drop this command. - - // Cancel hold timer and send the previous command as a click. - iPreviousPassthrough->CancelTimer(iTimer); - iPreviousPassthrough->SetCoreButtonAction(ERemConCoreApiButtonClick, ETrue); - iCommandInterface.MrcciNewCommand(*iPreviousPassthrough, iPreviousPassthrough->ClientId()); - - HandledCommand(*iPreviousPassthrough); - } - else - { - // Button release for same opId, hold timeout expired - iPreviousPassthrough->CancelTimer(iTimer); - HandledCommand(*iPreviousPassthrough); - - if(aCommand.IsAvrcpPassthrough()) - { - aCommand.SetCoreButtonAction(ERemConCoreApiButtonRelease, ETrue); - } - iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); - aCommand.DecrementUsers(); - } - } - else - { - // Drop this release and continue waiting for release to - // prevCommand. - Respond(aCommand, KErrNone); - aCommand.DecrementUsers(); - } - } - else - { - // No prevCommand, this is a release - // To get here either: - // - this is a spurious release - // - we've given up waiting for this - - // Because responses must be made within 100ms we respond before waiting - // to see what RemCon thinks. - Respond(aCommand, KErrNone); - aCommand.DecrementUsers(); - } - } - -void CPassthroughHelper::NewPress(CControlCommand& aCommand) - { - LOG_FUNC - __ASSERT_DEBUG(!iPreviousPassthrough, AVRCP_PANIC(EPreviousPassthroughNonNullReplacing)); - - iPreviousPassthrough = &aCommand; - - if(aCommand.IsAvrcpPassthrough()) - { - StartHoldTimer(aCommand); - } - else - { - iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); - StartReleaseTimer(aCommand); - } - } - -/** To be called on completion of command handling for an unbalanced press. - -This is a special version of the HandledCommand which which assumes the -command has been notified to the user and so balances the notification -of a press with a generated release command. - -@param aCommand The command to tidy up. -*/ -void CPassthroughHelper::BalanceHandledCommand(CControlCommand& aCommand) - { - LOG_FUNC - // CancelTimer also frees the timer entries, so needs to be called - // here even though there's no pending entry. - aCommand.CancelTimer(iTimer); - - // If this was the previous passthrough reset it to NULL - if(iPreviousPassthrough == &aCommand) - { - iPreviousPassthrough = NULL; - } - - // Here we handle the case that a press has been informed but a release has yet - // to be reported, and if it hasn't we provide the notification. - if(aCommand.ButtonAct() == AVCPanel::EButtonPress && !aCommand.Click()) - { - if(aCommand.IsAvrcpPassthrough()) - { - // FIXME I think we might need a new transaction id here? - TRAPD(err, aCommand.ReSetCoreButtonActionL(ERemConCoreApiButtonRelease, ETrue)); - if (err == KErrNone) - { - iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); - } - else - { - // just silently drop this command, do not send command to remconserv - } - } - else - { - // Need see if we can get a valid release from the converter. Pass - // it the same AVC Frame as the press, but with the button action - // flipped to release. If we can't do this then there's not a - // lot we can do. - // FIXME - } - } - aCommand.iHandlingLink.Deque(); - aCommand.DecrementUsers(); - } - - -//------------------------------------------------------------------------------------ -// Timer functions -//------------------------------------------------------------------------------------ - -/** Starts the hold timer (only applicable to press commands). - -This is the timer to determine whether a command will be passed to RemCon -as a click. If the timer expires before a matching release is received -the press and release will be sent separately. Otherwise, a click is -sent. - -@param aCommand The command to start the timer for. -*/ -void CPassthroughHelper::StartHoldTimer(CControlCommand& aCommand) - { - LOG_FUNC - - // These cannot fail as we use placement new - TAvrcpTimerExpiryInfo* timerInfo = new(aCommand.TimerExpiryInfo())TAvrcpTimerExpiryInfo(this, aCommand); - - TCallBack callback(HoldExpiry, timerInfo); - TDeltaTimerEntry* timerEntry = new(aCommand.TimerEntry())TDeltaTimerEntry(callback); - - iTimer.Queue(KRcpHoldThreshold, *timerEntry); - } - -/** Callback when hold timer expires. - -This is a static forwarding function. - -@param aExpiryInfo The information used by the real HoldExpiry to - deal with the timer expiry. -*/ -TInt CPassthroughHelper::HoldExpiry(TAny* aExpiryInfo) - { - LOG_STATIC_FUNC - TAvrcpTimerExpiryInfo *timerInfo = reinterpret_cast(aExpiryInfo); - (reinterpret_cast(timerInfo->iHandler))->HoldExpiry(timerInfo->iCommand); - - return KErrNone; - } - -/** Deals with expiry of hold timer. - -1) This is not a click. Set click to false for this command. -2) Inform RemCon of available press command -3) Start release timer. - -@param aCommand The CControlCommand that has expired. -*/ -void CPassthroughHelper::HoldExpiry(CControlCommand& aCommand) - { - LOG_FUNC - __ASSERT_DEBUG((aCommand.ButtonAct() == AVCPanel::EButtonPress), AvrcpUtils::Panic(EAvrcpHoldExpiryForRelease)); - - // We haven't received a release soon enough to treat this as - // a click. Send the press on to RemCon and wait for a release. - // CancelTimer also frees the timer entries, so needs to be called - // here even though there's no pending entry. - aCommand.CancelTimer(iTimer); - aCommand.SetClick(EFalse); - aCommand.SetCoreButtonAction(ERemConCoreApiButtonPress, ETrue); - iCommandInterface.MrcciNewCommand(aCommand, aCommand.ClientId()); - StartReleaseTimer(aCommand); - } - -/** Starts the release timer (only applicable to press commands). - -If a release is not received quickly enough to treat this press as -a click, the release timer is started. 2s after receiving a button -press we should assume the release if we haven't received one. - -@param aCommand The command to start the timer for. -*/ -void CPassthroughHelper::StartReleaseTimer(CControlCommand& aCommand) - { - TAvrcpTimerExpiryInfo* timerInfo = new(aCommand.TimerExpiryInfo())TAvrcpTimerExpiryInfo(this, aCommand); - - TCallBack callback(ReleaseExpiry, timerInfo); - TDeltaTimerEntry* timerEntry = new(aCommand.TimerEntry())TDeltaTimerEntry(callback); - - iTimer.Queue(KRcpIncomingButtonReleaseTimeout, *timerEntry); - } - -/** Callback when release timer expires. - -This is a static forwarding function. - -@param aExpiryInfo The information used by the real ReleaseExpiry to - deal with the timer expiry. -*/ -TInt CPassthroughHelper::ReleaseExpiry(TAny* aExpiryInfo) - { - LOG_STATIC_FUNC - TAvrcpTimerExpiryInfo *timerInfo = reinterpret_cast(aExpiryInfo); - (reinterpret_cast(timerInfo->iHandler))->ReleaseExpiry(timerInfo->iCommand); - - return KErrNone; - } - -/** Deals with expiry of release timer. - -1) Generate release for this command. -2) Inform RemCon of available release command. - -@param aCommand The CControlCommand that has expired. -*/ -void CPassthroughHelper::ReleaseExpiry(CControlCommand& aCommand) - { - LOG_FUNC - __ASSERT_DEBUG((aCommand.ButtonAct() == AVCPanel::EButtonPress), AvrcpUtils::Panic(EAvrcpReleaseExpiryForRelease)); - __ASSERT_DEBUG(!aCommand.Click(), AvrcpUtils::Panic(EAvrcpReleaseExpiryForClick)); - - // We haven't received a release within the allotted time. Assume - // one and generate it to RemCon. - BalanceHandledCommand(aCommand); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerbitmasks.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/playerbitmasks.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,337 +0,0 @@ -// 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" -// 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: -// TPlayerFeatureBitmask.cpp -// - -#include -#include "avrcplog.h" -#include "avrcputils.h" -#include "mediabrowse.h" -#include "nowplaying.h" -#include "playerbitmasks.h" -#include "remcongroupnavigation.h" - - -TPlayerFeatureBitmask::TPlayerFeatureBitmask() - { - iFeatureBitmask.FillZ(KFeatureBitmaskLength); - } - -TPlayerFeatureBitmask::TPlayerFeatureBitmask(const TPlayerFeatureBitmask& aFeatureBitmask) - { - iFeatureBitmask.Copy(aFeatureBitmask.FeatureBitmask()); - } - -void TPlayerFeatureBitmask::SetCoreApiFeatures(const RArray& aOperation) - { - if(aOperation.Count() > 0) - { - for(TInt j = 0; j< aOperation.Count() ; j++) - { - switch(aOperation[j]) - { - case ERemConCoreApiSelect: - iFeatureBitmask[ESelectByteOffset] |= (1<& aOperation) - { - if(aOperation.Count()) - { - iFeatureBitmask[EAdvancedControlPlayerByteOffset] |= (1<& aOperation) - { - if(aOperation.Count()) - { - iFeatureBitmask[EVendorUniqueByteOffset] |= (1<& aOperation) - { - if(aOperation.Count()) - { - iFeatureBitmask[EAdvancedControlPlayerByteOffset] |= (1<= 0) - { - iFeatureBitmask[EAddToNowPlayingByteOffset] |= (1<& aOperation) - { - if(aOperation.Count()) - { - iFeatureBitmask[EAdvancedControlPlayerByteOffset] |= (1<= 0) - { - iFeatureBitmask[ESearchByteOffset] |= (1<= 0) - { - iFeatureBitmask[EUidPersistencyByteOffset] |= (1<RemConCommandId(); - iCommandInterface.MrcciCommandExpired(transId); - - iCommands.Remove(aClientId); - cmd->DecrementUsers(); - } - } - -void CPlayerWatcherBase::MessageSent(CAvrcpCommand& /*aCommand*/, TInt /*aSendResult*/) - { - LOG_FUNC; - __DEBUG_ONLY(AVRCP_PANIC(ELowerInterfaceUsedOnInternalHandler)); - } - -void CPlayerWatcherBase::MaxPacketSize(TInt /*aMtu*/) - { - LOG_FUNC; - __DEBUG_ONLY(AVRCP_PANIC(ELowerInterfaceUsedOnInternalHandler)); - } - -void CPlayerWatcherBase::ReceiveCommandL(const TDesC8& /*aMessageInformation*/, SymbianAvctp::TTransactionLabel /*aTransLabel*/, const TBTDevAddr& /*aAddr*/) - { - LOG_FUNC; - __DEBUG_ONLY(AVRCP_PANIC(ELowerInterfaceUsedOnInternalHandler)); - } - -CInternalCommand& CPlayerWatcherBase::FindCommand(TUid __DEBUG_ONLY(aInterfaceUid), - TUint aTransactionId, TRemConClientId& aFoundClientId) - { - __ASSERT_DEBUG(aInterfaceUid == TUid::Uid(KRemConPlayerInformationUid) || aInterfaceUid == TUid::Uid(KRemConMediaBrowseApiUid), AVRCP_PANIC(EResponseForWrongInterface)); - THashMapIter commandIter(iCommands); - - CInternalCommand* command = NULL; - while(commandIter.NextValue()) - { - command = *commandIter.CurrentValue(); - if(command->RemConCommandId() == aTransactionId) - { - aFoundClientId = *commandIter.CurrentKey(); - break; - } - } - - // If command is NULL we reached the end of our iter without finding the match - __ASSERT_DEBUG(command, AVRCP_PANIC(EUnmatchedResponseFromRemCon)); - - return *command; - } - -TInt CPlayerWatcherBase::SendRemConResponse(TUid aInterfaceUid, TUint aTransactionId, RBuf8& aData) - { - LOG_FUNC; - - TRemConClientId clientId; - CInternalCommand& command = FindCommand(aInterfaceUid, aTransactionId, clientId); - - ReceiveUpdate(command, clientId, aData); - - return KErrNone; - } - -void CPlayerWatcherBase::SendReject(TUid aInterfaceUid, TUint aTransactionId) - { - TRemConClientId clientId; - (void)FindCommand(aInterfaceUid, aTransactionId, clientId); - - ReceiveReject(clientId); - } - -void CPlayerWatcherBase::Disconnect() - { - LOG_FUNC; - } - -CPlayStatusWatcher* CPlayStatusWatcher::NewL(MPlayStatusObserver& aObserver, MRemConCommandInterface& aCommandInterface) - { - LOG_STATIC_FUNC; - CPlayStatusWatcher* watcher = new(ELeave)CPlayStatusWatcher(aObserver, aCommandInterface); - return watcher; - } - -CPlayStatusWatcher::CPlayStatusWatcher(MPlayStatusObserver& aObserver, - MRemConCommandInterface& aCommandInterface) - : CPlayerWatcherBase(aCommandInterface), iObserver(aObserver) - { - LOG_FUNC; - } - -CPlayStatusWatcher::~CPlayStatusWatcher() - { - LOG_FUNC; - } - -void CPlayStatusWatcher::StartWatchingPlayerL(TRemConClientId aClientId) - { - LOG_FUNC; - __ASSERT_DEBUG(!iCommands.Find(aClientId), AVRCP_PANIC(EAlreadyWatchingPlayer)); - - CInternalCommand* command = CInternalCommand::NewL(TUid::Uid(KRemConPlayerInformationUid), - 0, - EGetPlayStatusUpdate, - KNullDesC8); - - CleanupStack::PushL(command); - iCommands.InsertL(aClientId, command); - CleanupStack::Pop(command); - command->IncrementUsers(); - - // Initially request uid notification relative to stopped - SendPlayStatusUpdateRequest(*command, aClientId, MPlayerEventsObserver::EStopped); - } - -void CPlayStatusWatcher::SendPlayStatusUpdateRequest(CInternalCommand& aCommand, TRemConClientId& aClientId, MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus) - { - LOG_FUNC; - - RRemConPlayerInformationGetPlayStatusUpdateRequest request; - request.iStatus = aPlaybackStatus; - - TBuf8 buf; - TRAPD(err, request.WriteL(buf)); - - // We know how big the request is so this should never fail - __ASSERT_DEBUG(err == KErrNone, AVRCP_PANIC(EUidUpdateRequestWriteFailure)); - - TUint transId = iCommandInterface.MrcciNewTransactionId(); - TRAP(err, aCommand.ResetL(transId, buf)); - - if(err == KErrNone) - { - iCommandInterface.MrcciNewCommand(aCommand, aClientId); - } - else - { - // Doom - iObserver.MpsoError(aClientId); - } - } - -void CPlayStatusWatcher::ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData) - { - LOG_FUNC; - - // Read 4 byte Big-Endian error code before the payload - RAvrcpIPCError errorResponse; - TRAPD(err, errorResponse.ReadL(aData)); - err = err ? err : errorResponse.iError; - - RRemConPlayerInformationGetPlayStatusUpdateResponse response; - if(!err) - { - // Parse the rest of the response (minus error code) - TRAP(err, response.ReadL(aData.RightTPtr(aData.Length() - KLengthErrorResponse))); - } - - aData.Close(); // data has been used now - - if(!err) - { - iObserver.MpsoPlayStatusChanged(aClientId, response.iStatus); - SendPlayStatusUpdateRequest(aCommand, aClientId, response.iStatus); - } - else - { - // Should never get here with a valid player. This client is - // sending us junk. - iObserver.MpsoError(aClientId); - } - } - -void CPlayStatusWatcher::ReceiveReject(TRemConClientId aClientId) - { - LOG_FUNC; - iObserver.MpsoError(aClientId); - } - -CUidWatcher* CUidWatcher::NewL(MUidObserver& aObserver, - MRemConCommandInterface& aCommandInterface) - { - LOG_STATIC_FUNC; - CUidWatcher* watcher = new(ELeave)CUidWatcher(aObserver, aCommandInterface); - return watcher; - } - -CUidWatcher::CUidWatcher(MUidObserver& aObserver, - MRemConCommandInterface& aCommandInterface) - : CPlayerWatcherBase(aCommandInterface), iObserver(aObserver) - { - LOG_FUNC; - } - -CUidWatcher::~CUidWatcher() - { - LOG_FUNC; - } - -void CUidWatcher::StartWatchingPlayerL(TRemConClientId aClientId) - { - LOG_FUNC; - __ASSERT_DEBUG(!iCommands.Find(aClientId), AVRCP_PANIC(EAlreadyWatchingPlayer)); - - CInternalCommand* command = CInternalCommand::NewL(TUid::Uid(KRemConMediaBrowseApiUid), - 0, - EMediaLibraryStateCookieUpdateOperationId, - KNullDesC8); - - CleanupStack::PushL(command); - iCommands.InsertL(aClientId, command); - CleanupStack::Pop(command); - command->IncrementUsers(); - - // Initially request uid notification relative to 0 uid counter - SendUidUpdateRequest(*command, aClientId, 0); - } - -void CUidWatcher::SendUidUpdateRequest(CInternalCommand& aCommand, TRemConClientId& aClientId, TUint16 aUidCounter) - { - LOG_FUNC; - RRemConUidsChangedRequest request; - request.iInitialUidCounter = aUidCounter; - TBuf8 buf; - TRAPD(err, request.WriteL(buf)); - // We know how big the request is so this should never fail - __ASSERT_DEBUG(err == KErrNone, AVRCP_PANIC(EUidUpdateRequestWriteFailure)); - - TUint transId = iCommandInterface.MrcciNewTransactionId(); - TRAP(err, aCommand.ResetL(transId, buf)); - - if(err == KErrNone) - { - iCommandInterface.MrcciNewCommand(aCommand, aClientId); - } - else - { - // Doom - iObserver.MuoError(aClientId); - } - } - -void CUidWatcher::ReceiveUpdate(CInternalCommand& aCommand, TRemConClientId aClientId, RBuf8& aData) - { - LOG_FUNC; - RRemConUidsChangedResponse response; - TRAPD(err, response.ReadL(aData)); - aData.Close(); // data has been used now - - if(!err) - { - iObserver.MuoUidChanged(aClientId, response.iUidCounter); - SendUidUpdateRequest(aCommand, aClientId, response.iUidCounter); - } - else - { - // Should never get here with a valid player. This client is - // sending us junk. - iObserver.MuoError(aClientId); - } - } - -void CUidWatcher::ReceiveReject(TRemConClientId aClientId) - { - LOG_FUNC; - iObserver.MuoError(aClientId); - } - - - diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp --- a/bluetoothappprofiles/avrcp/remconbeareravrcp/src/remconbeareravrcp.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1221 +0,0 @@ -// Copyright (c) 2004-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: -// - - - -/** - @file - @internalComponent - @released -*/ - -#include -#include -#include -#include -#include -#include -#include "controlcommand.h" -#include "browsecommand.h" -#include "avrcpbrowsingcommandhandler.h" -#include "avrcpincomingcommandhandler.h" -#include "avrcpoutgoingcommandhandler.h" -#include "avrcpremotedevice.h" -#include "avrcprouter.h" -#include "avrcputils.h" -#include "avrcpplayerinfomanager.h" -#include "bulkbearer.h" -#include "controlbearer.h" -#include "mediabrowse.h" -#include "nowplaying.h" - -#include "avrcplog.h" - - - -/** Allocates and constructs a new CRemConBearerAvrcp object. - -@param aParams Bearer construction params used for base class construction. -@return A new CRemConBearerAvrcp object. -@leave System wide error code -*/ -CRemConBearerAvrcp* CRemConBearerAvrcp::NewL(TBearerParams& aParams) - { - LOG_STATIC_FUNC - CRemConBearerAvrcp* bearer = new(ELeave) CRemConBearerAvrcp(aParams); - CleanupStack::PushL(bearer); - - TRAPD(err, bearer->ConstructL()); - - if(err == KErrNoMemory) - { - User::Leave(err); - } - // else KErrNone or some other error -- swallow it. - - CleanupStack::Pop(bearer); - return bearer; - } - -/** Constructor. - -@param aParams Bearer construction params used for base class construction. -*/ -CRemConBearerAvrcp::CRemConBearerAvrcp(TBearerParams& aParams) : - CRemConBearerPlugin(aParams), iRemotes(_FOFF(CRcpRemoteDevice, iLink)), - iReadyCommands(_FOFF(CAvrcpCommand, iReadyLink)), iReadyResponses(_FOFF(CAvrcpCommand, iReadyLink)), - iReadyNotifyResponses(_FOFF(CControlCommand, iReadyLink)), - iReadyNotifyCommands(_FOFF(CAvrcpCommand, iReadyLink)) - { - LOG_FUNC - } - -/** Second phase construction. - -@leave System wide error code -*/ -void CRemConBearerAvrcp::ConstructL() - { - LOG_FUNC - - // Set-up TLS - LEAVEIFERRORL(Dll::SetTls(reinterpret_cast(EControlThread))); - - // New up a router. This opens and uses the RAvctp. - // On initialisation it should begin listening. - iRouter = CControlRouter::NewL(iAvctp, *this); - iTimer = CDeltaTimer::NewL(CActive::EPriorityStandard); - iPlayerInfoManager = CAvrcpPlayerInfoManager::NewL(Observer(), *this); - iInternalHandler = &iPlayerInfoManager->InternalCommandHandler(); - - // Create the bulk bearer - actual usage occurs in the bulk thread. - iBulkBearer = CAvrcpBulkBearer::NewL(iAvctp, *iPlayerInfoManager); - iConstructionComplete = ETrue; - } - -/** Destructor. -*/ -CRemConBearerAvrcp::~CRemConBearerAvrcp() - { - LOG_FUNC - - while (!iRemotes.IsEmpty()) - { - CRcpRemoteDevice* remote = iRemotes.First(); - remote->iLink.Deque(); - remote->Disconnect(EFalse); - delete remote; - } - - delete iRouter; - - delete iBulkBearer; - - // Delete the timer last as pending events - // are cancelled in remote->Disconnect - - delete iTimer; - - delete iPlayerInfoManager; - - Dll::FreeTls(); - } - -//--------------------------------------------------------------------- -// RemConBearer control functions -//--------------------------------------------------------------------- - -/** Called by RemCon to retrieve a response on a connection. - -This must only be called as a result of a NewResponse upcall. - -@param aInterfaceUid The UID of the outer-layer client API specifying the response. -@param aId The command identifier used as a cookie for command/response matching. -@param aOperationId The ID of the response operation in the outer-layer client API. -@param aData API-specific message data. On success, ownership is returned. -@param aAddr The connection. -*/ -TInt CRemConBearerAvrcp::GetResponse(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr) - { - LOG_FUNC - - // If object only partially constructed, swallow the request - __ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpNoResponsesAvailable)); - - - TInt result = KErrNotFound; - - if(!iReadyResponses.IsEmpty()) - { - CAvrcpCommand* command = iReadyResponses.First(); - TBTDevAddr btAddr; - command->GetCommandInfo(aInterfaceUid, aId, aOperationId, aCommandData, btAddr); - AvrcpUtils::BTToRemConAddr(btAddr, aAddr); - - // Remove command from queue first because calling - // DecrementUsers() may delete command - command->iReadyLink.Deque(); - command->DecrementUsers(); - result = KErrNone; - } - else - { - // RemCon is trying to pick up a response we don't think we have - __ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpNoResponsesAvailable)); - } - - return result; - } - -/** Called by RemCon to retrieve a response on a connection. - -This must only be called as a result of a NewResponse upcall. - -@param aInterfaceUid The UID of the outer-layer client API specifying the response. -@param aId The command identifier used as a cookie for command/response matching. -@param aOperationId The ID of the response operation in the outer-layer client API. -@param aData API-specific message data. On success, ownership is returned. -@param aAddr The connection. -*/ -TInt CRemConBearerAvrcp::GetNotifyResponse(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr, - TRemConMessageSubType& aSubMessageType) - { - LOG_FUNC - - // If object only partially constructed, swallow the request - __ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpNoResponsesAvailable)); - - - TInt result = KErrNotFound; - - if(!iReadyNotifyResponses.IsEmpty()) - { - CControlCommand* command = iReadyNotifyResponses.First(); - TBTDevAddr btAddr; - command->GetCommandInfo(aInterfaceUid, aId, aOperationId, aCommandData, btAddr); - AvrcpUtils::BTToRemConAddr(btAddr, aAddr); - - switch ( command->Frame().Type() ) - { - case AVC::EInterim: - aSubMessageType = ERemConNotifyResponseInterim; - break; - case AVC::EChanged: - aSubMessageType = ERemConNotifyResponseChanged; - break; - case AVC::ERejected: // fall into default - case AVC::ENotImplemented:// fall into default - default: - aSubMessageType = ERemConMessageDefault; - break; - } - - // Remove command from queue first because calling - // DecrementUsers() may delete command - command->iReadyLink.Deque(); - command->DecrementUsers(); - result = KErrNone; - } - else - { - // RemCon is trying to pick up a response we don't think we have - __ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpNoResponsesAvailable)); - } - - return result; - } - -/** Called by RemCon to send a command on a connection. - -@param aInterfaceUid The UID of the outer-layer client API specifying the command. -@param aOperationId The ID of the command operation in the outer-layer client API. -@param aId The command identifier used as a cookie for command/response matching. -@param aData API-specific message data. On success, ownership is passed. -@param aAddr The connection. -@return Error. This request is synchronous. It returns KErrNone when AVRCP has -taken responsibility for sending the message. This involves checking that the message -is well-formed and adding it to the send queue. -*/ -TInt CRemConBearerAvrcp::SendCommand(TUid aInterfaceUid, - TUint aOperationId, - TUint aId, - RBuf8& aData, - const TRemConAddress& aAddr) - { - LOG_FUNC - // RemCon retains ownership of the data in aData until - // this function returns KErrNone. - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return KErrNotSupported; - } - - - TBTDevAddr btAddr; - TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr); - - if(err == KErrNone) - { - CRcpRemoteDevice* remote = RemoteDevice(btAddr); - __ASSERT_ALWAYS(remote, AVRCP_PANIC(EAvrcpNotConnected)); - - TRAP(err, remote->OutgoingHandler().SendCommandL(aInterfaceUid, - aOperationId, - aId, - aData, - btAddr)); - } - - return err; - } - - -/** Called by RemCon to retrieve a command on a connection. - -This must only be called as a result of a NewCommand upcall. - -@param aInterfaceUid The UID of the outer-layer client API specifying the command. -@param aId The command identifier used as a cookie for command/response matching. -@param aOperationId The ID of the command operation in the outer-layer client API. -@param aData API-specific message data. On success, ownership is returned. -@param aAddr The connection. -*/ -TInt CRemConBearerAvrcp::GetCommand(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr) - { - TInt result = KErrNotFound; - - if(!iReadyCommands.IsEmpty()) - { - CAvrcpCommand* command = GetFirstCommand(iReadyCommands, aInterfaceUid, aId, aOperationId, aCommandData, aAddr); - if(command) - { - // Remove command from queue first because calling - // DecrementUsers() may delete command - command->iReadyLink.Deque(); - command->DecrementUsers(); - result = KErrNone; - } - } - else - { - __DEBUGGER(); - } - - return result; - } - -/** Called by RemCon to retrieve a notify command on a connection. - -This must only be called as a result of a NewNotifyCommand upcall. - -@param aInterfaceUid The UID of the outer-layer client API specifying the command. -@param aId The command identifier used as a cookie for command/response matching. -@param aOperationId The ID of the command operation in the outer-layer client API. -@param aData API-specific message data. On success, ownership is returned. -@param aAddr The connection. -*/ -TInt CRemConBearerAvrcp::GetNotifyCommand(TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr) - { - TInt result = KErrNotFound; - - CAvrcpCommand* command = GetFirstCommand(iReadyNotifyCommands, aInterfaceUid, aId, aOperationId, aCommandData, aAddr); - if(command) - { - // Remove command from queue first because calling - // DecrementUsers() may delete command - command->iReadyLink.Deque(); - command->DecrementUsers(); - result = KErrNone; - } - - return result; - } - -/** -Internal method, called by GetCommand() and GetNotifyCommand() - -@return The first command from the Queue. NULL if the queue is empty. The command remains - on the queue. -*/ -CAvrcpCommand* CRemConBearerAvrcp::GetFirstCommand(TDblQue& aQue, TUid& aInterfaceUid, - TUint& aId, - TUint& aOperationId, - RBuf8& aCommandData, - TRemConAddress& aAddr) - { - LOG_FUNC - - // If object only partially constructed, swallow the request - __ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpNoResponsesAvailable)); - - CAvrcpCommand* command = NULL; - - if(! aQue.IsEmpty()) - { - command = aQue.First(); - - // Calling GetCommandInfo transfers the command data to RemCon. This means - // once we have called it we are committed to returning KErrNone. - TBTDevAddr btAddr; - command->GetCommandInfo(aInterfaceUid, aId, aOperationId, aCommandData, btAddr); - AvrcpUtils::BTToRemConAddr(btAddr, aAddr); - } - else - { - // RemCon is trying to pick up a command we don't think we have - __ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpNoResponsesAvailable)); - } - - return command; - } -/** Called by RemCon to send a response on a connection. - -@param aInterfaceUid The UID of the outer-layer client API specifying the response. -@param aOperationId The ID of the response operation in the outer-layer client API. -@param aId The command identifier used as a cookie for command/response matching -@param aData API-specific message data. On success, ownership is passed. -@param aAddr The connection. -@return Error. This request is synchronous. It is completed by AVRCP when it has -taken responsibility for sending the message. This involves checking that the message -is well-formed and adding it to the send queue. -*/ -TInt CRemConBearerAvrcp::SendResponse(TUid aInterfaceUid, - TUint /*aOperationId*/, - TUint aId, - RBuf8& aData, - const TRemConAddress& aAddr) - { - LOG_FUNC - // RemCon retains ownership of the data in aData until - // this function returns KErrNone. - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return KErrNotSupported; - } - - - TBTDevAddr btAddr; - TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr); - __ASSERT_DEBUG(err == KErrNone, AVRCP_PANIC(EInvalidBtAddrInResponse)); - - if(btAddr != TBTDevAddr(0)) - { - CRcpRemoteDevice* remote = RemoteDevice(btAddr); - __ASSERT_ALWAYS(remote, AVRCP_PANIC(EAvrcpNotConnected)); - - err = remote->IncomingHandler().SendRemConResponse(aInterfaceUid, aId, aData); - } - else - { - err = iInternalHandler->SendRemConResponse(aInterfaceUid, aId, aData); - } - - return err; - } - -/** Called by RemCon when either - a) The TSP does not address a command to any clients - b) The TSP does not permit the response from any commands - c) All the clients disconnect from remcon before the response is sent - to send a null response on a connection. The connection must already - exist - @param aInterfaceUid The UID of the outer-layer client API that the command - was sent to - @param aOperationId The ID of the command operation sent to remcon - @param aId The command identifier used as a cookie for command/response - matching. - @param aAddr The connection. - */ - -void CRemConBearerAvrcp::SendReject(TUid aInterfaceUid, - TUint /* aOperationId */, - TUint aTransactionId, - const TRemConAddress& aAddr) - { - LOG_FUNC - - __ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpNotFullyConstructed)); - - TBTDevAddr btAddr; - __DEBUG_ONLY(TInt err = )AvrcpUtils::RemConToBTAddr(aAddr, btAddr); - __ASSERT_DEBUG(err == KErrNone, AVRCP_PANIC(EInvalidBtAddrInResponse)); - - if(btAddr != TBTDevAddr(0)) - { - CRcpRemoteDevice* remote = RemoteDevice(btAddr); - __ASSERT_ALWAYS(remote, AVRCP_PANIC(EAvrcpNotConnected)); - - remote->IncomingHandler().SendReject(aInterfaceUid, aTransactionId); - } - else - { - iInternalHandler->SendReject(aInterfaceUid, aTransactionId); - } - - } - -/** Called by RemCon to establish a bearer-level connection to another party. - -Completion is signalled back in ConnectConfirm. - -@param aAddr The RemCon address to connect to. -*/ -void CRemConBearerAvrcp::ConnectRequest(const TRemConAddress& aAddr) - { - LOG_FUNC - - if (!iConstructionComplete) - { - // Object only partially constructed, error the request - Observer().ConnectConfirm(aAddr, KErrNotSupported); - return; - } - - - // Get a bluetooth address from the TRemConAddr - TBTDevAddr btAddr; - TInt convErr = AvrcpUtils::RemConToBTAddr(aAddr, btAddr); - if(convErr != KErrNone) - { - Observer().ConnectConfirm(aAddr, convErr); - return; - } - - // Address for internal commands - if(btAddr == TBTDevAddr(0)) - { - Observer().ConnectConfirm(aAddr, KErrNone); - return; - } - - CRcpRemoteDevice* remote = RemoteDevice(btAddr); - if(remote) - { - // Already have a connection to this address - Observer().ConnectConfirm(aAddr, KErrNone); - return; - } - - TRAPD(devErr, remote = CRcpRemoteDevice::NewL(btAddr, *iRouter, *this, Observer(), *iTimer, *iPlayerInfoManager)); - if(devErr) - { - Observer().ConnectConfirm(aAddr, devErr); - return; - } - - iRemotes.AddLast(*remote); - devErr = iRouter->ConnectRequest(btAddr); - if(devErr != KErrNone) - { - remote->iLink.Deque(); - delete remote; - - // Error with connect, generate errored ConnectConfirm. - Observer().ConnectConfirm(aAddr, devErr); - return; - } - - return; - } - -/** Called by RemCon to destroy a bearer-level connection to another party. - -Completion is signalled back in DisconnectConfirm. - -@param aAddr The RemCon address to disconnect from. -*/ -void CRemConBearerAvrcp::DisconnectRequest(const TRemConAddress& aAddr) - { - LOG_FUNC - - __ASSERT_DEBUG(iConstructionComplete, AVRCP_PANIC(EAvrcpDisconnectRequestWhilePartiallyConstructed)); - - TBTDevAddr btAddr; - TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr); - - if(!err) - { - // Address for internal commands - if(btAddr == TBTDevAddr(0)) - { - Observer().DisconnectConfirm(aAddr, KErrNone); - } - else - { - CRcpRemoteDevice *remote = RemoteDevice(btAddr); - if(remote) - { - // calling disconnect gives the remote the opportunity - // to do anything necessary to commands still on its - // queue before we delete it. - remote->Disconnect(ETrue); - remote->iLink.Deque(); - delete remote; - - err = iRouter->DisconnectRequest(btAddr); - // If this failed generate an errored DisconnectConfirm now, - // otherwise we'll be prodded with a DisconnectConfirm from - // the router at a later date. - if(err != KErrNone) - { - Observer().DisconnectConfirm(aAddr, err); - } - } - else - { - __ASSERT_DEBUG(EFalse, AVRCP_PANIC(EAvrcpMismatchedConnectDisconnect)); - Observer().DisconnectConfirm(aAddr, KErrNotFound); - } - } - } - else - { - Observer().DisconnectConfirm(aAddr, err); - } - } - -/** Called by RemCon to get the security policy. - -This is the list of capabilities required to make/destroy connections -over the bearer, and to send and receive messages over the bearer. - -@return The bearer's security policy. -*/ -TSecurityPolicy CRemConBearerAvrcp::SecurityPolicy() const - { - LOG_FUNC - return TSecurityPolicy(ECapabilityLocalServices); - } - -/** Called by RemCon when either (a) the number of controller clients changes -from 0 to 1 or from 1 to 0, or (b) the number of target clients changes -from 0 to 1 or from 1 to 0. - -@param aControllerPresent Whether there are any controller clients connected. -@param aTargetPresent Whether there are any target clients connected. -*/ -void CRemConBearerAvrcp::ClientStatus(TBool aControllerPresent, TBool aTargetPresent) - { - LOG_FUNC - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return; - } - - iPlayerInfoManager->ClientStatus(aControllerPresent, aTargetPresent); - } - -/** -Called by RemCon when a client has become available for addressing. Once this -call has been made the bearer may use the provided TRemConClientId to address -incoming commands and notifys to this client until RemCon calls ClientNotAvailable -with this TRemConClientId. - -@param aId A unique identifier for this client, that can be used when addressing -incoming commands. -@param aClientType The basic type of this client -@param aClientSubType More detailed type information on this client -@param aName The name of this client in UTF-8. -*/ -void CRemConBearerAvrcp::ClientAvailable(TRemConClientId& aId, TPlayerType aClientType, TPlayerSubType aClientSubType, const TDesC8& aName) - { - LOG_FUNC - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return; - } - - iPlayerInfoManager->ClientAvailable(aId, aClientType, aClientSubType, aName); - } - -/** -Called by RemCon when a client is no longer available for addressing. Once this -call has been made the bearer shall not use this client id when addressing incoming -commands and notifys until informed that the client is available again via -ClientAvailable. - -@param aId The client that has ceased to be available. -*/ -void CRemConBearerAvrcp::ClientNotAvailable(TRemConClientId& aId) - { - LOG_FUNC - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return; - } - - iPlayerInfoManager->ClientNotAvailable(aId); - } - -TInt CRemConBearerAvrcp::SetLocalAddressedClient(TRemConClientId& aId) - { - LOG_FUNC - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return KErrNotSupported; - } - - return iPlayerInfoManager->SetLocalAddressedClient(aId); - } - -void CRemConBearerAvrcp::TargetFeaturesUpdated(const TRemConClientId& aId, TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aName) - { - LOG_FUNC - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return; - } - - iPlayerInfoManager->TargetFeaturesUpdated(aId, aPlayerType, aPlayerSubType, aName); - } - -void CRemConBearerAvrcp::ControllerFeaturesUpdated(RArray& aSupportedInterfaces) - { - LOG_FUNC - - if(!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return; - } - - // This is a best effort attempt at keeping the sdp record accurate. If we - // failed to update it then just live with it. - TRAP_IGNORE(iPlayerInfoManager->ControllerFeaturesUpdatedL(aSupportedInterfaces)); - } - -//--------------------------------------------------------------------- -// Data notifications from the command handlers -//--------------------------------------------------------------------- - -/** Called from incoming handlers to notify that a command -is ready for Remcon. - -@param aCommand The command that is ready. -*/ -void CRemConBearerAvrcp::MrcciNewCommand(CAvrcpCommand& aCommand) - { - LOG_FUNC - - // Need to put the command on the queue straight - // away in case RemCon collects it synchronously - iReadyCommands.AddLast(aCommand); - aCommand.IncrementUsers(); - - TRemConAddress remAddr; - AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr); - - // Unaddressed variant - TInt err = Observer().NewCommand(remAddr); - - if(err != KErrNone) - { - HandleUndeliveredCommand(aCommand, remAddr); - } - } - -/** Called from incoming handlers to notify that a command -is ready for Remcon. - -@param aCommand The command that is ready. -*/ -void CRemConBearerAvrcp::MrcciNewCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId) - { - LOG_FUNC - - // Need to put the command on the queue straight - // away in case RemCon collects it synchronously - iReadyCommands.AddLast(aCommand); - aCommand.IncrementUsers(); - - TRemConAddress remAddr; - AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr); - - // if this is the null client id then RemCon will address it - TInt err = Observer().NewCommand(remAddr, aClientId); - - if(err != KErrNone) - { - HandleUndeliveredCommand(aCommand, remAddr); - } - } - -/** Called from incoming handlers to notify that a notify command -is ready for Remcon. - -@param aCommand The command that is ready. -*/ -void CRemConBearerAvrcp::MrccciNewNotifyCommand(CAvrcpCommand& aCommand) - { - LOG_FUNC - - // Need to put the command on the queue straight - // away in case RemCon collects it synchronously - iReadyNotifyCommands.AddLast(aCommand); - aCommand.IncrementUsers(); - - TRemConAddress remAddr; - AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr); - - // Will be addressed by RemCon - TInt err = Observer().NewNotifyCommand(remAddr); - - if(err != KErrNone) - { - HandleUndeliveredCommand(aCommand, remAddr); - } - } - -/** Called from incoming handlers to notify that a notify command -is ready for Remcon. - -@param aCommand The command that is ready. -*/ -void CRemConBearerAvrcp::MrccciNewNotifyCommand(CAvrcpCommand& aCommand, const TRemConClientId& aClientId) - { - LOG_FUNC - - // Need to put the command on the queue straight - // away in case RemCon collects it synchronously - iReadyNotifyCommands.AddLast(aCommand); - aCommand.IncrementUsers(); - - TRemConAddress remAddr; - AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr); - - // if this is the null client id then RemCon will address it - TInt err = Observer().NewNotifyCommand(remAddr, aClientId); - - if(err != KErrNone) - { - HandleUndeliveredCommand(aCommand, remAddr); - } - } - - -/** Called from outgoing handlers to notify that a response -is ready for RemCon. - -@param aCommand The response that is ready. -*/ -void CRemConBearerAvrcp::MrccciNewResponse(CAvrcpCommand& aCommand) - { - LOG_FUNC - - // Need to put the response on the queue straight - // away in case RemCon collects it synchronously - iReadyResponses.AddLast(aCommand); - aCommand.IncrementUsers(); - - TRemConAddress remAddr; - AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr); - TInt err = Observer().NewResponse(remAddr); - - if(err != KErrNone) - { - // RemCon is not going to pick this response up - aCommand.iReadyLink.Deque(); - aCommand.DecrementUsers(); - } - } - -/** Get a new transaction id for an incoming command. - -@return The new command id. -*/ -TUint CRemConBearerAvrcp::MrcciNewTransactionId() - { - LOG_FUNC - return Observer().NewTransactionId(); - } - -void CRemConBearerAvrcp::MrcciCommandExpired(TUint aTransactionId) - { - LOG_FUNC - Observer().CommandExpired(aTransactionId); - } - -void CRemConBearerAvrcp::MrccciSetAddressedClient(const TRemConClientId& aClientId) - { - LOG_FUNC - Observer().SetRemoteAddressedClient(TUid::Uid(KRemConBearerAvrcpImplementationUid), aClientId); - } - -void CRemConBearerAvrcp::MrccciRegisterForLocalAddressedClientUpdates() - { - // Addressed player observers are registered with RemCon on a per-bearer basis - // so we aggregate interest from remote here - iRemotesInterestedInLocalAddressedClient++; - if(iRemotesInterestedInLocalAddressedClient == 1) - { - // Weren't any registered before, tell RemCon we care - Observer().RegisterLocalAddressedClientObserver(TUid::Uid(KRemConBearerAvrcpImplementationUid)); - } - -#ifdef __DEBUG - TInt numRemotes = 0; - CRcpRemoteDevice* remote = NULL; - - TDblQueIter iter(iRemotes); - while (iter++) - { - numRemotes++; - } - __ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient <= numRemotes, AVRCP_PANIC(ETooManyRemotesRegisterForLocalAddressedPlayerUpdates)); -#endif - } - -void CRemConBearerAvrcp::MrccciUnregisterForLocalAddressedClientUpdates() - { -#ifdef __DEBUG - TInt numRemotes = 0; - CRcpRemoteDevice* remote = NULL; - - TDblQueIter iter(iRemotes); - while (iter++) - { - numRemotes++; - } - __ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient <= numRemotes, AVRCP_PANIC(ETooManyRemotesRegisterForLocalAddressedPlayerUpdates)); - __ASSERT_DEBUG(iRemotesInterestedInLocalAddressedClient > 0, AVRCP_PANIC(ETooFewRemotesRegisterForLocalAddressedPlayerUpdates)); -#endif - - iRemotesInterestedInLocalAddressedClient--; - if(iRemotesInterestedInLocalAddressedClient == 0) - { - // No-one left who cares. Tell RemCon not to bother updating - // us anymore. - Observer().UnregisterLocalAddressedClientObserver(TUid::Uid(KRemConBearerAvrcpImplementationUid)); - } - } - -/** Called from outgoing handlers to notify that a response -for a notify command is ready for RemCon. - -@param aCommand The response that is ready. -*/ -void CRemConBearerAvrcp::MrccciNewNotifyResponse(CControlCommand& aCommand) - { - LOG_FUNC - - // Need to put the response on the queue straight - // away in case RemCon collects it synchronously - iReadyNotifyResponses.AddLast(aCommand); - aCommand.IncrementUsers(); - - TRemConAddress remAddr; - AvrcpUtils::BTToRemConAddr(aCommand.RemoteAddress(), remAddr); - TInt err = Observer().NewNotifyResponse(remAddr); - - if(err != KErrNone) - { - // RemCon is not going to pick this response up - aCommand.iReadyLink.Deque(); - aCommand.DecrementUsers(); - } - } - -/** Called by RemCon to send a notify command on a connection. - -@param aInterfaceUid The UID of the outer-layer client API specifying the command. -@param aOperationId The ID of the command operation in the outer-layer client API. -@param aId The command identifier used as a cookie for command/response matching, the transaction ID. -@param aData API-specific message data. On success, ownership is passed. -@param aAddr The connection. -@return Error. This request is synchronous. It returns KErrNone when AVRCP has -taken responsibility for sending the message. This involves checking that the message -is well-formed and adding it to the send queue. -*/ -TInt CRemConBearerAvrcp::SendNotifyCommand(TUid aInterfaceUid, - TUint aOperationId, - TUint aId, - RBuf8& aData, - const TRemConAddress& aAddr) - { - LOG_FUNC - // RemCon retains ownership of the data in aData until - // this function returns KErrNone. - - if (!iConstructionComplete) - { - // Object only partially constructed, swallow the request - return KErrNotSupported; - } - - - TBTDevAddr btAddr; - TInt err = AvrcpUtils::RemConToBTAddr(aAddr, btAddr); - - if(err == KErrNone) - { - CRcpRemoteDevice* remote = RemoteDevice(btAddr); - __ASSERT_ALWAYS(remote, AVRCP_PANIC(EAvrcpNotConnected)); - - TRAP(err, remote->OutgoingHandler().SendNotifyCommandL(aInterfaceUid, - aOperationId, - aId, - aData, - btAddr)); - } - - return err; - } - -//--------------------------------------------------------------------- -// Control notifications from the router -//--------------------------------------------------------------------- - -/** Called when a connection comes in from a remote. - -@param aBTDevice The address of the device initiating the connection. -*/ -void CRemConBearerAvrcp::ConnectIndicate(const TBTDevAddr& aBTDevice) - { - LOG_FUNC - CRcpRemoteDevice *remote = NULL; - // We new up the device here even though we may end up deleting it - // later in the function because we need to know if we've successfully - // got a remote before we can tell RemCon. RemCon may optionally - // drop the connection in which case we delete remote straight away. - TRAPD(devErr, remote = CRcpRemoteDevice::NewL(aBTDevice, *iRouter, *this, Observer(), *iTimer, *iPlayerInfoManager)); - if(!devErr) - { - iRemotes.AddLast(*remote); - - TRemConAddress remoteAddr; - AvrcpUtils::BTToRemConAddr(aBTDevice, remoteAddr); - - TInt err = Observer().ConnectIndicate(remoteAddr); - if(err) - { - // We need to drop this connection. Disconnect and delete - // the remote NOW. When we get the disconnect confirm we - // will then know that we shouldn't tell RemCon. - remote->Disconnect(ETrue); - remote->iLink.Deque(); - delete remote; - - err = iRouter->DisconnectRequest(aBTDevice); - } - } - } - -/** Called to confirm an outgoing connection. - -@param aBTDevice The device the outgoing connection is to. -@param aError The result of the connection attempt. -*/ -void CRemConBearerAvrcp::ConnectConfirm(const TBTDevAddr& aBTDevice, TInt aError) - { - LOG_FUNC - TRemConAddress remoteAddr; - AvrcpUtils::BTToRemConAddr(aBTDevice, remoteAddr); - - if(aError != KErrNone) - { - CRcpRemoteDevice *remote = RemoteDevice(aBTDevice); - if(remote) - { - // calling disconnect gives the remote the opportunity - // to do anything necessary to commands still on its - // queue before we delete it. - remote->Disconnect(ETrue); - remote->iLink.Deque(); - delete remote; - } - } - - Observer().ConnectConfirm(remoteAddr, aError); - } - -/** Called when a remote disconnects. - -@param aBTDevice The address of the remote that has disconnected. -*/ -void CRemConBearerAvrcp::DisconnectIndicate(const TBTDevAddr& aBTDevice) - { - LOG_FUNC - TRemConAddress remoteAddr; - AvrcpUtils::BTToRemConAddr(aBTDevice, remoteAddr); - - CRcpRemoteDevice *remote = RemoteDevice(aBTDevice); - if(remote) - { - // calling disconnect gives the remote the opportunity - // to do anything necessary to commands still on its - // queue before we delete it. - remote->Disconnect(ETrue); - remote->iLink.Deque(); - delete remote; - } - - Observer().DisconnectIndicate(remoteAddr); - } - -/** Called to confirm a locally initiated disconnect. - -@param aBTDevice The address of the disconnected remote. -@param aError The result of the disconnect attempt. -*/ -void CRemConBearerAvrcp::DisconnectConfirm(const TBTDevAddr& aBTDevice, TInt aError) - { - LOG_FUNC - TRemConAddress remoteAddr; - AvrcpUtils::BTToRemConAddr(aBTDevice, remoteAddr); - - Observer().DisconnectConfirm(remoteAddr, aError); - } - -/** Called to get a bearer interface. - -@param aUid The uid of the desired interface. -@return An instance of the desired interface, NULL if - one could not be found. -*/ -TAny* CRemConBearerAvrcp::GetInterface(TUid aUid) - { - LOG_FUNC - - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConBearerInterface1) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - else if ( aUid == TUid::Uid(KRemConBearerInterface2) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - else if ( aUid == TUid::Uid(KRemConBearerInterface3) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - else if ( aUid == TUid::Uid(KRemConBearerBulkInterface1) ) - { - ret = reinterpret_cast( - static_cast(iBulkBearer) - ); - } - - return ret; - } - -//--------------------------------------------------------------------- -// Utility functions -//--------------------------------------------------------------------- - -MIncomingCommandHandler* CRemConBearerAvrcp::IncomingHandler(const TBTDevAddr& aAddr) - { - CRcpRemoteDevice* remote = RemoteDevice(aAddr); - if(remote) - { - return &remote->IncomingHandler(); - } - else - { - return NULL; - } - } - -MOutgoingCommandHandler* CRemConBearerAvrcp::OutgoingHandler(const TBTDevAddr& aAddr) - { - CRcpRemoteDevice* remote = RemoteDevice(aAddr); - if(remote) - { - return &remote->OutgoingHandler(); - } - else - { - return NULL; - } - } - -/** Utility function to get the CRcpRemoteDevice that -handles a given BT address. - -@param aAddr The address to get the CRcpRemoteDevice for. -@return A pointer to a remote device, or NULL if not found. -*/ -CRcpRemoteDevice* CRemConBearerAvrcp::RemoteDevice(const TBTDevAddr& aAddr) - { - LOG_FUNC - - CRcpRemoteDevice* remote = NULL; - - TDblQueIter iter(iRemotes); - while (iter) - { - remote = iter++; - if(remote->RemoteAddress() == aAddr) - { - break; - } - remote = NULL; - } - - return remote; - } - -void CRemConBearerAvrcp::HandleUndeliveredCommand(CAvrcpCommand& aCommand, const TRemConAddress& aAddr) - { - TUid interfaceUid; - TUint remconId, operationId; - RBuf8 commandData; - TBTDevAddr btAddr; - - // Calling GetCommandInfo transfers the command data to us. - aCommand.GetCommandInfo(interfaceUid, remconId, operationId, commandData, btAddr); - SendReject(interfaceUid, operationId, remconId, aAddr); - commandData.Close(); - - // RemCon is not going to pick this command up - aCommand.iReadyLink.Deque(); - aCommand.DecrementUsers(); - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusclient/bld.inf --- a/bluetoothappprofiles/avrcp/statusclient/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remconstatusapi.mmp - -PRJ_EXPORTS -remconstatusapicontroller.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconstatusapicontroller.h) -remconstatusapicontrollerobserver.h SYMBIAN_MW_LAYER_PUBLIC_EXPORT_PATH(remconstatusapicontrollerobserver.h) - -// -// End of file diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusclient/remconstatusapi.mmp --- a/bluetoothappprofiles/avrcp/statusclient/remconstatusapi.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -// Copyright (c) 2004-2009 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: -// remconstatusapi.dll Remote Control status API- an outer-layer client -// side library providing access to AV/C status commands. -// -// - -/** - @file - @internalComponent -*/ - -TARGET remconstatusapi.dll //Recommended unpaged -TARGETPATH /system/libs -// We need all these caps because we don't know anything about the process -// we'll be running in. -CAPABILITY All -Tcb -TARGETTYPE dll -// UID2 = 0x1000008d for static interface DLLs. -// UID3 = unique for RemCon system -UID 0x1000008d 0x10207ea5 -VENDORID 0x70000001 - -SOURCEPATH . -SOURCE statusapicontroller.cpp remconstatusapicontrollerobserver.cpp - -USERINCLUDE ../common -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -LIBRARY euser.lib -LIBRARY remconinterfacebase.lib - -#include - -// -// End of file - -SMPSAFE diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusclient/remconstatusapicontroller.h --- a/bluetoothappprofiles/avrcp/statusclient/remconstatusapicontroller.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONSTATUSAPICONTROLLER_H -#define REMCONSTATUSAPICONTROLLER_H - -#include -#include -#include - -_LIT(KStatusApiPanicName, "Status Api Panic"); - -class MRemConStatusApiControllerObserver; -class CRemConInterfaceSelector; - -/** -A controller which sends Status API commands. -@publishedAll -@released -*/ -NONSHARABLE_CLASS(CRemConStatusApiController) : public CRemConInterfaceBase, - public MRemConInterfaceIf - { -private: - enum TStatusApiPanic - { - EStatusApiCommandDataSectionTooLong, - }; - -public: - IMPORT_C static CRemConStatusApiController* NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConStatusApiControllerObserver& aObserver); - IMPORT_C ~CRemConStatusApiController(); - - // Commands - IMPORT_C void UnitInfo(TRequestStatus& aStatus, TUint& aNumRemotes); - IMPORT_C void SubunitInfo(TRequestStatus& aStatus, TUint& aNumRemotes); - -private: - CRemConStatusApiController(CRemConInterfaceSelector& aInterfaceSelector, - MRemConStatusApiControllerObserver& aObserver); - - // from CRemConInterfaceBase - void MrcibNewMessage(TUint aOperationId, const TDesC8& aData); - TAny* GetInterfaceIf(TUid aUid); - - // Utility functions - void SetUnitInfoResponseData(const TDesC8& aCommandData, - TInt& aVendorId, - TInt& aUnit, - TInt& aUnitType, - TInt& aExtendedUnitType); - - void SetSubunitInfoResponseData(const TDesC8& aCommandData, - TInt& aPage, - TInt& aExtension, - TPtrC8& aPageData); - - void ReadCommandDataToInt(const TDesC8& aCommandData, - TInt aOffset, - TInt aLength, - TInt& aValue); - - static void Panic(TStatusApiPanic aPanic); - -private: - MRemConStatusApiControllerObserver& iObserver; - RBuf8 iOutData; // There is no command data for any commands in this API - }; - -#endif // REMCONSTATUSAPICONTROLLER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusclient/remconstatusapicontrollerobserver.cpp --- a/bluetoothappprofiles/avrcp/statusclient/remconstatusapicontrollerobserver.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#include - -/** -This virtual function allows the M- class to be extended in future in a binary -compatible way by providing a method that clients can override in future to -allow extra callbacks to be made via aObject. -*/ -EXPORT_C void MRemConStatusApiControllerObserver::Mrcsaco_ExtensionInterfaceL(TUid /*aInterface*/, void*& aObject) - { - aObject = NULL; - } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusclient/remconstatusapicontrollerobserver.h --- a/bluetoothappprofiles/avrcp/statusclient/remconstatusapicontrollerobserver.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#ifndef REMCONSTATUSAPICONTROLLEROBSERVER_H -#define REMCONSTATUSAPICONTROLLEROBSERVER_H - -#include - -/** -Interface to observe responses from a Status API controller. -@publishedAll -@released -*/ -class MRemConStatusApiControllerObserver - { -public: - /** A UnitInfo response has been received. - - For details on the meanings on the fields please refer to the - AV/C Digital Interface Command Set General Specification, - section 11.2.1. - - If all values are zero there was an error with the command. - @param aVendorId The VendorId - @param aUnit Unit - @param aUnitType UnitType - @param aExtendedUnitType Extended Unit type. This data is only - valid if Unit type is 0x1e. The second byte is only valid - if the first byte is 0xff. - */ - virtual void MrcsacoUnitInfoResponse(TInt aVendorId, - TInt aUnit, - TInt aUnitType, - TInt aExtendedUnitType) = 0; - - /** A SubunitInfo response has been received. - - For details on the meanings on the fields please - refer to the AV/C Digital Interface Command Set - General Specification, section 11.2.2. - - If all values are zero there was an error with the command. - @param aPage Page - @param aExtension Extension. - @param aPageData Page Data. This data remains valid only for - the duration of this call. If the client wishes to store - the data it must be copied. - */ - virtual void MrcsacoSubunitInfoResponse(TInt aPage, - TInt aExtension, - TDesC8& aPageData) = 0; - - /** - Returns a null aObject if the extension is not implemented, or - a pointer to another interface if it is. - - @param aInterface UID of the interface to return - @param aObject the container for another interface as specified by aInterface - */ - IMPORT_C virtual void Mrcsaco_ExtensionInterfaceL(TUid aInterface, void*& aObject); - }; - -#endif // REMCONSTATUSAPICONTROLLEROBSERVER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusclient/statusapicontroller.cpp --- a/bluetoothappprofiles/avrcp/statusclient/statusapicontroller.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,259 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @publishedAll - @released -*/ - -#include -#include -#include -#include -#include "remconstatusapi.h" - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, LOG_COMPONENT_AVRCP_STATUS); -#endif - -/** Creates new Status Api Controller. - -@param aInterfaceSelector An interface selector for use with this interface. -@param aObserver An observer to be notified of responses to commands issued - to this interface. -@return A fully constructed CRemConStatusApiController -*/ -EXPORT_C CRemConStatusApiController* CRemConStatusApiController::NewL(CRemConInterfaceSelector& aInterfaceSelector, - MRemConStatusApiControllerObserver& aObserver) - { - LOG_STATIC_FUNC - - CRemConStatusApiController* self = new(ELeave) CRemConStatusApiController(aInterfaceSelector, aObserver); - CleanupStack::PushL(self); - self->BaseConstructL(); - CleanupStack::Pop(self); - return self; - } - -/** Constructs this interface. - -@param aInterfaceSelector An interface selector for use with this interface. -@param aObserver An observer to be notified of responses to commands issued - to this interface. -@internalComponent -@released -*/ -CRemConStatusApiController::CRemConStatusApiController(CRemConInterfaceSelector& aInterfaceSelector, - MRemConStatusApiControllerObserver& aObserver) -: CRemConInterfaceBase(TUid::Uid(KRemConStatusApiUid), - KRemConStatusApiMaxOperationSpecificDataSize, - aInterfaceSelector, - ERemConClientTypeController), - iObserver(aObserver) - { - iOutData.Assign(NULL); - } - -/** Destructor. -*/ -EXPORT_C CRemConStatusApiController::~CRemConStatusApiController() - { - } - -/** Gets a pointer to a specific interface version. - -@return A pointer to the interface, NULL if not supported. -@internalComponent -@released -*/ -TAny* CRemConStatusApiController::GetInterfaceIf(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConInterfaceIf1) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -/** New message from RemCon. - -@internalComponent -@released -*/ -void CRemConStatusApiController::MrcibNewMessage(TUint aOperationId, const TDesC8& aData) - { - LOG_FUNC - - switch ( aOperationId ) - { - case ERemConStatusApiUnitInfo: - { - TInt vendorId, unit, unitType, extendedUnitType; - SetUnitInfoResponseData(aData, vendorId, unit, unitType, extendedUnitType); - - iObserver.MrcsacoUnitInfoResponse(vendorId, unit, unitType, extendedUnitType); - break; - } - case ERemConStatusApiSubunitInfo: - { - TInt page, extension; - TPtrC8 pageData; - SetSubunitInfoResponseData(aData, page, extension, pageData); - - iObserver.MrcsacoSubunitInfoResponse(page, extension, pageData); - break; - } - default: - break; - } - } - -/** Parses command data from the buffer. - -@param aCommandData The buffer from which to read the data. -@param aVendorId On return, the vendor id -@param aUnit On return, the unit -@param aUnitType On return, the unit type -@param aExtendedUnitType On return, the extended unit type - -@internalComponent -@released -*/ -void CRemConStatusApiController::SetUnitInfoResponseData(const TDesC8& aCommandData, - TInt& aVendorId, TInt& aUnit, TInt& aUnitType, TInt& aExtendedUnitType) - { - if(aCommandData.Length()) - { - ReadCommandDataToInt(aCommandData, KRemConStatusApiVendorIdOffset, - KRemConStatusApiVendorIdLength, aVendorId); - ReadCommandDataToInt(aCommandData, KRemConStatusApiUnitOffset, - KRemConStatusApiUnitLength, aUnit); - ReadCommandDataToInt(aCommandData, KRemConStatusApiUnitTypeOffset, - KRemConStatusApiUnitTypeLength, aUnitType); - ReadCommandDataToInt(aCommandData, KRemConStatusApiExtendedUnitTypeOffset, - KRemConStatusApiExtendedUnitTypeLength, aExtendedUnitType); - } - else - { - // On error set all fields to 0 - aVendorId = aUnit = aUnitType = aExtendedUnitType = 0; - } - } - -/** Parses command data from the buffer. - -@param aCommandData The buffer from which to read the data. -@param aPage On return, the page -@param aExtension On return, the extension -@param aPageData On return, the page data - -@internalComponent -@released -*/ -void CRemConStatusApiController::SetSubunitInfoResponseData(const TDesC8& aCommandData, - TInt& aPage, TInt& aExtension, TPtrC8& aPageData) - { - if(aCommandData.Length()) - { - ReadCommandDataToInt(aCommandData, KRemConStatusApiPageOffset, - KRemConStatusApiPageLength, aPage); - ReadCommandDataToInt(aCommandData, KRemConStatusApiExtensionOffset, - KRemConStatusApiExtensionLength, aExtension); - - aPageData.Set(aCommandData.Mid(KRemConStatusApiPageDataOffset)); - } - else - { - // On error set all fields to 0 - aPage = aExtension = 0; - aPageData.Set(KNullDesC8()); - } - } - -/** Reads command data from the buffer to an int. - -@param aCommandData The buffer from which to read the data. -@param aOffset The offset within aCommandData read from. -@param aLength The length of data to read. This must not be - more than 4. -@param aValue On return, the value of the specified data section. - -@internalComponent -@released -*/ -void CRemConStatusApiController::ReadCommandDataToInt(const TDesC8& aCommandData, - TInt aOffset, TInt aLength, TInt& aValue) - { - __ASSERT_ALWAYS(aLength <= 4, CRemConStatusApiController::Panic(EStatusApiCommandDataSectionTooLong)); - - aValue = 0; - - for(TInt i = 0 ; i < aLength; i++) - { - aValue |= aCommandData[i+aOffset]<<(8*i); - } - } - -/** Issue UnitInfo command. -Only one command per controller session can be outstanding at any one time. -@param aStatus Status to be completed with the result of issuing this command. -@param aNumRemotes On completion, the number of remotes this command was issued to. -*/ -EXPORT_C void CRemConStatusApiController::UnitInfo(TRequestStatus& aStatus, TUint& aNumRemotes) - { - LOG_FUNC - - InterfaceSelector().Send(aStatus, - TUid::Uid(KRemConStatusApiUid), - (TUint)ERemConStatusApiUnitInfo, - aNumRemotes, - ERemConCommand, - iOutData); - } - -/** Issue SubUnitInfo command. -Only one command per controller session can be outstanding at any one time. -@param aStatus Status to be completed with the result of issuing this command. -@param aNumRemotes On completion, the number of remotes this command was issued to. -*/ -EXPORT_C void CRemConStatusApiController::SubunitInfo(TRequestStatus& aStatus, TUint& aNumRemotes) - { - LOG_FUNC - - InterfaceSelector().Send(aStatus, - TUid::Uid(KRemConStatusApiUid), - (TUint)ERemConStatusApiSubunitInfo, - aNumRemotes, - ERemConCommand); - } - -/** Utility Status Converter panic function. - -@param aPanic The panic number. -@internalComponent -@released -*/ -void CRemConStatusApiController::Panic(TStatusApiPanic aPanic) - { - User::Panic(KStatusApiPanicName, aPanic); - } - -// -// End of file diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusconverter/10207ea3.rss --- a/bluetoothappprofiles/avrcp/statusconverter/10207ea3.rss Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent -*/ - -#include - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x10207ea3; - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x10205C43; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10207ea4; - version_no = 1; - display_name = "RemConAvrcpStatusConverter"; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } - -// -// End of file diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusconverter/bld.inf --- a/bluetoothappprofiles/avrcp/statusconverter/bld.inf Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent -*/ - -PRJ_MMPFILES -remconavrcpstatusconverter.mmp - -// -// End of file diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusconverter/remconavrcpstatusconverter.cpp --- a/bluetoothappprofiles/avrcp/statusconverter/remconavrcpstatusconverter.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,551 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent - @released -*/ - -#include -#include - -#include "remconstatusapi.h" -#include "remconavrcpstatusconverter.h" - -/** Factory function. - -@return Ownership of a new CRemConAvrcpStatusConverter. -*/ -CRemConAvrcpStatusConverter* CRemConAvrcpStatusConverter::NewL() - { - CRemConAvrcpStatusConverter* self = new(ELeave) CRemConAvrcpStatusConverter; - return self; - } - -/** Destructor. -*/ -CRemConAvrcpStatusConverter::~CRemConAvrcpStatusConverter() - { - } - -/** Constructor. -*/ -CRemConAvrcpStatusConverter::CRemConAvrcpStatusConverter() - { - } - -/** Called to get a converter interface. - -@param aUid The uid of the desired interface. -@return An instance of the desired interface, NULL if - one could not be found. -*/ -TAny* CRemConAvrcpStatusConverter::GetInterface(TUid aUid) - { - TAny* ret = NULL; - if ( aUid == TUid::Uid(KRemConConverterInterface1) ) - { - ret = reinterpret_cast( - static_cast(this) - ); - } - - return ret; - } - -/** Decides whether this converter supports this interface. - -This converter supports only the AVRCP bearer and Status API. -This function checks whether the Uids provided match AVRCP and -Status. - -@param aInterfaceData The Uid of the originating RemCon interface. -@param aBearerUid The Uid of the bearer this data is destined for. -@return Whether this data can be converted. -*/ -TBool CRemConAvrcpStatusConverter::SupportedUids(const TUid& aInterfaceUid, const TUid& aBearerUid) const - { - return (aInterfaceUid == TUid::Uid(KRemConStatusApiUid) && - aBearerUid == TUid::Uid(KRemConBearerAvrcpImplementationUid)); - } - -/** Decides whether this converter supports this interface. - -This converter supports only the AVRCP bearer. That bearer publishes -interface data in the format of an AV/C frame. This function -checks that aBearerUid is that of AVRCP, and if so examines the AV/C -frame in aInterfaceData to see if it is a supported command. - -@param aInterfaceData Data in the format of the bearer identified by - aBearerUid. -@param aBearerUid The Uid of the bearer this data originates from. -@return Whether this data can be converted. -*/ -TBool CRemConAvrcpStatusConverter::SupportedInterface(const TDesC8& aInterfaceData, const TUid& aBearerUid) const - { - TInt supported = EFalse; - if(aBearerUid == TUid::Uid(KRemConBearerAvrcpImplementationUid)) - { - AVC::TOpcode opcode = AVC::EPower; // arbitrary initialisation to avoid compiler warning - TRAPD(err, opcode = CAVCFrame::OpcodeL(aInterfaceData)); - - if ( err == KErrNone - && ( opcode == AVC::EUnitInfo || opcode == AVC::ESubunitInfo ) - ) - { - supported = ETrue; - } - } - - return supported; - } - -/** Convert data from the API's form (as we're given it by RemCon) to -bearer-specific form. - -We only deal with the AVRCP bearer. This requires us to produce a -CAVCFrame. - -The supported commands are Unit Info and Subunit Info. - -@param aInterfaceUid The Uid of the originating RemCon interface. -@param aOperationId The id of the operation within the interface. -@param aData Data in the format defined by the RemCon interface. -@param aMsgType Whether this is a command or response. -@param aBearerData On return, an AV/C frame representing the operation. -*/ -TInt CRemConAvrcpStatusConverter::InterfaceToBearer(TUid aInterfaceUid, - TUint aOperationId, - const TDesC8& /*aData*/, - TRemConMessageType aMsgType, - TDes8& aBearerData) const - { - __ASSERT_ALWAYS(aInterfaceUid.iUid == KRemConStatusApiUid, CRemConAvrcpStatusConverter::Panic(EStatusConverterWrongInterface)); - TInt err = KErrCorrupt; - - switch(aOperationId) - { - case ERemConStatusApiUnitInfo: - { - if(aMsgType == ERemConCommand) - { - CAVCFrame* frame = NULL; - TRAP(err, frame = UnitInfoL()); - if(!err) - { - aBearerData = frame->Data(); - err = KErrNone; - delete frame; - } - } - else if(aMsgType == ERemConResponse) - { - // These should be generated within the bearer - // as it knows the manufacturer id - err = KErrNotSupported; - } - break; - } - case ERemConStatusApiSubunitInfo: - { - if(aMsgType == ERemConCommand) - { - CAVCFrame* frame = NULL; - TRAP(err, frame = SubunitInfoL()); - if(!err) - { - aBearerData = frame->Data(); - err = KErrNone; - delete frame; - } - } - else if(aMsgType == ERemConResponse) - { - // These should be generated within the bearer - // as it knows the manufacturer id - err = KErrNotSupported; - } - break; - } - default: - { - err = KErrNotSupported; - break; - } - } - - return err; - } - -/** Produce a Unit Info AV/C frame. - -@return A new AV/C frame representing unit info. -@leave System wide error. -*/ -CAVCFrame* CRemConAvrcpStatusConverter::UnitInfoL() - { - CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::EStatus, AVC::EUnit, AVC::EIgnore); - frame->Append(TChar(AVC::EUnitInfo)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - return frame; - } - -/** Produce a Subunit Info AV/C frame. - -@return A new AV/C frame representing subunit info. -@leave System wide error. -*/ -CAVCFrame* CRemConAvrcpStatusConverter::SubunitInfoL() - { - CAVCFrame* frame = CAVCFrame::NewL(AVC::ECommand, AVC::EStatus, AVC::EUnit, AVC::EIgnore); - frame->Append(TChar(AVC::ESubunitInfo)); - frame->Append(TChar(0x7)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - frame->Append(TChar(0xff)); - return frame; - } - -/** Convert data from the bearer format to RemCon interface format. - -We only deal with the Status Api. The supported commands are Unit -Info response and Subunit Info response. - -Support of these commands is mandatory in the targets. In the case -where a remote sends us something rubbish, we'll just provide our -client with the default info. - -@param aBearerData An AV/C frame to convert. -@param aInterfaceUid On return, the Uid of the RemCon interface. -@param aOperationId On return, the id of the operation within the - interface. -@param aMsgType Whether this is a command or response. -@param aData On return, Data in the format defined by the RemCon interface. -@return Whether the command was successfully converted. -*/ -TInt CRemConAvrcpStatusConverter::BearerToInterface(const TDesC8& aBearerData, - TUid& aInterfaceUid, - TUint& aOperationId, - TRemConMessageType& aMsgType, - TDes8& aData) const - { - TInt err = KErrCorrupt; - - switch(aOperationId) - { - case ERemConStatusApiUnitInfo: - { - if(aMsgType == ERemConCommand) - { - // These should be generated within the bearer - // as it knows the manufacturer id - err = KErrNotSupported; - } - else if(aMsgType == ERemConResponse) - { - // We try to parse the data, but if what the remote's sent - // us is invalid we'll fill in sensible values later - TRAP(err, SetUnitInfoResponseDataL(aBearerData, aData)); - aInterfaceUid = TUid::Uid(KRemConStatusApiUid); - aOperationId = ERemConStatusApiUnitInfo; - - if(err == KErrCorrupt) - { - // The data is set to the correct length in SetUnitInfoResponseDataL - // Stick some default data in there - SetCommandDataFromInt(aData, KRemConStatusApiUnitOffset, - KRemConStatusApiUnitLength, AVC::EID0); - - SetCommandDataFromInt(aData, KRemConStatusApiUnitTypeOffset, - KRemConStatusApiUnitTypeLength, AVC::EPanel); - - SetCommandDataFromInt(aData, KRemConStatusApiExtendedUnitTypeOffset, - KRemConStatusApiExtendedUnitTypeLength, 0); - - SetCommandDataFromInt(aData, KRemConStatusApiVendorIdOffset, - KRemConStatusApiVendorIdLength, KRemConStatusApiDefaultVendorId); - - err = KErrNone; - } - } - break; - } - case ERemConStatusApiSubunitInfo: - { - if(aMsgType == ERemConCommand) - { - // These should be generated within the bearer - // as it knows the manufacturer id - err = KErrNotSupported; - } - else if(aMsgType == ERemConResponse) - { - // We try to parse the data, but if what the remote's sent - // us is invalid we'll fill in sensible values later - TRAP(err, SetSubunitInfoResponseDataL(aBearerData, aData)); - aInterfaceUid = TUid::Uid(KRemConStatusApiUid); - aOperationId = ERemConStatusApiSubunitInfo; - - if(err == KErrCorrupt) - { - // Subunit response data varies in length, so the length - // set in SetSubunitInfoResponseDataL may be wrong. - aData.FillZ(KRemConStatusApiPageLength + KRemConStatusApiExtensionLength + KRemConStatusApiDefaultPageDataLength); - - // Stick some default data in there - SetCommandDataFromInt(aData, KRemConStatusApiPageOffset, - KRemConStatusApiPageLength, 0); - - SetCommandDataFromInt(aData, KRemConStatusApiExtensionOffset, - KRemConStatusApiExtensionLength, AVC::EIgnore); - - SetCommandDataFromInt(aData, KRemConStatusApiPageDataOffset, - KRemConStatusApiDefaultPageDataLength, KRemConStatusApiDefaultPageData); - - err = KErrNone; - } - } - break; - } - default: - { - err = KErrNotSupported; - break; - } - } - - return err; - } - -/** Parses command data from the buffer. - -@param aCommandData The buffer from which to read the data. -@param aVendorId On return, the vendor id -@param aUnit On return, the unit -@param aUnitType On return, the unit type -@param aExtendedUnitType On return, the extended unit type - -@internalComponent -@released -*/ -void CRemConAvrcpStatusConverter::SetUnitInfoResponseDataL(const TDesC8& aBearerData, - TDes8& aRemConData) - { - // AVRCP should pass us a sensible sized buffer! - __ASSERT_ALWAYS(aRemConData.MaxLength() >= KUnitInfoResponseLength, CRemConAvrcpStatusConverter::Panic(EAvrcpPassedTooSmallABuffer)); - - // Get rid of any junk - aRemConData.FillZ(KRemConStatusApiUnitLength + KRemConStatusApiUnitTypeLength - + KRemConStatusApiExtendedUnitTypeLength - + KRemConStatusApiVendorIdLength); - - // Get unit id if there's enough data for it - if(aBearerData.Length() < KUnitIdOffset + KUnitIdLength) - { - User::Leave(KErrCorrupt); - } - TInt unit; - ReadCommandDataToInt(aBearerData, KUnitIdOffset, KUnitIdLength, unit); - unit &= KAVCSubunitIDMask; - SetCommandDataFromInt(aRemConData, KRemConStatusApiUnitOffset, - KRemConStatusApiUnitLength, unit); - - // Get unit type (maybe extended) if there's enough data - if(aBearerData.Length() < KUnitTypeOffset + KUnitTypeLength) - { - User::Leave(KErrCorrupt); - } - TInt unitType; - ReadCommandDataToInt(aBearerData, KUnitTypeOffset, KUnitTypeLength, unitType); - unitType &= KAVCSubunitTypeMask; - unitType >>= KUnitTypeShift; - SetCommandDataFromInt(aRemConData, KRemConStatusApiUnitTypeOffset, - KRemConStatusApiUnitTypeLength, unitType); - - TInt unitTypeExtend = 0; - TInt vendorIdOffset = KVendorIdBaseOffset; - if(unitType == KUnitTypeExtend) - { - // Extended unit type. VendorId is offset by 1 - vendorIdOffset++; - - // Read the next byte if it's there - if(aBearerData.Length() < KUnitTypeExtendOffset + 1) - { - User::Leave(KErrCorrupt); - } - ReadCommandDataToInt(aBearerData, KUnitTypeExtendOffset, 1, unitTypeExtend); - unitTypeExtend <<= 8; - - // Double extended unit type. - if(unitTypeExtend == KUnitTypeExtendExtend) - { - // VendorId is offset by 1 - vendorIdOffset++; - - // Read the next byte - TInt unitTypeExtendExtend = 0; - if(aBearerData.Length() < KUnitTypeExtendExtendOffset + 1) - { - User::Leave(KErrCorrupt); - } - ReadCommandDataToInt(aBearerData, KUnitTypeExtendExtendOffset, 1, - unitTypeExtendExtend); - unitTypeExtend |= unitTypeExtendExtend; - } - - SetCommandDataFromInt(aRemConData, KRemConStatusApiExtendedUnitTypeOffset, - KRemConStatusApiExtendedUnitTypeLength, unitTypeExtend); - } - - // Get vendor id - if(aBearerData.Length() < vendorIdOffset + KVendorIdLength) - { - User::Leave(KErrCorrupt); - } - TInt vendorId; - ReadCommandDataToInt(aBearerData, vendorIdOffset, KVendorIdLength, vendorId); - SetCommandDataFromInt(aRemConData, KRemConStatusApiVendorIdOffset, - KRemConStatusApiVendorIdLength, vendorId); - } - -/** Parses command data from the buffer. - -@param aCommandData The buffer from which to read the data. -@param aPage On return, the page -@param aExtension On return, the extension -@param aPageData On return, the page data - -@internalComponent -@released -*/ -void CRemConAvrcpStatusConverter::SetSubunitInfoResponseDataL(const TDesC8& aBearerData, - TDes8& aRemConData) - { - // AVRCP should pass us a sensible sized buffer! - __ASSERT_ALWAYS(aRemConData.MaxLength() >= KUnitInfoResponseLength, CRemConAvrcpStatusConverter::Panic(EAvrcpPassedTooSmallABuffer)); - - CAVCFrame* frame = CAVCFrame::NewL(aBearerData, AVC::EResponse); //Qualified - CleanupStack::PushL(frame); - TPtrC8 ptr = frame->Data(); - - // Work out how long a buffer we need for the RemCon data. - // This is KRemConStatusApiPageLength + KRemConStatusApiExtensionLength - // + the length of the page data. - // We can work out the length of the page data from the frame - - // it's the remainder of the frame after KSubunitPageDataOffset. - // This gives us: - TInt remConDataLen = KRemConStatusApiPageLength - + KRemConStatusApiPageLength - + (ptr.Length() - KSubunitPageDataOffset); - - if(aRemConData.MaxLength() < remConDataLen) - { - User::Leave(KErrCorrupt); - } - - // Get rid of any junk - aRemConData.FillZ(remConDataLen); - - // Get page - if(aBearerData.Length() < KSubunitPageOffset + KSubunitPageLength) - { - User::Leave(KErrCorrupt); - } - TInt page; - ReadCommandDataToInt(aBearerData, KSubunitPageOffset, KSubunitPageLength, page); - page &= KSubunitPageMask; - SetCommandDataFromInt(aRemConData, KRemConStatusApiPageOffset, - KRemConStatusApiPageLength, page); - - // Get extension code - if(aBearerData.Length() < KSubunitExtensionOffset + KSubunitExtensionLength) - { - User::Leave(KErrCorrupt); - } - TInt extensionCode; - ReadCommandDataToInt(aBearerData, KSubunitExtensionOffset, KSubunitExtensionLength, - extensionCode); - extensionCode &= KSubunitExtensionMask; - SetCommandDataFromInt(aRemConData, KRemConStatusApiExtensionOffset, - KRemConStatusApiExtensionLength, extensionCode); - - // Get page data - TPtrC8 pageDataPtr = aBearerData.Mid(KSubunitPageDataOffset); - aRemConData.Replace(KRemConStatusApiPageDataOffset, pageDataPtr.Length(), pageDataPtr); - - CleanupStack::PopAndDestroy(frame); - } - -/** Reads command data from the buffer to an int. - -@param aCommandData The buffer from which to read the data. -@param aOffset The offset within aCommandData read from. -@param aLength The length of data to read. This must not be - more than 4. -@param aValue On return, the value of the specified data section. - -@internalComponent -@released -*/ -void CRemConAvrcpStatusConverter::ReadCommandDataToInt(const TDesC8& aCommandData, - TInt aOffset, TInt aLength, TInt& aValue) - { - __ASSERT_DEBUG(aLength <= 4, CRemConAvrcpStatusConverter::Panic(EStatusConverterDataTooShort)); - - aValue = 0; - - for(TInt i = 0 ; i < aLength; i++) - { - aValue |= aCommandData[aOffset+i]<<(8*i); - } - } - -/** Set the command data. This overwrites the current -contents of the data buffer. - -@param aCommandData The buffer in which to set the data. -@param aOffset The offset within aCommandData to set the data. -@param aLength The length of data to replace. -@param aValue The new value for the replaced data. -*/ -void CRemConAvrcpStatusConverter::SetCommandDataFromInt(TDes8& aCommandData, - TInt aOffset, TInt aLength, TInt aValue) - { - __ASSERT_DEBUG(aLength <= 4, CRemConAvrcpStatusConverter::Panic(EStatusConverterDataTooShort)); - - for(TInt i = 0; i < aLength; i++) - { - aCommandData[aOffset+i] = aValue >> (8*i); - } - } - -/** Utility Status Converter panic function. - -@param aPanic The panic number. -*/ -void CRemConAvrcpStatusConverter::Panic(TStatusConverterPanic aPanic) - { - User::Panic(KStatusConverterPanicName, aPanic); - } - -// -// End of file diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusconverter/remconavrcpstatusconverter.h --- a/bluetoothappprofiles/avrcp/statusconverter/remconavrcpstatusconverter.h Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent -*/ - -#ifndef REMCONAVRCPSTATUSCONVERTER_H -#define REMCONAVRCPSTATUSCONVERTER_H - -#include -#include -#include - -// These values are in bytes -const TUint KUnitIdOffset = 4; -const TUint KUnitIdLength = 1; -const TUint KUnitTypeOffset = 4; -const TUint KUnitTypeLength =1; -const TUint KUnitTypeExtendOffset = 5; -const TUint KUnitTypeExtendExtendOffset = 6; -const TUint KVendorIdBaseOffset = 5; -const TUint KVendorIdLength = 3; -const TUint KUnitInfoResponseLength = 8; -const TUint KRemConStatusApiDefaultPageDataLength = 4; - -const TUint KSubunitPageOffset = 3; -const TUint KSubunitPageLength = 1; -const TUint KSubunitExtensionOffset = 3; -const TUint KSubunitExtensionLength = 1; -const TUint KSubunitPageDataOffset = 4; - -// These values are in bits -const TUint KUnitTypeShift = 3; - -// Defined values for comparison -const TUint KUnitTypeExtend = 0x1e; -const TUint KUnitTypeExtendExtend = 0xff; -const TUint KSubunitPageMask = 0xf8; -const TUint KSubunitExtensionMask = 0x7; - -const TUint KRemConStatusApiDefaultVendorId = 0xffffff; -const TUint KRemConStatusApiDefaultPageData = 0xffffff48; - -_LIT(KStatusConverterPanicName, "Stat Conv Panic"); - -enum TStatusConverterPanic - { - EStatusConverterWrongInterface = 0, - EStatusConverterDataTooShort = 1, - EAvrcpPassedTooSmallABuffer = 2, - }; - -class CAVCFrame; -NONSHARABLE_CLASS(CRemConAvrcpStatusConverter) : public CRemConConverterPlugin, public MRemConConverterInterface - { -public: - static CRemConAvrcpStatusConverter* NewL(); - ~CRemConAvrcpStatusConverter(); - -private: // from CRemConConverterPlugin - TAny* GetInterface(TUid aUid); - - // from MRemConConverterInterface - TInt InterfaceToBearer(TUid aInterfaceUid, - TUint aOperationId, - const TDesC8& aData, - TRemConMessageType aMsgType, - TDes8& aBearerData) const; - - TInt BearerToInterface(const TDesC8& aBearerData, - TUid& aInterfaceUid, - TUint& aOperationId, - TRemConMessageType& aMsgType, - TDes8& aData) const; - - TBool SupportedUids(const TUid& aInterfaceUid, - const TUid& aBearerUid) const; - TBool SupportedInterface(const TDesC8& aInterfaceData, - const TUid& aBearerUid) const; - -private: - CRemConAvrcpStatusConverter(); - - static CAVCFrame* UnitInfoL(); - static CAVCFrame* SubunitInfoL(); - - static void SetUnitInfoResponseDataL(const TDesC8& aBearerData, - TDes8& aRemConData); - static void SetSubunitInfoResponseDataL(const TDesC8& aBearerData, - TDes8& aRemConData); - - static void ReadCommandDataToInt(const TDesC8& aCommandData, - TInt aOffset, TInt aLength, TInt& aValue); - static void SetCommandDataFromInt(TDes8& aCommandData, - TInt aOffset, TInt aLength, TInt aValue); - - static void Panic(TStatusConverterPanic aPanic); - }; - -#endif // REMCONAVRCPSTATUSCONVERTER_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusconverter/remconavrcpstatusconverter.mmp --- a/bluetoothappprofiles/avrcp/statusconverter/remconavrcpstatusconverter.mmp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -// Copyright (c) 2004-2009 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: -// remconavrcpstatusconverter.dll Converter between RemCon Avrcp Status API and -// AVRCP bearer. -// -// - -/** - @file - @internalComponent -*/ - -#include - -TARGET remconavrcpstatusconverter.dll //Recommended unpaged -TARGETPATH /system/libs -TARGETTYPE PLUGIN -// UID2 = 0x10009d8d for ECOM plugins. -// UID3 = the 'DLL UID' (see resource file) -UID 0x10009d8d 0x10207ea3 -VENDORID 0x70000001 - -SOURCEPATH . -SOURCE remconavrcpstatusconverter.cpp -SOURCE remconavrcpstatusconvertermain.cpp - -START RESOURCE 10207ea3.rss -target remconavrcpstatusconverter.rsc -END - -USERINCLUDE . -USERINCLUDE ../common - -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -LIBRARY euser.lib -LIBRARY remconconverterplugin.lib -LIBRARY avc.lib - -NOEXPORTLIBRARY - -// -// End of file - -SMPSAFE diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothappprofiles/avrcp/statusconverter/remconavrcpstatusconvertermain.cpp --- a/bluetoothappprofiles/avrcp/statusconverter/remconavrcpstatusconvertermain.cpp Wed Oct 13 13:15:31 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -// Copyright (c) 2004-2009 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: -// - -/** - @file - @internalComponent -*/ - -#include -#include "remconavrcpstatusconverter.h" - -// Define the private interface UIDs -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(0x10207ea4, CRemConAvrcpStatusConverter::NewL), - }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - -// -// End of file diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/bteng/btbearer/inc/btpluginnotifier.h --- a/bluetoothengine/bteng/btbearer/inc/btpluginnotifier.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/bteng/btbearer/inc/btpluginnotifier.h Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006 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" @@ -25,7 +25,6 @@ #include #include #include -#include /** @@ -151,7 +150,6 @@ */ CRepository* iSession; - CHbIndicatorSymbian* iBTIndicator; }; diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp --- a/bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/bteng/btbearer/src/btpluginnotifier.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -24,8 +24,6 @@ #include "debug.h" #include #include -#include "btindicatorconstants.h" -#include // ======== MEMBER FUNCTIONS ======== @@ -62,7 +60,6 @@ delete repository; CBTEngSettings* settings = CBTEngSettings::NewL(); - iBTIndicator = CHbIndicatorSymbian::NewL(); BluetoothFeatures::TEnterpriseEnablementMode mode = BluetoothFeatures::EnterpriseEnablementL(); TRACE_INFO( ( _L( "mode = %d" ), mode) ) @@ -81,14 +78,6 @@ { TRACE_INFO( ( _L( "Turning BT off" ) ) ) (void) settings->SetPowerState( EBTPowerOff ); // Result is not important here - TInt state = EBTIndicatorOff; - CHbSymbianVariant* parameters = CHbSymbianVariant::NewL(&state,CHbSymbianVariant::EInt ); - TBool success = iBTIndicator->Activate(KIndicatorType(),parameters); - delete parameters; - if(!success) - { - User::Leave(iBTIndicator->Error()); - } } delete settings; if ( mode != BluetoothFeatures::EDisabled ) // only subscribe if there's any point (NB changing Enterprise Disabling mode requires a reboot) @@ -123,7 +112,6 @@ TRACE_FUNC_ENTRY Cancel(); delete iSession; - delete iBTIndicator; } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/bteng/group/btbearer.mmp --- a/bluetoothengine/bteng/group/btbearer.mmp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/bteng/group/btbearer.mmp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006 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" @@ -42,7 +42,6 @@ MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore LIBRARY euser.lib LIBRARY ecom.lib @@ -50,5 +49,4 @@ LIBRARY btengsettings.lib LIBRARY btfeatures.lib LIBRARY btnotifclient.lib -LIBRARY hbcore.lib DEBUGLIBRARY flogger.lib // File logging services diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btindicator/inc/btindicator.h --- a/bluetoothengine/btindicator/inc/btindicator.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btindicator/inc/btindicator.h Tue Oct 19 15:09:34 2010 +0300 @@ -20,13 +20,17 @@ #include -//#include +#include + + + /** * Bluetooth indicator class. * Handles client request and showing the indications. */ class BTIndicator : public HbIndicatorInterface { + Q_OBJECT public: /** * Constructor @@ -55,20 +59,18 @@ bool handleClientRequest(RequestType type, const QVariant ¶meter); private: -// void launchBTCpSettingView(); + void launchBTCpSettingView(); -/*private slots: +private slots: void handleReturnValue(const QVariant &returnValue); - void handleError(int errorCode,const QString &errorMessage);*/ + void handleError(int errorCode,const QString &errorMessage); private: - - QString mSecDisplayName; -// XQApplicationManager mAppMgr; + XQApplicationManager mAppMgr; + XQAiwRequest *mRequest; int mIndicatorStatus; - -private: - + bool mIndicatorlaunch; + QStringList mSecondaryText; }; #endif /* BTINDICATOR_H */ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btindicator/src/btindicator.cpp --- a/bluetoothengine/btindicator/src/btindicator.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btindicator/src/btindicator.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -16,34 +16,28 @@ */ #include "btindicator.h" #include -//#include -//#include #include "btindicatorconstants.h" -//#include -//#include -//#include -#define LOC_BLUETOOTH hbTrId("txt_bt_dblist_bluetooth") -#define LOC_BLUETOOTH_OFF hbTrId("txt_bt_dblist_bluetooth_val_off") -#define LOC_BLUETOOTH_ON_VISIBLE hbTrId("txt_bt_dblist_bluetooth_val_on_and_visible") -#define LOC_BLUETOOTH_VISIBLE_CONNECTED hbTrId("txt_bt_dblist_bluetooth_val_visible_and_connected") -#define LOC_BLUETOOTH_ON_HIDDEN hbTrId("txt_bt_dblist_bluetooth_val_on_and_hidden") -#define LOC_BLUETOOTH_HIDDEN_CONNECTED hbTrId("txt_bt_dblist_bluetooth_val_hidden_and_connected") + + +#define LOC_BLUETOOTH hbTrId("txt_bt_dblist_bluetooth") + +const QString BT_APPLICATION("btcpplugin.dll"); struct BTIndicatorInfo - { - QString icon; - QString secondaryText; - }; +{ + QString DecorationIcon; + QString MonoDecorationIcon; +}; static const int BTIndicatorCount = 5; static const BTIndicatorInfo IndicatorInfo[BTIndicatorCount] = { - { "qtg_large_bluetooth_off", "LOC_BLUETOOTH_OFF" }, - { "qtg_large_bluetooth", "LOC_BLUETOOTH_ON_VISIBLE" }, - { "qtg_large_bluetooth_hide","LOC_BLUETOOTH_ON_HIDDEN" }, - { "qtg_large_bluetooth_active_connection", "LOC_BT_VISIBLE_CONNECT" }, - { "qtg_large_bluetooth_hide_connection","LOC_BT_HIDDEN_CONNECT" } + { "qtg_large_bluetooth_off", "qtg_status_bluetooth_off" }, + { "qtg_large_bluetooth","qtg_status_bluetooth" }, + { "qtg_large_bluetooth_hide","qtg_status_bluetooth_hide" }, + { "qtg_large_bluetooth_active_connection", "qtg_status_bluetooth_connection"}, + { "qtg_large_bluetooth_hide_connection", "qtg_status_bluetooth_hide_connection"} }; @@ -53,33 +47,40 @@ BTIndicator::BTIndicator(const QString &indicatorType) : HbIndicatorInterface(indicatorType, HbIndicatorInterface::SettingCategory , - InteractionActivated) - { - mIndicatorStatus = 0; - } + InteractionActivated),mRequest(0),mIndicatorStatus(0),mIndicatorlaunch(false) +{ + mSecondaryText << hbTrId("txt_bt_dblist_bluetooth_val_off") + << hbTrId("txt_bt_dblist_bluetooth_val_on_and_visible") + << hbTrId("txt_bt_dblist_bluetooth_val_on_and_hidden") + << hbTrId("txt_bt_dblist_bluetooth_val_visible_and_connected") + << hbTrId("txt_bt_dblist_bluetooth_val_hidden_and_connected"); +} // ---------------------------------------------------------------------------- // BTIndicator::~BTIndicator // ---------------------------------------------------------------------------- BTIndicator::~BTIndicator() - { - } +{ + delete mRequest; +} // ---------------------------------------------------------------------------- // BTIndicator::handleInteraction // ---------------------------------------------------------------------------- bool BTIndicator::handleInteraction(InteractionType type) - { - // bool handled = false; +{ if (type == InteractionActivated) - { - //@TODO need to code for launching the BT Control Panel Plugin is available - - // launchBTCpSettingView(); - } + { + /* if(!mIndicatorlaunch) + { + launchBTCpSettingView(); + mIndicatorlaunch = true; + }*/ + + } return true; - } +} // ---------------------------------------------------------------------------- // BTIndicator::indicatorData @@ -87,31 +88,33 @@ // ---------------------------------------------------------------------------- QVariant BTIndicator::indicatorData(int role) const { - switch(role) - { - case PrimaryTextRole: - { - QString text(LOC_BLUETOOTH); - return text; - } - case SecondaryTextRole: - { - return IndicatorInfo[mIndicatorStatus].secondaryText;//mSecDisplayName; - } - case DecorationNameRole: - { - //QString iconName("qtg_large_bluetooth"); - return IndicatorInfo[mIndicatorStatus].icon;//iconName; - } - case MonoDecorationNameRole : - { - // QString iconName("qtg_large_bluetooth"); - return IndicatorInfo[mIndicatorStatus].icon;//iconName; - } + QVariant data(""); - default: - return QVariant(); - } + if(mIndicatorStatus == 0) + { + data = QString(); + } + else + { + switch(role) { + case PrimaryTextRole: + data = QString(LOC_BLUETOOTH); + break; + case SecondaryTextRole: + data = mSecondaryText[mIndicatorStatus]; + break; + case DecorationNameRole: + data = IndicatorInfo[mIndicatorStatus].DecorationIcon; + break; + case MonoDecorationNameRole : + data = IndicatorInfo[mIndicatorStatus].MonoDecorationIcon; + break; + default: + data = QString(); + break; + } + } + return data; } // ---------------------------------------------------------------------------- @@ -120,76 +123,105 @@ // ---------------------------------------------------------------------------- bool BTIndicator::handleClientRequest( RequestType type, const QVariant ¶meter) - { +{ bool handled(false); switch (type) { case RequestActivate: { - mSecDisplayName.clear(); -/* if(parameter.toInt() == EBTIndicatorOff) - mSecDisplayName.append("LOC_BLUETOOTH_OFF"); - else if(parameter.toInt() == EBTIndicatorOnVisible) - mSecDisplayName.append("LOC_BLUETOOTH_ON_VISIBLE"); - else if(parameter.toInt() == EBTIndicatorOnHidden) - mSecDisplayName.append("LOC_BLUETOOTH_ON_HIDDEN"); - else if(parameter.toInt() == EBTIndicatorVisibleConnected) - mSecDisplayName.append("LOC_BT_VISIBLE_CONNECT"); - else if(parameter.toInt() == EBTIndicatorHiddenConnected) - mSecDisplayName.append("LOC_BT_HIDDEN_CONNECT");*/ mIndicatorStatus = parameter.toInt(); - emit dataChanged(); + if(( !mIndicatorStatus )&&( !mIndicatorlaunch )) + { + mSecondaryText = QStringList(); + emit deactivate(); + } + else + { + emit dataChanged(); + } handled = true; } break; - default: + case RequestDeactivate: { - mSecDisplayName.clear(); + mSecondaryText = QStringList(); + mIndicatorStatus = 0; emit deactivate(); } break; + default: + break; } return handled; - } +} -/*void BTIndicator::launchBTCpSettingView() - { - XQAiwRequest *request = mAppMgr.create("obexhighway","com.nokia.symbian.IFileShare","send(QVariant)",true); - - if (!request) - { - qDebug("BTIndicator request returned with NULL"); - return; - } - else +void BTIndicator::launchBTCpSettingView() +{ + if(!mRequest) { - connect(request, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant))); - connect(request, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString))); + mRequest = mAppMgr.create("com.nokia.symbian.ICpPluginLauncher","launchSettingView(QString,QVariant)",false); + + if (!mRequest) + { + qDebug("BTIndicator request returned with NULL"); + return; + } + else + { + connect(mRequest, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant))); + connect(mRequest, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString))); + // Set arguments for request + QList args; + args << QVariant(BT_APPLICATION); + mRequest->setArguments(args); + mRequest->setSynchronous(false); + } } - // Set arguments for request - QList args; - //c:\resource\qt\plugins\controlpanel\nfccpplugin.qtplugin - args << QVariant( "c:\\two.jpg" );//btcpplugin.dll -// args << QVariant ( "c:\\two.jpg" ); - request->setArguments(args); - - // Make the request - if (!request->send()) + // Make the request + if (!mRequest->send()) { //report error qDebug("BTIndicator::launchBTCpSettingView request not sent"); } + +/* QString service("com.nokia.symbian.ICpPluginLauncher"); + QString operation("launchSettingView(QString,QVariant)"); + QList args; + XQAiwRequest* request; + XQApplicationManager appManager; + request = appManager.create(service, operation, false); // not embedded + if ( request == NULL ) + { + //Could not create request because of the arguments passed to the create() API. + User::Leave(KErrArgument); + } + args << QVariant("btcpplugin.dll"); + request->setArguments(args); + TInt error = KErrNone; + if(!request->send()) + { + // The only likely Symbian error code that can be associated is KErrNotSupported + + } + delete request;*/ - delete request; - - }*/ + +} -/*void BTIndicator::handleReturnValue(const QVariant &returnValue) +void BTIndicator::handleReturnValue(const QVariant &returnValue) { + Q_UNUSED(returnValue); + mIndicatorlaunch = false; + if(!mIndicatorStatus ) + { + emit deactivate(); + } } void BTIndicator::handleError(int errorCode,const QString &errorMessage) - { +{ Q_UNUSED(errorCode); - }*/ + Q_UNUSED(errorMessage); + mIndicatorlaunch = false; +} diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro --- a/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# 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" @@ -24,6 +24,8 @@ MOC_DIR = moc OBJECTS_DIR = obj +TRANSLATIONS = btdialogs.ts + # dependencies HEADERS += inc/btdevicedialoginputwidget.h \ inc/btdevicedialogquerywidget.h \ @@ -37,7 +39,9 @@ inc/btdevicedialogrecvquerywidget.h \ inc/btrecvprgrsdialogwidget.h \ inc/btrecvcompleteddialogwidget.h \ - inc/btdeviceinfowidget.h + inc/btdeviceinfowidget.h \ + inc/btdevicedialogwaitingwidget.h \ + inc/btdeviceokonlydialogwidget.h SOURCES += src/btdevicedialogplugin.cpp \ @@ -50,7 +54,9 @@ src/btdevicedialogrecvquerywidget.cpp \ src/btrecvprgrsdialogwidget.cpp \ src/btrecvcompleteddialogwidget.cpp \ - src/btdeviceinfowidget.cpp + src/btdeviceinfowidget.cpp \ + src/btdevicedialogwaitingwidget.cpp \ + src/btdeviceokonlydialogwidget.cpp RESOURCES += btdevicedialogplugin.qrc diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc --- a/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc Tue Oct 19 15:09:34 2010 +0300 @@ -8,5 +8,6 @@ docml/bt-receive-auth-dialog.docml docml/bt-recv-progress-dialog.docml docml/bt-receive-done-dialog.docml + docml/bt-waiting-dialog.docml diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ - + @@ -10,47 +10,45 @@ - - - - + - - - - - - + - - - - - - - + + + + + + + + + - - - - + + + + + + + + diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml --- a/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-more-devices-dialog.docml Tue Oct 19 15:09:34 2010 +0300 @@ -1,30 +1,24 @@ - + - - - - + + - + + - - - - - - - - - - + + + + + diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-waiting-dialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-waiting-dialog.docml Tue Oct 19 15:09:34 2010 +0300 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogrecvquerywidget.h Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -53,7 +53,7 @@ void checkBoxStateChanged(bool checked); private: - bool constructDialog(const QVariantMap ¶meters); + void constructDialog(const QVariantMap ¶meters); signals: void deviceDialogClosed(); @@ -70,6 +70,7 @@ HbAction *mNoAction; HbCheckBox *mAuthorizeUser; HbDialog *mDialog; + int mError; Q_DISABLE_COPY(BTRecvQueryDialogWidget) }; diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogwaitingwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogwaitingwidget.h Tue Oct 19 15:09:34 2010 +0300 @@ -0,0 +1,60 @@ +/* +* 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: BtDeviceDialogWaitingWidget class declaration. +* +*/ + + +#ifndef BTDEVICEDIALOGWAITINGWIDGET_H +#define BTDEVICEDIALOGWAITINGWIDGET_H + +#include +#include +#include +#include +#include +#include + +class BtDeviceDialogWaitingWidget : public QObject, + public HbDeviceDialogInterface + { + Q_OBJECT + +public: + BtDeviceDialogWaitingWidget(const QVariantMap ¶meters); + ~BtDeviceDialogWaitingWidget(); + +public: // from HbDeviceDialogInterface + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; + void closeDeviceDialog(bool byClient); + HbPopup *deviceDialogWidget() const; + virtual QObject *signalSender() const; + +private: + bool constructDialog(const QVariantMap ¶meters); + +signals: + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + +private: + HbDocumentLoader *mLoader; + HbDialog *mDialog; + int mLastError; + + Q_DISABLE_COPY(BtDeviceDialogWaitingWidget) + }; + +#endif /* BTDEVICEDIALOGWAITINGWIDGET */ diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/inc/btdeviceinfowidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdeviceinfowidget.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdeviceinfowidget.h Tue Oct 19 15:09:34 2010 +0300 @@ -48,7 +48,6 @@ bool constructDialog(const QVariantMap ¶meters); public slots: - void messageBoxClosed(HbAction *action); void messageBoxClosed(int action); private: diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/inc/btdeviceokonlydialogwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdeviceokonlydialogwidget.h Tue Oct 19 15:09:34 2010 +0300 @@ -0,0 +1,75 @@ +/* +* 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: BtDeviceOkOnlyDialogWidget class declaration. +* +*/ + + +#ifndef BTDEVICEOKONLYDIALOGWIDGET_H +#define BTDEVICEOKONLYDIALOGWIDGET_H + +#include + +#include +#include +#include + +/*! + \class BtDeviceOkOnlyDialogWidget + \brief Widget class with properties setting. + + BtDeviceOkOnlyDialogWidget, inherited from HbDeviceDialogInterface, + implemented using HbMessageBox. + + */ +class BtDeviceOkOnlyDialogWidget : + public QObject, public HbDeviceDialogInterface +{ + Q_OBJECT + +public: + BtDeviceOkOnlyDialogWidget(HbMessageBox::MessageBoxType type, const QVariantMap ¶meters); + + // From base class HbDeviceDialogInterface + virtual bool setDeviceDialogParameters(const QVariantMap ¶meters); + virtual int deviceDialogError() const; + virtual void closeDeviceDialog(bool byClient); + virtual HbDialog *deviceDialogWidget() const; + virtual QObject *signalSender() const; + +signals: + // Required by the framework + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + +public slots: + void messageBoxClosed(HbAction*); + +private: + void processParam(const QVariantMap ¶meters); + bool constructQueryDialog(const QVariantMap ¶meters); + void resetProperties(); + QString& GetPasskeyEntryStatusString(int aStatus); + +private: + Q_DISABLE_COPY(BtDeviceOkOnlyDialogWidget) + + int mLastError; + int mSendAction; + bool mShowEventReceived; + + HbMessageBox *mMessageBox; +}; + +#endif // BTDEVICEOKONLYDIALOGWIDGET_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -57,7 +57,7 @@ void searchDialogClosed(); private: - bool constructDialog(const QVariantMap ¶meters); + void constructDialog(const QVariantMap ¶meters); private: enum devTypeSelectionList { @@ -90,7 +90,7 @@ HbAction *mCancelAction; int mStopRetryFlag; - + int mLastError; BtSendDataSource mData; BtSendDataSource mSelectedData; diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btmoredevicesdialogwidget.h Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -51,7 +51,7 @@ // void inputClosed(HbAction *action); private: - bool constructDialog(const QVariantMap ¶meters); + void constructDialog(const QVariantMap ¶meters); signals: void deviceDialogClosed(); @@ -64,6 +64,7 @@ HbAction *mCancelAction; QStandardItemModel* mContentItemModel; BtSendDataSource mData; + int mLastError; Q_DISABLE_COPY(BTMoreDevicesDialogWidget) }; diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvcompleteddialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvcompleteddialogwidget.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvcompleteddialogwidget.h Tue Oct 19 15:09:34 2010 +0300 @@ -51,7 +51,7 @@ void cancelClicked(); private: - bool constructDialog(const QVariantMap ¶meters); + void constructDialog(const QVariantMap ¶meters); signals: void deviceDialogClosed(); @@ -69,6 +69,7 @@ HbDialog *mReceiveCompleteDialog; int mFileSz; bool mOpenConversationView; + int mError; Q_DISABLE_COPY(BTRecvcompletedDialogWidget) }; diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h --- a/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btrecvprgrsdialogwidget.h Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -51,7 +51,7 @@ void cancelClicked(); private: - bool constructDialog(const QVariantMap ¶meters); + void constructDialog(const QVariantMap ¶meters); signals: void deviceDialogClosed(); @@ -69,6 +69,7 @@ HbDialog *mDialog; HbProgressBar *mProgressBar; int mFileSz; + int mError; Q_DISABLE_COPY(BTRecvPrgrsDialogWidget) }; diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -23,6 +23,7 @@ #include #include #include +#include #include "btdevicedialogpluginerrors.h" const int PASSCODE_MAX_LEN = 16; // from BT specs @@ -124,6 +125,8 @@ QString keyStr, prompt,title,regExp; QVariant name; + bool minLenRequired = false; + keyStr.setNum( TBluetoothDialogParams::EResource ); // Validate if the resource item exists. QVariantMap::const_iterator i = parameters.constFind( keyStr ); @@ -134,30 +137,24 @@ } QVariant param = parameters.value( keyStr ); - if ( param.toInt() == EPinInput ) { - // Numeric value only - mInputDialog->setInputMode(HbInputDialog::RealInput); - title = QString(hbTrId("txt_bt_title_pairing_with_1")); - // todo: Fix the multiline problem - prompt = QString( hbTrId( "txt_bt_dialog_please_enter_the_passcode_for_1" ) ); - } - else { + + if(param.toInt() != EPinInput) + { mLastError = ParameterError; return; - } + } + mInputDialog->setInputMode(HbInputDialog::RealInput); + name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); + title = HbParameterLengthLimiter(hbTrId("txt_bt_title_pairing_with_1")).arg(name.toString()); - // check if minLength of passcode required + // Set minimum input length requirements keyStr.setNum( TBluetoothDeviceDialog::EAdditionalDesc ); i = parameters.constFind( keyStr ); - // Mini Length required, update prompt - // ToDo: The validator doesn't seem to work properly + // Min Length required if ( i != parameters.constEnd() ) { - // Todo : The string ID for the localization is not available yet - // for string : "Enter %1 digit passcode for device %2:" - // I'm using the "Enter the passcode for device %1" instead - prompt = QString( hbTrId( "txt_bt_dialog_please_enter_the_passcode_for_1" ) ); + minLenRequired = true; param = parameters.value( keyStr ); - regExp = tr("^\\d{%1,}$"); + regExp = "^\\d{%1,}$"; regExp.arg(param.toString()); HbValidator* validator = new HbValidator(mInputDialog->lineEdit()); validator->addField( @@ -166,26 +163,24 @@ mInputDialog->setValidator(validator); }else{ // Minimum requirement is to have at least 1 digit - regExp = tr("^\\d{1,}$"); + regExp = "^\\d{1,}$"; HbValidator* validator = new HbValidator(mInputDialog->lineEdit()); validator->addField( new QRegExpValidator( QRegExp(regExp, Qt::CaseInsensitive), validator ),""); mInputDialog->setValidator(validator); } - // replace % with the minimum length and device name - int repls = prompt.count( QString( "%" ) ); - if ( repls > 1 ) { - prompt = prompt.arg( param.toString() ); - } - if ( repls > 0 ) { - name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); - prompt = prompt.arg( name.toString() ); - } - repls = title.count(QString("%")); - if(repls > 0){ - title = title.arg( name.toString() ); - } + if(minLenRequired) + { + // Todo : The string ID for the localization is not available yet + // for string : "Enter %1 digit passcode for device %2:" + // I'm using the "Enter the passcode for device %1" instead + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_dialog_please_enter_the_passcode_for_1" )).arg(name.toString()); + } + else + { + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_dialog_please_enter_the_passcode_for_1" )).arg(name.toString()); + } mInputDialog->setHeadingWidget(new HbLabel(title)); mInputDialog->lineEdit(0)->setMaxLength(PASSCODE_MAX_LEN); mInputDialog->lineEdit(0)->setText(tr("")); // clear the input field diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -21,6 +21,7 @@ #include #include #include +#include #include "btdevicedialogpluginerrors.h" #include #include @@ -126,8 +127,10 @@ void BtDeviceDialogNotifWidget::processParam(const QVariantMap ¶meters) { TRACE_ENTRY - QString keyStr, prompt,title; - QVariant classOfDevice, notifType; + QString keyStr,prompt,title,devName; + QVariant classOfDevice, notifType, param; + HbIcon icon; + keyStr.setNum( TBluetoothDialogParams::EResource ); // Validate if the resource item exists. QVariantMap::const_iterator i = parameters.constFind( keyStr ); @@ -136,15 +139,20 @@ mLastError = UnknownDeviceDialogError; return; } - HbIcon icon; - QString textStr; - QString devName; - QVariant param = parameters.value( keyStr ); + param = parameters.value( keyStr ); int key = param.toInt(); + + keyStr.setNum( TBluetoothDeviceDialog::EDeviceName ); + i = parameters.constFind( keyStr ); + if ( i != parameters.constEnd() ) + { + devName = QString(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); + } + switch ( key ) { case EPairingSuccess: title = QString(hbTrId( "txt_bt_dpophead_paired" )); - prompt = QString( hbTrId( "txt_bt_dpopinfo_paired_to_1" ) ); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_dpopinfo_paired_to_1" )).arg(devName); classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); icon = getBadgedDeviceTypeIcon(classOfDevice.toInt()); mNotificationDialog->setIcon(icon); @@ -152,7 +160,7 @@ // todo: remove this Unpaired notification if not used case EUnpairedDevice: title = QString(hbTrId( "txt_bt_dpophead_unpaired" )); - prompt = QString( hbTrId( "txt_bt_dpopinfo_with_1" ) ); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_dpopinfo_with_1" )).arg(devName); classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); icon = getBadgedDeviceTypeIcon(classOfDevice.toInt()); mNotificationDialog->setIcon(icon); @@ -170,29 +178,24 @@ { case EBTConnected: title = QString(hbTrId( "txt_bt_dpophead_connected" )); - prompt = QString( hbTrId( "txt_bt_dpopinfo_connected_to_1" ) ); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_dpopinfo_connected_to_1" )).arg(devName); classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); icon = getBadgedDeviceTypeIcon(classOfDevice.toInt()); mNotificationDialog->setIcon(icon); break; case EBTClosed: title = QString(hbTrId( "txt_bt_dpophead_disconnected" )); - prompt = QString( hbTrId( "txt_bt_dpopinfo_disconnected_from_1" ) ); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_dpopinfo_disconnected_from_1" )).arg(devName); classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); icon = getBadgedDeviceTypeIcon(classOfDevice.toInt()); mNotificationDialog->setIcon(icon); break; - case EBTDisconnected: - case EBTDeviceNotAvailable: - case EBTOfflineDisabled: - case EBTEnterSap: case EBTSapOk: - case EBTSapFailed: - case EBTSapNoSim: - case EBTDeviceBusy: - case ECmdShowBtBatteryLow: - case ECmdShowBtBatteryCritical: - case EBTStayPowerOn: + title = QString(hbTrId( "txt_bt_dpophead_sim_access_profile" )); + prompt = QString( hbTrId( "txt_bt_dpopinfo_in_use" ) ); + classOfDevice = parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass )); + icon = QString("qtg_large_bluetooth"); + mNotificationDialog->setIcon(icon); break; case EBTSwitchedOn: title = QString(hbTrId("txt_bt_dpophead_bluetooth")); @@ -207,11 +210,24 @@ mNotificationDialog->setIcon(icon); break; // not used anymore? + case EBTEnterSap: + // EnterSAP is handled in another dialog type + case EBTSapNoSim: + case EBTSapFailed: + // SapNoSIM and SAP Failed handled in another dialog type case EIRNotSupported: case EBTVisibilityTimeout: case EBTAudioAccessory: case EBTAudioHandset: + case EBTDisconnected: + case EBTDeviceNotAvailable: + case EBTOfflineDisabled: + case EBTDeviceBusy: + case ECmdShowBtBatteryLow: + case ECmdShowBtBatteryCritical: + case EBTStayPowerOn: default: + mLastError = ParameterError; break; } break; @@ -225,9 +241,7 @@ case ESendCompleted: title = QString(hbTrId("txt_bt_dpophead_all_files_sent")); - textStr = QString(hbTrId("txt_bt_dpopinfo_sent_to_1")); - devName = QString(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); - prompt = QString(textStr.arg(devName)); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_dpopinfo_sent_to_1")).arg(devName); icon = getBadgedDeviceTypeIcon(parameters.value( QString::number(TBluetoothDeviceDialog::EDeviceClass)).toDouble()); mNotificationDialog->setIcon(icon); @@ -235,9 +249,7 @@ /*case ESendCancelled: title = QString(hbTrId("txt_bt_dpophead_sending_cancelled")); - textStr = QString(hbTrId("txt_bt_dpopinfo_sent_to_1")); - devName = QString(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); - prompt = QString(textStr.arg(devName)); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_dpopinfo_sent_to_1")).arg(devName); icon = getBadgedDeviceTypeIcon(parameters.value(QString::number( TBluetoothDeviceDialog::EDeviceClass)).toDouble()); mNotificationDialog->setIcon(icon); @@ -247,11 +259,6 @@ mLastError = ParameterError; break; } - int repls = prompt.count( QString( "%" ) ); - if ( repls > 0 ) { - QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); - prompt = prompt.arg( name.toString() ); - } mNotificationDialog->setTitle( title ); mNotificationDialog->setText( prompt ); TRACE_EXIT diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -33,6 +33,8 @@ #include "btdevicedialogrecvquerywidget.h" #include "btrecvcompleteddialogwidget.h" #include "btdeviceinfowidget.h" +#include "btdevicedialogwaitingwidget.h" +#include "btdeviceokonlydialogwidget.h" #include Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin) @@ -210,6 +212,7 @@ HbDeviceDialogInterface *deviceDialog = NULL; switch ( i.value().toInt() ) { case TBluetoothDialogParams::ENote: + case TBluetoothDialogParams::bt_054_d_entered_popup: deviceDialog = new BtDeviceDialogNotifWidget(parameters); break; @@ -244,6 +247,14 @@ case TBluetoothDialogParams::EInformationDialog: deviceDialog = new BtDeviceInfoWidget(parameters); break; + case TBluetoothDialogParams::bt_052_d_entering: + deviceDialog = new BtDeviceDialogWaitingWidget(parameters); + break; + case TBluetoothDialogParams::bt_053_d_unable_to_use_no_sim: + case TBluetoothDialogParams::bt_053_d_unable_to_use: + deviceDialog = + new BtDeviceOkOnlyDialogWidget(HbMessageBox::MessageTypeWarning,parameters); + break; default: d->mError = UnknownDeviceDialogError; break; diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -22,6 +22,7 @@ #include #include #include +#include #include "btdevicedialogpluginerrors.h" #include @@ -163,9 +164,9 @@ void BtDeviceDialogQueryWidget::processParam(const QVariantMap ¶meters) { TRACE_ENTRY - QString keyStr, prompt,title; + QString keyStr, prompt,title,devName; int status = -1; - QVariant name,param,addval,passkeyinputstatus; + QVariant param,addval,passkeyinputstatus; keyStr.setNum( TBluetoothDialogParams::EResource ); // Validate if the resource item exists. QVariantMap::const_iterator i = parameters.constFind( keyStr ); @@ -180,18 +181,26 @@ param = parameters.value( keyStr ); int key = param.toInt(); + + keyStr.setNum( TBluetoothDeviceDialog::EDeviceName ); + i = parameters.constFind( keyStr ); + if ( i != parameters.constEnd() ) + { + devName = QString(parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceName)).toString()); + } + switch ( key ) { case ENumericComparison: - prompt = QString( hbTrId( "txt_bt_info_does_this_code_match_the_code_on_1" ) ); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_info_does_this_code_match_the_code_on_1" )).arg(devName); break; case EPasskeyDisplay: - prompt = QString( hbTrId( "txt_bt_info_enter_the_following_code_to_the_1" ) ); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_info_enter_the_following_code_to_the_1" )).arg(devName); break; case EPairingFailureRetry: - prompt = QString( hbTrId( "txt_bt_info_pairing_with_1_failed_either_the_pas" ) ); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_info_pairing_with_1_failed_either_the_pas" )).arg(devName); break; case EPairingFailureOk: - prompt = QString( hbTrId( "txt_bt_info_unable_to_pair_with_1" ) ); + prompt = HbParameterLengthLimiter(hbTrId("txt_bt_info_unable_to_pair_with_1" )).arg(devName); break; // Input dialogs case EPinInput: @@ -203,36 +212,26 @@ mLastError = ParameterError; break; } - int repls = prompt.count( QString( "%" ) ); - if ( repls > 0 ) { - name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) ); - prompt = prompt.arg( name.toString() ); - if(key != EPairingFailureRetry && key != EPairingFailureOk) + if(key != EPairingFailureRetry && key != EPairingFailureOk) + { + addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) ); + // todo: Formating the prompt need to be discussed with UI designer + // The passcode could be displayed on a separate row if it the label did support + // the use of newline escape character. + prompt.append(tr("\n")); // insert 1 newlines for clarity + prompt.append(addval.toString()); + if(key == EPasskeyDisplay) { - addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) ); - // todo: Formating the prompt need to be discussed with UI designer - // The passcode could be displayed on a separate row if it the label did support - // the use of newline escape character. - prompt.append(tr("\n")); // insert 1 newlines for clarity - prompt.append(addval.toString()); - if(key == EPasskeyDisplay) + prompt.append("\n"); + bool ret = false; + passkeyinputstatus = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalInt )); + status = passkeyinputstatus.toInt(&ret); + if(ret) { - prompt.append("\n"); - bool ret = false; - passkeyinputstatus = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalInt )); - status = passkeyinputstatus.toInt(&ret); - if(ret) - { - prompt.append(GetPasskeyEntryStatusString(status)); - } + prompt.append(GetPasskeyEntryStatusString(status)); } } - } - // set property value to this dialog widget - if(key != EPairingFailureRetry && key != EPairingFailureOk) - { - title = QString(hbTrId("txt_bt_title_pairing_with_1")); - title = title.arg(name.toString()); + title = HbParameterLengthLimiter(hbTrId("txt_bt_title_pairing_with_1")).arg(devName); mMessageBox->setHeadingWidget(new HbLabel(title)); mMessageBox->setIconVisible(false); if(key == EPasskeyDisplay) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogrecvquerywidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogrecvquerywidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogrecvquerywidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -18,14 +18,16 @@ #include "btdevicedialogrecvquerywidget.h" #include "bluetoothdevicedialogs.h" +#include "btdevicedialogpluginerrors.h" #include const char* DOCML_BT_RECV_QUERY_DIALOG = ":/docml/bt-receive-auth-dialog.docml"; BTRecvQueryDialogWidget::BTRecvQueryDialogWidget(const QVariantMap ¶meters) +:mLoader(0), +mError(NoError) { - mLoader = 0; constructDialog(parameters); } @@ -41,12 +43,19 @@ bool BTRecvQueryDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) { Q_UNUSED(parameters); - return true; + if(!mError) + { + return true; + } + else + { + return false; + } } int BTRecvQueryDialogWidget::deviceDialogError() const { - return 0; + return mError; } void BTRecvQueryDialogWidget::closeDeviceDialog(bool byClient) @@ -66,7 +75,7 @@ return const_cast(this); } -bool BTRecvQueryDialogWidget::constructDialog(const QVariantMap ¶meters) +void BTRecvQueryDialogWidget::constructDialog(const QVariantMap ¶meters) { mLoader = new HbDocumentLoader(); bool ok = false; @@ -121,17 +130,19 @@ } mDialog->setHeadingWidget(mHeading); + + mDialog->setBackgroundFaded(false); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + mDialog->setTimeout(HbPopup::NoTimeout); + + connect(mYesAction, SIGNAL(triggered()), this, SLOT(yesClicked())); + connect(mNoAction, SIGNAL(triggered()), this, SLOT(noClicked())); + connect(mAuthorizeUser, SIGNAL(clicked(bool)), this, SLOT(checkBoxStateChanged(bool))); } - - mDialog->setBackgroundFaded(false); - mDialog->setDismissPolicy(HbPopup::NoDismiss); - mDialog->setTimeout(HbPopup::NoTimeout); - - connect(mYesAction, SIGNAL(triggered()), this, SLOT(yesClicked())); - connect(mNoAction, SIGNAL(triggered()), this, SLOT(noClicked())); - connect(mAuthorizeUser, SIGNAL(clicked(bool)), this, SLOT(checkBoxStateChanged(bool))); - - return true; + else + { + mError = DocMLLoadingError; + } } void BTRecvQueryDialogWidget::yesClicked() diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogwaitingwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogwaitingwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -0,0 +1,114 @@ +/* +* 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: BtDeviceDialogWaitingWidget class declaration. +* +*/ + + +#include "btdevicedialogwaitingwidget.h" +#include "bluetoothdevicedialogs.h" +#include "btdevicedialogpluginerrors.h" +#include +#include + +const char* DOCML_BT_WAITING_DIALOG = ":/docml/bt-waiting-dialog.docml"; + + +BtDeviceDialogWaitingWidget::BtDeviceDialogWaitingWidget(const QVariantMap ¶meters) +:mLoader(0),mDialog(0),mLastError(NoError) +{ + constructDialog(parameters); +} + +BtDeviceDialogWaitingWidget::~BtDeviceDialogWaitingWidget() +{ + delete mLoader; +} + +bool BtDeviceDialogWaitingWidget::setDeviceDialogParameters(const QVariantMap ¶meters) +{ + Q_UNUSED(parameters); + return true; +} + +int BtDeviceDialogWaitingWidget::deviceDialogError() const +{ + return mLastError; +} + +void BtDeviceDialogWaitingWidget::closeDeviceDialog(bool byClient) +{ + Q_UNUSED(byClient); + mDialog->close(); + emit deviceDialogClosed(); +} + +HbPopup* BtDeviceDialogWaitingWidget::deviceDialogWidget() const +{ + return mDialog; +} + +QObject* BtDeviceDialogWaitingWidget::signalSender() const +{ + return const_cast(this); +} + +bool BtDeviceDialogWaitingWidget::constructDialog(const QVariantMap ¶meters) +{ + Q_UNUSED(parameters); + HbLabel *heading; + HbProgressBar* progressBar; + mLoader = new HbDocumentLoader(); + bool ok = false; + + mLoader->load(DOCML_BT_WAITING_DIALOG, &ok); + if(ok) + { + mDialog = qobject_cast( mLoader->findWidget( "dialog" ) ); + if(mDialog == 0) + { + mLastError = UnknownDeviceDialogError; + return false; + } + heading = qobject_cast( mLoader->findWidget( "heading" ) ); + if(heading == 0) + { + mLastError = UnknownDeviceDialogError; + return false; + } + progressBar = qobject_cast( mLoader->findWidget( "progressBar" ) ); + if(progressBar == 0) + { + mLastError = UnknownDeviceDialogError; + return false; + } + + progressBar->setRange(0,0); + heading->setPlainText(hbTrId("txt_bt_info_entering_sim_access_profile")); + + mDialog->setBackgroundFaded(false); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + mDialog->setTimeout(HbPopup::NoTimeout); + return true; + } + else + { + mLastError = DocMLLoadingError; + return false; + } +} + + + + diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdeviceinfowidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdeviceinfowidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdeviceinfowidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -20,6 +20,7 @@ #include "bluetoothdevicedialogs.h" #include "btdevicedialogpluginerrors.h" #include +#include const int timeOut = 30000; @@ -86,7 +87,7 @@ HbIcon icon(QString("qtg_large_bluetooth")); mMessageBox->setIcon(icon); mMessageBox->setTimeout(timeOut); - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); }break; //TODO: Remove this piece of code if notifier is used in toggle case TBluetoothDialogParams::EOfflineQuery: @@ -98,7 +99,6 @@ mMessageBox->setIcon(icon); mMessageBox->setTimeout(timeOut); connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); }break; case TBluetoothDialogParams::ERecvFailed: @@ -111,7 +111,7 @@ HbIcon icon = getBadgedDeviceTypeIcon(classOfDevice); mMessageBox->setIcon(icon); mMessageBox->setDismissPolicy(HbPopup::NoDismiss); - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); }break; case TBluetoothDialogParams::ESendFailed: @@ -124,7 +124,7 @@ HbIcon icon = getBadgedDeviceTypeIcon(classOfDevice); mMessageBox->setIcon(icon); mMessageBox->setDismissPolicy(HbPopup::NoDismiss); - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); }break; case TBluetoothDialogParams::EMemoryFull: @@ -135,7 +135,7 @@ QString driveName(parameters.value(QString::number(TBluetoothDeviceDialog::EDriveName)).toString()); mMessageBox->setText(textStr.arg(driveLetter).arg(driveName)); mMessageBox->setDismissPolicy(HbPopup::NoDismiss); - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); }break; case TBluetoothDialogParams::EDriveNotFound: @@ -143,7 +143,7 @@ mMessageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning); mMessageBox->setText(hbTrId("txt_bt_info_file_not_fould_memory_card_has_been_r")); mMessageBox->setDismissPolicy(HbPopup::NoDismiss); - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); }break; case TBluetoothDialogParams::EFileMoved: @@ -151,7 +151,7 @@ mMessageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning); mMessageBox->setText(hbTrId("txt_bt_info_file_not_fould_it_may_be_removed_or_d")); mMessageBox->setDismissPolicy(HbPopup::NoDismiss); - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); }break; case TBluetoothDialogParams::EUnsupportedImages: @@ -166,6 +166,37 @@ mMessageBox->setDismissPolicy(HbPopup::NoDismiss); connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); }break; + + case TBluetoothDialogParams::ECannotUseSAPTemporarily: + { + mMessageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); + mMessageBox->setText(hbTrId("txt_bt_info_sim_access_profile_is_used_next_time_t")); + mMessageBox->setDismissPolicy(HbPopup::TapOutside); + mMessageBox->setTimeout(HbPopup::StandardTimeout); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); + }break; + + case TBluetoothDialogParams::ENoSimInDevice: + { + mMessageBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion); + mMessageBox->setHeadingWidget(new HbLabel(hbTrId("txt_bt_title_no_sim_card_in_the_device"))); + mMessageBox->setText(hbTrId("txt_bt_info_do_you_still_want_to_enable_sim_access")); + mMessageBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); + mMessageBox->setDismissPolicy(HbPopup::TapOutside); + mMessageBox->setTimeout(HbPopup::StandardTimeout); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); + }break; + + case TBluetoothDialogParams::EUnableToUseSAP: + { + mMessageBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion); + mMessageBox->setHeadingWidget(new HbLabel(hbTrId("txt_bt_title_unable_to_enter_sim_access_profile"))); + mMessageBox->setText(hbTrId("txt_bt_info_try_entering_the_sim_access_profile_ag")); + mMessageBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); + mMessageBox->setDismissPolicy(HbPopup::TapOutside); + mMessageBox->setTimeout(HbPopup::StandardTimeout); + connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); + }break; default: mLastError = UnknownDeviceDialogError; @@ -188,7 +219,6 @@ mMessageBox->setIcon(icon); mMessageBox->setTimeout(timeOut); connect(mMessageBox, SIGNAL(finished(int)), this, SLOT(messageBoxClosed(int))); - connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); }break; default: @@ -211,16 +241,10 @@ return false; } -void BtDeviceInfoWidget::messageBoxClosed(HbAction *action) -{ - Q_UNUSED(action); - emit deviceDialogClosed(); -} - void BtDeviceInfoWidget::messageBoxClosed(int action) { QVariantMap data; - if((action == HbMessageBox::Yes) || (action == HbMessageBox::Continue)) + if((action == HbMessageBox::Yes) || (action == HbMessageBox::Continue) || (action == HbMessageBox::Ok)) { data.insert(QString("actionResult"), QVariant(true)); } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdeviceokonlydialogwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdeviceokonlydialogwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -0,0 +1,175 @@ +/* +* 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: BtDeviceOkOnlyDialogWidget class implementation. +* +*/ + + +#include "btdeviceokonlydialogwidget.h" +#include "btdevicedialogplugintrace.h" +#include +#include +#include +#include +#include "btdevicedialogpluginerrors.h" + +/*! + class Constructor + */ +BtDeviceOkOnlyDialogWidget::BtDeviceOkOnlyDialogWidget( + HbMessageBox::MessageBoxType type, const QVariantMap ¶meters) +{ + TRACE_ENTRY + // set properties + mLastError = NoError; + mShowEventReceived = false; + mMessageBox = new HbMessageBox(type); + resetProperties(); + constructQueryDialog(parameters); + TRACE_EXIT +} + +/*! + Set parameters, implementation of interface + Invoked when HbDeviceDialog::update calls. + */ +bool BtDeviceOkOnlyDialogWidget::setDeviceDialogParameters( + const QVariantMap ¶meters) +{ + TRACE_ENTRY + mLastError = NoError; + processParam(parameters); + TRACE_EXIT + return true; +} + +/*! + Get error, implementation of interface + */ +int BtDeviceOkOnlyDialogWidget::deviceDialogError() const +{ + TRACE_ENTRY + TRACE_EXIT + return mLastError; +} + +/*! + Close notification, implementation of interface + */ +void BtDeviceOkOnlyDialogWidget::closeDeviceDialog(bool byClient) +{ + TRACE_ENTRY + Q_UNUSED(byClient); + // Closed by client or internally by server -> no action to be transmitted. + mMessageBox->close(); + // If show event has been received, close is signalled from hide event. If not, + // hide event does not come and close is signalled from here. + if (!mShowEventReceived) { + emit deviceDialogClosed(); + } + TRACE_EXIT +} + +/*! + Return display widget, implementation of interface + */ +HbDialog *BtDeviceOkOnlyDialogWidget::deviceDialogWidget() const +{ + TRACE_ENTRY + TRACE_EXIT + return mMessageBox; +} + +QObject *BtDeviceOkOnlyDialogWidget::signalSender() const +{ + return const_cast(this); +} + +/*! + Construct display widget + */ +bool BtDeviceOkOnlyDialogWidget::constructQueryDialog(const QVariantMap ¶meters) +{ + TRACE_ENTRY + // analyze the parameters to compose the properties of the message box widget + processParam(parameters); + + connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*))); + + TRACE_EXIT + return true; +} + + +/*! + Take parameter values and generate relevant property of this widget + */ +void BtDeviceOkOnlyDialogWidget::processParam(const QVariantMap ¶meters) +{ + TRACE_ENTRY + QString keyStr, prompt; + QVariant param; + keyStr.setNum( TBluetoothDialogParams::EDialogType ); + // Validate if the resource item exists. + QVariantMap::const_iterator i = parameters.constFind( keyStr ); + // item of ResourceId is not found, can't continue. + if ( i == parameters.constEnd() ) { + mLastError = UnknownDeviceDialogError; + return; + } + + param = parameters.value( keyStr ); + int key = param.toInt(); + switch ( key ) { + case TBluetoothDialogParams::bt_053_d_unable_to_use_no_sim: + // Todo : Update this string ID when we have it + prompt = QString( hbTrId( "txt_bt_title_unable_to_enter_sim_access_profile" ) ); + break; + case TBluetoothDialogParams::bt_053_d_unable_to_use: + prompt = QString( hbTrId( "txt_bt_title_unable_to_enter_sim_access_profile" ) ); + break; + default: + mLastError = ParameterError; + break; + } + mMessageBox->setStandardButtons( HbMessageBox::Ok); + mMessageBox->setText( prompt ); + TRACE_EXIT +} + +/*! + Reset properties to default values + */ +void BtDeviceOkOnlyDialogWidget::resetProperties() +{ + TRACE_ENTRY + // set to default values + mMessageBox->setModal(true); + mMessageBox->setTimeout(HbDialog::StandardTimeout); + mMessageBox->setDismissPolicy(HbDialog::NoDismiss); + TRACE_EXIT + return; +} + + +void BtDeviceOkOnlyDialogWidget::messageBoxClosed(HbAction* action) +{ + TRACE_ENTRY + Q_UNUSED(action); + QVariantMap data; + data.insert( QString( "result" ), QVariant(true)); + emit deviceDialogData(data); + emit deviceDialogClosed(); + TRACE_EXIT +} diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -30,6 +30,7 @@ #include #include #include +#include "btdevicedialogpluginerrors.h" const char* DOCML_BTDEV_SEARCH_DIALOG = ":/docml/bt-device-search-dialog.docml"; @@ -48,6 +49,7 @@ mContentItemModel = 0; mStopRetryFlag = 0; // Stop mQuery = 0; + mLastError = NoError; mSelectedDeviceType |= (BtuiDevProperty::AVDev | BtuiDevProperty::Computer | BtuiDevProperty::Phone | BtuiDevProperty::Peripheral | BtuiDevProperty::LANAccessDev | BtuiDevProperty::Toy | @@ -68,65 +70,71 @@ bool BTDeviceSearchDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) { - if(parameters.keys().contains("Search Completed")) + if(!mLastError) { - mStopRetryFlag = 1; // Retry - mSearchLabel->hide(); - - mSearchIconLabel->hide(); + if(parameters.keys().contains("Search Completed")) + { + mStopRetryFlag = 1; // Retry + mSearchLabel->hide(); + + mSearchIconLabel->hide(); + + mSearchDoneLabel->show(); + mSearchDoneLabel->setTextWrapping(Hb::TextWordWrap); + mSearchDoneLabel->setAlignment(Qt::AlignLeft); + mSearchDoneLabel->setPlainText(LOC_SEARCH_DONE); + + mStopRetryAction->setText(LOC_SEARCH_RETRY); + } + else + { + int cod = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toInt(); + int uiMajorDevice; + int uiMinorDevice; - mSearchDoneLabel->show(); - mSearchDoneLabel->setTextWrapping(Hb::TextWordWrap); - mSearchDoneLabel->setAlignment(Qt::AlignLeft); - mSearchDoneLabel->setPlainText(LOC_SEARCH_DONE); - - mStopRetryAction->setText(LOC_SEARCH_RETRY); + BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); + + BtSendDataItem devData; + //TODO Need to create string constant for Name as enum EDeviceName is not working for this + devData[NameAliasRole] =parameters.value("Name").toString(); + devData[ReadableBdaddrRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EAddress)); + devData[CoDRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)); + devData[DeviceTypeRole] = QVariant(uiMajorDevice); + setMajorProperty(devData,BtuiDevProperty::Bonded, + parameters.value("Bonded").toBool()); + setMajorProperty(devData,BtuiDevProperty::Blocked, + parameters.value("Blocked").toBool()); + setMajorProperty(devData,BtuiDevProperty::Trusted, + parameters.value("Trusted").toBool()); + setMajorProperty(devData,BtuiDevProperty::Connected, + parameters.value("Connected").toBool()); + mData.append(devData); + + if(mSelectedDeviceType & devData[DeviceTypeRole].toInt()) + { + QStandardItem* listitem = new QStandardItem(); + QStringList info; + info.append(devData[NameAliasRole].toString()); + listitem->setData(info, Qt::DisplayRole); + HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toInt(), + devData[MajorPropertyRole].toInt(), + BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); + listitem->setIcon(icon.qicon()); + mContentItemModel->appendRow(listitem); + mSelectedData.append(devData); + } + } + return true; } else { - int cod = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)).toInt(); - int uiMajorDevice; - int uiMinorDevice; - - BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); - - BtSendDataItem devData; - //TODO Need to create string constant for Name as enum EDeviceName is not working for this - devData[NameAliasRole] =parameters.value("Name").toString(); - devData[ReadableBdaddrRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EAddress)); - devData[CoDRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)); - devData[DeviceTypeRole] = QVariant(uiMajorDevice); - setMajorProperty(devData,BtuiDevProperty::Bonded, - parameters.value("Bonded").toBool()); - setMajorProperty(devData,BtuiDevProperty::Blocked, - parameters.value("Blocked").toBool()); - setMajorProperty(devData,BtuiDevProperty::Trusted, - parameters.value("Trusted").toBool()); - setMajorProperty(devData,BtuiDevProperty::Connected, - parameters.value("Connected").toBool()); - mData.append(devData); - - if(mSelectedDeviceType & devData[DeviceTypeRole].toInt()) - { - QStandardItem* listitem = new QStandardItem(); - QStringList info; - info.append(devData[NameAliasRole].toString()); - listitem->setData(info, Qt::DisplayRole); - HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toInt(), - devData[MajorPropertyRole].toInt(), - BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); - listitem->setIcon(icon.qicon()); - mContentItemModel->appendRow(listitem); - mSelectedData.append(devData); - } + return false; } - - return true; } int BTDeviceSearchDialogWidget::deviceDialogError() const { - return 0; + return mLastError; } void BTDeviceSearchDialogWidget::closeDeviceDialog(bool byClient) @@ -153,9 +161,9 @@ return const_cast(this); } -bool BTDeviceSearchDialogWidget::constructDialog(const QVariantMap ¶meters) +void BTDeviceSearchDialogWidget::constructDialog(const QVariantMap ¶meters) { - (void) parameters; + Q_UNUSED(parameters); bool ok = false; mLoader = new HbDocumentLoader(); @@ -196,19 +204,22 @@ connect(mStopRetryAction, SIGNAL(triggered()), this, SLOT(stopRetryClicked())); connect(mSearchDevicesDialog, SIGNAL(aboutToClose()), this, SLOT(searchDialogClosed())); + mSearchDevicesDialog->setBackgroundFaded(false); + mSearchDevicesDialog->setDismissPolicy(HbPopup::NoDismiss); + mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout); + mSearchDevicesDialog->setAttribute(Qt::WA_DeleteOnClose); + + mDevTypeList << hbTrId("txt_bt_list_audio_devices") + << hbTrId("txt_bt_list_computers") + << hbTrId("txt_bt_list_input_devices") + << hbTrId("txt_bt_list_phones") + << hbTrId("txt_bt_list_other_devices"); } - mSearchDevicesDialog->setBackgroundFaded(false); - mSearchDevicesDialog->setDismissPolicy(HbPopup::NoDismiss); - mSearchDevicesDialog->setTimeout(HbPopup::NoTimeout); - mSearchDevicesDialog->setAttribute(Qt::WA_DeleteOnClose); - - mDevTypeList << hbTrId("txt_bt_list_audio_devices") - << hbTrId("txt_bt_list_computers") - << hbTrId("txt_bt_list_input_devices") - << hbTrId("txt_bt_list_phones") - << hbTrId("txt_bt_list_other_devices"); - - return true; + else + { + mLastError = DocMLLoadingError; + } + } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btmoredevicesdialogwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * 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"" @@ -16,17 +16,11 @@ */ #include "btmoredevicesdialogwidget.h" -#include #include -#include -#include -#include -#include #include #include #include - - +#include "btdevicedialogpluginerrors.h" const char* DOCML_BT_MORE_DEV_DIALOG = ":/docml/bt-more-devices-dialog.docml"; @@ -35,18 +29,8 @@ { mLoader = 0; mContentItemModel = 0; + mLastError = NoError; constructDialog(parameters); -/* try - { - //May throws badAlloc on exception - constructDialog(parameters); - } - catch(std::bad_alloc &badAlloc) - { - //Failure to allocate memory - Q_UNUSED(badAlloc); - // = UnknownDeviceDialogError; - }*/ } BTMoreDevicesDialogWidget::~BTMoreDevicesDialogWidget() @@ -61,38 +45,45 @@ int uiMajorDevice; int uiMinorDevice; - BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); - if ((uiMajorDevice & BtuiDevProperty::Phone)||(uiMajorDevice & BtuiDevProperty::Computer) ) + if(!mLastError) { - BtSendDataItem devData; - //todo Need to create string constant for name as enum EDeviceName has an issue - devData[NameAliasRole] = parameters.value("Name"); - devData[ReadableBdaddrRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EAddress)); - devData[CoDRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)); - - setMajorProperty(devData,BtuiDevProperty::Bonded, - parameters.value("Bonded").toBool()); - setMajorProperty(devData,BtuiDevProperty::Blocked, - parameters.value("Blocked").toBool()); - setMajorProperty(devData,BtuiDevProperty::Trusted, - parameters.value("Trusted").toBool()); - setMajorProperty(devData,BtuiDevProperty::Connected, - parameters.value("Connected").toBool()); - mData.append(devData); - - QStandardItem* listitem = new QStandardItem(); - QStringList info; - info.append(devData[NameAliasRole].toString()); - - listitem->setData(info, Qt::DisplayRole); - HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toInt(), - devData[MajorPropertyRole].toInt(), - BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); - listitem->setIcon(icon.qicon()); - - mContentItemModel->appendRow(listitem); + BtuiDevProperty::mapDeiveType(uiMajorDevice, uiMinorDevice, cod); + if ((uiMajorDevice & BtuiDevProperty::Phone)||(uiMajorDevice & BtuiDevProperty::Computer) ) + { + BtSendDataItem devData; + //todo Need to create string constant for name as enum EDeviceName has an issue + devData[NameAliasRole] = parameters.value("Name"); + devData[ReadableBdaddrRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EAddress)); + devData[CoDRole] = parameters.value(QString::number(TBluetoothDeviceDialog::EDeviceClass)); + + setMajorProperty(devData,BtuiDevProperty::Bonded, + parameters.value("Bonded").toBool()); + setMajorProperty(devData,BtuiDevProperty::Blocked, + parameters.value("Blocked").toBool()); + setMajorProperty(devData,BtuiDevProperty::Trusted, + parameters.value("Trusted").toBool()); + setMajorProperty(devData,BtuiDevProperty::Connected, + parameters.value("Connected").toBool()); + mData.append(devData); + + QStandardItem* listitem = new QStandardItem(); + QStringList info; + info.append(devData[NameAliasRole].toString()); + + listitem->setData(info, Qt::DisplayRole); + HbIcon icon = getBadgedDeviceTypeIcon(devData[CoDRole].toInt(), + devData[MajorPropertyRole].toInt(), + BtuiBottomLeft | BtuiBottomRight | BtuiTopLeft | BtuiTopRight); + listitem->setIcon(icon.qicon()); + + mContentItemModel->appendRow(listitem); + } + return true; } - return true; + else + { + return false; + } } @@ -100,7 +91,7 @@ int BTMoreDevicesDialogWidget::deviceDialogError() const { - return 0; + return mLastError; } void BTMoreDevicesDialogWidget::closeDeviceDialog(bool byClient) @@ -126,7 +117,7 @@ return const_cast(this); } -bool BTMoreDevicesDialogWidget::constructDialog(const QVariantMap ¶meters) +void BTMoreDevicesDialogWidget::constructDialog(const QVariantMap ¶meters) { Q_UNUSED(parameters); mLoader = new HbDocumentLoader(); @@ -137,7 +128,6 @@ { mLastUsedDeviceDialog = qobject_cast(mLoader->findWidget("lastUsedDevicesDialog")); - HbListView* deviceList = qobject_cast(mLoader->findWidget("deviceList")); deviceList->setSelectionMode(HbAbstractItemView::SingleSelection); @@ -152,13 +142,15 @@ connect(mMoreAction, SIGNAL(triggered()), this, SLOT(moreDevicesClicked())); connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); - + mLastUsedDeviceDialog->setBackgroundFaded(false); + mLastUsedDeviceDialog->setDismissPolicy(HbPopup::NoDismiss); + mLastUsedDeviceDialog->setTimeout(HbPopup::NoTimeout); + mLastUsedDeviceDialog->setAttribute(Qt::WA_DeleteOnClose); } - mLastUsedDeviceDialog->setBackgroundFaded(false); - mLastUsedDeviceDialog->setDismissPolicy(HbPopup::NoDismiss); - mLastUsedDeviceDialog->setTimeout(HbPopup::NoTimeout); - mLastUsedDeviceDialog->setAttribute(Qt::WA_DeleteOnClose); - return true; + else + { + mLastError = DocMLLoadingError; + } } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvcompleteddialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvcompleteddialogwidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvcompleteddialogwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -17,6 +17,7 @@ #include "btrecvcompleteddialogwidget.h" #include "bluetoothdevicedialogs.h" +#include "btdevicedialogpluginerrors.h" const char* DOCML_BT_RECV_CMPLTD_DIALOG = ":/docml/bt-receive-done-dialog.docml"; @@ -24,7 +25,8 @@ BTRecvcompletedDialogWidget::BTRecvcompletedDialogWidget(const QVariantMap ¶meters) :mLoader(0), - mOpenConversationView(false) + mOpenConversationView(false), + mError(NoError) { constructDialog(parameters); } @@ -41,12 +43,19 @@ bool BTRecvcompletedDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) { Q_UNUSED(parameters); - return true; + if(!mError) + { + return true; + } + else + { + return false; + } } int BTRecvcompletedDialogWidget::deviceDialogError() const { - return 0; + return mError; } void BTRecvcompletedDialogWidget::closeDeviceDialog(bool byClient) @@ -66,7 +75,7 @@ return const_cast(this); } -bool BTRecvcompletedDialogWidget::constructDialog(const QVariantMap ¶meters) +void BTRecvcompletedDialogWidget::constructDialog(const QVariantMap ¶meters) { mLoader = new HbDocumentLoader(); bool ok = false; @@ -137,22 +146,24 @@ QString fCntStr(hbTrId("txt_bt_info_ln_other_files_received", (fCnt-1))); mFileCount->setPlainText(fCntStr); } + + mReceiveCompleteDialog->setBackgroundFaded(false); + mReceiveCompleteDialog->setDismissPolicy(HbPopup::NoDismiss); + mReceiveCompleteDialog->setTimeout(HbPopup::NoTimeout); + + connect(mShowAction, SIGNAL(triggered()), this, SLOT(showClicked())); + connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); + + QVariantMap::const_iterator i = parameters.find("OpenCnvView"); + if(i != parameters.end()) + { + mOpenConversationView = (i.value().toBool() == true) ? true : false; + } } - - mReceiveCompleteDialog->setBackgroundFaded(false); - mReceiveCompleteDialog->setDismissPolicy(HbPopup::NoDismiss); - mReceiveCompleteDialog->setTimeout(HbPopup::NoTimeout); - - connect(mShowAction, SIGNAL(triggered()), this, SLOT(showClicked())); - connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); - - QVariantMap::const_iterator i = parameters.find("OpenCnvView"); - if(i != parameters.end()) - { - mOpenConversationView = (i.value().toBool() == true) ? true : false; - } - - return true; + else + { + mError = DocMLLoadingError; + } } void BTRecvcompletedDialogWidget::showClicked() diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btrecvprgrsdialogwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* 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" @@ -18,13 +18,14 @@ #include "btrecvprgrsdialogwidget.h" #include "bluetoothdevicedialogs.h" +#include "btdevicedialogpluginerrors.h" const char* DOCML_BT_RECV_PRGRS_DIALOG = ":/docml/bt-recv-progress-dialog.docml"; BTRecvPrgrsDialogWidget::BTRecvPrgrsDialogWidget(const QVariantMap ¶meters) +:mLoader(0), mError(NoError) { - mLoader = 0; constructDialog(parameters); } @@ -39,15 +40,22 @@ bool BTRecvPrgrsDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) { - mProgressBar->setMinimum(0); - mProgressBar->setMaximum(mFileSz); - mProgressBar->setProgressValue(parameters.value("progress").toInt()); - return true; + if(!mError) + { + mProgressBar->setMinimum(0); + mProgressBar->setMaximum(mFileSz); + mProgressBar->setProgressValue(parameters.value("progress").toInt()); + return true; + } + else + { + return false; + } } int BTRecvPrgrsDialogWidget::deviceDialogError() const { - return 0; + return mError; } void BTRecvPrgrsDialogWidget::closeDeviceDialog(bool byClient) @@ -67,7 +75,7 @@ return const_cast(this); } -bool BTRecvPrgrsDialogWidget::constructDialog(const QVariantMap ¶meters) +void BTRecvPrgrsDialogWidget::constructDialog(const QVariantMap ¶meters) { mLoader = new HbDocumentLoader(); bool ok = false; @@ -153,16 +161,19 @@ QString fCntStr(hbTrId("txt_bt_info_ln_files_already_received", fCnt)); mFileCount->setPlainText(fCntStr); } - } - mDialog->setBackgroundFaded(false); - mDialog->setDismissPolicy(HbPopup::NoDismiss); - mDialog->setTimeout(HbPopup::NoTimeout); - - connect(mHide, SIGNAL(triggered()), this, SLOT(hideClicked())); - connect(mCancel, SIGNAL(triggered()), this, SLOT(cancelClicked())); - - return true; + mDialog->setBackgroundFaded(false); + mDialog->setDismissPolicy(HbPopup::NoDismiss); + mDialog->setTimeout(HbPopup::NoTimeout); + + connect(mHide, SIGNAL(triggered()), this, SLOT(hideClicked())); + connect(mCancel, SIGNAL(triggered()), this, SLOT(cancelClicked())); + + } + else + { + mError = DocMLLoadingError; + } } void BTRecvPrgrsDialogWidget::hideClicked() diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp --- a/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btsenddialogwidget.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -37,32 +37,38 @@ bool BTSendDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters) { - mLastError = NoError; - if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) + if(!mLastError) { - mDialogHeading->setTextWrapping(Hb::TextWordWrap); - mDialogHeading->setAlignment(Qt::AlignHCenter); - - QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) - .arg(parameters.value("totalFilesCnt").toInt()) - .arg(parameters.value("destinationName").toString()); - mDialogHeading->setPlainText(headLabel); + if(mFileIndex != parameters.value("currentFileIdx").toString().toInt() ) + { + mDialogHeading->setTextWrapping(Hb::TextWordWrap); + mDialogHeading->setAlignment(Qt::AlignHCenter); - //Todo - Insert file icons here instead of bluetooth image - QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); - mFileIconLabel->setIcon(icon); - mFileNameLabel->setPlainText(parameters.value("fileName").toString()); - mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); - mProgressBar->setMinimum(0); - mProgressBar->setProgressValue(0); - mProgressBar->setMaximum(parameters.value("fileSz").toInt()); - mFileIndex = parameters.value("currentFileIdx").toString().toInt(); + QString headLabel = QString(LOC_SENDING_FILES_TO_DEVICE).arg(parameters.value("currentFileIdx").toInt()) + .arg(parameters.value("totalFilesCnt").toInt()) + .arg(parameters.value("destinationName").toString()); + mDialogHeading->setPlainText(headLabel); + + //Todo - Insert file icons here instead of bluetooth image + QIcon icon(QString(":/icons/qtg_large_bluetooth.svg")); + mFileIconLabel->setIcon(icon); + mFileNameLabel->setPlainText(parameters.value("fileName").toString()); + mFileSizeLabel->setPlainText(parameters.value("fileSzTxt").toString()); + mProgressBar->setMinimum(0); + mProgressBar->setProgressValue(0); + mProgressBar->setMaximum(parameters.value("fileSz").toInt()); + mFileIndex = parameters.value("currentFileIdx").toString().toInt(); + } + else + { + mProgressBar->setProgressValue(parameters.value("progressValue").toInt()); + } + return true; } - else + else { - mProgressBar->setProgressValue(parameters.value("progressValue").toInt()); + return false; } - return true; } int BTSendDialogWidget::deviceDialogError() const @@ -90,7 +96,7 @@ void BTSendDialogWidget::constructDialog(const QVariantMap& parameters) { - Q_UNUSED(parameters); + Q_UNUSED(parameters); mLoader = new HbDocumentLoader(); bool ok = false; @@ -104,19 +110,19 @@ mFileSizeLabel = qobject_cast(mLoader->findWidget("fileSize")); mProgressBar = qobject_cast(mLoader->findWidget("sendProgressBar")); - mSendDialog->setBackgroundFaded(false); - mSendDialog->setDismissPolicy(HbPopup::NoDismiss); - mSendDialog->setTimeout(HbPopup::NoTimeout); - mSendDialog->setAttribute(Qt::WA_DeleteOnClose); - - mCancelAction = static_cast( mLoader->findObject( "cancelAction" ) ); - - connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); + mSendDialog->setBackgroundFaded(false); + mSendDialog->setDismissPolicy(HbPopup::NoDismiss); + mSendDialog->setTimeout(HbPopup::NoTimeout); + mSendDialog->setAttribute(Qt::WA_DeleteOnClose); + + mCancelAction = static_cast( mLoader->findObject( "cancelAction" ) ); + + connect(mCancelAction, SIGNAL(triggered()), this, SLOT(cancelClicked())); } else - { - mLastError = DocMLLoadingError; - } + { + mLastError = DocMLLoadingError; + } } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/inc/btnotifgeninfonotifier.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/btnotifgeninfonotifier.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifgeninfonotifier.h Tue Oct 19 15:09:34 2010 +0300 @@ -111,7 +111,13 @@ * Not own. */ CBluetoothNotification* iNotification; - + + /** + * Pointer to the entering SAP notification. + * + */ + CBluetoothNotification* iEnterSAPNotification; + }; #endif // BTNOTIFDEVICESELECTOR_H diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/inc/traceconfig.h --- a/bluetoothengine/btnotif/btnotifsrv/inc/traceconfig.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/inc/traceconfig.h Tue Oct 19 15:09:34 2010 +0300 @@ -4,7 +4,7 @@ * Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD * Description : Configuration of debug tracing in btnotif * -* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright © 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" @@ -106,15 +106,15 @@ * Group-mapping aligning with OST groups. * The purpose of using groups is to ease migrating tracing from legacy logging to OST. */ -#define TRACE_FATAL "[FATAL]" -#define TRACE_IMPORTANT "[IMPTT]" -#define TRACE_NORMAL "[NORML]" -#define TRACE_API "[ API ]" -#define TRACE_FLOW "[FLOW ]" -#define TRACE_STATE "[STATE]" -#define TRACE_DETAILED "[DETLD]" -#define TRACE_DEBUG "[DEBUG]" -#define TRACE_PERFORMANCE "[PFMAN]" +#define TRACE_FATAL _L("[FATAL]") +#define TRACE_IMPORTANT _L("[IMPTT]") +#define TRACE_NORMAL _L("[NORML]") +#define TRACE_API _L("[ API ]") +#define TRACE_FLOW _L("[FLOW ]") +#define TRACE_STATE _L("[STATE]") +#define TRACE_DETAILED _L("[DETLD]") +#define TRACE_DEBUG _L("[DEBUG]") +#define TRACE_PERFORMANCE _L("[PFMAN]") /** * Component Identifier to be written into traces: diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -218,21 +218,18 @@ TBuf<32> buf; switch (aType) { case TBluetoothDialogParams::EAddress: - _LIT(KAddress,"EAddress"); - buf.Append(KAddress); + buf.Append(_L("EAddress")); break; case TBluetoothDeviceDialog::EDeviceName: - _LIT(KDeviceName,"EDeviceName"); - buf.Append(KDeviceName); + buf.Append(_L("EDeviceName")); break; case TBluetoothDeviceDialog::EAdditionalDesc: - _LIT(KAdditionalDesc,"EAdditionalDesc"); - buf.Append(KAdditionalDesc); + buf.Append(_L("EAdditionalDesc")); break; } TPtrC p(buf); TPtrC16 *ptr = (TPtrC16 *)value->Data(); - BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%S]", &p, ptr); + BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, _L("SetData [%S] = [%S]"), &p, ptr); ); User::LeaveIfError(iNotificationData->Add( key, value )); // Takes ownership of value break; @@ -285,7 +282,7 @@ } TPtrC p(buf); TInt *intPtr = (TInt *)value->Data(); - BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%d]", &p, *intPtr); + BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, _L("SetData [%S] = [%d]"), &p, *intPtr); ); User::LeaveIfError(iNotificationData->Add( key, value )); // Takes ownership of value break; @@ -322,21 +319,18 @@ TBuf<32> buf; switch (aType) { case TBluetoothDialogParams::EAddress: - _LIT(KAddress,"EAddress"); - buf.Append(KAddress); + buf.Append(_L("EAddress")); break; case TBluetoothDeviceDialog::EDeviceName: - _LIT(KDeviceName,"EDeviceName"); - buf.Append(KDeviceName); + buf.Append(_L("EDeviceName")); break; case TBluetoothDeviceDialog::EAdditionalDesc: - _LIT(KAdditionalDesc,"EAdditionalDesc"); - buf.Append(KAdditionalDesc); + buf.Append(_L("EAdditionalDesc")); break; } TPtrC p(buf); TPtrC16 *ptr = (TPtrC16 *)value->Data(); - BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%S]", &p, ptr); + BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, _L("SetData [%S] = [%S]"), &p, ptr); ); User::LeaveIfError(iNotificationData->Delete( key)); User::LeaveIfError(iNotificationData->Add( key, value )); // Takes ownership of value @@ -390,7 +384,7 @@ } TPtrC p(buf); TInt *intPtr = (TInt *)value->Data(); - BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%d]", &p, *intPtr); + BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, _L("SetData [%S] = [%d]"), &p, *intPtr); ); User::LeaveIfError(iNotificationData->Delete(key)); User::LeaveIfError(iNotificationData->Add( key, value )); // Takes ownership of value @@ -498,7 +492,7 @@ break; } TPtrC p(buf); - BOstraceExt1( TRACE_DEBUG, DUMMY_DEVLIST, "HbSymbianVariantMap [%S]", &p); + BOstraceExt1( TRACE_DEBUG, DUMMY_DEVLIST, _L("HbSymbianVariantMap [%S]"), &p); } } #endif // BLUETOOTHTRACE_ENABLED diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -176,7 +176,7 @@ if(aData.Keys().MdcaPoint(aData.Keys().MdcaCount()-1).Compare(_L("selectedindex"))==KErrNone) { TInt val = *(static_cast(aData.Get(_L("selectedindex"))->Data())); - BOstrace1( TRACE_DEBUG, TNAME_DEVLIST_2, "MBRDataReceived, val %d", val ); + BOstrace1( TRACE_DEBUG, DUMMY_DEVLIST, _L("MBRDataReceived, val %d"), val ); if ( !iMessage.IsNull() ) { diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/btnotifgeninfonotifier.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifgeninfonotifier.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifgeninfonotifier.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -34,7 +34,7 @@ // --------------------------------------------------------------------------- // CBTNotifGenInfoNotifier::CBTNotifGenInfoNotifier( CBTNotifServer* aServer ) -: iServer( aServer ) +: iServer( aServer ),iNotification(NULL),iEnterSAPNotification(NULL) { } @@ -148,6 +148,17 @@ void CBTNotifGenInfoNotifier::ShowNotificationL(const RMessage2& aMessage ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); + // read the message parameters + RBuf8 params; + params.CreateL( aMessage.GetDesLengthL( EBTNotifSrvParamSlot ) ); + aMessage.ReadL( EBTNotifSrvParamSlot, params ); + TBTGenericInfoNotifierParams notifparams; + TPckgC paramsPckg( notifparams ); + paramsPckg.Set( params ); + TInt notifType = paramsPckg().iMessageType; + + TInt err = KErrNone; + if(iNotification) { iNotification->RemoveObserver(); @@ -156,16 +167,6 @@ iNotification = iServer->NotificationManager()->GetNotification(); User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory iNotification->SetObserver( this ); - iNotification->SetNotificationType( TBluetoothDialogParams::ENote, EGenericInfo ); - - // read the message parameters - RBuf8 params; - params.CreateL( aMessage.GetDesLengthL( EBTNotifSrvParamSlot ) ); - aMessage.ReadL( EBTNotifSrvParamSlot, params ); - TBTGenericInfoNotifierParams notifparams; - TPckgC paramsPckg( notifparams ); - paramsPckg.Set( params ); - TInt notifType = paramsPckg().iMessageType; switch(notifType) { @@ -173,15 +174,32 @@ case EBTSwitchedOff: { User::LeaveIfError(iNotification->SetData( TBluetoothDeviceDialog::EAdditionalInt, notifType)); + iNotification->SetNotificationType( TBluetoothDialogParams::ENote, EGenericInfo ); }break; - + case EBTEnterSap: + // save the pointer in order to dismiss the dialog later on + iEnterSAPNotification = iNotification; + iNotification->SetNotificationType( TBluetoothDialogParams::bt_052_d_entering, EUnusedResource ); + break; + case EBTSapNoSim: + iNotification->SetNotificationType( TBluetoothDialogParams::bt_053_d_unable_to_use_no_sim, EUnusedResource ); + break; + case EBTSapFailed: + iNotification->SetNotificationType( TBluetoothDialogParams::bt_053_d_unable_to_use, EUnusedResource ); + break; + case EBTSapOk: + if(iEnterSAPNotification) + iEnterSAPNotification->Close(); + iNotification->SetNotificationType( TBluetoothDialogParams::bt_054_d_entered_popup, EGenericInfo ); + // Todo: handler err in a proper way + err = iNotification->SetData( TBluetoothDeviceDialog::EAdditionalInt, notifType); + break; default: { + iNotification->SetNotificationType( TBluetoothDialogParams::ENote, EGenericInfo ); TBTDevAddr addr(paramsPckg().iRemoteAddr); // Get the device name - TInt err = KErrNone; - const CBtDevExtension* dev = iServer->DevRepository().Device(addr); if(dev) { diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifincomingpairinghandler.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -196,7 +196,7 @@ // a service connection with phone. We won't take any action (e.g. remove // link key) in this case. As the result, this device can't be seen in our UI, // however other applications are still freely to use its services. - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: JW pairing with no IO device"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]: JW pairing with no IO device")); TBTEngConnectionStatus status = iParent.ConnectStatus( aDev.Address() ); if ( status == EBTEngConnecting || status == EBTEngConnected ) { @@ -211,7 +211,7 @@ { // The linkkey has been created by an incoming OBEX service request // which resulted a pairing event received from pair server. - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: JW pairing with IO device"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]: JW pairing with IO device")); iParent.RenewPairingHandler( NULL ); } else @@ -221,7 +221,7 @@ // The user was involved in the pairing, so display in the paired devices list (void) iParent.AddUiCookieJustWorksPaired(aDev); } - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]: Non-JW pairing"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]: Non-JW pairing")); // Other pairing model than Just Works: CancelPlaNotification(); SetPairResult( KErrNone ); @@ -347,7 +347,7 @@ // though the link has dropped because of a time-out. err = iPla.Open( iParent.SocketServ(), iAddr ); } - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:HasPhysicalLink ? %d", iPla.IsOpen() ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]:HasPhysicalLink ? %d"), iPla.IsOpen() ); BOstraceFunctionExit0( DUMMY_DEVLIST ); return err; } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifoutgoingpairinghandler.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -146,8 +146,14 @@ // TInt CBTNotifOutgoingPairingHandler::ObserveIncomingPair( const TBTDevAddr& aAddr ) { - (void)aAddr; - return KErrServerBusy; + if(iAddr == aAddr) + { + return KErrNone; + } + else + { + return KErrServerBusy; + } } // --------------------------------------------------------------------------- @@ -156,7 +162,7 @@ // void CBTNotifOutgoingPairingHandler::HandleOutgoingPairL( const TBTDevAddr& aAddr, TUint aCod ) { - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST," cod 0x%08x", aCod ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L(" cod 0x%08x"), aCod ); if ( iActive->IsActive() || aAddr != iAddr ) { // we don't allow another pairing request. @@ -264,7 +270,7 @@ // bluetooth application: if ( aDev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable ) { - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNOTIF] Outgoing Pairing, Just Works pairing"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNOTIF] Outgoing Pairing, Just Works pairing")); err = iParent.AddUiCookieJustWorksPaired( aDev ); } iActive->Cancel(); @@ -292,7 +298,7 @@ CBtSimpleActive* aActive, TInt aStatus ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - BOstraceExt3(TRACE_DEBUG,DUMMY_DEVLIST,"reqid %d, status: %d, pair mode %d ", aActive->RequestId(), + BOstraceExt3(TRACE_DEBUG,DUMMY_DEVLIST,_L("reqid %d, status: %d, pair mode %d "), aActive->RequestId(), aStatus, iPairMode); if( aActive->RequestId() == EDedicatedBonding && ( aStatus == KErrRemoteDeviceIndicatedNoBonding || @@ -306,7 +312,7 @@ { iPairMode = EBTOutgoingHeadsetManualPairing; // auto pairing with headset failed, try to pair again with manual pin: - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST," auto pairing failed, switch to manual pairing"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L(" auto pairing failed, switch to manual pairing")); DoPairingL(); } else if ( aStatus && aActive->RequestId() == EGeneralBonding && @@ -398,7 +404,7 @@ void CBTNotifOutgoingPairingHandler::HandleError( CBtSimpleActive* aActive, TInt aError ) { - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"error: %d", aError ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("error: %d"), aError ); // Our RunL can actually not leave, so we should never reach here. (void) aActive; iParent.OutgoingPairCompleted( aError ); @@ -427,7 +433,7 @@ nextMode = EGeneralBondingRetry; } - BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"[BTENG] CBTEngOtgPair::DoPairingL: bonding mode: pre %d, next %d", currentMode, nextMode); + BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNOTIF] CBTEngOtgPair::DoPairingL: bonding mode: pre %d, next %d"), currentMode, nextMode); iActive->SetRequestId( nextMode ); if ( nextMode == EDedicatedBonding ) @@ -513,6 +519,7 @@ void CBTNotifOutgoingPairingHandler::NotificationClosedL( TInt aError, const TDesC8& aData ) { BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError ); + (void)aError; // Read the result. TPckgC result( EFalse ); result.Set( aData.Ptr(), result.Length() ); // Read the part containing the result diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairnotifier.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -105,13 +105,13 @@ TInt uid = aMessage.Int0(); TInt opCode = aMessage.Function(); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Opcode: %d",opCode); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]:Opcode: %d"),opCode); if ( (!iNotifierMessage.IsNull()) && (opCode != EBTNotifCancelNotifier )&&(opCode != EBTNotifUpdateNotifier)) { // todo: do we allow concurrent pairing? - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:We are busy"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]:We are busy")); User::Leave(KErrServerBusy ); } @@ -146,7 +146,7 @@ { // If the device is banned and pairing is not locally initiated // then we reject. - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Device is banned"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]:Device is banned")); iNotifierMessage.Complete( KErrCancel ); return; } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifsecuritymanager.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -337,7 +337,7 @@ void CBTNotifSecurityManager::SessionClosed( CSession2* aSession ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST," session %x", aSession); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L(" session %x"), aSession); if ( !iMessage.IsNull() && iMessage.Session() == aSession ) { iMessage.Complete( KErrCancel ); @@ -364,7 +364,7 @@ // Unpair the device in registry (synchronously) iRegistry.UnpairDevice( dev.Address(), status ); User::WaitForRequest( status ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"Delete link key, res %d", status.Int()); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("Delete link key, res %d"), status.Int()); if ( status == KErrNone ) { TBTDeviceSecurity security = dev.GlobalSecurity(); @@ -379,7 +379,7 @@ // Remove the UI cookie bit for Just Works pairing. TInt32 cookie = dev.UiCookie() & ~EBTUiCookieJustWorksPaired; dev.SetUiCookie( cookie ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"UI cookie %x cleared", EBTUiCookieJustWorksPaired ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("UI cookie %x cleared"), EBTUiCookieJustWorksPaired ); } // modify the device in registry synchronously // status.Int() could be -1 if the device is not in registry @@ -429,7 +429,7 @@ cookie |= EBTUiCookieJustWorksPaired; dev.SetUiCookie( cookie ); err = UpdateRegDevice( dev ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"Outgoing Pairing write Ui cookie ret %d", err ); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("Outgoing Pairing write Ui cookie ret %d"), err ); } BOstraceFunctionExit0( DUMMY_DEVLIST); return err; @@ -446,7 +446,7 @@ // update the device in registry synchronously iRegistry.ModifyDevice( aDev, status ); User::WaitForRequest( status ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"UpdateRegDevice, ret %d", status.Int()); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("UpdateRegDevice, ret %d"), status.Int()); BOstraceFunctionExit0( DUMMY_DEVLIST); return status.Int(); } @@ -498,7 +498,7 @@ void CBTNotifSecurityManager::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"aId: %d, aStatus: %d", aActive->RequestId(), aStatus); + BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,_L("aId: %d, aStatus: %d"), aActive->RequestId(), aStatus); // Check which request is completed. switch( aActive->RequestId() ) { @@ -579,7 +579,7 @@ void CBTNotifSecurityManager::HandleError( CBtSimpleActive* aActive, TInt aError ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,"request id: %d, error: %d", aActive->RequestId(), aError); + BOstraceExt2(TRACE_DEBUG,DUMMY_DEVLIST,_L("request id: %d, error: %d"), aActive->RequestId(), aError); (void) aActive; (void) aError; BOstraceFunctionExit0( DUMMY_DEVLIST); @@ -650,10 +650,10 @@ TBool bonded = CBtDevExtension::IsBonded( aDevice.Device().AsNamelessDevice() ); if ( i == KErrNotFound ) { - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"Not found"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("Not found")); if ( bonded ) { - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"Not found but bonded"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("Not found but bonded")); TRAP_IGNORE( HandleRegistryBondingL( aDevice.Device().AsNamelessDevice() ) ); @@ -672,7 +672,7 @@ // no pairing or linkkey change. Nothing to do for pairing handling. // but we'd better update local copy just in case other data // of this device is needed by someone: - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"No pairing or link key change"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("No pairing or link key change")); iPairedDevices[i] = aDevice.Device().AsNamelessDevice(); BOstraceFunctionExit0( DUMMY_DEVLIST); return; @@ -717,7 +717,7 @@ TInt CBTNotifSecurityManager::SetPairObserver(const TBTDevAddr& aAddr, TBool aActivate) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"%d", aActivate); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("%d"), aActivate); BtTraceBtAddr0(TRACE_DEBUG,DUMMY_DEVLIST, aAddr ); TInt err( KErrNone ); if ( !aActivate ) @@ -823,7 +823,7 @@ void CBTNotifSecurityManager::HandlePairingResultL( const TBTDevAddr& aAddr, TInt aResult ) { BOstraceFunctionEntry0( DUMMY_DEVLIST ); - BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,"result %d", aResult); + BOstrace1(TRACE_DEBUG,DUMMY_DEVLIST,_L("result %d"), aResult); BtTraceBtAddr0(TRACE_DEBUG,DUMMY_DEVLIST, aAddr ); if ( !iPairingHandler && ( aResult == KErrNone || aResult == KHCIErrorBase ) ) diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -55,7 +55,7 @@ // Initialisation complete, now signal the client RProcess::Rendezvous( KErrNone ); // The server is now up and running. - BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST, "[BTNOTIF]\t BTNotif server now up and running" ); + BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST, _L("[BTNOTIF]\t BTNotif server now up and running" )); // The active scheduler runs during the lifetime of this thread. CActiveScheduler::Start(); // Stopping the active scheduler means terminating the thread. diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp --- a/bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifserviceauthorizer.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -91,7 +91,7 @@ aMessage.Complete(err); return; } - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:We are busy"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]:We are busy")); User::Leave(KErrServerBusy ); } @@ -111,7 +111,7 @@ { // If the device is banned, service connection from // this device is not allowed: - BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,"[BTNotif]:Device is banned"); + BOstrace0(TRACE_DEBUG,DUMMY_DEVLIST,_L("[BTNotif]:Device is banned")); aMessage.Complete( KErrCancel); return; } diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h --- a/bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h Tue Oct 19 15:09:34 2010 +0300 @@ -4,7 +4,7 @@ * Part of : bluetoothengine / btnotif * Description : Data structures for passing dialog type and formatting between btnotif and the UI component showing the actual dialogs. Also defines identifiers for Bluetooth device dialogs. * -* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright © 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" @@ -76,7 +76,13 @@ EUserAuthorization, EReceiveProgress, EReceiveDone, - EInformationDialog + EInformationDialog, + bt_052_d_entering, + bt_054_d_entered_popup, + bt_056_d_no_sim, + bt_051_d_no_carkit_connection, + bt_053_d_unable_to_use_no_sim, + bt_053_d_unable_to_use }; /** Enumeration for the notification parameters data type to be configured. */ @@ -105,7 +111,10 @@ EMemoryFull, EFileMoved, EDriveNotFound, - EUnsupportedImages + EUnsupportedImages, + ENoSimInDevice, + EUnableToUseSAP, + ECannotUseSAPTemporarily }; enum TDialogActionType diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btnotif/inc/bluetoothtrace.h --- a/bluetoothengine/btnotif/inc/bluetoothtrace.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btnotif/inc/bluetoothtrace.h Tue Oct 19 15:09:34 2010 +0300 @@ -1,23 +1,18 @@ /* -* ============================================================================ -* Name : bluetoothtrace.h -* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD -* Description : API declaration of run-time debug tracing +* 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". * -* Copyright © 2009 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. * -* Initial Contributors: -* Nokia Corporation - initial contribution. +* Contributors: * -* Contributors: -* Nokia Corporation -* ============================================================================ -* Template version: 4.2 +* Description: BtDeviceDialogWidget class declaration. +* */ #ifndef BLUETOOTHTRACE_H @@ -144,14 +139,11 @@ */ inline void Trace(const TDesC &trGrp, const TDesC &trTxt) { - _LIT(Format, "%S%S%S"); - TBuf16<0x180> str; TPtrC cp(KComponentName); - str.Format(Format, &cp, &trGrp, &trTxt); #ifdef BLUETOOTHTRACE_MEDIA_FILE - RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, str); + RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, _L("%S%S%S"),&cp,&trGrp,&trTxt); #else - RDebug::Print( str ); + RDebug::Print( _L("%S%S%S"),&cp,&trGrp,&trTxt ); #endif } @@ -160,8 +152,7 @@ */ #define BOstrace0( aGroupName, aTraceName, aTraceText ) \ {\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - Trace( TrGrp, TrTxt ); \ + Trace( aGroupName, aTraceText ); \ } /* @@ -169,10 +160,9 @@ */ #define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \ {\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam); \ - Trace( TrGrp, buf ); \ + TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ + buf.AppendFormat(aTraceText, &overflow, aParam); \ + Trace( aGroupName, buf ); \ } /* @@ -191,10 +181,9 @@ */ #define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ {\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2); \ - Trace( TrGrp, buf ); \ + TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ + buf.AppendFormat(aTraceText, &overflow, aParam1, aParam2); \ + Trace( aGroupName, buf ); \ } /* @@ -202,10 +191,9 @@ */ #define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ {\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3); \ - Trace( TrGrp, buf ); \ + TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ + buf.AppendFormat(aTraceText, &overflow, aParam1, aParam2, aParam3); \ + Trace( aGroupName, buf ); \ } /* @@ -213,10 +201,9 @@ */ #define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ {\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4); \ - Trace( TrGrp, buf ); \ + TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ + buf.AppendFormat(aTraceText, &overflow, aParam1, aParam2, aParam3, aParam4); \ + Trace( aGroupName, buf ); \ } /* @@ -224,10 +211,9 @@ */ #define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ {\ - _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ - TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4, aParam5); \ - Trace( TrGrp, buf ); \ + TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ + buf.AppendFormat(aTraceText, &overflow, aParam1, aParam2, aParam3, aParam4, aParam5); \ + Trace( aGroupName, buf ); \ } /* @@ -236,11 +222,9 @@ */ #define BOstraceFunctionEntry0( aTraceName ) \ {\ - _LIT(TrGrp, "[ API ]"); \ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry );\ - Trace( TrGrp, buf ); \ + TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L(">> ") );\ + Trace( _L("[ API ]"), buf ); \ } /* @@ -250,13 +234,11 @@ */ #define BOstraceFunctionEntry1( aTraceName, aInstance ) \ {\ - _LIT(TrGrp, "[ API ]");\ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d)"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ + TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L(">> ") ); \ TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \ - Trace( TrGrp, buf ); \ + buf.AppendFormat(_L(" 0x%X(%d)"), &overflow, aInstance, aInstance); \ + Trace( _L("[ API ]"), buf ); \ } /* @@ -265,13 +247,11 @@ */ #define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \ { \ - _LIT(TrGrp, "[ API ]");\ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d) arg %d"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ + TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L(">> ")); \ TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aArg); \ - Trace( TrGrp, buf ); \ + buf.AppendFormat(_L(" 0x%X(%d) arg %d"), &overflow, aInstance, aInstance, aArg); \ + Trace( _L("[ API ]"), buf ); \ } /* * Function exit trace without extra parameters. @@ -279,11 +259,9 @@ */ #define BOstraceFunctionExit0( aTraceName ) \ {\ - _LIT(TrGrp, "[ API ]"); \ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ - Trace( TrGrp, buf ); \ + TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L("<< ")); \ + Trace( _L("[ API ]"), buf ); \ } /* @@ -293,13 +271,11 @@ */ #define BOstraceFunctionExit1( aTraceName, aInstance ) \ {\ - _LIT(TrGrp, "[ API ]"); \ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d)"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ + TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L("<< ")); \ TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \ - Trace( TrGrp, buf ); \ + buf.AppendFormat(_L(" 0x%X(%d)"), &overflow, aInstance, aInstance); \ + Trace( _L("[ API ]"), buf ); \ } /* @@ -309,13 +285,11 @@ */ #define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \ {\ - _LIT(TrGrp, "[ API ]");\ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ - _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d) ret %d"); \ - TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ + TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L("<< ")); \ TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aRetval); \ - Trace( TrGrp, buf ); \ + buf.AppendFormat(_L(" 0x%X(%d) ret %d"), &overflow, aInstance, aInstance, aRetval); \ + Trace( _L("[ API ]"), buf ); \ } /* @@ -324,10 +298,8 @@ */ #define BOstraceEventStart0( aTraceName, aEventName ) \ {\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Start] "); \ - TBuf<512> buf(Entry); buf.Append( EvName ); \ - Trace( TrGrp, buf ); \ + TBuf<200> buf(_L("[Start] ")); buf.Append( aEventName ); \ + Trace( _L("[PFMAN]"), buf ); \ } /* @@ -336,12 +308,10 @@ */ #define BOstraceEventStart1( aTraceName, aEventName, aParam ) \ {\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Start] %S 0x%X(%d)"); \ - TPtrC evt(EvName); TBuf<512> buf; \ + TPtrC evt(aEventName); TBuf<200> buf; \ TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aParam, aParam ); \ - Trace( TrGrp, buf ); \ + buf.AppendFormat(_L("[Start] %S 0x%X(%d)"), &overflow, &evt, aParam, aParam ); \ + Trace( _L("[PFMAN]"), buf ); \ } /* @@ -350,10 +320,8 @@ */ #define BOstraceEventStop( aTraceName, aEventName ) \ {\ - _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ - _LIT(Entry, "[Stop] "); \ - TBuf<512> buf(Entry); buf.Append( EvName ); \ - Trace( TrGrp, buf ); \ + TBuf<200> buf(_L("[Stop] ")); buf.Append( aEventName ); \ + Trace( _L("[PFMAN]"), buf ); \ } /* @@ -362,12 +330,10 @@ */ #define BOstraceState0( aTraceName, aStateName, aNewState ) \ {\ - _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \ - _LIT(Entry, "%S 0x%X(%d)"); \ - TPtrC evt(StName); TBuf<512> buf; \ + TPtrC evt(aStateName); TBuf<200> buf; \ TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState ); \ - Trace( TrGrp, buf ); \ + buf.AppendFormat(_L("%S 0x%X(%d)"), &overflow, &evt, aNewState, aNewState ); \ + Trace( _L("[STATE]"), buf ); \ } /* @@ -376,12 +342,10 @@ */ #define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \ {\ - _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \ - _LIT(Entry, "%S 0x%X(%d) instance=0x%X(%d)"); \ - TPtrC evt(StName); TBuf<512> buf; \ + TPtrC evt(aStateName); TBuf<200> buf; \ TBtTraceOflowTruncate16 overflow; \ - buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState, aInstance, aInstance ); \ - Trace( TrGrp, buf ); \ + buf.AppendFormat(_L("%S 0x%X(%d) instance=0x%X(%d)"), &overflow, &evt, aNewState, aNewState, aInstance, aInstance ); \ + Trace( _L("[STATE]"), buf ); \ } #endif // BLUETOOTHTRACE_MEDIA_OST @@ -399,10 +363,9 @@ */ #define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam ) \ { \ - _LIT(TrTxt, aTraceText); TPtrC p(TrTxt); \ TBuf<12> buf; \ aParam.GetReadable( buf ); TPtrC p2(buf);\ - BOstraceExt2( aGroupName, aTraceName, "%S%S", &p, &p2 ); \ + BOstraceExt2( aGroupName, aTraceName, "%S%S", aTraceText, &p2 ); \ } /* @@ -412,7 +375,7 @@ #define BtTraceBtAddr0( aGroupName, aTraceName, aParam ) \ { \ TBuf<12> buf; aParam.GetReadable( buf ); TPtrC p(buf); \ - BOstraceExt1( aGroupName, aTraceName, "%S", &p ); \ + BOstraceExt1( aGroupName, aTraceName, _L("%S"), &p ); \ } #else // BLUETOOTHTRACE_ENABLED diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btsap/src/BTSapSocketHandler.cpp --- a/bluetoothengine/btsap/src/BTSapSocketHandler.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btsap/src/BTSapSocketHandler.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -279,16 +279,6 @@ if(err) { - TInt freeChnl; - err = iListener.GetOpt(KRFCOMMGetAvailableServerChannel, KSolBtRFCOMM, freeChnl); - if (err == KErrNone) - { - err = iListener.SetLocalPort(freeChnl); - iChannel = freeChnl; - } - } - if(err) - { // Try to bind using KRfcommPassiveAutoBind iChannel = KRfcommPassiveAutoBind; addr.SetPort(iChannel); diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuideviceview.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -20,9 +20,7 @@ #include #include #include -#include -#include -#include +#include #include #include #include @@ -101,12 +99,14 @@ BTUI_ASSERT_X( mDeviceStatus != 0, "bt-device-view", "Device status not found" ); - mConnectionDataForm = 0; - mConnectionDataForm = qobject_cast( mLoader->findWidget( "connectionCombobox" ) ); - BTUI_ASSERT_X( mConnectionDataForm != 0, "bt-device-view", "connection combobox not found" ); + mCombobox = 0; + mCombobox = qobject_cast( mLoader->findWidget( "connectionCombobox" ) ); + BTUI_ASSERT_X( mCombobox != 0, "bt-device-view", "connection combobox not found" ); - mConnectionComboboxModel = new HbDataFormModel( this ); - + ret = connect(mCombobox, SIGNAL(currentIndexChanged (int)), + this, SLOT(connectionPreferenceChanged(int))); + BTUI_ASSERT_X( ret, "Btui, BtcpuiDeviceView::BtcpuiDeviceView", "currentIndexChanged() connect failed"); + mPair_Unpair=0; mPair_Unpair = qobject_cast( mLoader->findWidget( "devicePairUnpair" ) ); BTUI_ASSERT_X( mPair_Unpair != 0, "bt-device-view", "pair/unpair button not found" ); @@ -122,7 +122,7 @@ SLOT(handleDeviceSetting())); BTUI_ASSERT_X( ret, "Btui, BtcpuiDeviceView::BtcpuiDeviceView", "clicked() connect failed"); - setConnectionCombobox(); + } BtcpuiDeviceView::~BtcpuiDeviceView() @@ -311,90 +311,75 @@ { BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); QString deviceStatus; + bool ret = false; + // Avoid unnecessary actions: // The device model has been modified and need to be reflected // in the UI however if we don't disable the signal before the UI update // the connectionPreferenceChanged function will be called and trigger // unnecessary update of the model by the device view. - mConnectionDataForm->removeConnection(mCombobox, SIGNAL(currentIndexChanged (int)), + ret = disconnect(mCombobox, SIGNAL(currentIndexChanged (int)), this, SLOT(connectionPreferenceChanged(int))); + BTUI_ASSERT_X( ret, "Btui, BtcpuiDeviceView::setDeviceStatus", "currentIndexChanged() disconnect failed"); + if (majorRole & BtuiDevProperty::Bonded && majorRole & BtuiDevProperty::Trusted && majorRole & BtuiDevProperty::Connected ) { mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trused_connected")); - mCombobox->setContentWidgetData("currentIndex", ConnectionAutomatic ); + mCombobox->setCurrentIndex(ConnectionAutomatic ); mComboboxIndex = ConnectionAutomatic; } else if (majorRole & BtuiDevProperty::Bonded && majorRole & BtuiDevProperty::Connected ) { mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_connected")); - mCombobox->setContentWidgetData("currentIndex", ConnectionAlwaysAsk ); + mCombobox->setCurrentIndex(ConnectionAlwaysAsk ); mComboboxIndex = ConnectionAlwaysAsk; } else if (majorRole & BtuiDevProperty::Bonded && majorRole & BtuiDevProperty::Trusted ) { mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired_trusted")); - mCombobox->setContentWidgetData("currentIndex", ConnectionAutomatic ); + mCombobox->setCurrentIndex(ConnectionAutomatic ); mComboboxIndex = ConnectionAutomatic; } else if (majorRole & BtuiDevProperty::Connected && majorRole & BtuiDevProperty::Trusted ) { mDeviceStatus->setPlainText(hbTrId("Trusted, Connected")); // ToDo: missing textId! - mCombobox->setContentWidgetData("currentIndex", ConnectionAutomatic ); + mCombobox->setCurrentIndex(ConnectionAutomatic ); mComboboxIndex = ConnectionAutomatic; } else if (majorRole & BtuiDevProperty::Trusted ) { mDeviceStatus->setPlainText(hbTrId("Trusted")); // ToDo: missing textId! - mCombobox->setContentWidgetData("currentIndex", ConnectionAutomatic ); + mCombobox->setCurrentIndex(ConnectionAutomatic ); mComboboxIndex = ConnectionAutomatic; } else if (majorRole & BtuiDevProperty::Bonded) { mDeviceStatus->setPlainText(hbTrId("txt_bt_info_paired")); - mCombobox->setContentWidgetData("currentIndex", ConnectionAlwaysAsk ); + mCombobox->setCurrentIndex(ConnectionAlwaysAsk ); mComboboxIndex = ConnectionAlwaysAsk; } else if (majorRole & BtuiDevProperty::Connected) { mDeviceStatus->setPlainText(hbTrId("txt_bt_info_connected")); - mCombobox->setContentWidgetData("currentIndex", ConnectionAlwaysAsk ); + mCombobox->setCurrentIndex(ConnectionAlwaysAsk ); mComboboxIndex = ConnectionAlwaysAsk; } else if (majorRole & BtuiDevProperty::Blocked) { mDeviceStatus->setPlainText(hbTrId("txt_bt_info_blocked")); - mCombobox->setContentWidgetData("currentIndex", ConnectionBlocked ); + mCombobox->setCurrentIndex(ConnectionBlocked ); mComboboxIndex = ConnectionBlocked; } else { // device not paired, connected, trusted or blocked. mDeviceStatus->setPlainText(" "); - mCombobox->setContentWidgetData("currentIndex", ConnectionAlwaysAsk ); + mCombobox->setCurrentIndex(ConnectionAlwaysAsk ); mComboboxIndex = ConnectionAlwaysAsk; } - mConnectionDataForm->addConnection(mCombobox, SIGNAL(currentIndexChanged (int)), + ret = connect(mCombobox, SIGNAL(currentIndexChanged (int)), this, SLOT(connectionPreferenceChanged(int))); + BTUI_ASSERT_X( ret, "Btui, BtcpuiDeviceView::setDeviceStatus", "currentIndexChanged() connect failed"); + BOstraceFunctionExit0(DUMMY_DEVLIST); } -void BtcpuiDeviceView::setConnectionCombobox() -{ - BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); - //create a model class - mCombobox = mConnectionComboboxModel->appendDataFormItem( - HbDataFormModelItem::ComboBoxItem, hbTrId("txt_bt_setlabel_connection"), - mConnectionComboboxModel->invisibleRootItem()); - - QStringList connList; - connList.append( hbTrId("txt_bt_setlabel_bluetooth_val_automatic") ); - connList.append( hbTrId("txt_bt_setlabel_bluetooth_val_always_ask") ); - connList.append( hbTrId("txt_bt_setlabel_bluetooth_val_blocked") ); - mCombobox->setContentWidgetData( "items", connList ); - - //set the model to the view, once model and data class are created - mConnectionDataForm->setModel(mConnectionComboboxModel); - mConnectionDataForm->addConnection(mCombobox, SIGNAL(currentIndexChanged (int)), - this, SLOT(connectionPreferenceChanged(int))); - BOstraceFunctionExit0(DUMMY_DEVLIST); -} - void BtcpuiDeviceView::setTextAndVisibilityOfButtons(int majorProperty) { BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); @@ -693,10 +678,14 @@ params.setValue(list); mAbstractDelegate = BtDelegateFactory::newDelegate( - BtDelegate::ChangeDeviceFriendlyName, mSettingModel, mDeviceModel); - connect( mAbstractDelegate, SIGNAL(delegateCompleted(int,BtAbstractDelegate*)), - this, SLOT(changeDevNameDelegateCompleted(int, QVariant)) ); - mAbstractDelegate->exec(params); + BtDelegate::ChangeDeviceFriendlyName, mSettingModel, mDeviceModel); + + bool ok(false); + ok =connect( mAbstractDelegate, SIGNAL(delegateCompleted(int,BtAbstractDelegate*)), + this, SLOT(changeDevNameDelegateCompleted(int)) ); + BTUI_ASSERT_X( ok, "BtcpuiDeviceView", "changeDevName: fail to connect signal" ); + + mAbstractDelegate->exec(params); } else { setPrevBtDeviceName(); diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btui/btcpplugin/btcpuideviceview.h --- a/bluetoothengine/btui/btcpplugin/btcpuideviceview.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuideviceview.h Tue Oct 19 15:09:34 2010 +0300 @@ -28,10 +28,7 @@ class HbPushButton; class HbIcon; class HbDocumentLoader; -class HbDataForm; - -class HbDataFormModel; -class HbDataFormModelItem; +class HbComboBox; class CpSettingFormItemData; class BtAbstractDelegate; class BtCpUiDeviceDetail; @@ -77,7 +74,7 @@ void clearViewData(); void setDeviceCategory(int cod, int majorRole);//cod:class of device void setDeviceStatus(int majorRole); - void setConnectionCombobox(); + void setTextAndVisibilityOfButtons(int majorProperty); void loadDeviceDetails(); void unloadDeviceDetails(); @@ -94,9 +91,7 @@ HbLabel *mDeviceCategory; HbLabel *mDeviceStatus; - HbDataForm *mConnectionDataForm; - HbDataFormModel *mConnectionComboboxModel; - HbDataFormModelItem *mCombobox; + HbComboBox *mCombobox; HbPushButton *mPair_Unpair; HbPushButton *mConnect_Disconnect; diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btui/btcpplugin/btcpuimainview.cpp --- a/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -533,12 +533,14 @@ if (val) { HbIcon icon("qtg_mono_bluetooth"); icon.setIconName("qtg_mono_bluetooth"); - mPowerButton->setIcon(icon); + mPowerButton->setIcon(icon); + mPowerButton->setChecked(true); } else { HbIcon icon("qtg_mono_bluetooth_off"); icon.setIconName("qtg_mono_bluetooth_off"); mPowerButton->setIcon(icon); + mPowerButton->setChecked(false); } break; case BtSettingModel::VisibilityRow: @@ -569,11 +571,24 @@ powerState = BtPowerOff; } (void) createExecuteDelegate(BtDelegate::ManagePower, - this, SLOT(handleDelegateCompleted(int,BtAbstractDelegate*)), + this, SLOT(powerDelegateCompleted(int)), QVariant((int)powerState)); BOstraceFunctionExit0(DUMMY_DEVLIST); } +void BtcpuiMainView::powerDelegateCompleted(int status) +{ + BOstraceFunctionEntry1( DUMMY_DEVLIST, this ); + if(KErrNone != status) { + QModelIndex top = mSettingModel->index( BtSettingModel::PowerStateRow, 0 ); + QModelIndex bottom = mSettingModel->index( BtSettingModel::PowerStateRow, 0 ); + // update power rows only + updateSettingItems( top, bottom ); + } + handleDelegateCompleted(status, mDelegate); + BOstraceFunctionExit0(DUMMY_DEVLIST); +} + void BtcpuiMainView::loadDocument() { bool ret(false); @@ -637,6 +652,7 @@ BTUI_ASSERT_X( mPowerButton != 0, "bt-main-view", "power button not found" ); ret = connect(mPowerButton, SIGNAL(clicked()), this, SLOT(changePowerState())); BTUI_ASSERT_X( ret, "BtcpuiMainView::BtcpuiMainView", "can't connect power button" ); + mPowerButton->setCheckable(true); mVisibilityMode=0; mVisibilityMode = qobject_cast( mLoader->findWidget( "visibilityMode" ) ); diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btui/btcpplugin/btcpuimainview.h --- a/bluetoothengine/btui/btcpplugin/btcpuimainview.h Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.h Tue Oct 19 15:09:34 2010 +0300 @@ -66,6 +66,7 @@ void goToSearchView(); //from delegate classes + void powerDelegateCompleted(int status); void visibilityDelegateCompleted(int status); void btNameDelegateCompleted(int status); void allActionTriggered(); diff -r 16e4b9007960 -r f5508c13dfe0 bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml --- a/bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml Wed Oct 13 13:15:31 2010 +0300 +++ b/bluetoothengine/btui/btcpplugin/docml/bt-device-view.docml Tue Oct 19 15:09:34 2010 +0300 @@ -1,264 +1,231 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + + - - -
- - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - -
-
- - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - -
-
- - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - + +
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
diff -r 16e4b9007960 -r f5508c13dfe0 btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp --- a/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/bip/src/BIPController.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -358,6 +358,16 @@ return KErrIrObexRespUnauthorized; } + // For every packet received, this check is required to ensure that the case where the + // memory card is removed while a transfer is in progress is handled in the right way. + TVolumeInfo volInfo; + TInt err = iFs.Volume(volInfo, iDrive); + if(err != KErrNone) + { + HandleError(ETrue); + return err; + } + if (iBTObject) { iTotalSizeByte = iBTObject->Length(); // get size of receiving file @@ -639,6 +649,34 @@ TRACE_FUNC_ENTRY TInt retVal = KErrNone; + // Before saving the file received, this check is required to ensure that the case where the + // memory card is removed while a transfer is in progress is handled in the right way. + TVolumeInfo volInfo; + retVal = iFs.Volume(volInfo, iDrive); + if(retVal != KErrNone) + { + TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) ); + HandleError(ETrue); + + // Even if the object saving fails we must return image handle with error code + TRAP_IGNORE( iBIPImageHandler->AddImageHandleHeaderL( iBTObexServer ) ); + + TRACE_INFO( _L( "[obexreceiveservicebip] HandlePutCompleteIndication Done\t" ) ); + + delete iBTObject; + iBTObject = NULL; + + delete iBuf; + iBuf = NULL; + + iPreviousDefaultFolder = iDefaultFolder; // save the last file path where file is successfully saved to file system. + iMsvIdParent = KMsvNullIndexEntryId; + + TRACE_FUNC_EXIT + + return retVal; + } + iDefaultFolder.Zero(); TChar driveLetter; if ( iDrive == EDriveC ) @@ -667,15 +705,15 @@ if ( retVal == KErrNone) { TRAP (retVal, TObexUtilsMessageHandler::AddEntryToInboxL(iMsvIdParent, iFullPathFilename)); + + if( retVal != KErrNone ) + { + TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) ); + TRAP( retVal, TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject, iMsvIdParent)); + retVal = KErrDiskFull; + } } - - if( retVal != KErrNone ) - { - TRACE_ERROR((_L( "[obexreceiveservicebip] CBIPController: HandlePutCompleteIndication error:\t %d" ), retVal ) ); - TRAP( retVal, TObexUtilsMessageHandler::RemoveInboxEntriesL(iBTObject, iMsvIdParent)); - retVal = KErrDiskFull; - } // Even if the object saving fails we must return image handle with error code TRAP_IGNORE( iBIPImageHandler->AddImageHandleHeaderL( iBTObexServer ) ); TRACE_INFO( _L( "[obexreceiveservicebip] HandlePutCompleteIndication Done\t" ) ); diff -r 16e4b9007960 -r f5508c13dfe0 btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp --- a/btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp Wed Oct 13 13:15:31 2010 +0300 +++ b/btobexprofiles/obexreceiveservices/opp/src/oppcontroller.cpp Tue Oct 19 15:09:34 2010 +0300 @@ -323,6 +323,16 @@ HandleError(ETrue); // reset state and clear up return KErrIrObexRespUnauthorized; } + + // For every packet received, this check is required to ensure that the case where the + // memory card is removed while a transfer is in progress is handled in the right way. + TVolumeInfo volInfo; + TInt err = iFs.Volume(volInfo, iDrive); + if(err != KErrNone) + { + HandleError(ETrue); + return err; + } iTotalSizeByte = iObexObject->Length(); // get size of receiving file iReceivingFileName = iObexObject->Name(); // get name of receiving file @@ -575,6 +585,27 @@ TRACE_FUNC TInt retVal = KErrNone; + // Before saving the file received, this check is required to ensure that the case where the + // memory card is removed while a transfer is in progress is handled in the right way. + TVolumeInfo volInfo; + retVal = iFs.Volume(volInfo, iDrive); + if(retVal != KErrNone) + { + TRACE_INFO( (_L( "[oppreceiveservice] HandlePutCompleteIndication failed %d \t" ),retVal ) ); + + HandleError(ETrue); + delete iObexObject; + iObexObject = NULL; + + delete iBuf; + iBuf = NULL; + + iPreviousDefaultFolder = iDefaultFolder; // save the last file path where file is successfully saved to file system. + iMsvIdParent = KMsvNullIndexEntryId; + TRACE_INFO( _L( "[oppreceiveservice] HandlePutCompleteIndication Done\t" ) ); + return retVal; + } + TChar driveLetter; iDefaultFolder.Zero(); iFs.DriveToChar(iDrive, driveLetter); diff -r 16e4b9007960 -r f5508c13dfe0 btservices_plat/bt_xqservice_api/inc/btxqserviceapi.h --- a/btservices_plat/bt_xqservice_api/inc/btxqserviceapi.h Wed Oct 13 13:15:31 2010 +0300 +++ b/btservices_plat/bt_xqservice_api/inc/btxqserviceapi.h Tue Oct 19 15:09:34 2010 +0300 @@ -72,13 +72,6 @@ static const QString BluetoothActivateDutMode("activateDeviceTestMode()"); /*! - The operation used for activating the Bluetooth device test mode (DUT mode) - - This API is deprecated and should be removed when the client has migrated to new API. - */ -static const QString ActivateDutMode("activateDeviceTestMode()"); - -/*! The full service name of activating Bluetooth device test mode (DUT mode) */ static const QString BluetoothServiceActivateDutMode = @@ -95,13 +88,6 @@ static const QString BluetoothToggleSspDebugMode("toggleSspDebugMode()"); /*! - The operation used for toggling the Bluetooth SSP debug mode. - - This API is deprecated and should be removed when the client has migrated to new API. - */ -static const QString ToggleSspDebugMode("toggleSspDebugMode()"); - -/*! The full service name of toggling Bluetooth SSP debug mode */ static const QString BluetoothServiceToggleSspDebugMode =