upnpavcontroller/upnpavcontrollerserver/src/upnpavdispatcher.cpp
branchnew development branch with rendering state machine and other goodies
changeset 38 5360b7ddc251
parent 32 3785f754ee62
equal deleted inserted replaced
32:3785f754ee62 38:5360b7ddc251
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
    20 // INCLUDE FILES
    24 
    21 
    25 #include "upnpavdispatcher.h"
    22 #include "upnpavdispatcher.h"
    26 
    23 
    27 #include "upnpavactioninfo.h"
    24 #include "upnpavactioninfo.h"
    28 #include "upnpavcontrolpointobserver.h"
    25 #include "upnpavcontrolpointobserver.h"
    29 //#include "upnpavcontrollerimpl.h"
       
    30 #include "upnpavcontrollerserver.h"
    26 #include "upnpavcontrollerserver.h"
    31 
    27 
    32 _LIT( KComponentLogfile, "CUPnPAVDispatcher.txt");
    28 _LIT( KComponentLogfile, "CUPnPAVDispatcher.txt");
    33 #include "upnplog.h"
    29 #include "upnplog.h"
    34 
    30 
    80     self->ConstructL();
    76     self->ConstructL();
    81     return self;
    77     return self;
    82     }
    78     }
    83 
    79 
    84     
    80     
    85 // Destructor
    81 // --------------------------------------------------------------------------
       
    82 // CUPnPAVDispatcher::~CUPnPAVDispatcher
       
    83 // --------------------------------------------------------------------------
       
    84 //
    86 CUPnPAVDispatcher::~CUPnPAVDispatcher()
    85 CUPnPAVDispatcher::~CUPnPAVDispatcher()
    87     {
    86     {
    88     iActionInfos.ResetAndDestroy(); 
    87     iActionInfos.ResetAndDestroy(); 
    89 //    iActionInfosDevice.ResetAndDestroy();
       
    90     iActionInfosEvent.ResetAndDestroy();           
    88     iActionInfosEvent.ResetAndDestroy();           
    91     }
    89     }
    92 
    90 
    93 // --------------------------------------------------------------------------
    91 
    94 // CUPnPAVDispatcher::NewLC
    92 
    95 // Two-phased constructor.
    93 // --------------------------------------------------------------------------
    96 // --------------------------------------------------------------------------
    94 // CUPnPAVDispatcher::ActionResponseL
    97 //
    95 // --------------------------------------------------------------------------
    98 void CUPnPAVDispatcher::RcSetVolumeResponse(
    96 //
    99     const TDesC8& aUuid,
    97 void CUPnPAVDispatcher::ActionResponseL(CUpnpAction* aAction )
   100     TInt aSessionId,
    98     {
   101     TInt aErr, 
    99     __LOG( "CUPnPAVDispatcher::ActionResponseL" );
   102     const TDesC8& aInstance, 
   100 
   103     const TDesC8& aChannel, 
   101     MUpnpAVControlPointObserver& obs = FindObserver( aAction->SessionId() );
   104     const TDesC8& aDesiredVolume)
       
   105     {
       
   106     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   107     if( &obs )
   102     if( &obs )
   108         {
   103         {
   109         obs.RcSetVolumeResponse( aUuid, aSessionId, aErr, aInstance, aChannel,
   104         obs.ActionResponseL( aAction );
   110             aDesiredVolume );        
   105         }
   111         }
   106     }
   112     }
   107 
   113 
   108 // --------------------------------------------------------------------------
   114 // --------------------------------------------------------------------------
   109 // CUPnPAVDispatcher::StateUpdatedL
   115 // CUPnPAVDispatcher::NewLC
   110 // --------------------------------------------------------------------------
   116 // Two-phased constructor.
   111 //
   117 // --------------------------------------------------------------------------
   112 void CUPnPAVDispatcher::StateUpdatedL(CUpnpService* aService)
   118 //
   113     {
   119 void CUPnPAVDispatcher::RcVolumeResponse(
   114     __LOG( "CUPnPAVDispatcher::StateUpdatedL" );
   120     const TDesC8& aUuid,
   115 
   121     TInt aSessionId,
       
   122     TInt aErr, 
       
   123     const TDesC8& aInstance, 
       
   124     const TDesC8& aChannel, 
       
   125     const TDesC8& aCurrentVolume)
       
   126     {
       
   127     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   128     if( &obs )
       
   129         {
       
   130         obs.RcVolumeResponse( aUuid, aSessionId, aErr, aInstance, aChannel,
       
   131             aCurrentVolume );
       
   132         }
       
   133     }
       
   134 
       
   135 // --------------------------------------------------------------------------
       
   136 // CUPnPAVDispatcher::NewLC
       
   137 // Two-phased constructor.
       
   138 // --------------------------------------------------------------------------
       
   139 //
       
   140 void CUPnPAVDispatcher::RcSetMuteResponse(
       
   141     const TDesC8& aUuid,
       
   142     TInt aSessionId,
       
   143     TInt aErr, 
       
   144     const TDesC8& aInstance, 
       
   145     const TDesC8& aChannel, 
       
   146     const TDesC8& aDesiredMute)
       
   147     {
       
   148     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   149     if( &obs )
       
   150         {
       
   151     
       
   152         obs.RcSetMuteResponse( aUuid, aSessionId, aErr, aInstance, aChannel,
       
   153             aDesiredMute );
       
   154         }
       
   155     }
       
   156 
       
   157 // --------------------------------------------------------------------------
       
   158 // CUPnPAVDispatcher::NewLC
       
   159 // Two-phased constructor.
       
   160 // --------------------------------------------------------------------------
       
   161 //
       
   162 void CUPnPAVDispatcher::RcMuteResponse(
       
   163     const TDesC8& aUuid,
       
   164     TInt aSessionId,
       
   165     TInt aErr, 
       
   166     const TDesC8& aInstance, 
       
   167     const TDesC8& aChannel, 
       
   168     const TDesC8& aCurrentMute)
       
   169     {
       
   170     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   171     if( &obs )
       
   172         {
       
   173        
       
   174         obs.RcMuteResponse( aUuid, aSessionId, aErr, aInstance, aChannel,
       
   175             aCurrentMute );
       
   176         }
       
   177     }
       
   178 
       
   179 
       
   180 // --------------------------------------------------------------------------
       
   181 // CUPnPAVDispatcher::NewLC
       
   182 // Two-phased constructor.
       
   183 // --------------------------------------------------------------------------
       
   184 //
       
   185 void CUPnPAVDispatcher::AvtSetTransportUriResponse(
       
   186     const TDesC8& aUuid,
       
   187     TInt aSessionId,
       
   188     TInt aErr,
       
   189     const TDesC8& aInstanceId,
       
   190     const TDesC8& aCurrentUri,
       
   191     const TDesC8& aCurrentUriMetaData)
       
   192     {
       
   193     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   194     if( &obs )
       
   195         {
       
   196         obs.AvtSetTransportUriResponse( aUuid, aSessionId, aErr, aInstanceId,
       
   197             aCurrentUri, aCurrentUriMetaData );
       
   198         }
       
   199     }
       
   200 
       
   201 // --------------------------------------------------------------------------
       
   202 // CUPnPAVDispatcher::NewLC
       
   203 // Two-phased constructor.
       
   204 // --------------------------------------------------------------------------
       
   205 //
       
   206 void CUPnPAVDispatcher::AvtSetNextTransportUriResponse(
       
   207     const TDesC8& aUuid,
       
   208     TInt aSessionId,
       
   209     TInt aErr,
       
   210     const TDesC8& aInstanceId,
       
   211     const TDesC8& aNextUri,
       
   212     const TDesC8& aNextUriMetaData )
       
   213     {
       
   214     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   215     if( &obs )
       
   216         {
       
   217         obs.AvtSetNextTransportUriResponse( aUuid, aSessionId, aErr,
       
   218             aInstanceId, aNextUri, aNextUriMetaData );
       
   219         }
       
   220     }
       
   221   
       
   222 // --------------------------------------------------------------------------
       
   223 // CUPnPAVDispatcher::NewLC
       
   224 // Two-phased constructor.
       
   225 // --------------------------------------------------------------------------
       
   226 //
       
   227 void CUPnPAVDispatcher::AvtMediaInfoResponse(
       
   228     const TDesC8& /*aUuid*/,
       
   229     TInt /*aSessionId*/,
       
   230     TInt /*aErr*/,
       
   231     const TDesC8& /*aInstanceId*/,
       
   232     const TDesC8& /*aNrTracks*/,
       
   233     const TDesC8& /*aMediaDuration*/,
       
   234     const TDesC8& /*aCurrentUri*/,
       
   235     const TDesC8& /*aCurrentUriMetaData*/,
       
   236     const TDesC8& /*aNextUri*/,
       
   237     const TDesC8& /*aNextUriMetaData*/,
       
   238     const TDesC8& /*aPlayMedium*/,
       
   239     const TDesC8& /*aRecordMedium*/,
       
   240     const TDesC8& /*aWriteStatus*/)
       
   241     {
       
   242     
       
   243     }
       
   244 
       
   245 // --------------------------------------------------------------------------
       
   246 // CUPnPAVDispatcher::NewLC
       
   247 // Two-phased constructor.
       
   248 // --------------------------------------------------------------------------
       
   249 //
       
   250 void CUPnPAVDispatcher::AvtGetTransportInfoResponse(
       
   251     const TDesC8& /*aUuid*/,
       
   252     TInt /*aSessionId*/,
       
   253     TInt /*aErr*/,
       
   254     const TDesC8& /*aInstanceId*/,
       
   255     const TDesC8& /*aCurrenTransportState*/,
       
   256     const TDesC8& /*aCurrentTransportStatus*/,
       
   257     const TDesC8& /*aCurrentSpeed*/)
       
   258     {
       
   259     
       
   260     }
       
   261 
       
   262 // --------------------------------------------------------------------------
       
   263 // CUPnPAVDispatcher::NewLC
       
   264 // Two-phased constructor.
       
   265 // --------------------------------------------------------------------------
       
   266 //
       
   267 void CUPnPAVDispatcher::AvtPositionInfoResponse(
       
   268     const TDesC8& aUuid,
       
   269     TInt aSessionId,
       
   270     TInt aErr,
       
   271     const TDesC8& aInstanceId,
       
   272     const TDesC8& aTrack,
       
   273     const TDesC8& aTrackDuration,
       
   274     const TDesC8& aTrackMetaData,
       
   275     const TDesC8& aTrackURI,
       
   276     const TDesC8& aRelTime,
       
   277     const TDesC8& aAbsTime,
       
   278     const TDesC8& aRelCount,
       
   279     const TDesC8& aAbsCount)
       
   280     {
       
   281     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   282     if( &obs )
       
   283         {
       
   284         obs.AvtPositionInfoResponse( aUuid, aSessionId, aErr,
       
   285             aInstanceId, aTrack, aTrackDuration, aTrackMetaData,
       
   286             aTrackURI, aRelTime, aAbsTime, aRelCount, aAbsCount );
       
   287         }
       
   288     }
       
   289 
       
   290 // --------------------------------------------------------------------------
       
   291 // CUPnPAVDispatcher::NewLC
       
   292 // Two-phased constructor.
       
   293 // --------------------------------------------------------------------------
       
   294 //
       
   295 void CUPnPAVDispatcher::AvtDeviceCapabilitiesResponse(
       
   296     const TDesC8& /*aUuid*/,
       
   297     TInt /*aSessionId*/,
       
   298     TInt /*aErr*/,
       
   299     const TDesC8& /*aInstanceId*/,
       
   300     const TDesC8& /*aPlayMedia*/,
       
   301     const TDesC8& /*aRecMedia*/,
       
   302     const TDesC8& /*aRecQualityMode*/)
       
   303     {
       
   304     
       
   305     }
       
   306 
       
   307 // --------------------------------------------------------------------------
       
   308 // CUPnPAVDispatcher::NewLC
       
   309 // Two-phased constructor.
       
   310 // --------------------------------------------------------------------------
       
   311 //
       
   312 void CUPnPAVDispatcher::AvtTransportSettingsResponse(
       
   313     const TDesC8& /*aUuid*/,
       
   314     TInt /*aSessionId*/,
       
   315     TInt /*aErr*/,
       
   316     const TDesC8& /*aInstanceId*/,
       
   317     const TDesC8& /*aPlayMode*/,
       
   318     const TDesC8& /*aRecQualityMode*/)
       
   319     {
       
   320     
       
   321     }
       
   322 
       
   323 // --------------------------------------------------------------------------
       
   324 // CUPnPAVDispatcher::NewLC
       
   325 // Two-phased constructor.
       
   326 // --------------------------------------------------------------------------
       
   327 //
       
   328 void CUPnPAVDispatcher::AvtStopResponse(
       
   329     const TDesC8& aUuid,
       
   330     TInt aSessionId,
       
   331     TInt aErr,
       
   332     const TDesC8& aInstanceId)
       
   333     {
       
   334     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   335     if( &obs )
       
   336         {
       
   337         obs.AvtStopResponse( aUuid, aSessionId, aErr, aInstanceId );
       
   338         }
       
   339     }
       
   340 
       
   341 // --------------------------------------------------------------------------
       
   342 // CUPnPAVDispatcher::NewLC
       
   343 // Two-phased constructor.
       
   344 // --------------------------------------------------------------------------
       
   345 //
       
   346 void CUPnPAVDispatcher::AvtPlayResponse(
       
   347     const TDesC8& aUuid,
       
   348     TInt aSessionId,
       
   349     TInt aErr,
       
   350     const TDesC8& aInstanceId,
       
   351     const TDesC8& aSpeed)
       
   352     {
       
   353     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   354     if( &obs )
       
   355         {
       
   356         obs.AvtPlayResponse( aUuid, aSessionId, aErr, aInstanceId,
       
   357             aSpeed );
       
   358         }
       
   359     }
       
   360 
       
   361 // --------------------------------------------------------------------------
       
   362 // CUPnPAVDispatcher::NewLC
       
   363 // Two-phased constructor.
       
   364 // --------------------------------------------------------------------------
       
   365 //
       
   366 void CUPnPAVDispatcher::AvtPauseResponse(
       
   367     const TDesC8& aUuid,
       
   368     TInt aSessionId,
       
   369     TInt aErr,
       
   370     const TDesC8& aInstanceId)
       
   371     {
       
   372     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   373     if( &obs )
       
   374         {
       
   375         obs.AvtPauseResponse( aUuid, aSessionId, aErr, aInstanceId );
       
   376         }
       
   377     }
       
   378 
       
   379 // --------------------------------------------------------------------------
       
   380 // CUPnPAVDispatcher::NewLC
       
   381 // Two-phased constructor.
       
   382 // --------------------------------------------------------------------------
       
   383 //
       
   384 void CUPnPAVDispatcher::AvtRecordResponse(
       
   385     const TDesC8& /*aUuid*/,
       
   386     TInt /*aSessionId*/,
       
   387     TInt /*aErr*/,
       
   388     const TDesC8& /*aInstanceId*/)
       
   389     {
       
   390     
       
   391     }
       
   392 
       
   393 // --------------------------------------------------------------------------
       
   394 // CUPnPAVDispatcher::NewLC
       
   395 // Two-phased constructor.
       
   396 // --------------------------------------------------------------------------
       
   397 //
       
   398 void CUPnPAVDispatcher::AvtSeekResponse(
       
   399     const TDesC8& /*aUuid*/,
       
   400     TInt /*aSessionId*/,
       
   401     TInt /*aErr*/,
       
   402     const TDesC8& /*aInstanceId*/,
       
   403     const TDesC8& /*aUnit*/,
       
   404     const TDesC8& /*aTarget*/)
       
   405     {
       
   406     
       
   407     }
       
   408 
       
   409 // --------------------------------------------------------------------------
       
   410 // CUPnPAVDispatcher::NewLC
       
   411 // Two-phased constructor.
       
   412 // --------------------------------------------------------------------------
       
   413 //
       
   414 void CUPnPAVDispatcher::AvtNextResponse(
       
   415     const TDesC8& /*aUuid*/,
       
   416     TInt /*aSessionId*/,
       
   417     TInt /*aErr*/,
       
   418     const TDesC8& /*aInstanceId*/)
       
   419     {
       
   420     
       
   421     }
       
   422 
       
   423 // --------------------------------------------------------------------------
       
   424 // CUPnPAVDispatcher::NewLC
       
   425 // Two-phased constructor.
       
   426 // --------------------------------------------------------------------------
       
   427 //
       
   428 void CUPnPAVDispatcher::AvtPreviousResponse(
       
   429     const TDesC8& /*aUuid*/,
       
   430     TInt /*aSessionId*/,
       
   431     TInt /*aErr*/,
       
   432     const TDesC8& /*aInstanceId*/)
       
   433     {
       
   434     
       
   435     }
       
   436 
       
   437 // --------------------------------------------------------------------------
       
   438 // CUPnPAVDispatcher::NewLC
       
   439 // Two-phased constructor.
       
   440 // --------------------------------------------------------------------------
       
   441 //
       
   442 void CUPnPAVDispatcher::AvtSetPlayModeResponse(
       
   443     const TDesC8& /*aUuid*/,
       
   444     TInt /*aSessionId*/,
       
   445     TInt /*aErr*/,
       
   446     const TDesC8& /*aInstanceId*/,
       
   447     const TDesC8& /*aNewPlayMode*/)
       
   448     {
       
   449     
       
   450     }
       
   451 
       
   452 // --------------------------------------------------------------------------
       
   453 // CUPnPAVDispatcher::NewLC
       
   454 // Two-phased constructor.
       
   455 // --------------------------------------------------------------------------
       
   456 //
       
   457 void CUPnPAVDispatcher::AvtSetRecordModeResponse(
       
   458     const TDesC8& /*aUuid*/,
       
   459     TInt /*aSessionId*/,
       
   460     TInt /*aErr*/,
       
   461     const TDesC8& /*aInstanceId*/,
       
   462     const TDesC8& /*aNewRecordQuality*/)
       
   463     {
       
   464     
       
   465     }
       
   466 
       
   467 // --------------------------------------------------------------------------
       
   468 // CUPnPAVDispatcher::NewLC
       
   469 // Two-phased constructor.
       
   470 // --------------------------------------------------------------------------
       
   471 //
       
   472 void CUPnPAVDispatcher::CdsSearchCapabilitiesResponse(
       
   473     const TDesC8& aUuid,
       
   474     TInt aSessionId,
       
   475     TInt aErr,
       
   476     const TDesC8& aSearchCaps)
       
   477     {
       
   478     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   479     if( &obs )
       
   480         {
       
   481         obs.CdsSearchCapabilitiesResponse( aUuid, aSessionId, aErr,
       
   482             aSearchCaps );
       
   483         }
       
   484     }
       
   485 
       
   486 // --------------------------------------------------------------------------
       
   487 // CUPnPAVDispatcher::NewLC
       
   488 // Two-phased constructor.
       
   489 // --------------------------------------------------------------------------
       
   490 //
       
   491 void CUPnPAVDispatcher::CdsSortCapabilitiesResponse(
       
   492     const TDesC8& /*aUuid*/,
       
   493     TInt /*aSessionId*/,
       
   494     TInt /*aErr*/,
       
   495     const TDesC8& /*aSortCaps*/)
       
   496     {
       
   497     
       
   498     }
       
   499 
       
   500 // --------------------------------------------------------------------------
       
   501 // CUPnPAVDispatcher::NewLC
       
   502 // Two-phased constructor.
       
   503 // --------------------------------------------------------------------------
       
   504 //
       
   505 void CUPnPAVDispatcher::CdsSystemUpdateIdResponse(
       
   506     const TDesC8& /*aUuid*/,
       
   507     TInt /*aSessionId*/,
       
   508     TInt /*aErr*/,
       
   509     TInt /*aSystemUpdateId*/)
       
   510     {
       
   511     
       
   512     }
       
   513 
       
   514 // --------------------------------------------------------------------------
       
   515 // CUPnPAVDispatcher::NewLC
       
   516 // Two-phased constructor.
       
   517 // --------------------------------------------------------------------------
       
   518 //
       
   519 void CUPnPAVDispatcher::CdsBrowseResponse(
       
   520     const TDesC8& aUuid,
       
   521     TInt aSessionId,
       
   522     TInt aErr,
       
   523     const TDesC8& aObjectID,
       
   524     const TDesC8&  aBrowseFlag,
       
   525     const TDesC8&  aFilter,
       
   526     TInt aIndex,
       
   527     TInt aRequest,
       
   528     const TDesC8&  aSortCriteria,
       
   529     const TDesC8&  aResult,
       
   530     TInt aReturned,
       
   531     TInt aMatches,
       
   532     const TDesC8&  aUpdateID)
       
   533     {
       
   534     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   535     if( &obs )
       
   536         {
       
   537         obs.CdsBrowseResponse( aUuid, aSessionId, aErr, aObjectID,
       
   538             aBrowseFlag, aFilter, aIndex, aRequest, aSortCriteria,
       
   539             aResult, aReturned, aMatches, aUpdateID );
       
   540         }
       
   541     }
       
   542 
       
   543 // --------------------------------------------------------------------------
       
   544 // CUPnPAVDispatcher::NewLC
       
   545 // Two-phased constructor.
       
   546 // --------------------------------------------------------------------------
       
   547 //
       
   548 void CUPnPAVDispatcher::CdsSearchResponse(
       
   549     const TDesC8& aUuid,
       
   550     TInt aSessionId,
       
   551     TInt aErr,
       
   552     const TDesC8& aContainerId,
       
   553     const TDesC8& aSearchCriteria,
       
   554     const TDesC8& aFilter,
       
   555     TInt aIndex,
       
   556     TInt aRequest,
       
   557     const TDesC8& aSortCriteria,
       
   558     const TDesC8& aResult,
       
   559     TInt aReturned,
       
   560     TInt aMatches,
       
   561     const TDesC8& aUpdateID)
       
   562     {
       
   563     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   564     if( &obs )
       
   565         {
       
   566         obs.CdsSearchResponse( aUuid, aSessionId, aErr, aContainerId,
       
   567             aSearchCriteria, aFilter, aIndex, aRequest, aSortCriteria,
       
   568             aResult, aReturned, aMatches, aUpdateID );
       
   569         }
       
   570     }
       
   571 
       
   572 // --------------------------------------------------------------------------
       
   573 // CUPnPAVDispatcher::NewLC
       
   574 // Two-phased constructor.
       
   575 // --------------------------------------------------------------------------
       
   576 //
       
   577 void CUPnPAVDispatcher::CdsDestroyObjectResponse(
       
   578     const TDesC8& aUuid,
       
   579     TInt aSessionId,
       
   580     TInt aErr,
       
   581     const TDesC8& aObjectId )
       
   582     {
       
   583     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   584     if( &obs )
       
   585         {
       
   586         obs.CdsDestroyObjectResponse( aUuid, aSessionId, aErr, aObjectId );
       
   587         }
       
   588     }
       
   589 
       
   590 // --------------------------------------------------------------------------
       
   591 // CUPnPAVDispatcher::NewLC
       
   592 // Two-phased constructor.
       
   593 // --------------------------------------------------------------------------
       
   594 //
       
   595 void CUPnPAVDispatcher::CdsUpdateObjectResponse(
       
   596     const TDesC8& /*aUuid*/,
       
   597     TInt /*aSessionId*/,
       
   598     TInt /*aErr*/,
       
   599     const TDesC8& /*aObjectId*/,
       
   600     const TDesC8& /*aCurrentTagValue*/,
       
   601     const TDesC8& /*aNewTagValue*/ )
       
   602     {
       
   603     
       
   604     }
       
   605 
       
   606 // --------------------------------------------------------------------------
       
   607 // CUPnPAVDispatcher::NewLC
       
   608 // Two-phased constructor.
       
   609 // --------------------------------------------------------------------------
       
   610 //
       
   611 void CUPnPAVDispatcher::CdsImportResponse(
       
   612     const TDesC8& aUuid,
       
   613     TInt aSessionId,
       
   614     TInt aErr,
       
   615     const TDesC8& aSourceURI,
       
   616     const TDesC8& aDestinationURI,
       
   617     const TDesC8& aTransferId )
       
   618     {
       
   619     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   620     if( &obs )
       
   621         {
       
   622         obs.CdsImportResponse( aUuid, aSessionId, aErr, aSourceURI,
       
   623             aDestinationURI, aTransferId );
       
   624         }
       
   625     
       
   626     }
       
   627 
       
   628 // --------------------------------------------------------------------------
       
   629 // CUPnPAVDispatcher::NewLC
       
   630 // Two-phased constructor.
       
   631 // --------------------------------------------------------------------------
       
   632 //
       
   633 void CUPnPAVDispatcher::CdsExportResponse(
       
   634     const TDesC8& aUuid,
       
   635     TInt aSessionId,
       
   636     TInt aErr,
       
   637     const TDesC8& aSourceURI,
       
   638     const TDesC8& aDestinationURI,
       
   639     const TDesC8& aTransferId )
       
   640     {
       
   641     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   642     if( &obs )
       
   643         {
       
   644         obs.CdsExportResponse( aUuid, aSessionId, aErr, aSourceURI,
       
   645             aDestinationURI, aTransferId );
       
   646         }
       
   647     
       
   648     
       
   649     }
       
   650 
       
   651 // --------------------------------------------------------------------------
       
   652 // CUPnPAVDispatcher::NewLC
       
   653 // Two-phased constructor.
       
   654 // --------------------------------------------------------------------------
       
   655 //
       
   656 void CUPnPAVDispatcher::CdsStopTransferResponse(
       
   657     const TDesC8& aUuid,
       
   658     TInt aSessionId,
       
   659     TInt aErr,
       
   660     const TDesC8& aTransferId )
       
   661     {
       
   662     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   663     if( &obs )
       
   664         {
       
   665         obs.CdsStopTransferResponse( aUuid, aSessionId, aErr, aTransferId );
       
   666         }    
       
   667     }
       
   668 
       
   669 // --------------------------------------------------------------------------
       
   670 // CUPnPAVDispatcher::NewLC
       
   671 // Two-phased constructor.
       
   672 // --------------------------------------------------------------------------
       
   673 //
       
   674 void CUPnPAVDispatcher::CdsCTransferProgressResponse(
       
   675     const TDesC8& aUuid,
       
   676     TInt aSessionId,
       
   677     TInt aErr,
       
   678     const TDesC8& aTransferId,
       
   679     const TDesC8& aTransferStatus,
       
   680     const TDesC8& aTransferLength,            
       
   681     const TDesC8& aTransferTotal )
       
   682     {
       
   683     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   684     if( &obs )
       
   685         {
       
   686         obs.CdsCTransferProgressResponse( aUuid, aSessionId,
       
   687             aErr, aTransferId, aTransferStatus, aTransferLength,
       
   688             aTransferTotal );
       
   689         }
       
   690     }
       
   691 
       
   692 // --------------------------------------------------------------------------
       
   693 // CUPnPAVDispatcher::NewLC
       
   694 // Two-phased constructor.
       
   695 // --------------------------------------------------------------------------
       
   696 //
       
   697 void CUPnPAVDispatcher::CdsDeleteResourceResponse(
       
   698     const TDesC8& /*aUuid*/,
       
   699     TInt /*aSessionId*/,
       
   700     TInt /*aErr*/,
       
   701     const TDesC8& /*aResourceUri*/ )
       
   702     {
       
   703     
       
   704     }
       
   705 
       
   706 // --------------------------------------------------------------------------
       
   707 // CUPnPAVDispatcher::NewLC
       
   708 // Two-phased constructor.
       
   709 // --------------------------------------------------------------------------
       
   710 //
       
   711 void CUPnPAVDispatcher::CdsCreateReferenceResponse(
       
   712     const TDesC8& /*aUuid*/,
       
   713     TInt /*aSessionId*/,
       
   714     TInt /*aErr*/,
       
   715     const TDesC8& /*aContainerId*/, 
       
   716     const TDesC8& /*aObjectId*/, 
       
   717     const TDesC8& /*aNewId*/ )
       
   718     {
       
   719     
       
   720     }
       
   721 
       
   722 // --------------------------------------------------------------------------
       
   723 // CUPnPAVDispatcher::NewLC
       
   724 // Two-phased constructor.
       
   725 // --------------------------------------------------------------------------
       
   726 //
       
   727 void CUPnPAVDispatcher::CdsCreateObjectResponse(
       
   728     const TDesC8& aUuid,
       
   729     TInt aSessionId,
       
   730     TInt aErr,
       
   731     const TDesC8& aContainerID, 
       
   732     const TDesC8& aElements, 
       
   733     const TDesC8& aObjectID, 
       
   734     const TDesC8& aResult )
       
   735     {
       
   736     MUpnpAVControlPointObserver& obs = FindObserver( aSessionId );
       
   737     if( &obs )
       
   738         {
       
   739         obs.CdsCreateObjectResponse( aUuid, aSessionId, aErr, aContainerID,
       
   740             aElements, aObjectID, aResult );
       
   741         }
       
   742     }
       
   743 
       
   744 // --------------------------------------------------------------------------
       
   745 // CUPnPAVDispatcher::NewLC
       
   746 // Two-phased constructor.
       
   747 // --------------------------------------------------------------------------
       
   748 //
       
   749 void CUPnPAVDispatcher::CmProtocolInfoResponse(
       
   750     const TDesC8& aUuid,
       
   751     TInt aSessionId,
       
   752     TInt aErr,
       
   753     const TDesC8& aSource, 
       
   754     const TDesC8& aSink )
       
   755     {
       
   756     iServer.CmProtocolInfoResponse( aUuid, aSessionId, aErr, aSource, aSink );
       
   757     }
       
   758 
       
   759 // --------------------------------------------------------------------------
       
   760 // CUPnPAVDispatcher::NewLC
       
   761 // Two-phased constructor.
       
   762 // --------------------------------------------------------------------------
       
   763 //
       
   764 void CUPnPAVDispatcher::CmPrepareResponse(
       
   765     const TDesC8& /*aUuid*/,
       
   766     TInt /*aSessionId*/,
       
   767     TInt /*aErr*/,
       
   768     const TDesC8& /*aRemoteProtocolInfo*/,
       
   769     const TDesC8& /*aPeerConnectionManager*/,
       
   770     const TDesC8& /*aPeerConnectionId*/,
       
   771     const TDesC8& /*aDirection*/,
       
   772     TInt /*aConnection*/,
       
   773     TInt /*aTransport*/,
       
   774     TInt /*aRsc*/ )
       
   775     {
       
   776     
       
   777     }
       
   778 
       
   779 // --------------------------------------------------------------------------
       
   780 // CUPnPAVDispatcher::NewLC
       
   781 // Two-phased constructor.
       
   782 // --------------------------------------------------------------------------
       
   783 //
       
   784 void CUPnPAVDispatcher::CmComplete(
       
   785     const TDesC8& /*aUuid*/,
       
   786     TInt /*aSessionId*/,
       
   787     TInt /*aErr*/,
       
   788     TInt /*aConnection*/ )
       
   789     {
       
   790     
       
   791     }
       
   792 
       
   793 // --------------------------------------------------------------------------
       
   794 // CUPnPAVDispatcher::NewLC
       
   795 // Two-phased constructor.
       
   796 // --------------------------------------------------------------------------
       
   797 //
       
   798 void CUPnPAVDispatcher::CmCurrentConnections(
       
   799     const TDesC8& /*aUuid*/,
       
   800     TInt /*aSessionId*/,
       
   801     TInt /*aErr*/,
       
   802     const TDesC8& /*aConnections*/)
       
   803     {
       
   804     
       
   805     }
       
   806 
       
   807 // --------------------------------------------------------------------------
       
   808 // CUPnPAVDispatcher::NewLC
       
   809 // Two-phased constructor.
       
   810 // --------------------------------------------------------------------------
       
   811 //
       
   812 void CUPnPAVDispatcher::CmCurrentInfo(
       
   813     const TDesC8& /*aUuid*/,
       
   814     TInt /*aSessionId*/,
       
   815     TInt /*aErr*/,
       
   816     TInt /*rscId*/, 
       
   817     TInt /*transportId*/, 
       
   818     const TDesC8& /*aProtocolInfo*/,
       
   819     const TDesC8& /*aPeerConnectionManager*/, 
       
   820     TInt /*peerId*/, 
       
   821     const TDesC8& /*aDirection*/, 
       
   822     const TDesC8& /*aStatus*/ )
       
   823     {
       
   824     
       
   825     }
       
   826 
       
   827 // --------------------------------------------------------------------------
       
   828 // CUPnPAVDispatcher::NewLC
       
   829 // Two-phased constructor.
       
   830 // --------------------------------------------------------------------------
       
   831 //
       
   832 void CUPnPAVDispatcher::CdsUpdateEvent(
       
   833         const TDesC8& /*aUuid*/,
       
   834         TInt /*aSystemUpdateId*/
       
   835         )
       
   836     {
       
   837     
       
   838     }
       
   839 
       
   840 // --------------------------------------------------------------------------
       
   841 // CUPnPAVDispatcher::NewLC
       
   842 // Two-phased constructor.
       
   843 // --------------------------------------------------------------------------
       
   844 //
       
   845 void CUPnPAVDispatcher::CdsContainerEvent(
       
   846         const TDesC8& /*aUuid*/,
       
   847         const TDesC8& /*aConteinerIds*/
       
   848         )
       
   849     {
       
   850     
       
   851     }
       
   852 
       
   853 // --------------------------------------------------------------------------
       
   854 // CUPnPAVDispatcher::NewLC
       
   855 // Two-phased constructor.
       
   856 // --------------------------------------------------------------------------
       
   857 //
       
   858 void CUPnPAVDispatcher::CdsTransferEvent(
       
   859         const TDesC8& /*aUuid*/,
       
   860         const TDesC8& /*aTransferIds*/
       
   861         )
       
   862     {
       
   863 
       
   864     }
       
   865 
       
   866 // --------------------------------------------------------------------------
       
   867 // CUPnPAVDispatcher::NewLC
       
   868 // Two-phased constructor.
       
   869 // --------------------------------------------------------------------------
       
   870 //
       
   871 void CUPnPAVDispatcher::RcLastChangeEvent(
       
   872         const TDesC8& aUuid,
       
   873         const TDesC8& aLastChange
       
   874         )
       
   875     {
       
   876     // Forward to each observer
   116     // Forward to each observer
   877     TInt tempCount = iActionInfosEvent.Count();
   117     TInt tempCount = iActionInfosEvent.Count();
   878     
   118     
   879     for( TInt i = 0; i < tempCount; i++ )
   119     //We may have multiple sessions to the same device and 
   880         {
   120     //they are all interested about state changes
   881         if( aUuid == iActionInfosEvent[ i ]->Uuid() )
   121     for( TInt i = 0; i < tempCount; i++ )
   882             {
   122         {
   883             iActionInfosEvent[ i ]->Observer().RcLastChangeEvent(
   123         if( aService->Device().Uuid() == iActionInfosEvent[i]->Uuid() )
   884                 aUuid, aLastChange );            
   124             {
   885             }
   125             iActionInfosEvent[i]->Observer().StateUpdatedL(aService);
   886         }    
   126             }
   887     }
   127         }
   888 
   128     }
   889 // --------------------------------------------------------------------------
   129 
   890 // CUPnPAVDispatcher::NewLC
   130 // --------------------------------------------------------------------------
   891 // Two-phased constructor.
   131 // CUPnPAVDispatcher::HttpResponseL
   892 // --------------------------------------------------------------------------
       
   893 //
       
   894 void CUPnPAVDispatcher::AvtLastChangeEvent(
       
   895         const TDesC8& aUuid,
       
   896         const TDesC8& aLastChange
       
   897         )
       
   898     {
       
   899     // Forward to each observer
       
   900     TInt tempCount = iActionInfosEvent.Count();
       
   901     
       
   902     for( TInt i = 0; i < tempCount; i++ )
       
   903         {
       
   904         if( aUuid == iActionInfosEvent[ i ]->Uuid() )
       
   905             {
       
   906             iActionInfosEvent[ i ]->Observer().AvtLastChangeEvent(
       
   907                 aUuid, aLastChange );
       
   908             }
       
   909         }
       
   910     
       
   911     }
       
   912 
       
   913 // --------------------------------------------------------------------------
       
   914 // CUPnPAVDispatcher::NewLC
       
   915 // Two-phased constructor.
       
   916 // --------------------------------------------------------------------------
       
   917 //
       
   918 void CUPnPAVDispatcher::CmSourceEvent(
       
   919         const TDesC8& /*aUuid*/,
       
   920         const TDesC8& /*aSource*/
       
   921         )
       
   922     {
       
   923     
       
   924     }
       
   925 
       
   926 // --------------------------------------------------------------------------
       
   927 // CUPnPAVDispatcher::NewLC
       
   928 // Two-phased constructor.
       
   929 // --------------------------------------------------------------------------
       
   930 //
       
   931 void CUPnPAVDispatcher::CmSinkEvent(
       
   932         const TDesC8& /*aUuid*/,
       
   933         const TDesC8& /*aSink*/
       
   934         )
       
   935     {
       
   936     
       
   937     }
       
   938 
       
   939 // --------------------------------------------------------------------------
       
   940 // CUPnPAVDispatcher::NewLC
       
   941 // Two-phased constructor.
       
   942 // --------------------------------------------------------------------------
       
   943 //
       
   944 void CUPnPAVDispatcher::CmConnectionsEvent(
       
   945         const TDesC8& /*aUuid*/,
       
   946         const TDesC8& /*aConnections*/
       
   947         )
       
   948     {
       
   949     
       
   950     }
       
   951 
       
   952 // --------------------------------------------------------------------------
       
   953 // CUPnPAVDispatcher::NewLC
       
   954 // Two-phased constructor.
       
   955 // --------------------------------------------------------------------------
   132 // --------------------------------------------------------------------------
   956 //
   133 //
   957 void CUPnPAVDispatcher::HttpResponseL( CUpnpHttpMessage* /*aMessage*/ )
   134 void CUPnPAVDispatcher::HttpResponseL( CUpnpHttpMessage* /*aMessage*/ )
   958     {
   135     {
   959     
   136     //NO IMPLEMENTATION NEEDED
   960     }
   137     }
   961 
   138 
   962 // --------------------------------------------------------------------------
   139 // --------------------------------------------------------------------------
   963 // CUPnPAVDispatcher::NewLC
   140 // CUPnPAVDispatcher::DeviceDiscoveredL
   964 // Two-phased constructor.
       
   965 // --------------------------------------------------------------------------
   141 // --------------------------------------------------------------------------
   966 //
   142 //
   967 void CUPnPAVDispatcher::DeviceDiscoveredL( CUpnpDevice* aDevice )
   143 void CUPnPAVDispatcher::DeviceDiscoveredL( CUpnpDevice* aDevice )
   968     {
   144     {
   969     __ASSERTD( aDevice, __FILE__, __LINE__  )
   145     __ASSERT( aDevice, __FILE__, __LINE__  )
   970     
   146     
   971     if( aDevice )
   147     iServer.DeviceDiscoveredL( *aDevice );    
   972         {
   148     }
   973         iServer.DeviceDiscoveredL( *aDevice );    
   149 
   974         }
   150 // --------------------------------------------------------------------------
   975     else
   151 // CUPnPAVDispatcher::DeviceDisappearedL
   976         {
       
   977         // No can do?
       
   978         }    
       
   979     }
       
   980 
       
   981 // --------------------------------------------------------------------------
       
   982 // CUPnPAVDispatcher::NewLC
       
   983 // Two-phased constructor.
       
   984 // --------------------------------------------------------------------------
   152 // --------------------------------------------------------------------------
   985 //
   153 //
   986 void CUPnPAVDispatcher::DeviceDisappearedL( CUpnpDevice* aDevice )
   154 void CUPnPAVDispatcher::DeviceDisappearedL( CUpnpDevice* aDevice )
   987     {
   155     {
   988     __ASSERTD( aDevice, __FILE__, __LINE__  );
   156     __ASSERT( aDevice, __FILE__, __LINE__  );
   989     
   157     
   990     if( aDevice )
   158     iServer.DeviceDisappearedL( *aDevice );    
   991         {
   159     }
   992         iServer.DeviceDisappearedL( *aDevice );    
   160 
   993         }
   161 // --------------------------------------------------------------------------
   994     else
   162 // CUPnPAVDispatcher::RegisterL
   995         {
   163 // --------------------------------------------------------------------------
   996         // No can do?
   164 //
   997         }                
       
   998     }
       
   999 
       
  1000 void CUPnPAVDispatcher::RegisterL( TInt aSessionId,
   165 void CUPnPAVDispatcher::RegisterL( TInt aSessionId,
  1001     MUpnpAVControlPointObserver& aObserver/*, const TDesC8& aUuid*/ )
   166     MUpnpAVControlPointObserver& aObserver )
  1002     {
   167     {
       
   168     __LOG1( "CUPnPAVDispatcher::RegisterL session: %d", aSessionId );
       
   169 
  1003     CUPnPAVActionInfo* tempInfo = CUPnPAVActionInfo::NewLC();
   170     CUPnPAVActionInfo* tempInfo = CUPnPAVActionInfo::NewLC();
  1004     tempInfo->SetSessionId( aSessionId );
   171     tempInfo->SetSessionId( aSessionId );
  1005     tempInfo->SetObserver( aObserver );
   172     tempInfo->SetObserver( aObserver );
  1006     //tempInfo->SetUuidL( aUuid );
       
  1007     CleanupStack::Pop( tempInfo );
   173     CleanupStack::Pop( tempInfo );
  1008     iActionInfos.AppendL( tempInfo );
   174     iActionInfos.AppendL( tempInfo );
  1009     }
   175     }
  1010 
   176 
       
   177 // --------------------------------------------------------------------------
       
   178 // CUPnPAVDispatcher::UnRegister
       
   179 // --------------------------------------------------------------------------
       
   180 //
  1011 void CUPnPAVDispatcher::UnRegister( TInt aSessionId
   181 void CUPnPAVDispatcher::UnRegister( TInt aSessionId
  1012     /*, const TDesC8& aUuid*/ )
   182     /*, const TDesC8& aUuid*/ )
  1013     {
   183     {
       
   184     __LOG1( "CUPnPAVDispatcher::UnRegister session: %d", aSessionId );
       
   185 
  1014     TInt tempCount = iActionInfos.Count();
   186     TInt tempCount = iActionInfos.Count();
  1015     
   187     
  1016     for( TInt i = 0; i < tempCount; i++ )
   188     for( TInt i = 0; i < tempCount; i++ )
  1017         {
   189         {
  1018         if( iActionInfos[ i ]->SessionId() == aSessionId )
   190         if( iActionInfos[ i ]->SessionId() == aSessionId )
  1022             i = tempCount;
   194             i = tempCount;
  1023             }
   195             }
  1024         }
   196         }
  1025     }
   197     }
  1026 
   198 
       
   199 // --------------------------------------------------------------------------
       
   200 // CUPnPAVDispatcher::FindObserver
       
   201 // --------------------------------------------------------------------------
       
   202 //
  1027 MUpnpAVControlPointObserver& CUPnPAVDispatcher::FindObserver(
   203 MUpnpAVControlPointObserver& CUPnPAVDispatcher::FindObserver(
  1028     TInt aSessionId )
   204     TInt aSessionId )
  1029     {
   205     {
  1030     MUpnpAVControlPointObserver* tempObserver = NULL;
   206     MUpnpAVControlPointObserver* tempObserver = NULL;
  1031     TInt tempCount = iActionInfos.Count();
   207     TInt tempCount = iActionInfos.Count();
  1039             }
   215             }
  1040         }
   216         }
  1041     return *tempObserver;   
   217     return *tempObserver;   
  1042     }
   218     }
  1043 
   219 
       
   220 // --------------------------------------------------------------------------
       
   221 // CUPnPAVDispatcher::RegisterForEventsL
       
   222 // --------------------------------------------------------------------------
       
   223 //
  1044 void CUPnPAVDispatcher::RegisterForEventsL(
   224 void CUPnPAVDispatcher::RegisterForEventsL(
  1045     MUpnpAVControlPointObserver& aObserver, const TDesC8& aUuid )
   225     MUpnpAVControlPointObserver& aObserver, const TDesC8& aUuid )
  1046     {
   226     {
       
   227     __LOG( "CUPnPAVDispatcher::RegisterForEventsL" );
       
   228 
       
   229     TInt tempCount = iActionInfosEvent.Count();
       
   230     for( TInt i = 0; i < tempCount; i++ )
       
   231         {
       
   232         if( &aObserver == &iActionInfosEvent[ i ]->Observer() )
       
   233             {
       
   234             // Must not let to register twice!
       
   235             __PANIC( __FILE__, __LINE__ );
       
   236             }
       
   237         }        
       
   238 
  1047     CUPnPAVActionInfo* tempInfo = CUPnPAVActionInfo::NewLC();
   239     CUPnPAVActionInfo* tempInfo = CUPnPAVActionInfo::NewLC();
  1048     tempInfo->SetObserver( aObserver );
   240     tempInfo->SetObserver( aObserver );
  1049     tempInfo->SetUuidL( aUuid );
   241     tempInfo->SetUuidL( aUuid );
  1050     CleanupStack::Pop( tempInfo );
   242     CleanupStack::Pop( tempInfo );
  1051     iActionInfosEvent.AppendL( tempInfo );        
   243     iActionInfosEvent.AppendL( tempInfo );        
  1052     }
   244     }
  1053     
   245     
       
   246 // --------------------------------------------------------------------------
       
   247 // CUPnPAVDispatcher::UnRegisterEvents
       
   248 // --------------------------------------------------------------------------
       
   249 //
  1054 void CUPnPAVDispatcher::UnRegisterEvents(
   250 void CUPnPAVDispatcher::UnRegisterEvents(
  1055     MUpnpAVControlPointObserver& aObserver )
   251     MUpnpAVControlPointObserver& aObserver )
  1056     {
   252     {
       
   253     __LOG( "CUPnPAVDispatcher::UnRegisterEvents" );
       
   254     
  1057     TInt tempCount = iActionInfosEvent.Count();
   255     TInt tempCount = iActionInfosEvent.Count();
  1058     
       
  1059     for( TInt i = 0; i < tempCount; i++ )
   256     for( TInt i = 0; i < tempCount; i++ )
  1060         {
   257         {
  1061         if( &aObserver == &iActionInfosEvent[ i ]->Observer() )
   258         if( &aObserver == &iActionInfosEvent[ i ]->Observer() )
  1062             {
   259             {
  1063             delete iActionInfosEvent[ i ];
   260             delete iActionInfosEvent[ i ];