00001 /* 00002 * ============================================================================== 00003 * Name : sensrvchannelcondition.h 00004 * Interface : Sensor Channel API 00005 * Description : Channel condition object 00006 * Version : %version: 2.1.1 % 00007 * 00008 * Copyright © 2008 Nokia. All rights reserved. 00009 * This material, including documentation and any related computer 00010 * programs, is protected by copyright controlled by Nokia. All 00011 * rights are reserved. Copying, including reproducing, storing, 00012 * adapting or translating, any or all of this material requires the 00013 * prior written consent of Nokia. This material also contains 00014 * confidential information which may not be disclosed to others 00015 * without the prior written consent of Nokia. 00016 * ============================================================================ 00017 * Template version: 4.1 00018 */ 00019 00020 00021 #ifndef SENSRVCHANNELCONDITION_H 00022 #define SENSRVCHANNELCONDITION_H 00023 00024 // INCLUDES 00025 #include <e32base.h> 00026 00027 // FORWARD DECLARATIONS 00028 00029 class CSensrvChannelCondition; 00030 00031 // DATA TYPES 00032 00036 typedef RPointerArray<CSensrvChannelCondition> RSensrvChannelConditionList; 00037 00062 enum TSensrvConditionType 00063 { 00065 ESensrvSingleLimitCondition = 0, 00067 ESensrvRangeConditionLowerLimit, 00069 ESensrvRangeConditionUpperLimit, 00071 ESensrvBinaryCondition 00072 }; 00073 00074 /* 00075 * Defines condition operator 00076 * 00077 * For a range condition a ConditionSet must contain 2 Conditions each with an operator in a 00078 * different direction. i.e. There must be matching greater than and less than pair. Also the pair 00079 * of conditions must have the same index in the ConditionSet. 00080 * 00081 * - ESensrvOperatorEquals checks if the value got from the sensor is equal to the set value. This is 00082 * not a valid operator for a range condition. 00083 * - ESensrvOperatorGreaterThan checks if the value got from the sensor is greater than the set limit. 00084 * This is not a valid operator for a binary condition. 00085 * - ESensrvOperatorGreaterThanOrEquals checks if the value got from the sensor is greater than or equal 00086 * to the set limit. This is not a valid operator for a binary condition. 00087 * - ESensrvOperatorLessThan checks if the value got from the sensor is less than the set limit. This is 00088 * not a valid operator for a binary condition. 00089 * - ESensrvOperatorLessThanOrEquals checks if the value got from the sensor is less than or equal to the 00090 * set limit. This is not a valid operator for a binary condition. 00091 * - ESensrvOperatorBinaryAnd checks if a bitmask data value got from the sensor has set at least one of 00092 * the bits set in the condition value. In other words, if result of datavalue & conditionvalue != 0, 00093 * there is a match. This is not a valid operator for a single limit or range conditions. 00094 * 00095 * Example: 00096 * Condition value: 01101101 00097 * Data value: 10001010 00098 * Resulting value: 00001000 -> Non-zero, which indicates a match. 00099 * - ESensrvOperatorBinaryAll checks if a bitmask data value got from the sensor has set all of the bits 00100 * set in the condition value. The rest of the data value bits are ignored. In other words, if 00101 * datavalue & conditionvalue == conditionvalue, there is a match. Not a valid operator for a single limit 00102 * or range conditions. 00103 * Example: 00104 * Condition value: 01101101 00105 * Data value: 10001010 00106 * Resulting value: 00001000 -> Not equal to condition value -> Not a match. 00107 * 00108 * @see CSensrvChannelCondition 00109 * @see TSensrvConditionType 00110 */ 00111 enum TSensrvConditionOperator 00112 { 00113 ESensrvOperatorEquals = 0, 00114 ESensrvOperatorGreaterThan, 00115 ESensrvOperatorGreaterThanOrEquals, 00116 ESensrvOperatorLessThan, 00117 ESensrvOperatorLessThanOrEquals, 00118 ESensrvOperatorBinaryAnd, 00119 ESensrvOperatorBinaryAll 00120 }; 00121 00122 // CLASS DECLARATION 00123 00145 NONSHARABLE_CLASS( CSensrvChannelCondition ): public CBase 00146 { 00147 public: 00162 IMPORT_C static CSensrvChannelCondition* NewL 00163 ( TInt aConditionType, 00164 TInt aConditionOperator, 00165 TInt aItemIndex, 00166 TDesC8& aValue ); 00167 00182 IMPORT_C static CSensrvChannelCondition* NewLC 00183 ( TInt aConditionType, 00184 TInt aConditionOperator, 00185 TInt aItemIndex, 00186 TDesC8& aValue ); 00187 public: 00188 00194 virtual TInt ConditionType() const = 0; 00195 00201 virtual TInt ConditionOperator() const = 0; 00202 00208 virtual TInt ConditionItemIndex() const = 0; 00209 00216 virtual TInt GetConditionValue( TDes8& aValue ) const = 0; 00217 00223 virtual const TDesC8& ConditionValue() const = 0; 00224 00225 public: 00229 CSensrvChannelCondition(); 00230 }; 00231 00232 #endif //SENSRVCHANNELCONDITION_H 00233 00234 // End of File 00235 00236