bluetoothappprofiles/avrcp/mediainformationapi/public/remconmediainformationtarget.h
changeset 70 f5508c13dfe0
parent 67 16e4b9007960
child 71 083fd884d7dd
equal deleted inserted replaced
67:16e4b9007960 70:f5508c13dfe0
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedAll
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef REMCONMEDIAINFORMATIONTARGET_H
       
    23 #define REMCONMEDIAINFORMATIONTARGET_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <remcon/remconinterfacebase.h>
       
    27 #include <remcon/remconinterfaceif.h>
       
    28 #include <remconmediainformationtargetobserver.h>
       
    29 
       
    30 class CRemConInterfaceSelector;
       
    31 class RRemConGetElementAttributesResponse;
       
    32 
       
    33 NONSHARABLE_CLASS(CRemConMediaInformationQueuedMessage): public CBase
       
    34 	{
       
    35 public:
       
    36 	static CRemConMediaInformationQueuedMessage* NewL(const TDesC8& aData);
       
    37 	~CRemConMediaInformationQueuedMessage();
       
    38 	
       
    39 	const TDesC8& Data();
       
    40 private:
       
    41 	CRemConMediaInformationQueuedMessage();
       
    42 	void ConstructL(const TDesC8& aData);
       
    43 public:
       
    44 	TSglQueLink iLink;
       
    45 private:
       
    46 	RBuf8 iData;
       
    47 	};
       
    48 
       
    49 /**
       
    50 Client-instantiable type supporting sending media information.
       
    51 */
       
    52 NONSHARABLE_CLASS(CRemConMediaInformationTarget) : public CRemConInterfaceBase, 
       
    53 								          		public MRemConInterfaceIf
       
    54 	{
       
    55 public:
       
    56 
       
    57 	/**
       
    58 	Factory function.
       
    59 	@param aInterfaceSelector The interface selector. The client must have 
       
    60 	created one of these first.
       
    61 	@param aObserver The observer of this interface.
       
    62 	@return A new CRemConMediaInformationTarget, owned by the interface selector.
       
    63 	*/
       
    64 	IMPORT_C static CRemConMediaInformationTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
       
    65 		MRemConMediaInformationTargetObserver& aObserver);
       
    66 	
       
    67 	/** Destructor */
       
    68 	IMPORT_C ~CRemConMediaInformationTarget();
       
    69 
       
    70 public:
       
    71 	/** Called by the client in response to a MrcmitoGetCurrentlyPlayingMetadata() call.
       
    72 	Each call provides one of the attribute values requested.
       
    73 	This is repeatedly called until all attributes requested have been supplied and then followed by Completed().
       
    74 	@param aAttribute The ID of the attribute supplied.
       
    75 	@param aValue A reference to a descriptor containing the attribute data.  
       
    76 	This must be valid until Completed() has been called. 
       
    77 	@see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata()
       
    78 	@see CRemConMediaInformationTarget::Completed()
       
    79 	*/
       
    80 	IMPORT_C TInt AttributeValue( TMediaAttributeId aAttributeId, TDesC8& aAttributeData);
       
    81 	
       
    82 	/** Signal that all attributes requested by MrcmitoGetCurrentlyPlayingMetadata() have been supplied
       
    83 	using the AttributeValue() method.
       
    84 	@see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata()
       
    85 	@see CRemConMediaInformationTarget::AttributeValue()
       
    86 	*/
       
    87 	IMPORT_C void Completed();
       
    88 	
       
    89 private:
       
    90 	/** 
       
    91 	Constructor.
       
    92 	@param aInterfaceSelector The interface selector.
       
    93 	@param aObserver The observer of this interface.
       
    94 	*/
       
    95 	CRemConMediaInformationTarget(CRemConInterfaceSelector& aInterfaceSelector, 
       
    96 		MRemConMediaInformationTargetObserver& aObserver);
       
    97 
       
    98 	void ConstructL();
       
    99 
       
   100 private: // from CRemConInterfaceBase
       
   101 	TAny* GetInterfaceIf(TUid aUid);
       
   102 
       
   103 private: // from MRemConInterfaceIf
       
   104 	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
       
   105 
       
   106 private: // utility
       
   107 	void SendError(TInt aError);
       
   108 	void ProcessMessage(const TDesC8& aData);
       
   109 	
       
   110 	static int NextMessageCb(TAny* aThis);
       
   111 	void DoNextMessage();
       
   112 private: // unowned
       
   113 	MRemConMediaInformationTargetObserver& iObserver;
       
   114 
       
   115 private: // owned
       
   116 	RRemConGetElementAttributesResponse* iResponse;
       
   117 
       
   118 	RArray<TMediaAttributeId>  	iMediaAttributeIDs;
       
   119 	TMediaAttributeIter 		iAttributeIterator;
       
   120 	TBool						iInProgress;
       
   121 	TSglQue<CRemConMediaInformationQueuedMessage> iMsgQueue;
       
   122 	
       
   123 	CAsyncCallBack* iNextMessageCallBack;
       
   124 	};
       
   125 
       
   126 #endif // REMCONMEDIAINFORMATIONTARGET_H