diff -r 3785f754ee62 -r 5360b7ddc251 upnpframework/upnpcommand/src/upnpbrowsecommand.cpp --- a/upnpframework/upnpcommand/src/upnpbrowsecommand.cpp Fri Sep 17 08:31:21 2010 +0300 +++ b/upnpframework/upnpcommand/src/upnpbrowsecommand.cpp Mon Nov 01 12:37:49 2010 +0200 @@ -1,114 +1,115 @@ -/* -* Copyright (c) 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: Source file for CUpnpBrowseCommand class. -* -*/ - - -// INCLUDE FILES -#include // CUpnpBrowseCommand -#include "upnpcommand.h" // CUpnpCommand -#include "upnpcommandmain.h" // UpnpCommandMain::LoadL - -// -------------------------------------------------------------------------- -// CUpnpBrowseCommand::NewL -// Creates a new UpnpCommand for Upnp home network browsing purposes. -// -------------------------------------------------------------------------- -// -EXPORT_C CUpnpBrowseCommand* CUpnpBrowseCommand::NewL() - { - // Create new CUpnpBrowseCommand instance - CUpnpBrowseCommand* self = new (ELeave) CUpnpBrowseCommand(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUpnpBrowseCommand::CUpnpBrowseCommand -// Constructor -// -------------------------------------------------------------------------- -// -CUpnpBrowseCommand::CUpnpBrowseCommand() - { - // No implementation - } - -// -------------------------------------------------------------------------- -// CUpnpBrowseCommand::~CUpnpBrowseCommand -// Destructor -// -------------------------------------------------------------------------- -// -CUpnpBrowseCommand::~CUpnpBrowseCommand() - { - delete iCommand; - iCommand = NULL; - } - -// -------------------------------------------------------------------------- -// CUpnpBrowseCommand::ConstructL -// Second phase constructor -// -------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::ConstructL() - { - iCommand = UpnpCommandMain::LoadL( UpnpCommand::ECommandBrowse ); - } - -// -------------------------------------------------------------------------- -// CUpnpBrowseCommand::BrowseHomeNetworkL -// Allocates Upnp Framework resources, and initiates Upnp home network -// browsing. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUpnpBrowseCommand::BrowseHomeNetworkL() - { - // Allocate Upnp Framework resources - iCommand->AllocateResourcesL(); - - // Execute the command (Synchronous. Will not return until the user - // stops browsing) - TRAPD( executeError, iCommand->ExecuteL() ); - - // Release Upnp Framework resources - iCommand->ReleaseResources(); - - // Leave if operation failed - if( executeError != KErrNone ) - { - User::Leave( executeError ); - } - } - -// -------------------------------------------------------------------------- -// CUpnpBrowseCommand::IsAvailableL -// Returns the availability information of the command. -// -------------------------------------------------------------------------- -// -EXPORT_C TBool CUpnpBrowseCommand::IsAvailableL() - { - // create a temporary plugin instance - // then query command availability. - TBool available = EFalse; - TRAP_IGNORE( - CUpnpCommand* temp = UpnpCommandMain::LoadL( UpnpCommand::ECommandBrowse ); - CleanupStack::PushL( temp ); - available = temp->IsAvailableL(); - CleanupStack::PopAndDestroy( temp ); - ); - return available; - } - -// End of File +/* +* Copyright (c) 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: Source file for CUpnpBrowseCommand class. +* +*/ + + +// INCLUDE FILES +#include // CUpnpBrowseCommand +#include "upnpcommand.h" // CUpnpCommand +#include "upnpcommandmain.h" // UpnpCommandMain::LoadL + +// -------------------------------------------------------------------------- +// CUpnpBrowseCommand::NewL +// Creates a new UpnpCommand for Upnp home network browsing purposes. +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpBrowseCommand* CUpnpBrowseCommand::NewL() + { + // Create new CUpnpBrowseCommand instance + CUpnpBrowseCommand* self = new (ELeave) CUpnpBrowseCommand(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpBrowseCommand::CUpnpBrowseCommand +// Constructor +// -------------------------------------------------------------------------- +// +CUpnpBrowseCommand::CUpnpBrowseCommand() + { + // No implementation + } + +// -------------------------------------------------------------------------- +// CUpnpBrowseCommand::~CUpnpBrowseCommand +// Destructor +// -------------------------------------------------------------------------- +// +CUpnpBrowseCommand::~CUpnpBrowseCommand() + { + delete iCommand; + iCommand = NULL; + } + +// -------------------------------------------------------------------------- +// CUpnpBrowseCommand::ConstructL +// Second phase constructor +// -------------------------------------------------------------------------- +// +void CUpnpBrowseCommand::ConstructL() + { + iCommand = UpnpCommandMain::LoadL( UpnpCommand::ECommandBrowse ); + } + +// -------------------------------------------------------------------------- +// CUpnpBrowseCommand::BrowseHomeNetworkL +// Allocates Upnp Framework resources, and initiates Upnp home network +// browsing. +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpBrowseCommand::BrowseHomeNetworkL() + { + // Allocate Upnp Framework resources + iCommand->AllocateResourcesL(); + + // Execute the command (Synchronous. Will not return until the user + // stops browsing) + TRAPD( executeError, iCommand->ExecuteL() ); + + // Release Upnp Framework resources + iCommand->ReleaseResources(); + + // Leave if operation failed + if( executeError != KErrNone ) + { + User::Leave( executeError ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpBrowseCommand::IsAvailableL +// Returns the availability information of the command. +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CUpnpBrowseCommand::IsAvailableL() + { + // create a temporary plugin instance + // then query command availability. + TBool available = EFalse; + TRAP_IGNORE( + CUpnpCommand* temp = UpnpCommandMain::LoadL( + UpnpCommand::ECommandBrowse ); + CleanupStack::PushL( temp ); + available = temp->IsAvailableL(); + CleanupStack::PopAndDestroy( temp ); + ); + return available; + } + +// End of File