diff -r 7d48bed6ce0c -r 987c9837762f convergedcallengine/csplugin/src/cspservicesettingshandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/convergedcallengine/csplugin/src/cspservicesettingshandler.cpp Wed Sep 01 12:15:03 2010 +0100 @@ -0,0 +1,138 @@ +/* +* 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: Contains the implementation of class CSPServiceSettingsHandler +* +*/ + + +// CLASS HEADER +#include "cspservicesettingshandler.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "csplogger.h" + + +_LIT(KLineNameVoice, "CS"); + + + +CSPServiceSettingsHandler* CSPServiceSettingsHandler::NewL( ) + { + CSPServiceSettingsHandler* self + = new ( ELeave ) CSPServiceSettingsHandler( ); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor of the object. +// --------------------------------------------------------------------------- +// +CSPServiceSettingsHandler::~CSPServiceSettingsHandler( ) + { + CSPLOGSTRING(CSPOBJECT, "CSPServiceSettingsHandler::~CSPServiceSettingsHandler()" ); + } + +// --------------------------------------------------------------------------- +// Finds service ID by name. +// --------------------------------------------------------------------------- +// +void CSPServiceSettingsHandler::FindByNameL( const TDesC& aName, + TUint32& aServiceId ) + { + CSPLOGSTRING(CSPINT, "CSPServiceSettingsHandler::FindByNameL()" ); + CSPLOGSTRING2(CSPINT, "CSPServiceSettingsHandler::FindByNameL() Name=%S", &aName ); + CSPSettings* settingsApi = CSPSettings::NewLC(); + RIdArray idArray; + CleanupClosePushL( idArray ); + TInt err = settingsApi->FindServiceIdsL( idArray ); + + TBool found = EFalse; + if ( KErrNone == err ) + { + TInt idCount = idArray.Count(); + if( idCount > 0 ) + { + + for ( TInt i = 0; !found && i < idCount; i++ ) + { + CSPEntry* entry = CSPEntry::NewLC(); + TInt ferr = settingsApi->FindEntryL( idArray[i], *entry ); + + if( ferr == KErrNone + && aName.Compare( entry->GetServiceName() ) == 0 ) + { + aServiceId = idArray[i]; + found = ETrue; + } + CleanupStack::PopAndDestroy( entry ); + } + } + else + { + err = KErrNotFound; + } + } + + if ( !found ) + { + err = KErrNotFound; + } + + CleanupStack::PopAndDestroy( &idArray ); + CleanupStack::PopAndDestroy( settingsApi ); + CSPLOGSTRING3(CSPINT, "CSProvider::FindByNameL() err = %d serv_id = %u", + err, aServiceId ); + User::LeaveIfError( err ); + } + + + +TInt CSPServiceSettingsHandler::ReadCSServiceId( TUint32& aServiceId ) + { + TRAPD( err, FindByNameL( KLineNameVoice, aServiceId ) ); + + if ( err ) + { + CSPLOGSTRING2(CSPINT, + "CSPServiceSettingsHandler::FindByNameL() leave %d", + err ); + } + return err; + } + +// --------------------------------------------------------------------------- +// Constructs the requester. +// --------------------------------------------------------------------------- +// +CSPServiceSettingsHandler::CSPServiceSettingsHandler( ) + { + CSPLOGSTRING(CSPOBJECT, "CSPServiceSettingsHandler::CSPServiceSettingsHandler()" ); + } + +// --------------------------------------------------------------------------- +// Constructs the requester in the second phase. +// --------------------------------------------------------------------------- +// +void CSPServiceSettingsHandler::ConstructL( ) + { + } + +