|
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 Harvester's metadata collector header |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 #ifndef CMMDHMETADATACOLLECTOR_H |
|
25 #define CMMDHMETADATACOLLECTOR_H |
|
26 |
|
27 // INCLUDES |
|
28 #include <e32std.h> |
|
29 #include "cdssync.h" |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CCmMdhMediaserverContainer; |
|
33 class CUpnpAVControlPoint; |
|
34 class CSHA1; |
|
35 class CCmSearchResponseHash; |
|
36 |
|
37 // DATA TYPES |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * CCmMdhMetadataCollector |
|
43 * This is a class for metadata harvester server's |
|
44 * metadata collector component |
|
45 * |
|
46 * @since Series 60 3.0 |
|
47 */ |
|
48 class CCmMdhMetadataCollector: public CBase, public MCdsSyncObserver |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 */ |
|
55 static CCmMdhMetadataCollector* NewL( |
|
56 CCmMdhMediaserverContainer& aMediaserverContainer, |
|
57 CUpnpAVControlPoint& aControlPoint, |
|
58 TInt aSearchChunkSize, |
|
59 TInt aAddGranularity); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CCmMdhMetadataCollector(); |
|
65 |
|
66 public: // New functions |
|
67 |
|
68 /** |
|
69 * Observer callback for Content Directory Search function. |
|
70 * @since Series 60 2.0 |
|
71 * @param aSessionId |
|
72 * @param aErr UPnP error code. |
|
73 * @param aResult |
|
74 * @param aReturned |
|
75 * @param aMatches |
|
76 */ |
|
77 void CCmMdhMetadataCollector::CdsSearchResponse( |
|
78 TInt aSessionId, |
|
79 TInt aErr, |
|
80 const TDesC8& aResult, |
|
81 TInt aReturned, |
|
82 TInt aMatches); |
|
83 |
|
84 /** |
|
85 * Harvests a media server |
|
86 * @since Series 60 2.0 |
|
87 * @param aUuid uuid |
|
88 */ |
|
89 void HarvestMediaserverL( TDesC8& aUuid ); |
|
90 |
|
91 /** |
|
92 * Cancels harvest |
|
93 * @since Series 60 2.0 |
|
94 * @param aUuid uuid |
|
95 */ |
|
96 void CancelHarvest(); |
|
97 |
|
98 /** |
|
99 * Static timer callback function |
|
100 * @since Series 60 2.0 |
|
101 * @param aNy instance of this class |
|
102 */ |
|
103 static TInt TimeoutTimerCompletedL( TAny* aNy ); |
|
104 |
|
105 |
|
106 /** |
|
107 * Timer callback function |
|
108 * @since Series 60 2.0 |
|
109 */ |
|
110 TInt DoTimeoutTimerCompletedL(); |
|
111 |
|
112 |
|
113 public: // MCdsSyncObserver functions |
|
114 |
|
115 /** |
|
116 * Send progress data |
|
117 * @since S60 3.1 |
|
118 * @param aItemCount progressed items count |
|
119 */ |
|
120 void ProgressL( TInt aItemCount ); |
|
121 |
|
122 /** |
|
123 * Notification of processed chunk |
|
124 * @since S60 3.1 |
|
125 */ |
|
126 void ChunkCompleteL(); |
|
127 |
|
128 /** |
|
129 * Cds Sync completion callback function |
|
130 * @since S60 3.1 |
|
131 */ |
|
132 void SyncCompleteL(); |
|
133 |
|
134 /** |
|
135 * Cds Sync error callback function |
|
136 * @since S60 3.1 |
|
137 * @param aError error code |
|
138 */ |
|
139 void SyncErrorL( TInt aError ); |
|
140 |
|
141 private: |
|
142 |
|
143 /** |
|
144 * Constructor. |
|
145 */ |
|
146 CCmMdhMetadataCollector( |
|
147 CCmMdhMediaserverContainer& aMediaserverContainer, |
|
148 CUpnpAVControlPoint& aAvControlPoint, |
|
149 TInt aSearchChunkSize, |
|
150 TInt aAddGranularity); |
|
151 |
|
152 /** |
|
153 * By default Symbian 2nd phase constructor is private. |
|
154 */ |
|
155 void ConstructL(); |
|
156 |
|
157 /** |
|
158 * Harvests a media server |
|
159 * @since Series 60 2.0 |
|
160 */ |
|
161 void DoHarvestMediaserverL(); |
|
162 |
|
163 /** |
|
164 * Handles Content Directory search response processing. |
|
165 * @since Series 60 3.1 |
|
166 * @param aSessionId |
|
167 * @param aErr UPnP error code. |
|
168 * @param aResult |
|
169 * @param aReturned |
|
170 * @param aMatches |
|
171 */ |
|
172 void HandleSearchResponseL( TInt aSessionId, |
|
173 TInt aErr, |
|
174 const TDesC8& aResult, |
|
175 TInt aReturned, |
|
176 TInt aMatches ); |
|
177 private: // Data |
|
178 |
|
179 // Cds synchronizer (owned) |
|
180 CCdsSync* iCdsSync; |
|
181 |
|
182 RPointerArray<HBufC8> iSourceDataArray; // elements owned |
|
183 |
|
184 // reference to mediaserver container |
|
185 CCmMdhMediaserverContainer& iMediaserverContainer; |
|
186 |
|
187 // reference to av control point |
|
188 CUpnpAVControlPoint& iAvControlPoint; |
|
189 |
|
190 // timeout timer |
|
191 CPeriodic* iTimer; // owned |
|
192 |
|
193 TInt iSearchIndex; |
|
194 TInt iSearchRetryCount; |
|
195 TInt iSearchChunkSize; |
|
196 TInt iAddGranularity; |
|
197 TInt iSessionId; |
|
198 TInt iItemsToParse; |
|
199 TBool iResultIncomplete; |
|
200 TBool iCanceled; |
|
201 TBool iInit; |
|
202 |
|
203 HBufC8* iUuid; // owned |
|
204 HBufC8* iXmlToParse; // owned |
|
205 |
|
206 TInt iMediaServerId; |
|
207 |
|
208 #ifdef _DEBUG |
|
209 TTime iDebugTime; |
|
210 #endif // _DEBUG |
|
211 |
|
212 |
|
213 CSHA1* iHashGenerator; |
|
214 |
|
215 RPointerArray<CCmSearchResponseHash> iHashValues; |
|
216 |
|
217 TInt iTempStartIndex; |
|
218 |
|
219 }; |
|
220 |
|
221 #endif // CMMDHMETADATACOLLECTOR_H |
|
222 |
|
223 // End of File |