|
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: implements a renderer playback state machine |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 // INCLUDE FILES |
|
25 // System |
|
26 #include <in_sock.h> |
|
27 #include <mmf/common/mmfcontrollerpluginresolver.h> |
|
28 |
|
29 // upnp stack api |
|
30 #include <upnpdevice.h> |
|
31 #include <upnpcontainer.h> |
|
32 #include <upnpservice.h> |
|
33 #include <upnpitem.h> |
|
34 #include <upnpelement.h> |
|
35 #include <upnpstring.h> |
|
36 #include <upnpmediaserverclient.h> |
|
37 #include <upnpdlnaprotocolinfo.h> |
|
38 #include <upnpavcontrolpoint.h> |
|
39 |
|
40 // upnpframework / xmlparser api |
|
41 #include "upnpxmlparser.h" |
|
42 |
|
43 // upnpframework / avcontroller api |
|
44 #include "upnpavcontrollerglobals.h" |
|
45 |
|
46 // upnpframework / avcontroller helper api |
|
47 #include "upnpitemutility.h" |
|
48 #include "upnpconstantdefs.h" // for upnp-specific stuff |
|
49 |
|
50 // upnpframework / internal api's |
|
51 #include "upnpmetadatafetcher.h" |
|
52 #include "upnpcommonutils.h" |
|
53 #include "upnpcdsreselementutility.h" |
|
54 #include "upnpxmleventparser.h" |
|
55 |
|
56 // avcontroller internal |
|
57 #include "upnpavcontrollerserver.h" |
|
58 #include "upnpavrequest.h" |
|
59 #include "upnpfilesharingactive.h" |
|
60 #include "upnpavdispatcher.h" |
|
61 #include "upnpaverrorhandler.h" |
|
62 #include "upnpavdeviceextended.h" |
|
63 #include "upnpdevicerepository.h" |
|
64 #include "upnpplaybacksession.h" |
|
65 #include "upnpperiodic.h" |
|
66 |
|
67 _LIT( KComponentLogfile, "upnpavcontrollerserver.txt"); |
|
68 #include "upnplog.h" |
|
69 |
|
70 _LIT8( KPlaying, "PLAYING" ); |
|
71 _LIT8( KPaused, "PAUSED_PLAYBACK" ); |
|
72 _LIT8( KStopped, "STOPPED" ); |
|
73 _LIT8( KNormalSpeed, "1" ); |
|
74 _LIT8( KMasterVolume, "Master" ); |
|
75 _LIT8( KMuteOn, "1" ); |
|
76 _LIT8( KMuteOff, "0" ); |
|
77 _LIT8( KAsterisk, "*" ); |
|
78 |
|
79 const TInt KDefaultInstanceId = 0; |
|
80 const TInt KExpectedCount = 1; |
|
81 const TInt KMaxVolume = 100; |
|
82 |
|
83 // Timer to wait until sending the play action after set transport uri. |
|
84 // For some reason, some equipments can not responce play action |
|
85 // immediately after set transport uri, eg. Kiss 1600. |
|
86 const TInt KPlayDelayTimerInterval = 1000000; |
|
87 |
|
88 // ======== MEMBER FUNCTIONS ======== |
|
89 |
|
90 // -------------------------------------------------------------------------- |
|
91 // CUPnPPlaybackSession::NewL |
|
92 // See upnpplaybacksession.h |
|
93 // -------------------------------------------------------------------------- |
|
94 CUPnPPlaybackSession* CUPnPPlaybackSession::NewL |
|
95 ( |
|
96 RUpnpMediaServerClient& aClient, |
|
97 CUpnpAVControllerServer& aServer, |
|
98 TInt aSessionId, |
|
99 const TDesC8& aUuid |
|
100 ) |
|
101 { |
|
102 CUPnPPlaybackSession* self = new (ELeave) CUPnPPlaybackSession( |
|
103 aClient, aServer, aSessionId ); |
|
104 CleanupStack::PushL( self ); |
|
105 self->ConstructL( aUuid ); |
|
106 CleanupStack::Pop( self ); |
|
107 return self; |
|
108 } |
|
109 |
|
110 // -------------------------------------------------------------------------- |
|
111 // CUPnPPlaybackSession::CUPnPPlaybackSession |
|
112 // See upnpplaybacksession.h |
|
113 // -------------------------------------------------------------------------- |
|
114 CUPnPPlaybackSession::CUPnPPlaybackSession |
|
115 ( |
|
116 RUpnpMediaServerClient& aClient, |
|
117 CUpnpAVControllerServer& aServer, |
|
118 TInt aSessionId |
|
119 ): |
|
120 iServer( aServer ), |
|
121 iMediaServer( aClient ), |
|
122 iSessionId( aSessionId ), |
|
123 iInstanceId( KDefaultInstanceId ), |
|
124 iIPSessionIdCommand( KErrNotFound ), |
|
125 iIPSessionIdSetting( KErrNotFound ), |
|
126 iEventingActive( EFalse ), |
|
127 iMuteState( EUnknown ), |
|
128 iVolume( -1 ) |
|
129 { |
|
130 } |
|
131 |
|
132 // -------------------------------------------------------------------------- |
|
133 // CUPnPPlaybackSession::~CUPnPPlaybackSession |
|
134 // See upnpplaybacksession.h |
|
135 // -------------------------------------------------------------------------- |
|
136 CUPnPPlaybackSession::~CUPnPPlaybackSession() |
|
137 { |
|
138 __LOG( "CUPnPPlaybackSession::~CUPnPPlaybackSession" ); |
|
139 |
|
140 if( iPlaybackState == EPlaying || iPlaybackState == EPaused || |
|
141 iPlaybackState == EPlaySent ) |
|
142 { |
|
143 if( iDevice && iServer.DeviceRepository().IsWlanActive() ) |
|
144 { |
|
145 __LOG( "~CUPnPPlaybackSession - \ |
|
146 playback still ongoing, send stop" ); |
|
147 TRAP_IGNORE( iServer.ControlPoint().AvtStopActionL( |
|
148 iDevice->Uuid(), iInstanceId ) ); |
|
149 } |
|
150 else |
|
151 { |
|
152 __LOG( "~CUPnPPlaybackSession - \ |
|
153 playback still ongoing, wlan not active" ); |
|
154 } |
|
155 } |
|
156 |
|
157 if( iSharedItem && iItemShared && iFileSharing ) |
|
158 { |
|
159 TRAP_IGNORE( iFileSharing->UnShareItemL( iSharedItem->Id() ) ); |
|
160 } |
|
161 |
|
162 if( iNextSharedItem && iNextItemShared && iFileSharing ) |
|
163 { |
|
164 TRAP_IGNORE( iFileSharing->UnShareItemL( iNextSharedItem->Id() ) ); |
|
165 } |
|
166 delete iFileSharing; |
|
167 |
|
168 //iMediaServer.Close(); |
|
169 |
|
170 delete iSharedItem; |
|
171 delete iNextSharedItem; |
|
172 |
|
173 delete iEventMessage; |
|
174 delete iSettingMessage; |
|
175 delete iCommandMessage; |
|
176 delete iDeviceMessage; |
|
177 |
|
178 delete iLocalMediaServerUuid; |
|
179 delete iEventParser; |
|
180 |
|
181 iEventQue.Reset(); |
|
182 iEventQue.Close(); |
|
183 |
|
184 if( iEventingActive && iDevice ) |
|
185 { |
|
186 __LOG( "~CUPnPPlaybackSession - UnSubscribeDeviceL" ); |
|
187 TRAP_IGNORE( iServer.DeviceRepository().UnSubscribeDeviceL( |
|
188 iDevice->Uuid() ) ); |
|
189 iServer.Dispatcher().UnRegisterEvents( *this ); |
|
190 iEventingActive = EFalse; |
|
191 } |
|
192 |
|
193 delete iDevice; |
|
194 |
|
195 // delete the playdelay timer |
|
196 if( iPlayDelayTimer ) |
|
197 { |
|
198 iPlayDelayTimer->Cancel(); |
|
199 delete iPlayDelayTimer; |
|
200 } |
|
201 } |
|
202 |
|
203 // -------------------------------------------------------------------------- |
|
204 // CUPnPPlaybackSession::ConstructL |
|
205 // See upnpplaybacksession.h |
|
206 // -------------------------------------------------------------------------- |
|
207 void CUPnPPlaybackSession::ConstructL( const TDesC8& aUuid ) |
|
208 { |
|
209 __LOG( "CUPnPPlaybackSession::ConstructL" ); |
|
210 |
|
211 iFileSharing = CUPnPFileSharingActive::NewL(); |
|
212 |
|
213 iEventParser = CUPnPXMLEventParser::NewL(); |
|
214 |
|
215 const RPointerArray<CUpnpAVDeviceExtended>& devList = |
|
216 iServer.DeviceRepository().DeviceList(); |
|
217 TInt count = devList.Count(); |
|
218 TInt i; |
|
219 for( i = 0; i < count; i++ ) |
|
220 { |
|
221 if( devList[ i ]->Local() ) |
|
222 { |
|
223 __LOG( "CUPnPPlaybackSession::ConstructL - Local MS found!" ); |
|
224 |
|
225 __ASSERTD( !iLocalMediaServerUuid, __FILE__, __LINE__ ); |
|
226 iLocalMediaServerUuid = devList[i]->Uuid().AllocL(); |
|
227 } |
|
228 if( devList[ i ]->Uuid() == aUuid ) |
|
229 { |
|
230 __ASSERTD( !iDevice, __FILE__, __LINE__ ); |
|
231 iDevice = CUpnpAVDeviceExtended::NewL( *devList[ i ] ); |
|
232 } |
|
233 } |
|
234 if( !iDevice ) |
|
235 { |
|
236 User::Leave( KErrNotFound ); |
|
237 } |
|
238 |
|
239 // create the playdelaytimer |
|
240 iPlayDelayTimer = CUPnPPeriodic::NewL( CActive::EPriorityStandard ); |
|
241 } |
|
242 |
|
243 // -------------------------------------------------------------------------- |
|
244 // CUPnPPlaybackSession::RcSetVolumeResponse |
|
245 // See upnpplaybacksession.h |
|
246 // -------------------------------------------------------------------------- |
|
247 void CUPnPPlaybackSession::RcSetVolumeResponse( |
|
248 const TDesC8& /*aUuid*/, |
|
249 TInt aSessionId, |
|
250 TInt aErr, |
|
251 const TDesC8& /*aInstance*/, |
|
252 const TDesC8& /*aChannel*/, |
|
253 const TDesC8& aDesiredVolume ) |
|
254 { |
|
255 __LOG1( "CUPnPPlaybackSession::RcSetVolumeResponse: %d", aErr ); |
|
256 |
|
257 __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ ); |
|
258 |
|
259 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
260 //iSettingPending = EFalse; |
|
261 iIPSessionIdSetting = KErrNotFound; |
|
262 |
|
263 if( iSettingMessage ) |
|
264 { |
|
265 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
266 EUPnPRenderingControlError ); |
|
267 |
|
268 if( aErr == KErrNone ) |
|
269 { |
|
270 TInt vol; |
|
271 TLex8 lex( aDesiredVolume ); |
|
272 TInt err = lex.Val( vol ); |
|
273 if( err == KErrNone ) |
|
274 { |
|
275 TInt maxVolume = iDevice->MaxVolume(); |
|
276 // If max volume not KMaxVolume |
|
277 if( maxVolume != KMaxVolume ) |
|
278 { |
|
279 // Convert volume to match max volume 100 |
|
280 TReal tempVolumeLevel = vol; |
|
281 TReal tempMaxVolume = maxVolume; |
|
282 |
|
283 vol = KMaxVolume * tempVolumeLevel / tempMaxVolume; |
|
284 } |
|
285 iVolume = vol; |
|
286 TPckg<TInt> resp2( vol ); |
|
287 iSettingMessage->Write( 2, resp2 ); |
|
288 |
|
289 iSettingMessage->Complete( EAVControllerSetVolumeCompleted ); |
|
290 delete iSettingMessage; iSettingMessage = NULL; |
|
291 } |
|
292 else |
|
293 { |
|
294 iSettingMessage->Complete( err ); |
|
295 delete iSettingMessage; iSettingMessage = NULL; |
|
296 } |
|
297 } |
|
298 else |
|
299 { |
|
300 iSettingMessage->Complete( aErr ); |
|
301 delete iSettingMessage; iSettingMessage = NULL; |
|
302 } |
|
303 } |
|
304 else |
|
305 { |
|
306 __LOG( "RcSetVolumeResponse - no msg" ); |
|
307 } |
|
308 |
|
309 } |
|
310 |
|
311 // -------------------------------------------------------------------------- |
|
312 // CUPnPPlaybackSession::RcVolumeResponse |
|
313 // See upnpplaybacksession.h |
|
314 // -------------------------------------------------------------------------- |
|
315 void CUPnPPlaybackSession::RcVolumeResponse( |
|
316 const TDesC8& /*aUuid*/, |
|
317 TInt aSessionId, |
|
318 TInt aErr, |
|
319 const TDesC8& /*aInstance*/, |
|
320 const TDesC8& /*aChannel*/, |
|
321 const TDesC8& aCurrentVolume) |
|
322 { |
|
323 __LOG1( "CUPnPPlaybackSession::RcVolumeResponse: %d", aErr ); |
|
324 |
|
325 __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ ); |
|
326 |
|
327 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
328 //iSettingPending = EFalse; |
|
329 iIPSessionIdSetting = KErrNotFound; |
|
330 |
|
331 if( iSettingMessage ) |
|
332 { |
|
333 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
334 EUPnPRenderingControlError ); |
|
335 |
|
336 if( aErr == KErrNone ) |
|
337 { |
|
338 TInt vol; |
|
339 TLex8 lex( aCurrentVolume ); |
|
340 TInt err = lex.Val( vol ); |
|
341 if( err == KErrNone ) |
|
342 { |
|
343 |
|
344 // Get device's maximum volume value |
|
345 TInt maxVolume = iDevice->MaxVolume(); |
|
346 |
|
347 // If max volume not KMaxVolume |
|
348 if( maxVolume != KMaxVolume ) |
|
349 { |
|
350 // Convert volume to match max volume KMaxVolume |
|
351 TReal tempVolumeLevel = vol; |
|
352 TReal tempMaxVolume = maxVolume; |
|
353 |
|
354 vol = KMaxVolume * tempVolumeLevel / tempMaxVolume; |
|
355 } |
|
356 iVolume = vol; |
|
357 TPckg<TInt> resp1( vol ); |
|
358 iSettingMessage->Write( 1, resp1 ); |
|
359 |
|
360 iSettingMessage->Complete( EAVControllerGetVolumeCompleted ); |
|
361 delete iSettingMessage; iSettingMessage = NULL; |
|
362 } |
|
363 else |
|
364 { |
|
365 iSettingMessage->Complete( err ); |
|
366 delete iSettingMessage; iSettingMessage = NULL; |
|
367 } |
|
368 } |
|
369 else |
|
370 { |
|
371 iSettingMessage->Complete( aErr ); |
|
372 delete iSettingMessage; iSettingMessage = NULL; |
|
373 } |
|
374 } |
|
375 else |
|
376 { |
|
377 __LOG( "RcVolumeResponse - no msg" ); |
|
378 } |
|
379 |
|
380 } |
|
381 |
|
382 // -------------------------------------------------------------------------- |
|
383 // CUPnPPlaybackSession::RcSetMuteResponse |
|
384 // See upnpplaybacksession.h |
|
385 // -------------------------------------------------------------------------- |
|
386 void CUPnPPlaybackSession::RcSetMuteResponse( |
|
387 const TDesC8& /*aUuid*/, |
|
388 TInt aSessionId, |
|
389 TInt aErr, |
|
390 const TDesC8& /*aInstance*/, |
|
391 const TDesC8& /*aChannel*/, |
|
392 const TDesC8& aDesiredMute ) |
|
393 { |
|
394 __LOG1( "CUPnPPlaybackSession::RcSetMuteResponse: %d", aErr ); |
|
395 |
|
396 __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ ); |
|
397 |
|
398 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
399 //iSettingPending = EFalse; |
|
400 iIPSessionIdSetting = KErrNotFound; |
|
401 |
|
402 if( iSettingMessage ) |
|
403 { |
|
404 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
405 EUPnPRenderingControlError ); |
|
406 |
|
407 if( aErr == KErrNone ) |
|
408 { |
|
409 TInt mute( EUnknown ); |
|
410 TLex8 lex( aDesiredMute ); |
|
411 TInt err = lex.Val( mute ); |
|
412 |
|
413 // If mute's value isn't ENotMuted or EMuted, |
|
414 // we think the value is incorrect. |
|
415 if ( err == KErrNone && mute != ENotMuted && mute != EMuted ) |
|
416 { |
|
417 err = KErrArgument; |
|
418 } |
|
419 |
|
420 if( err == KErrNone ) |
|
421 { |
|
422 iMuteState = (TMuteState)mute; |
|
423 TPckg<TInt> resp2( mute ); |
|
424 iSettingMessage->Write( 2, resp2 ); |
|
425 |
|
426 iSettingMessage->Complete( EAVControllerSetMuteCompleted ); |
|
427 delete iSettingMessage; iSettingMessage = NULL; |
|
428 } |
|
429 else |
|
430 { |
|
431 iSettingMessage->Complete( err ); |
|
432 delete iSettingMessage; iSettingMessage = NULL; |
|
433 } |
|
434 } |
|
435 else |
|
436 { |
|
437 iSettingMessage->Complete( aErr ); |
|
438 delete iSettingMessage; iSettingMessage = NULL; |
|
439 } |
|
440 } |
|
441 else |
|
442 { |
|
443 __LOG( "RcSetMuteResponse - no msg" ); |
|
444 } |
|
445 |
|
446 } |
|
447 |
|
448 // -------------------------------------------------------------------------- |
|
449 // CUPnPPlaybackSession::RcMuteResponse |
|
450 // See upnpplaybacksession.h |
|
451 // -------------------------------------------------------------------------- |
|
452 void CUPnPPlaybackSession::RcMuteResponse( |
|
453 const TDesC8& /*aUuid*/, |
|
454 TInt aSessionId, |
|
455 TInt aErr, |
|
456 const TDesC8& /*aInstance*/, |
|
457 const TDesC8& /*aChannel*/, |
|
458 const TDesC8& aCurrentMute ) |
|
459 { |
|
460 __LOG1( "CUPnPPlaybackSession::RcMuteResponse: %d" , aErr ); |
|
461 |
|
462 __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ ); |
|
463 |
|
464 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
465 iIPSessionIdSetting = KErrNotFound; |
|
466 |
|
467 if( iSettingMessage ) |
|
468 { |
|
469 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
470 EUPnPRenderingControlError ); |
|
471 |
|
472 if( aErr == KErrNone ) |
|
473 { |
|
474 TInt mute( EUnknown ); |
|
475 TLex8 lex( aCurrentMute ); |
|
476 TInt err = lex.Val( mute ); |
|
477 |
|
478 // If mute's value isn't ENotMuted or EMuted, |
|
479 // we think the value is incorrect. |
|
480 if ( err == KErrNone && mute != ENotMuted && mute != EMuted ) |
|
481 { |
|
482 err = KErrArgument; |
|
483 } |
|
484 |
|
485 if( err == KErrNone ) |
|
486 { |
|
487 iMuteState = (TMuteState)mute; |
|
488 TPckg<TInt> resp1( mute ); |
|
489 iSettingMessage->Write( 1, resp1 ); |
|
490 |
|
491 iSettingMessage->Complete( EAVControllerGetMuteCompleted ); |
|
492 delete iSettingMessage; iSettingMessage = NULL; |
|
493 } |
|
494 else |
|
495 { |
|
496 iSettingMessage->Complete( err ); |
|
497 delete iSettingMessage; iSettingMessage = NULL; |
|
498 } |
|
499 } |
|
500 else |
|
501 { |
|
502 iSettingMessage->Complete( aErr ); |
|
503 delete iSettingMessage; iSettingMessage = NULL; |
|
504 } |
|
505 } |
|
506 else |
|
507 { |
|
508 __LOG( "RcMuteResponse - no msg" ); |
|
509 } |
|
510 } |
|
511 |
|
512 // -------------------------------------------------------------------------- |
|
513 // CUPnPPlaybackSession::AvtSetTransportUriResponse |
|
514 // See upnpplaybacksession.h |
|
515 // -------------------------------------------------------------------------- |
|
516 void CUPnPPlaybackSession::AvtSetTransportUriResponse( |
|
517 const TDesC8& /*aUuid*/, |
|
518 TInt aSessionId, |
|
519 TInt aErr, |
|
520 const TDesC8& aInstanceId, |
|
521 const TDesC8& /*aCurrentUri*/, |
|
522 const TDesC8& /*aCurrentUriMetaData*/) |
|
523 { |
|
524 __LOG1( "CUPnPPlaybackSession::AvtSetTransportUriResponse: %d", aErr ); |
|
525 |
|
526 __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ ); |
|
527 |
|
528 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
529 iIPSessionIdCommand = KErrNotFound; |
|
530 TInt temp; |
|
531 TLex8 lex( aInstanceId ); |
|
532 TInt err = lex.Val( temp ); |
|
533 if( err == KErrNone ) |
|
534 { |
|
535 __LOG1( "AvtSetTransportUriResponse, instance id: %d", temp ); |
|
536 iInstanceId = temp; |
|
537 iPlaybackState = EStopped; |
|
538 } |
|
539 |
|
540 if( iCommandMessage ) |
|
541 { |
|
542 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
543 EUPnPAVTransportError ); |
|
544 |
|
545 if( aErr == KErrNone ) |
|
546 { |
|
547 iCommandMessage->Complete( EAVControllerSetURICompleted ); |
|
548 delete iCommandMessage; iCommandMessage = NULL; |
|
549 } |
|
550 else |
|
551 { |
|
552 iCommandMessage->Complete( aErr ); |
|
553 delete iCommandMessage; iCommandMessage = NULL; |
|
554 } |
|
555 } |
|
556 else |
|
557 { |
|
558 __LOG( "AvtSetTransportUriResponse - no msg" ); |
|
559 } |
|
560 } |
|
561 |
|
562 // -------------------------------------------------------------------------- |
|
563 // CUPnPPlaybackSession::AvtSetNextTransportUriResponse |
|
564 // See upnpplaybacksession.h |
|
565 // -------------------------------------------------------------------------- |
|
566 void CUPnPPlaybackSession::AvtSetNextTransportUriResponse( |
|
567 const TDesC8& /*aUuid*/, |
|
568 TInt aSessionId, |
|
569 TInt aErr, |
|
570 const TDesC8& aInstanceId, |
|
571 const TDesC8& /*aNextUri*/, |
|
572 const TDesC8& /*aNextUriMetaData*/) |
|
573 { |
|
574 __LOG1( "CUPnPPlaybackSession::AvtSetNextTransportUriResponse: %d", |
|
575 aErr ); |
|
576 |
|
577 __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ ); |
|
578 |
|
579 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
580 iIPSessionIdCommand = KErrNotFound; |
|
581 |
|
582 TInt temp; |
|
583 TLex8 lex( aInstanceId ); |
|
584 TInt err = lex.Val( temp ); |
|
585 if( err == KErrNone ) |
|
586 { |
|
587 __LOG1( "AvtSetNextTransportUriResponse, instance id: %d", temp ); |
|
588 //iInstanceId = temp; |
|
589 } |
|
590 |
|
591 if( iCommandMessage ) |
|
592 { |
|
593 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
594 EUPnPAVTransportError ); |
|
595 |
|
596 if( aErr == KErrNone ) |
|
597 { |
|
598 iCommandMessage->Complete( EAVControllerSetNextURICompleted ); |
|
599 delete iCommandMessage; iCommandMessage = NULL; |
|
600 } |
|
601 else |
|
602 { |
|
603 iCommandMessage->Complete( aErr ); |
|
604 delete iCommandMessage; iCommandMessage = NULL; |
|
605 } |
|
606 } |
|
607 else |
|
608 { |
|
609 __LOG( "AvtSetNextTransportUriResponse - no msg" ); |
|
610 } |
|
611 |
|
612 } |
|
613 |
|
614 // -------------------------------------------------------------------------- |
|
615 // CUPnPPlaybackSession::AvtMediaInfoResponse |
|
616 // See upnpplaybacksession.h |
|
617 // -------------------------------------------------------------------------- |
|
618 void CUPnPPlaybackSession::AvtMediaInfoResponse( |
|
619 const TDesC8& /*aUuid*/, |
|
620 TInt /*aSessionId*/, |
|
621 TInt /*aErr*/, |
|
622 const TDesC8& /*aInstanceId*/, |
|
623 const TDesC8& /*aNrTracks*/, |
|
624 const TDesC8& /*aMediaDuration*/, |
|
625 const TDesC8& /*aCurrentUri*/, |
|
626 const TDesC8& /*aCurrentUriMetaData*/, |
|
627 const TDesC8& /*aNextUri*/, |
|
628 const TDesC8& /*aNextUriMetaData*/, |
|
629 const TDesC8& /*aPlayMedium*/, |
|
630 const TDesC8& /*aRecordMedium*/, |
|
631 const TDesC8& /*aWriteStatus*/) |
|
632 { |
|
633 // No implementation required |
|
634 } |
|
635 |
|
636 // -------------------------------------------------------------------------- |
|
637 // CUPnPPlaybackSession::AvtGetTransportInfoResponse |
|
638 // Two-phased constructor. |
|
639 // -------------------------------------------------------------------------- |
|
640 // |
|
641 void CUPnPPlaybackSession::AvtGetTransportInfoResponse( |
|
642 const TDesC8& /*aUuid*/, |
|
643 TInt /*aSessionId*/, |
|
644 TInt /*aErr*/, |
|
645 const TDesC8& /*aInstanceId*/, |
|
646 const TDesC8& /*aCurrenTransportState*/, |
|
647 const TDesC8& /*aCurrentTransportStatus*/, |
|
648 const TDesC8& /*aCurrentSpeed*/) |
|
649 { |
|
650 // No implementation required |
|
651 } |
|
652 |
|
653 // -------------------------------------------------------------------------- |
|
654 // CUPnPPlaybackSession::AvtPositionInfoResponse |
|
655 // See upnpplaybacksession.h |
|
656 // -------------------------------------------------------------------------- |
|
657 void CUPnPPlaybackSession::AvtPositionInfoResponse( |
|
658 const TDesC8& /*aUuid*/, |
|
659 TInt aSessionId, |
|
660 TInt aErr, |
|
661 const TDesC8& /*aInstanceId*/, |
|
662 const TDesC8& /*aTrack*/, |
|
663 const TDesC8& aTrackDuration, |
|
664 const TDesC8& /*aTrackMetaData*/, |
|
665 const TDesC8& /*aTrackURI*/, |
|
666 const TDesC8& aRelTime, |
|
667 const TDesC8& /*aAbsTime*/, |
|
668 const TDesC8& /*aRelCount*/, |
|
669 const TDesC8& /*aAbsCount*/) |
|
670 { |
|
671 __LOG1( "CUPnPPlaybackSession::AvtPositionInfoResponse: %d", aErr ); |
|
672 |
|
673 __ASSERTD( iIPSessionIdSetting == aSessionId, __FILE__, __LINE__ ); |
|
674 |
|
675 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
676 iIPSessionIdSetting = KErrNotFound; |
|
677 |
|
678 if( iSettingMessage ) |
|
679 { |
|
680 TInt err = iSettingMessage->Write( 1, aTrackDuration ); |
|
681 err = iSettingMessage->Write( 2, aRelTime ); |
|
682 // Howto handle err? |
|
683 |
|
684 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
685 EUPnPAVTransportError ); |
|
686 |
|
687 if( aErr == KErrNone ) |
|
688 { |
|
689 iSettingMessage->Complete( EAVControllerPositionInfoCompleted ); |
|
690 delete iSettingMessage; iSettingMessage = NULL; |
|
691 } |
|
692 else |
|
693 { |
|
694 iSettingMessage->Complete( aErr ); |
|
695 delete iSettingMessage; iSettingMessage = NULL; |
|
696 } |
|
697 } |
|
698 else |
|
699 { |
|
700 __LOG( "AvtPositionInfoResponse - no msg" ); |
|
701 } |
|
702 } |
|
703 |
|
704 // -------------------------------------------------------------------------- |
|
705 // CUPnPPlaybackSession::AvtDeviceCapabilitiesResponse |
|
706 // See upnpplaybacksession.h |
|
707 // -------------------------------------------------------------------------- |
|
708 void CUPnPPlaybackSession::AvtDeviceCapabilitiesResponse( |
|
709 const TDesC8& /*aUuid*/, |
|
710 TInt /*aSessionId*/, |
|
711 TInt /*aErr*/, |
|
712 const TDesC8& /*aInstanceId*/, |
|
713 const TDesC8& /*aPlayMedia*/, |
|
714 const TDesC8& /*aRecMedia*/, |
|
715 const TDesC8& /*aRecQualityMode*/) |
|
716 { |
|
717 // No implementation required |
|
718 } |
|
719 |
|
720 // -------------------------------------------------------------------------- |
|
721 // CUPnPPlaybackSession::AvtTransportSettingsResponse |
|
722 // See upnpplaybacksession.h |
|
723 // -------------------------------------------------------------------------- |
|
724 void CUPnPPlaybackSession::AvtTransportSettingsResponse( |
|
725 const TDesC8& /*aUuid*/, |
|
726 TInt /*aSessionId*/, |
|
727 TInt /*aErr*/, |
|
728 const TDesC8& /*aInstanceId*/, |
|
729 const TDesC8& /*aPlayMode*/, |
|
730 const TDesC8& /*aRecQualityMode*/) |
|
731 { |
|
732 // No implementation required |
|
733 } |
|
734 |
|
735 // -------------------------------------------------------------------------- |
|
736 // CUPnPPlaybackSession::AvtStopResponse |
|
737 // See upnpplaybacksession.h |
|
738 // -------------------------------------------------------------------------- |
|
739 void CUPnPPlaybackSession::AvtStopResponse( |
|
740 const TDesC8& /*aUuid*/, |
|
741 TInt aSessionId, |
|
742 TInt aErr, |
|
743 const TDesC8& /*aInstanceId*/) |
|
744 { |
|
745 __LOG1( "CUPnPPlaybackSession::AvtStopResponse: %d", aErr ); |
|
746 |
|
747 __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ ); |
|
748 |
|
749 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
750 //iCommandPending = EFalse; |
|
751 iIPSessionIdCommand = KErrNotFound; |
|
752 |
|
753 if( iCommandMessage ) |
|
754 { |
|
755 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
756 EUPnPAVTransportError ); |
|
757 |
|
758 if( aErr == KErrNone ) |
|
759 { |
|
760 iPlaybackState = EStopped; |
|
761 iCommandMessage->Complete( EAVControllerStopCompleted ); |
|
762 delete iCommandMessage; iCommandMessage = NULL; |
|
763 } |
|
764 else |
|
765 { |
|
766 iCommandMessage->Complete( aErr ); |
|
767 delete iCommandMessage; iCommandMessage = NULL; |
|
768 } |
|
769 } |
|
770 else |
|
771 { |
|
772 __LOG( "AvtStopResponse - no msg" ); |
|
773 } |
|
774 } |
|
775 |
|
776 // -------------------------------------------------------------------------- |
|
777 // CUPnPPlaybackSession::AvtPlayResponse |
|
778 // See upnpplaybacksession.h |
|
779 // -------------------------------------------------------------------------- |
|
780 void CUPnPPlaybackSession::AvtPlayResponse( |
|
781 const TDesC8& /*aUuid*/, |
|
782 TInt aSessionId, |
|
783 TInt aErr, |
|
784 const TDesC8& /*aInstanceId*/, |
|
785 const TDesC8& /*aSpeed*/) |
|
786 { |
|
787 __LOG1( "CUPnPPlaybackSession::AvtPlayResponse: %d", aErr ); |
|
788 |
|
789 __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ ); |
|
790 |
|
791 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
792 //iCommandPending = EFalse; |
|
793 iIPSessionIdCommand = KErrNotFound; |
|
794 |
|
795 if( iCommandMessage ) |
|
796 { |
|
797 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
798 EUPnPAVTransportError ); |
|
799 |
|
800 if( aErr == KErrNone ) |
|
801 { |
|
802 iPlaybackState = EPlaying; |
|
803 iCommandMessage->Complete( EAVControllerPlayCompleted ); |
|
804 delete iCommandMessage; iCommandMessage = NULL; |
|
805 } |
|
806 else |
|
807 { |
|
808 iCommandMessage->Complete( aErr ); |
|
809 delete iCommandMessage; iCommandMessage = NULL; |
|
810 } |
|
811 } |
|
812 else |
|
813 { |
|
814 __LOG( "AvtPlayResponse - no msg" ); |
|
815 } |
|
816 } |
|
817 |
|
818 // -------------------------------------------------------------------------- |
|
819 // CUPnPPlaybackSession::AvtPauseResponse |
|
820 // See upnpplaybacksession.h |
|
821 // -------------------------------------------------------------------------- |
|
822 void CUPnPPlaybackSession::AvtPauseResponse( |
|
823 const TDesC8& /*aUuid*/, |
|
824 TInt aSessionId, |
|
825 TInt aErr, |
|
826 const TDesC8& /*aInstanceId*/) |
|
827 { |
|
828 __LOG1( "CUPnPPlaybackSession::AvtPauseResponse: %d", aErr ); |
|
829 |
|
830 __ASSERTD( iIPSessionIdCommand == aSessionId, __FILE__, __LINE__ ); |
|
831 |
|
832 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
833 //iCommandPending = EFalse; |
|
834 iIPSessionIdCommand = KErrNotFound; |
|
835 |
|
836 if( iCommandMessage ) |
|
837 { |
|
838 aErr = UPnPAVErrorHandler::ConvertToSymbianErrorCode( aErr, |
|
839 EUPnPAVTransportError ); |
|
840 |
|
841 if( aErr == KErrNone ) |
|
842 { |
|
843 iPlaybackState = EPaused; |
|
844 iCommandMessage->Complete( EAVControllerPauseCompleted ); |
|
845 delete iCommandMessage; iCommandMessage = NULL; |
|
846 } |
|
847 else |
|
848 { |
|
849 iCommandMessage->Complete( aErr ); |
|
850 delete iCommandMessage; iCommandMessage = NULL; |
|
851 } |
|
852 } |
|
853 else |
|
854 { |
|
855 __LOG( "AvtPauseResponse - no msg" ); |
|
856 } |
|
857 } |
|
858 |
|
859 // -------------------------------------------------------------------------- |
|
860 // CUPnPPlaybackSession::AvtRecordResponse |
|
861 // See upnpplaybacksession.h |
|
862 // -------------------------------------------------------------------------- |
|
863 void CUPnPPlaybackSession::AvtRecordResponse( |
|
864 const TDesC8& /*aUuid*/, |
|
865 TInt /*aSessionId*/, |
|
866 TInt /*aErr*/, |
|
867 const TDesC8& /*aInstanceId*/) |
|
868 { |
|
869 // No implementation required |
|
870 } |
|
871 |
|
872 // -------------------------------------------------------------------------- |
|
873 // CUPnPPlaybackSession::AvtSeekResponse |
|
874 // See upnpplaybacksession.h |
|
875 // -------------------------------------------------------------------------- |
|
876 void CUPnPPlaybackSession::AvtSeekResponse( |
|
877 const TDesC8& /*aUuid*/, |
|
878 TInt /*aSessionId*/, |
|
879 TInt /*aErr*/, |
|
880 const TDesC8& /*aInstanceId*/, |
|
881 const TDesC8& /*aUnit*/, |
|
882 const TDesC8& /*aTarget*/) |
|
883 { |
|
884 // No implementation required |
|
885 } |
|
886 |
|
887 // -------------------------------------------------------------------------- |
|
888 // CUPnPPlaybackSession::AvtNextResponse |
|
889 // See upnpplaybacksession.h |
|
890 // -------------------------------------------------------------------------- |
|
891 void CUPnPPlaybackSession::AvtNextResponse( |
|
892 const TDesC8& /*aUuid*/, |
|
893 TInt /*aSessionId*/, |
|
894 TInt /*aErr*/, |
|
895 const TDesC8& /*aInstanceId*/) |
|
896 { |
|
897 // No implementation required |
|
898 } |
|
899 |
|
900 // -------------------------------------------------------------------------- |
|
901 // CUPnPPlaybackSession::AvtPreviousResponse |
|
902 // See upnpplaybacksession.h |
|
903 // -------------------------------------------------------------------------- |
|
904 void CUPnPPlaybackSession::AvtPreviousResponse( |
|
905 const TDesC8& /*aUuid*/, |
|
906 TInt /*aSessionId*/, |
|
907 TInt /*aErr*/, |
|
908 const TDesC8& /*aInstanceId*/) |
|
909 { |
|
910 // No implementation required |
|
911 } |
|
912 |
|
913 // -------------------------------------------------------------------------- |
|
914 // CUPnPPlaybackSession::AvtSetPlayModeResponse |
|
915 // See upnpplaybacksession.h |
|
916 // -------------------------------------------------------------------------- |
|
917 void CUPnPPlaybackSession::AvtSetPlayModeResponse( |
|
918 const TDesC8& /*aUuid*/, |
|
919 TInt /*aSessionId*/, |
|
920 TInt /*aErr*/, |
|
921 const TDesC8& /*aInstanceId*/, |
|
922 const TDesC8& /*aNewPlayMode*/) |
|
923 { |
|
924 // No implementation required |
|
925 } |
|
926 |
|
927 // -------------------------------------------------------------------------- |
|
928 // CUPnPPlaybackSession::AvtSetRecordModeResponse |
|
929 // See upnpplaybacksession.h |
|
930 // -------------------------------------------------------------------------- |
|
931 void CUPnPPlaybackSession::AvtSetRecordModeResponse( |
|
932 const TDesC8& /*aUuid*/, |
|
933 TInt /*aSessionId*/, |
|
934 TInt /*aErr*/, |
|
935 const TDesC8& /*aInstanceId*/, |
|
936 const TDesC8& /*aNewRecordQuality*/) |
|
937 { |
|
938 // No implementation required |
|
939 } |
|
940 |
|
941 // -------------------------------------------------------------------------- |
|
942 // CUPnPPlaybackSession::CdsSearchCapabilitiesResponse |
|
943 // See upnpplaybacksession.h |
|
944 // -------------------------------------------------------------------------- |
|
945 void CUPnPPlaybackSession::CdsSearchCapabilitiesResponse( |
|
946 const TDesC8& /*aUuid*/, |
|
947 TInt /*aSessionId*/, |
|
948 TInt /*aErr*/, |
|
949 const TDesC8& /*aSearchCaps*/) |
|
950 { |
|
951 // No implementation required |
|
952 } |
|
953 |
|
954 // -------------------------------------------------------------------------- |
|
955 // CUPnPPlaybackSession::CdsSortCapabilitiesResponse |
|
956 // See upnpplaybacksession.h |
|
957 // -------------------------------------------------------------------------- |
|
958 void CUPnPPlaybackSession::CdsSortCapabilitiesResponse( |
|
959 const TDesC8& /*aUuid*/, |
|
960 TInt /*aSessionId*/, |
|
961 TInt /*aErr*/, |
|
962 const TDesC8& /*aSortCaps*/) |
|
963 { |
|
964 // No implementation required |
|
965 } |
|
966 |
|
967 // -------------------------------------------------------------------------- |
|
968 // CUPnPPlaybackSession::CdsSystemUpdateIdResponse |
|
969 // See upnpplaybacksession.h |
|
970 // -------------------------------------------------------------------------- |
|
971 void CUPnPPlaybackSession::CdsSystemUpdateIdResponse( |
|
972 const TDesC8& /*aUuid*/, |
|
973 TInt /*aSessionId*/, |
|
974 TInt /*aErr*/, |
|
975 TInt /*aSystemUpdateId*/) |
|
976 { |
|
977 // No implementation required |
|
978 } |
|
979 |
|
980 // -------------------------------------------------------------------------- |
|
981 // CUPnPPlaybackSession::CdsBrowseResponse |
|
982 // See upnpplaybacksession.h |
|
983 // -------------------------------------------------------------------------- |
|
984 void CUPnPPlaybackSession::CdsBrowseResponse( |
|
985 const TDesC8& /*aUuid*/, |
|
986 TInt /*aSessionId*/, |
|
987 TInt /*aErr*/, |
|
988 const TDesC8& /*aObjectID*/, |
|
989 const TDesC8& /*aBrowseFlag*/, |
|
990 const TDesC8& /*aFilter*/, |
|
991 TInt /*aIndex*/, |
|
992 TInt /*aRequest*/, |
|
993 const TDesC8& /*aSortCriteria*/, |
|
994 const TDesC8& /*aResult*/, |
|
995 TInt /*aReturned*/, |
|
996 TInt /*aMatches*/, |
|
997 const TDesC8& /*aUpdateID*/ ) |
|
998 { |
|
999 } |
|
1000 |
|
1001 // -------------------------------------------------------------------------- |
|
1002 // CUPnPPlaybackSession::CdsSearchResponse |
|
1003 // See upnpplaybacksession.h |
|
1004 // -------------------------------------------------------------------------- |
|
1005 void CUPnPPlaybackSession::CdsSearchResponse( |
|
1006 const TDesC8& /*aUuid*/, |
|
1007 TInt /*aSessionId*/, |
|
1008 TInt /*aErr*/, |
|
1009 const TDesC8& /*aContainerId*/, |
|
1010 const TDesC8& /*aSearchCriteria*/, |
|
1011 const TDesC8& /*aFilter*/, |
|
1012 TInt /*aIndex*/, |
|
1013 TInt /*aRequest*/, |
|
1014 const TDesC8& /*aSortCriteria*/, |
|
1015 const TDesC8& /*aResult*/, |
|
1016 TInt /*aReturned*/, |
|
1017 TInt /*aMatches*/, |
|
1018 const TDesC8& /*aUpdateID*/) |
|
1019 { |
|
1020 // No implementation required |
|
1021 } |
|
1022 |
|
1023 // -------------------------------------------------------------------------- |
|
1024 // CUPnPPlaybackSession::CdsDestroyObjectResponse |
|
1025 // See upnpplaybacksession.h |
|
1026 // -------------------------------------------------------------------------- |
|
1027 void CUPnPPlaybackSession::CdsDestroyObjectResponse( |
|
1028 const TDesC8& /*aUuid*/, |
|
1029 TInt /*aSessionId*/, |
|
1030 TInt /*aErr*/, |
|
1031 const TDesC8& /*aObjectId*/ ) |
|
1032 { |
|
1033 // No implementation required |
|
1034 } |
|
1035 |
|
1036 // -------------------------------------------------------------------------- |
|
1037 // CUPnPPlaybackSession::CdsUpdateObjectResponse |
|
1038 // See upnpplaybacksession.h |
|
1039 // -------------------------------------------------------------------------- |
|
1040 void CUPnPPlaybackSession::CdsUpdateObjectResponse( |
|
1041 const TDesC8& /*aUuid*/, |
|
1042 TInt /*aSessionId*/, |
|
1043 TInt /*aErr*/, |
|
1044 const TDesC8& /*aObjectId*/, |
|
1045 const TDesC8& /*aCurrentTagValue*/, |
|
1046 const TDesC8& /*aNewTagValue*/ ) |
|
1047 { |
|
1048 // No implementation required |
|
1049 } |
|
1050 |
|
1051 // -------------------------------------------------------------------------- |
|
1052 // CUPnPPlaybackSession::CdsImportResponse |
|
1053 // See upnpplaybacksession.h |
|
1054 // -------------------------------------------------------------------------- |
|
1055 void CUPnPPlaybackSession::CdsImportResponse( |
|
1056 const TDesC8& /*aUuid*/, |
|
1057 TInt /*aSessionId*/, |
|
1058 TInt /*aErr*/, |
|
1059 const TDesC8& /*aSourceURI*/, |
|
1060 const TDesC8& /*aDestinationURI*/, |
|
1061 const TDesC8& /*aTransferId*/ ) |
|
1062 { |
|
1063 // No implementation required |
|
1064 } |
|
1065 |
|
1066 // -------------------------------------------------------------------------- |
|
1067 // CUPnPPlaybackSession::CdsExportResponse |
|
1068 // See upnpplaybacksession.h |
|
1069 // -------------------------------------------------------------------------- |
|
1070 void CUPnPPlaybackSession::CdsExportResponse( |
|
1071 const TDesC8& /*aUuid*/, |
|
1072 TInt /*aSessionId*/, |
|
1073 TInt /*aErr*/, |
|
1074 const TDesC8& /*aSourceURI*/, |
|
1075 const TDesC8& /*aDestinationURI*/, |
|
1076 const TDesC8& /*aTransferId*/ ) |
|
1077 { |
|
1078 // No implementation required |
|
1079 } |
|
1080 |
|
1081 // -------------------------------------------------------------------------- |
|
1082 // CUPnPPlaybackSession::CdsStopTransferResponse |
|
1083 // See upnpplaybacksession.h |
|
1084 // -------------------------------------------------------------------------- |
|
1085 void CUPnPPlaybackSession::CdsStopTransferResponse( |
|
1086 const TDesC8& /*aUuid*/, |
|
1087 TInt /*aSessionId*/, |
|
1088 TInt /*aErr*/, |
|
1089 const TDesC8& /*aTransferId*/ ) |
|
1090 { |
|
1091 // No implementation required |
|
1092 } |
|
1093 |
|
1094 // -------------------------------------------------------------------------- |
|
1095 // CUPnPPlaybackSession::CdsCTransferProgressResponse |
|
1096 // See upnpplaybacksession.h |
|
1097 // -------------------------------------------------------------------------- |
|
1098 void CUPnPPlaybackSession::CdsCTransferProgressResponse( |
|
1099 const TDesC8& /*aUuid*/, |
|
1100 TInt /*aSessionId*/, |
|
1101 TInt /*aErr*/, |
|
1102 const TDesC8& /*aTransferId*/, |
|
1103 const TDesC8& /*aTransferStatus*/, |
|
1104 const TDesC8& /*aTransferLength*/, |
|
1105 const TDesC8& /*aTransferTotal*/ ) |
|
1106 { |
|
1107 // No implementation required |
|
1108 } |
|
1109 |
|
1110 // -------------------------------------------------------------------------- |
|
1111 // CUPnPPlaybackSession::CdsDeleteResourceResponse |
|
1112 // See upnpplaybacksession.h |
|
1113 // -------------------------------------------------------------------------- |
|
1114 void CUPnPPlaybackSession::CdsDeleteResourceResponse( |
|
1115 const TDesC8& /*aUuid*/, |
|
1116 TInt /*aSessionId*/, |
|
1117 TInt /*aErr*/, |
|
1118 const TDesC8& /*aResourceUri*/ ) |
|
1119 { |
|
1120 // No implementation required |
|
1121 } |
|
1122 |
|
1123 // -------------------------------------------------------------------------- |
|
1124 // CUPnPPlaybackSession::CdsCreateReferenceResponse |
|
1125 // See upnpplaybacksession.h |
|
1126 // -------------------------------------------------------------------------- |
|
1127 void CUPnPPlaybackSession::CdsCreateReferenceResponse( |
|
1128 const TDesC8& /*aUuid*/, |
|
1129 TInt /*aSessionId*/, |
|
1130 TInt /*aErr*/, |
|
1131 const TDesC8& /*aContainerId*/, |
|
1132 const TDesC8& /*ObjectId*/, |
|
1133 const TDesC8& /*aNewId*/ ) |
|
1134 { |
|
1135 // No implementation required |
|
1136 } |
|
1137 |
|
1138 // -------------------------------------------------------------------------- |
|
1139 // CUPnPPlaybackSession::CdsCreateObjectResponse |
|
1140 // See upnpplaybacksession.h |
|
1141 // -------------------------------------------------------------------------- |
|
1142 void CUPnPPlaybackSession::CdsCreateObjectResponse( |
|
1143 const TDesC8& /*aUuid*/, |
|
1144 TInt /*aSessionId*/, |
|
1145 TInt /*aErr*/, |
|
1146 const TDesC8& /*aContainerID*/, |
|
1147 const TDesC8& /*aElements*/, |
|
1148 const TDesC8& /*aObjectID*/, |
|
1149 const TDesC8& /*aResult*/ ) |
|
1150 { |
|
1151 // No implementation required |
|
1152 } |
|
1153 |
|
1154 // -------------------------------------------------------------------------- |
|
1155 // CUPnPPlaybackSession::CmProtocolInfoResponse |
|
1156 // See upnpplaybacksession.h |
|
1157 // -------------------------------------------------------------------------- |
|
1158 void CUPnPPlaybackSession::CmProtocolInfoResponse( |
|
1159 const TDesC8& /*aUuid*/, |
|
1160 TInt /*aSessionId*/, |
|
1161 TInt /*aErr*/, |
|
1162 const TDesC8& /*aSource*/, |
|
1163 const TDesC8& /*aSink*/ ) |
|
1164 { |
|
1165 // No implementation required |
|
1166 } |
|
1167 |
|
1168 // -------------------------------------------------------------------------- |
|
1169 // CUPnPPlaybackSession::CmPrepareResponse |
|
1170 // See upnpplaybacksession.h |
|
1171 // -------------------------------------------------------------------------- |
|
1172 void CUPnPPlaybackSession::CmPrepareResponse( |
|
1173 const TDesC8& /*aUuid*/, |
|
1174 TInt /*aSessionId*/, |
|
1175 TInt /*aErr*/, |
|
1176 const TDesC8& /*aRemoteProtocolInfo*/, |
|
1177 const TDesC8& /*aPeerConnectionManager*/, |
|
1178 const TDesC8& /*aPeerConnectionId*/, |
|
1179 const TDesC8& /*aDirection*/, |
|
1180 TInt /*aConnection*/, |
|
1181 TInt /*aTransport*/, |
|
1182 TInt /*aRsc*/ ) |
|
1183 { |
|
1184 // No implementation required |
|
1185 } |
|
1186 |
|
1187 // -------------------------------------------------------------------------- |
|
1188 // CUPnPPlaybackSession::CmComplete |
|
1189 // See upnpplaybacksession.h |
|
1190 // -------------------------------------------------------------------------- |
|
1191 void CUPnPPlaybackSession::CmComplete( |
|
1192 const TDesC8& /*aUuid*/, |
|
1193 TInt /*aSessionId*/, |
|
1194 TInt /*aErr*/, |
|
1195 TInt /*aConnection*/ ) |
|
1196 { |
|
1197 // No implementation required |
|
1198 } |
|
1199 |
|
1200 // -------------------------------------------------------------------------- |
|
1201 // CUPnPPlaybackSession::CmCurrentConnections |
|
1202 // See upnpplaybacksession.h |
|
1203 // -------------------------------------------------------------------------- |
|
1204 void CUPnPPlaybackSession::CmCurrentConnections( |
|
1205 const TDesC8& /*aUuid*/, |
|
1206 TInt /*aSessionId*/, |
|
1207 TInt /*aErr*/, |
|
1208 const TDesC8& /*aConnections*/) |
|
1209 { |
|
1210 // No implementation required |
|
1211 } |
|
1212 |
|
1213 // -------------------------------------------------------------------------- |
|
1214 // CUPnPPlaybackSession::CmCurrentInfo |
|
1215 // See upnpplaybacksession.h |
|
1216 // -------------------------------------------------------------------------- |
|
1217 void CUPnPPlaybackSession::CmCurrentInfo( |
|
1218 const TDesC8& /*aUuid*/, |
|
1219 TInt /*aSessionId*/, |
|
1220 TInt /*aErr*/, |
|
1221 TInt /*rscId*/, |
|
1222 TInt /*transportId*/, |
|
1223 const TDesC8& /*aProtocolInfo*/, |
|
1224 const TDesC8& /*aPeerConnectionManager*/, |
|
1225 TInt /*peerId*/, |
|
1226 const TDesC8& /*aDirection*/, |
|
1227 const TDesC8& /*aStatus*/ ) |
|
1228 { |
|
1229 // No implementation required |
|
1230 } |
|
1231 |
|
1232 // -------------------------------------------------------------------------- |
|
1233 // CUPnPPlaybackSession::CdsUpdateEvent |
|
1234 // See upnpplaybacksession.h |
|
1235 // -------------------------------------------------------------------------- |
|
1236 void CUPnPPlaybackSession::CdsUpdateEvent( |
|
1237 const TDesC8& /*aUuid*/, |
|
1238 TInt /*aSystemUpdateId*/ |
|
1239 ) |
|
1240 { |
|
1241 // No implementation required |
|
1242 } |
|
1243 |
|
1244 // -------------------------------------------------------------------------- |
|
1245 // CUPnPPlaybackSession::CdsContainerEvent |
|
1246 // See upnpplaybacksession.h |
|
1247 // -------------------------------------------------------------------------- |
|
1248 void CUPnPPlaybackSession::CdsContainerEvent( |
|
1249 const TDesC8& /*aUuid*/, |
|
1250 const TDesC8& /*aConteinerIds*/ |
|
1251 ) |
|
1252 { |
|
1253 // No implementation required |
|
1254 } |
|
1255 |
|
1256 // -------------------------------------------------------------------------- |
|
1257 // CUPnPPlaybackSession::CdsTransferEvent |
|
1258 // See upnpplaybacksession.h |
|
1259 // -------------------------------------------------------------------------- |
|
1260 void CUPnPPlaybackSession::CdsTransferEvent( |
|
1261 const TDesC8& /*aUuid*/, |
|
1262 const TDesC8& /*aTransferIds*/ |
|
1263 ) |
|
1264 { |
|
1265 // No implementation required |
|
1266 } |
|
1267 |
|
1268 // -------------------------------------------------------------------------- |
|
1269 // CUPnPPlaybackSession::RcLastChangeEvent |
|
1270 // See upnpplaybacksession.h |
|
1271 // -------------------------------------------------------------------------- |
|
1272 void CUPnPPlaybackSession::RcLastChangeEvent( |
|
1273 const TDesC8& /*aUuid*/, |
|
1274 const TDesC8& aLastChange |
|
1275 ) |
|
1276 { |
|
1277 // No implementation required |
|
1278 if( iPlaybackState != EUninitialized ) |
|
1279 { |
|
1280 __LOG( "CUPnPPlaybackSession::RcLastChangeEvent" ); |
|
1281 //__LOG8( aLastChange ); |
|
1282 |
|
1283 TInt instanceId = -1; |
|
1284 TInt volume = -1; |
|
1285 TBool mute = EFalse; |
|
1286 if( iMuteState == EMuted ) |
|
1287 { |
|
1288 mute = ETrue; |
|
1289 } |
|
1290 |
|
1291 TRAPD( err, iEventParser->ParseResultDataL( aLastChange, instanceId, |
|
1292 volume, mute ) ); |
|
1293 if( err == KErrNone && instanceId == iInstanceId ) |
|
1294 { |
|
1295 TUnsolicitedEventC unEvent; |
|
1296 if( iMuteState != (TMuteState)mute ) |
|
1297 { |
|
1298 // State of mute changed, create an event and send it to |
|
1299 // the client side |
|
1300 unEvent.iEvent = EMute; |
|
1301 unEvent.iValue = (TInt)mute; |
|
1302 |
|
1303 // If mute's value isn't ENotMuted or EMuted, |
|
1304 // we think the value is incorrect. |
|
1305 if ( mute != ENotMuted && mute != EMuted ) |
|
1306 { |
|
1307 err = KErrArgument; |
|
1308 } |
|
1309 else |
|
1310 { |
|
1311 iMuteState = (TMuteState)mute; |
|
1312 } |
|
1313 if( iEventMessage ) |
|
1314 { |
|
1315 TPckg<TUnsolicitedEventC> resp1( unEvent ); |
|
1316 TInt error = iEventMessage->Write( 1, resp1 ); |
|
1317 if ( error == KErrNone ) |
|
1318 { |
|
1319 error = err; |
|
1320 } |
|
1321 iEventMessage->Complete( error ); |
|
1322 delete iEventMessage; iEventMessage = NULL; |
|
1323 } |
|
1324 else if ( err == KErrNone ) |
|
1325 { |
|
1326 // If iEventMessage is invalid and mute's value is |
|
1327 // right, we will append event to iEventQue. |
|
1328 // Else nothing to do. |
|
1329 iEventQue.Append( unEvent ); |
|
1330 } |
|
1331 } |
|
1332 |
|
1333 // Scale the volume level |
|
1334 // Get device's maximum volume value |
|
1335 TInt maxVolume = iDevice->MaxVolume(); |
|
1336 // If max volume not KMaxVolume |
|
1337 if( maxVolume != KMaxVolume ) |
|
1338 { |
|
1339 // Convert volume to match max volume 100 |
|
1340 TReal tempVolumeLevel = volume; |
|
1341 TReal tempMaxVolume = maxVolume; |
|
1342 |
|
1343 volume = KMaxVolume * tempVolumeLevel / tempMaxVolume; |
|
1344 } |
|
1345 |
|
1346 if( iVolume != volume && volume >= 0 ) |
|
1347 { |
|
1348 // State of volume changed, create an event and send it to |
|
1349 // the client side |
|
1350 unEvent.iEvent = EVolume; |
|
1351 unEvent.iValue = volume; |
|
1352 iVolume = volume; |
|
1353 if( iEventMessage ) |
|
1354 { |
|
1355 TPckg<TUnsolicitedEventC> resp1( unEvent ); |
|
1356 TInt err = iEventMessage->Write( 1, resp1 ); |
|
1357 iEventMessage->Complete( err ); |
|
1358 delete iEventMessage; iEventMessage = NULL; |
|
1359 } |
|
1360 else |
|
1361 { |
|
1362 iEventQue.Append( unEvent ); |
|
1363 } |
|
1364 } |
|
1365 |
|
1366 } |
|
1367 } |
|
1368 } |
|
1369 |
|
1370 // -------------------------------------------------------------------------- |
|
1371 // CUPnPPlaybackSession::AvtLastChangeEvent |
|
1372 // See upnpplaybacksession.h |
|
1373 // -------------------------------------------------------------------------- |
|
1374 void CUPnPPlaybackSession::AvtLastChangeEvent( |
|
1375 const TDesC8& /*aUuid*/, |
|
1376 const TDesC8& aLastChange |
|
1377 ) |
|
1378 { |
|
1379 // Is it for this device? |
|
1380 if( iPlaybackState != EUninitialized ) |
|
1381 { |
|
1382 __LOG( "CUPnPPlaybackSession::AvtLastChangeEvent" ); |
|
1383 |
|
1384 TUnsolicitedEventC event; |
|
1385 if( aLastChange.Find( KPlaying ) >= 0 ) |
|
1386 { |
|
1387 __LOG( "AvtLastChangeEvent - PlayUser received" ); |
|
1388 event.iEvent = EPlay; |
|
1389 iPlaybackState = EPlaying; |
|
1390 if( iEventMessage ) |
|
1391 { |
|
1392 TPckg<TUnsolicitedEventC> resp1( event ); |
|
1393 TInt err = iEventMessage->Write( 1, resp1 ); |
|
1394 iEventMessage->Complete( err ); // Ok to complete with err? |
|
1395 delete iEventMessage; iEventMessage = NULL; |
|
1396 } |
|
1397 else |
|
1398 { |
|
1399 __LOG( "AvtLastChangeEvent - appending playuser" ); |
|
1400 iEventQue.Append( event ); |
|
1401 } |
|
1402 } |
|
1403 else if( aLastChange.Find( KStopped ) >= 0 && |
|
1404 iPlaybackState != EStopped ) |
|
1405 { |
|
1406 __LOG( "AvtLastChangeEvent - StopUser received" ); |
|
1407 event.iEvent = EStop; |
|
1408 iPlaybackState = EStopped; |
|
1409 if( iEventMessage ) |
|
1410 { |
|
1411 TPckg<TUnsolicitedEventC> resp1( event ); |
|
1412 TInt err = iEventMessage->Write( 1, resp1 ); |
|
1413 iEventMessage->Complete( err ); // Ok to complete with err? |
|
1414 delete iEventMessage; iEventMessage = NULL; |
|
1415 } |
|
1416 else |
|
1417 { |
|
1418 __LOG( "AvtLastChangeEvent - appending stopuser" ); |
|
1419 iEventQue.Append( event ); |
|
1420 } |
|
1421 } |
|
1422 else if( aLastChange.Find( KPaused ) >= 0 && |
|
1423 iPlaybackState != EPaused ) |
|
1424 { |
|
1425 __LOG( "AvtLastChangeEvent - PauseUser received" ); |
|
1426 event.iEvent = EPause; |
|
1427 iPlaybackState = EPaused; |
|
1428 if( iEventMessage ) |
|
1429 { |
|
1430 __LOG( "CUPnPPlaybackSession::AvtLastChangeEvent" ); |
|
1431 TPckg<TUnsolicitedEventC> resp1( event ); |
|
1432 TInt err = iEventMessage->Write( 1, resp1 ); |
|
1433 iEventMessage->Complete( err ); // Ok to complete with err? |
|
1434 delete iEventMessage; iEventMessage = NULL; |
|
1435 } |
|
1436 else |
|
1437 { |
|
1438 __LOG( "AvtLastChangeEvent - appending pauseuser" ); |
|
1439 iEventQue.Append( event ); |
|
1440 } |
|
1441 } |
|
1442 } |
|
1443 } |
|
1444 |
|
1445 // -------------------------------------------------------------------------- |
|
1446 // CUPnPPlaybackSession::CmSourceEvent |
|
1447 // See upnpplaybacksession.h |
|
1448 // -------------------------------------------------------------------------- |
|
1449 void CUPnPPlaybackSession::CmSourceEvent( |
|
1450 const TDesC8& /*aUuid*/, |
|
1451 const TDesC8& /*aSource*/ |
|
1452 ) |
|
1453 { |
|
1454 // No implementation required |
|
1455 } |
|
1456 |
|
1457 // -------------------------------------------------------------------------- |
|
1458 // CUPnPPlaybackSession::CmSinkEvent |
|
1459 // See upnpplaybacksession.h |
|
1460 // -------------------------------------------------------------------------- |
|
1461 void CUPnPPlaybackSession::CmSinkEvent( |
|
1462 const TDesC8& /*aUuid*/, |
|
1463 const TDesC8& /*aSink*/ |
|
1464 ) |
|
1465 { |
|
1466 // No implementation required |
|
1467 } |
|
1468 |
|
1469 // -------------------------------------------------------------------------- |
|
1470 // CUPnPPlaybackSession::CmConnectionsEvent |
|
1471 // See upnpplaybacksession.h |
|
1472 // -------------------------------------------------------------------------- |
|
1473 void CUPnPPlaybackSession::CmConnectionsEvent( |
|
1474 const TDesC8& /*aUuid*/, |
|
1475 const TDesC8& /*aConnections*/ |
|
1476 ) |
|
1477 { |
|
1478 // No implementation required |
|
1479 } |
|
1480 |
|
1481 // -------------------------------------------------------------------------- |
|
1482 // CUPnPPlaybackSession::HttpResponseL |
|
1483 // See upnpplaybacksession.h |
|
1484 // -------------------------------------------------------------------------- |
|
1485 void CUPnPPlaybackSession::HttpResponseL( CUpnpHttpMessage* /*aMessage*/ ) |
|
1486 { |
|
1487 // No implementation required |
|
1488 } |
|
1489 |
|
1490 // -------------------------------------------------------------------------- |
|
1491 // CUPnPPlaybackSession::DeviceDiscoveredL |
|
1492 // See upnpplaybacksession.h |
|
1493 // -------------------------------------------------------------------------- |
|
1494 void CUPnPPlaybackSession::DeviceDiscoveredL( CUpnpDevice* /*aDevice*/ ) |
|
1495 { |
|
1496 // No implementation required |
|
1497 } |
|
1498 |
|
1499 // -------------------------------------------------------------------------- |
|
1500 // CUPnPPlaybackSession::DeviceDisappearedL |
|
1501 // See upnpplaybacksession.h |
|
1502 // -------------------------------------------------------------------------- |
|
1503 void CUPnPPlaybackSession::DeviceDisappearedL( CUpnpDevice* /*aDevice*/ ) |
|
1504 { |
|
1505 // No implementation required |
|
1506 } |
|
1507 |
|
1508 // -------------------------------------------------------------------------- |
|
1509 // CUPnPPlaybackSession::DeviceDisappearedL |
|
1510 // See upnpplaybacksession.h |
|
1511 // -------------------------------------------------------------------------- |
|
1512 void CUPnPPlaybackSession::DeviceDisappearedL( |
|
1513 CUpnpAVDeviceExtended& aDevice ) |
|
1514 { |
|
1515 __LOG( "CUPnPPlaybackSession::DeviceDisappearedL" ); |
|
1516 |
|
1517 if( aDevice.Local() ) |
|
1518 { |
|
1519 delete iLocalMediaServerUuid; iLocalMediaServerUuid = NULL; |
|
1520 } |
|
1521 else if( iDeviceMessage ) // Target device |
|
1522 { |
|
1523 iDeviceMessage->Complete( KErrNone ); |
|
1524 delete iDeviceMessage; iDeviceMessage = NULL; |
|
1525 } |
|
1526 } |
|
1527 |
|
1528 // -------------------------------------------------------------------------- |
|
1529 // CUPnPPlaybackSession::SetLocalMSUuidL |
|
1530 // See upnpplaybacksession.h |
|
1531 // -------------------------------------------------------------------------- |
|
1532 void CUPnPPlaybackSession::SetLocalMSUuidL( const TDesC8& aUuid ) |
|
1533 { |
|
1534 HBufC8* tmp = aUuid.AllocL(); |
|
1535 delete iLocalMediaServerUuid; |
|
1536 iLocalMediaServerUuid = tmp; |
|
1537 } |
|
1538 |
|
1539 // -------------------------------------------------------------------------- |
|
1540 // CUPnPPlaybackSession::SessionId |
|
1541 // See upnpplaybacksession.h |
|
1542 // -------------------------------------------------------------------------- |
|
1543 TInt CUPnPPlaybackSession::SessionId() const |
|
1544 { |
|
1545 return iSessionId; |
|
1546 } |
|
1547 |
|
1548 // -------------------------------------------------------------------------- |
|
1549 // CUPnPPlaybackSession::EventRequestL |
|
1550 // See upnpplaybacksession.h |
|
1551 // -------------------------------------------------------------------------- |
|
1552 void CUPnPPlaybackSession::EventRequestL( const RMessage2& aMessage ) |
|
1553 { |
|
1554 __LOG( "CUPnPPlaybackSession::EventRequestL" ); |
|
1555 |
|
1556 __ASSERTD( !iEventMessage, __FILE__, __LINE__ ); |
|
1557 |
|
1558 TInt count = iEventQue.Count(); |
|
1559 if( count ) |
|
1560 { |
|
1561 __LOG( "EventRequestL - events in the que" ); |
|
1562 // Events pending, get the event from que and complete the msg |
|
1563 TPckg<TUnsolicitedEventC> resp1( iEventQue[ count - 1 ] ); |
|
1564 TInt err = aMessage.Write( 1, resp1 ); |
|
1565 iEventQue.Remove( count - 1 ); |
|
1566 aMessage.Complete( err ); // Ok to complete with err? |
|
1567 } |
|
1568 else |
|
1569 { |
|
1570 __LOG( "EventRequestL - storing the msg" ); |
|
1571 iEventMessage = new (ELeave) RMessage2( aMessage ); |
|
1572 |
|
1573 if( !iEventingActive ) |
|
1574 { |
|
1575 __LOG( "EventRequestL - subscribing.." ); |
|
1576 iServer.DeviceRepository().SubscribeDeviceL( iDevice->Uuid() ); |
|
1577 iServer.Dispatcher().RegisterForEventsL( *this, |
|
1578 iDevice->Uuid() ); |
|
1579 iEventingActive = ETrue; |
|
1580 } |
|
1581 } |
|
1582 } |
|
1583 |
|
1584 // -------------------------------------------------------------------------- |
|
1585 // CUPnPPlaybackSession::CancelEventRequestL |
|
1586 // See upnpplaybacksession.h |
|
1587 // -------------------------------------------------------------------------- |
|
1588 void CUPnPPlaybackSession::CancelEventRequestL() |
|
1589 { |
|
1590 __LOG( "CUPnPPlaybackSession::CancelEventRequestL" ); |
|
1591 |
|
1592 if( iEventingActive ) |
|
1593 { |
|
1594 __LOG( "CancelEventRequestL - unsubscribing.." ); |
|
1595 iServer.DeviceRepository().UnSubscribeDeviceL( iDevice->Uuid() ); |
|
1596 iServer.Dispatcher().UnRegisterEvents( *this ); |
|
1597 iEventingActive = EFalse; |
|
1598 } |
|
1599 |
|
1600 if( iEventMessage ) |
|
1601 { |
|
1602 __LOG( "CancelEventRequestL - cancelling the msg.." ); |
|
1603 iEventMessage->Complete( KErrCancel ); |
|
1604 delete iEventMessage; iEventMessage = NULL; |
|
1605 } |
|
1606 } |
|
1607 |
|
1608 // -------------------------------------------------------------------------- |
|
1609 // CUPnPPlaybackSession::SetURIL |
|
1610 // See upnpplaybacksession.h |
|
1611 // -------------------------------------------------------------------------- |
|
1612 void CUPnPPlaybackSession::SetURIL( const RMessage2& aMessage ) |
|
1613 { |
|
1614 __LOG( "CUPnPPlaybackSession::SetURIL" ); |
|
1615 |
|
1616 __ASSERTD( !iCommandMessage, __FILE__, __LINE__ ); |
|
1617 |
|
1618 ResetL(); |
|
1619 |
|
1620 if( iPlaybackState == EPlaying || iPlaybackState == EPaused || |
|
1621 iPlaybackState == EPlaySent ) |
|
1622 { |
|
1623 iServer.ControlPoint().AvtStopActionL( iDevice->Uuid(), |
|
1624 iInstanceId ); |
|
1625 } |
|
1626 |
|
1627 if( iItemShared ) |
|
1628 { |
|
1629 iFileSharing->UnShareItemL( iSharedItem->Id() ); |
|
1630 iItemShared = EFalse; |
|
1631 } |
|
1632 |
|
1633 // Uri is set by providing an item. Convert the item to xml document and |
|
1634 // send the action |
|
1635 |
|
1636 __LOG( "SetURIL" ); |
|
1637 |
|
1638 CUpnpAVRequest* tmpRequest = CUpnpAVRequest::NewLC(); |
|
1639 |
|
1640 ReadReqFromMessageL( aMessage, 1 ,tmpRequest ); |
|
1641 |
|
1642 CUpnpItem* tmpItem = CUpnpItem::NewL(); |
|
1643 CleanupStack::PushL( tmpItem ); |
|
1644 |
|
1645 ReadObjFromMessageL( aMessage, 2 ,tmpItem ); |
|
1646 |
|
1647 TPtrC8 uri = tmpRequest->URI(); |
|
1648 |
|
1649 const CUpnpElement& res = |
|
1650 UPnPItemUtility::ResourceFromItemL( *tmpItem ); |
|
1651 const CUpnpAttribute* protocolInfo = |
|
1652 UPnPItemUtility::FindAttributeByName( |
|
1653 res, KAttributeProtocolInfo ); |
|
1654 |
|
1655 if( !iDevice->MatchSinkProtocolInfo( protocolInfo->Value() ) ) |
|
1656 { |
|
1657 // Did not match, try to find a match |
|
1658 TRAPD( err, uri.Set( iDevice->FindFirstMatchingInSinkL( |
|
1659 *tmpItem ) ) ); |
|
1660 if( err == KErrNone ) |
|
1661 { |
|
1662 // Suitable res-element found! |
|
1663 __LOG( "Suitable element found!" ); |
|
1664 } |
|
1665 else if( err == KErrNotSupported ) |
|
1666 { |
|
1667 // No suitable res-element |
|
1668 if( iDevice->DLNADeviceType() == |
|
1669 CUpnpAVDeviceExtended::EDMR ) |
|
1670 { |
|
1671 // DLNA content, DLNA device, no match -> leave |
|
1672 User::Leave( KErrNotSupported ); |
|
1673 } |
|
1674 else |
|
1675 { |
|
1676 // Not a dlna device, try to set the uri of |
|
1677 // original res-element anyways |
|
1678 } |
|
1679 } |
|
1680 else |
|
1681 { |
|
1682 // Some error occured |
|
1683 User::Leave( err ); |
|
1684 } |
|
1685 } |
|
1686 |
|
1687 ValidateProtocolInfoL( *protocolInfo ); |
|
1688 |
|
1689 // Create metadata xml document |
|
1690 HBufC8* xmlDoc = CUPnPXMLParser::ItemAsXmlLC( *tmpItem ); |
|
1691 |
|
1692 iIPSessionIdCommand = iServer.ControlPoint(). |
|
1693 AvtSetTransportUriActionL( iDevice->Uuid(), iInstanceId, uri, |
|
1694 //KNullDesC8 ); |
|
1695 *xmlDoc ); |
|
1696 |
|
1697 CleanupStack::PopAndDestroy( xmlDoc ); |
|
1698 CleanupStack::PopAndDestroy( tmpItem ); |
|
1699 CleanupStack::PopAndDestroy( tmpRequest ); |
|
1700 |
|
1701 |
|
1702 if( iIPSessionIdCommand > 0 ) |
|
1703 { |
|
1704 // Register |
|
1705 iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this ); |
|
1706 } |
|
1707 else |
|
1708 { |
|
1709 User::Leave( iIPSessionIdCommand ); |
|
1710 } |
|
1711 |
|
1712 iCommandMessage = new (ELeave) RMessage2( aMessage ); |
|
1713 |
|
1714 // after settransporturi, there is a delay to send play action. |
|
1715 if ( !iPlayDelayTimer->IsActive() ) |
|
1716 { |
|
1717 iPlayDelayTimer->Start( |
|
1718 0, KPlayDelayTimerInterval, |
|
1719 TCallBack( PlayDelayTimeExpired , this ) ); |
|
1720 } |
|
1721 else |
|
1722 { |
|
1723 iPlayDelayTimer->Cancel(); |
|
1724 iPlayDelayTimer->Start( |
|
1725 0, KPlayDelayTimerInterval, |
|
1726 TCallBack( PlayDelayTimeExpired , this ) ); |
|
1727 } |
|
1728 __LOG( "CUPnPPlaybackSession::SetURIL - end" ); |
|
1729 } |
|
1730 |
|
1731 // -------------------------------------------------------------------------- |
|
1732 // CUPnPPlaybackSession::CancelSetURIL |
|
1733 // See upnpplaybacksession.h |
|
1734 // -------------------------------------------------------------------------- |
|
1735 void CUPnPPlaybackSession::CancelSetURIL() |
|
1736 { |
|
1737 __LOG( "CUPnPPlaybackSession::CancelSetURIL" ); |
|
1738 |
|
1739 if( iCommandMessage ) |
|
1740 { |
|
1741 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
1742 iIPSessionIdCommand = KErrNotFound; |
|
1743 iCommandMessage->Complete( KErrCancel ); |
|
1744 delete iCommandMessage; iCommandMessage = NULL; |
|
1745 } |
|
1746 } |
|
1747 |
|
1748 // -------------------------------------------------------------------------- |
|
1749 // CUPnPPlaybackSession::SetNextURIL |
|
1750 // See upnpplaybacksession.h |
|
1751 // -------------------------------------------------------------------------- |
|
1752 void CUPnPPlaybackSession::SetNextURIL( const RMessage2& aMessage ) |
|
1753 { |
|
1754 __LOG( "CUPnPPlaybackSession::SetNextURIL" ); |
|
1755 |
|
1756 __ASSERTD( !iCommandMessage, __FILE__, __LINE__ ); |
|
1757 |
|
1758 ResetL(); |
|
1759 |
|
1760 if( iNextItemShared ) |
|
1761 { |
|
1762 iFileSharing->UnShareItemL( iNextSharedItem->Id() ); |
|
1763 iNextItemShared = EFalse; |
|
1764 } |
|
1765 |
|
1766 // Uri is set by providing an item. Convert the item to xml document and |
|
1767 // send the action |
|
1768 CUpnpAVRequest* tmpRequest = CUpnpAVRequest::NewLC(); |
|
1769 |
|
1770 ReadReqFromMessageL( aMessage, 1 ,tmpRequest ); |
|
1771 |
|
1772 CUpnpItem* tmpItem = CUpnpItem::NewL(); |
|
1773 CleanupStack::PushL( tmpItem ); |
|
1774 |
|
1775 ReadObjFromMessageL( aMessage, 2 ,tmpItem ); |
|
1776 |
|
1777 TPtrC8 uri = tmpRequest->URI(); |
|
1778 |
|
1779 const CUpnpElement& res = |
|
1780 UPnPItemUtility::ResourceFromItemL( *tmpItem ); |
|
1781 const CUpnpAttribute* protocolInfo = |
|
1782 UPnPItemUtility::FindAttributeByName( |
|
1783 res, KAttributeProtocolInfo ); |
|
1784 |
|
1785 if( !iDevice->MatchSinkProtocolInfo( protocolInfo->Value() ) ) |
|
1786 { |
|
1787 // Did not match, try to find a match |
|
1788 TRAPD( err, uri.Set( iDevice->FindFirstMatchingInSinkL( |
|
1789 *tmpItem ) ) ); |
|
1790 if( err == KErrNone ) |
|
1791 { |
|
1792 // Suitable res-element found! |
|
1793 } |
|
1794 else if( err == KErrNotSupported ) |
|
1795 { |
|
1796 // No suitable res-element |
|
1797 if( iDevice->DLNADeviceType() == |
|
1798 CUpnpAVDeviceExtended::EDMR ) |
|
1799 { |
|
1800 // DLNA content, DLNA device, no match -> leave |
|
1801 User::Leave( KErrNotSupported ); |
|
1802 } |
|
1803 else |
|
1804 { |
|
1805 // Not a dlna device, try to set the uri of |
|
1806 // original res-element anyways |
|
1807 } |
|
1808 } |
|
1809 else |
|
1810 { |
|
1811 // Some error occured |
|
1812 User::Leave( err ); |
|
1813 } |
|
1814 } |
|
1815 |
|
1816 // Create metadata xml document |
|
1817 HBufC8* xmlDoc = CUPnPXMLParser::ItemAsXmlLC( *tmpItem ); |
|
1818 |
|
1819 iIPSessionIdCommand = iServer.ControlPoint(). |
|
1820 AvtSetNextTransportUriActionL( iDevice->Uuid(), iInstanceId, uri, |
|
1821 *xmlDoc ); |
|
1822 |
|
1823 |
|
1824 CleanupStack::PopAndDestroy( xmlDoc ); |
|
1825 CleanupStack::PopAndDestroy( tmpItem ); |
|
1826 CleanupStack::PopAndDestroy( tmpRequest ); |
|
1827 |
|
1828 if( iIPSessionIdCommand > 0 ) |
|
1829 { |
|
1830 // Register |
|
1831 iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this ); |
|
1832 } |
|
1833 else |
|
1834 { |
|
1835 User::Leave( iIPSessionIdCommand ); |
|
1836 } |
|
1837 |
|
1838 iCommandMessage = new (ELeave) RMessage2( aMessage ); |
|
1839 |
|
1840 __LOG( "CUPnPPlaybackSession::SetNextURIL - end" ); |
|
1841 |
|
1842 } |
|
1843 |
|
1844 // -------------------------------------------------------------------------- |
|
1845 // CUPnPPlaybackSession::CancelSetNextURIL |
|
1846 // See upnpplaybacksession.h |
|
1847 // -------------------------------------------------------------------------- |
|
1848 void CUPnPPlaybackSession::CancelSetNextURIL() |
|
1849 { |
|
1850 __LOG( "CUPnPPlaybackSession::CancelSetNextURIL" ); |
|
1851 |
|
1852 //__ASSERTD( iCommandPending, User::Panic( KPanicText, __LINE__ ) ); |
|
1853 if( iCommandMessage ) |
|
1854 { |
|
1855 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
1856 iIPSessionIdCommand = KErrNotFound; |
|
1857 iCommandMessage->Complete( KErrCancel ); |
|
1858 delete iCommandMessage; iCommandMessage = NULL; |
|
1859 } |
|
1860 } |
|
1861 |
|
1862 // -------------------------------------------------------------------------- |
|
1863 // CUPnPPlaybackSession::PlayL |
|
1864 // See upnpplaybacksession.h |
|
1865 // -------------------------------------------------------------------------- |
|
1866 void CUPnPPlaybackSession::PlayL( const RMessage2& aMessage ) |
|
1867 { |
|
1868 __LOG( "CUPnPPlaybackSession::PlayL" ); |
|
1869 if ( !iPlayDelayTimer->IsActive() ) |
|
1870 { |
|
1871 // timer is not running so some time has passed since subscribing |
|
1872 __ASSERTD( !iCommandMessage, __FILE__, __LINE__ ); |
|
1873 |
|
1874 ResetL(); |
|
1875 |
|
1876 iIPSessionIdCommand = iServer.ControlPoint().AvtPlayActionL( |
|
1877 iDevice->Uuid(), iInstanceId, KNormalSpeed ); |
|
1878 |
|
1879 if( iIPSessionIdCommand > 0 ) |
|
1880 { |
|
1881 __LOG( "CUPnPPlaybackSession::PlayL - registering" ); |
|
1882 // Register |
|
1883 iPlaybackState = EPlaySent; |
|
1884 iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this ); |
|
1885 } |
|
1886 else |
|
1887 { |
|
1888 User::Leave( iIPSessionIdCommand ); |
|
1889 } |
|
1890 |
|
1891 } |
|
1892 else // less than KPlayDelayInterval passed since subscribe. |
|
1893 { |
|
1894 // issue the play after the timer expires to make sure some HW |
|
1895 // renderers are not confused when beginning the playback. |
|
1896 iPlayRequested = ETrue; |
|
1897 } |
|
1898 |
|
1899 iCommandMessage = new (ELeave) RMessage2( aMessage ); |
|
1900 __LOG( "CUPnPPlaybackSession::PlayL - end" ); |
|
1901 } |
|
1902 |
|
1903 // -------------------------------------------------------------------------- |
|
1904 // CUPnPPlaybackSession::CancelPlayL |
|
1905 // See upnpplaybacksession.h |
|
1906 // -------------------------------------------------------------------------- |
|
1907 void CUPnPPlaybackSession::CancelPlayL() |
|
1908 { |
|
1909 __LOG( "CUPnPPlaybackSession::CancelPlayL" ); |
|
1910 |
|
1911 //__ASSERTD( iCommandPending, User::Panic( KPanicText, __LINE__ ) ); |
|
1912 if( iCommandMessage ) |
|
1913 { |
|
1914 // cancel postponed play |
|
1915 if ( iPlayDelayTimer->IsActive() ) |
|
1916 { |
|
1917 iPlayDelayTimer->Cancel(); |
|
1918 } |
|
1919 |
|
1920 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
1921 iIPSessionIdCommand = KErrNotFound; |
|
1922 iCommandMessage->Complete( KErrCancel ); |
|
1923 delete iCommandMessage; iCommandMessage = NULL; |
|
1924 } |
|
1925 } |
|
1926 |
|
1927 // -------------------------------------------------------------------------- |
|
1928 // CUPnPPlaybackSession::StopL |
|
1929 // See upnpplaybacksession.h |
|
1930 // -------------------------------------------------------------------------- |
|
1931 void CUPnPPlaybackSession::StopL( const RMessage2& aMessage ) |
|
1932 { |
|
1933 __LOG( "CUPnPPlaybackSession::StopL" ); |
|
1934 |
|
1935 __ASSERTD( !iCommandMessage, __FILE__, __LINE__ ); |
|
1936 |
|
1937 ResetL(); |
|
1938 // state stopped must be check before stopped action |
|
1939 if( iPlaybackState != EStopped ) |
|
1940 { |
|
1941 iIPSessionIdCommand = iServer.ControlPoint().AvtStopActionL( |
|
1942 iDevice->Uuid(), iInstanceId ); |
|
1943 } |
|
1944 |
|
1945 if( iIPSessionIdCommand > 0 ) |
|
1946 { |
|
1947 // Register |
|
1948 iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this ); |
|
1949 } |
|
1950 else |
|
1951 { |
|
1952 User::Leave( iIPSessionIdCommand ); |
|
1953 } |
|
1954 iCommandMessage = new (ELeave) RMessage2( aMessage ); |
|
1955 |
|
1956 __LOG( "CUPnPPlaybackSession::StopL - end" ); |
|
1957 } |
|
1958 |
|
1959 // -------------------------------------------------------------------------- |
|
1960 // CUPnPPlaybackSession::CancelStopL |
|
1961 // See upnpplaybacksession.h |
|
1962 // -------------------------------------------------------------------------- |
|
1963 void CUPnPPlaybackSession::CancelStopL() |
|
1964 { |
|
1965 __LOG( "CUPnPPlaybackSession::CancelStopL" ); |
|
1966 |
|
1967 if( iCommandMessage ) |
|
1968 { |
|
1969 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
1970 iIPSessionIdCommand = KErrNotFound; |
|
1971 iCommandMessage->Complete( KErrCancel ); |
|
1972 delete iCommandMessage; iCommandMessage = NULL; |
|
1973 } |
|
1974 } |
|
1975 |
|
1976 // -------------------------------------------------------------------------- |
|
1977 // CUPnPPlaybackSession::PauseL |
|
1978 // See upnpplaybacksession.h |
|
1979 // -------------------------------------------------------------------------- |
|
1980 void CUPnPPlaybackSession::PauseL( const RMessage2& aMessage ) |
|
1981 { |
|
1982 __LOG( "CUPnPPlaybackSession::PauseL" ); |
|
1983 |
|
1984 __ASSERTD( !iCommandMessage, __FILE__, __LINE__ ); |
|
1985 |
|
1986 ResetL(); |
|
1987 |
|
1988 iIPSessionIdCommand = iServer.ControlPoint().AvtPauseActionL( |
|
1989 iDevice->Uuid(), iInstanceId ); |
|
1990 |
|
1991 if( iIPSessionIdCommand > 0 ) |
|
1992 { |
|
1993 // Register |
|
1994 iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this ); |
|
1995 } |
|
1996 else |
|
1997 { |
|
1998 User::Leave( iIPSessionIdCommand ); |
|
1999 } |
|
2000 iCommandMessage = new (ELeave) RMessage2( aMessage ); |
|
2001 |
|
2002 __LOG( "CUPnPPlaybackSession::PauseL - end" ); |
|
2003 } |
|
2004 |
|
2005 // -------------------------------------------------------------------------- |
|
2006 // CUPnPPlaybackSession::CancelPauseL |
|
2007 // See upnpplaybacksession.h |
|
2008 // -------------------------------------------------------------------------- |
|
2009 void CUPnPPlaybackSession::CancelPauseL() |
|
2010 { |
|
2011 __LOG( "CUPnPPlaybackSession::CancelPauseL" ); |
|
2012 |
|
2013 if( iCommandMessage ) |
|
2014 { |
|
2015 iServer.Dispatcher().UnRegister( iIPSessionIdCommand ); |
|
2016 iIPSessionIdCommand = KErrNotFound; |
|
2017 iCommandMessage->Complete( KErrCancel ); |
|
2018 delete iCommandMessage; iCommandMessage = NULL; |
|
2019 } |
|
2020 } |
|
2021 |
|
2022 // -------------------------------------------------------------------------- |
|
2023 // CUPnPPlaybackSession::SetVolumeL |
|
2024 // See upnpplaybacksession.h |
|
2025 // -------------------------------------------------------------------------- |
|
2026 void CUPnPPlaybackSession::SetVolumeL( const RMessage2& aMessage ) |
|
2027 { |
|
2028 __LOG( "CUPnPPlaybackSession::SetVolumeL" ); |
|
2029 |
|
2030 __ASSERTD( !iSettingMessage, __FILE__, __LINE__ ); |
|
2031 |
|
2032 ResetL(); |
|
2033 |
|
2034 TInt volume = aMessage.Int1(); |
|
2035 |
|
2036 TInt maxVolume = iDevice->MaxVolume(); |
|
2037 |
|
2038 // If max volume not KMaxVolume |
|
2039 if( maxVolume != KMaxVolume ) |
|
2040 { |
|
2041 // Convert volume to match device's max volume |
|
2042 TReal tempVolumeLevel = volume; |
|
2043 TReal tempMaxVolume = maxVolume; |
|
2044 |
|
2045 volume = tempMaxVolume * tempVolumeLevel / KMaxVolume; |
|
2046 } |
|
2047 |
|
2048 |
|
2049 |
|
2050 iIPSessionIdSetting = iServer.ControlPoint().RcSetVolumetActionL( |
|
2051 iDevice->Uuid(), iInstanceId, KMasterVolume, volume ); |
|
2052 |
|
2053 if( iIPSessionIdSetting > 0 ) |
|
2054 { |
|
2055 __LOG( "CUPnPPlaybackSession::SetVolumeL - registering" ); |
|
2056 // Register |
|
2057 iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this ); |
|
2058 } |
|
2059 else |
|
2060 { |
|
2061 User::Leave( iIPSessionIdSetting ); |
|
2062 } |
|
2063 |
|
2064 iSettingMessage = new (ELeave) RMessage2( aMessage ); |
|
2065 } |
|
2066 |
|
2067 // -------------------------------------------------------------------------- |
|
2068 // CUPnPPlaybackSession::CancelSetVolumeL |
|
2069 // See upnpplaybacksession.h |
|
2070 // -------------------------------------------------------------------------- |
|
2071 void CUPnPPlaybackSession::CancelSetVolumeL() |
|
2072 { |
|
2073 __LOG( "CUPnPPlaybackSession::CancelSetVolumeL" ); |
|
2074 |
|
2075 if( iSettingMessage ) |
|
2076 { |
|
2077 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
2078 iIPSessionIdSetting = KErrNotFound; |
|
2079 iSettingMessage->Complete( KErrCancel ); |
|
2080 delete iSettingMessage; iSettingMessage = NULL; |
|
2081 } |
|
2082 } |
|
2083 |
|
2084 // -------------------------------------------------------------------------- |
|
2085 // CUPnPPlaybackSession::GetVolumeL |
|
2086 // See upnpplaybacksession.h |
|
2087 // -------------------------------------------------------------------------- |
|
2088 void CUPnPPlaybackSession::GetVolumeL( const RMessage2& aMessage ) |
|
2089 { |
|
2090 __LOG( "CUPnPPlaybackSession::GetVolumeL" ); |
|
2091 |
|
2092 __ASSERTD( !iSettingMessage, __FILE__, __LINE__ ); |
|
2093 |
|
2094 ResetL(); |
|
2095 |
|
2096 iIPSessionIdSetting = iServer.ControlPoint().RcGetVolumetActionL( |
|
2097 iDevice->Uuid(), iInstanceId, KMasterVolume ); |
|
2098 |
|
2099 if( iIPSessionIdSetting > 0 ) |
|
2100 { |
|
2101 // Register |
|
2102 iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this ); |
|
2103 } |
|
2104 else |
|
2105 { |
|
2106 User::Leave( iIPSessionIdSetting ); |
|
2107 } |
|
2108 iSettingMessage = new (ELeave) RMessage2( aMessage ); |
|
2109 } |
|
2110 |
|
2111 // -------------------------------------------------------------------------- |
|
2112 // CUPnPPlaybackSession::CancelGetVolumeL |
|
2113 // See upnpplaybacksession.h |
|
2114 // -------------------------------------------------------------------------- |
|
2115 void CUPnPPlaybackSession::CancelGetVolumeL() |
|
2116 { |
|
2117 __LOG( "CUPnPPlaybackSession::CancelGetVolumeL" ); |
|
2118 |
|
2119 if( iSettingMessage ) |
|
2120 { |
|
2121 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
2122 iIPSessionIdSetting = KErrNotFound; |
|
2123 iSettingMessage->Complete( KErrCancel ); |
|
2124 delete iSettingMessage; iSettingMessage = NULL; |
|
2125 } |
|
2126 } |
|
2127 |
|
2128 // -------------------------------------------------------------------------- |
|
2129 // CUPnPPlaybackSession::SetMuteL |
|
2130 // See upnpplaybacksession.h |
|
2131 // -------------------------------------------------------------------------- |
|
2132 void CUPnPPlaybackSession::SetMuteL( const RMessage2& aMessage ) |
|
2133 { |
|
2134 __LOG( "CUPnPPlaybackSession::SetMuteL" ); |
|
2135 |
|
2136 __ASSERTD( !iSettingMessage, __FILE__, __LINE__ ); |
|
2137 |
|
2138 ResetL(); |
|
2139 |
|
2140 TInt mute = aMessage.Int1(); |
|
2141 if( mute ) |
|
2142 { |
|
2143 iIPSessionIdSetting = iServer.ControlPoint().RcSetMuteActionL( |
|
2144 iDevice->Uuid(), iInstanceId, KMasterVolume, KMuteOn ); |
|
2145 } |
|
2146 else |
|
2147 { |
|
2148 iIPSessionIdSetting = iServer.ControlPoint().RcSetMuteActionL( |
|
2149 iDevice->Uuid(), iInstanceId, KMasterVolume, KMuteOff ); |
|
2150 } |
|
2151 |
|
2152 if( iIPSessionIdSetting > 0 ) |
|
2153 { |
|
2154 // Register |
|
2155 iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this ); |
|
2156 } |
|
2157 else |
|
2158 { |
|
2159 User::Leave( iIPSessionIdSetting ); |
|
2160 } |
|
2161 |
|
2162 iSettingMessage = new (ELeave) RMessage2( aMessage ); |
|
2163 } |
|
2164 |
|
2165 // -------------------------------------------------------------------------- |
|
2166 // CUPnPPlaybackSession::CancelSetMuteL |
|
2167 // See upnpplaybacksession.h |
|
2168 // -------------------------------------------------------------------------- |
|
2169 void CUPnPPlaybackSession::CancelSetMuteL() |
|
2170 { |
|
2171 __LOG( "CUPnPPlaybackSession::CancelSetMuteL" ); |
|
2172 |
|
2173 if( iSettingMessage ) |
|
2174 { |
|
2175 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
2176 iIPSessionIdSetting = KErrNotFound; |
|
2177 iSettingMessage->Complete( KErrCancel ); |
|
2178 delete iSettingMessage; iSettingMessage = NULL; |
|
2179 } |
|
2180 } |
|
2181 |
|
2182 // -------------------------------------------------------------------------- |
|
2183 // CUPnPPlaybackSession::GetMuteL |
|
2184 // See upnpplaybacksession.h |
|
2185 // -------------------------------------------------------------------------- |
|
2186 void CUPnPPlaybackSession::GetMuteL( const RMessage2& aMessage ) |
|
2187 { |
|
2188 __LOG( "CUPnPPlaybackSession::GetMuteL" ); |
|
2189 |
|
2190 __ASSERTD( !iSettingMessage, __FILE__, __LINE__ ); |
|
2191 |
|
2192 ResetL(); |
|
2193 |
|
2194 iIPSessionIdSetting = iServer.ControlPoint().RcGetMuteActionL( |
|
2195 iDevice->Uuid(), iInstanceId, KMasterVolume ); |
|
2196 |
|
2197 if( iIPSessionIdSetting > 0 ) |
|
2198 { |
|
2199 // Register |
|
2200 iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this ); |
|
2201 } |
|
2202 else |
|
2203 { |
|
2204 User::Leave( iIPSessionIdSetting ); |
|
2205 } |
|
2206 iSettingMessage = new (ELeave) RMessage2( aMessage ); |
|
2207 |
|
2208 } |
|
2209 |
|
2210 // -------------------------------------------------------------------------- |
|
2211 // CUPnPPlaybackSession::CancelGetMuteL |
|
2212 // See upnpplaybacksession.h |
|
2213 // -------------------------------------------------------------------------- |
|
2214 void CUPnPPlaybackSession::CancelGetMuteL() |
|
2215 { |
|
2216 __LOG( "CUPnPPlaybackSession::CancelGetMuteL" ); |
|
2217 |
|
2218 if( iSettingMessage ) |
|
2219 { |
|
2220 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
2221 iIPSessionIdSetting = KErrNotFound; |
|
2222 iSettingMessage->Complete( KErrCancel ); |
|
2223 delete iSettingMessage; iSettingMessage = NULL; |
|
2224 } |
|
2225 } |
|
2226 |
|
2227 // -------------------------------------------------------------------------- |
|
2228 // CUPnPPlaybackSession::GetPositionInfoL |
|
2229 // See upnpplaybacksession.h |
|
2230 // -------------------------------------------------------------------------- |
|
2231 void CUPnPPlaybackSession::GetPositionInfoL( const RMessage2& aMessage ) |
|
2232 { |
|
2233 __LOG( "CUPnPPlaybackSession::GetPositionInfoL" ); |
|
2234 |
|
2235 __ASSERTD( !iSettingMessage, __FILE__, __LINE__ ); |
|
2236 |
|
2237 ResetL(); |
|
2238 |
|
2239 iIPSessionIdSetting = iServer.ControlPoint().AvtPositionInfoActionL( |
|
2240 iDevice->Uuid(), iInstanceId ); |
|
2241 |
|
2242 if( iIPSessionIdSetting > 0 ) |
|
2243 { |
|
2244 // Register |
|
2245 iServer.Dispatcher().RegisterL( iIPSessionIdSetting, *this ); |
|
2246 } |
|
2247 else |
|
2248 { |
|
2249 User::Leave( iIPSessionIdSetting ); |
|
2250 } |
|
2251 iSettingMessage = new (ELeave) RMessage2( aMessage ); |
|
2252 |
|
2253 } |
|
2254 |
|
2255 // -------------------------------------------------------------------------- |
|
2256 // CUPnPPlaybackSession::CancelGetPositionInfoL |
|
2257 // See upnpplaybacksession.h |
|
2258 // -------------------------------------------------------------------------- |
|
2259 void CUPnPPlaybackSession::CancelGetPositionInfoL() |
|
2260 { |
|
2261 __LOG( "CUPnPPlaybackSession::CancelGetPositionInfoL" ); |
|
2262 |
|
2263 if( iSettingMessage ) |
|
2264 { |
|
2265 iServer.Dispatcher().UnRegister( iIPSessionIdSetting ); |
|
2266 iIPSessionIdSetting = KErrNotFound; |
|
2267 iSettingMessage->Complete( KErrCancel ); |
|
2268 delete iSettingMessage; iSettingMessage = NULL; |
|
2269 } |
|
2270 } |
|
2271 |
|
2272 // -------------------------------------------------------------------------- |
|
2273 // CUPnPPlaybackSession::DeviceDisappearedRequestL |
|
2274 // See upnpplaybacksession.h |
|
2275 // -------------------------------------------------------------------------- |
|
2276 void CUPnPPlaybackSession::DeviceDisappearedRequestL( |
|
2277 const RMessage2& aMessage ) |
|
2278 { |
|
2279 __LOG( "CUPnPPlaybackSession::DeviceDisappearedRequestL" ); |
|
2280 |
|
2281 __ASSERTD( !iDeviceMessage, __FILE__, __LINE__ ); |
|
2282 |
|
2283 iDeviceMessage = new (ELeave ) RMessage2( aMessage ); |
|
2284 } |
|
2285 |
|
2286 // -------------------------------------------------------------------------- |
|
2287 // CUPnPPlaybackSession::CancelDeviceDisappearedRequestL |
|
2288 // See upnpplaybacksession.h |
|
2289 // -------------------------------------------------------------------------- |
|
2290 void CUPnPPlaybackSession::CancelDeviceDisappearedRequestL() |
|
2291 { |
|
2292 __LOG( "CUPnPPlaybackSession::CancelDeviceDisappearedRequestL" ); |
|
2293 |
|
2294 if( iDeviceMessage ) |
|
2295 { |
|
2296 iDeviceMessage->Complete( KErrCancel ); |
|
2297 delete iDeviceMessage; iDeviceMessage = NULL; |
|
2298 } |
|
2299 } |
|
2300 |
|
2301 // -------------------------------------------------------------------------- |
|
2302 // CUPnPPlaybackSession::ParseBrowseResponseL |
|
2303 // See upnpplaybacksession.h |
|
2304 // -------------------------------------------------------------------------- |
|
2305 HBufC8* CUPnPPlaybackSession::ParseBrowseResponseL( const TDesC8& aResponse ) |
|
2306 { |
|
2307 __LOG( "CUPnPPlaybackSession::ParseBrowseResponseL" ); |
|
2308 |
|
2309 HBufC8* resource = NULL; |
|
2310 |
|
2311 CUPnPXMLParser* parser = CUPnPXMLParser::NewL(); |
|
2312 CleanupStack::PushL( parser ); |
|
2313 |
|
2314 RPointerArray<CUpnpObject> array; |
|
2315 CleanupResetAndDestroyPushL( array ); |
|
2316 |
|
2317 parser->ParseResultDataL( array, aResponse ); |
|
2318 |
|
2319 if( array.Count() == KExpectedCount ) |
|
2320 { |
|
2321 if( array[ 0 ]->ObjectType() == EUPnPItem ) |
|
2322 { |
|
2323 CUpnpItem* item = static_cast<CUpnpItem*>( array[ 0 ] ); |
|
2324 resource = UPnPItemUtility::ResourceFromItemL( |
|
2325 *item ).Value().AllocL(); |
|
2326 CleanupStack::PushL( resource ); |
|
2327 |
|
2328 const CUpnpElement& res = |
|
2329 UPnPItemUtility::ResourceFromItemL( *item ); |
|
2330 const CUpnpAttribute* protocolInfo = |
|
2331 UPnPItemUtility::FindAttributeByName( |
|
2332 res, KAttributeProtocolInfo ); |
|
2333 |
|
2334 if( !iDevice->MatchSinkProtocolInfo( protocolInfo->Value() ) ) |
|
2335 { |
|
2336 TPtrC8 uri; |
|
2337 // Did not match, try to find a match |
|
2338 TRAPD( err, uri.Set( iDevice->FindFirstMatchingInSinkL( |
|
2339 *item ) ) ); |
|
2340 if( err == KErrNone ) |
|
2341 { |
|
2342 // Suitable res-element found! |
|
2343 CleanupStack::PopAndDestroy( resource ); |
|
2344 resource = uri.AllocL(); |
|
2345 } |
|
2346 else if( err == KErrNotSupported ) |
|
2347 { |
|
2348 // No suitable res-element |
|
2349 if( iDevice->DLNADeviceType() == |
|
2350 CUpnpAVDeviceExtended::EDMR ) |
|
2351 { |
|
2352 // DLNA content, DLNA device, no match -> leave |
|
2353 User::Leave( KErrNotSupported ); |
|
2354 } |
|
2355 else |
|
2356 { |
|
2357 // Not a dlna device, try to set the uri of |
|
2358 // original res-element anyways |
|
2359 CleanupStack::Pop( resource ); |
|
2360 } |
|
2361 } |
|
2362 else |
|
2363 { |
|
2364 // Some error occured |
|
2365 User::Leave( err ); |
|
2366 } |
|
2367 } |
|
2368 } |
|
2369 else |
|
2370 { |
|
2371 User::Leave( KErrGeneral ); |
|
2372 } |
|
2373 } |
|
2374 else |
|
2375 { |
|
2376 User::Leave( KErrGeneral ); |
|
2377 } |
|
2378 |
|
2379 CleanupStack::PopAndDestroy( &array ); |
|
2380 CleanupStack::PopAndDestroy( parser ); |
|
2381 |
|
2382 __LOG( "CUPnPPlaybackSession::ParseBrowseResponseL - end" ); |
|
2383 |
|
2384 if( !resource ) |
|
2385 { |
|
2386 User::Leave( KErrGeneral ); |
|
2387 } |
|
2388 |
|
2389 return resource; |
|
2390 } |
|
2391 |
|
2392 // -------------------------------------------------------------------------- |
|
2393 // CUPnPPlaybackSession::Uuid |
|
2394 // See upnpplaybacksession.h |
|
2395 // -------------------------------------------------------------------------- |
|
2396 const TDesC8& CUPnPPlaybackSession::Uuid() const |
|
2397 { |
|
2398 if( iDevice ) |
|
2399 { |
|
2400 return iDevice->Uuid(); |
|
2401 } |
|
2402 else |
|
2403 { |
|
2404 return KNullDesC8; |
|
2405 } |
|
2406 } |
|
2407 |
|
2408 // -------------------------------------------------------------------------- |
|
2409 // CUPnPPlaybackSession::EncodeXmlL |
|
2410 // See upnpplaybacksession.h |
|
2411 // -------------------------------------------------------------------------- |
|
2412 HBufC8* CUPnPPlaybackSession::EncodeXmlL( const TDesC8& aResult ) |
|
2413 { |
|
2414 HBufC8* tmpBuf = aResult.AllocLC(); |
|
2415 HBufC8* result = UpnpString::EncodeXmlStringL( tmpBuf ); |
|
2416 CleanupStack::PopAndDestroy( tmpBuf ); |
|
2417 return result; |
|
2418 } |
|
2419 |
|
2420 // -------------------------------------------------------------------------- |
|
2421 // CUPnPPlaybackSession::Reset |
|
2422 // See upnpplaybacksession.h |
|
2423 // -------------------------------------------------------------------------- |
|
2424 void CUPnPPlaybackSession::ResetL() |
|
2425 { |
|
2426 __LOG( "CUPnPPlaybackSession::ResetL" ); |
|
2427 |
|
2428 if( !iServer.DeviceRepository().IsWlanActive() ) |
|
2429 { |
|
2430 __LOG( "Reset - disconnected" ); |
|
2431 User::Leave( KErrDisconnected ); |
|
2432 } |
|
2433 } |
|
2434 |
|
2435 // -------------------------------------------------------------------------- |
|
2436 // CUPnPPlaybackSession::ReadObjFromMessageL |
|
2437 // See upnpplaybacksession.h |
|
2438 // -------------------------------------------------------------------------- |
|
2439 void CUPnPPlaybackSession::ReadObjFromMessageL( const RMessage2& aMessage, |
|
2440 TInt aSlot, CUpnpObject* aObj ) |
|
2441 { |
|
2442 // create buffer |
|
2443 TInt len = aMessage.GetDesMaxLength( aSlot ); |
|
2444 HBufC8* buf = HBufC8::NewLC( len ); |
|
2445 TPtr8 ptr( buf->Des() ); |
|
2446 User::LeaveIfError( aMessage.Read( aSlot, ptr ) ); |
|
2447 |
|
2448 // read stream |
|
2449 RDesReadStream stream( *buf ); |
|
2450 CleanupClosePushL( stream ); |
|
2451 |
|
2452 // internalize object |
|
2453 stream >> *aObj; |
|
2454 |
|
2455 // clean up |
|
2456 CleanupStack::PopAndDestroy( &stream ); |
|
2457 CleanupStack::PopAndDestroy( buf ); |
|
2458 } |
|
2459 |
|
2460 // -------------------------------------------------------------------------- |
|
2461 // CUPnPPlaybackSession::ReadReqFromMessageL |
|
2462 // See upnpplaybacksession.h |
|
2463 // -------------------------------------------------------------------------- |
|
2464 void CUPnPPlaybackSession::ReadReqFromMessageL( const RMessage2& aMessage, |
|
2465 TInt aSlot, CUpnpAVRequest* aReq ) |
|
2466 { |
|
2467 // create buffer |
|
2468 TInt len = aMessage.GetDesMaxLength( aSlot ); |
|
2469 HBufC8* buf = HBufC8::NewLC( len ); |
|
2470 TPtr8 ptr( buf->Des() ); |
|
2471 User::LeaveIfError( aMessage.Read( aSlot, ptr ) ); |
|
2472 |
|
2473 // read stream |
|
2474 RDesReadStream stream( *buf ); |
|
2475 CleanupClosePushL( stream ); |
|
2476 |
|
2477 // internalize object |
|
2478 stream >> *aReq; |
|
2479 |
|
2480 // clean up |
|
2481 CleanupStack::PopAndDestroy( &stream ); |
|
2482 CleanupStack::PopAndDestroy( buf ); |
|
2483 } |
|
2484 |
|
2485 void CUPnPPlaybackSession::ValidateProtocolInfoL( const CUpnpAttribute& |
|
2486 aResource ) |
|
2487 { |
|
2488 __LOG( "CUPnPPlaybackSession::ValidateProtocolInfoL" ); |
|
2489 |
|
2490 // Whe'd like to modify the original protocolInfo, that's why constness |
|
2491 // is casted away |
|
2492 CUpnpAttribute& attr = const_cast<CUpnpAttribute&>( aResource ); |
|
2493 |
|
2494 // ProtocolInfo-wrapper takes care of 4th field validation, omitting |
|
2495 // invalid optional parameters |
|
2496 CUpnpDlnaProtocolInfo* tmpInfo = |
|
2497 CUpnpDlnaProtocolInfo::NewL( attr.Value() ); |
|
2498 CleanupStack::PushL( tmpInfo ); |
|
2499 |
|
2500 tmpInfo->SetSecondFieldL( KAsterisk ); // Second field must be '*' |
|
2501 |
|
2502 attr.SetValueL( tmpInfo->ProtocolInfoL() ); |
|
2503 |
|
2504 CleanupStack::PopAndDestroy( tmpInfo ); |
|
2505 } |
|
2506 |
|
2507 // -------------------------------------------------------------------------- |
|
2508 // CUPnPPlaybackSession::SendPlayIfNeededL |
|
2509 // See upnpplaybacksession.h |
|
2510 // -------------------------------------------------------------------------- |
|
2511 void CUPnPPlaybackSession::SendPlayIfNeededL() |
|
2512 { |
|
2513 __LOG( "CUPnPPlaybackSession::SendPlayIfNeededL" ); |
|
2514 if ( iPlayRequested ) |
|
2515 { |
|
2516 // during the timer was running, there was a play request. |
|
2517 // handle it here |
|
2518 iPlayRequested = EFalse; // play request is being handled |
|
2519 |
|
2520 ResetL(); |
|
2521 |
|
2522 iIPSessionIdCommand = iServer.ControlPoint().AvtPlayActionL( |
|
2523 iDevice->Uuid(), iInstanceId, KNormalSpeed ); |
|
2524 |
|
2525 if( iIPSessionIdCommand > 0 ) |
|
2526 { |
|
2527 __LOG( "CUPnPPlaybackSession::SendPlayIfNeededL - registering" ); |
|
2528 // Register |
|
2529 iPlaybackState = EPlaySent; |
|
2530 iServer.Dispatcher().RegisterL( iIPSessionIdCommand, *this ); |
|
2531 } |
|
2532 else |
|
2533 { |
|
2534 User::Leave( iIPSessionIdCommand ); |
|
2535 } |
|
2536 } |
|
2537 } |
|
2538 |
|
2539 // -------------------------------------------------------------------------- |
|
2540 // CUPnPPlaybackSession::PlayDelayTimeExpired |
|
2541 // See upnpplaybacksession.h |
|
2542 // -------------------------------------------------------------------------- |
|
2543 TInt CUPnPPlaybackSession::PlayDelayTimeExpired( TAny* aPtr ) |
|
2544 { |
|
2545 __LOG( "CUPnPPlaybackSession::PlayDelayTimeExpired" ); |
|
2546 TRAPD( err, ( static_cast< CUPnPPlaybackSession* >( aPtr ) )-> |
|
2547 SendPlayIfNeededL() ); |
|
2548 |
|
2549 if ( err ) |
|
2550 { |
|
2551 __LOG( "CUPnPPlaybackSession::PlayDelayTimeExpired error" ); |
|
2552 } |
|
2553 |
|
2554 return ETrue; |
|
2555 } |
|
2556 |
|
2557 // end of file |