|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : conditiononfeature.cpp |
|
15 // Part of : System Startup / Starter |
|
16 // Implementation of CConditionOnFeature class |
|
17 // Version : %version: 1 % |
|
18 // This material, including documentation and any related computer |
|
19 // programs, is protected by copyright controlled by Nokia. All |
|
20 // rights are reserved. Copying, including reproducing, storing, |
|
21 // adapting or translating, any or all of this material requires the |
|
22 // prior written consent of Nokia. This material also contains |
|
23 // confidential information which may not be disclosed to others |
|
24 // without the prior written consent of Nokia. |
|
25 // Template version: 4.1 |
|
26 // Nokia Core OS * |
|
27 // File renamed from conditiononfeature.cpp to cndfeature.cpp as part of Core OS transfer. |
|
28 // |
|
29 |
|
30 |
|
31 |
|
32 #include "cndfeature.h" |
|
33 #include <featmgr/featurecontrol.h> |
|
34 #include <featmgr/featmgr.h> |
|
35 |
|
36 CCndFeature::CCndFeature(const TConditionCheckType aConditionCheckType, const TInt aFeatureId, const TUint32 aCndValue) |
|
37 : iConditionCheckType( aConditionCheckType ), iFeatureId ( aFeatureId ), |
|
38 iCndValue( aCndValue ) |
|
39 { |
|
40 } |
|
41 |
|
42 CCndFeature* CCndFeature::NewL(const TConditionCheckType aConditionCheckType, const TInt aFeatureId) |
|
43 { |
|
44 const TUint nullFeatureData = 0; |
|
45 |
|
46 //Passing the condition value as 0 as it is only required while checking the feature data. |
|
47 return NewL(aConditionCheckType, aFeatureId, nullFeatureData); |
|
48 } |
|
49 |
|
50 CCndFeature* CCndFeature::NewL(const TConditionCheckType aConditionCheckType, const TInt aFeatureId, const TUint32 aCndValue) |
|
51 { |
|
52 CCndFeature* self = new (ELeave)CCndFeature(aConditionCheckType, aFeatureId, aCndValue); |
|
53 return self; |
|
54 } |
|
55 |
|
56 TBool CCndFeature::EvaluateL() const |
|
57 { |
|
58 RFeatureControl featureControl; |
|
59 User::LeaveIfError(featureControl.Open()); |
|
60 |
|
61 TUid featureUid = {iFeatureId}; |
|
62 TBool retVal = EFalse; |
|
63 TFeatureEntry featureEntry(featureUid); |
|
64 TInt result = featureControl.FeatureSupported(featureUid); |
|
65 |
|
66 if (KFeatureSupported == result) |
|
67 { |
|
68 if (ECompareFeatureData == iConditionCheckType) |
|
69 { |
|
70 if(iCndValue == featureEntry. FeatureData()) |
|
71 { |
|
72 retVal = ETrue; |
|
73 } |
|
74 } |
|
75 else |
|
76 { |
|
77 retVal = ETrue; |
|
78 } |
|
79 } |
|
80 |
|
81 featureControl.Close(); |
|
82 return retVal; |
|
83 } |
|
84 |
|
85 CCndFeature::~CCndFeature() |
|
86 { |
|
87 } |
|
88 |