sysstatemgmt/systemstateplugins/conditionevaluator/src/cndsystemwideproperty.cpp
branchRCL_3
changeset 22 8cb079868133
parent 21 ccb4f6b3db21
equal deleted inserted replaced
21:ccb4f6b3db21 22:8cb079868133
     1 // Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 
    17 
    18 /**
    18 /**
    19  @internalComponent
    19  @internalComponent
    20 */
    20 */
    21 
    21 
    22 #include "ssmdebug.h"
       
    23 #include "cndsystemwideproperty.h"
    22 #include "cndsystemwideproperty.h"
    24 #include <ssm/ssmsystemwideproperty.h>
    23 #include <ssm/ssmsystemwideproperty.h>
    25 
    24 
    26 CCndSwp::CCndSwp(const TConditionCheckType aConditionCheckType,
    25 CCndSwp::CCndSwp(const TConditionCheckType aConditionCheckType,
    27         			const TUint aKey, const TInt aCndValue): iConditionCheckType(aConditionCheckType),
    26         			const TUint aKey, const TInt aCndValue): iConditionCheckType(aConditionCheckType),
    47     {
    46     {
    48     TInt value = 0;
    47     TInt value = 0;
    49   
    48   
    50     RSsmSystemWideProperty property;
    49     RSsmSystemWideProperty property;
    51 	User::LeaveIfError(property.Connect(iKey));
    50 	User::LeaveIfError(property.Connect(iKey));
    52 	CleanupClosePushL(property);
    51 	User::LeaveIfError(property.GetValue(value));
    53 
    52 	property.Close();
    54 	SSMLOGLEAVEIFERROR(property.GetValue(value));
       
    55 	
    53 	
    56     TBool retVal = EFalse;
    54     TBool retVal = EFalse;
    57     if (iConditionCheckType == ECompareValue)
    55     if (iConditionCheckType == ECompareValue)
    58         {
    56         {
    59         retVal = (value == iCndValue);
    57         retVal = (value == iCndValue);
    60         }
    58         }
    61     else
    59     else
    62         {
    60         {
    63         retVal = ((value & iCndValue) == iCndValue);
    61         retVal = ((value & iCndValue) == iCndValue);
    64         }
    62         }
    65 
       
    66 	CleanupStack::PopAndDestroy(&property);
       
    67     return retVal;
    63     return retVal;
    68     }
    64     }