williamr@2: /* williamr@2: * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Channel condition set object williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef SENSRVCHANNELCONDITIONSET_H williamr@2: #define SENSRVCHANNELCONDITIONSET_H williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: williamr@2: class CSensrvChannelConditionSet; williamr@2: williamr@2: // DATA TYPES williamr@2: williamr@2: /** williamr@2: * RPointerArray based channel condition set list williamr@2: */ williamr@2: typedef RPointerArray RSensrvChannelConditionSetList; williamr@2: williamr@2: /** williamr@2: * Logical operator to be used in a condition set. williamr@2: * williamr@2: * @see CSensrvChannelConditionSet williamr@2: */ williamr@2: enum TSensrvConditionSetType williamr@2: { williamr@2: /** OR-operator for a channel condition set */ williamr@2: ESensrvOrConditionSet = 0, williamr@2: /** AND-operator for a channel condtion set */ williamr@2: ESensrvAndConditionSet williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * CSensrvChannelConditionSet represents a set of conditions. A condition set is a container for one williamr@2: * or more conditions. williamr@2: * williamr@2: * The data type of the value contained in each Condition, in a Condition Set, must have the same data type williamr@2: * as the data for the channel to which it is added. By default this should be a packaged data object of williamr@2: * the channel. See the channel specific headers in \epoc32\include\sensors\channels. If the channel type williamr@2: * requires a different type of value, that must be indicated clearly in the channel specific header williamr@2: * defining the channel. williamr@2: * williamr@2: * The channel condition set combines channel conditions with either an AND-operator or an OR-operator. In williamr@2: * an AND-set, all conditions need to be met by single data item before a condition set is met. In an williamr@2: * OR-set, a single condition in the set needs to be met before a condition set is met. Certain condition williamr@2: * types (range conditions) require two condition objects (upper and lower limit) in a condition set for williamr@2: * the set to be valid. williamr@2: * williamr@2: * The pair of conditions must both have the same index in the condition set and they are considered a williamr@2: * single channel condition. williamr@2: * williamr@2: * @see CSensrvChannelCondition williamr@2: * @lib sensrvutil.lib williamr@2: * @since S60 5.0 williamr@2: */ williamr@2: NONSHARABLE_CLASS( CSensrvChannelConditionSet ): public CBase williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Two-phase constructor williamr@2: * williamr@2: * @since S60 5.0 williamr@2: * @param aConditionSetType Defines logical operator to be used for the condition set. williamr@2: * @return Pointer to created object williamr@2: * @leave KErrNoMemory williamr@2: * @leave One of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C static CSensrvChannelConditionSet* NewL williamr@2: ( TSensrvConditionSetType aConditionSetType ); williamr@2: williamr@2: /** williamr@2: * Two-phase constructor williamr@2: * williamr@2: * @since S60 5.0 williamr@2: * @param aConditionSetType Defines logical operator to be used for the condition set. williamr@2: * @return Pointer to created object williamr@2: * @leave KErrNoMemory williamr@2: * @leave One of the system-wide error codes williamr@2: */ williamr@2: IMPORT_C static CSensrvChannelConditionSet* NewLC williamr@2: ( TSensrvConditionSetType aConditionSetType ); williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Get condition set type. williamr@2: * williamr@2: * @return Type of the condition set williamr@2: */ williamr@2: virtual TSensrvConditionSetType ConditionSetType() const = 0; williamr@2: williamr@2: /** williamr@2: * Adds a channel condition to the condition set. Ownership of the CSensrvChannelCondition williamr@2: * is transferred to the CSensrvChannelConditionSet. The channel condition is deleted when williamr@2: * this condition set is destroyed. williamr@2: * williamr@2: * Single conditions added to the Condition Set using this operation must each have a williamr@2: * different item index. Range conditions must have the same item index and they must also williamr@2: * have complimentary parts. When the second part of a range condition is added, i.e. the williamr@2: * condition has the same item index as a condition already in the set, it is checked to williamr@2: * ensure it is the complimentary partner of the already added part. If it is not williamr@2: * complimentary then the operation will leave with KErrArgument. The conditions at each williamr@2: * different index whether single or range is considered an individua condition. williamr@2: * williamr@2: * Individual conditions do not need to have contiguous index values. williamr@2: * williamr@2: * @since S60 5.0 williamr@2: * @param aChannelCondition Channel condition to be added williamr@2: * @leave KErrArgument If the condition is NULL, there is already a condition for the same index williamr@2: * in this set and the new condition is not a complementary part of range condition for that williamr@2: * existing condition. williamr@2: * @leave One of the system-wide error codes williamr@2: * @see CSensrvChannelCondition williamr@2: */ williamr@2: virtual void AddChannelConditionL williamr@2: ( CSensrvChannelCondition* aChannelCondition ) = 0; williamr@2: williamr@2: /** williamr@2: * Get all channel conditions in this condition set. Conditions with the same index (range conditions) williamr@2: * are always in sequential slots in the returned array. Otherwise, conditions are in the order they williamr@2: * were added. williamr@2: * williamr@2: * @since S60 5.0 williamr@2: * @return Reference to a list of condition pointers williamr@2: */ williamr@2: virtual const RSensrvChannelConditionList& AllConditions() const = 0; williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Default constructor. williamr@2: */ williamr@2: CSensrvChannelConditionSet(); williamr@2: }; williamr@2: williamr@2: williamr@2: #endif //SENSRVCHANNELCONDITIONSET_H williamr@2: williamr@2: // End of File williamr@2: williamr@2: