|
1 /* |
|
2 * Copyright (c) 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: AO that monitors for device events |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 // upnp stack api |
|
25 #include <upnpsettings.h> |
|
26 |
|
27 // upnpframework / avcontroller api |
|
28 #include "upnpavdevice.h" |
|
29 #include "upnpavdeviceobserver.h" |
|
30 #include "upnpavdevicelist.h" |
|
31 |
|
32 // avcontroller internal |
|
33 #include "upnpavcontrolleractive.h" |
|
34 #include "upnpavrenderingsessionimpl.h" |
|
35 #include "upnpavbrowsingsessionimpl.h" |
|
36 #include "upnpavconnectionactive.h" |
|
37 #include "upnpfileuploadsessionimpl.h" |
|
38 #include "upnpfiledownloadsessionimpl.h" |
|
39 |
|
40 _LIT( KComponentLogfile, "upnpavcontrollerclient.txt"); |
|
41 #include "upnplog.h" |
|
42 |
|
43 |
|
44 // ======== MEMBER FUNCTIONS ======== |
|
45 |
|
46 // -------------------------------------------------------------------------- |
|
47 // CUPnPAVControllerActive::NewL |
|
48 // Two-phase construct |
|
49 // -------------------------------------------------------------------------- |
|
50 CUPnPAVControllerActive* CUPnPAVControllerActive::NewL() |
|
51 { |
|
52 CUPnPAVControllerActive* self = CUPnPAVControllerActive::NewLC(); |
|
53 CleanupStack::Pop( self ); |
|
54 return self; |
|
55 } |
|
56 |
|
57 // -------------------------------------------------------------------------- |
|
58 // CUPnPAVControllerActive::NewLC |
|
59 // Two-phase construct |
|
60 // -------------------------------------------------------------------------- |
|
61 CUPnPAVControllerActive* CUPnPAVControllerActive::NewLC() |
|
62 { |
|
63 CUPnPAVControllerActive* self = new (ELeave) CUPnPAVControllerActive; |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 return self; |
|
67 } |
|
68 |
|
69 // -------------------------------------------------------------------------- |
|
70 // CUPnPAVControllerActive::CUPnPAVControllerActive |
|
71 // Two-phase construct |
|
72 // -------------------------------------------------------------------------- |
|
73 CUPnPAVControllerActive::CUPnPAVControllerActive() : |
|
74 CActive( EPriorityStandard ), |
|
75 iRespBufSizePkg( iRespBufSize ), |
|
76 iDiscoveredPkg( iDiscovered ), |
|
77 iAlive( ETrue ), |
|
78 iReleaseState( EStateReleasable ) |
|
79 { |
|
80 CActiveScheduler::Add( this ); |
|
81 } |
|
82 |
|
83 // -------------------------------------------------------------------------- |
|
84 // CUPnPAVControllerActive::Release |
|
85 // Destructor |
|
86 // -------------------------------------------------------------------------- |
|
87 void CUPnPAVControllerActive::Release() |
|
88 { |
|
89 __LOG( "CUPnPAVControllerActive::Release" ); |
|
90 |
|
91 if( iReleaseState == EStateReleasable ) |
|
92 { |
|
93 __LOG( "Release - ok to delete" ); |
|
94 delete this; |
|
95 } |
|
96 else if( iReleaseState == EStateWLANLost ) |
|
97 { |
|
98 __LOG( "Release - waiting for release" ); |
|
99 // Still sending WLAN lost messages, cannot delete |
|
100 // To be released |
|
101 iReleaseState = EStateWaitingForRelease; |
|
102 } |
|
103 else |
|
104 { |
|
105 __LOG( "Release - do nothing, double release" ); |
|
106 } |
|
107 } |
|
108 |
|
109 // -------------------------------------------------------------------------- |
|
110 // CUPnPAVControllerActive::~CUPnPAVControllerActive |
|
111 // Destructor |
|
112 // -------------------------------------------------------------------------- |
|
113 CUPnPAVControllerActive::~CUPnPAVControllerActive() |
|
114 { |
|
115 __LOG( "CUPnPAVControllerActive::~CUPnPAVControllerActive" ); |
|
116 Cancel(); |
|
117 delete iConnectionActive; |
|
118 iBrowsingSessions.ResetAndDestroy(); |
|
119 iRenderingSessions.ResetAndDestroy(); |
|
120 iDownloadSessions.ResetAndDestroy(); |
|
121 iUploadSessions.ResetAndDestroy(); |
|
122 |
|
123 iServer.Close(); |
|
124 } |
|
125 |
|
126 // -------------------------------------------------------------------------- |
|
127 // CUPnPAVControllerActive::ConstructL |
|
128 // Two-phase construct |
|
129 // -------------------------------------------------------------------------- |
|
130 void CUPnPAVControllerActive::ConstructL() |
|
131 { |
|
132 __LOG( "CUPnPAVControllerActive::ConstructL" ); |
|
133 |
|
134 // Check the aip |
|
135 TInt iap = 0; |
|
136 CUpnpSettings* settings = CUpnpSettings::NewL( KCRUidUPnPStack ); |
|
137 settings->Get( CUpnpSettings::KUPnPStackIapId, iap ); |
|
138 delete settings; |
|
139 User::LeaveIfError( iap ); |
|
140 User::LeaveIfError( iServer.Connect() ); |
|
141 |
|
142 iConnectionActive = CUPnPAVConnectionActive::NewL( iServer, *this ); |
|
143 iConnectionActive->StartMonitoring(); |
|
144 |
|
145 iServer.StartUp( iStatus ); // Start up the AV Control Point and wait |
|
146 // until it has been started. |
|
147 SetActive(); |
|
148 iWait.Start(); |
|
149 __LOG1( "ConstructL - iStatus = %d", iStatus.Int() ); |
|
150 User::LeaveIfError( iStatus.Int() ); |
|
151 } |
|
152 |
|
153 // -------------------------------------------------------------------------- |
|
154 // CUPnPAVControllerActive::RunL |
|
155 // From CActive |
|
156 // -------------------------------------------------------------------------- |
|
157 void CUPnPAVControllerActive::RunL() |
|
158 { |
|
159 __LOG( "CUPnPAVControllerActive::RunL" ); |
|
160 |
|
161 if( iWait.IsStarted() ) |
|
162 { |
|
163 iWait.AsyncStop(); // AV Control Point has been started, continue |
|
164 // Construction |
|
165 return; |
|
166 } |
|
167 |
|
168 switch( iStatus.Int() ) |
|
169 { |
|
170 case EAVControllerDeviceCompleted: |
|
171 { |
|
172 HBufC8* tempBuf = HBufC8::NewLC( iRespBufSize ); |
|
173 TPtr8 ptr = tempBuf->Des(); |
|
174 if( iServer.GetDevice( ptr ) == KErrNone ) |
|
175 { |
|
176 // Create a device and make a callback |
|
177 CUpnpAVDevice* tempDev = CUpnpAVDevice::NewLC(); |
|
178 RDesReadStream stream( ptr ); |
|
179 CleanupClosePushL( stream ); |
|
180 stream >> *tempDev; |
|
181 CleanupStack::PopAndDestroy( &stream ); |
|
182 |
|
183 if( iDiscovered == EAVDeviceDiscovered ) |
|
184 { |
|
185 // Discovered a device |
|
186 iDeviceObserver->UPnPDeviceDiscovered( *tempDev ); |
|
187 } |
|
188 else |
|
189 { |
|
190 // Device disappeared |
|
191 iDeviceObserver->UPnPDeviceDisappeared( *tempDev ); |
|
192 } |
|
193 CleanupStack::PopAndDestroy( tempDev ); |
|
194 |
|
195 // Activate again if needed (it's possible to remove and set |
|
196 // the device obs from the UPnPDeviceDiscovered or |
|
197 // UPnPDeviceDisappeared callbacks |
|
198 if( !IsActive() ) |
|
199 { |
|
200 iServer.DeviceRequest( iDiscoveredPkg, iRespBufSizePkg, |
|
201 iStatus ); |
|
202 SetActive(); |
|
203 } |
|
204 } |
|
205 else |
|
206 { |
|
207 // Can't handle the error anyhow, just log it |
|
208 __LOG1( "RunL - error: %d", iStatus.Int() ); |
|
209 } |
|
210 CleanupStack::PopAndDestroy( tempBuf ); |
|
211 } |
|
212 break; |
|
213 |
|
214 default: |
|
215 { |
|
216 __PANICD( __FILE__, __LINE__ ); |
|
217 } |
|
218 } |
|
219 } |
|
220 |
|
221 // -------------------------------------------------------------------------- |
|
222 // CUPnPAVControllerActive::DoCancel |
|
223 // From CActive |
|
224 // -------------------------------------------------------------------------- |
|
225 void CUPnPAVControllerActive::DoCancel() |
|
226 { |
|
227 __LOG( "CUPnPAVControllerActive::DoCancel" ); |
|
228 if( !iDeviceObserver ) |
|
229 { |
|
230 __LOG( "iServer.CancelStartUp()" ); |
|
231 // Not a real cancel, but if this is the last session, we'll shut |
|
232 // down the server immidiately |
|
233 iServer.CancelStartUp(); |
|
234 } |
|
235 else |
|
236 { |
|
237 iServer.CancelDeviceRequest(); |
|
238 } |
|
239 } |
|
240 |
|
241 // -------------------------------------------------------------------------- |
|
242 // CUPnPAVControllerActive::RunError |
|
243 // From CActive |
|
244 // -------------------------------------------------------------------------- |
|
245 TInt CUPnPAVControllerActive::RunError( |
|
246 TInt aError |
|
247 ) |
|
248 { |
|
249 // Can't handle the error anyhow, just log it |
|
250 __LOG1( "CUPnPAVControllerActive::RunError: %d", aError ); |
|
251 |
|
252 return KErrNone; |
|
253 } |
|
254 |
|
255 // -------------------------------------------------------------------------- |
|
256 // CUPnPAVControllerActive::SetDeviceObserver |
|
257 // Sets device observer |
|
258 // -------------------------------------------------------------------------- |
|
259 void CUPnPAVControllerActive::SetDeviceObserver( |
|
260 MUPnPAVDeviceObserver& aObserver ) |
|
261 { |
|
262 __LOG( "CUPnPAVControllerActive::SetDeviceObserver" ); |
|
263 |
|
264 // Set the observer and make an async request to the server to receive |
|
265 // device callbacks |
|
266 __ASSERTD( !iDeviceObserver, __FILE__, __LINE__ ); |
|
267 |
|
268 if( iAlive ) |
|
269 { |
|
270 iDeviceObserver = &aObserver; |
|
271 |
|
272 iServer.DeviceRequest( iDiscoveredPkg, iRespBufSizePkg, iStatus ); |
|
273 SetActive(); |
|
274 } |
|
275 } |
|
276 |
|
277 // -------------------------------------------------------------------------- |
|
278 // CUPnPAVControllerActive::DeviceObserver |
|
279 // Returns device observer |
|
280 // -------------------------------------------------------------------------- |
|
281 MUPnPAVDeviceObserver* CUPnPAVControllerActive::DeviceObserver() |
|
282 { |
|
283 __LOG( "CUPnPAVControllerActive::DeviceObserver" ); |
|
284 |
|
285 return iDeviceObserver; |
|
286 } |
|
287 |
|
288 // -------------------------------------------------------------------------- |
|
289 // CUPnPAVControllerActive::RemoveDeviceObserver |
|
290 // Removes device observer |
|
291 // -------------------------------------------------------------------------- |
|
292 void CUPnPAVControllerActive::RemoveDeviceObserver() |
|
293 { |
|
294 __LOG( "CUPnPAVControllerActive::RemoveDeviceObserver" ); |
|
295 |
|
296 Cancel(); |
|
297 |
|
298 iDeviceObserver = NULL; |
|
299 } |
|
300 |
|
301 // -------------------------------------------------------------------------- |
|
302 // CUPnPAVControllerActive::GetMediaServersL |
|
303 // Returns a list of media servers |
|
304 // -------------------------------------------------------------------------- |
|
305 CUpnpAVDeviceList* CUPnPAVControllerActive::GetMediaServersL() |
|
306 { |
|
307 __LOG( "CUPnPAVControllerActive::GetMediaServersL" ); |
|
308 |
|
309 if( !iAlive ) |
|
310 { |
|
311 User::Leave( KErrDisconnected ); |
|
312 } |
|
313 |
|
314 CUpnpAVDeviceList* tempList = NULL; |
|
315 |
|
316 TPckg<TAVControllerDeviceListType> type( EAVMediaServer ); |
|
317 |
|
318 TInt respBufSize = 0; |
|
319 TPckg<TInt> respBufSizePkg( respBufSize ); |
|
320 TInt err = iServer.GetDeviceListSize( type, respBufSizePkg ); |
|
321 |
|
322 if( err == KErrNone ) |
|
323 { |
|
324 |
|
325 HBufC8* tempBuf = HBufC8::NewLC( respBufSize ); |
|
326 TPtr8 ptr = tempBuf->Des(); |
|
327 |
|
328 err = iServer.GetDeviceList( ptr ); |
|
329 if( err == KErrNone ) |
|
330 { |
|
331 // Create a device and make a callback |
|
332 tempList = CUpnpAVDeviceList::NewL(); |
|
333 RDesReadStream stream( ptr ); |
|
334 stream >> *tempList; |
|
335 stream.Close(); |
|
336 } |
|
337 else |
|
338 { |
|
339 User::Leave( err ); |
|
340 } |
|
341 CleanupStack::PopAndDestroy( tempBuf ); |
|
342 } |
|
343 else |
|
344 { |
|
345 User::Leave( err ); |
|
346 } |
|
347 return tempList; |
|
348 } |
|
349 |
|
350 // -------------------------------------------------------------------------- |
|
351 // CUPnPAVControllerActive::GetMediaRenderersL |
|
352 // Returns a list of media renderes |
|
353 // -------------------------------------------------------------------------- |
|
354 CUpnpAVDeviceList* CUPnPAVControllerActive::GetMediaRenderersL() |
|
355 { |
|
356 __LOG( "CUPnPAVControllerActive::GetMediaRenderersL" ); |
|
357 |
|
358 if( !iAlive ) |
|
359 { |
|
360 User::Leave( KErrDisconnected ); |
|
361 } |
|
362 |
|
363 CUpnpAVDeviceList* tempList = NULL; |
|
364 |
|
365 TPckg<TAVControllerDeviceListType> type( EAVMediaRenderer ); |
|
366 |
|
367 TInt respBufSize = 0; |
|
368 TPckg<TInt> respBufSizePkg( respBufSize ); |
|
369 TInt err = iServer.GetDeviceListSize( type, respBufSizePkg ); |
|
370 |
|
371 if( err == KErrNone ) |
|
372 { |
|
373 |
|
374 HBufC8* tempBuf = HBufC8::NewLC( respBufSize ); |
|
375 TPtr8 ptr = tempBuf->Des(); |
|
376 |
|
377 err = iServer.GetDeviceList( ptr ); |
|
378 if( err == KErrNone ) |
|
379 { |
|
380 // Create a device and make a callback |
|
381 tempList = CUpnpAVDeviceList::NewL(); |
|
382 RDesReadStream stream( ptr ); |
|
383 stream >> *tempList; |
|
384 stream.Close(); |
|
385 } |
|
386 else |
|
387 { |
|
388 User::Leave( err ); |
|
389 } |
|
390 CleanupStack::PopAndDestroy( tempBuf ); |
|
391 } |
|
392 else |
|
393 { |
|
394 User::Leave( err ); |
|
395 } |
|
396 return tempList; |
|
397 } |
|
398 |
|
399 // -------------------------------------------------------------------------- |
|
400 // CUPnPAVControllerActive::StartBrowsingSessionL |
|
401 // Starts a browsing session |
|
402 // -------------------------------------------------------------------------- |
|
403 MUPnPAVBrowsingSession& CUPnPAVControllerActive::StartBrowsingSessionL( |
|
404 const CUpnpAVDevice& aDevice ) |
|
405 { |
|
406 __LOG( "CUPnPAVControllerActive::StartBrowsingSessionL" ); |
|
407 |
|
408 if( !iAlive ) |
|
409 { |
|
410 User::Leave( KErrDisconnected ); |
|
411 } |
|
412 |
|
413 if( aDevice.DeviceType() != CUpnpAVDevice::EMediaServer ) |
|
414 { |
|
415 User::Leave( KErrNotSupported ); |
|
416 } |
|
417 CUPnPAVBrowsingSessionImpl* sessionImpl = |
|
418 CUPnPAVBrowsingSessionImpl::NewL( iServer, aDevice ); |
|
419 iBrowsingSessions.Append( sessionImpl ); |
|
420 return *sessionImpl; |
|
421 } |
|
422 |
|
423 // -------------------------------------------------------------------------- |
|
424 // CUPnPAVControllerActive::StopBrowsingSession |
|
425 // Stops a browsing session |
|
426 // -------------------------------------------------------------------------- |
|
427 void CUPnPAVControllerActive::StopBrowsingSession( |
|
428 MUPnPAVBrowsingSession& aSession ) |
|
429 { |
|
430 __LOG( "CUPnPAVControllerActive::StopBrowsingSession" ); |
|
431 |
|
432 CUPnPAVBrowsingSessionImpl* sessionImpl = |
|
433 static_cast<CUPnPAVBrowsingSessionImpl*>(&aSession); |
|
434 TInt count = iBrowsingSessions.Count(); |
|
435 for( TInt i = 0; i < count; i++ ) |
|
436 { |
|
437 if( iBrowsingSessions[ i ] == sessionImpl ) |
|
438 { |
|
439 delete iBrowsingSessions[ i ]; |
|
440 iBrowsingSessions[ i ] = NULL; |
|
441 i = count; |
|
442 } |
|
443 } |
|
444 } |
|
445 |
|
446 // -------------------------------------------------------------------------- |
|
447 // CUPnPAVControllerActive::StartRenderingSessionL |
|
448 // Starts a rendering session |
|
449 // -------------------------------------------------------------------------- |
|
450 MUPnPAVRenderingSession& CUPnPAVControllerActive::StartRenderingSessionL( |
|
451 const CUpnpAVDevice& aDevice ) |
|
452 { |
|
453 __LOG( "CUPnPAVControllerActive::StartRenderingSessionL" ); |
|
454 |
|
455 if( !iAlive ) |
|
456 { |
|
457 User::Leave( KErrDisconnected ); |
|
458 } |
|
459 |
|
460 if( aDevice.DeviceType() != CUpnpAVDevice::EMediaRenderer ) |
|
461 { |
|
462 User::Leave( KErrNotSupported ); |
|
463 } |
|
464 CUPnPAVRenderingSessionImpl* sessionImpl = |
|
465 CUPnPAVRenderingSessionImpl::NewL( iServer, aDevice ); |
|
466 iRenderingSessions.Append( sessionImpl ); |
|
467 return *sessionImpl; |
|
468 } |
|
469 |
|
470 // -------------------------------------------------------------------------- |
|
471 // CUPnPAVControllerActive::StopRenderingSession |
|
472 // Stops a rendering session |
|
473 // -------------------------------------------------------------------------- |
|
474 void CUPnPAVControllerActive::StopRenderingSession( |
|
475 MUPnPAVRenderingSession& aSession ) |
|
476 { |
|
477 __LOG( "CUPnPAVControllerActive::StopRenderingSession" ); |
|
478 |
|
479 CUPnPAVRenderingSessionImpl* sessionImpl = |
|
480 static_cast<CUPnPAVRenderingSessionImpl*>(&aSession); |
|
481 TInt count = iRenderingSessions.Count(); |
|
482 for( TInt i = 0; i < count; i++ ) |
|
483 { |
|
484 if( iRenderingSessions[ i ] == sessionImpl ) |
|
485 { |
|
486 delete iRenderingSessions[ i ]; |
|
487 iRenderingSessions[ i ] = NULL; |
|
488 i = count; |
|
489 } |
|
490 } |
|
491 } |
|
492 |
|
493 // -------------------------------------------------------------------------- |
|
494 // CUPnPAVControllerActive::StartUploadSessionL |
|
495 // Starts an upload session |
|
496 // -------------------------------------------------------------------------- |
|
497 MUPnPFileUploadSession& CUPnPAVControllerActive::StartUploadSessionL( |
|
498 const CUpnpAVDevice& aDevice ) |
|
499 { |
|
500 __LOG( "CUPnPAVControllerActive::StartUploadSessionL" ); |
|
501 |
|
502 if( !iAlive ) |
|
503 { |
|
504 User::Leave( KErrDisconnected ); |
|
505 } |
|
506 |
|
507 if( aDevice.DeviceType() != CUpnpAVDevice::EMediaServer ) |
|
508 { |
|
509 User::Leave( KErrNotSupported ); |
|
510 } |
|
511 CUPnPFileUploadSessionImpl* sessionImpl = |
|
512 CUPnPFileUploadSessionImpl::NewL( iServer, aDevice ); |
|
513 iUploadSessions.Append( sessionImpl ); |
|
514 return *sessionImpl; |
|
515 } |
|
516 |
|
517 // -------------------------------------------------------------------------- |
|
518 // CUPnPAVControllerActive::StopUploadSession |
|
519 // Stops an upload session |
|
520 // -------------------------------------------------------------------------- |
|
521 void CUPnPAVControllerActive::StopUploadSession( |
|
522 MUPnPFileUploadSession& aSession ) |
|
523 { |
|
524 __LOG( "CUPnPAVControllerActive::StopUploadSession" ); |
|
525 |
|
526 CUPnPFileUploadSessionImpl* sessionImpl = |
|
527 static_cast<CUPnPFileUploadSessionImpl*>(&aSession); |
|
528 TInt count = iUploadSessions.Count(); |
|
529 for( TInt i = 0; i < count; i++ ) |
|
530 { |
|
531 if( iUploadSessions[ i ] == sessionImpl ) |
|
532 { |
|
533 delete iUploadSessions[ i ]; |
|
534 iUploadSessions[ i ] = NULL; |
|
535 i = count; |
|
536 } |
|
537 } |
|
538 |
|
539 } |
|
540 |
|
541 // -------------------------------------------------------------------------- |
|
542 // CUPnPAVControllerActive::StartDownloadSessionL |
|
543 // Starts a download session |
|
544 // -------------------------------------------------------------------------- |
|
545 MUPnPFileDownloadSession& CUPnPAVControllerActive::StartDownloadSessionL( |
|
546 const CUpnpAVDevice& aDevice ) |
|
547 { |
|
548 __LOG( "CUPnPAVControllerActive::StartDownloadSessionL" ); |
|
549 |
|
550 if( !iAlive ) |
|
551 { |
|
552 User::Leave( KErrDisconnected ); |
|
553 } |
|
554 |
|
555 if( aDevice.DeviceType() != CUpnpAVDevice::EMediaServer ) |
|
556 { |
|
557 User::Leave( KErrNotSupported ); |
|
558 } |
|
559 CUPnPFileDownloadSessionImpl* sessionImpl = |
|
560 CUPnPFileDownloadSessionImpl::NewL( iServer, aDevice ); |
|
561 iDownloadSessions.Append( sessionImpl ); |
|
562 return *sessionImpl; |
|
563 } |
|
564 |
|
565 // -------------------------------------------------------------------------- |
|
566 // CUPnPAVControllerActive::StopDownloadSession |
|
567 // Stops a download session |
|
568 // -------------------------------------------------------------------------- |
|
569 void CUPnPAVControllerActive::StopDownloadSession( |
|
570 MUPnPFileDownloadSession& aSession ) |
|
571 { |
|
572 __LOG( "CUPnPAVControllerActive::StopDownloadSession" ); |
|
573 |
|
574 CUPnPFileDownloadSessionImpl* sessionImpl = |
|
575 static_cast<CUPnPFileDownloadSessionImpl*>(&aSession); |
|
576 TInt count = iDownloadSessions.Count(); |
|
577 for( TInt i = 0; i < count; i++ ) |
|
578 { |
|
579 if( iDownloadSessions[ i ] == sessionImpl ) |
|
580 { |
|
581 delete iDownloadSessions[ i ]; |
|
582 //iRenderingSessions.Remove( i ); |
|
583 iDownloadSessions[ i ] = NULL; |
|
584 i = count; |
|
585 } |
|
586 } |
|
587 |
|
588 } |
|
589 |
|
590 // -------------------------------------------------------------------------- |
|
591 // CUPnPAVControllerActive::ConnectionLost |
|
592 // Wlan disconnected |
|
593 // -------------------------------------------------------------------------- |
|
594 void CUPnPAVControllerActive::ConnectionLost() |
|
595 { |
|
596 __LOG( "CUPnPAVControllerActive::ConnectionLost" ); |
|
597 |
|
598 iAlive = EFalse; |
|
599 |
|
600 iReleaseState = EStateWLANLost; |
|
601 |
|
602 TInt count = iRenderingSessions.Count(); |
|
603 for( TInt i = 0; i < count; i++ ) |
|
604 { |
|
605 if( iRenderingSessions.Count() && iRenderingSessions[ i ] ) |
|
606 { |
|
607 iRenderingSessions[ i ]->WLANConnectionLost(); |
|
608 } |
|
609 } |
|
610 |
|
611 count = iBrowsingSessions.Count(); |
|
612 for( TInt i = 0; i < count; i++ ) |
|
613 { |
|
614 if( iBrowsingSessions.Count() && iBrowsingSessions[ i ] ) |
|
615 { |
|
616 iBrowsingSessions[ i ]->WLANConnectionLost(); |
|
617 } |
|
618 } |
|
619 |
|
620 count = iUploadSessions.Count(); |
|
621 for( TInt i = 0; i < count; i++ ) |
|
622 { |
|
623 if( iUploadSessions.Count() && iUploadSessions[ i ] ) |
|
624 { |
|
625 iUploadSessions[ i ]->WLANConnectionLost(); |
|
626 } |
|
627 } |
|
628 |
|
629 count = iDownloadSessions.Count(); |
|
630 for( TInt i = 0; i < count; i++ ) |
|
631 { |
|
632 if( iDownloadSessions.Count() && iDownloadSessions[ i ] ) |
|
633 { |
|
634 iDownloadSessions[ i ]->WLANConnectionLost(); |
|
635 } |
|
636 } |
|
637 |
|
638 if( iDeviceObserver ) |
|
639 { |
|
640 iDeviceObserver->WLANConnectionLost(); |
|
641 } |
|
642 |
|
643 if( iReleaseState == EStateWaitingForRelease ) |
|
644 { |
|
645 __LOG( "ConnectionLost - release" ); |
|
646 delete this; |
|
647 } |
|
648 |
|
649 iReleaseState = EStateReleasable; |
|
650 } |
|
651 // end of file |