1 /** @file |
|
2 * Copyright (c) 2005-2006 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: Describes UPnP metadata for item/container |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPMETADATA_H |
|
20 #define C_CUPNPMETADATA_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32cmn.h> |
|
25 |
|
26 #include <xml/dom/xmlengdom.h> |
|
27 #include <xml/dom/xmlengdocument.h> |
|
28 |
|
29 //rsfw |
|
30 #include <rsfwmountman.h> |
|
31 #include <rsfwmountentry.h> |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class RUpnpAVCPEngineMSClient; |
|
35 |
|
36 enum TMetadataStatus |
|
37 { |
|
38 EPreparingMetadata, |
|
39 EDownloadingMetadata, |
|
40 EUploadingMetadata |
|
41 }; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 /** |
|
45 * Describes UPnP metadata for item/container |
|
46 * |
|
47 * @lib AVCPEngineClient.lib |
|
48 * @since Series 60 3.1 |
|
49 */ |
|
50 class CUpnpMetadata : public CActive |
|
51 { |
|
52 |
|
53 public: // Constructors and destructor |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 IMPORT_C static CUpnpMetadata* NewL(RUpnpAVCPEngineMSClient& aSession); |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 virtual ~CUpnpMetadata(); |
|
62 |
|
63 public: // New functions |
|
64 /** |
|
65 * Return ID of object |
|
66 * |
|
67 * @return id |
|
68 */ |
|
69 IMPORT_C TPtrC8 IdL(); |
|
70 /** |
|
71 * Return title of object |
|
72 * |
|
73 * @return title |
|
74 */ |
|
75 IMPORT_C TPtrC8 TitleL(); |
|
76 /** |
|
77 * Set new title |
|
78 * |
|
79 * @param aTitle new title |
|
80 */ |
|
81 IMPORT_C void SetTitleL(const TDesC8& aTitle) ; |
|
82 /** |
|
83 * Return creator of object |
|
84 * |
|
85 * @return creator |
|
86 */ |
|
87 IMPORT_C TPtrC8 CreatorL(); |
|
88 /** |
|
89 * Set new creator |
|
90 * |
|
91 * @param aCreator new creator |
|
92 */ |
|
93 IMPORT_C void SetCreatorL(const TDesC8& aCreator); |
|
94 /** |
|
95 * Return class of object |
|
96 * |
|
97 * @return class |
|
98 */ |
|
99 IMPORT_C TPtrC8 ClassL(); |
|
100 /** |
|
101 * Set new class |
|
102 * |
|
103 * @param aClass new clas |
|
104 */ |
|
105 IMPORT_C void SetClassL(const TDesC8& aClass); |
|
106 /** |
|
107 * Return atrist of object |
|
108 * |
|
109 * @return atrist |
|
110 */ |
|
111 IMPORT_C TPtrC8 ArtistL(); |
|
112 /** |
|
113 * Set new atrist |
|
114 * |
|
115 * @param aArtist new atrist |
|
116 */ |
|
117 IMPORT_C void SetArtistL(const TDesC8& aArtist); |
|
118 /** |
|
119 * Return genre of object |
|
120 * |
|
121 * @return genre |
|
122 */ |
|
123 IMPORT_C TPtrC8 GenreL(); |
|
124 /** |
|
125 * Set new genre |
|
126 * |
|
127 * @param aGenre new genre |
|
128 */ |
|
129 IMPORT_C void SetGenreL(const TDesC8& aGenre); |
|
130 /** |
|
131 * Return album of object |
|
132 * |
|
133 * @return album |
|
134 */ |
|
135 IMPORT_C TPtrC8 AlbumL(); |
|
136 /** |
|
137 * Set new album |
|
138 * |
|
139 * @param aAlbum new album |
|
140 */ |
|
141 IMPORT_C void SetAlbumL(const TDesC8& aAlbum); |
|
142 /** |
|
143 * Return whole metada as XML |
|
144 * |
|
145 * @return document with metadata |
|
146 */ |
|
147 IMPORT_C RXmlEngDocument& AsXmlL(); |
|
148 /** |
|
149 * Fetch metadata for given path |
|
150 * |
|
151 * @param aPathName path name on MS's drive |
|
152 */ |
|
153 IMPORT_C void FetchL( const TDesC& aPathName ); |
|
154 /** |
|
155 * Fetch metadata for given path |
|
156 * |
|
157 * @param aPathName path name on MS's drive |
|
158 */ |
|
159 IMPORT_C void FetchL(const TDesC& aPathName, TRequestStatus& aStatus ); |
|
160 /** |
|
161 * Approve changes made in metadata and send them to update in MS |
|
162 */ |
|
163 IMPORT_C void CommitL(); |
|
164 /** |
|
165 * Approve changes made in metadata and send them to update in MS |
|
166 */ |
|
167 IMPORT_C void CommitL( TRequestStatus& aStatus ); |
|
168 protected: // from CActive |
|
169 /** |
|
170 * From CActive invoke when local request should be cancelled |
|
171 */ |
|
172 void DoCancel(); |
|
173 /** |
|
174 * From CActive invoke when RunL leaves |
|
175 */ |
|
176 TInt RunError( TInt aError ); |
|
177 /** |
|
178 * From CActive invoke when asynchronous action is completed |
|
179 */ |
|
180 void RunL(); |
|
181 private: |
|
182 /** |
|
183 * C++ default constructor. |
|
184 */ |
|
185 CUpnpMetadata(RUpnpAVCPEngineMSClient& aSession); |
|
186 |
|
187 /** |
|
188 * By default Symbian 2nd phase constructor is private. |
|
189 */ |
|
190 void ConstructL(); |
|
191 /** |
|
192 * Get object XML element from inside stored XML |
|
193 * |
|
194 * @param aObject element for object XML |
|
195 * @return ETrue if found, else EFalse |
|
196 */ |
|
197 TBool ObjectL(TXmlEngElement& aObject); |
|
198 /** |
|
199 * Get value of element with given name |
|
200 * (it has to be child of object element) |
|
201 * |
|
202 * @param aName name of element |
|
203 * @return value of element |
|
204 */ |
|
205 TPtrC8 GetElementL( const TDesC8& aName); |
|
206 /** |
|
207 * Set value of element with given name |
|
208 * (it is child of object element) |
|
209 * |
|
210 * @param aNamespace namespace of element |
|
211 * @param aName name of element |
|
212 * @param aValue value of element |
|
213 */ |
|
214 void SetElementL( const TDesC8& aNamespace, const TDesC8& aName, const TDesC8& aValue); |
|
215 /** |
|
216 * Normalize slashes in path |
|
217 * |
|
218 * @param aData path to normalize |
|
219 */ |
|
220 void Normalize(TDes8& aData); |
|
221 /** |
|
222 * Get metadata synchnronous |
|
223 */ |
|
224 void GetMetadataL(); |
|
225 /** |
|
226 * Get metadata asynchnronous |
|
227 */ |
|
228 void GetMetadataL(TRequestStatus& aStatus); |
|
229 /** |
|
230 * Parse metadata |
|
231 */ |
|
232 void ParseMetadataL(); |
|
233 /** |
|
234 * Prepare information about file, check if drive is upnp, normalize path slashes |
|
235 * |
|
236 * @param aPathName path to check |
|
237 */ |
|
238 void PrepareDataL(const TDesC& aPathName ); |
|
239 private: |
|
240 // sesion to server AVCPEngine |
|
241 RUpnpAVCPEngineMSClient& iSession; |
|
242 // UDN of MS |
|
243 HBufC8* iUuid; |
|
244 // pathname |
|
245 HBufC8* iPathName; |
|
246 // metadata |
|
247 HBufC8* iMetaData; |
|
248 // new metadata (used during Commit operation |
|
249 HBufC8* iUpdatedMetaData; |
|
250 // pointer to metadata |
|
251 TPtr8 iMetaDataPtr; |
|
252 // document with parsed metadata |
|
253 RXmlEngDocument iDocument; |
|
254 // client-interface to RS Fwk |
|
255 // RRsfwControl iRsfwControl; |
|
256 // command id (it's id of command used to fetch metadata) |
|
257 TInt iId; |
|
258 // package for id |
|
259 TPckg<TInt> iIdPckg; |
|
260 // size of metadata |
|
261 TInt iSize; |
|
262 // package for size |
|
263 TPckg<TInt> iSizePckg; |
|
264 // request status fo |
|
265 TRequestStatus* iClientStatus; |
|
266 // state of asynchrounus performing |
|
267 TMetadataStatus iState; |
|
268 RXmlEngDOMImplementation iDOMImpl; |
|
269 }; |
|
270 |
|
271 #endif // C_CUPNPMETADATA_H |
|
272 |
|
273 // End of File |
|