upnpavcontroller/upnpavcontrollerclient/src/upnpavcontrollerclient.cpp
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:      AV Controller client
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 // Sysatem
       
    25 #include <e32math.h>
       
    26 #include <s32mem.h>
       
    27 #include <f32file.h>
       
    28 
       
    29 // upnpframework / avcontroller api
       
    30 #include "upnpavcontrollerglobals.h"
       
    31 
       
    32 // avcontroller internal
       
    33 #include "upnpavcontrollerclient.h"
       
    34 
       
    35 // Number of message slots to reserve for this client server session.
       
    36 const TInt KDefaultMessageSlots = -1;
       
    37 
       
    38 
       
    39 // Function prototypes
       
    40 static TInt StartServer( void );
       
    41 static TInt CreateServerProcess( void ); 
       
    42 
       
    43 // --------------------------------------------------------------------------
       
    44 // RUPnPAVControllerClient::RUPnPAVControllerClient
       
    45 // C++ default constructor can NOT contain any code, that
       
    46 // might leave.
       
    47 // --------------------------------------------------------------------------
       
    48 RUPnPAVControllerClient::RUPnPAVControllerClient()
       
    49     :RSessionBase() 
       
    50     {
       
    51     // No implementation required
       
    52     }
       
    53 
       
    54 // --------------------------------------------------------------------------
       
    55 // RUPnPAVControllerClient::Connect
       
    56 // Connect to Media Server session. 
       
    57 // exist
       
    58 // --------------------------------------------------------------------------
       
    59 TInt RUPnPAVControllerClient::Connect()
       
    60     {
       
    61     TInt error = ::StartServer();
       
    62 
       
    63     if ( KErrNone == error )
       
    64         {
       
    65         error = CreateSession( KAVControllerName,
       
    66                                Version(),
       
    67                                KDefaultMessageSlots );
       
    68         }
       
    69     return error;
       
    70     }
       
    71 
       
    72 // --------------------------------------------------------------------------
       
    73 // RUPnPAVControllerClient::Version
       
    74 // Version information.
       
    75 // --------------------------------------------------------------------------
       
    76 TVersion RUPnPAVControllerClient::Version() const
       
    77     {
       
    78     return TVersion( KAVControllerMajorVersionNumber,
       
    79                      KAVControllerMinorVersionNumber,
       
    80                      KAVControllerBuildVersionNumber );
       
    81     }
       
    82 
       
    83 
       
    84 // --------------------------------------------------------------------------
       
    85 // RUPnPAVControllerClient::StartUp
       
    86 // See upnpavcontrollerclient.h
       
    87 // --------------------------------------------------------------------------
       
    88 void RUPnPAVControllerClient::StartUp( TRequestStatus& aStatus )
       
    89     {
       
    90     TIpcArgs args( TIpcArgs::ENothing );
       
    91     SendReceive( EAVControllerStartupRequest, args, aStatus );    
       
    92     }
       
    93 
       
    94 
       
    95 // --------------------------------------------------------------------------
       
    96 // RUPnPAVControllerClient::CancelStartUp
       
    97 // See upnpavcontrollerclient.h
       
    98 // --------------------------------------------------------------------------
       
    99 TInt RUPnPAVControllerClient::CancelStartUp()
       
   100     {
       
   101     TIpcArgs args( TIpcArgs::ENothing );
       
   102     return SendReceive( EAVControllerCancelStartupRequest, args );    
       
   103     }
       
   104 
       
   105 // --------------------------------------------------------------------------
       
   106 // RUPnPAVControllerClient::DeviceRequest
       
   107 // See upnpavcontrollerclient.h
       
   108 // --------------------------------------------------------------------------
       
   109 void RUPnPAVControllerClient::DeviceRequest( TDes8& aDiscovered,
       
   110     TDes8& aRcvdBufSize, TRequestStatus& aStatus )
       
   111     {
       
   112     TIpcArgs args( &aDiscovered, &aRcvdBufSize );
       
   113     SendReceive( EAVControllerDeviceRequest, args, aStatus );    
       
   114     }
       
   115 
       
   116 // --------------------------------------------------------------------------
       
   117 // RUPnPAVControllerClient::CancelDeviceRequest
       
   118 // See upnpavcontrollerclient.h
       
   119 // --------------------------------------------------------------------------
       
   120 TInt RUPnPAVControllerClient::CancelDeviceRequest()
       
   121     {
       
   122     TIpcArgs args( TIpcArgs::ENothing );
       
   123     return SendReceive( EAVControllerCancelDeviceRequest, args );    
       
   124     }
       
   125 
       
   126 // --------------------------------------------------------------------------
       
   127 // RUPnPAVControllerClient::GetDevice
       
   128 // See upnpavcontrollerclient.h
       
   129 // --------------------------------------------------------------------------
       
   130 TInt RUPnPAVControllerClient::GetDevice( TDes8& aDevice )
       
   131     {
       
   132     TIpcArgs args( &aDevice );
       
   133     return SendReceive( EAVControllerGetDeviceRequest, args );
       
   134     }
       
   135     
       
   136 // --------------------------------------------------------------------------
       
   137 // RUPnPAVControllerClient::GetDeviceListSize
       
   138 // See upnpavcontrollerclient.h
       
   139 // --------------------------------------------------------------------------
       
   140 TInt RUPnPAVControllerClient::GetDeviceListSize( TDes8& aType, TDes8& aSize )
       
   141     {
       
   142     TIpcArgs args( &aType, &aSize );
       
   143     return SendReceive( EAVControllerGetDeviceListSizeRequest, args );
       
   144     }
       
   145     
       
   146 // --------------------------------------------------------------------------
       
   147 // RUPnPAVControllerClient::GetDeviceList
       
   148 // See upnpavcontrollerclient.h
       
   149 // --------------------------------------------------------------------------
       
   150 TInt RUPnPAVControllerClient::GetDeviceList( TDes8& aList )
       
   151     {
       
   152     TIpcArgs args( &aList );
       
   153     return SendReceive( EAVControllerGetDeviceListRequest, args );
       
   154     }
       
   155 
       
   156 // --------------------------------------------------------------------------
       
   157 // RUPnPAVControllerClient::ReleaseMediaServer
       
   158 // See upnpavcontrollerclient.h
       
   159 // --------------------------------------------------------------------------
       
   160 TInt RUPnPAVControllerClient::ReleaseMediaServer( TInt aId )
       
   161     {
       
   162     TIpcArgs args( aId );
       
   163     return SendReceive( EAVControllerStopMediaServer, args );    
       
   164     }
       
   165 
       
   166 // --------------------------------------------------------------------------
       
   167 // RUPnPAVControllerClient::ReserveMediaServer
       
   168 // See upnpavcontrollerclient.h
       
   169 // --------------------------------------------------------------------------
       
   170 void RUPnPAVControllerClient::ReserveMediaServer( TInt aId,
       
   171     TRequestStatus& aStatus )
       
   172     {
       
   173     TIpcArgs args( aId );
       
   174     SendReceive( EAVControllerStartMediaServer, args, aStatus );
       
   175     }
       
   176 
       
   177 // --------------------------------------------------------------------------
       
   178 // RUPnPAVControllerClient::CancelReserveMediaServer
       
   179 // See upnpavcontrollerclient.h
       
   180 // --------------------------------------------------------------------------
       
   181 TInt RUPnPAVControllerClient::CancelReserveMediaServer( TInt aId )
       
   182     {
       
   183     TIpcArgs args( aId );
       
   184     return SendReceive( EAVControllerCancelStartMediaServer, args );
       
   185     }
       
   186 
       
   187 // --------------------------------------------------------------------------
       
   188 // RUPnPAVControllerClient::CreateRenderingSession
       
   189 // See upnpavcontrollerclient.h
       
   190 // --------------------------------------------------------------------------
       
   191 TInt RUPnPAVControllerClient::CreateRenderingSession( TInt aId,
       
   192     TDes8& aUuid )
       
   193     {
       
   194     TIpcArgs args( aId, &aUuid );
       
   195     return SendReceive( EAVControllerCreateRenderingSession, args );    
       
   196     }
       
   197 
       
   198 // --------------------------------------------------------------------------
       
   199 // RUPnPAVControllerClient::DestroyRenderingSession
       
   200 // See upnpavcontrollerclient.h
       
   201 // --------------------------------------------------------------------------
       
   202 TInt RUPnPAVControllerClient::DestroyRenderingSession( TInt aId )
       
   203     {
       
   204     TIpcArgs args( aId );
       
   205     return SendReceive( EAVControllerDestroyRenderingSession, args );
       
   206     }
       
   207 
       
   208 // --------------------------------------------------------------------------
       
   209 // RUPnPAVControllerClient::EventRequest
       
   210 // See upnpavcontrollerclient.h
       
   211 // --------------------------------------------------------------------------
       
   212 void RUPnPAVControllerClient::EventRequest( TDes8& aEvent, TInt aId,
       
   213     TRequestStatus& aStatus )
       
   214     {
       
   215     TIpcArgs args( aId, &aEvent );
       
   216     SendReceive( EAVControllerEventRequest, args, aStatus );   
       
   217     }
       
   218 
       
   219 // --------------------------------------------------------------------------
       
   220 // RUPnPAVControllerClient::CancelEventRequest
       
   221 // See upnpavcontrollerclient.h
       
   222 // --------------------------------------------------------------------------
       
   223 TInt RUPnPAVControllerClient::CancelEventRequest( TInt aId )
       
   224     {
       
   225     TIpcArgs args( aId );
       
   226     return SendReceive( EAVControllerCancelEventRequest, args );    
       
   227     }
       
   228 
       
   229 // --------------------------------------------------------------------------
       
   230 // RUPnPAVControllerClient::SetURI
       
   231 // See upnpavcontrollerclient.h
       
   232 // --------------------------------------------------------------------------
       
   233 void RUPnPAVControllerClient::SetURI( TInt aId, TDes8& aRequest,
       
   234     TDes8& aItem, TRequestStatus& aStatus )
       
   235     {
       
   236     TIpcArgs args( aId, &aRequest, &aItem );
       
   237     
       
   238     SendReceive( EAVControllerSetURI, args, aStatus );   
       
   239     }
       
   240     
       
   241 // --------------------------------------------------------------------------
       
   242 // RUPnPAVControllerClient::CancelSetURI
       
   243 // See upnpavcontrollerclient.h
       
   244 // --------------------------------------------------------------------------
       
   245 TInt RUPnPAVControllerClient::CancelSetURI( TInt aId )
       
   246     {
       
   247     TIpcArgs args( aId );
       
   248     return SendReceive( EAVControllerCancelSetURI, args );
       
   249     }
       
   250 
       
   251 // --------------------------------------------------------------------------
       
   252 // RUPnPAVControllerClient::SetNextURI
       
   253 // See upnpavcontrollerclient.h
       
   254 // --------------------------------------------------------------------------
       
   255 void RUPnPAVControllerClient::SetNextURI( TInt aId, TDes8& aRequest,
       
   256     TDes8& aItem, TRequestStatus& aStatus )
       
   257     {
       
   258     TIpcArgs args( aId, &aRequest, &aItem );
       
   259     
       
   260     SendReceive( EAVControllerSetNextURI, args, aStatus );       
       
   261     }
       
   262 
       
   263 // --------------------------------------------------------------------------
       
   264 // RUPnPAVControllerClient::CancelSetNextURI
       
   265 // See upnpavcontrollerclient.h
       
   266 // --------------------------------------------------------------------------
       
   267 TInt RUPnPAVControllerClient::CancelSetNextURI( TInt aId )
       
   268     {
       
   269     TIpcArgs args( aId );
       
   270     return SendReceive( EAVControllerCancelSetNextURI, args );    
       
   271     }
       
   272 
       
   273 // --------------------------------------------------------------------------
       
   274 // RUPnPAVControllerClient::Play
       
   275 // See upnpavcontrollerclient.h
       
   276 // --------------------------------------------------------------------------
       
   277 void RUPnPAVControllerClient::Play( TInt aId, TRequestStatus& aStatus )
       
   278     {
       
   279     TIpcArgs args( aId );
       
   280     
       
   281     SendReceive( EAVControllerPlay, args, aStatus );       
       
   282     }
       
   283 
       
   284 // --------------------------------------------------------------------------
       
   285 // RUPnPAVControllerClient::CancelPlay
       
   286 // See upnpavcontrollerclient.h
       
   287 // --------------------------------------------------------------------------
       
   288 TInt RUPnPAVControllerClient::CancelPlay( TInt aId )
       
   289     {
       
   290     TIpcArgs args( aId );
       
   291     return SendReceive( EAVControllerCancelPlay, args );
       
   292     }
       
   293       
       
   294 // --------------------------------------------------------------------------
       
   295 // RUPnPAVControllerClient::Stop
       
   296 // See upnpavcontrollerclient.h
       
   297 // --------------------------------------------------------------------------
       
   298 void RUPnPAVControllerClient::Stop( TInt aId, TRequestStatus& aStatus )
       
   299     {
       
   300     TIpcArgs args( aId );
       
   301     SendReceive( EAVControllerStop, args, aStatus ); 
       
   302     }
       
   303     
       
   304 // --------------------------------------------------------------------------
       
   305 // RUPnPAVControllerClient::CancelStop
       
   306 // See upnpavcontrollerclient.h
       
   307 // --------------------------------------------------------------------------
       
   308 TInt RUPnPAVControllerClient::CancelStop( TInt aId )
       
   309     {
       
   310     TIpcArgs args( aId );
       
   311     return SendReceive( EAVControllerCancelStop, args ); 
       
   312     }
       
   313     
       
   314 // --------------------------------------------------------------------------
       
   315 // RUPnPAVControllerClient::Pause
       
   316 // See upnpavcontrollerclient.h
       
   317 // --------------------------------------------------------------------------
       
   318 void RUPnPAVControllerClient::Pause( TInt aId, TRequestStatus& aStatus )
       
   319     {
       
   320     TIpcArgs args( aId );
       
   321     SendReceive( EAVControllerPause, args, aStatus ); 
       
   322     }
       
   323     
       
   324 // --------------------------------------------------------------------------
       
   325 // RUPnPAVControllerClient::CancelPause
       
   326 // See upnpavcontrollerclient.h
       
   327 // --------------------------------------------------------------------------
       
   328 TInt RUPnPAVControllerClient::CancelPause( TInt aId )
       
   329     {
       
   330     TIpcArgs args( aId );
       
   331     return SendReceive( EAVControllerCancelPause, args );    
       
   332     }
       
   333 
       
   334 // --------------------------------------------------------------------------
       
   335 // RUPnPAVControllerClient::SetVolume
       
   336 // See upnpavcontrollerclient.h
       
   337 // --------------------------------------------------------------------------
       
   338 void RUPnPAVControllerClient::SetVolume( TInt aId, TInt aVolumeLevel,
       
   339     TDes8& aRetVolume, TRequestStatus& aStatus )
       
   340     {
       
   341     TIpcArgs args( aId, aVolumeLevel, &aRetVolume );
       
   342     SendReceive( EAVControllerSetVolume, args, aStatus );      
       
   343     }
       
   344 
       
   345 // --------------------------------------------------------------------------
       
   346 // RUPnPAVControllerClient::CancelSetVolume
       
   347 // See upnpavcontrollerclient.h
       
   348 // --------------------------------------------------------------------------
       
   349 TInt RUPnPAVControllerClient::CancelSetVolume( TInt aId )
       
   350     {
       
   351     TIpcArgs args( aId );
       
   352     return SendReceive( EAVControllerCancelSetVolume, args );        
       
   353     }
       
   354 
       
   355 // --------------------------------------------------------------------------
       
   356 // RUPnPAVControllerClient::GetVolume
       
   357 // See upnpavcontrollerclient.h
       
   358 // --------------------------------------------------------------------------
       
   359 void RUPnPAVControllerClient::GetVolume( TInt aId, TDes8& aVolumeLevel,
       
   360     TRequestStatus& aStatus )
       
   361     {
       
   362     TIpcArgs args( aId, &aVolumeLevel );
       
   363     SendReceive( EAVControllerGetVolume, args, aStatus );     
       
   364     }
       
   365 
       
   366 // --------------------------------------------------------------------------
       
   367 // RUPnPAVControllerClient::CancelGetVolume
       
   368 // See upnpavcontrollerclient.h
       
   369 // --------------------------------------------------------------------------
       
   370 TInt RUPnPAVControllerClient::CancelGetVolume( TInt aId )
       
   371     {
       
   372     TIpcArgs args( aId );
       
   373     return SendReceive( EAVControllerCancelGetVolume, args );        
       
   374     }
       
   375 
       
   376 // --------------------------------------------------------------------------
       
   377 // RUPnPAVControllerClient::SetMute
       
   378 // See upnpavcontrollerclient.h
       
   379 // --------------------------------------------------------------------------
       
   380 void RUPnPAVControllerClient::SetMute( TInt aId, TBool aMute,
       
   381     TDes8& aRetMute, TRequestStatus& aStatus )
       
   382     {
       
   383     TIpcArgs args( aId, (TInt)aMute, &aRetMute );
       
   384     SendReceive( EAVControllerSetMute, args, aStatus );        
       
   385     }
       
   386 
       
   387 // --------------------------------------------------------------------------
       
   388 // RUPnPAVControllerClient::GetMute
       
   389 // See upnpavcontrollerclient.h
       
   390 // --------------------------------------------------------------------------
       
   391 void RUPnPAVControllerClient::GetMute( TInt aId, TDes8& aMute,
       
   392     TRequestStatus& aStatus )
       
   393     {
       
   394     TIpcArgs args( aId, &aMute );
       
   395     SendReceive( EAVControllerGetMute, args, aStatus );     
       
   396     }
       
   397 
       
   398 // --------------------------------------------------------------------------
       
   399 // RUPnPAVControllerClient::CancelSetMute
       
   400 // See upnpavcontrollerclient.h
       
   401 // --------------------------------------------------------------------------
       
   402 TInt RUPnPAVControllerClient::CancelSetMute( TInt aId )
       
   403     {
       
   404     TIpcArgs args( aId );
       
   405     return SendReceive( EAVControllerCancelSetMute, args );        
       
   406     }
       
   407 
       
   408 // --------------------------------------------------------------------------
       
   409 // RUPnPAVControllerClient::CancelGetMute
       
   410 // See upnpavcontrollerclient.h
       
   411 // --------------------------------------------------------------------------
       
   412 TInt RUPnPAVControllerClient::CancelGetMute( TInt aId )
       
   413     {
       
   414     TIpcArgs args( aId );
       
   415     return SendReceive( EAVControllerCancelGetMute, args );        
       
   416     }
       
   417 
       
   418 // --------------------------------------------------------------------------
       
   419 // RUPnPAVControllerClient::GetPositionInfo
       
   420 // See upnpavcontrollerclient.h
       
   421 // --------------------------------------------------------------------------
       
   422 void RUPnPAVControllerClient::GetPositionInfo( TInt aId, TDes8& aPosition,
       
   423     TDes8& aLength, TRequestStatus& aStatus )    
       
   424     {
       
   425     TIpcArgs args( aId, &aPosition, &aLength );
       
   426     SendReceive( EAVControllerGetPositionInfo, args, aStatus );     
       
   427     }
       
   428     
       
   429 // --------------------------------------------------------------------------
       
   430 // RUPnPAVControllerClient::CancelGetPositionInfo
       
   431 // See upnpavcontrollerclient.h
       
   432 // --------------------------------------------------------------------------
       
   433 TInt RUPnPAVControllerClient::CancelGetPositionInfo( TInt aId )
       
   434     {
       
   435     TIpcArgs args( aId );
       
   436     return SendReceive( EAVControllerCancelGetPositionInfo, args ); 
       
   437     }
       
   438 
       
   439 // --------------------------------------------------------------------------
       
   440 // RUPnPAVControllerClient::CreateBrowsingSession
       
   441 // See upnpavcontrollerclient.h
       
   442 // --------------------------------------------------------------------------
       
   443 TInt RUPnPAVControllerClient::CreateBrowsingSession( TInt aId, TDes8& aUuid )
       
   444     {
       
   445     TIpcArgs args( aId, &aUuid );
       
   446     return SendReceive( EAVControllerCreateBrowsingSession, args ); 
       
   447     }
       
   448 
       
   449 
       
   450 // --------------------------------------------------------------------------
       
   451 // RUPnPAVControllerClient::DestroyBrowsingSession
       
   452 // See upnpavcontrollerclient.h
       
   453 // --------------------------------------------------------------------------
       
   454 TInt RUPnPAVControllerClient::DestroyBrowsingSession( TInt aId )
       
   455     {
       
   456     TIpcArgs args( aId );
       
   457     return SendReceive( EAVControllerDestroyBrowsingSession, args );     
       
   458     }
       
   459 
       
   460 // --------------------------------------------------------------------------
       
   461 // RUPnPAVControllerClient::BrowseResponseSize
       
   462 // See upnpavcontrollerclient.h
       
   463 // --------------------------------------------------------------------------
       
   464 void RUPnPAVControllerClient::BrowseResponseSize( TInt aId, TDes8& aRequest,
       
   465     TDes8& aParams, TRequestStatus& aStatus )
       
   466     {
       
   467     TIpcArgs args( aId, &aRequest, &aParams );
       
   468     SendReceive( EAVControllerGetBrowseResponseSize, args, aStatus );         
       
   469     }
       
   470 
       
   471 // --------------------------------------------------------------------------
       
   472 // RUPnPAVControllerClient::CancelBrowseResponseSize
       
   473 // See upnpavcontrollerclient.h
       
   474 // --------------------------------------------------------------------------
       
   475 TInt RUPnPAVControllerClient::CancelBrowseResponseSize( TInt aId )
       
   476     {
       
   477     TIpcArgs args( aId );
       
   478     return SendReceive( EAVControllerCancelGetBrowseResponseSize, args );     
       
   479     }
       
   480 
       
   481 // --------------------------------------------------------------------------
       
   482 // RUPnPAVControllerClient::BrowseResponse
       
   483 // See upnpavcontrollerclient.h
       
   484 // --------------------------------------------------------------------------
       
   485 TInt RUPnPAVControllerClient::BrowseResponse( TInt aId,
       
   486     TDes8& aBrowseResponse, TDes8& aUpdateId)
       
   487     {
       
   488     TIpcArgs args( aId, &aBrowseResponse, &aUpdateId );
       
   489     return SendReceive( EAVControllerGetBrowseResponse, args );
       
   490     }
       
   491 
       
   492 // --------------------------------------------------------------------------
       
   493 // RUPnPAVControllerClient::SearchResponseSize
       
   494 // See upnpavcontrollerclient.h
       
   495 // --------------------------------------------------------------------------
       
   496 void RUPnPAVControllerClient::SearchResponseSize( TInt aId, TDes8& aRequest,
       
   497     TDes8& aParams, TRequestStatus& aStatus )
       
   498     {
       
   499     TIpcArgs args( aId, &aRequest, &aParams );
       
   500     SendReceive( EAVControllerGetSearchResponseSize, args, aStatus );
       
   501     }
       
   502 
       
   503 // --------------------------------------------------------------------------
       
   504 // RUPnPAVControllerClient::CancelSearchResponseSize
       
   505 // See upnpavcontrollerclient.h
       
   506 // --------------------------------------------------------------------------
       
   507 TInt RUPnPAVControllerClient::CancelSearchResponseSize( TInt aId )
       
   508     {
       
   509     TIpcArgs args( aId );
       
   510     return SendReceive( EAVControllerCancelGetSearchResponseSize, args );
       
   511     }
       
   512 
       
   513 // --------------------------------------------------------------------------
       
   514 // RUPnPAVControllerClient::SearchResponse
       
   515 // See upnpavcontrollerclient.h
       
   516 // --------------------------------------------------------------------------
       
   517 TInt RUPnPAVControllerClient::SearchResponse( TInt aId,
       
   518     TDes8& aSearchResponse, TDes8& aUpdateId )
       
   519     {
       
   520     TIpcArgs args( aId, &aSearchResponse,& aUpdateId );
       
   521     return SendReceive( EAVControllerGetSearchResponse, args );             
       
   522     }
       
   523 
       
   524 // --------------------------------------------------------------------------
       
   525 // RUPnPAVControllerClient::GetSearchCapabilitiesSize
       
   526 // See upnpavcontrollerclient.h
       
   527 // --------------------------------------------------------------------------
       
   528 void RUPnPAVControllerClient::GetSearchCapabilitiesSize( TInt aId,
       
   529     TDes8& aSize, TRequestStatus& aStatus )
       
   530     {
       
   531     TIpcArgs args( aId, &aSize );
       
   532     SendReceive( EAVControllerGetSearchCapabilitiesSize, args, aStatus );
       
   533     }
       
   534 
       
   535 // --------------------------------------------------------------------------
       
   536 // RUPnPAVControllerClient::CancelGetSearchCapabilitiesSize
       
   537 // See upnpavcontrollerclient.h
       
   538 // --------------------------------------------------------------------------
       
   539 TInt RUPnPAVControllerClient::CancelGetSearchCapabilitiesSize( TInt aId )
       
   540     {
       
   541     TIpcArgs args( aId );
       
   542     return SendReceive( EAVControllerCancelGetSearchCapabilitiesSize,
       
   543         args );
       
   544     }
       
   545 
       
   546 // --------------------------------------------------------------------------
       
   547 // RUPnPAVControllerClient::SearchCapabilitiesResponse
       
   548 // See upnpavcontrollerclient.h
       
   549 // --------------------------------------------------------------------------
       
   550 TInt RUPnPAVControllerClient::SearchCapabilitiesResponse( TInt aId,
       
   551     TDes8& aCapabilitiesResponse )
       
   552     {
       
   553     TIpcArgs args( aId, &aCapabilitiesResponse );
       
   554     return SendReceive( EAVControllerGetSearchCapabilities, args );    
       
   555     }
       
   556 
       
   557 // --------------------------------------------------------------------------
       
   558 // RUPnPAVControllerClient::CreateContainer
       
   559 // See upnpavcontrollerclient.h
       
   560 // --------------------------------------------------------------------------
       
   561 void RUPnPAVControllerClient::CreateContainer( TInt aId, TDes8& aTitle,
       
   562     TDes8& aParentId, TInt aContainerType, TRequestStatus& aStatus )
       
   563     {
       
   564     TIpcArgs args( aId, &aTitle, &aParentId, aContainerType );
       
   565     SendReceive( EAVControllerCreateContainer, args, aStatus );        
       
   566     }
       
   567 
       
   568 // --------------------------------------------------------------------------
       
   569 // RUPnPAVControllerClient::CancelCreateContainer
       
   570 // See upnpavcontrollerclient.h
       
   571 // --------------------------------------------------------------------------
       
   572 TInt RUPnPAVControllerClient::CancelCreateContainer( TInt aId )
       
   573     {
       
   574     TIpcArgs args( aId );
       
   575     return SendReceive( EAVControllerCancelCreateContainer, args );        
       
   576     }
       
   577 
       
   578 // --------------------------------------------------------------------------
       
   579 // RUPnPAVControllerClient::DeleteObject
       
   580 // See upnpavcontrollerclient.h
       
   581 // --------------------------------------------------------------------------
       
   582 void RUPnPAVControllerClient::DeleteObject( TInt aId, TDes8& aObjectId,
       
   583     TRequestStatus& aStatus )
       
   584     {
       
   585     TIpcArgs args( aId, &aObjectId );
       
   586     SendReceive( EAVControllerDeleteObject, args, aStatus );        
       
   587     }
       
   588 
       
   589 // --------------------------------------------------------------------------
       
   590 // RUPnPAVControllerClient::CancelDeleteObject
       
   591 // See upnpavcontrollerclient.h
       
   592 // --------------------------------------------------------------------------
       
   593 TInt RUPnPAVControllerClient::CancelDeleteObject( TInt aId )
       
   594     {
       
   595     TIpcArgs args( aId );
       
   596     return SendReceive( EAVControllerCancelDeleteObject, args );        
       
   597     }
       
   598 
       
   599 // --------------------------------------------------------------------------
       
   600 // RUPnPAVControllerClient::DeviceDisappearedRequest
       
   601 // See upnpavcontrollerclient.h
       
   602 // --------------------------------------------------------------------------
       
   603 void RUPnPAVControllerClient::DeviceDisappearedRequest( TInt aId,
       
   604     TRequestStatus& aStatus )
       
   605     {
       
   606     TIpcArgs args( aId );
       
   607     SendReceive( EAVControllerDeviceDisappearedRequest, args, aStatus );
       
   608     }
       
   609 
       
   610 // --------------------------------------------------------------------------
       
   611 // RUPnPAVControllerClient::CancelDeviceDisappearedRequest
       
   612 // See upnpavcontrollerclient.h
       
   613 // --------------------------------------------------------------------------
       
   614 TInt RUPnPAVControllerClient::CancelDeviceDisappearedRequest( TInt aId )
       
   615     {
       
   616     TIpcArgs args( aId );
       
   617     return SendReceive( EAVControllerCancelDeviceDisappearedRequest, args );
       
   618     }
       
   619 
       
   620 // --------------------------------------------------------------------------
       
   621 // RUPnPAVControllerClient::MonitorConnection
       
   622 // See upnpavcontrollerclient.h
       
   623 // --------------------------------------------------------------------------
       
   624 void RUPnPAVControllerClient::MonitorConnection( TRequestStatus& aStatus )
       
   625     {
       
   626     TIpcArgs args( TIpcArgs::ENothing );
       
   627     SendReceive( EAVControllerMonitorConnection, args, aStatus );        
       
   628     }
       
   629     
       
   630 // --------------------------------------------------------------------------
       
   631 // RUPnPAVControllerClient::CancelMonitorConnection
       
   632 // See upnpavcontrollerclient.h
       
   633 // --------------------------------------------------------------------------
       
   634 TInt RUPnPAVControllerClient::CancelMonitorConnection()
       
   635     {
       
   636     TIpcArgs args( TIpcArgs::ENothing );
       
   637     return SendReceive( EAVControllerCancelMonitorConnection, args );    
       
   638     }
       
   639 
       
   640 // --------------------------------------------------------------------------
       
   641 // RUPnPAVControllerClient::MSServicesInUse
       
   642 // See upnpavcontrollerclient.h
       
   643 // --------------------------------------------------------------------------
       
   644 TInt RUPnPAVControllerClient::MSServicesInUse( TDes8& aInUse )
       
   645     {
       
   646     TIpcArgs args( &aInUse );
       
   647     return SendReceive( EAVControllerMSServicesInUse, args ); 
       
   648     }
       
   649 
       
   650 // --------------------------------------------------------------------------
       
   651 // RUPnPAVControllerClient::CreateDownloadSession
       
   652 // See upnpavcontrollerclient.h
       
   653 // --------------------------------------------------------------------------
       
   654 TInt RUPnPAVControllerClient::CreateDownloadSession( TInt aId, TDes8& aUuid )
       
   655     {
       
   656     TIpcArgs args( aId, &aUuid );
       
   657     return SendReceive( EAVControllerCreateDownloadSession, args );        
       
   658     }
       
   659     
       
   660 // --------------------------------------------------------------------------
       
   661 // RUPnPAVControllerClient::DestroyDownloadSession
       
   662 // See upnpavcontrollerclient.h
       
   663 // --------------------------------------------------------------------------
       
   664 TInt RUPnPAVControllerClient::DestroyDownloadSession( TInt aId )
       
   665     {
       
   666     TIpcArgs args( aId );
       
   667     return SendReceive( EAVControllerDestroyDownloadSession, args );    
       
   668     }
       
   669     
       
   670 // --------------------------------------------------------------------------
       
   671 // RUPnPAVControllerClient::CreateUploadSession
       
   672 // See upnpavcontrollerclient.h
       
   673 // --------------------------------------------------------------------------
       
   674 TInt RUPnPAVControllerClient::CreateUploadSession( TInt aId, TDes8& aUuid )
       
   675     {
       
   676     TIpcArgs args( aId, &aUuid );
       
   677     return SendReceive( EAVControllerCreateUploadSession, args );            
       
   678     }
       
   679     
       
   680 // --------------------------------------------------------------------------
       
   681 // RUPnPAVControllerClient::MSServicesInUse
       
   682 // See upnpavcontrollerclient.h
       
   683 // --------------------------------------------------------------------------
       
   684 TInt RUPnPAVControllerClient::DestroyUploadSession( TInt aId )
       
   685     {
       
   686     TIpcArgs args( aId );
       
   687     return SendReceive( EAVControllerDestroyUploadSession, args );        
       
   688     }
       
   689 
       
   690 // --------------------------------------------------------------------------
       
   691 // RUPnPAVControllerClient::MSServicesInUse
       
   692 // See upnpavcontrollerclient.h
       
   693 // --------------------------------------------------------------------------
       
   694 TInt RUPnPAVControllerClient::StartDownload( TInt aId,
       
   695     TDes8& aFileTransferItem )
       
   696     {
       
   697     TIpcArgs args( aId, &aFileTransferItem );
       
   698     return SendReceive( EAVControllerStartDownload, args );    
       
   699     }
       
   700 
       
   701 // --------------------------------------------------------------------------
       
   702 // RUPnPAVControllerClient::MSServicesInUse
       
   703 // See upnpavcontrollerclient.h
       
   704 // --------------------------------------------------------------------------
       
   705 TInt RUPnPAVControllerClient::StartDownload( TInt aId,
       
   706     TDes8& aFileTransferItem, const RFile& aFile )
       
   707     {
       
   708     TIpcArgs args( aId, &aFileTransferItem );
       
   709     aFile.TransferToServer( args, 2, 3 );
       
   710     return SendReceive( EAVControllerStartDownloadFH, args );
       
   711     }
       
   712 
       
   713 // --------------------------------------------------------------------------
       
   714 // RUPnPAVControllerClient::MSServicesInUse
       
   715 // See upnpavcontrollerclient.h
       
   716 // --------------------------------------------------------------------------
       
   717 void RUPnPAVControllerClient::GetDownloadEvent( TInt aId, TDes8& aEvent,
       
   718     TRequestStatus& aStatus, TDes& aBuffer )
       
   719     {
       
   720     TIpcArgs args( aId, &aEvent, &aBuffer );
       
   721     SendReceive( EAVControllerGetDownloadEvent, args, aStatus );
       
   722     }
       
   723 
       
   724 // --------------------------------------------------------------------------
       
   725 // RUPnPAVControllerClient::MSServicesInUse
       
   726 // See upnpavcontrollerclient.h
       
   727 // --------------------------------------------------------------------------
       
   728 TInt RUPnPAVControllerClient::CancelDownloadEvent( TInt aId )
       
   729     {
       
   730     TIpcArgs args( aId );
       
   731     return SendReceive( EAVControllerCancelDownloadEvent, args );
       
   732     }
       
   733 
       
   734 // --------------------------------------------------------------------------
       
   735 // RUPnPAVControllerClient::MSServicesInUse
       
   736 // See upnpavcontrollerclient.h
       
   737 // --------------------------------------------------------------------------
       
   738 TInt RUPnPAVControllerClient::StartTrackingDownloadProgress( TInt aId,
       
   739     TInt aKey )
       
   740     {
       
   741     TIpcArgs args( aId, aKey );
       
   742     return SendReceive( EAVControllerStartTrackingDownloadProgress, args );
       
   743     }
       
   744 
       
   745 // --------------------------------------------------------------------------
       
   746 // RUPnPAVControllerClient::MSServicesInUse
       
   747 // See upnpavcontrollerclient.h
       
   748 // --------------------------------------------------------------------------
       
   749 TInt RUPnPAVControllerClient::CancelDownload( TInt aId, TInt aKey )
       
   750     {
       
   751     TIpcArgs args( aId, aKey );
       
   752     return SendReceive( EAVControllerCancelDownload, args );    
       
   753     }
       
   754     
       
   755 // --------------------------------------------------------------------------
       
   756 // RUPnPAVControllerClient::MSServicesInUse
       
   757 // See upnpavcontrollerclient.h
       
   758 // --------------------------------------------------------------------------
       
   759 TInt RUPnPAVControllerClient::CancelAllDownloads( TInt aId )
       
   760     {
       
   761     TIpcArgs args( aId );
       
   762     return SendReceive( EAVControllerCancelAllDownloads, args );
       
   763     }
       
   764 
       
   765 // --------------------------------------------------------------------------
       
   766 // RUPnPAVControllerClient::MSServicesInUse
       
   767 // See upnpavcontrollerclient.h
       
   768 // --------------------------------------------------------------------------
       
   769 TInt RUPnPAVControllerClient::StartUpload( TInt aId, TDes8& aFileTransferItem )
       
   770     {
       
   771     TIpcArgs args( aId, &aFileTransferItem );
       
   772     return SendReceive( EAVControllerStartUpload, args );    
       
   773     }
       
   774     
       
   775 // --------------------------------------------------------------------------
       
   776 // RUPnPAVControllerClient::MSServicesInUse
       
   777 // See upnpavcontrollerclient.h
       
   778 // --------------------------------------------------------------------------
       
   779 void RUPnPAVControllerClient::GetUploadEvent( TInt aId, TDes8& aEvent,
       
   780         TRequestStatus& aStatus )
       
   781     {
       
   782     TIpcArgs args( aId, &aEvent );
       
   783     SendReceive( EAVControllerGetUploadEvent, args, aStatus );    
       
   784     }
       
   785     
       
   786 // --------------------------------------------------------------------------
       
   787 // RUPnPAVControllerClient::MSServicesInUse
       
   788 // See upnpavcontrollerclient.h
       
   789 // --------------------------------------------------------------------------
       
   790 TInt RUPnPAVControllerClient::CancelUploadEvent( TInt aId )
       
   791     {
       
   792     TIpcArgs args( aId );
       
   793     return SendReceive( EAVControllerCancelUploadEvent, args );    
       
   794     }
       
   795         
       
   796 // --------------------------------------------------------------------------
       
   797 // RUPnPAVControllerClient::MSServicesInUse
       
   798 // See upnpavcontrollerclient.h
       
   799 // --------------------------------------------------------------------------
       
   800 TInt RUPnPAVControllerClient::StartTrackingUploadProgress( TInt aId, TInt aKey )
       
   801     {
       
   802     TIpcArgs args( aId, aKey );
       
   803     return SendReceive( EAVControllerStartTrackingUploadProgress, args );    
       
   804     }
       
   805     
       
   806 // --------------------------------------------------------------------------
       
   807 // RUPnPAVControllerClient::MSServicesInUse
       
   808 // See upnpavcontrollerclient.h
       
   809 // --------------------------------------------------------------------------
       
   810 TInt RUPnPAVControllerClient::CancelUpload( TInt aId, TInt aKey )
       
   811     {
       
   812     TIpcArgs args( aId, aKey );
       
   813     return SendReceive( EAVControllerCancelUpload, args );        
       
   814     }
       
   815     
       
   816 // --------------------------------------------------------------------------
       
   817 // RUPnPAVControllerClient::MSServicesInUse
       
   818 // See upnpavcontrollerclient.h
       
   819 // --------------------------------------------------------------------------
       
   820 TInt RUPnPAVControllerClient::CancelAllUploads( TInt aId )
       
   821     {
       
   822     TIpcArgs args( aId );
       
   823     return SendReceive( EAVControllerCancelAllUploads, args );    
       
   824     }
       
   825 
       
   826 // --------------------------------------------------------------------------
       
   827 // StartServer
       
   828 // Static method to start the server.
       
   829 // --------------------------------------------------------------------------
       
   830 static TInt StartServer()
       
   831     {
       
   832     TInt result;
       
   833 
       
   834     TFindServer findAVControllerServer( KAVControllerName );
       
   835     TFullName name;
       
   836 
       
   837     result = findAVControllerServer.Next( name );
       
   838     if ( result != KErrNone )
       
   839         {
       
   840         // server not found - try to create it.
       
   841         result = CreateServerProcess();
       
   842         }
       
   843 
       
   844     return  result;
       
   845     }
       
   846 
       
   847 // --------------------------------------------------------------------------
       
   848 // CreateServerProcess
       
   849 // Static method to create the server process.
       
   850 // --------------------------------------------------------------------------
       
   851 static TInt CreateServerProcess()
       
   852     {
       
   853     TInt result;
       
   854 
       
   855     const TUidType serverUid( KNullUid, KNullUid, KAVCServerUid3 );
       
   856     RProcess server;
       
   857 
       
   858     result = server.Create( KAVControllerFilename, KNullDesC, serverUid );
       
   859     if ( result != KErrNone )
       
   860         {
       
   861         return  result;
       
   862         }
       
   863 
       
   864     TRequestStatus stat = KRequestPending;
       
   865     server.Rendezvous(stat);
       
   866     if ( stat != KRequestPending )
       
   867         {
       
   868         server.Kill( 0 );       // abort startup
       
   869         }
       
   870     else
       
   871         {
       
   872         server.Resume();    // logon OK - start the server
       
   873         }
       
   874         
       
   875     User::WaitForRequest(stat);     // wait for start or death
       
   876 
       
   877     // we can't use the 'exit reason' if the server panicked as this
       
   878     // is the panic 'reason' and may be '0' which cannot be distinguished
       
   879     // from KErrNone
       
   880     if ( server.ExitType() == EExitPanic )
       
   881         {
       
   882         result = KErrGeneral;
       
   883         }
       
   884     else
       
   885         {
       
   886         result = stat.Int();
       
   887         }
       
   888     
       
   889     server.Close();   
       
   890     return result;
       
   891     }
       
   892 
       
   893 
       
   894 
       
   895 
       
   896 
       
   897