diff -r 000000000000 -r 8c5d936e5675 profilesservices/ProfileEngine/EngSrc/ProfileEngUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/profilesservices/ProfileEngine/EngSrc/ProfileEngUtils.cpp Thu Dec 17 08:52:52 2009 +0200 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2002 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: Implemention of the ProfileEngUtils. +* +*/ + + + +// INCLUDE FILES +#include "ProfileEngUtils.h" +#include "CProfileEngineImpl.h" +#include "ProfileEngineConstants.h" +#include +#include +#include + +#include +#include +#include +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ProfileEngUtils::GetAlternateService +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void ProfileEngUtils::GetAlternateLineService( TInt& aValue ) + { + aValue = ESSSettingsAlsNotSupported; + RSSSettings settings; + + if( settings.Open() == KErrNone ) + { + // Get Alternate Line Service setting. Ignore errors because + // iAlternateLineService value ESSSettingsAlsNotSupported is also valid. + settings.Get( ESSSettingsAls, aValue ); + settings.Close(); + } + } + +// ----------------------------------------------------------------------------- +// ProfileEngUtils::IsAlternateLineSelected +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TBool ProfileEngUtils::IsAlternateLineSelected() + { + TInt als( ESSSettingsAlsNotSupported ); + GetAlternateLineService( als ); + return ( als == ESSSettingsAlsAlternate ); + } + +// ----------------------------------------------------------------------------- +// ProfileEngUtils::ResolveKey +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TUint32 ProfileEngUtils::ResolveKey( TUint aPartialKey, TInt aProfileId ) + { + return ( ( aProfileId << KProfileIdShift ) | aPartialKey ); + } + +// ----------------------------------------------------------------------------- +// ProfileEngUtils::GetBinarySettingL +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void ProfileEngUtils::GetBinarySettingL( CRepository& aCenRep, + TUint32 aId, + TDes8& aDes ) + { + aDes.Zero(); + User::LeaveIfError( aCenRep.Get( aId, aDes ) ); + const TInt KProEngEmptyBinSettingLength( 2 ); + const TInt KProEngZero( 0 ); + + if( ( aDes.Length() == KProEngEmptyBinSettingLength ) && + ( aDes[0] == KProEngZero && aDes[1] == KProEngZero ) ) + { + aDes.Zero(); + } + } + +// ----------------------------------------------------------------------------- +// ProfileEngUtils::FindValueFromBinaryKey +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt ProfileEngUtils::FindValueFromBinaryKeyL( CRepository& aCenRep, + TUint32 aCenRepKey, + TUint8 aValue ) + { + HBufC8* buf = HBufC8::NewLC( + NCentralRepositoryConstants::KMaxBinaryLength ); + TPtr8 ptr = buf->Des(); + ProfileEngUtils::GetBinarySettingL( aCenRep, aCenRepKey, ptr ); + + TInt result( KErrNotFound ); + TInt len( buf->Length() ); + for( TInt i( 0 ); iGet( KPsmCurrentMode, psm ) ); + CleanupStack::PopAndDestroy( cenrep ); + } + + if ( psm == EPsmsrvModePowerSave ) + { + return ETrue; + } +#endif + + return EFalse; + } + + +// End of File