|
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: AVController server side root class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 // upnp stack api |
|
25 #include <upnpdevice.h> |
|
26 #include <upnpcontainer.h> |
|
27 #include <upnpservice.h> |
|
28 #include <upnpstatevariable.h> |
|
29 #include <upnpaction.h> |
|
30 #include <upnpobjectlist.h> |
|
31 #include <upnpavcontrolpoint.h> |
|
32 |
|
33 // upnpframework / avcontroller api |
|
34 #include "upnpavdeviceobserver.h" |
|
35 #include "upnpavdevicelist.h" |
|
36 |
|
37 // avcontroller internal |
|
38 #include "upnpavcontrollerimpl.h" |
|
39 #include "upnpavcontrollerserver.h" |
|
40 #include "upnpavdispatcher.h" |
|
41 #include "upnpavdeviceextended.h" |
|
42 #include "upnpdevicerepository.h" |
|
43 #include "upnpaverrorhandler.h" |
|
44 #include "upnpplaybacksession.h" |
|
45 #include "upnpbrowsingsession.h" |
|
46 #include "upnpdevicediscoverymessage.h" |
|
47 |
|
48 #include "upnpuploadsession.h" |
|
49 #include "upnpdownloadsession.h" |
|
50 |
|
51 |
|
52 |
|
53 #include "upnpsecaccesscontroller.h" |
|
54 |
|
55 _LIT( KComponentLogfile, "upnpavcontrollerserver.txt"); |
|
56 #include "upnplog.h" |
|
57 |
|
58 // ======== MEMBER FUNCTIONS ======== |
|
59 |
|
60 // -------------------------------------------------------------------------- |
|
61 // CUPnPAVControllerImpl::NewL |
|
62 // See upnpavcontrollerimpl.h |
|
63 // -------------------------------------------------------------------------- |
|
64 CUPnPAVControllerImpl* CUPnPAVControllerImpl::NewL( |
|
65 RUpnpMediaServerClient& aClient, |
|
66 CUpnpAVControllerServer& aServer ) |
|
67 { |
|
68 CUPnPAVControllerImpl* self = new (ELeave) CUPnPAVControllerImpl( |
|
69 aClient, aServer ); |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL(); |
|
72 CleanupStack::Pop( self ); |
|
73 return self; |
|
74 } |
|
75 |
|
76 // -------------------------------------------------------------------------- |
|
77 // CUPnPAVControllerImpl::CUPnPAVControllerImpl |
|
78 // See upnpavcontrollerimpl.h |
|
79 // -------------------------------------------------------------------------- |
|
80 CUPnPAVControllerImpl::CUPnPAVControllerImpl( |
|
81 RUpnpMediaServerClient& aClient, |
|
82 CUpnpAVControllerServer& aServer ) : |
|
83 iMediaServer( aClient ), |
|
84 iServer( aServer ), |
|
85 iDeviceDiscoveryEnabled( EFalse), |
|
86 iDeviceMsgQue( CUpnpDeviceDiscoveryMessage::LinkOffset() ), |
|
87 iDeviceMsgQueIter( iDeviceMsgQue ) |
|
88 { |
|
89 } |
|
90 |
|
91 // -------------------------------------------------------------------------- |
|
92 // CUPnPAVControllerImpl::~CUPnPAVControllerImpl |
|
93 // See upnpavcontrollerimpl.h |
|
94 // -------------------------------------------------------------------------- |
|
95 CUPnPAVControllerImpl::~CUPnPAVControllerImpl() |
|
96 { |
|
97 __LOG( "CUPnPAVControllerImpl::~CUPnPAVControllerImpl" ); |
|
98 |
|
99 delete iDeviceRespBuf; |
|
100 delete iDeviceListRespBuf; |
|
101 |
|
102 iPlaybackSessions.ResetAndDestroy(); |
|
103 iBrowsingSessions.ResetAndDestroy(); |
|
104 |
|
105 iUploadSessions.ResetAndDestroy(); |
|
106 iDownloadSessions.ResetAndDestroy(); |
|
107 |
|
108 CUpnpDeviceDiscoveryMessage* devMsg = NULL; |
|
109 iDeviceMsgQueIter.SetToFirst(); |
|
110 while ( ( devMsg = iDeviceMsgQueIter++ ) != NULL ) |
|
111 { |
|
112 iDeviceMsgQue.Remove( *devMsg ); |
|
113 delete devMsg; |
|
114 }; |
|
115 |
|
116 delete iConnectionMsg; iConnectionMsg = NULL; |
|
117 delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL; |
|
118 } |
|
119 |
|
120 // -------------------------------------------------------------------------- |
|
121 // CUPnPAVControllerImpl::ConstructL |
|
122 // See upnpavcontrollerimpl.h |
|
123 // -------------------------------------------------------------------------- |
|
124 void CUPnPAVControllerImpl::ConstructL() |
|
125 { |
|
126 __LOG( "CUPnPAVControllerImpl::ConstructL" ); |
|
127 |
|
128 } |
|
129 |
|
130 // -------------------------------------------------------------------------- |
|
131 // CUPnPAVControllerImpl::ConnectionLost |
|
132 // See upnpavcontrollerimpl.h |
|
133 // -------------------------------------------------------------------------- |
|
134 void CUPnPAVControllerImpl::ConnectionLost() |
|
135 { |
|
136 if( iConnectionMsg ) |
|
137 { |
|
138 iConnectionMsg->Complete( EAVControllerConnectionLost ); |
|
139 delete iConnectionMsg; iConnectionMsg = NULL; |
|
140 |
|
141 } |
|
142 else |
|
143 { |
|
144 // No msg, no can do |
|
145 } |
|
146 |
|
147 } |
|
148 |
|
149 // -------------------------------------------------------------------------- |
|
150 // CUPnPAVControllerImpl::DeviceDiscoveredL |
|
151 // See upnpavcontrollerimpl.h |
|
152 // -------------------------------------------------------------------------- |
|
153 void CUPnPAVControllerImpl::DeviceDiscoveredL( |
|
154 CUpnpAVDeviceExtended& aDevice ) |
|
155 { |
|
156 __LOG( "CUPnPAVControllerImpl::DeviceDiscoveredL" ); |
|
157 |
|
158 if( aDevice.DeviceType() == CUpnpAVDevice::EMediaServer && |
|
159 ( aDevice.Local() ) ) |
|
160 { |
|
161 TInt i; |
|
162 TInt count = iPlaybackSessions.Count(); |
|
163 for( i = 0; i < count; i++ ) |
|
164 { |
|
165 iPlaybackSessions[ i ]->SetLocalMSUuidL( aDevice.Uuid() ); |
|
166 } |
|
167 |
|
168 count = iBrowsingSessions.Count(); |
|
169 for( i = 0; i < count; i++ ) |
|
170 { |
|
171 iBrowsingSessions[ i ]->SetLocalMSUuidL( aDevice.Uuid() ); |
|
172 } |
|
173 |
|
174 } |
|
175 else if( iDeviceDiscoveryEnabled ) |
|
176 { |
|
177 CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL( aDevice ); |
|
178 |
|
179 if( iDeviceDiscoveryMsg ) |
|
180 { |
|
181 CleanupStack::PushL( tempDev ); |
|
182 |
|
183 delete iDeviceRespBuf; iDeviceRespBuf = NULL; |
|
184 iDeviceRespBuf = tempDev->ToDes8L(); |
|
185 |
|
186 CleanupStack::PopAndDestroy( tempDev ); |
|
187 |
|
188 // Write back to the client that a device was discovered |
|
189 // of the device and the size |
|
190 TPckg<TAVControllerDeviceDiscovery> resp0( EAVDeviceDiscovered ); |
|
191 TPckg<TInt> resp1( iDeviceRespBuf->Length() ); |
|
192 |
|
193 iDeviceDiscoveryMsg->WriteL( 0, resp0 ); |
|
194 iDeviceDiscoveryMsg->WriteL( 1, resp1 ); |
|
195 |
|
196 iDeviceDiscoveryMsg->Complete( EAVControllerDeviceCompleted ); |
|
197 delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL; |
|
198 } |
|
199 else |
|
200 { |
|
201 // Msg not valid, client is still processing.. |
|
202 //add the discovered device to queue |
|
203 CUpnpDeviceDiscoveryMessage* tmpDevMsg = |
|
204 CUpnpDeviceDiscoveryMessage::NewL( |
|
205 tempDev, EAVDeviceDiscovered ); |
|
206 iDeviceMsgQue.AddLast( *tmpDevMsg ); |
|
207 } |
|
208 } |
|
209 } |
|
210 |
|
211 // -------------------------------------------------------------------------- |
|
212 // CUPnPAVControllerImpl::DeviceDisappearedL |
|
213 // See upnpavcontrollerimpl.h |
|
214 // -------------------------------------------------------------------------- |
|
215 void CUPnPAVControllerImpl::DeviceDisappearedL( |
|
216 CUpnpAVDeviceExtended& aDevice ) |
|
217 { |
|
218 __LOG( "CUPnPAVControllerImpl::DeviceDisappearedL" ); |
|
219 |
|
220 // Go through browsing and rendering sessions and report if their |
|
221 // device or the local MS disappeared |
|
222 TBool localMs = EFalse; |
|
223 if( aDevice.DeviceType() == CUpnpAVDevice::EMediaServer && |
|
224 ( aDevice.Local() ) ) |
|
225 { |
|
226 __LOG( "CUPnPAVControllerImpl::DeviceDisappearedL\ |
|
227 - Local MS disappeared!" ); |
|
228 |
|
229 // Local MS disappeared |
|
230 localMs = ETrue; |
|
231 } |
|
232 |
|
233 TInt i; |
|
234 TInt count = iPlaybackSessions.Count(); |
|
235 for( i = 0; i < count; i++ ) |
|
236 { |
|
237 if( ( iPlaybackSessions[ i ]->Uuid() == aDevice.Uuid() ) || |
|
238 ( localMs ) ) |
|
239 { |
|
240 iPlaybackSessions[ i ]->DeviceDisappearedL( aDevice ); |
|
241 } |
|
242 } |
|
243 |
|
244 count = iBrowsingSessions.Count(); |
|
245 for( i = 0; i < count; i++ ) |
|
246 { |
|
247 if( ( iBrowsingSessions[ i ]->Uuid() == aDevice.Uuid() ) || |
|
248 ( localMs ) ) |
|
249 { |
|
250 iBrowsingSessions[ i ]->DeviceDisappearedL( aDevice ); |
|
251 } |
|
252 } |
|
253 |
|
254 count = iUploadSessions.Count(); |
|
255 for( i = 0; i < count; i++ ) |
|
256 { |
|
257 if( iUploadSessions[ i ]->Uuid() == aDevice.Uuid() ) |
|
258 { |
|
259 iUploadSessions[ i ]->DeviceDisappearedL( aDevice ); |
|
260 } |
|
261 } |
|
262 |
|
263 count = iDownloadSessions.Count(); |
|
264 for( i = 0; i < count; i++ ) |
|
265 { |
|
266 if( iDownloadSessions[ i ]->Uuid() == aDevice.Uuid() ) |
|
267 { |
|
268 iDownloadSessions[ i ]->DeviceDisappearedL( aDevice ); |
|
269 } |
|
270 } |
|
271 |
|
272 if( iDeviceDiscoveryEnabled ) |
|
273 { |
|
274 // Create a device (buffer) |
|
275 CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL( aDevice ); |
|
276 |
|
277 if( iDeviceDiscoveryMsg ) |
|
278 { |
|
279 CleanupStack::PushL( tempDev ); |
|
280 |
|
281 delete iDeviceRespBuf; iDeviceRespBuf = NULL; |
|
282 iDeviceRespBuf = tempDev->ToDes8L(); |
|
283 CleanupStack::PopAndDestroy( tempDev ); |
|
284 |
|
285 // Write back to the client that a device was discovered |
|
286 // and the size of the device |
|
287 TPckg<TAVControllerDeviceDiscovery> resp0( |
|
288 EAVDeviceDisappeared ); |
|
289 TPckg<TInt> resp1( iDeviceRespBuf->Length() ); |
|
290 |
|
291 iDeviceDiscoveryMsg->WriteL( 0, resp0 ); |
|
292 iDeviceDiscoveryMsg->WriteL( 1, resp1 ); |
|
293 |
|
294 iDeviceDiscoveryMsg->Complete( EAVControllerDeviceCompleted ); |
|
295 delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL; |
|
296 } |
|
297 else |
|
298 { |
|
299 // Msg not valid, client is still processing.. |
|
300 //add the disappeared device to queue |
|
301 |
|
302 CUpnpDeviceDiscoveryMessage* tmpDevMsg = |
|
303 CUpnpDeviceDiscoveryMessage::NewL( |
|
304 tempDev, EAVDeviceDisappeared ); |
|
305 iDeviceMsgQue.AddLast( *tmpDevMsg ); |
|
306 } |
|
307 } |
|
308 } |
|
309 |
|
310 // -------------------------------------------------------------------------- |
|
311 // CUPnPAVControllerImpl::EnableDeviceDiscoveryL |
|
312 // See upnpavcontrollerimpl.h |
|
313 // -------------------------------------------------------------------------- |
|
314 void CUPnPAVControllerImpl::EnableDeviceDiscoveryL( |
|
315 const RMessage2& aMessage ) |
|
316 { |
|
317 __LOG( "CUPnPAVControllerImpl::EnableDeviceDiscoveryL" ); |
|
318 |
|
319 __ASSERTD( !iDeviceDiscoveryMsg, __FILE__, __LINE__ ); |
|
320 |
|
321 if( !iDeviceDiscoveryEnabled ) |
|
322 { |
|
323 //iDispatcher.RegisterForDeviceDiscoveryL( *this ); |
|
324 iDeviceDiscoveryEnabled = ETrue; |
|
325 } |
|
326 |
|
327 iDeviceDiscoveryMsg = new (ELeave) RMessage2( aMessage ); |
|
328 |
|
329 // Check queu's |
|
330 if( !iDeviceMsgQue.IsEmpty() ) |
|
331 { |
|
332 CUpnpDeviceDiscoveryMessage* devMsg = iDeviceMsgQue.First(); |
|
333 __ASSERTD( devMsg, __FILE__, __LINE__ ); |
|
334 CUpnpAVDevice* dev = devMsg->Device(); |
|
335 TAVControllerDeviceDiscovery devMsgType = devMsg->MsgType(); |
|
336 DequeDeviceL( *dev, devMsgType ); |
|
337 iDeviceMsgQue.Remove( *devMsg ); |
|
338 delete devMsg; |
|
339 } |
|
340 else |
|
341 { |
|
342 // Empty else |
|
343 } |
|
344 } |
|
345 |
|
346 // -------------------------------------------------------------------------- |
|
347 // CUPnPAVControllerImpl::DequeDeviceL |
|
348 // See upnpavcontrollerimpl.h |
|
349 // -------------------------------------------------------------------------- |
|
350 void CUPnPAVControllerImpl::DequeDeviceL( const CUpnpAVDevice& aDevice, |
|
351 TAVControllerDeviceDiscovery aType ) |
|
352 { |
|
353 __LOG( "CUPnPAVControllerImpl::DequeDeviceL" ); |
|
354 |
|
355 TPckg<TAVControllerDeviceDiscovery> resp0( aType ); |
|
356 iDeviceDiscoveryMsg->WriteL( 0, resp0 ); |
|
357 |
|
358 HBufC8* tmp = aDevice.ToDes8L(); |
|
359 CleanupStack::PushL( tmp ); |
|
360 |
|
361 TPckg<TInt> resp1( tmp->Length() ); |
|
362 iDeviceDiscoveryMsg->WriteL( 1, resp1 ); |
|
363 |
|
364 CleanupStack::Pop( tmp ); |
|
365 |
|
366 delete iDeviceRespBuf; iDeviceRespBuf = NULL; |
|
367 iDeviceRespBuf = tmp; |
|
368 |
|
369 iDeviceDiscoveryMsg->Complete( EAVControllerDeviceCompleted ); |
|
370 delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL; |
|
371 |
|
372 |
|
373 } |
|
374 |
|
375 // -------------------------------------------------------------------------- |
|
376 // CUPnPAVControllerImpl::GetDeviceL |
|
377 // See upnpavcontrollerimpl.h |
|
378 // -------------------------------------------------------------------------- |
|
379 void CUPnPAVControllerImpl::GetDeviceL( const RMessage2& aMessage ) |
|
380 { |
|
381 __LOG1( "CUPnPAVControllerImpl::GetDeviceL, 0x%d", iDeviceRespBuf ); |
|
382 |
|
383 aMessage.WriteL( 0, *iDeviceRespBuf ); |
|
384 aMessage.Complete( KErrNone ); |
|
385 delete iDeviceRespBuf; iDeviceRespBuf = NULL; |
|
386 } |
|
387 |
|
388 // -------------------------------------------------------------------------- |
|
389 // CUPnPAVControllerImpl::DisableDeviceDiscoveryL |
|
390 // See upnpavcontrollerimpl.h |
|
391 // -------------------------------------------------------------------------- |
|
392 void CUPnPAVControllerImpl::DisableDeviceDiscoveryL( |
|
393 /*const RMessage2& aMessage*/ ) |
|
394 { |
|
395 __LOG( "CUPnPAVControllerImpl::DisableDeviceDiscoveryL" ); |
|
396 |
|
397 if( iDeviceDiscoveryEnabled ) |
|
398 { |
|
399 //iDispatcher.UnRegisterDeviceDiscovery( *this ); |
|
400 iDeviceDiscoveryEnabled = EFalse; |
|
401 } |
|
402 |
|
403 if( iDeviceDiscoveryMsg ) |
|
404 { |
|
405 iDeviceDiscoveryMsg->Complete( KErrCancel ); |
|
406 delete iDeviceDiscoveryMsg; iDeviceDiscoveryMsg = NULL; |
|
407 } |
|
408 } |
|
409 |
|
410 // -------------------------------------------------------------------------- |
|
411 // CUPnPAVControllerImpl::GetDeviceListSizeL |
|
412 // See upnpavcontrollerimpl.h |
|
413 // -------------------------------------------------------------------------- |
|
414 void CUPnPAVControllerImpl::GetDeviceListSizeL( const RMessage2& aMessage ) |
|
415 { |
|
416 __LOG( "CUPnPAVControllerImpl::GetDeviceListSizeL" ); |
|
417 |
|
418 // Get the device list from the av control point, create a response buffer |
|
419 // and write the size of the list back to the client |
|
420 TAVControllerDeviceListType deviceListType; |
|
421 TPckg<TAVControllerDeviceListType> resp0( deviceListType ); |
|
422 aMessage.ReadL( 0, resp0 ); |
|
423 |
|
424 delete iDeviceListRespBuf; iDeviceListRespBuf = NULL; |
|
425 |
|
426 const RPointerArray<CUpnpAVDeviceExtended>& devList = |
|
427 iServer.DeviceRepository().DeviceList(); |
|
428 |
|
429 if( deviceListType == EAVMediaServer ) |
|
430 { |
|
431 CUpnpAVDeviceList* tempList = CUpnpAVDeviceList::NewLC(); |
|
432 |
|
433 TInt count = devList.Count(); |
|
434 for( TInt i = 0; i < count; i++ ) |
|
435 { |
|
436 if( devList[ i ]->DeviceType() == CUpnpAVDevice::EMediaServer ) |
|
437 { |
|
438 if( devList[ i ]->PInfoReceived() && |
|
439 !devList[ i ]->Local() ) |
|
440 { |
|
441 CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL( |
|
442 *devList[i] ); |
|
443 // Ownership of tempDev transferred |
|
444 tempList->AppendDeviceL( *tempDev ); |
|
445 } |
|
446 } |
|
447 } |
|
448 iDeviceListRespBuf = tempList->ToDes8L(); |
|
449 CleanupStack::PopAndDestroy( tempList ); |
|
450 } |
|
451 else |
|
452 { |
|
453 CUpnpAVDeviceList* tempList = CUpnpAVDeviceList::NewLC(); |
|
454 |
|
455 TInt count = devList.Count(); |
|
456 for( TInt i = 0; i < count; i++ ) |
|
457 { |
|
458 if( devList[ i ]->DeviceType() == CUpnpAVDevice::EMediaRenderer ) |
|
459 { |
|
460 if( devList[ i ]->PInfoReceived() ) |
|
461 { |
|
462 CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL( |
|
463 *devList[i] ); |
|
464 // Ownership of tempDev transferred |
|
465 tempList->AppendDeviceL( *tempDev ); |
|
466 } |
|
467 } |
|
468 } |
|
469 iDeviceListRespBuf = tempList->ToDes8L(); |
|
470 CleanupStack::PopAndDestroy( tempList ); |
|
471 } |
|
472 |
|
473 // Write the size back to the client |
|
474 TPckg<TInt> resp1( iDeviceListRespBuf->Length() ); |
|
475 aMessage.WriteL( 1, resp1 ); |
|
476 aMessage.Complete( KErrNone ); |
|
477 } |
|
478 |
|
479 // -------------------------------------------------------------------------- |
|
480 // CUPnPAVControllerImpl::GetDeviceListL |
|
481 // See upnpavcontrollerimpl.h |
|
482 // -------------------------------------------------------------------------- |
|
483 void CUPnPAVControllerImpl::GetDeviceListL( const RMessage2& aMessage ) |
|
484 { |
|
485 __LOG1( "CUPnPAVControllerImpl::GetDeviceListL, 0x%d", |
|
486 iDeviceListRespBuf ); |
|
487 |
|
488 // Write the device list back to the client |
|
489 aMessage.WriteL( 0, *iDeviceListRespBuf ); |
|
490 aMessage.Complete( KErrNone ); |
|
491 delete iDeviceListRespBuf; iDeviceListRespBuf = NULL; |
|
492 } |
|
493 |
|
494 // -------------------------------------------------------------------------- |
|
495 // CUPnPAVControllerImpl::CreateRenderingSessionL |
|
496 // See upnpavcontrollerimpl.h |
|
497 // -------------------------------------------------------------------------- |
|
498 void CUPnPAVControllerImpl::CreateRenderingSessionL( |
|
499 const RMessage2& aMessage ) |
|
500 { |
|
501 __LOG1( "CUPnPAVControllerImpl::CreateRenderingSessionL, 0x%d", |
|
502 aMessage.Int0() ); |
|
503 |
|
504 // Create a rendering session |
|
505 TInt id = aMessage.Int0(); |
|
506 |
|
507 // Read the device UID |
|
508 TInt len = aMessage.GetDesMaxLength( 1 ); |
|
509 HBufC8* buf = HBufC8::NewLC( len ); |
|
510 TPtr8 ptr( buf->Des() ); |
|
511 User::LeaveIfError( aMessage.Read( 1, ptr ) ); |
|
512 |
|
513 CUPnPPlaybackSession* tempPtr = CUPnPPlaybackSession::NewL( |
|
514 iMediaServer, iServer, id, *buf ); |
|
515 |
|
516 CleanupStack::PopAndDestroy( buf ); |
|
517 iPlaybackSessions.Append( tempPtr ); |
|
518 |
|
519 aMessage.Complete( KErrNone ); |
|
520 } |
|
521 |
|
522 // -------------------------------------------------------------------------- |
|
523 // CUPnPAVControllerImpl::DestroyRenderingSessionL |
|
524 // See upnpavcontrollerimpl.h |
|
525 // -------------------------------------------------------------------------- |
|
526 void CUPnPAVControllerImpl::DestroyRenderingSessionL( |
|
527 const RMessage2& aMessage ) |
|
528 { |
|
529 __LOG1( "CUPnPAVControllerImpl::DestroyRenderingSessionL, 0x%d", |
|
530 aMessage.Int0() ); |
|
531 |
|
532 // Find and delete a rendering session |
|
533 TInt id = aMessage.Int0(); |
|
534 TInt count = iPlaybackSessions.Count(); |
|
535 TBool found = EFalse; |
|
536 for( TInt i = 0; i < count; i++ ) |
|
537 { |
|
538 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
539 { |
|
540 delete iPlaybackSessions[ i ]; |
|
541 iPlaybackSessions.Remove( i ); |
|
542 found = ETrue; |
|
543 i = count; |
|
544 } |
|
545 } |
|
546 if( found ) |
|
547 { |
|
548 aMessage.Complete( KErrNone ); |
|
549 } |
|
550 else |
|
551 { |
|
552 aMessage.Complete( KErrNotFound ); |
|
553 } |
|
554 } |
|
555 |
|
556 // -------------------------------------------------------------------------- |
|
557 // CUPnPAVControllerImpl::EventRequestL |
|
558 // See upnpavcontrollerimpl.h |
|
559 // -------------------------------------------------------------------------- |
|
560 void CUPnPAVControllerImpl::EventRequestL( const RMessage2& aMessage ) |
|
561 { |
|
562 TInt id = aMessage.Int0(); |
|
563 // Find the session |
|
564 TInt count = iPlaybackSessions.Count(); |
|
565 TBool found = EFalse; |
|
566 for( TInt i = 0; i < count; i++ ) |
|
567 { |
|
568 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
569 { |
|
570 iPlaybackSessions[ i ]->EventRequestL( aMessage ); |
|
571 found = ETrue; |
|
572 i = count; |
|
573 } |
|
574 } |
|
575 if( !found ) |
|
576 { |
|
577 aMessage.Complete( KErrNotFound ); |
|
578 } |
|
579 } |
|
580 |
|
581 // -------------------------------------------------------------------------- |
|
582 // CUPnPAVControllerImpl::CancelEventRequestL |
|
583 // See upnpavcontrollerimpl.h |
|
584 // -------------------------------------------------------------------------- |
|
585 void CUPnPAVControllerImpl::CancelEventRequestL( const RMessage2& aMessage ) |
|
586 { |
|
587 TInt id = aMessage.Int0(); |
|
588 // Find the session |
|
589 TInt count = iPlaybackSessions.Count(); |
|
590 TBool found = EFalse; |
|
591 for( TInt i = 0; i < count; i++ ) |
|
592 { |
|
593 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
594 { |
|
595 iPlaybackSessions[ i ]->CancelEventRequestL(); |
|
596 found = ETrue; |
|
597 i = count; |
|
598 } |
|
599 } |
|
600 if( found ) |
|
601 { |
|
602 aMessage.Complete( KErrNone ); |
|
603 } |
|
604 else |
|
605 { |
|
606 aMessage.Complete( KErrNotFound ); |
|
607 } |
|
608 } |
|
609 |
|
610 // -------------------------------------------------------------------------- |
|
611 // CUPnPAVControllerImpl::SetURIL |
|
612 // See upnpavcontrollerimpl.h |
|
613 // -------------------------------------------------------------------------- |
|
614 void CUPnPAVControllerImpl::SetURIL( const RMessage2& aMessage ) |
|
615 { |
|
616 TInt id = aMessage.Int0(); |
|
617 |
|
618 // Find the session |
|
619 TInt count = iPlaybackSessions.Count(); |
|
620 TBool found = EFalse; |
|
621 for( TInt i = 0; i < count; i++ ) |
|
622 { |
|
623 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
624 { |
|
625 iPlaybackSessions[ i ]->SetURIL( aMessage ); |
|
626 found = ETrue; |
|
627 i = count; |
|
628 } |
|
629 } |
|
630 if( !found ) |
|
631 { |
|
632 aMessage.Complete( KErrNotFound ); |
|
633 } |
|
634 } |
|
635 |
|
636 // -------------------------------------------------------------------------- |
|
637 // CUPnPAVControllerImpl::CancelSetURIL |
|
638 // See upnpavcontrollerimpl.h |
|
639 // -------------------------------------------------------------------------- |
|
640 void CUPnPAVControllerImpl::CancelSetURIL( const RMessage2& aMessage ) |
|
641 { |
|
642 TInt id = aMessage.Int0(); |
|
643 |
|
644 // Find the session |
|
645 TInt count = iPlaybackSessions.Count(); |
|
646 TBool found = EFalse; |
|
647 for( TInt i = 0; i < count; i++ ) |
|
648 { |
|
649 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
650 { |
|
651 iPlaybackSessions[ i ]->CancelSetURIL(); |
|
652 found = ETrue; |
|
653 i = count; |
|
654 aMessage.Complete( KErrNone ); |
|
655 } |
|
656 } |
|
657 if( !found ) |
|
658 { |
|
659 aMessage.Complete( KErrNotFound ); |
|
660 } |
|
661 } |
|
662 |
|
663 // -------------------------------------------------------------------------- |
|
664 // CUPnPAVControllerImpl::SetNextURIL |
|
665 // See upnpavcontrollerimpl.h |
|
666 // -------------------------------------------------------------------------- |
|
667 void CUPnPAVControllerImpl::SetNextURIL( const RMessage2& aMessage ) |
|
668 { |
|
669 TInt id = aMessage.Int0(); |
|
670 |
|
671 // Find the session |
|
672 TInt count = iPlaybackSessions.Count(); |
|
673 TBool found = EFalse; |
|
674 for( TInt i = 0; i < count; i++ ) |
|
675 { |
|
676 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
677 { |
|
678 iPlaybackSessions[ i ]->SetNextURIL( aMessage ); |
|
679 found = ETrue; |
|
680 i = count; |
|
681 } |
|
682 } |
|
683 if( !found ) |
|
684 { |
|
685 aMessage.Complete( KErrNotFound ); |
|
686 } |
|
687 } |
|
688 |
|
689 // -------------------------------------------------------------------------- |
|
690 // CUPnPAVControllerImpl::CancelSetNextURIL |
|
691 // See upnpavcontrollerimpl.h |
|
692 // -------------------------------------------------------------------------- |
|
693 void CUPnPAVControllerImpl::CancelSetNextURIL( const RMessage2& aMessage ) |
|
694 { |
|
695 TInt id = aMessage.Int0(); |
|
696 |
|
697 // Find the session |
|
698 TInt count = iPlaybackSessions.Count(); |
|
699 TBool found = EFalse; |
|
700 for( TInt i = 0; i < count; i++ ) |
|
701 { |
|
702 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
703 { |
|
704 iPlaybackSessions[ i ]->CancelSetNextURIL(); |
|
705 found = ETrue; |
|
706 i = count; |
|
707 aMessage.Complete( KErrNone ); |
|
708 } |
|
709 } |
|
710 if( !found ) |
|
711 { |
|
712 aMessage.Complete( KErrNotFound ); |
|
713 } |
|
714 } |
|
715 |
|
716 // -------------------------------------------------------------------------- |
|
717 // CUPnPAVControllerImpl::PlayL |
|
718 // See upnpavcontrollerimpl.h |
|
719 // -------------------------------------------------------------------------- |
|
720 void CUPnPAVControllerImpl::PlayL( const RMessage2& aMessage ) |
|
721 { |
|
722 TInt id = aMessage.Int0(); |
|
723 |
|
724 // Find the session |
|
725 TInt count = iPlaybackSessions.Count(); |
|
726 TBool found = EFalse; |
|
727 for( TInt i = 0; i < count; i++ ) |
|
728 { |
|
729 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
730 { |
|
731 iPlaybackSessions[ i ]->PlayL( aMessage ); |
|
732 found = ETrue; |
|
733 i = count; |
|
734 } |
|
735 } |
|
736 if( !found ) |
|
737 { |
|
738 aMessage.Complete( KErrNotFound ); |
|
739 } |
|
740 } |
|
741 |
|
742 // -------------------------------------------------------------------------- |
|
743 // CUPnPAVControllerImpl::CancelPlayL |
|
744 // See upnpavcontrollerimpl.h |
|
745 // -------------------------------------------------------------------------- |
|
746 void CUPnPAVControllerImpl::CancelPlayL( const RMessage2& aMessage ) |
|
747 { |
|
748 TInt id = aMessage.Int0(); |
|
749 |
|
750 // Find the session |
|
751 TInt count = iPlaybackSessions.Count(); |
|
752 TBool found = EFalse; |
|
753 for( TInt i = 0; i < count; i++ ) |
|
754 { |
|
755 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
756 { |
|
757 iPlaybackSessions[ i ]->CancelPlayL(); |
|
758 found = ETrue; |
|
759 i = count; |
|
760 aMessage.Complete( KErrNone ); |
|
761 } |
|
762 } |
|
763 if( !found ) |
|
764 { |
|
765 aMessage.Complete( KErrNotFound ); |
|
766 } |
|
767 } |
|
768 |
|
769 // -------------------------------------------------------------------------- |
|
770 // CUPnPAVControllerImpl::StopL |
|
771 // See upnpavcontrollerimpl.h |
|
772 // -------------------------------------------------------------------------- |
|
773 void CUPnPAVControllerImpl::StopL( const RMessage2& aMessage ) |
|
774 { |
|
775 TInt id = aMessage.Int0(); |
|
776 |
|
777 // Find the session |
|
778 TInt count = iPlaybackSessions.Count(); |
|
779 TBool found = EFalse; |
|
780 for( TInt i = 0; i < count; i++ ) |
|
781 { |
|
782 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
783 { |
|
784 iPlaybackSessions[ i ]->StopL( aMessage ); |
|
785 found = ETrue; |
|
786 i = count; |
|
787 } |
|
788 } |
|
789 if( !found ) |
|
790 { |
|
791 aMessage.Complete( KErrNotFound ); |
|
792 } |
|
793 } |
|
794 |
|
795 // -------------------------------------------------------------------------- |
|
796 // CUPnPAVControllerImpl::CancelStopL |
|
797 // See upnpavcontrollerimpl.h |
|
798 // -------------------------------------------------------------------------- |
|
799 void CUPnPAVControllerImpl::CancelStopL( const RMessage2& aMessage ) |
|
800 { |
|
801 TInt id = aMessage.Int0(); |
|
802 |
|
803 // Find the session |
|
804 TInt count = iPlaybackSessions.Count(); |
|
805 TBool found = EFalse; |
|
806 for( TInt i = 0; i < count; i++ ) |
|
807 { |
|
808 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
809 { |
|
810 iPlaybackSessions[ i ]->CancelStopL(); |
|
811 found = ETrue; |
|
812 i = count; |
|
813 aMessage.Complete( KErrNone ); |
|
814 } |
|
815 } |
|
816 if( !found ) |
|
817 { |
|
818 aMessage.Complete( KErrNotFound ); |
|
819 } |
|
820 } |
|
821 |
|
822 // -------------------------------------------------------------------------- |
|
823 // CUPnPAVControllerImpl::PauseL |
|
824 // See upnpavcontrollerimpl.h |
|
825 // -------------------------------------------------------------------------- |
|
826 void CUPnPAVControllerImpl::PauseL( const RMessage2& aMessage ) |
|
827 { |
|
828 TInt id = aMessage.Int0(); |
|
829 |
|
830 // Find the session |
|
831 TInt count = iPlaybackSessions.Count(); |
|
832 TBool found = EFalse; |
|
833 for( TInt i = 0; i < count; i++ ) |
|
834 { |
|
835 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
836 { |
|
837 iPlaybackSessions[ i ]->PauseL( aMessage ); |
|
838 found = ETrue; |
|
839 i = count; |
|
840 } |
|
841 } |
|
842 if( !found ) |
|
843 { |
|
844 aMessage.Complete( KErrNotFound ); |
|
845 } |
|
846 } |
|
847 |
|
848 // -------------------------------------------------------------------------- |
|
849 // CUPnPAVControllerImpl::CancelPauseL |
|
850 // See upnpavcontrollerimpl.h |
|
851 // -------------------------------------------------------------------------- |
|
852 void CUPnPAVControllerImpl::CancelPauseL( const RMessage2& aMessage ) |
|
853 { |
|
854 TInt id = aMessage.Int0(); |
|
855 |
|
856 // Find the session |
|
857 TInt count = iPlaybackSessions.Count(); |
|
858 TBool found = EFalse; |
|
859 for( TInt i = 0; i < count; i++ ) |
|
860 { |
|
861 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
862 { |
|
863 iPlaybackSessions[ i ]->CancelPauseL(); |
|
864 found = ETrue; |
|
865 i = count; |
|
866 aMessage.Complete( KErrNone ); |
|
867 } |
|
868 } |
|
869 if( !found ) |
|
870 { |
|
871 aMessage.Complete( KErrNotFound ); |
|
872 } |
|
873 } |
|
874 |
|
875 // -------------------------------------------------------------------------- |
|
876 // CUPnPAVControllerImpl::SetVolumeL |
|
877 // See upnpavcontrollerimpl.h |
|
878 // -------------------------------------------------------------------------- |
|
879 void CUPnPAVControllerImpl::SetVolumeL( const RMessage2& aMessage ) |
|
880 { |
|
881 TInt id = aMessage.Int0(); |
|
882 |
|
883 // Find the session |
|
884 TInt count = iPlaybackSessions.Count(); |
|
885 TBool found = EFalse; |
|
886 for( TInt i = 0; i < count; i++ ) |
|
887 { |
|
888 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
889 { |
|
890 iPlaybackSessions[ i ]->SetVolumeL( aMessage ); |
|
891 found = ETrue; |
|
892 i = count; |
|
893 } |
|
894 } |
|
895 if( !found ) |
|
896 { |
|
897 aMessage.Complete( KErrNotFound ); |
|
898 } |
|
899 } |
|
900 |
|
901 // -------------------------------------------------------------------------- |
|
902 // CUPnPAVControllerImpl::CancelSetVolumeL |
|
903 // See upnpavcontrollerimpl.h |
|
904 // -------------------------------------------------------------------------- |
|
905 void CUPnPAVControllerImpl::CancelSetVolumeL( const RMessage2& aMessage ) |
|
906 { |
|
907 TInt id = aMessage.Int0(); |
|
908 |
|
909 // Find the session |
|
910 TInt count = iPlaybackSessions.Count(); |
|
911 TBool found = EFalse; |
|
912 for( TInt i = 0; i < count; i++ ) |
|
913 { |
|
914 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
915 { |
|
916 iPlaybackSessions[ i ]->CancelSetVolumeL(); |
|
917 found = ETrue; |
|
918 i = count; |
|
919 aMessage.Complete( KErrNone ); |
|
920 } |
|
921 } |
|
922 if( !found ) |
|
923 { |
|
924 aMessage.Complete( KErrNotFound ); |
|
925 } |
|
926 } |
|
927 |
|
928 // -------------------------------------------------------------------------- |
|
929 // CUPnPAVControllerImpl::GetVolumeL |
|
930 // See upnpavcontrollerimpl.h |
|
931 // -------------------------------------------------------------------------- |
|
932 void CUPnPAVControllerImpl::GetVolumeL( const RMessage2& aMessage ) |
|
933 { |
|
934 TInt id = aMessage.Int0(); |
|
935 |
|
936 // Find the session |
|
937 TInt count = iPlaybackSessions.Count(); |
|
938 TBool found = EFalse; |
|
939 for( TInt i = 0; i < count; i++ ) |
|
940 { |
|
941 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
942 { |
|
943 iPlaybackSessions[ i ]->GetVolumeL( aMessage ); |
|
944 found = ETrue; |
|
945 i = count; |
|
946 } |
|
947 } |
|
948 if( !found ) |
|
949 { |
|
950 aMessage.Complete( KErrNotFound ); |
|
951 } |
|
952 } |
|
953 |
|
954 // -------------------------------------------------------------------------- |
|
955 // CUPnPAVControllerImpl::CancelGetVolumeL |
|
956 // See upnpavcontrollerimpl.h |
|
957 // -------------------------------------------------------------------------- |
|
958 void CUPnPAVControllerImpl::CancelGetVolumeL( const RMessage2& aMessage ) |
|
959 { |
|
960 TInt id = aMessage.Int0(); |
|
961 |
|
962 // Find the session |
|
963 TInt count = iPlaybackSessions.Count(); |
|
964 TBool found = EFalse; |
|
965 for( TInt i = 0; i < count; i++ ) |
|
966 { |
|
967 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
968 { |
|
969 iPlaybackSessions[ i ]->CancelGetVolumeL(); |
|
970 found = ETrue; |
|
971 i = count; |
|
972 aMessage.Complete( KErrNone ); |
|
973 } |
|
974 } |
|
975 if( !found ) |
|
976 { |
|
977 aMessage.Complete( KErrNotFound ); |
|
978 } |
|
979 } |
|
980 |
|
981 // -------------------------------------------------------------------------- |
|
982 // CUPnPAVControllerImpl::SetMuteL |
|
983 // See upnpavcontrollerimpl.h |
|
984 // -------------------------------------------------------------------------- |
|
985 void CUPnPAVControllerImpl::SetMuteL( const RMessage2& aMessage ) |
|
986 { |
|
987 TInt id = aMessage.Int0(); |
|
988 |
|
989 // Find the session |
|
990 TInt count = iPlaybackSessions.Count(); |
|
991 TBool found = EFalse; |
|
992 for( TInt i = 0; i < count; i++ ) |
|
993 { |
|
994 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
995 { |
|
996 iPlaybackSessions[ i ]->SetMuteL( aMessage ); |
|
997 found = ETrue; |
|
998 i = count; |
|
999 } |
|
1000 } |
|
1001 if( !found ) |
|
1002 { |
|
1003 aMessage.Complete( KErrNotFound ); |
|
1004 } |
|
1005 } |
|
1006 |
|
1007 // -------------------------------------------------------------------------- |
|
1008 // CUPnPAVControllerImpl::CancelSetMuteL |
|
1009 // See upnpavcontrollerimpl.h |
|
1010 // -------------------------------------------------------------------------- |
|
1011 void CUPnPAVControllerImpl::CancelSetMuteL( const RMessage2& aMessage ) |
|
1012 { |
|
1013 TInt id = aMessage.Int0(); |
|
1014 |
|
1015 // Find the session |
|
1016 TInt count = iPlaybackSessions.Count(); |
|
1017 TBool found = EFalse; |
|
1018 for( TInt i = 0; i < count; i++ ) |
|
1019 { |
|
1020 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
1021 { |
|
1022 iPlaybackSessions[ i ]->CancelSetMuteL(); |
|
1023 found = ETrue; |
|
1024 i = count; |
|
1025 aMessage.Complete( KErrNone ); |
|
1026 } |
|
1027 } |
|
1028 if( !found ) |
|
1029 { |
|
1030 aMessage.Complete( KErrNotFound ); |
|
1031 } |
|
1032 } |
|
1033 |
|
1034 // -------------------------------------------------------------------------- |
|
1035 // CUPnPAVControllerImpl::GetMuteL |
|
1036 // See upnpavcontrollerimpl.h |
|
1037 // -------------------------------------------------------------------------- |
|
1038 void CUPnPAVControllerImpl::GetMuteL( const RMessage2& aMessage ) |
|
1039 { |
|
1040 TInt id = aMessage.Int0(); |
|
1041 |
|
1042 // Find the session |
|
1043 TInt count = iPlaybackSessions.Count(); |
|
1044 TBool found = EFalse; |
|
1045 for( TInt i = 0; i < count; i++ ) |
|
1046 { |
|
1047 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
1048 { |
|
1049 iPlaybackSessions[ i ]->GetMuteL( aMessage ); |
|
1050 found = ETrue; |
|
1051 i = count; |
|
1052 } |
|
1053 } |
|
1054 if( !found ) |
|
1055 { |
|
1056 aMessage.Complete( KErrNotFound ); |
|
1057 } |
|
1058 } |
|
1059 |
|
1060 // -------------------------------------------------------------------------- |
|
1061 // CUPnPAVControllerImpl::CancelGetMuteL |
|
1062 // See upnpavcontrollerimpl.h |
|
1063 // -------------------------------------------------------------------------- |
|
1064 void CUPnPAVControllerImpl::CancelGetMuteL( const RMessage2& aMessage ) |
|
1065 { |
|
1066 TInt id = aMessage.Int0(); |
|
1067 |
|
1068 // Find the session |
|
1069 TInt count = iPlaybackSessions.Count(); |
|
1070 TBool found = EFalse; |
|
1071 for( TInt i = 0; i < count; i++ ) |
|
1072 { |
|
1073 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
1074 { |
|
1075 iPlaybackSessions[ i ]->CancelGetMuteL(); |
|
1076 found = ETrue; |
|
1077 i = count; |
|
1078 aMessage.Complete( KErrNone ); |
|
1079 } |
|
1080 } |
|
1081 if( !found ) |
|
1082 { |
|
1083 aMessage.Complete( KErrNotFound ); |
|
1084 } |
|
1085 } |
|
1086 |
|
1087 // -------------------------------------------------------------------------- |
|
1088 // CUPnPAVControllerImpl::GetPositionInfoL |
|
1089 // See upnpavcontrollerimpl.h |
|
1090 // -------------------------------------------------------------------------- |
|
1091 void CUPnPAVControllerImpl::GetPositionInfoL( const RMessage2& aMessage ) |
|
1092 { |
|
1093 TInt id = aMessage.Int0(); |
|
1094 |
|
1095 // Find the session |
|
1096 TInt count = iPlaybackSessions.Count(); |
|
1097 TBool found = EFalse; |
|
1098 for( TInt i = 0; i < count; i++ ) |
|
1099 { |
|
1100 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
1101 { |
|
1102 iPlaybackSessions[ i ]->GetPositionInfoL( aMessage ); |
|
1103 found = ETrue; |
|
1104 i = count; |
|
1105 } |
|
1106 } |
|
1107 if( !found ) |
|
1108 { |
|
1109 aMessage.Complete( KErrNotFound ); |
|
1110 } |
|
1111 } |
|
1112 |
|
1113 // -------------------------------------------------------------------------- |
|
1114 // CUPnPAVControllerImpl::CancelGetPositionInfoL |
|
1115 // See upnpavcontrollerimpl.h |
|
1116 // -------------------------------------------------------------------------- |
|
1117 void CUPnPAVControllerImpl::CancelGetPositionInfoL( |
|
1118 const RMessage2& aMessage ) |
|
1119 { |
|
1120 TInt id = aMessage.Int0(); |
|
1121 |
|
1122 // Find the session |
|
1123 TInt count = iPlaybackSessions.Count(); |
|
1124 TBool found = EFalse; |
|
1125 for( TInt i = 0; i < count; i++ ) |
|
1126 { |
|
1127 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
1128 { |
|
1129 iPlaybackSessions[ i ]->CancelGetPositionInfoL(); |
|
1130 found = ETrue; |
|
1131 i = count; |
|
1132 aMessage.Complete( KErrNone ); |
|
1133 } |
|
1134 } |
|
1135 if( !found ) |
|
1136 { |
|
1137 aMessage.Complete( KErrNotFound ); |
|
1138 } |
|
1139 } |
|
1140 |
|
1141 // -------------------------------------------------------------------------- |
|
1142 // CUPnPAVControllerImpl::CreateBrowsingSessionL |
|
1143 // See upnpavcontrollerimpl.h |
|
1144 // -------------------------------------------------------------------------- |
|
1145 void CUPnPAVControllerImpl::CreateBrowsingSessionL( |
|
1146 const RMessage2& aMessage ) |
|
1147 { |
|
1148 __LOG1( "CUPnPAVControllerImpl::CreateBrowsingSessionL, 0x%d", |
|
1149 aMessage.Int0() ); |
|
1150 |
|
1151 // Create a rendering session |
|
1152 TInt id = aMessage.Int0(); |
|
1153 |
|
1154 // Read the device UID |
|
1155 TInt len = aMessage.GetDesMaxLength( 1 ); |
|
1156 HBufC8* buf = HBufC8::NewLC( len ); |
|
1157 TPtr8 ptr( buf->Des() ); |
|
1158 User::LeaveIfError( aMessage.Read( 1, ptr ) ); |
|
1159 |
|
1160 CUPnPBrowsingSession* tempPtr = CUPnPBrowsingSession::NewL( |
|
1161 iMediaServer, iServer, id, *buf ); |
|
1162 |
|
1163 CleanupStack::PopAndDestroy( buf ); |
|
1164 iBrowsingSessions.Append( tempPtr ); |
|
1165 |
|
1166 aMessage.Complete( KErrNone ); |
|
1167 } |
|
1168 |
|
1169 // -------------------------------------------------------------------------- |
|
1170 // CUPnPAVControllerImpl::DestroyBrowsingSessionL |
|
1171 // See upnpavcontrollerimpl.h |
|
1172 // -------------------------------------------------------------------------- |
|
1173 void CUPnPAVControllerImpl::DestroyBrowsingSessionL( |
|
1174 const RMessage2& aMessage ) |
|
1175 { |
|
1176 __LOG1( "CUPnPAVControllerImpl::DestroyBrowsingSessionL, 0x%d", |
|
1177 aMessage.Int0() ); |
|
1178 |
|
1179 // Find and delete a rendering session |
|
1180 TInt id = aMessage.Int0(); |
|
1181 TInt count = iBrowsingSessions.Count(); |
|
1182 TBool found = EFalse; |
|
1183 for( TInt i = 0; i < count; i++ ) |
|
1184 { |
|
1185 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1186 { |
|
1187 delete iBrowsingSessions[ i ]; |
|
1188 iBrowsingSessions.Remove( i ); |
|
1189 found = ETrue; |
|
1190 i = count; |
|
1191 } |
|
1192 } |
|
1193 if( found ) |
|
1194 { |
|
1195 aMessage.Complete( KErrNone ); |
|
1196 } |
|
1197 else |
|
1198 { |
|
1199 aMessage.Complete( KErrNotFound ); |
|
1200 } |
|
1201 } |
|
1202 |
|
1203 // -------------------------------------------------------------------------- |
|
1204 // CUPnPAVControllerImpl::GetBrowseResponseSizeL |
|
1205 // See upnpavcontrollerimpl.h |
|
1206 // -------------------------------------------------------------------------- |
|
1207 void CUPnPAVControllerImpl::GetBrowseResponseSizeL( |
|
1208 const RMessage2& aMessage ) |
|
1209 { |
|
1210 TInt id = aMessage.Int0(); |
|
1211 |
|
1212 // Find the session |
|
1213 TInt count = iBrowsingSessions.Count(); |
|
1214 TBool found = EFalse; |
|
1215 for( TInt i = 0; i < count; i++ ) |
|
1216 { |
|
1217 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1218 { |
|
1219 iBrowsingSessions[ i ]->GetBrowseResponseSizeL( aMessage ); |
|
1220 found = ETrue; |
|
1221 i = count; |
|
1222 } |
|
1223 } |
|
1224 if( !found ) |
|
1225 { |
|
1226 aMessage.Complete( KErrNotFound ); |
|
1227 } |
|
1228 } |
|
1229 |
|
1230 // -------------------------------------------------------------------------- |
|
1231 // CUPnPAVControllerImpl::CancelGetBrowseResponseSizeL |
|
1232 // See upnpavcontrollerimpl.h |
|
1233 // -------------------------------------------------------------------------- |
|
1234 void CUPnPAVControllerImpl::CancelGetBrowseResponseSizeL( |
|
1235 const RMessage2& aMessage ) |
|
1236 { |
|
1237 TInt id = aMessage.Int0(); |
|
1238 |
|
1239 // Find the session |
|
1240 TInt count = iBrowsingSessions.Count(); |
|
1241 TBool found = EFalse; |
|
1242 for( TInt i = 0; i < count; i++ ) |
|
1243 { |
|
1244 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1245 { |
|
1246 iBrowsingSessions[ i ]->CancelGetBrowseResponseSizeL(); |
|
1247 found = ETrue; |
|
1248 i = count; |
|
1249 aMessage.Complete( KErrNone ); |
|
1250 } |
|
1251 } |
|
1252 if( !found ) |
|
1253 { |
|
1254 aMessage.Complete( KErrNotFound ); |
|
1255 } |
|
1256 } |
|
1257 |
|
1258 // -------------------------------------------------------------------------- |
|
1259 // CUPnPAVControllerImpl::GetBrowseResponseL |
|
1260 // See upnpavcontrollerimpl.h |
|
1261 // -------------------------------------------------------------------------- |
|
1262 void CUPnPAVControllerImpl::GetBrowseResponseL( const RMessage2& aMessage ) |
|
1263 { |
|
1264 TInt id = aMessage.Int0(); |
|
1265 |
|
1266 // Find the session |
|
1267 TInt count = iBrowsingSessions.Count(); |
|
1268 TBool found = EFalse; |
|
1269 for( TInt i = 0; i < count; i++ ) |
|
1270 { |
|
1271 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1272 { |
|
1273 iBrowsingSessions[ i ]->GetBrowseResponseL( aMessage ); |
|
1274 found = ETrue; |
|
1275 i = count; |
|
1276 } |
|
1277 } |
|
1278 if( !found ) |
|
1279 { |
|
1280 aMessage.Complete( KErrNotFound ); |
|
1281 } |
|
1282 } |
|
1283 |
|
1284 // -------------------------------------------------------------------------- |
|
1285 // CUPnPAVControllerImpl::GetSearchResponseSizeL |
|
1286 // See upnpavcontrollerimpl.h |
|
1287 // -------------------------------------------------------------------------- |
|
1288 void CUPnPAVControllerImpl::GetSearchResponseSizeL( |
|
1289 const RMessage2& aMessage ) |
|
1290 { |
|
1291 TInt id = aMessage.Int0(); |
|
1292 |
|
1293 // Find the session |
|
1294 TInt count = iBrowsingSessions.Count(); |
|
1295 TBool found = EFalse; |
|
1296 for( TInt i = 0; i < count; i++ ) |
|
1297 { |
|
1298 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1299 { |
|
1300 iBrowsingSessions[ i ]->GetSearchResponseSizeL( aMessage ); |
|
1301 found = ETrue; |
|
1302 i = count; |
|
1303 } |
|
1304 } |
|
1305 if( !found ) |
|
1306 { |
|
1307 aMessage.Complete( KErrNotFound ); |
|
1308 } |
|
1309 } |
|
1310 |
|
1311 // -------------------------------------------------------------------------- |
|
1312 // CUPnPAVControllerImpl::CancelGetSearchResponseSizeL |
|
1313 // See upnpavcontrollerimpl.h |
|
1314 // -------------------------------------------------------------------------- |
|
1315 void CUPnPAVControllerImpl::CancelGetSearchResponseSizeL( |
|
1316 const RMessage2& aMessage ) |
|
1317 { |
|
1318 TInt id = aMessage.Int0(); |
|
1319 |
|
1320 // Find the session |
|
1321 TInt count = iBrowsingSessions.Count(); |
|
1322 TBool found = EFalse; |
|
1323 for( TInt i = 0; i < count; i++ ) |
|
1324 { |
|
1325 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1326 { |
|
1327 iBrowsingSessions[ i ]->CancelGetSearchResponseSizeL(); |
|
1328 found = ETrue; |
|
1329 i = count; |
|
1330 aMessage.Complete( KErrNone ); |
|
1331 } |
|
1332 } |
|
1333 if( !found ) |
|
1334 { |
|
1335 aMessage.Complete( KErrNotFound ); |
|
1336 } |
|
1337 } |
|
1338 |
|
1339 // -------------------------------------------------------------------------- |
|
1340 // CUPnPAVControllerImpl::GetSearchResponseL |
|
1341 // See upnpavcontrollerimpl.h |
|
1342 // -------------------------------------------------------------------------- |
|
1343 void CUPnPAVControllerImpl::GetSearchResponseL( |
|
1344 const RMessage2& aMessage ) |
|
1345 { |
|
1346 TInt id = aMessage.Int0(); |
|
1347 |
|
1348 // Find the session |
|
1349 TInt count = iBrowsingSessions.Count(); |
|
1350 TBool found = EFalse; |
|
1351 for( TInt i = 0; i < count; i++ ) |
|
1352 { |
|
1353 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1354 { |
|
1355 iBrowsingSessions[ i ]->GetSearchResponseL( aMessage ); |
|
1356 found = ETrue; |
|
1357 i = count; |
|
1358 } |
|
1359 } |
|
1360 if( !found ) |
|
1361 { |
|
1362 aMessage.Complete( KErrNotFound ); |
|
1363 } |
|
1364 } |
|
1365 |
|
1366 // -------------------------------------------------------------------------- |
|
1367 // CUPnPAVControllerImpl::GetSearchCapabitiesSizeL |
|
1368 // See upnpavcontrollerimpl.h |
|
1369 // -------------------------------------------------------------------------- |
|
1370 void CUPnPAVControllerImpl::GetSearchCapabitiesSizeL( |
|
1371 const RMessage2& aMessage ) |
|
1372 { |
|
1373 TInt id = aMessage.Int0(); |
|
1374 |
|
1375 // Find the session |
|
1376 TInt count = iBrowsingSessions.Count(); |
|
1377 TBool found = EFalse; |
|
1378 for( TInt i = 0; i < count; i++ ) |
|
1379 { |
|
1380 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1381 { |
|
1382 iBrowsingSessions[ i ]->GetSearchCapabitiesSizeL( aMessage ); |
|
1383 found = ETrue; |
|
1384 i = count; |
|
1385 } |
|
1386 } |
|
1387 if( !found ) |
|
1388 { |
|
1389 aMessage.Complete( KErrNotFound ); |
|
1390 } |
|
1391 } |
|
1392 |
|
1393 // -------------------------------------------------------------------------- |
|
1394 // CUPnPAVControllerImpl::CancelGetSearchCapabitiesSizeL |
|
1395 // See upnpavcontrollerimpl.h |
|
1396 // -------------------------------------------------------------------------- |
|
1397 void CUPnPAVControllerImpl::CancelGetSearchCapabitiesSizeL( |
|
1398 const RMessage2& aMessage ) |
|
1399 { |
|
1400 TInt id = aMessage.Int0(); |
|
1401 |
|
1402 // Find the session |
|
1403 TInt count = iBrowsingSessions.Count(); |
|
1404 TBool found = EFalse; |
|
1405 for( TInt i = 0; i < count; i++ ) |
|
1406 { |
|
1407 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1408 { |
|
1409 iBrowsingSessions[ i ]->CancelGetSearchCapabitiesSizeL(); |
|
1410 found = ETrue; |
|
1411 i = count; |
|
1412 aMessage.Complete( KErrNone ); |
|
1413 } |
|
1414 } |
|
1415 if( !found ) |
|
1416 { |
|
1417 aMessage.Complete( KErrNotFound ); |
|
1418 } |
|
1419 } |
|
1420 |
|
1421 // -------------------------------------------------------------------------- |
|
1422 // CUPnPAVControllerImpl::GetSearchCapabitiesL |
|
1423 // See upnpavcontrollerimpl.h |
|
1424 // -------------------------------------------------------------------------- |
|
1425 void CUPnPAVControllerImpl::GetSearchCapabitiesL( const RMessage2& aMessage ) |
|
1426 { |
|
1427 TInt id = aMessage.Int0(); |
|
1428 |
|
1429 // Find the session |
|
1430 TInt count = iBrowsingSessions.Count(); |
|
1431 TBool found = EFalse; |
|
1432 for( TInt i = 0; i < count; i++ ) |
|
1433 { |
|
1434 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1435 { |
|
1436 iBrowsingSessions[ i ]->GetSearchCapabitiesL( aMessage ); |
|
1437 found = ETrue; |
|
1438 i = count; |
|
1439 } |
|
1440 } |
|
1441 if( !found ) |
|
1442 { |
|
1443 aMessage.Complete( KErrNotFound ); |
|
1444 } |
|
1445 } |
|
1446 |
|
1447 // -------------------------------------------------------------------------- |
|
1448 // CUPnPAVControllerImpl::CreateContainerL |
|
1449 // See upnpavcontrollerimpl.h |
|
1450 // -------------------------------------------------------------------------- |
|
1451 void CUPnPAVControllerImpl::CreateContainerL( const RMessage2& aMessage ) |
|
1452 { |
|
1453 TInt id = aMessage.Int0(); |
|
1454 |
|
1455 // Find the session |
|
1456 TInt count = iBrowsingSessions.Count(); |
|
1457 TBool found = EFalse; |
|
1458 for( TInt i = 0; i < count; i++ ) |
|
1459 { |
|
1460 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1461 { |
|
1462 iBrowsingSessions[ i ]->CreateContainerL( aMessage ); |
|
1463 found = ETrue; |
|
1464 i = count; |
|
1465 } |
|
1466 } |
|
1467 if( !found ) |
|
1468 { |
|
1469 aMessage.Complete( KErrNotFound ); |
|
1470 } |
|
1471 } |
|
1472 |
|
1473 // -------------------------------------------------------------------------- |
|
1474 // CUPnPAVControllerImpl::CancelCreateContainerL |
|
1475 // See upnpavcontrollerimpl.h |
|
1476 // -------------------------------------------------------------------------- |
|
1477 void CUPnPAVControllerImpl::CancelCreateContainerL( |
|
1478 const RMessage2& aMessage ) |
|
1479 { |
|
1480 TInt id = aMessage.Int0(); |
|
1481 |
|
1482 // Find the session |
|
1483 TInt count = iBrowsingSessions.Count(); |
|
1484 TBool found = EFalse; |
|
1485 for( TInt i = 0; i < count; i++ ) |
|
1486 { |
|
1487 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1488 { |
|
1489 iBrowsingSessions[ i ]->CancelCreateContainerL(); |
|
1490 found = ETrue; |
|
1491 i = count; |
|
1492 aMessage.Complete( KErrNone ); |
|
1493 } |
|
1494 } |
|
1495 if( !found ) |
|
1496 { |
|
1497 aMessage.Complete( KErrNotFound ); |
|
1498 } |
|
1499 } |
|
1500 |
|
1501 // -------------------------------------------------------------------------- |
|
1502 // CUPnPAVControllerImpl::DeleteObjectL |
|
1503 // See upnpavcontrollerimpl.h |
|
1504 // -------------------------------------------------------------------------- |
|
1505 void CUPnPAVControllerImpl::DeleteObjectL( const RMessage2& aMessage ) |
|
1506 { |
|
1507 TInt id = aMessage.Int0(); |
|
1508 |
|
1509 // Find the session |
|
1510 TInt count = iBrowsingSessions.Count(); |
|
1511 TBool found = EFalse; |
|
1512 for( TInt i = 0; i < count; i++ ) |
|
1513 { |
|
1514 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1515 { |
|
1516 iBrowsingSessions[ i ]->DeleteObjectL( aMessage ); |
|
1517 found = ETrue; |
|
1518 i = count; |
|
1519 } |
|
1520 } |
|
1521 if( !found ) |
|
1522 { |
|
1523 aMessage.Complete( KErrNotFound ); |
|
1524 } |
|
1525 } |
|
1526 |
|
1527 // -------------------------------------------------------------------------- |
|
1528 // CUPnPAVControllerImpl::CancelDeleteObjectL |
|
1529 // See upnpavcontrollerimpl.h |
|
1530 // -------------------------------------------------------------------------- |
|
1531 void CUPnPAVControllerImpl::CancelDeleteObjectL( const RMessage2& aMessage ) |
|
1532 { |
|
1533 TInt id = aMessage.Int0(); |
|
1534 |
|
1535 // Find the session |
|
1536 TInt count = iBrowsingSessions.Count(); |
|
1537 TBool found = EFalse; |
|
1538 for( TInt i = 0; i < count; i++ ) |
|
1539 { |
|
1540 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1541 { |
|
1542 iBrowsingSessions[ i ]->CancelDeleteObjectL(); |
|
1543 found = ETrue; |
|
1544 i = count; |
|
1545 aMessage.Complete( KErrNone ); |
|
1546 } |
|
1547 } |
|
1548 if( !found ) |
|
1549 { |
|
1550 aMessage.Complete( KErrNotFound ); |
|
1551 } |
|
1552 } |
|
1553 |
|
1554 // -------------------------------------------------------------------------- |
|
1555 // CUPnPAVControllerImpl::DeviceDisappearedRequestL |
|
1556 // See upnpavcontrollerimpl.h |
|
1557 // -------------------------------------------------------------------------- |
|
1558 void CUPnPAVControllerImpl::DeviceDisappearedRequestL( |
|
1559 const RMessage2& aMessage ) |
|
1560 { |
|
1561 TInt id = aMessage.Int0(); |
|
1562 |
|
1563 // Find the session |
|
1564 TInt count = iBrowsingSessions.Count(); |
|
1565 TBool found = EFalse; |
|
1566 TInt i; |
|
1567 for( i = 0; i < count; i++ ) |
|
1568 { |
|
1569 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1570 { |
|
1571 iBrowsingSessions[ i ]->DeviceDisappearedRequestL( aMessage ); |
|
1572 found = ETrue; |
|
1573 i = count; |
|
1574 } |
|
1575 } |
|
1576 |
|
1577 if( !found ) |
|
1578 { |
|
1579 count = iPlaybackSessions.Count(); |
|
1580 for( i = 0; i < count; i++ ) |
|
1581 { |
|
1582 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
1583 { |
|
1584 iPlaybackSessions[ i ]->DeviceDisappearedRequestL( |
|
1585 aMessage ); |
|
1586 found = ETrue; |
|
1587 i = count; |
|
1588 } |
|
1589 } |
|
1590 } |
|
1591 |
|
1592 if( !found ) |
|
1593 { |
|
1594 aMessage.Complete( KErrNotFound ); |
|
1595 } |
|
1596 } |
|
1597 |
|
1598 // -------------------------------------------------------------------------- |
|
1599 // CUPnPAVControllerImpl::CancelDeviceDisappearedRequestL |
|
1600 // See upnpavcontrollerimpl.h |
|
1601 // -------------------------------------------------------------------------- |
|
1602 void CUPnPAVControllerImpl::CancelDeviceDisappearedRequestL( |
|
1603 const RMessage2& aMessage ) |
|
1604 { |
|
1605 TInt id = aMessage.Int0(); |
|
1606 |
|
1607 // Find the session |
|
1608 TInt count = iBrowsingSessions.Count(); |
|
1609 TBool found = EFalse; |
|
1610 TInt i; |
|
1611 for( i = 0; i < count; i++ ) |
|
1612 { |
|
1613 if( iBrowsingSessions[ i ]->SessionId() == id ) |
|
1614 { |
|
1615 iBrowsingSessions[ i ]->CancelDeviceDisappearedRequestL(); |
|
1616 found = ETrue; |
|
1617 i = count; |
|
1618 aMessage.Complete( KErrNone ); |
|
1619 } |
|
1620 } |
|
1621 if( !found ) |
|
1622 { |
|
1623 count = iPlaybackSessions.Count(); |
|
1624 for( i = 0; i < count; i++ ) |
|
1625 { |
|
1626 if( iPlaybackSessions[ i ]->SessionId() == id ) |
|
1627 { |
|
1628 iPlaybackSessions[ i ]->CancelDeviceDisappearedRequestL(); |
|
1629 found = ETrue; |
|
1630 i = count; |
|
1631 aMessage.Complete( KErrNone ); |
|
1632 } |
|
1633 } |
|
1634 } |
|
1635 |
|
1636 if( !found ) |
|
1637 { |
|
1638 aMessage.Complete( KErrNotFound ); |
|
1639 } |
|
1640 } |
|
1641 |
|
1642 // -------------------------------------------------------------------------- |
|
1643 // CUPnPAVControllerImpl::MonitorConnectionL |
|
1644 // See upnpavcontrollerimpl.h |
|
1645 // -------------------------------------------------------------------------- |
|
1646 void CUPnPAVControllerImpl::MonitorConnectionL( const RMessage2& aMessage ) |
|
1647 { |
|
1648 |
|
1649 if( iConnectionMsg ) |
|
1650 { |
|
1651 User::Leave( KErrInUse ); |
|
1652 } |
|
1653 else |
|
1654 { |
|
1655 iConnectionMsg = new (ELeave) RMessage2( aMessage ); |
|
1656 } |
|
1657 } |
|
1658 |
|
1659 // -------------------------------------------------------------------------- |
|
1660 // CUPnPAVControllerImpl::CancelMonitorConnectionL |
|
1661 // See upnpavcontrollerimpl.h |
|
1662 // -------------------------------------------------------------------------- |
|
1663 void CUPnPAVControllerImpl::CancelMonitorConnectionL( |
|
1664 const RMessage2& aMessage ) |
|
1665 { |
|
1666 |
|
1667 if( iConnectionMsg ) |
|
1668 { |
|
1669 iConnectionMsg->Complete( KErrCancel ); |
|
1670 delete iConnectionMsg; iConnectionMsg = NULL; |
|
1671 } |
|
1672 aMessage.Complete( KErrNone ); |
|
1673 } |
|
1674 |
|
1675 // -------------------------------------------------------------------------- |
|
1676 // CUPnPAVControllerImpl::CreateDownloadSessionL |
|
1677 // See upnpavcontrollerimpl.h |
|
1678 // -------------------------------------------------------------------------- |
|
1679 void CUPnPAVControllerImpl::CreateDownloadSessionL( |
|
1680 const RMessage2& aMessage ) |
|
1681 { |
|
1682 __LOG1( "CUPnPAVControllerImpl::CreateDownloadSessionL, 0x%d", |
|
1683 aMessage.Int0() ); |
|
1684 |
|
1685 // Create a downloading session |
|
1686 TInt id = aMessage.Int0(); |
|
1687 |
|
1688 // Read the device UID |
|
1689 TInt len = aMessage.GetDesMaxLength( 1 ); |
|
1690 HBufC8* buf = HBufC8::NewLC( len ); |
|
1691 TPtr8 ptr( buf->Des() ); |
|
1692 User::LeaveIfError( aMessage.Read( 1, ptr ) ); |
|
1693 |
|
1694 CUPnPDownloadSession* tempPtr = CUPnPDownloadSession::NewL( |
|
1695 iServer, id, *buf ); |
|
1696 CleanupStack::PopAndDestroy( buf ); |
|
1697 iDownloadSessions.Append( tempPtr ); |
|
1698 |
|
1699 aMessage.Complete( KErrNone ); |
|
1700 } |
|
1701 |
|
1702 // -------------------------------------------------------------------------- |
|
1703 // CUPnPAVControllerImpl::DestroyDownloadSessionL |
|
1704 // See upnpavcontrollerimpl.h |
|
1705 // -------------------------------------------------------------------------- |
|
1706 void CUPnPAVControllerImpl::DestroyDownloadSessionL( |
|
1707 const RMessage2& aMessage ) |
|
1708 { |
|
1709 __LOG1( "CUPnPAVControllerImpl::DestroyDownloadSessionL, 0x%d", |
|
1710 aMessage.Int0() ); |
|
1711 |
|
1712 // Find and delete a downloading session |
|
1713 TInt id = aMessage.Int0(); |
|
1714 TInt count = iDownloadSessions.Count(); |
|
1715 TBool found = EFalse; |
|
1716 for( TInt i = 0; i < count; i++ ) |
|
1717 { |
|
1718 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1719 { |
|
1720 delete iDownloadSessions[ i ]; |
|
1721 iDownloadSessions.Remove( i ); |
|
1722 found = ETrue; |
|
1723 i = count; |
|
1724 } |
|
1725 } |
|
1726 if( found ) |
|
1727 { |
|
1728 aMessage.Complete( KErrNone ); |
|
1729 } |
|
1730 else |
|
1731 { |
|
1732 aMessage.Complete( KErrNotFound ); |
|
1733 } |
|
1734 } |
|
1735 |
|
1736 void CUPnPAVControllerImpl::StartDownloadL( const RMessage2& aMessage ) |
|
1737 { |
|
1738 TInt id = aMessage.Int0(); |
|
1739 |
|
1740 // Find the session |
|
1741 TInt count = iDownloadSessions.Count(); |
|
1742 TBool found = EFalse; |
|
1743 for( TInt i = 0; i < count; i++ ) |
|
1744 { |
|
1745 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1746 { |
|
1747 iDownloadSessions[ i ]->StartDownloadL( aMessage ); |
|
1748 found = ETrue; |
|
1749 i = count; |
|
1750 } |
|
1751 } |
|
1752 if( !found ) |
|
1753 { |
|
1754 aMessage.Complete( KErrNotFound ); |
|
1755 } |
|
1756 } |
|
1757 |
|
1758 void CUPnPAVControllerImpl::StartDownloadFHL( const RMessage2& aMessage ) |
|
1759 { |
|
1760 TInt id = aMessage.Int0(); |
|
1761 |
|
1762 // Find the session |
|
1763 TInt count = iDownloadSessions.Count(); |
|
1764 TBool found = EFalse; |
|
1765 for( TInt i = 0; i < count; i++ ) |
|
1766 { |
|
1767 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1768 { |
|
1769 iDownloadSessions[ i ]->StartDownloadFHL( aMessage ); |
|
1770 found = ETrue; |
|
1771 i = count; |
|
1772 } |
|
1773 } |
|
1774 if( !found ) |
|
1775 { |
|
1776 aMessage.Complete( KErrNotFound ); |
|
1777 } |
|
1778 } |
|
1779 |
|
1780 void CUPnPAVControllerImpl::CancelDownloadL( const RMessage2& aMessage ) |
|
1781 { |
|
1782 TInt id = aMessage.Int0(); |
|
1783 |
|
1784 // Find the session |
|
1785 TInt count = iDownloadSessions.Count(); |
|
1786 TBool found = EFalse; |
|
1787 for( TInt i = 0; i < count; i++ ) |
|
1788 { |
|
1789 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1790 { |
|
1791 iDownloadSessions[ i ]->CancelDownloadL( aMessage ); |
|
1792 found = ETrue; |
|
1793 i = count; |
|
1794 } |
|
1795 } |
|
1796 if( !found ) |
|
1797 { |
|
1798 aMessage.Complete( KErrNotFound ); |
|
1799 } |
|
1800 } |
|
1801 |
|
1802 void CUPnPAVControllerImpl::CancelAllDownloadsL( const RMessage2& aMessage ) |
|
1803 { |
|
1804 TInt id = aMessage.Int0(); |
|
1805 |
|
1806 // Find the session |
|
1807 TInt count = iDownloadSessions.Count(); |
|
1808 TBool found = EFalse; |
|
1809 for( TInt i = 0; i < count; i++ ) |
|
1810 { |
|
1811 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1812 { |
|
1813 iDownloadSessions[ i ]->CancelAllDownloadsL( aMessage ); |
|
1814 found = ETrue; |
|
1815 i = count; |
|
1816 } |
|
1817 } |
|
1818 if( !found ) |
|
1819 { |
|
1820 aMessage.Complete( KErrNotFound ); |
|
1821 } |
|
1822 } |
|
1823 |
|
1824 void CUPnPAVControllerImpl::StartTrackingDownloadProgressL( |
|
1825 const RMessage2& aMessage ) |
|
1826 { |
|
1827 TInt id = aMessage.Int0(); |
|
1828 |
|
1829 // Find the session |
|
1830 TInt count = iDownloadSessions.Count(); |
|
1831 TBool found = EFalse; |
|
1832 for( TInt i = 0; i < count; i++ ) |
|
1833 { |
|
1834 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1835 { |
|
1836 iDownloadSessions[ i ]->StartTrackingDownloadProgressL( |
|
1837 aMessage ); |
|
1838 found = ETrue; |
|
1839 i = count; |
|
1840 } |
|
1841 } |
|
1842 if( !found ) |
|
1843 { |
|
1844 aMessage.Complete( KErrNotFound ); |
|
1845 } |
|
1846 } |
|
1847 |
|
1848 void CUPnPAVControllerImpl::StopTrackingDownloadProgressL( |
|
1849 const RMessage2& aMessage ) |
|
1850 { |
|
1851 TInt id = aMessage.Int0(); |
|
1852 |
|
1853 // Find the session |
|
1854 TInt count = iDownloadSessions.Count(); |
|
1855 TBool found = EFalse; |
|
1856 for( TInt i = 0; i < count; i++ ) |
|
1857 { |
|
1858 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1859 { |
|
1860 iDownloadSessions[ i ]->StopTrackingDownloadProgressL( |
|
1861 aMessage ); |
|
1862 found = ETrue; |
|
1863 i = count; |
|
1864 } |
|
1865 } |
|
1866 if( !found ) |
|
1867 { |
|
1868 aMessage.Complete( KErrNotFound ); |
|
1869 } |
|
1870 } |
|
1871 |
|
1872 void CUPnPAVControllerImpl::GetDownloadEventL( const RMessage2& aMessage ) |
|
1873 { |
|
1874 TInt id = aMessage.Int0(); |
|
1875 |
|
1876 // Find the session |
|
1877 TInt count = iDownloadSessions.Count(); |
|
1878 TBool found = EFalse; |
|
1879 for( TInt i = 0; i < count; i++ ) |
|
1880 { |
|
1881 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1882 { |
|
1883 iDownloadSessions[ i ]->GetDownloadEventL( |
|
1884 aMessage ); |
|
1885 found = ETrue; |
|
1886 i = count; |
|
1887 } |
|
1888 } |
|
1889 if( !found ) |
|
1890 { |
|
1891 aMessage.Complete( KErrNotFound ); |
|
1892 } |
|
1893 } |
|
1894 |
|
1895 void CUPnPAVControllerImpl::CancelGetDownloadEventL( |
|
1896 const RMessage2& aMessage ) |
|
1897 { |
|
1898 TInt id = aMessage.Int0(); |
|
1899 |
|
1900 // Find the session |
|
1901 TInt count = iDownloadSessions.Count(); |
|
1902 TBool found = EFalse; |
|
1903 for( TInt i = 0; i < count; i++ ) |
|
1904 { |
|
1905 if( iDownloadSessions[ i ]->SessionId() == id ) |
|
1906 { |
|
1907 iDownloadSessions[ i ]->CancelGetDownloadEventL( |
|
1908 aMessage ); |
|
1909 found = ETrue; |
|
1910 i = count; |
|
1911 } |
|
1912 } |
|
1913 if( !found ) |
|
1914 { |
|
1915 aMessage.Complete( KErrNotFound ); |
|
1916 } |
|
1917 } |
|
1918 |
|
1919 // -------------------------------------------------------------------------- |
|
1920 // CUPnPAVControllerImpl::DestroyUploadSessionL |
|
1921 // See upnpavcontrollerimpl.h |
|
1922 // -------------------------------------------------------------------------- |
|
1923 void CUPnPAVControllerImpl::CreateUploadSessionL( |
|
1924 const RMessage2& aMessage ) |
|
1925 { |
|
1926 __LOG1( "CUPnPAVControllerImpl::CreateUploadSessionL, 0x%d", |
|
1927 aMessage.Int0() ); |
|
1928 |
|
1929 // Create a downloading session |
|
1930 TInt id = aMessage.Int0(); |
|
1931 |
|
1932 // Read the device UID |
|
1933 TInt len = aMessage.GetDesMaxLength( 1 ); |
|
1934 HBufC8* buf = HBufC8::NewLC( len ); |
|
1935 TPtr8 ptr( buf->Des() ); |
|
1936 User::LeaveIfError( aMessage.Read( 1, ptr ) ); |
|
1937 |
|
1938 CUPnPUploadSession* tempPtr = CUPnPUploadSession::NewL( |
|
1939 iServer, id, *buf ); |
|
1940 CleanupStack::PopAndDestroy( buf ); |
|
1941 iUploadSessions.Append( tempPtr ); |
|
1942 |
|
1943 aMessage.Complete( KErrNone ); |
|
1944 } |
|
1945 |
|
1946 // -------------------------------------------------------------------------- |
|
1947 // CUPnPAVControllerImpl::DestroyUploadSessionL |
|
1948 // See upnpavcontrollerimpl.h |
|
1949 // -------------------------------------------------------------------------- |
|
1950 void CUPnPAVControllerImpl::DestroyUploadSessionL( |
|
1951 const RMessage2& aMessage ) |
|
1952 { |
|
1953 __LOG1( "CUPnPAVControllerImpl::DestroyUploadSessionL, 0x%d", |
|
1954 aMessage.Int0() ); |
|
1955 |
|
1956 // Find and delete an uploading session |
|
1957 TInt id = aMessage.Int0(); |
|
1958 TInt count = iUploadSessions.Count(); |
|
1959 TBool found = EFalse; |
|
1960 for( TInt i = 0; i < count; i++ ) |
|
1961 { |
|
1962 if( iUploadSessions[ i ]->SessionId() == id ) |
|
1963 { |
|
1964 delete iUploadSessions[ i ]; |
|
1965 iUploadSessions.Remove( i ); |
|
1966 found = ETrue; |
|
1967 i = count; |
|
1968 } |
|
1969 } |
|
1970 if( found ) |
|
1971 { |
|
1972 aMessage.Complete( KErrNone ); |
|
1973 } |
|
1974 else |
|
1975 { |
|
1976 aMessage.Complete( KErrNotFound ); |
|
1977 } |
|
1978 } |
|
1979 |
|
1980 void CUPnPAVControllerImpl::StartUploadL( const RMessage2& aMessage ) |
|
1981 { |
|
1982 TInt id = aMessage.Int0(); |
|
1983 |
|
1984 // Find the session |
|
1985 TInt count = iUploadSessions.Count(); |
|
1986 TBool found = EFalse; |
|
1987 for( TInt i = 0; i < count; i++ ) |
|
1988 { |
|
1989 if( iUploadSessions[ i ]->SessionId() == id ) |
|
1990 { |
|
1991 iUploadSessions[ i ]->StartUploadL( |
|
1992 aMessage ); |
|
1993 found = ETrue; |
|
1994 i = count; |
|
1995 } |
|
1996 } |
|
1997 if( !found ) |
|
1998 { |
|
1999 aMessage.Complete( KErrNotFound ); |
|
2000 } |
|
2001 } |
|
2002 |
|
2003 void CUPnPAVControllerImpl::CancelUploadL( const RMessage2& aMessage ) |
|
2004 { |
|
2005 TInt id = aMessage.Int0(); |
|
2006 |
|
2007 // Find the session |
|
2008 TInt count = iUploadSessions.Count(); |
|
2009 TBool found = EFalse; |
|
2010 for( TInt i = 0; i < count; i++ ) |
|
2011 { |
|
2012 if( iUploadSessions[ i ]->SessionId() == id ) |
|
2013 { |
|
2014 iUploadSessions[ i ]->CancelUploadL( |
|
2015 aMessage ); |
|
2016 found = ETrue; |
|
2017 i = count; |
|
2018 } |
|
2019 } |
|
2020 if( !found ) |
|
2021 { |
|
2022 aMessage.Complete( KErrNotFound ); |
|
2023 } |
|
2024 } |
|
2025 |
|
2026 void CUPnPAVControllerImpl::CancelAllUploadsL( const RMessage2& aMessage ) |
|
2027 { |
|
2028 TInt id = aMessage.Int0(); |
|
2029 |
|
2030 // Find the session |
|
2031 TInt count = iUploadSessions.Count(); |
|
2032 TBool found = EFalse; |
|
2033 for( TInt i = 0; i < count; i++ ) |
|
2034 { |
|
2035 if( iUploadSessions[ i ]->SessionId() == id ) |
|
2036 { |
|
2037 iUploadSessions[ i ]->CancelAllUploadsL( |
|
2038 aMessage ); |
|
2039 found = ETrue; |
|
2040 i = count; |
|
2041 } |
|
2042 } |
|
2043 if( !found ) |
|
2044 { |
|
2045 aMessage.Complete( KErrNotFound ); |
|
2046 } |
|
2047 } |
|
2048 |
|
2049 void CUPnPAVControllerImpl::StartTrackingUploadProgressL( const RMessage2& |
|
2050 aMessage ) |
|
2051 { |
|
2052 TInt id = aMessage.Int0(); |
|
2053 |
|
2054 // Find the session |
|
2055 TInt count = iUploadSessions.Count(); |
|
2056 TBool found = EFalse; |
|
2057 for( TInt i = 0; i < count; i++ ) |
|
2058 { |
|
2059 if( iUploadSessions[ i ]->SessionId() == id ) |
|
2060 { |
|
2061 iUploadSessions[ i ]->StartTrackingUploadProgressL( |
|
2062 aMessage ); |
|
2063 found = ETrue; |
|
2064 i = count; |
|
2065 } |
|
2066 } |
|
2067 if( !found ) |
|
2068 { |
|
2069 aMessage.Complete( KErrNotFound ); |
|
2070 } |
|
2071 } |
|
2072 |
|
2073 void CUPnPAVControllerImpl::StopTrackingUploadProgressL( const RMessage2& |
|
2074 aMessage ) |
|
2075 { |
|
2076 TInt id = aMessage.Int0(); |
|
2077 |
|
2078 // Find the session |
|
2079 TInt count = iUploadSessions.Count(); |
|
2080 TBool found = EFalse; |
|
2081 for( TInt i = 0; i < count; i++ ) |
|
2082 { |
|
2083 if( iUploadSessions[ i ]->SessionId() == id ) |
|
2084 { |
|
2085 iUploadSessions[ i ]->StopTrackingUploadProgressL( |
|
2086 aMessage ); |
|
2087 found = ETrue; |
|
2088 i = count; |
|
2089 } |
|
2090 } |
|
2091 if( !found ) |
|
2092 { |
|
2093 aMessage.Complete( KErrNotFound ); |
|
2094 } |
|
2095 } |
|
2096 |
|
2097 void CUPnPAVControllerImpl::GetUploadEventL( const RMessage2& aMessage ) |
|
2098 { |
|
2099 TInt id = aMessage.Int0(); |
|
2100 |
|
2101 // Find the session |
|
2102 TInt count = iUploadSessions.Count(); |
|
2103 TBool found = EFalse; |
|
2104 for( TInt i = 0; i < count; i++ ) |
|
2105 { |
|
2106 if( iUploadSessions[ i ]->SessionId() == id ) |
|
2107 { |
|
2108 iUploadSessions[ i ]->GetUploadEventL( |
|
2109 aMessage ); |
|
2110 found = ETrue; |
|
2111 i = count; |
|
2112 } |
|
2113 } |
|
2114 if( !found ) |
|
2115 { |
|
2116 aMessage.Complete( KErrNotFound ); |
|
2117 } |
|
2118 } |
|
2119 |
|
2120 void CUPnPAVControllerImpl::CancelGetUploadEventL( const RMessage2& |
|
2121 aMessage ) |
|
2122 { |
|
2123 TInt id = aMessage.Int0(); |
|
2124 |
|
2125 // Find the session |
|
2126 TInt count = iUploadSessions.Count(); |
|
2127 TBool found = EFalse; |
|
2128 for( TInt i = 0; i < count; i++ ) |
|
2129 { |
|
2130 if( iUploadSessions[ i ]->SessionId() == id ) |
|
2131 { |
|
2132 iUploadSessions[ i ]->CancelGetUploadEventL( |
|
2133 aMessage ); |
|
2134 found = ETrue; |
|
2135 i = count; |
|
2136 } |
|
2137 } |
|
2138 if( !found ) |
|
2139 { |
|
2140 aMessage.Complete( KErrNotFound ); |
|
2141 } |
|
2142 } |
|
2143 |
|
2144 // end of file |