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