|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Metadata utility class definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __UPNPCONTENTMETADATAUTILITY_H__ |
|
24 #define __UPNPCONTENTMETADATAUTILITY_H__ |
|
25 |
|
26 |
|
27 // INCLUDES |
|
28 // System |
|
29 #include <e32base.h> |
|
30 #include <MCLFOperationObserver.h> |
|
31 #include <MCLFChangedItemObserver.h> |
|
32 #include <MCLFItem.h> |
|
33 #include <badesca.h> |
|
34 |
|
35 // upnp stack api |
|
36 #include <upnpitem.h> |
|
37 |
|
38 // upnpframework / avcontroller helper api |
|
39 #include "upnpconstantdefs.h" // for upnp-specific stuff |
|
40 |
|
41 // homeconnect internal |
|
42 #include "upnpcontentserverdefs.h" |
|
43 #include "upnpcontentserverhandler.h" |
|
44 |
|
45 |
|
46 // CONSTANTS |
|
47 const TInt KMaxRefreshCount = 3; |
|
48 |
|
49 // FORWARD DECLARATIONS |
|
50 class MCLFContentListingEngine; |
|
51 class MCLFItemListModel; |
|
52 class CUpnpCustomGrouper; |
|
53 class CUpnpPostFilter; |
|
54 class MUpnpMetadataObserver; |
|
55 class CUPnPMetaDataUtility; |
|
56 |
|
57 |
|
58 // CLASS DECLARATION |
|
59 |
|
60 /** |
|
61 * Class to collect files from phone to share. |
|
62 * This class collects the media files for Upnp content server to share |
|
63 * The files are obtained using Content Listing Framework. |
|
64 * |
|
65 * @since S60 3.1 |
|
66 */ |
|
67 class CUpnpContentMetadataUtility : public CBase, |
|
68 public MCLFOperationObserver |
|
69 { |
|
70 public: // Constructors and destructor |
|
71 |
|
72 /** |
|
73 * Two-phased constructor. |
|
74 */ |
|
75 static CUpnpContentMetadataUtility* NewL(); |
|
76 |
|
77 /** |
|
78 * Destructor. |
|
79 */ |
|
80 virtual ~CUpnpContentMetadataUtility(); |
|
81 |
|
82 public: // New functions |
|
83 |
|
84 /** |
|
85 * Updates metadata for the item |
|
86 * @since S60 3.1 |
|
87 * @param aMediaType Media type of oitem to be updated |
|
88 * @param aItem pointer to item |
|
89 * @param aFileName Reference to item filename |
|
90 * @return ETrue if the item was found from this model |
|
91 */ |
|
92 TBool UpdateMetadataL( const TUpnpMediaType& aMediaType, |
|
93 CUpnpItem* aItem, |
|
94 const TDesC& aFileName ); |
|
95 |
|
96 /** |
|
97 * Returns music model |
|
98 * @since S60 3.1 |
|
99 * @return MCLFItemListModel reference to model |
|
100 */ |
|
101 const MCLFItemListModel& MusicFiles() const; |
|
102 |
|
103 /** |
|
104 * Returns image model |
|
105 * @since S60 3.1 |
|
106 * @return MCLFItemListModel reference to model |
|
107 */ |
|
108 const MCLFItemListModel& ImageFiles() const; |
|
109 |
|
110 |
|
111 /** |
|
112 * Returns video model |
|
113 * @since S60 3.1 |
|
114 * @return MCLFItemListModel reference to model |
|
115 */ |
|
116 const MCLFItemListModel& VideoFiles() const; |
|
117 |
|
118 |
|
119 /** |
|
120 * Returns collection model |
|
121 * @since S60 3.1 |
|
122 * @return MCLFItemListModel reference to model |
|
123 */ |
|
124 const MCLFItemListModel& Collections() const; |
|
125 |
|
126 |
|
127 /** |
|
128 * Collects items from selected collection to the model |
|
129 * @since S60 3.1 |
|
130 * @param aNameOfCollection, collection name |
|
131 */ |
|
132 void CollectionItemsL( const TDesC& aNameOfCollection ); |
|
133 |
|
134 |
|
135 /** |
|
136 * Extract files from descriptor to the array |
|
137 * @since S60 3.1 |
|
138 * @param aFileArray, file name array |
|
139 * @param aFiles, file name descriptor |
|
140 */ |
|
141 void GetCollectionFileNamesL( CDesCArray& aFileArray, |
|
142 const TDesC& aFiles ) const; |
|
143 |
|
144 /** |
|
145 * Returns true if refresh is still ongoing |
|
146 * @since S60 3.1 |
|
147 * @return Status of the refresh operation |
|
148 */ |
|
149 TBool RefreshOngoing() const; |
|
150 |
|
151 /** |
|
152 * Clears all postfilters |
|
153 * @since S60 3.1 |
|
154 * |
|
155 */ |
|
156 void ClearPostFiltersL(); |
|
157 |
|
158 /** |
|
159 * Creates UPnP item from CLF Item |
|
160 * @since S60 3.1 |
|
161 * @param aCLFItem reference to original item |
|
162 * @param aParentId Parent id of the item |
|
163 * @return CUpnpItem new item allocation |
|
164 */ |
|
165 CUpnpItem* CreateItemL( const MCLFItem& aCLFItem, |
|
166 const TDesC8& aParentId ) const; |
|
167 |
|
168 /** |
|
169 * Creates UPnP item from CLF Item |
|
170 * @since S60 3.1 |
|
171 * @param aFullFilenme Filename of the item |
|
172 * @param aParentId Parent id of the item |
|
173 * @return CUpnpItem new item allocation |
|
174 */ |
|
175 CUpnpItem* CreateItemL( |
|
176 const TDesC& aFullFilename, |
|
177 const TDesC8& aParentId ) const; |
|
178 |
|
179 /** |
|
180 * Sets the callback for informing about refresh state |
|
181 * @since S60 3.1 |
|
182 * @param aHandler pointer to observer |
|
183 */ |
|
184 void SetCallback( MUpnpMetadataObserver* aObserver ); |
|
185 |
|
186 |
|
187 protected: // From MCLFOperationObserver |
|
188 |
|
189 /** |
|
190 * Abstract method to get list model operation events. This method is |
|
191 * called when an event is received. |
|
192 * @since S60 3.1 |
|
193 * @param aOperationEvent Operation event code of the event |
|
194 * @param aError System wide error code if the operation did not |
|
195 * succeed. |
|
196 */ |
|
197 void HandleOperationEventL( TCLFOperationEvent aOperationEvent, |
|
198 TInt aError ); |
|
199 |
|
200 protected: // From MCLFChangedItemObserver |
|
201 |
|
202 /** |
|
203 * From MCLFChangedItemObserver Method to handle changed item event. |
|
204 * @since S60 3.1 |
|
205 * @param aItemIDArray List of changed item IDs |
|
206 */ |
|
207 void HandleItemChangeL( const TArray<TCLFItemId>& aItemIDArray ); |
|
208 |
|
209 /** |
|
210 * From MCLFChangedItemObserver Method is used to handle errors in |
|
211 * changed item event. |
|
212 * @since S60 3.1 |
|
213 * @param aError System wide error code. |
|
214 */ |
|
215 void HandleError( TInt aError ); |
|
216 |
|
217 |
|
218 private: |
|
219 |
|
220 /** |
|
221 * C++ default constructor. |
|
222 */ |
|
223 CUpnpContentMetadataUtility(); |
|
224 |
|
225 /** |
|
226 * By default Symbian 2nd phase constructor is private. |
|
227 */ |
|
228 void ConstructL(); |
|
229 |
|
230 private: // Data |
|
231 // Content listing engine (owned) |
|
232 MCLFContentListingEngine* iEngine; |
|
233 |
|
234 // Content listing model for music (owned) |
|
235 MCLFItemListModel* iMusicModel; |
|
236 |
|
237 // Content listing model for images (owned) |
|
238 MCLFItemListModel* iImageModel; |
|
239 |
|
240 // Content listing model for videos (owned) |
|
241 MCLFItemListModel* iVideoModel; |
|
242 |
|
243 // Content listing model for collections (owned) |
|
244 MCLFItemListModel* iCollectionModel; |
|
245 |
|
246 // Custom grouper for collection grouping (owned) |
|
247 CUpnpCustomGrouper* iCustomGrouper; |
|
248 |
|
249 // Status to indicate if refresh operation is ongoing |
|
250 TBool iRefreshOngoing; |
|
251 |
|
252 // Keeps count of refreshed models |
|
253 TInt iRefreshCounter; |
|
254 |
|
255 // Post filter for filtering (owned) |
|
256 CUpnpPostFilter* iPostFilter; |
|
257 |
|
258 // Callback interface |
|
259 // not owned |
|
260 MUpnpMetadataObserver* iHandler; |
|
261 |
|
262 // The index maintained during the multiple CLF operations |
|
263 TInt iClfIndex; |
|
264 |
|
265 // Utility class for CLF |
|
266 CUPnPMetaDataUtility* iMetaDataUtility; // owned |
|
267 }; |
|
268 |
|
269 #endif // __UPNPCONTENTMETADATAUTILITY_H__ |
|
270 |
|
271 // End of File |