|
1 // Copyright (c) 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 // Provides the implementation to evaluate the condition on SwP |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @internalComponent |
|
20 */ |
|
21 |
|
22 #include "cndsystemwideproperty.h" |
|
23 #include <ssm/ssmsystemwideproperty.h> |
|
24 |
|
25 CCndSwp::CCndSwp(const TConditionCheckType aConditionCheckType, |
|
26 const TUint aKey, const TInt aCndValue): iConditionCheckType(aConditionCheckType), |
|
27 iKey(aKey), |
|
28 iCndValue(aCndValue) |
|
29 { |
|
30 |
|
31 } |
|
32 |
|
33 CCndSwp::~CCndSwp() |
|
34 { |
|
35 |
|
36 } |
|
37 |
|
38 CCndSwp* CCndSwp::NewL(const TConditionCheckType aConditionCheckType, |
|
39 const TUint aKey, const TInt aCndValue) |
|
40 { |
|
41 CCndSwp* self = new (ELeave)CCndSwp(aConditionCheckType,aKey, aCndValue); |
|
42 return self; |
|
43 } |
|
44 |
|
45 TBool CCndSwp::EvaluateL() const |
|
46 { |
|
47 TInt value = 0; |
|
48 |
|
49 RSsmSystemWideProperty property; |
|
50 User::LeaveIfError(property.Connect(iKey)); |
|
51 User::LeaveIfError(property.GetValue(value)); |
|
52 property.Close(); |
|
53 |
|
54 TBool retVal = EFalse; |
|
55 if (iConditionCheckType == ECompareValue) |
|
56 { |
|
57 retVal = (value == iCndValue); |
|
58 } |
|
59 else |
|
60 { |
|
61 retVal = ((value & iCndValue) == iCndValue); |
|
62 } |
|
63 return retVal; |
|
64 } |