51
|
1 |
// Copyright (c) 2008-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 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@publishedAll
|
|
21 |
@released
|
|
22 |
*/
|
|
23 |
|
|
24 |
#ifndef REMCONMEDIABROWSETARGETBASE_H
|
|
25 |
#define REMCONMEDIABROWSETARGETBASE_H
|
|
26 |
|
|
27 |
#include <remcondatabaseawaremedialibrarybrowseobserver.h>
|
|
28 |
#include <remcondatabaseawarenowplayingbrowseobserver.h>
|
|
29 |
#include <remcondatabaseunawaremedialibrarybrowseobserver.h>
|
|
30 |
#include <remcondatabaseunawarenowplayingbrowseobserver.h>
|
|
31 |
#include <remconmediabrowsetypes.h>
|
|
32 |
#include <remcon/remconinterfacebase.h>
|
|
33 |
#include <remcon/remconinterfaceif.h>
|
|
34 |
|
|
35 |
class RRemConGetFolderItemsResponse;
|
|
36 |
class RRemConGetItemAttributesResponse;
|
|
37 |
class RRemConGetPathResponse;
|
|
38 |
class TRemConMessageQueue;
|
|
39 |
/**
|
|
40 |
This interface enables the client to present a heirarchical view
|
|
41 |
of the local media library for browsing by a remote entity.
|
|
42 |
|
|
43 |
The view is a virtual filesystem and does not need to correspond
|
|
44 |
directly to any structure on local storage. It could for example
|
|
45 |
map onto a database of media content.
|
|
46 |
|
|
47 |
Each item in the media library is identified by a UID. At a
|
|
48 |
minimum this must uniquely identify an element within a folder.
|
|
49 |
For clients that support it the UID can be persistant accross
|
|
50 |
the entire virtual filesystem. In this case a media library
|
|
51 |
state cookie is used to ensure that that state is consistent
|
|
52 |
between the client and the remote device.
|
|
53 |
|
|
54 |
This interface does not have NewL()/NewLC, so the client should
|
|
55 |
use the object CRemConDatabaseAwareMediaBrowseTarget or
|
|
56 |
CRemConDatabaseUnawareMediaBrowseTarget to use its exported functions.
|
|
57 |
|
|
58 |
This class is only to be used by classes currently derived from it.
|
|
59 |
|
|
60 |
@see CRemConDatabaseAwareMediaBrowseTarget
|
|
61 |
@see CRemConDatabaseUnawareMediaBrowseTarget
|
|
62 |
*/
|
|
63 |
NONSHARABLE_CLASS(CRemConMediaBrowseTargetBase) : public CRemConInterfaceBase, public MRemConInterfaceIf
|
|
64 |
{
|
|
65 |
protected:
|
|
66 |
CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector,
|
|
67 |
MRemConDatabaseAwareMediaLibraryBrowseObserver& aMlObserver,
|
|
68 |
MRemConDatabaseAwareNowPlayingBrowseObserver& aNpObserver,
|
|
69 |
TUint16 aMediaLibraryStateCookie);
|
|
70 |
|
|
71 |
CRemConMediaBrowseTargetBase(CRemConInterfaceSelector& aInterfaceSelector,
|
|
72 |
MRemConDatabaseUnawareMediaLibraryBrowseObserver& aMlObserver,
|
|
73 |
MRemConDatabaseUnawareNowPlayingBrowseObserver& aNpObserver);
|
|
74 |
|
|
75 |
virtual ~CRemConMediaBrowseTargetBase();
|
|
76 |
|
|
77 |
virtual void BaseConstructL(TBool aSearchSupported);
|
|
78 |
|
|
79 |
void DoFolderListing(const TArray<TRemConItem>& aFolderListing,
|
|
80 |
TUint16 aMediaLibraryStateCookie,
|
|
81 |
TInt aResult);
|
|
82 |
|
|
83 |
void DoFolderUpResult(TUint aItemCount, TInt aResult);
|
|
84 |
void DoFolderDownResult(TUint aItemCount, TInt aResult);
|
|
85 |
|
|
86 |
void DoGetPathResult(TUint aItemCount,
|
|
87 |
TUint16 aMediaLibraryStateCookie,
|
|
88 |
TInt aResult);
|
|
89 |
|
|
90 |
void DoSearchResult(TUint aNumberItemsFound,
|
|
91 |
TUint16 aMediaLibraryStateCookie,
|
|
92 |
TInt aResult);
|
|
93 |
|
|
94 |
void DoMediaLibraryStateChange(TUint16 aMediaLibraryStateCookie);
|
|
95 |
|
|
96 |
void DoFolderItemResult(const TRemConItemUid& aFolderID,
|
|
97 |
const TDesC8& aFolderName,
|
|
98 |
TFolderItemType aFolderType,
|
|
99 |
TFolderItemPlayable aPlayable,
|
|
100 |
const TArray<TMediaElementAttribute>& aAttributes,
|
|
101 |
TInt aResult);
|
|
102 |
|
|
103 |
void DoMediaElementItemResult(const TRemConItemUid& aMediaID,
|
|
104 |
const TDesC8& aMediaName,
|
|
105 |
TMediaItemType aMediaType,
|
|
106 |
const TArray<TMediaElementAttribute>& aAttributes,
|
|
107 |
TInt aResult);
|
|
108 |
|
|
109 |
private: // From CRemConInterfaceBase
|
|
110 |
TAny* GetInterfaceIf(TUid aUid);
|
|
111 |
|
|
112 |
private: // From MRemConInterfaceIf
|
|
113 |
void MrcibNewMessage(TUint aOperationId,
|
|
114 |
const TDesC8& aData);
|
|
115 |
|
|
116 |
private: // Utility
|
|
117 |
void ProcessGetFolderItems(const TDesC8& aData);
|
|
118 |
void ProcessChangePath(const TDesC8& aData);
|
|
119 |
void ProcessGetItemAttributes(const TDesC8& aData);
|
|
120 |
void ProcessSearch(const TDesC8& aData);
|
|
121 |
void ProcessGetPath(const TDesC8& aData);
|
|
122 |
void ProcessMediaLibraryStateCookieUpdate(const TDesC8& aData);
|
|
123 |
|
|
124 |
void SendGetItemAttributesResponse(TInt aResult, const TDesC8& aData);
|
|
125 |
void SendGetFolderItemsResponse(TInt aResult, const TDesC8& aData);
|
|
126 |
void SendChangePathResponse(TUint aItemCount, TInt aResult);
|
|
127 |
void SendInternalNotificationResponse(TRemConMessageSubType aMsgSubType);
|
|
128 |
void SendNotificationResponse(TRemConMessageSubType aMsgSubType);
|
|
129 |
void SendSearchResponse(TInt aResult, TUint aNumberItemsFound, TUint16 aMediaLibraryStateCookie);
|
|
130 |
void SendMediaLibraryStateCookieUpdateResponse(TUint16 aMediaLibraryStateCookie);
|
|
131 |
|
|
132 |
static TInt NextMessageCb(TAny* aThis);
|
|
133 |
void DoNextMessage();
|
|
134 |
|
|
135 |
static TInt NextItemCallBack(TAny* aThis);
|
|
136 |
void RequestNextItem();
|
|
137 |
void DoItemComplete(TInt aResult);
|
|
138 |
|
|
139 |
void SendError(TUint8 aPduId,
|
|
140 |
TUint aOperationId,
|
|
141 |
TInt aError);
|
|
142 |
|
|
143 |
// Used for Gia
|
|
144 |
TInt ItemAttributesResult(const TArray<TMediaElementAttribute>& aAttributes);
|
|
145 |
TInt DoAttributeValue(TMediaAttributeId aAttributeId, const TDesC8& aAttributeData);
|
|
146 |
void DoAllAttributesCompleted(TInt aResult);
|
|
147 |
|
|
148 |
void AddToOperationQueue(TUint8 aPduId,
|
|
149 |
TInt aOperationId,
|
|
150 |
const TDesC8& aData);
|
|
151 |
TInt ParseGetItemAttributesRequest(const TDesC8& aData,
|
|
152 |
TRemConFolderScope& aScope,
|
|
153 |
TRemConItemUid& aItemUid,
|
|
154 |
TUint16& aMediaLibraryStateCookie);
|
|
155 |
void ProcessMediaElementItemResult(const TRemConItemUid& aMediaID,
|
|
156 |
const TDesC8& aMediaName,
|
|
157 |
TMediaItemType aMediaType,
|
|
158 |
const TArray<TMediaElementAttribute>& aAttributes,
|
|
159 |
TInt aResult);
|
|
160 |
void ProcessFolderItemResult(const TRemConItemUid& aFolderID,
|
|
161 |
const TDesC8& aFolderName,
|
|
162 |
TFolderItemType aFolderType,
|
|
163 |
TFolderItemPlayable aPlayable,
|
|
164 |
TInt aResult);
|
|
165 |
void ProcessGetItemAttributesResult(
|
|
166 |
const TArray<TMediaElementAttribute>& aAttributes,
|
|
167 |
TInt aResult);
|
|
168 |
|
|
169 |
inline TBool DatabaseAware() const;
|
|
170 |
|
|
171 |
private:
|
|
172 |
// Unowned
|
|
173 |
CRemConInterfaceSelector& iInterfaceSelector;
|
|
174 |
|
|
175 |
MRemConDatabaseAwareMediaLibraryBrowseObserver* iRcdamlbo;
|
|
176 |
MRemConDatabaseUnawareMediaLibraryBrowseObserver* iRcdumlbo;
|
|
177 |
|
|
178 |
MRemConDatabaseAwareNowPlayingBrowseObserver* iRcdanpbo;
|
|
179 |
MRemConDatabaseUnawareNowPlayingBrowseObserver* iRcdunpbo;
|
|
180 |
|
|
181 |
// Owned
|
|
182 |
CAsyncCallBack* iNextMessageCallBack;
|
|
183 |
CAsyncCallBack* iNextItemCallBack;
|
|
184 |
|
|
185 |
RBuf8 iOutBuf;
|
|
186 |
|
|
187 |
TUint16 iMediaLibraryStateCookie;
|
|
188 |
|
|
189 |
TBool iInProgress; // used internally to see if any operation is in progress
|
|
190 |
TRemConMessageQueue* iMsgQueue; // used to queue messages if another operation is in progress
|
|
191 |
|
|
192 |
RArray<TMediaAttributeId> iMediaAttributeIds; // used for Gfl and Gia to store requested attributes
|
|
193 |
TMediaAttributeIter iAttributeIterator; // provided to the client on requesting item attributes for Gfl and Gia
|
|
194 |
|
|
195 |
RArray<TMediaAttributeId> iNullArray;
|
|
196 |
TMediaAttributeIter iNullIterator; // Used for getting a folder item to perform a folder listing
|
|
197 |
|
|
198 |
TBool iGetFolderListing; // used to check Gfl is in progress
|
|
199 |
RRemConGetFolderItemsResponse* iGflResponse; // used to build up Gfl response from client
|
|
200 |
TRemConFolderScope iScope; // stored for use in async callbacks to get folder items
|
|
201 |
|
|
202 |
TBool iGetItemAttributes; // used to check Gia is in progress
|
|
203 |
TBool iSetAttributeValue; // used to check that client has set response if it returns KErrNone
|
|
204 |
RRemConGetItemAttributesResponse* iGiaResponse; // used to build up Gia response from client
|
|
205 |
|
|
206 |
TBool iSearchSupported;
|
|
207 |
TBool iSearchInProgress; // used to check Search is in progress
|
|
208 |
RBuf8 iSearchString; // used to store search string until request is complete
|
|
209 |
|
|
210 |
RRemConGetPathResponse* iGetPathResponse; // used to build up get path response
|
|
211 |
|
|
212 |
TBool iMlscUpdatePending;
|
|
213 |
TUint16 iLastMlscUpdate;
|
|
214 |
};
|
|
215 |
|
|
216 |
#endif // REMCONMEDIABROWSETARGETBASE_H
|
|
217 |
|