diff -r 000000000000 -r 7f85d04be362 upnpframework/upnpaiwprovider/src/upnpaiwopenexternalservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnpaiwprovider/src/upnpaiwopenexternalservice.cpp Thu Dec 17 08:52:00 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the UpnpAiwOpenExternalService +* +*/ + + +#include +#include +#include +#include "upnpaiwengine.h" +#include "upnpaiwopenexternalservice.h" + +_LIT( KComponentLogfile, "upnpaiwprovider.log" ); +#include "upnplog.h" + +// -------------------------------------------------------------------------- +// CUPnPAiwOpenExternalService::NewL +// NewL. +// -------------------------------------------------------------------------- +CUPnPAiwOpenExternalService* CUPnPAiwOpenExternalService::NewL() + { + __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::NewL" ); + + CUPnPAiwOpenExternalService* self = + new (ELeave) CUPnPAiwOpenExternalService; + CleanupStack::PushL( self ); + + self->ConstructL(); + + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUPnPAiwOpenExternalService::CUPnPAiwOpenExternalService +// Constructor. +// -------------------------------------------------------------------------- +CUPnPAiwOpenExternalService::CUPnPAiwOpenExternalService() + { + __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\ +CUPnPAiwOpenExternalService" ); + } + +// -------------------------------------------------------------------------- +// CUPnPAiwOpenExternalService::~CUPnPAiwOpenExternalService +// Destructor. +// -------------------------------------------------------------------------- +CUPnPAiwOpenExternalService::~CUPnPAiwOpenExternalService() + { + __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\ +~CUPnPAiwOpenExternalService" ); + + // Release the engine instance + if( iEngine ) + { + CUPnPAiwEngine::ReleaseInstance(); + iEngine = NULL; + } + } + +// -------------------------------------------------------------------------- +// CUPnPAiwOpenExternalService::ConstructL +// Second phase constructor. +// -------------------------------------------------------------------------- +void CUPnPAiwOpenExternalService::ConstructL() + { + __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\ +ConstructL" ); + + // Create the engine + iEngine = CUPnPAiwEngine::NewL(); + } + +// -------------------------------------------------------------------------- +// CUPnPAiwOpenExternalService::HandleServiceCmdL +// AIW Framework's method for handling service commands +// -------------------------------------------------------------------------- +void CUPnPAiwOpenExternalService::HandleServiceCmdL( + const TInt& aCmdId, + const CAiwGenericParamList& /*aInParamList*/, + CAiwGenericParamList& aOutParamList, + TUint /*aCmdOptions*/, + const MAiwNotifyCallback* /*aCallback*/ ) + { + // Process the command only if the id matches + if( aCmdId == KAiwCmdUPnPOpen ) + { + __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\ +HandleServiceCmdL" ); + + TInt returnValue = KErrNone; + + if( iEngine ) + { + TRAP( returnValue, + iEngine->OpenExternalMediaL() ); + } + else + { + returnValue = KErrDied; + __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService, \ +engine is dead!" ); + } + + // Add the return value on the out param list + TAiwGenericParam statusParameter( + EGenericParamError, + returnValue ); + aOutParamList.AppendL( statusParameter ); + } + } + +// End of file