16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 |
19 |
20 |
20 |
21 |
|
22 |
|
23 #ifndef UPNPLOCALITEMRESOLVER_H |
21 #ifndef UPNPLOCALITEMRESOLVER_H |
24 #define UPNPLOCALITEMRESOLVER_H |
22 #define UPNPLOCALITEMRESOLVER_H |
25 |
23 |
26 // INCLUDES |
24 // INCLUDES |
27 #include <e32base.h> |
25 #include <e32base.h> |
28 #include "upnpavbrowsingsessionobserver.h" // base class |
|
29 #include "upnpitemresolver.h" // base class |
26 #include "upnpitemresolver.h" // base class |
30 #include <upnpmediaserverclient.h> // a member |
27 #include "upnpthumbnailcreator.h" |
31 |
28 |
32 // FORWARD DECLARATIONS |
29 // FORWARD DECLARATIONS |
33 class MUPnPAVController; |
30 class MUPnPAVController; |
34 class MUPnPAVBrowsingSession; |
|
35 class CUpnpFileSharing; |
|
36 class CUpnpItem; |
31 class CUpnpItem; |
37 class CUpnpSecAccessController; |
32 class MUPnPItemResolverObserver; |
38 class CUPnPPeriodic; |
33 class MMPXCollectionHelper; |
|
34 class CUpnpAVDevice; |
|
35 class CUpnpTranscodeHelper; |
39 |
36 |
40 // CLASS DECLARATION |
37 // CLASS DECLARATION |
41 |
38 |
42 /** |
39 /** |
43 * Resolves remote upnp items from a plain item id. |
40 * Resolves remote upnp items from a plain item id. |
95 * |
92 * |
96 * @param aFilePath, local item to be resolved |
93 * @param aFilePath, local item to be resolved |
97 */ |
94 */ |
98 void ConstructL( const TDesC& aFilePath ); |
95 void ConstructL( const TDesC& aFilePath ); |
99 |
96 |
100 private: // Business logic methods |
|
101 |
97 |
102 /** |
98 private: |
103 * Allows/denied access to the files to which the given item's res- |
|
104 * elements are pointing. |
|
105 * |
|
106 * @since Series 60 3.2 |
|
107 * @param aItem the item |
|
108 * @param aAccessAllowed ETrue to allow and EFalse to deny the access |
|
109 */ |
|
110 void SetAccesstoItemResources( CUpnpItem& aItem, TBool aAccessAllowed ); |
|
111 |
|
112 public: // the interface |
|
113 |
99 |
114 /** |
100 /** |
115 * see UPnPItemResolver |
101 * see UPnPItemResolver |
116 */ |
102 */ |
117 void ResolveL( |
103 void ResolveL( |
118 MUPnPItemResolverObserver& aObserver |
104 MUPnPItemResolverObserver& aObserver |
119 ); |
105 , CUpnpAVDevice* aDevice = NULL); |
120 |
106 |
121 /** |
107 /** |
122 * see UPnPItemResolver |
108 * see UPnPItemResolver |
123 */ |
109 */ |
124 const CUpnpItem& Item() const; |
110 const CUpnpItem& Item() const; |
126 |
112 |
127 /** |
113 /** |
128 * see UPnPItemResolver |
114 * see UPnPItemResolver |
129 */ |
115 */ |
130 const CUpnpElement& Resource() const; |
116 const CUpnpElement& Resource() const; |
131 |
|
132 protected: // From CActive |
|
133 |
|
134 /** |
|
135 * See CActive |
|
136 */ |
|
137 void RunL(); |
|
138 |
|
139 /** |
|
140 * See CActive |
|
141 */ |
|
142 void DoCancel(); |
|
143 |
|
144 /** |
|
145 * See CActive |
|
146 */ |
|
147 TInt RunError( TInt aError ); |
|
148 |
|
149 protected: // overrides to CUPnPBrowsingSessionObserverProxy |
|
150 |
|
151 |
|
152 /** |
|
153 * see MUPnPAVSessionObserverBase |
|
154 */ |
|
155 void ReserveLocalMSServicesCompleted( TInt aError ); |
|
156 |
117 |
157 |
118 |
158 private: // private methods |
119 private: // private methods |
159 |
120 |
160 /** |
121 /** |
161 * initiate the sharing process |
122 * shares upnpitem |
162 */ |
123 */ |
163 void DoShareL(); |
124 void ShareL(); |
164 |
125 |
165 /** |
|
166 * initiate the unsharing process |
|
167 */ |
|
168 void DoUnshareL(); |
|
169 |
|
170 /** |
|
171 * Completes ongoing async operation |
|
172 */ |
|
173 void Complete( TInt aError ); |
|
174 |
|
175 /** |
126 /** |
176 * Clean up all resources |
127 * Clean up all resources |
177 */ |
128 */ |
178 void Cleanup(); |
129 void Cleanup(); |
179 |
130 |
180 /** |
131 /** |
181 * internal state machinery |
132 * checks if media "song" file has a album art |
|
133 * |
|
134 * @param aFileName filepath to media |
182 */ |
135 */ |
183 enum TInternalState { |
136 void SetAlbumArtResourceToItemL( const TDesC& aFileName ); |
184 EStateIdle, // no data, ready for starting |
|
185 EStateCreatingItem, // CreateItemFromFileLC called |
|
186 EStateStartingMS, // starting the local mediaserver |
|
187 EStateSharing, // sharing the local file |
|
188 EStateUnsharing, // unsharing the local file |
|
189 EStateReady, // Ready. Can free. |
|
190 EStateCancel // command to cancel ongoing process |
|
191 }; |
|
192 |
|
193 private: // Call back methods of MUPnPAVBrowsingSessionObserver |
|
194 |
|
195 /* Not used */ |
|
196 void BrowseResponse( |
|
197 const TDesC8& /*aBrowseResponse*/, |
|
198 TInt /*aError*/, |
|
199 TInt /*aMatches*/, |
|
200 TInt /*aTotalCount*/, |
|
201 const TDesC8& /*aUpdateId*/ |
|
202 ) {} |
|
203 void SearchResponse( |
|
204 const TDesC8& /*aSearchResponse*/, |
|
205 TInt /*aError*/, |
|
206 TInt /*aMatches*/, |
|
207 TInt /*aTotalCount*/, |
|
208 const TDesC8& /*aUpdateId*/ |
|
209 ) {} |
|
210 void SearchCapabilitiesResponse( |
|
211 TInt /*aError*/, |
|
212 const TDesC8& /*aSearchCapabilities*/ |
|
213 ) {} |
|
214 void CreateContainerResponse( TInt /*aError*/, |
|
215 const TDesC8& /*aObjectId*/ ) {} |
|
216 void DeleteObjectResponse( TInt /*aError*/ ) {} |
|
217 |
|
218 void MediaServerDisappeared( |
|
219 TUPnPDeviceDisconnectedReason /*aReason*/ ) {} |
|
220 |
137 |
|
138 private: |
|
139 void ThumbnailCreatorReady( TInt aError); |
221 |
140 |
222 private: // Timer callback |
141 void AddAlbumArtAndShareL(); |
223 /** |
142 |
224 * timer callback |
143 void AddThumbnailandShareL(); |
225 * unsharing is sometimes jammed and timer is used for cancelling |
|
226 * unshare call |
|
227 */ |
|
228 static TInt TimerExpired( TAny* aArg ); |
|
229 |
144 |
230 private: // members |
145 private: // members |
231 |
|
232 // local file path (Owned). |
|
233 HBufC* iFilePath; |
|
234 |
|
235 // avcontroller |
|
236 MUPnPAVController& iAvController; |
|
237 |
|
238 // temporary session for starting local mediaserver |
|
239 MUPnPAVBrowsingSession* iTempSession; |
|
240 |
146 |
241 // resource selector |
147 // resource selector |
242 MUPnPResourceSelector& iSelector; |
148 MUPnPResourceSelector& iSelector; |
243 |
149 |
244 // observer for this utility. Note: NOT OWNED |
150 // local file path (Owned). |
245 MUPnPItemResolverObserver* iObserver; |
151 HBufC* iFilePath; |
246 |
|
247 // state of the class |
|
248 TInternalState iState; |
|
249 |
152 |
250 // the first level browse result item (Owned). |
153 // the first level browse result item (Owned). |
251 CUpnpItem* iSharedItem; |
154 CUpnpItem* iSharedItem; |
252 |
155 |
253 // The selected resource within the last level item. |
156 // The selected resource within the last level item. |
254 const CUpnpElement* iResource; |
157 const CUpnpElement* iResource; |
255 |
158 |
256 // The mediaserver (required to get the server IP address) |
|
257 RUpnpMediaServerClient iMediaServer; |
|
258 |
|
259 // optimisation flags |
159 // optimisation flags |
260 TInt iOptimisationFlags; |
160 TInt iOptimisationFlags; |
261 |
161 |
262 // S60 file sharing metadata interface |
162 CUpnpThumbnailCreator* iThumbnailCreator; |
263 CUpnpFileSharing* iFileSharing; |
|
264 |
163 |
265 // security access controller |
164 MUPnPItemResolverObserver* iObserver; |
266 CUpnpSecAccessController* iAccessController; |
|
267 |
165 |
268 // wait until unshare finishes |
166 CUpnpItem* iLocalItem; |
269 CActiveSchedulerWait* iWait; |
|
270 |
167 |
271 // timer to cancel unshare |
168 // owned |
272 CUPnPPeriodic* iTimer; |
169 MMPXCollectionHelper* iCollectionHelper; |
|
170 |
|
171 CUpnpTranscodeHelper* iTranscodeHelper; |
273 }; |
172 }; |
274 |
173 |
275 |
174 |
276 #endif // UPNPLOCALITEMRESOLVER_H |
175 #endif // UPNPLOCALITEMRESOLVER_H |
277 |
176 |