1 /* |
1 /* |
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
23 // System |
23 // System |
24 #include <e32base.h> |
24 #include <e32base.h> |
25 |
25 |
26 // upnpframework / avcontroller api |
26 // upnpframework / avcontroller api |
27 #include "upnpavdeviceobserver.h" // base class |
27 #include "upnpavdeviceobserver.h" // base class |
28 #include "upnpavbrowsingsessionobserver.h" // base class |
28 |
29 |
29 |
30 // FORWARD DECLARATIONS |
30 // FORWARD DECLARATIONS |
31 class CUPnPCommonUI; |
31 class CUPnPCommonUI; |
32 class CUpnpNoteHandler; |
32 class CUpnpNoteHandler; |
33 class MUPnPAVController; |
33 class MUPnPAVController; |
34 class CUpnpAVDevice; |
34 class CUpnpAVDevice; |
35 class MUPnPAVBrowsingSession; |
|
36 class CUpnpNoteHandler; |
35 class CUpnpNoteHandler; |
37 |
36 |
38 /** |
37 /** |
39 * A helper class that makes a method async. |
38 * A helper class that makes a method async. |
40 */ |
39 */ |
41 class CUpnpTaskResourceAllocator |
40 class CUpnpTaskResourceAllocator |
42 : public CAsyncOneShot |
41 : public CAsyncOneShot |
43 , public MUPnPAVDeviceObserver |
42 , public MUPnPAVDeviceObserver |
44 , public MUPnPAVBrowsingSessionObserver |
|
45 { |
43 { |
46 public: |
44 public: |
47 |
45 |
48 /** |
46 /** |
49 * List of upnp resource types available. |
47 * List of upnp resource types available. |
51 */ |
49 */ |
52 enum TUpnpResourceTypes |
50 enum TUpnpResourceTypes |
53 { |
51 { |
54 // open AV controller resource |
52 // open AV controller resource |
55 EResourceAvController = 0x0001, |
53 EResourceAvController = 0x0001, |
56 // start local mediaserver |
|
57 EResourceLocalMediaServer = 0x0002, |
|
58 // select an image-capable renderer |
54 // select an image-capable renderer |
59 EResourceSelectImageRenderer = 0x0100, |
55 EResourceSelectImageRenderer = 0x0100, |
60 // select a copy-capable server |
56 // select a copy-capable server |
61 EResourceSelectCopyServer = 0x0200, |
57 EResourceSelectCopyServer = 0x0200, |
62 // select a copy-capable server (display move title) |
58 // select a copy-capable server (display move title) |
171 |
167 |
172 void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ); |
168 void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ); |
173 |
169 |
174 void WLANConnectionLost(); |
170 void WLANConnectionLost(); |
175 |
171 |
176 |
|
177 public: // Call back methods of MUPnPAVBrowsingSessionObserver |
|
178 |
|
179 void BrowseResponse( |
|
180 const TDesC8& aBrowseResponse, |
|
181 TInt aError, |
|
182 TInt aMatches, |
|
183 TInt aTotalCount, |
|
184 const TDesC8& aUpdateId |
|
185 ); |
|
186 |
|
187 void SearchResponse( |
|
188 const TDesC8& aSearchResponse, |
|
189 TInt aError, |
|
190 TInt aMatches, |
|
191 TInt aTotalCount, |
|
192 const TDesC8& aUpdateId |
|
193 ); |
|
194 |
|
195 void SearchCapabilitiesResponse( |
|
196 TInt aError, |
|
197 const TDesC8& aSearchCapabilities |
|
198 ); |
|
199 |
|
200 void CreateContainerResponse( TInt aError, |
|
201 const TDesC8& aObjectId ); |
|
202 |
|
203 void DeleteObjectResponse( TInt aError ); |
|
204 |
|
205 void MediaServerDisappeared( |
|
206 TUPnPDeviceDisconnectedReason aReason ); |
|
207 |
|
208 void ReserveLocalMSServicesCompleted( TInt aError ); |
|
209 |
172 |
210 protected: |
173 protected: |
211 |
174 |
212 /** |
175 /** |
213 * states of the allocator |
176 * states of the allocator |
214 */ |
177 */ |
215 enum TAllocatorState |
178 enum TAllocatorState |
216 { |
179 { |
217 EStateIdle = 0, // class constructed, allocation not started yet |
180 EStateIdle = 0, // class constructed, allocation not started yet |
218 EStateAllocating, // allocation in progress |
181 EStateAllocating, // allocation in progress |
219 EStateWaitingForLMS, // rest done,waiting for local media server |
|
220 EStateReady, // allocation succesful |
182 EStateReady, // allocation succesful |
221 EStateError // allocation failed |
183 EStateError // allocation failed |
222 }; |
184 }; |
223 |
185 |
224 private: |
186 private: |
239 MUPnPAVController* iAVController; |
201 MUPnPAVController* iAVController; |
240 |
202 |
241 // selected device |
203 // selected device |
242 CUpnpAVDevice* iSelectedDevice; |
204 CUpnpAVDevice* iSelectedDevice; |
243 |
205 |
244 // the mediaserver keepalive browsing session |
|
245 MUPnPAVBrowsingSession* iMediaServerSession; |
|
246 |
|
247 // error occurred in some asynchronous operation |
206 // error occurred in some asynchronous operation |
248 TInt iErrorCode; |
207 TInt iErrorCode; |
249 |
|
250 // flag for local mediaserver start state |
|
251 TBool iLocalMSStarted; |
|
252 |
|
253 // flag for local mediaserver callback |
|
254 TBool iLocalMSSCompleted; |
|
255 |
|
256 |
208 |
257 }; |
209 }; |
258 |
210 |
259 |
211 |
260 #endif // UPNP_TASKRESOURCEALLOCATOR_H |
212 #endif // UPNP_TASKRESOURCEALLOCATOR_H |