First public contribution.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
24 #include <e32property.h>
25 #include <numberconversion.h>
26 #include "tupsproperty.h"
29 CUpsProperty* CUpsProperty::NewL(const TUid& aCategory)
31 CUpsProperty* self = new(ELeave) CUpsProperty(aCategory);
35 CUpsProperty::CUpsProperty(const TUid& aCategory)
36 : iCategory(aCategory)
41 void CUpsProperty::GetL(TInt aInstanceNumber, TInt aPropertyKey, TType aType, TInt& aValue)
44 if (aType == EPolicyEvaluator)
46 key = GetPropertyKey(aPropertyKey, KPe_Start, KInstanceInterval, aInstanceNumber);
50 key = GetPropertyKey(aPropertyKey, KDc_Start, KInstanceInterval, aInstanceNumber);
52 User::LeaveIfError(RProperty::Get(iCategory, key, aValue));
55 void CUpsProperty::GetL(TInt aInstanceNumber, TInt aPropertyKey, TType aType, TDes& aValue)
58 if (aType == EPolicyEvaluator)
60 key = GetPropertyKey(aPropertyKey, KPe_Start, KInstanceInterval, aInstanceNumber);
64 key = GetPropertyKey(aPropertyKey, KDc_Start, KInstanceInterval, aInstanceNumber);
66 User::LeaveIfError(RProperty::Get(iCategory, key, aValue));
69 void CUpsProperty::SetL(TInt aInstanceNumber, TInt aPropertyKey, TType aType, TInt aValue)
72 if (aType == EPolicyEvaluator)
74 key = GetPropertyKey(aPropertyKey, KPe_Start, KInstanceInterval, aInstanceNumber);
78 key = GetPropertyKey(aPropertyKey, KDc_Start, KInstanceInterval, aInstanceNumber);
80 User::LeaveIfError(RProperty::Set(iCategory, key, aValue));
83 void CUpsProperty::SetL(TInt aInstanceNumber, TInt aPropertyKey, TType aType, TDes& aValue)
86 if (aType == EPolicyEvaluator)
88 key = GetPropertyKey(aPropertyKey, KPe_Start, KInstanceInterval, aInstanceNumber);
92 key = GetPropertyKey(aPropertyKey, KDc_Start, KInstanceInterval, aInstanceNumber);
94 User::LeaveIfError(RProperty::Set(iCategory, key, aValue));
97 TInt CUpsProperty::GetPropertyKey(TInt aPropertyKey, TInt aStart, TInt aInterval, TInt aInstanceNumber)
99 TInt actualKey = ((aInstanceNumber - 1) * aInterval) + aPropertyKey + aStart;