sysstatemgmt/systemstateplugins/conditionevaluator/src/cndpublishsubscribe.cpp
changeset 0 4e1aa6a622a0
child 7 1a73e8f1b64d
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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        : conditiononpubsub.cpp
       
    15 // Part of     : System Startup / Condition
       
    16 // Implementation of CConditionOnPubSub and CConditionOnPubSubFlag
       
    17 // classes
       
    18 // Version     : %version: 1 %
       
    19 // This material, including documentation and any related computer
       
    20 // programs, is protected by copyright controlled by Nokia.  All
       
    21 // rights are reserved.  Copying, including reproducing, storing,
       
    22 // adapting or translating, any or all of this material requires the
       
    23 // prior written consent of Nokia.  This material also contains
       
    24 // confidential information which may not be disclosed to others
       
    25 // without the prior written consent of Nokia.
       
    26 // Template version: 4.1
       
    27 // Nokia Core OS *
       
    28 // File renamed from conditiononpubsub.cpp to cndpublishsubscribe.cpp as part of Core OS transfer.
       
    29 //
       
    30 
       
    31 
       
    32 
       
    33 #include "cndpublishsubscribe.h"
       
    34 #include <e32property.h> 
       
    35 
       
    36 CCndPublishSubscribe::CCndPublishSubscribe(const TConditionCheckType aConditionCheckType, const TInt aCategory,
       
    37         			const TUint aKey, const TInt aCndValue): iConditionCheckType(aConditionCheckType),
       
    38         		    iCategory(aCategory),
       
    39         		    iKey(aKey),
       
    40         		    iCndValue(aCndValue)
       
    41 	{
       
    42 
       
    43 	}
       
    44 
       
    45 CCndPublishSubscribe::~CCndPublishSubscribe()
       
    46 	{
       
    47 	
       
    48 	}
       
    49 
       
    50 CCndPublishSubscribe* CCndPublishSubscribe::NewL(const TConditionCheckType aConditionCheckType,
       
    51 								const TInt aCategory, const TUint aKey, const TInt aCndValue)
       
    52 	{
       
    53 	CCndPublishSubscribe* self = new (ELeave)CCndPublishSubscribe(aConditionCheckType,
       
    54 																aCategory, aKey, aCndValue);
       
    55 	return self;
       
    56 	}
       
    57 
       
    58 TBool CCndPublishSubscribe::EvaluateL() const
       
    59     {
       
    60     TInt value = 0;
       
    61     User::LeaveIfError(RProperty::Get(TUid::Uid(iCategory), iKey, value));
       
    62     TBool retVal = EFalse;
       
    63     if (iConditionCheckType == ECompareValue)
       
    64         {
       
    65         retVal = (value == iCndValue);
       
    66         }
       
    67     else
       
    68         {
       
    69         retVal = ((value & iCndValue) == iCndValue);
       
    70         }
       
    71     return retVal;
       
    72     }