sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "tupsproperty.h" sl@0: sl@0: sl@0: CUpsProperty* CUpsProperty::NewL(const TUid& aCategory) sl@0: { sl@0: CUpsProperty* self = new(ELeave) CUpsProperty(aCategory); sl@0: return self; sl@0: } sl@0: sl@0: CUpsProperty::CUpsProperty(const TUid& aCategory) sl@0: : iCategory(aCategory) sl@0: { sl@0: sl@0: } sl@0: sl@0: void CUpsProperty::GetL(TInt aInstanceNumber, TInt aPropertyKey, TType aType, TInt& aValue) sl@0: { sl@0: TInt key; sl@0: if (aType == EPolicyEvaluator) sl@0: { sl@0: key = GetPropertyKey(aPropertyKey, KPe_Start, KInstanceInterval, aInstanceNumber); sl@0: } sl@0: else sl@0: { sl@0: key = GetPropertyKey(aPropertyKey, KDc_Start, KInstanceInterval, aInstanceNumber); sl@0: } sl@0: User::LeaveIfError(RProperty::Get(iCategory, key, aValue)); sl@0: } sl@0: sl@0: void CUpsProperty::GetL(TInt aInstanceNumber, TInt aPropertyKey, TType aType, TDes& aValue) sl@0: { sl@0: TInt key; sl@0: if (aType == EPolicyEvaluator) sl@0: { sl@0: key = GetPropertyKey(aPropertyKey, KPe_Start, KInstanceInterval, aInstanceNumber); sl@0: } sl@0: else sl@0: { sl@0: key = GetPropertyKey(aPropertyKey, KDc_Start, KInstanceInterval, aInstanceNumber); sl@0: } sl@0: User::LeaveIfError(RProperty::Get(iCategory, key, aValue)); sl@0: } sl@0: sl@0: void CUpsProperty::SetL(TInt aInstanceNumber, TInt aPropertyKey, TType aType, TInt aValue) sl@0: { sl@0: TInt key; sl@0: if (aType == EPolicyEvaluator) sl@0: { sl@0: key = GetPropertyKey(aPropertyKey, KPe_Start, KInstanceInterval, aInstanceNumber); sl@0: } sl@0: else sl@0: { sl@0: key = GetPropertyKey(aPropertyKey, KDc_Start, KInstanceInterval, aInstanceNumber); sl@0: } sl@0: User::LeaveIfError(RProperty::Set(iCategory, key, aValue)); sl@0: } sl@0: sl@0: void CUpsProperty::SetL(TInt aInstanceNumber, TInt aPropertyKey, TType aType, TDes& aValue) sl@0: { sl@0: TInt key; sl@0: if (aType == EPolicyEvaluator) sl@0: { sl@0: key = GetPropertyKey(aPropertyKey, KPe_Start, KInstanceInterval, aInstanceNumber); sl@0: } sl@0: else sl@0: { sl@0: key = GetPropertyKey(aPropertyKey, KDc_Start, KInstanceInterval, aInstanceNumber); sl@0: } sl@0: User::LeaveIfError(RProperty::Set(iCategory, key, aValue)); sl@0: } sl@0: sl@0: TInt CUpsProperty::GetPropertyKey(TInt aPropertyKey, TInt aStart, TInt aInterval, TInt aInstanceNumber) sl@0: { sl@0: TInt actualKey = ((aInstanceNumber - 1) * aInterval) + aPropertyKey + aStart; sl@0: return actualKey; sl@0: }