epoc32/include/remconmediainformationtarget.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/remconmediainformationtarget.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,128 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @publishedAll
    1.24 + @released
    1.25 +*/
    1.26 +
    1.27 +#ifndef REMCONMEDIAINFORMATIONTARGET_H
    1.28 +#define REMCONMEDIAINFORMATIONTARGET_H
    1.29 +
    1.30 +#include <e32base.h>
    1.31 +#include <remcon/remconinterfacebase.h>
    1.32 +#include <remcon/remconinterfaceif.h>
    1.33 +#include <remcon/mediainformation.h>
    1.34 +#include <remconmediainformationtargetobserver.h>
    1.35 +
    1.36 +class CRemConInterfaceSelector;
    1.37 +
    1.38 +NONSHARABLE_CLASS(CRemConMediaInformationQueuedMessage): public CBase
    1.39 +	{
    1.40 +public:
    1.41 +	static CRemConMediaInformationQueuedMessage* NewL(const TDesC8& aData);
    1.42 +	~CRemConMediaInformationQueuedMessage();
    1.43 +	
    1.44 +	const TDesC8& Data();
    1.45 +private:
    1.46 +	CRemConMediaInformationQueuedMessage();
    1.47 +	void ConstructL(const TDesC8& aData);
    1.48 +public:
    1.49 +	TSglQueLink iLink;
    1.50 +private:
    1.51 +	RBuf8 iData;
    1.52 +	};
    1.53 +
    1.54 +/**
    1.55 +Client-instantiable type supporting sending media information.
    1.56 +*/
    1.57 +NONSHARABLE_CLASS(CRemConMediaInformationTarget) : public CRemConInterfaceBase, 
    1.58 +								          		public MRemConInterfaceIf
    1.59 +	{
    1.60 +public:
    1.61 +
    1.62 +	/**
    1.63 +	Factory function.
    1.64 +	@param aInterfaceSelector The interface selector. The client must have 
    1.65 +	created one of these first.
    1.66 +	@param aObserver The observer of this interface.
    1.67 +	@return A new CRemConMediaInformationTarget, owned by the interface selector.
    1.68 +	*/
    1.69 +	IMPORT_C static CRemConMediaInformationTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, 
    1.70 +		MRemConMediaInformationTargetObserver& aObserver);
    1.71 +	
    1.72 +	/** Destructor */
    1.73 +	IMPORT_C ~CRemConMediaInformationTarget();
    1.74 +
    1.75 +public:
    1.76 +	/** Called by the client in response to a MrcmitoGetCurrentlyPlayingMetadata() call.
    1.77 +	Each call provides one of the attribute values requested.
    1.78 +	This is repeatedly called until all attributes requested have been supplied and then followed by Completed().
    1.79 +	@param aAttribute The ID of the attribute supplied.
    1.80 +	@param aValue A reference to a descriptor containing the attribute data.  
    1.81 +	This must be valid until Completed() has been called. 
    1.82 +	@see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata()
    1.83 +	@see CRemConMediaInformationTarget::Completed()
    1.84 +	*/
    1.85 +	IMPORT_C TInt AttributeValue( TMediaAttributeId aAttributeId, TDesC8& aAttributeData);
    1.86 +	
    1.87 +	/** Signal that all attributes requested by MrcmitoGetCurrentlyPlayingMetadata() have been supplied
    1.88 +	using the AttributeValue() method.
    1.89 +	@see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata()
    1.90 +	@see CRemConMediaInformationTarget::AttributeValue()
    1.91 +	*/
    1.92 +	IMPORT_C void Completed();
    1.93 +	
    1.94 +private:
    1.95 +	/** 
    1.96 +	Constructor.
    1.97 +	@param aInterfaceSelector The interface selector.
    1.98 +	@param aObserver The observer of this interface.
    1.99 +	*/
   1.100 +	CRemConMediaInformationTarget(CRemConInterfaceSelector& aInterfaceSelector, 
   1.101 +		MRemConMediaInformationTargetObserver& aObserver);
   1.102 +
   1.103 +	void ConstructL();
   1.104 +
   1.105 +private: // from CRemConInterfaceBase
   1.106 +	TAny* GetInterfaceIf(TUid aUid);
   1.107 +
   1.108 +private: // from MRemConInterfaceIf
   1.109 +	void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
   1.110 +
   1.111 +private: // utility
   1.112 +	void SendError(TInt aError);
   1.113 +	void ProcessMessage(const TDesC8& aData);
   1.114 +	
   1.115 +	static int NextMessageCb(TAny* aThis);
   1.116 +	void DoNextMessage();
   1.117 +private: // unowned
   1.118 +	MRemConMediaInformationTargetObserver& iObserver;
   1.119 +
   1.120 +private: // owned
   1.121 +	RRemConGetElementAttributesResponse iResponse;
   1.122 +
   1.123 +	RArray<TMediaAttributeId>  	iMediaAttributeIDs;
   1.124 +	TMediaAttributeIter 		iAttributeIterator;
   1.125 +	TBool						iInProgress;
   1.126 +	TSglQue<CRemConMediaInformationQueuedMessage> iMsgQueue;
   1.127 +	
   1.128 +	CAsyncCallBack* iNextMessageCallBack;
   1.129 +	};
   1.130 +
   1.131 +#endif // REMCONMEDIAINFORMATIONTARGET_H