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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #ifndef REMCONMEDIAINFORMATIONTARGET_H
23 #define REMCONMEDIAINFORMATIONTARGET_H
26 #include <remcon/remconinterfacebase.h>
27 #include <remcon/remconinterfaceif.h>
28 #include <remconmediainformationtargetobserver.h>
30 class CRemConInterfaceSelector;
31 class RRemConGetElementAttributesResponse;
33 NONSHARABLE_CLASS(CRemConMediaInformationQueuedMessage): public CBase
36 static CRemConMediaInformationQueuedMessage* NewL(const TDesC8& aData);
37 ~CRemConMediaInformationQueuedMessage();
41 CRemConMediaInformationQueuedMessage();
42 void ConstructL(const TDesC8& aData);
50 Client-instantiable type supporting sending media information.
52 NONSHARABLE_CLASS(CRemConMediaInformationTarget) : public CRemConInterfaceBase,
53 public MRemConInterfaceIf
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.
64 IMPORT_C static CRemConMediaInformationTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector,
65 MRemConMediaInformationTargetObserver& aObserver);
68 IMPORT_C ~CRemConMediaInformationTarget();
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()
80 IMPORT_C TInt AttributeValue( TMediaAttributeId aAttributeId, TDesC8& aAttributeData);
82 /** Signal that all attributes requested by MrcmitoGetCurrentlyPlayingMetadata() have been supplied
83 using the AttributeValue() method.
84 @see MRemConMediaInformationTargetObserver::MrcmitoGetCurrentlyPlayingMetadata()
85 @see CRemConMediaInformationTarget::AttributeValue()
87 IMPORT_C void Completed();
92 @param aInterfaceSelector The interface selector.
93 @param aObserver The observer of this interface.
95 CRemConMediaInformationTarget(CRemConInterfaceSelector& aInterfaceSelector,
96 MRemConMediaInformationTargetObserver& aObserver);
100 private: // from CRemConInterfaceBase
101 TAny* GetInterfaceIf(TUid aUid);
103 private: // from MRemConInterfaceIf
104 void MrcibNewMessage(TUint aOperationId, const TDesC8& aData);
107 void SendError(TInt aError);
108 void ProcessMessage(const TDesC8& aData);
110 static int NextMessageCb(TAny* aThis);
111 void DoNextMessage();
113 MRemConMediaInformationTargetObserver& iObserver;
116 RRemConGetElementAttributesResponse* iResponse;
118 RArray<TMediaAttributeId> iMediaAttributeIDs;
119 TMediaAttributeIter iAttributeIterator;
121 TSglQue<CRemConMediaInformationQueuedMessage> iMsgQueue;
123 CAsyncCallBack* iNextMessageCallBack;
126 #endif // REMCONMEDIAINFORMATIONTARGET_H