upnpframework/upnpaiwprovider/src/upnpaiwopenexternalservice.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Implementation of the UpnpAiwOpenExternalService
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <AiwMenu.h>
       
    20 #include <AiwCommon.hrh>
       
    21 #include <aknnotewrappers.h>
       
    22 #include "upnpaiwengine.h"
       
    23 #include "upnpaiwopenexternalservice.h"
       
    24 
       
    25 _LIT( KComponentLogfile, "upnpaiwprovider.log" );
       
    26 #include "upnplog.h"
       
    27 
       
    28 // --------------------------------------------------------------------------
       
    29 // CUPnPAiwOpenExternalService::NewL
       
    30 // NewL.
       
    31 // --------------------------------------------------------------------------
       
    32 CUPnPAiwOpenExternalService* CUPnPAiwOpenExternalService::NewL()
       
    33     {
       
    34     __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::NewL" );
       
    35 
       
    36     CUPnPAiwOpenExternalService* self = 
       
    37                 new (ELeave) CUPnPAiwOpenExternalService;
       
    38     CleanupStack::PushL( self );
       
    39 
       
    40     self->ConstructL();
       
    41 
       
    42     CleanupStack::Pop( self );
       
    43     return self;
       
    44     }
       
    45 
       
    46 // --------------------------------------------------------------------------
       
    47 // CUPnPAiwOpenExternalService::CUPnPAiwOpenExternalService
       
    48 // Constructor.
       
    49 // --------------------------------------------------------------------------
       
    50 CUPnPAiwOpenExternalService::CUPnPAiwOpenExternalService()
       
    51     {
       
    52     __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\
       
    53 CUPnPAiwOpenExternalService" );
       
    54     }
       
    55 
       
    56 // --------------------------------------------------------------------------
       
    57 // CUPnPAiwOpenExternalService::~CUPnPAiwOpenExternalService
       
    58 // Destructor.
       
    59 // --------------------------------------------------------------------------
       
    60 CUPnPAiwOpenExternalService::~CUPnPAiwOpenExternalService()
       
    61     {
       
    62     __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\
       
    63 ~CUPnPAiwOpenExternalService" );
       
    64 
       
    65     // Release the engine instance
       
    66     if( iEngine )
       
    67         {
       
    68         CUPnPAiwEngine::ReleaseInstance();
       
    69         iEngine = NULL;
       
    70         }
       
    71     }
       
    72 
       
    73 // --------------------------------------------------------------------------
       
    74 // CUPnPAiwOpenExternalService::ConstructL
       
    75 // Second phase constructor.
       
    76 // --------------------------------------------------------------------------
       
    77 void CUPnPAiwOpenExternalService::ConstructL()
       
    78     {
       
    79     __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\
       
    80 ConstructL" );
       
    81 
       
    82     // Create the engine
       
    83     iEngine = CUPnPAiwEngine::NewL();
       
    84     }
       
    85 
       
    86 // --------------------------------------------------------------------------
       
    87 // CUPnPAiwOpenExternalService::HandleServiceCmdL
       
    88 // AIW Framework's method for handling service commands
       
    89 // --------------------------------------------------------------------------
       
    90 void CUPnPAiwOpenExternalService::HandleServiceCmdL( 
       
    91                     const TInt& aCmdId,
       
    92                     const CAiwGenericParamList& /*aInParamList*/,
       
    93                     CAiwGenericParamList& aOutParamList,
       
    94                     TUint /*aCmdOptions*/,
       
    95                     const MAiwNotifyCallback* /*aCallback*/ )
       
    96     {
       
    97     // Process the command only if the id matches
       
    98     if( aCmdId == KAiwCmdUPnPOpen )
       
    99         {
       
   100         __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\
       
   101 HandleServiceCmdL" );
       
   102  
       
   103         TInt returnValue = KErrNone;
       
   104 
       
   105         if( iEngine )
       
   106             {
       
   107             TRAP( returnValue,
       
   108                   iEngine->OpenExternalMediaL() );
       
   109             }
       
   110         else
       
   111             {
       
   112             returnValue = KErrDied;
       
   113             __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService, \
       
   114 engine is dead!" );
       
   115             }
       
   116 
       
   117         // Add the return value on the out param list
       
   118         TAiwGenericParam statusParameter( 
       
   119                             EGenericParamError, 
       
   120                             returnValue );
       
   121         aOutParamList.AppendL( statusParameter );
       
   122         }
       
   123     }
       
   124 
       
   125 // End of file