upnpavcontrolpoint/avcontrolframework/src/upnpavcontrolpoint.cpp
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /** @file
       
     2 * Copyright (c) 2005-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:  CUpnpAVControlPoint
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "upnpavcontrolpoint.h"
       
    21 #include "upnpargument.h"
       
    22 
       
    23 #include "upnpstateupdatehandler.h"
       
    24 #include "upnpactionresponsehandler.h"
       
    25 #include "upnpavtactionfactory.h"
       
    26 #include "upnpcdsactionfactory.h"
       
    27 #include "upnpcmactionfactory.h"
       
    28 #include "upnprcactionfactory.h"
       
    29 #define KLogFile _L("UPnPStack.txt")
       
    30 #include "upnpcustomlog.h"
       
    31 #include "upnpcons.h"
       
    32 
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CUpnpAVControlPoint::NewL
       
    36 // Two-phased constructor.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 EXPORT_C CUpnpAVControlPoint* CUpnpAVControlPoint::NewL(
       
    40             MUpnpAVControlPointObserver& aAVControlPointObserver)
       
    41     {
       
    42     CUpnpAVControlPoint* self = 
       
    43         new (ELeave) CUpnpAVControlPoint(aAVControlPointObserver);    
       
    44     CleanupStack::PushL( self );
       
    45     self->ConstructL();
       
    46     CleanupStack::Pop( self );
       
    47     return self;
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CUpnpAVControlPoint::CUpnpAVControlPoint
       
    52 // C++ default constructor can NOT contain any code, that
       
    53 // might leave.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CUpnpAVControlPoint::CUpnpAVControlPoint(
       
    57      MUpnpAVControlPointObserver& aAVControlPointObserver)
       
    58                 : CUpnpControlPoint(),
       
    59                   iAVControlPointObserver(aAVControlPointObserver)
       
    60     {
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CUpnpStateUpdateHandler::ConstructL
       
    65 // Symbian 2nd phase constructor can leave.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C void CUpnpAVControlPoint::ConstructL( )
       
    69     {
       
    70     _LIT8( KMediaServer, "urn:schemas-upnp-org:device:MediaServer" );
       
    71     _LIT8( KMediaRenderer, "urn:schemas-upnp-org:device:MediaRenderer" );
       
    72 
       
    73     CDesC8ArrayFlat* targetDeviceTypes = new(ELeave) CDesC8ArrayFlat(1);
       
    74     CleanupStack::PushL( targetDeviceTypes );
       
    75     targetDeviceTypes->AppendL( KMediaServer() );
       
    76     targetDeviceTypes->AppendL( KMediaRenderer() );    
       
    77     CUpnpControlPoint::ConstructL( *targetDeviceTypes );
       
    78     CleanupStack::Pop( targetDeviceTypes );
       
    79     targetDeviceTypes->Reset();
       
    80     delete targetDeviceTypes; 
       
    81     targetDeviceTypes = NULL;
       
    82 
       
    83     TPtrC8 devicePtr;
       
    84     devicePtr.Set( UpnpSSDP::KUPnPRootDevice );
       
    85     SearchL( devicePtr );
       
    86 
       
    87     iStateUpdateHandler = CUpnpStateUpdateHandler::NewL( 
       
    88         iAVControlPointObserver, 
       
    89         *this );
       
    90     iActionResponseHandler = CUpnpActionResponseHandler::NewL(
       
    91         iAVControlPointObserver,
       
    92         *this );
       
    93     
       
    94     iAvtActionFactory = CUpnpAvtActionFactory::NewL(
       
    95         iAVControlPointObserver,
       
    96         *this );
       
    97     iCdsActionFactory = CUpnpCdsActionFactory::NewL(
       
    98         iAVControlPointObserver,
       
    99         *this );
       
   100     iCmActionFactory = CUpnpCmActionFactory::NewL(
       
   101         iAVControlPointObserver,
       
   102         *this );
       
   103     iRcActionFactory = CUpnpRcActionFactory::NewL(
       
   104         iAVControlPointObserver,
       
   105         *this );
       
   106   
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CUpnpAVControlPoint::~CUpnpAVControlPoint
       
   111 // Destructor
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 EXPORT_C CUpnpAVControlPoint::~CUpnpAVControlPoint()
       
   115     {
       
   116     delete iStateUpdateHandler;
       
   117     delete iActionResponseHandler;
       
   118     delete iAvtActionFactory;
       
   119     delete iCdsActionFactory;
       
   120     delete iCmActionFactory;
       
   121     delete iRcActionFactory;
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CUpnpAVControlPoint::InitializeCdsActionFactoryL
       
   126 // Initialize CdsActionFactory if is NULL
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 EXPORT_C void CUpnpAVControlPoint::InitializeCdsActionFactoryL() 
       
   130     {
       
   131     
       
   132     if (!iCdsActionFactory)
       
   133         {
       
   134         iCdsActionFactory = CUpnpCdsActionFactory::NewL(
       
   135             iAVControlPointObserver,
       
   136             *this );
       
   137         }    
       
   138     }
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CUpnpAVControlPoint::StateUpdatedL
       
   142 // This function implements an inteface and forwards request 
       
   143 // to stateupdate handler.
       
   144 // (other items were commented in a header)
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 EXPORT_C void CUpnpAVControlPoint::StateUpdatedL(CUpnpService*  aService)
       
   148     {
       
   149     iStateUpdateHandler->StateUpdated( aService );
       
   150     }
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // CUpnpAVControlPoint::DeviceDiscoveredL
       
   154 // This function implements an inteface and notifies an observer.
       
   155 // (other items were commented in a header)
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 EXPORT_C void CUpnpAVControlPoint::DeviceDiscoveredL(CUpnpDevice* aDevice)
       
   159     {
       
   160     iAVControlPointObserver.DeviceDiscoveredL( aDevice );
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CUpnpAVControlPoint::DeviceDisappearedL
       
   165 // This function implements an inteface and notifies an observer.
       
   166 // (other items were commented in a header)
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 EXPORT_C void CUpnpAVControlPoint::DeviceDisappearedL(CUpnpDevice* aDevice)
       
   170     {    
       
   171     iAVControlPointObserver.DeviceDisappearedL(aDevice);
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CUpnpAVControlPoint::ActionResponseReceivedL
       
   176 // This function ralizes an interface. Functionality is located in separate 
       
   177 // handler class.
       
   178 // (other items were commented in a header)
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 EXPORT_C void CUpnpAVControlPoint::ActionResponseReceivedL(CUpnpAction* aAction)
       
   182     {
       
   183     TInt err = iActionResponseHandler->ActionResponseReceived( aAction );
       
   184 #ifdef _DEBUG
       
   185     if (err != KErrNone)
       
   186         {
       
   187         LOGS("Error in action response received.");
       
   188         }
       
   189 #endif //_DEBUG
       
   190     }
       
   191 
       
   192 // -----------------------------------------------------------------------------
       
   193 // CUpnpAVControlPoint::HttpResponseReceivedL
       
   194 // This function implements an inteface and notifies an observer.
       
   195 // (other items were commented in a header)
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 EXPORT_C void CUpnpAVControlPoint::HttpResponseReceivedL(CUpnpHttpMessage* aMessage)
       
   199     {    
       
   200     iAVControlPointObserver.HttpResponseL( aMessage );
       
   201     }
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // CUpnpAVControlPoint::Service
       
   205 // This function returns a pointer to appropriate service instance.
       
   206 // (other items were commented in a header)
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209 EXPORT_C CUpnpService* CUpnpAVControlPoint::Service( CUpnpDevice* aMediaServer, 
       
   210                                     const TDesC8& aServiceType )
       
   211     {
       
   212     RPointerArray<CUpnpService>& services = aMediaServer->ServiceList();
       
   213     
       
   214     for( TInt i(0); i < services.Count(); i++ )
       
   215         {
       
   216         if( services[i]->ServiceType().Match( aServiceType ) != KErrNotFound )
       
   217             {
       
   218             return services[i];
       
   219             }
       
   220         }
       
   221     return NULL;
       
   222     }
       
   223 
       
   224 // -----------------------------------------------------------------------------
       
   225 // CUpnpAVControlPoint::AvtSetTransportUriActionL
       
   226 // This function creates and sends a action.
       
   227 // (other items were commented in a header)
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 EXPORT_C TInt CUpnpAVControlPoint::AvtSetTransportUriActionL(const TDesC8& aUuid,
       
   231                                                  TInt aInstanceId,
       
   232                                                  const TDesC8& aCurrentUri,
       
   233                                                  const TDesC8& aCurrentMetaData)
       
   234     {
       
   235     const CUpnpDevice* device = Device( aUuid );
       
   236     if( !device ) 
       
   237         {
       
   238         return KErrBadHandle;
       
   239         }
       
   240     else
       
   241         {
       
   242         CUpnpAction* action = NULL;
       
   243         TInt err( KErrNone );
       
   244         err = iAvtActionFactory->AvtSetTransportUriActionLC(
       
   245             action,
       
   246             (CUpnpDevice*)device,
       
   247             aInstanceId,
       
   248             aCurrentUri,
       
   249             aCurrentMetaData
       
   250             );
       
   251 
       
   252         if( err == KErrNone )
       
   253             {
       
   254             SendL( action );
       
   255             CleanupStack::Pop( action );
       
   256 
       
   257             return action->SessionId();
       
   258             }
       
   259         else
       
   260             {
       
   261             return err;
       
   262             }
       
   263         }
       
   264     }
       
   265 
       
   266 // -----------------------------------------------------------------------------
       
   267 // CUpnpAVControlPoint::AvtSetNextTransportUriActionL
       
   268 // This function creates and sends a action.
       
   269 // (other items were commented in a header)
       
   270 // -----------------------------------------------------------------------------
       
   271 //
       
   272 EXPORT_C TInt CUpnpAVControlPoint::AvtSetNextTransportUriActionL(
       
   273                                                  const TDesC8& aUuid,
       
   274                                                  TInt aInstanceId,
       
   275                                                  const TDesC8& aNextUri,
       
   276                                                  const TDesC8& aNextMetaData)
       
   277     {
       
   278     const CUpnpDevice* device = Device( aUuid );
       
   279     if( !device ) 
       
   280         {
       
   281         return KErrBadHandle;
       
   282         }
       
   283     else
       
   284         {
       
   285         CUpnpAction* action = NULL;
       
   286         TInt err( KErrNone );
       
   287         err = iAvtActionFactory->AvtSetNextTransportUriActionLC(
       
   288             action,
       
   289             (CUpnpDevice*)device,
       
   290             aInstanceId,
       
   291             aNextUri,
       
   292             aNextMetaData
       
   293             );
       
   294 
       
   295         if( err == KErrNone )
       
   296             {
       
   297             SendL( action );
       
   298             CleanupStack::Pop( action );
       
   299 
       
   300             return action->SessionId();
       
   301             }
       
   302         else
       
   303             {
       
   304             return err;
       
   305             }
       
   306         }
       
   307     }
       
   308 
       
   309 // -----------------------------------------------------------------------------
       
   310 // CUpnpAVControlPoint::AvtSeekActionL
       
   311 // This function creates and sends a action.
       
   312 // (other items were commented in a header)
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 EXPORT_C TInt CUpnpAVControlPoint::AvtSeekActionL(const TDesC8& aUuid,
       
   316                                       TInt aInstanceId,
       
   317                                       const TDesC8& aUnit,
       
   318                                       const TDesC8& aTarget)
       
   319     {
       
   320     const CUpnpDevice* device = Device( aUuid );
       
   321     if( !device ) 
       
   322         {
       
   323         return KErrBadHandle;
       
   324         }
       
   325     else
       
   326         {
       
   327         CUpnpAction* action = NULL;
       
   328         TInt err( KErrNone );
       
   329         err = iAvtActionFactory->AvtSeekActionLC(
       
   330             action,
       
   331             (CUpnpDevice*)device,
       
   332             aInstanceId,
       
   333             aUnit,
       
   334             aTarget
       
   335             );
       
   336 
       
   337         if( err == KErrNone )
       
   338             {
       
   339             SendL( action );
       
   340             CleanupStack::Pop( action );
       
   341 
       
   342             return action->SessionId();
       
   343             }
       
   344         else
       
   345             {
       
   346             return err;
       
   347             }
       
   348         }
       
   349     }
       
   350 
       
   351 // -----------------------------------------------------------------------------
       
   352 // CUpnpAVControlPoint::AvtMediaInfoActionL
       
   353 // This function creates and sends a action.
       
   354 // (other items were commented in a header)
       
   355 // -----------------------------------------------------------------------------
       
   356 //
       
   357 EXPORT_C TInt CUpnpAVControlPoint::AvtMediaInfoActionL(const TDesC8& aUuid,
       
   358                                            TInt aInstanceId)
       
   359     {
       
   360     const CUpnpDevice* device = Device( aUuid );
       
   361     if( !device ) 
       
   362         {
       
   363         return KErrBadHandle;
       
   364         }
       
   365     else
       
   366         {
       
   367         CUpnpAction* action = NULL;
       
   368         TInt err( KErrNone );
       
   369         err = iAvtActionFactory->AvtMediaInfoActionLC(
       
   370             action,
       
   371             (CUpnpDevice*)device,
       
   372             aInstanceId
       
   373             );
       
   374 
       
   375         if( err == KErrNone )
       
   376             {
       
   377             SendL( action );
       
   378             CleanupStack::Pop( action );
       
   379 
       
   380             return action->SessionId();
       
   381             }
       
   382         else
       
   383             {
       
   384             return err;
       
   385             }
       
   386         }
       
   387     }
       
   388 
       
   389 // -----------------------------------------------------------------------------
       
   390 // CUpnpAVControlPoint::AvtTransportInfoActionL
       
   391 // This function creates and sends a action.
       
   392 // (other items were commented in a header)
       
   393 // -----------------------------------------------------------------------------
       
   394 //
       
   395 EXPORT_C TInt CUpnpAVControlPoint::AvtTransportInfoActionL(const TDesC8& aUuid,
       
   396                                                TInt aInstanceId)
       
   397     {
       
   398     const CUpnpDevice* device = Device( aUuid );
       
   399     if( !device ) 
       
   400         {
       
   401         return KErrBadHandle;
       
   402         }
       
   403     else
       
   404         {
       
   405         CUpnpAction* action = NULL;
       
   406         TInt err( KErrNone );
       
   407         err = iAvtActionFactory->AvtTransportInfoActionLC(
       
   408             action,
       
   409             (CUpnpDevice*)device,
       
   410             aInstanceId
       
   411             );
       
   412 
       
   413         if( err == KErrNone )
       
   414             {
       
   415             SendL( action );
       
   416             CleanupStack::Pop( action );
       
   417 
       
   418             return action->SessionId();
       
   419             }
       
   420         else
       
   421             {
       
   422             return err;
       
   423             }
       
   424         }
       
   425     }
       
   426 
       
   427 // -----------------------------------------------------------------------------
       
   428 // CUpnpAVControlPoint::AvtPositionInfoActionL
       
   429 // This function creates and sends a action.
       
   430 // (other items were commented in a header)
       
   431 // -----------------------------------------------------------------------------
       
   432 //
       
   433 EXPORT_C TInt CUpnpAVControlPoint::AvtPositionInfoActionL(const TDesC8& aUuid,
       
   434                                               TInt aInstanceId)
       
   435     {
       
   436     const CUpnpDevice* device = Device( aUuid );
       
   437     if( !device ) 
       
   438         {
       
   439         return KErrBadHandle;
       
   440         }
       
   441     else
       
   442         {
       
   443         CUpnpAction* action = NULL;
       
   444         TInt err( KErrNone );
       
   445         err = iAvtActionFactory->AvtPositionInfoActionLC(
       
   446             action,
       
   447             (CUpnpDevice*)device,
       
   448             aInstanceId
       
   449             );
       
   450 
       
   451         if( err == KErrNone )
       
   452             {
       
   453             SendL( action );
       
   454             CleanupStack::Pop( action );
       
   455 
       
   456             return action->SessionId();
       
   457             }
       
   458         else
       
   459             {
       
   460             return err;
       
   461             }
       
   462         }
       
   463     }
       
   464 
       
   465 // -----------------------------------------------------------------------------
       
   466 // CUpnpAVControlPoint::AvtDeviceCapabilitiesActionL
       
   467 // This function creates and sends a action.
       
   468 // (other items were commented in a header)
       
   469 // -----------------------------------------------------------------------------
       
   470 //
       
   471 EXPORT_C TInt CUpnpAVControlPoint::AvtDeviceCapabilitiesActionL(const TDesC8& aUuid,
       
   472                                                     TInt aInstanceId)
       
   473     {
       
   474     const CUpnpDevice* device = Device( aUuid );
       
   475     if( !device ) 
       
   476         {
       
   477         return KErrBadHandle;
       
   478         }
       
   479     else
       
   480         {
       
   481         CUpnpAction* action = NULL;
       
   482         TInt err( KErrNone );
       
   483         err = iAvtActionFactory->AvtDeviceCapabilitiesActionLC(
       
   484             action,
       
   485             (CUpnpDevice*)device,
       
   486             aInstanceId
       
   487             );
       
   488 
       
   489         if( err == KErrNone )
       
   490             {
       
   491             SendL( action );
       
   492             CleanupStack::Pop( action );
       
   493 
       
   494             return action->SessionId();
       
   495             }
       
   496         else
       
   497             {
       
   498             return err;
       
   499             }
       
   500         }
       
   501     }
       
   502 
       
   503 // -----------------------------------------------------------------------------
       
   504 // CUpnpAVControlPoint::AvtTransportSettingsActionL
       
   505 // This function creates and sends a action.
       
   506 // (other items were commented in a header)
       
   507 // -----------------------------------------------------------------------------
       
   508 //
       
   509 EXPORT_C TInt CUpnpAVControlPoint::AvtTransportSettingsActionL(const TDesC8& aUuid,
       
   510                                                    TInt aInstanceId)
       
   511     {
       
   512     const CUpnpDevice* device = Device( aUuid );
       
   513     if( !device ) 
       
   514         {
       
   515         return KErrBadHandle;
       
   516         }
       
   517     else
       
   518         {
       
   519         CUpnpAction* action = NULL;
       
   520         TInt err( KErrNone );
       
   521         err = iAvtActionFactory->AvtTransportSettingsActionLC(
       
   522             action,
       
   523             (CUpnpDevice*)device,
       
   524             aInstanceId
       
   525             );
       
   526 
       
   527         if( err == KErrNone )
       
   528             {
       
   529             SendL( action );
       
   530             CleanupStack::Pop( action );
       
   531 
       
   532             return action->SessionId();
       
   533             }
       
   534         else
       
   535             {
       
   536             return err;
       
   537             }
       
   538         }
       
   539     }
       
   540 
       
   541 // -----------------------------------------------------------------------------
       
   542 // CUpnpAVControlPoint::AvtStopActionL
       
   543 // This function creates and sends a action.
       
   544 // (other items were commented in a header)
       
   545 // -----------------------------------------------------------------------------
       
   546 //
       
   547 EXPORT_C TInt CUpnpAVControlPoint::AvtStopActionL(const TDesC8& aUuid,
       
   548                                       TInt aInstanceId)
       
   549     {
       
   550     const CUpnpDevice* device = Device( aUuid );
       
   551     if( !device ) 
       
   552         {
       
   553         return KErrBadHandle;
       
   554         }
       
   555     else
       
   556         {
       
   557         CUpnpAction* action = NULL;
       
   558         TInt err( KErrNone );
       
   559         err = iAvtActionFactory->AvtStopActionLC(
       
   560             action,
       
   561             (CUpnpDevice*)device,
       
   562             aInstanceId
       
   563             );
       
   564 
       
   565         if( err == KErrNone )
       
   566             {
       
   567             SendL( action );
       
   568             CleanupStack::Pop( action );
       
   569 
       
   570             return action->SessionId();
       
   571             }
       
   572         else
       
   573             {
       
   574             return err;
       
   575             }
       
   576         }
       
   577     }
       
   578 
       
   579 // -----------------------------------------------------------------------------
       
   580 // CUpnpAVControlPoint::AvtPlayActionL
       
   581 // This function creates and sends a action.
       
   582 // (other items were commented in a header)
       
   583 // -----------------------------------------------------------------------------
       
   584 //
       
   585 EXPORT_C TInt CUpnpAVControlPoint::AvtPlayActionL(const TDesC8& aUuid,
       
   586                                       TInt aInstanceId,
       
   587                                       const TDesC8& aSpeed)
       
   588     {
       
   589     const CUpnpDevice* device = Device( aUuid );
       
   590     if( !device ) 
       
   591         {
       
   592         return KErrBadHandle;
       
   593         }
       
   594     else
       
   595         {
       
   596         CUpnpAction* action = NULL;
       
   597         TInt err( KErrNone );
       
   598         err = iAvtActionFactory->AvtPlayActionLC(
       
   599             action,
       
   600             (CUpnpDevice*)device,
       
   601             aInstanceId,
       
   602             aSpeed
       
   603             );
       
   604 
       
   605         if( err == KErrNone )
       
   606             {
       
   607             SendL( action );
       
   608             CleanupStack::Pop( action );
       
   609 
       
   610             return action->SessionId();
       
   611             }
       
   612         else
       
   613             {
       
   614             return err;
       
   615             }
       
   616         }
       
   617     }
       
   618 
       
   619 // -----------------------------------------------------------------------------
       
   620 // CUpnpAVControlPoint::AvtPauseActionL
       
   621 // This function creates and sends a action.
       
   622 // (other items were commented in a header)
       
   623 // -----------------------------------------------------------------------------
       
   624 //
       
   625 EXPORT_C TInt CUpnpAVControlPoint::AvtPauseActionL(const TDesC8& aUuid,
       
   626                                        TInt aInstanceId)
       
   627     {
       
   628     const CUpnpDevice* device = Device( aUuid );
       
   629     if( !device ) 
       
   630         {
       
   631         return KErrBadHandle;
       
   632         }
       
   633     else
       
   634         {
       
   635         CUpnpAction* action = NULL;
       
   636         TInt err( KErrNone );
       
   637         err = iAvtActionFactory->AvtPauseActionLC(
       
   638             action,
       
   639             (CUpnpDevice*)device,
       
   640             aInstanceId
       
   641             );
       
   642 
       
   643         if( err == KErrNone )
       
   644             {
       
   645             SendL( action );
       
   646             CleanupStack::Pop( action );
       
   647 
       
   648             return action->SessionId();
       
   649             }
       
   650         else
       
   651             {
       
   652             return err;
       
   653             }
       
   654         }
       
   655     }
       
   656 
       
   657 // -----------------------------------------------------------------------------
       
   658 // CUpnpAVControlPoint::AvtRecordActionL
       
   659 // This function creates and sends a action.
       
   660 // (other items were commented in a header)
       
   661 // -----------------------------------------------------------------------------
       
   662 //
       
   663 EXPORT_C TInt CUpnpAVControlPoint::AvtRecordActionL(const TDesC8& aUuid,
       
   664                                         TInt aInstanceId)
       
   665     {
       
   666     const CUpnpDevice* device = Device( aUuid );
       
   667     if( !device ) 
       
   668         {
       
   669         return KErrBadHandle;
       
   670         }
       
   671     else
       
   672         {
       
   673         CUpnpAction* action = NULL;
       
   674         TInt err( KErrNone );
       
   675         err = iAvtActionFactory->AvtRecordActionLC(
       
   676             action,
       
   677             (CUpnpDevice*)device,
       
   678             aInstanceId );
       
   679 
       
   680         if( err == KErrNone )
       
   681             {
       
   682             SendL( action );
       
   683             CleanupStack::Pop( action );
       
   684 
       
   685             return action->SessionId();
       
   686             }
       
   687         else
       
   688             {
       
   689             return err;
       
   690             }
       
   691         }
       
   692     }
       
   693 
       
   694 // -----------------------------------------------------------------------------
       
   695 // CUpnpAVControlPoint::AvtNextActionL
       
   696 // This function creates and sends a action.
       
   697 // (other items were commented in a header)
       
   698 // -----------------------------------------------------------------------------
       
   699 //
       
   700 EXPORT_C TInt CUpnpAVControlPoint::AvtNextActionL(const TDesC8& aUuid,
       
   701                                       TInt aInstanceId)
       
   702     {
       
   703     const CUpnpDevice* device = Device( aUuid );
       
   704     if( !device ) 
       
   705         {
       
   706         return KErrBadHandle;
       
   707         }
       
   708     else
       
   709         {
       
   710         CUpnpAction* action = NULL;
       
   711         TInt err( KErrNone );
       
   712         err = iAvtActionFactory->AvtNextActionLC(
       
   713             action,
       
   714             (CUpnpDevice*)device,
       
   715             aInstanceId
       
   716             );
       
   717 
       
   718         if( err == KErrNone )
       
   719             {
       
   720             
       
   721             SendL( action );
       
   722             CleanupStack::Pop( action );
       
   723 
       
   724             return action->SessionId();
       
   725             }
       
   726         else
       
   727             {
       
   728             return err;
       
   729             }
       
   730         }
       
   731     }
       
   732 
       
   733 // -----------------------------------------------------------------------------
       
   734 // CUpnpAVControlPoint::AvtPreviousActionL
       
   735 // This function creates and sends a action.
       
   736 // (other items were commented in a header)
       
   737 // -----------------------------------------------------------------------------
       
   738 //
       
   739 EXPORT_C TInt CUpnpAVControlPoint::AvtPreviousActionL(const TDesC8& aUuid,
       
   740                                           TInt aInstanceId)
       
   741     {
       
   742     const CUpnpDevice* device = Device( aUuid );
       
   743     if( !device ) 
       
   744         {
       
   745         return KErrBadHandle;
       
   746         }
       
   747     else
       
   748         {
       
   749         CUpnpAction* action = NULL;
       
   750         TInt err( KErrNone );
       
   751         err = iAvtActionFactory->AvtPreviousActionLC(
       
   752             action,
       
   753             (CUpnpDevice*)device,
       
   754             aInstanceId
       
   755             );
       
   756 
       
   757         if( err == KErrNone )
       
   758             {
       
   759             
       
   760             SendL( action );
       
   761             CleanupStack::Pop( action );
       
   762 
       
   763             return action->SessionId();
       
   764             }
       
   765         else
       
   766             {
       
   767             return err;
       
   768             }
       
   769         }
       
   770     }
       
   771 
       
   772 // -----------------------------------------------------------------------------
       
   773 // CUpnpAVControlPoint::AvtSetPlayModeActionL
       
   774 // This function creates and sends a action.
       
   775 // (other items were commented in a header)
       
   776 // -----------------------------------------------------------------------------
       
   777 //
       
   778 EXPORT_C TInt CUpnpAVControlPoint::AvtSetPlayModeActionL(const TDesC8& aUuid,
       
   779                                              TInt aInstanceId,
       
   780                                              const TDesC8& aPlayMode)
       
   781     {
       
   782     const CUpnpDevice* device = Device( aUuid );
       
   783     if( !device ) 
       
   784         {
       
   785         return KErrBadHandle;
       
   786         }
       
   787     else
       
   788         {
       
   789         CUpnpAction* action = NULL;
       
   790         TInt err( KErrNone );
       
   791         err = iAvtActionFactory->AvtSetPlayModeActionLC(
       
   792             action,
       
   793             (CUpnpDevice*)device,
       
   794             aInstanceId,
       
   795             aPlayMode
       
   796             );
       
   797 
       
   798         if( err == KErrNone )
       
   799             {
       
   800             
       
   801             SendL( action );
       
   802             CleanupStack::Pop( action );
       
   803 
       
   804             return action->SessionId();
       
   805             }
       
   806         else
       
   807             {
       
   808             return err;
       
   809             }
       
   810         }
       
   811     }
       
   812 
       
   813 // -----------------------------------------------------------------------------
       
   814 // CUpnpAVControlPoint::AvtSetRecordModeActionL
       
   815 // This function creates and sends a action.
       
   816 // (other items were commented in a header)
       
   817 // -----------------------------------------------------------------------------
       
   818 //
       
   819 EXPORT_C TInt CUpnpAVControlPoint::AvtSetRecordModeActionL(const TDesC8& aUuid,
       
   820                                                TInt aInstanceId,
       
   821                                                const TDesC8& aRecordMode)
       
   822     {
       
   823     const CUpnpDevice* device = Device( aUuid );
       
   824     if( !device ) 
       
   825         {
       
   826         return KErrBadHandle;
       
   827         }
       
   828     else
       
   829         {
       
   830         CUpnpAction* action = NULL;
       
   831         TInt err( KErrNone );
       
   832         err = iAvtActionFactory->AvtSetRecordModeActionLC(
       
   833             action,
       
   834             (CUpnpDevice*)device,
       
   835             aInstanceId,
       
   836             aRecordMode
       
   837             );
       
   838 
       
   839         if( err == KErrNone )
       
   840             {
       
   841             
       
   842             SendL( action );
       
   843             CleanupStack::Pop( action );
       
   844 
       
   845             return action->SessionId();
       
   846             }
       
   847         else
       
   848             {
       
   849             return err;
       
   850             }
       
   851         }
       
   852     }
       
   853 
       
   854 // -----------------------------------------------------------------------------
       
   855 // CUpnpAVControlPoint::AvtTransportsActionL
       
   856 // This function creates and sends a action.
       
   857 // (other items were commented in a header)
       
   858 // -----------------------------------------------------------------------------
       
   859 //
       
   860 EXPORT_C TInt CUpnpAVControlPoint::AvtTransportsActionL(const TDesC8& aUuid,
       
   861                                             TInt aInstanceId)
       
   862     {
       
   863     const CUpnpDevice* device = Device( aUuid );
       
   864     if( !device ) 
       
   865         {
       
   866         return KErrBadHandle;
       
   867         }
       
   868     else
       
   869         {
       
   870         CUpnpAction* action = NULL;
       
   871         TInt err( KErrNone );
       
   872         err = iAvtActionFactory->AvtTransportsActionLC(
       
   873             action,
       
   874             (CUpnpDevice*)device,
       
   875             aInstanceId
       
   876             );
       
   877 
       
   878         if( err == KErrNone )
       
   879             {
       
   880             
       
   881             SendL( action );
       
   882             CleanupStack::Pop( action );
       
   883 
       
   884             return action->SessionId();
       
   885             }
       
   886         else
       
   887             {
       
   888             return err;
       
   889             }
       
   890         }
       
   891     }
       
   892 
       
   893 // -----------------------------------------------------------------------------
       
   894 // CUpnpAVControlPoint::CdsBrowseActionL
       
   895 // This function creates and sends a action.
       
   896 // (other items were commented in a header)
       
   897 // -----------------------------------------------------------------------------
       
   898 //
       
   899 EXPORT_C TInt CUpnpAVControlPoint::CdsBrowseActionL(const TDesC8& aUuid,
       
   900                                         const TDesC8& aObjectId,
       
   901                                         const TDesC8& aBrowseFlag,
       
   902                                         const TDesC8& aFilter, 
       
   903                                         TInt aStartingIndex,
       
   904                                         TInt aRequestedCount,
       
   905                                         const TDesC8& aSortCriteria)
       
   906     {
       
   907     const CUpnpDevice* device = Device( aUuid );
       
   908     if( !device ) 
       
   909         {
       
   910         return KErrBadHandle;
       
   911         }
       
   912     else
       
   913         {
       
   914         CUpnpAction* action = NULL;
       
   915         TInt err( KErrNone );
       
   916         err = iCdsActionFactory->CdsBrowseActionLC(
       
   917             action,
       
   918             (CUpnpDevice*)device,
       
   919             aObjectId,
       
   920             aBrowseFlag,
       
   921             aFilter,
       
   922             aStartingIndex,
       
   923             aRequestedCount,
       
   924             aSortCriteria
       
   925             );
       
   926 
       
   927         if( err == KErrNone )
       
   928             {
       
   929             
       
   930             SendL( action );
       
   931             CleanupStack::Pop( action );
       
   932 
       
   933             return action->SessionId();
       
   934             }
       
   935         else
       
   936             {
       
   937             return err;
       
   938             }
       
   939         }
       
   940     }
       
   941 
       
   942 // -----------------------------------------------------------------------------
       
   943 // CUpnpAVControlPoint::CdsSearchActionL
       
   944 // This function creates and sends a action.
       
   945 // (other items were commented in a header)
       
   946 // -----------------------------------------------------------------------------
       
   947 //
       
   948 EXPORT_C TInt CUpnpAVControlPoint::CdsSearchActionL(const TDesC8& aUuid,
       
   949                                         const TDesC8& aObjectId,
       
   950                                         const TDesC8& aSearchCriteria,
       
   951                                         const TDesC8& aFilter, 
       
   952                                         TInt aStartingIndex,
       
   953                                         TInt aRequestedCount,
       
   954                                         const TDesC8& aSortCriteria
       
   955                                         )
       
   956     {
       
   957     const CUpnpDevice* device = Device( aUuid );
       
   958     if( !device ) 
       
   959         {
       
   960         return KErrBadHandle;
       
   961         }
       
   962     else
       
   963         {
       
   964         CUpnpAction* action = NULL;
       
   965         TInt err( KErrNone );
       
   966         err = iCdsActionFactory->CdsSearchActionLC(
       
   967             action,
       
   968             (CUpnpDevice*)device,
       
   969             aObjectId,
       
   970             aSearchCriteria,
       
   971             aFilter,
       
   972             aStartingIndex,
       
   973             aRequestedCount,
       
   974             aSortCriteria
       
   975             );
       
   976 
       
   977         if( err == KErrNone )
       
   978             {
       
   979             
       
   980             SendL( action );
       
   981             CleanupStack::Pop( action );
       
   982 
       
   983             return action->SessionId();
       
   984             }
       
   985         else
       
   986             {
       
   987             return err;
       
   988             }
       
   989         }
       
   990     }
       
   991 
       
   992 // -----------------------------------------------------------------------------
       
   993 // CUpnpAVControlPoint::CdsSystemUpdateIdActionL
       
   994 // This function creates and sends a action.
       
   995 // (other items were commented in a header)
       
   996 // -----------------------------------------------------------------------------
       
   997 //
       
   998 EXPORT_C TInt CUpnpAVControlPoint::CdsSystemUpdateIdActionL(const TDesC8& aUuid)
       
   999     {
       
  1000     const CUpnpDevice* device = Device( aUuid );
       
  1001     if( !device ) 
       
  1002         {
       
  1003         return KErrBadHandle;
       
  1004         }
       
  1005     else
       
  1006         {
       
  1007         CUpnpAction* action = NULL;
       
  1008         TInt err( KErrNone );
       
  1009         err = iCdsActionFactory->CdsSystemUpdateIdActionLC(
       
  1010             action,
       
  1011             (CUpnpDevice*)device
       
  1012             );
       
  1013 
       
  1014         if( err == KErrNone )
       
  1015             {
       
  1016             
       
  1017             SendL( action );
       
  1018             CleanupStack::Pop( action );
       
  1019 
       
  1020             return action->SessionId();
       
  1021             }
       
  1022         else
       
  1023             {
       
  1024             return err;
       
  1025             }
       
  1026         }
       
  1027     }
       
  1028 
       
  1029 // -----------------------------------------------------------------------------
       
  1030 // CUpnpAVControlPoint::CdsSearchCapabilitiesActionL
       
  1031 // This function creates and sends a action.
       
  1032 // (other items were commented in a header)
       
  1033 // -----------------------------------------------------------------------------
       
  1034 //
       
  1035 EXPORT_C TInt CUpnpAVControlPoint::CdsSearchCapabilitiesActionL(const TDesC8& aUuid)
       
  1036     {
       
  1037     const CUpnpDevice* device = Device( aUuid );
       
  1038     if( !device ) 
       
  1039         {
       
  1040         return KErrBadHandle;
       
  1041         }
       
  1042     else
       
  1043         {
       
  1044         CUpnpAction* action = NULL;
       
  1045         TInt err( KErrNone );
       
  1046         err = iCdsActionFactory->CdsSearchCapabilitiesActionLC(
       
  1047             action,
       
  1048             (CUpnpDevice*)device
       
  1049             );
       
  1050 
       
  1051         if( err == KErrNone )
       
  1052             {
       
  1053             
       
  1054             SendL( action );
       
  1055             CleanupStack::Pop( action );
       
  1056 
       
  1057             return action->SessionId();
       
  1058             }
       
  1059         else
       
  1060             {
       
  1061             return err;
       
  1062             }
       
  1063         }
       
  1064     }
       
  1065 
       
  1066 // -----------------------------------------------------------------------------
       
  1067 // CUpnpAVControlPoint::CdsSortCapabilitiesActionL
       
  1068 // This function creates and sends a action.
       
  1069 // (other items were commented in a header)
       
  1070 // -----------------------------------------------------------------------------
       
  1071 //
       
  1072 EXPORT_C TInt CUpnpAVControlPoint::CdsSortCapabilitiesActionL(const TDesC8& aUuid)
       
  1073     {
       
  1074     const CUpnpDevice* device = Device( aUuid );
       
  1075     if( !device ) 
       
  1076         {
       
  1077         return KErrBadHandle;
       
  1078         }
       
  1079     else
       
  1080         {
       
  1081         CUpnpAction* action = NULL;
       
  1082         TInt err( KErrNone );
       
  1083         err = iCdsActionFactory->CdsSortCapabilitiesActionLC(
       
  1084             action,
       
  1085             (CUpnpDevice*)device
       
  1086             );
       
  1087 
       
  1088         if( err == KErrNone )
       
  1089             {
       
  1090             
       
  1091             SendL( action );
       
  1092             CleanupStack::Pop( action );
       
  1093 
       
  1094             return action->SessionId();
       
  1095             }
       
  1096         else
       
  1097             {
       
  1098             return err;
       
  1099             }
       
  1100         }
       
  1101     }
       
  1102 
       
  1103 // -----------------------------------------------------------------------------
       
  1104 // CUpnpAVControlPoint::CdsCreateObjectActionL
       
  1105 // This function creates and sends a action.
       
  1106 // (other items were commented in a header)
       
  1107 // -----------------------------------------------------------------------------
       
  1108 //                                                                                               
       
  1109 EXPORT_C TInt CUpnpAVControlPoint::CdsCreateObjectActionL(const TDesC8& aUuid,
       
  1110                                               const TDesC8& aId, 
       
  1111                                               const TDesC8& aElements)
       
  1112     {
       
  1113     const CUpnpDevice* device = Device( aUuid );
       
  1114     if( !device ) 
       
  1115         {
       
  1116         return KErrBadHandle;
       
  1117         }
       
  1118     else
       
  1119         {
       
  1120         CUpnpAction* action = NULL;
       
  1121         TInt err( KErrNone );
       
  1122         err = iCdsActionFactory->CdsCreateObjectActionLC(
       
  1123             action,
       
  1124             (CUpnpDevice*)device,
       
  1125             aId,
       
  1126             aElements
       
  1127             );
       
  1128 
       
  1129         if( err == KErrNone )
       
  1130             {
       
  1131             
       
  1132             SendL( action );
       
  1133             CleanupStack::Pop( action );
       
  1134 
       
  1135             return action->SessionId();
       
  1136             }
       
  1137         else
       
  1138             {
       
  1139             return err;
       
  1140             }
       
  1141         }
       
  1142     }
       
  1143 
       
  1144 // -----------------------------------------------------------------------------
       
  1145 // CUpnpAVControlPoint::CdsImportResourceActionL
       
  1146 // This function creates and sends a action.
       
  1147 // (other items were commented in a header)
       
  1148 // -----------------------------------------------------------------------------
       
  1149 //
       
  1150 EXPORT_C TInt CUpnpAVControlPoint::CdsImportResourceActionL(const TDesC8& aUuid,
       
  1151                                                 const TDesC8& aSourceUri, 
       
  1152                                                 const TDesC8& aDestinationUri
       
  1153                                                 )
       
  1154     {
       
  1155     const CUpnpDevice* device = Device( aUuid );
       
  1156     if( !device ) 
       
  1157         {
       
  1158         return KErrBadHandle;
       
  1159         }
       
  1160     else
       
  1161         {
       
  1162         CUpnpAction* action = NULL;
       
  1163         TInt err( KErrNone );
       
  1164         err = iCdsActionFactory->CdsImportResourceActionLC(
       
  1165             action,
       
  1166             (CUpnpDevice*)device,
       
  1167             aSourceUri,
       
  1168             aDestinationUri
       
  1169             );
       
  1170 
       
  1171         if( err == KErrNone )
       
  1172             {
       
  1173             
       
  1174             SendL( action );
       
  1175             CleanupStack::Pop( action );
       
  1176 
       
  1177             return action->SessionId();
       
  1178             }
       
  1179         else
       
  1180             {
       
  1181             return err;
       
  1182             }
       
  1183         }
       
  1184     }
       
  1185 
       
  1186 // -----------------------------------------------------------------------------
       
  1187 // CUpnpAVControlPoint::CdsExportResourceActionL
       
  1188 // This function creates and sends a action.
       
  1189 // (other items were commented in a header)
       
  1190 // -----------------------------------------------------------------------------
       
  1191 //
       
  1192 EXPORT_C TInt CUpnpAVControlPoint::CdsExportResourceActionL(const TDesC8& aUuid,
       
  1193                                                 const TDesC8& aSourceUri, 
       
  1194                                                 const TDesC8& aDestinationUri )
       
  1195     {
       
  1196     const CUpnpDevice* device = Device( aUuid );
       
  1197     if( !device ) 
       
  1198         {
       
  1199         return KErrBadHandle;
       
  1200         }
       
  1201     else
       
  1202         {
       
  1203         CUpnpAction* action = NULL;
       
  1204         TInt err( KErrNone );
       
  1205         err = iCdsActionFactory->CdsExportResourceActionLC(
       
  1206             action,
       
  1207             (CUpnpDevice*)device,
       
  1208             aSourceUri,
       
  1209             aDestinationUri
       
  1210             );
       
  1211 
       
  1212         if( err == KErrNone )
       
  1213             {
       
  1214             
       
  1215             SendL( action );
       
  1216             CleanupStack::Pop( action );
       
  1217 
       
  1218             return action->SessionId();
       
  1219             }
       
  1220         else
       
  1221             {
       
  1222             return err;
       
  1223             }
       
  1224         }
       
  1225     }
       
  1226 
       
  1227 // -----------------------------------------------------------------------------
       
  1228 // CUpnpAVControlPoint::CdsCreateReferenceActionL
       
  1229 // This function creates and sends a action.
       
  1230 // (other items were commented in a header)
       
  1231 // -----------------------------------------------------------------------------
       
  1232 //
       
  1233 EXPORT_C TInt CUpnpAVControlPoint::CdsCreateReferenceActionL(
       
  1234                                         const TDesC8& aUuid,
       
  1235                                         const TDesC8& aDestinationContainerId, 
       
  1236                                         const TDesC8& aSourceObjectId )
       
  1237     {
       
  1238     const CUpnpDevice* device = Device( aUuid );
       
  1239     if( !device ) 
       
  1240         {
       
  1241         return KErrBadHandle;
       
  1242         }
       
  1243     else
       
  1244         {
       
  1245         CUpnpAction* action = NULL;
       
  1246         TInt err( KErrNone );
       
  1247         err = iCdsActionFactory->CdsCreateReferenceActionLC(
       
  1248             action,
       
  1249             (CUpnpDevice*)device,
       
  1250             aDestinationContainerId,
       
  1251             aSourceObjectId
       
  1252             );
       
  1253 
       
  1254         if( err == KErrNone )
       
  1255             {
       
  1256             
       
  1257             SendL( action );
       
  1258             CleanupStack::Pop( action );
       
  1259 
       
  1260             return action->SessionId();
       
  1261             }
       
  1262         else
       
  1263             {
       
  1264             return err;
       
  1265             }
       
  1266         }
       
  1267     }
       
  1268 
       
  1269 // -----------------------------------------------------------------------------
       
  1270 // CUpnpAVControlPoint::CdsDeleteResourceActionL
       
  1271 // This function creates and sends a action.
       
  1272 // (other items were commented in a header)
       
  1273 // -----------------------------------------------------------------------------
       
  1274 //
       
  1275 EXPORT_C TInt CUpnpAVControlPoint::CdsDeleteResourceActionL(const TDesC8& aUuid,
       
  1276                                                 const TDesC8& aResourceUri )
       
  1277     {
       
  1278     const CUpnpDevice* device = Device( aUuid );
       
  1279     if( !device ) 
       
  1280         {
       
  1281         return KErrBadHandle;
       
  1282         }
       
  1283     else
       
  1284         {
       
  1285         CUpnpAction* action = NULL;
       
  1286         TInt err( KErrNone );
       
  1287         err = iCdsActionFactory->CdsDeleteResourceActionLC(
       
  1288             action,
       
  1289             (CUpnpDevice*)device,
       
  1290             aResourceUri
       
  1291             );
       
  1292 
       
  1293         if( err == KErrNone )
       
  1294             {
       
  1295             
       
  1296             SendL( action );
       
  1297             CleanupStack::Pop( action );
       
  1298 
       
  1299             return action->SessionId();
       
  1300             }
       
  1301         else
       
  1302             {
       
  1303             return err;
       
  1304             }
       
  1305         }
       
  1306     }
       
  1307 
       
  1308 // -----------------------------------------------------------------------------
       
  1309 // CUpnpAVControlPoint::CdsDestroyObjectActionL
       
  1310 // This function creates and sends a action.
       
  1311 // (other items were commented in a header)
       
  1312 // -----------------------------------------------------------------------------
       
  1313 //
       
  1314 EXPORT_C TInt CUpnpAVControlPoint::CdsDestroyObjectActionL(const TDesC8& aUuid,
       
  1315                                                const TDesC8& aObjectId )
       
  1316     {
       
  1317     const CUpnpDevice* device = Device( aUuid );
       
  1318     if( !device ) 
       
  1319         {
       
  1320         return KErrBadHandle;
       
  1321         }
       
  1322     else
       
  1323         {
       
  1324         CUpnpAction* action = NULL;
       
  1325         TInt err( KErrNone );
       
  1326         err = iCdsActionFactory->CdsDestroyObjectActionLC(
       
  1327             action,
       
  1328             (CUpnpDevice*)device,
       
  1329             aObjectId
       
  1330             );
       
  1331 
       
  1332         if( err == KErrNone )
       
  1333             {
       
  1334             
       
  1335             SendL( action );
       
  1336             CleanupStack::Pop( action );
       
  1337 
       
  1338             return action->SessionId();
       
  1339             }
       
  1340         else
       
  1341             {
       
  1342             return err;
       
  1343             }
       
  1344         }
       
  1345     }
       
  1346 
       
  1347 // -----------------------------------------------------------------------------
       
  1348 // CUpnpAVControlPoint::CdsStopTransferActionL
       
  1349 // This function creates and sends a action.
       
  1350 // (other items were commented in a header)
       
  1351 // -----------------------------------------------------------------------------
       
  1352 //
       
  1353 EXPORT_C TInt CUpnpAVControlPoint::CdsStopTransferActionL(const TDesC8& aUuid,
       
  1354                                               TInt aTransferId )
       
  1355     {
       
  1356     const CUpnpDevice* device = Device( aUuid );
       
  1357     if( !device ) 
       
  1358         {
       
  1359         return KErrBadHandle;
       
  1360         }
       
  1361     else
       
  1362         {
       
  1363         CUpnpAction* action = NULL;
       
  1364         TInt err( KErrNone );
       
  1365         err = iCdsActionFactory->CdsStopTransferActionLC(
       
  1366             action,
       
  1367             (CUpnpDevice*)device,
       
  1368             aTransferId
       
  1369             );
       
  1370 
       
  1371         if( err == KErrNone )
       
  1372             {
       
  1373             
       
  1374             SendL( action );
       
  1375             CleanupStack::Pop( action );
       
  1376 
       
  1377             return action->SessionId();
       
  1378             }
       
  1379         else
       
  1380             {
       
  1381             return err;
       
  1382             }
       
  1383         }
       
  1384     }
       
  1385 
       
  1386 // -----------------------------------------------------------------------------
       
  1387 // CUpnpAVControlPoint::CdsTransferProgressActionL
       
  1388 // This function creates and sends a action.
       
  1389 // (other items were commented in a header)
       
  1390 // -----------------------------------------------------------------------------
       
  1391 //
       
  1392 EXPORT_C TInt CUpnpAVControlPoint::CdsTransferProgressActionL(const TDesC8& aUuid,
       
  1393                                                   TInt aTransferId )
       
  1394     {
       
  1395     const CUpnpDevice* device = Device( aUuid );
       
  1396     if( !device ) 
       
  1397         {
       
  1398         return KErrBadHandle;
       
  1399         }
       
  1400     else
       
  1401         {
       
  1402         CUpnpAction* action = NULL;
       
  1403         TInt err( KErrNone );
       
  1404         err = iCdsActionFactory->CdsTransferProgressActionLC(
       
  1405             action,
       
  1406             (CUpnpDevice*)device,
       
  1407             aTransferId
       
  1408             );
       
  1409 
       
  1410         if( err == KErrNone )
       
  1411             {
       
  1412             
       
  1413             SendL( action );
       
  1414             CleanupStack::Pop( action );
       
  1415 
       
  1416             return action->SessionId();
       
  1417             }
       
  1418         else
       
  1419             {
       
  1420             return err;
       
  1421             }
       
  1422         }
       
  1423     }
       
  1424 
       
  1425 // -----------------------------------------------------------------------------
       
  1426 // CUpnpAVControlPoint::CdsUpdateObjectActionL
       
  1427 // This function creates and sends a action.
       
  1428 // (other items were commented in a header)
       
  1429 // -----------------------------------------------------------------------------
       
  1430 //
       
  1431 EXPORT_C TInt CUpnpAVControlPoint::CdsUpdateObjectActionL(const TDesC8& aUuid,
       
  1432                                               const TDesC8& aObjectID,
       
  1433                                               const TDesC8& aCurrentTagValue,
       
  1434                                               const TDesC8& aNewTagValue )
       
  1435     {
       
  1436     const CUpnpDevice* device = Device( aUuid );
       
  1437     if( !device ) 
       
  1438         {
       
  1439         return KErrBadHandle;
       
  1440         }
       
  1441     else
       
  1442         {
       
  1443         CUpnpAction* action = NULL;
       
  1444         TInt err( KErrNone );
       
  1445         err = iCdsActionFactory->CdsUpdateObjectActionLC(
       
  1446             action,
       
  1447             (CUpnpDevice*)device,
       
  1448             aObjectID,
       
  1449             aCurrentTagValue,
       
  1450             aNewTagValue
       
  1451             );
       
  1452 
       
  1453         if( err == KErrNone )
       
  1454             {
       
  1455             
       
  1456             SendL( action );
       
  1457             CleanupStack::Pop( action );
       
  1458 
       
  1459             return action->SessionId();
       
  1460             }
       
  1461         else
       
  1462             {
       
  1463             return err;
       
  1464             }
       
  1465         }
       
  1466     }
       
  1467 
       
  1468 // -----------------------------------------------------------------------------
       
  1469 // CUpnpAVControlPoint::CmProtocolInfoActionL
       
  1470 // This function creates and sends a action.
       
  1471 // (other items were commented in a header)
       
  1472 // -----------------------------------------------------------------------------
       
  1473 //
       
  1474 EXPORT_C TInt CUpnpAVControlPoint::CmProtocolInfoActionL(
       
  1475                                                         const TDesC8& aUuid)
       
  1476     {
       
  1477     const CUpnpDevice* device = Device( aUuid );
       
  1478     if( !device ) 
       
  1479         {
       
  1480         return KErrBadHandle;
       
  1481         }
       
  1482     else
       
  1483         {
       
  1484         CUpnpAction* action = NULL;
       
  1485         TInt err( KErrNone );
       
  1486         err = iCmActionFactory->CmProtocolInfoActionLC(
       
  1487             action,
       
  1488             (CUpnpDevice*)device
       
  1489             );
       
  1490 
       
  1491         if( err == KErrNone )
       
  1492             {
       
  1493             
       
  1494             SendL( action );
       
  1495             CleanupStack::Pop( action );
       
  1496 
       
  1497             return action->SessionId();
       
  1498             }
       
  1499         else
       
  1500             {
       
  1501             return err;
       
  1502             }
       
  1503         }
       
  1504     }
       
  1505 
       
  1506 // -----------------------------------------------------------------------------
       
  1507 // CUpnpAVControlPoint::CmCurrentConnectionsActionL
       
  1508 // This function creates and sends a action.
       
  1509 // (other items were commented in a header)
       
  1510 // -----------------------------------------------------------------------------
       
  1511 //
       
  1512 EXPORT_C TInt CUpnpAVControlPoint::CmCurrentConnectionsActionL(const TDesC8& aUuid)
       
  1513     {
       
  1514     const CUpnpDevice* device = Device( aUuid );
       
  1515     if( !device ) 
       
  1516         {
       
  1517         return KErrBadHandle;
       
  1518         }
       
  1519     else
       
  1520         {
       
  1521         CUpnpAction* action = NULL;
       
  1522         TInt err( KErrNone );
       
  1523         err = iCmActionFactory->CmCurrentConnectionsActionLC(
       
  1524             action,
       
  1525             (CUpnpDevice*)device
       
  1526             );
       
  1527 
       
  1528         if( err == KErrNone )
       
  1529             {
       
  1530             
       
  1531             SendL( action );
       
  1532             CleanupStack::Pop( action );
       
  1533 
       
  1534             return action->SessionId();
       
  1535             }
       
  1536         else
       
  1537             {
       
  1538             return err;
       
  1539             }
       
  1540         }
       
  1541     }
       
  1542 
       
  1543 // -----------------------------------------------------------------------------
       
  1544 // CUpnpAVControlPoint::CmPrepareConnectionActionL
       
  1545 // This function creates and sends a action.
       
  1546 // (other items were commented in a header)
       
  1547 // -----------------------------------------------------------------------------
       
  1548 //
       
  1549 EXPORT_C TInt CUpnpAVControlPoint::CmPrepareConnectionActionL(
       
  1550                                           const TDesC8& aUuid,
       
  1551                                           const TDesC8& aRemoteProtocolInfo,
       
  1552                                           const TDesC8& aPeerConnectionManager,
       
  1553                                           TInt aPeerConnectionID,
       
  1554                                           const TDesC8& aDirection
       
  1555                                                   )
       
  1556     {
       
  1557     const CUpnpDevice* device = Device( aUuid );
       
  1558     if( !device ) 
       
  1559         {
       
  1560         return KErrBadHandle;
       
  1561         }
       
  1562     else
       
  1563         {
       
  1564         CUpnpAction* action = NULL;
       
  1565         TInt err( KErrNone );
       
  1566         err = iCmActionFactory->CmPrepareConnectionActionLC(
       
  1567             action,
       
  1568             (CUpnpDevice*)device,
       
  1569             aRemoteProtocolInfo,
       
  1570             aPeerConnectionManager,
       
  1571             aPeerConnectionID,
       
  1572             aDirection
       
  1573             );
       
  1574 
       
  1575         if( err == KErrNone )
       
  1576             {
       
  1577             
       
  1578             SendL( action );
       
  1579             CleanupStack::Pop( action );
       
  1580 
       
  1581             return action->SessionId();
       
  1582             }
       
  1583         else
       
  1584             {
       
  1585             return err;
       
  1586             }
       
  1587         }
       
  1588     }
       
  1589 
       
  1590 // -----------------------------------------------------------------------------
       
  1591 // CUpnpAVControlPoint::CmConnectionCompleteActionL
       
  1592 // This function creates and sends a action.
       
  1593 // (other items were commented in a header)
       
  1594 // -----------------------------------------------------------------------------
       
  1595 //
       
  1596 EXPORT_C TInt CUpnpAVControlPoint::CmConnectionCompleteActionL(
       
  1597                                                    const TDesC8& aUuid,
       
  1598                                                    TInt aConnectionId
       
  1599                                                    )
       
  1600     {
       
  1601     const CUpnpDevice* device = Device( aUuid );
       
  1602     if( !device ) 
       
  1603         {
       
  1604         return KErrBadHandle;
       
  1605         }
       
  1606     else
       
  1607         {
       
  1608         CUpnpAction* action = NULL;
       
  1609         TInt err( KErrNone );
       
  1610         err = iCmActionFactory->CmConnectionCompleteActionLC(
       
  1611             action,
       
  1612             (CUpnpDevice*)device,
       
  1613             aConnectionId
       
  1614             );
       
  1615 
       
  1616         if( err == KErrNone )
       
  1617             {
       
  1618             
       
  1619             SendL( action );
       
  1620             CleanupStack::Pop( action );
       
  1621 
       
  1622             return action->SessionId();
       
  1623             }
       
  1624         else
       
  1625             {
       
  1626             return err;
       
  1627             }
       
  1628         }
       
  1629     }
       
  1630 
       
  1631 // -----------------------------------------------------------------------------
       
  1632 // CUpnpAVControlPoint::CmCurrentConnectionInfoActionL
       
  1633 // This function creates and sends a action.
       
  1634 // (other items were commented in a header)
       
  1635 // -----------------------------------------------------------------------------
       
  1636 //
       
  1637 EXPORT_C TInt CUpnpAVControlPoint::CmCurrentConnectionInfoActionL(
       
  1638                                                       const TDesC8& aUuid,
       
  1639                                                       TInt aConnectionId
       
  1640                                                       )
       
  1641     {
       
  1642     const CUpnpDevice* device = Device( aUuid );
       
  1643     if( !device ) 
       
  1644         {
       
  1645         return KErrBadHandle;
       
  1646         }
       
  1647     else
       
  1648         {
       
  1649         CUpnpAction* action = NULL;
       
  1650         TInt err( KErrNone );
       
  1651         err = iCmActionFactory->CmCurrentConnectionInfoActionLC(
       
  1652             action,
       
  1653             (CUpnpDevice*)device,
       
  1654             aConnectionId
       
  1655             );
       
  1656 
       
  1657         if( err == KErrNone )
       
  1658             {
       
  1659             
       
  1660             SendL( action );
       
  1661             CleanupStack::Pop( action );
       
  1662 
       
  1663             return action->SessionId();
       
  1664             }
       
  1665         else
       
  1666             {
       
  1667             return err;
       
  1668             }
       
  1669         }
       
  1670     }
       
  1671 
       
  1672 // -----------------------------------------------------------------------------
       
  1673 // CUpnpAVControlPoint::RcGetVolumetActionL
       
  1674 // This function creates and sends a action.
       
  1675 // (other items were commented in a header)
       
  1676 // -----------------------------------------------------------------------------
       
  1677 //
       
  1678 EXPORT_C TInt CUpnpAVControlPoint::RcGetVolumetActionL(
       
  1679                                            const TDesC8& aUuid,
       
  1680                                            TInt aInstanceID,
       
  1681                                            const TDesC8& aChannel
       
  1682                                            )
       
  1683     {
       
  1684     const CUpnpDevice* device = Device( aUuid );
       
  1685     if( !device ) 
       
  1686         {
       
  1687         return KErrBadHandle;
       
  1688         }
       
  1689     else
       
  1690         {
       
  1691         CUpnpAction* action = NULL;
       
  1692         TInt err( KErrNone );
       
  1693         err = iRcActionFactory->RcGetVolumeActionLC(
       
  1694             action,
       
  1695             (CUpnpDevice*)device,
       
  1696             aInstanceID,
       
  1697             aChannel
       
  1698             );
       
  1699 
       
  1700         if( err == KErrNone )
       
  1701             {
       
  1702             
       
  1703             SendL( action );
       
  1704             CleanupStack::Pop( action );
       
  1705 
       
  1706             return action->SessionId();
       
  1707             }
       
  1708         else
       
  1709             {
       
  1710             return err;
       
  1711             }
       
  1712         }
       
  1713     }
       
  1714 
       
  1715 // -----------------------------------------------------------------------------
       
  1716 // CUpnpAVControlPoint::RcSetVolumetActionL
       
  1717 // This function creates and sends a action.
       
  1718 // (other items were commented in a header)
       
  1719 // -----------------------------------------------------------------------------
       
  1720 //
       
  1721 EXPORT_C TInt CUpnpAVControlPoint::RcSetVolumetActionL(
       
  1722                                            const TDesC8& aUuid,
       
  1723                                            TInt aInstanceId,
       
  1724                                            const TDesC8& aChannel,
       
  1725                                            TInt aVolume
       
  1726                                            )
       
  1727     {
       
  1728     const CUpnpDevice* device = Device( aUuid );
       
  1729     if( !device ) 
       
  1730         {
       
  1731         return KErrBadHandle;
       
  1732         }
       
  1733     else
       
  1734         {
       
  1735         CUpnpAction* action = NULL;
       
  1736         TInt err( KErrNone );
       
  1737         err = iRcActionFactory->RcSetVolumeActionLC(
       
  1738             action,
       
  1739             (CUpnpDevice*)device,
       
  1740             aInstanceId,
       
  1741             aChannel,
       
  1742             aVolume
       
  1743             );
       
  1744 
       
  1745         if( err == KErrNone )
       
  1746             {
       
  1747             
       
  1748             SendL( action );
       
  1749             CleanupStack::Pop( action );
       
  1750 
       
  1751             return action->SessionId();
       
  1752             }
       
  1753         else
       
  1754             {
       
  1755             return err;
       
  1756             }
       
  1757         }
       
  1758     }
       
  1759 
       
  1760 // -----------------------------------------------------------------------------
       
  1761 // CUpnpAVControlPoint::RcGetMuteActionL
       
  1762 // This function creates and sends a action.
       
  1763 // (other items were commented in a header)
       
  1764 // -----------------------------------------------------------------------------
       
  1765 //
       
  1766 EXPORT_C TInt CUpnpAVControlPoint::RcGetMuteActionL(
       
  1767                                         const TDesC8& aUuid,
       
  1768                                         TInt aInstanceId,
       
  1769                                         const TDesC8& aChannel
       
  1770                                         )
       
  1771     {
       
  1772     const CUpnpDevice* device = Device( aUuid );
       
  1773     if( !device ) 
       
  1774         {
       
  1775         return KErrBadHandle;
       
  1776         }
       
  1777     else
       
  1778         {
       
  1779         CUpnpAction* action = NULL;
       
  1780         TInt err( KErrNone );
       
  1781         err = iRcActionFactory->RcGetMuteActionLC(
       
  1782             action,
       
  1783             (CUpnpDevice*)device,
       
  1784             aInstanceId,
       
  1785             aChannel
       
  1786             );
       
  1787 
       
  1788         if( err == KErrNone )
       
  1789             {
       
  1790             
       
  1791             SendL( action );
       
  1792             CleanupStack::Pop( action );
       
  1793 
       
  1794             return action->SessionId();
       
  1795             }
       
  1796         else
       
  1797             {
       
  1798             return err;
       
  1799             }
       
  1800         }
       
  1801     }
       
  1802 
       
  1803 // -----------------------------------------------------------------------------
       
  1804 // CUpnpAVControlPoint::RcSetMuteActionL
       
  1805 // This function creates and sends a action.
       
  1806 // (other items were commented in a header)
       
  1807 // -----------------------------------------------------------------------------
       
  1808 //
       
  1809 EXPORT_C TInt CUpnpAVControlPoint::RcSetMuteActionL(
       
  1810                                         const TDesC8& aUuid,
       
  1811                                         TInt aInstanceId,
       
  1812                                         const TDesC8& aChannel,
       
  1813                                         const TDesC8& aMute
       
  1814                                         )
       
  1815     {
       
  1816     const CUpnpDevice* device = Device( aUuid );
       
  1817     if( !device ) 
       
  1818         {
       
  1819         return KErrBadHandle;
       
  1820         }
       
  1821     else
       
  1822         {
       
  1823         CUpnpAction* action = NULL;
       
  1824         TInt err( KErrNone );
       
  1825         err = iRcActionFactory->RcSetMuteActionLC(
       
  1826             action,
       
  1827             (CUpnpDevice*)device,
       
  1828             aInstanceId,
       
  1829             aChannel,
       
  1830             aMute
       
  1831             );
       
  1832 
       
  1833         if( err == KErrNone )
       
  1834             {
       
  1835             SendL( action );
       
  1836             CleanupStack::Pop( action );
       
  1837 
       
  1838             return action->SessionId();
       
  1839             }
       
  1840         else
       
  1841             {
       
  1842             return err;
       
  1843             }
       
  1844         }
       
  1845     }
       
  1846     
       
  1847 // -----------------------------------------------------------------------------
       
  1848 // CUpnpAVControlPoint::NetworkEvent
       
  1849 // -----------------------------------------------------------------------------
       
  1850 //
       
  1851 EXPORT_C void CUpnpAVControlPoint::NetworkEvent( CUpnpNetworkEventBase* aEvent )
       
  1852     {
       
  1853     CUpnpControlPoint::NetworkEvent( aEvent );                
       
  1854     TRAP_IGNORE( SearchL( UpnpSSDP::KUPnPRootDevice ) );
       
  1855     }    
       
  1856 
       
  1857 //end of file