epoc32/include/sensrvchannelconditionset.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Channel condition set object
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef SENSRVCHANNELCONDITIONSET_H
williamr@2
    20
#define SENSRVCHANNELCONDITIONSET_H
williamr@2
    21
williamr@2
    22
#include <e32base.h>
williamr@2
    23
#include <sensrvchannelcondition.h>
williamr@2
    24
williamr@2
    25
// FORWARD DECLARATIONS
williamr@2
    26
williamr@2
    27
class CSensrvChannelConditionSet;
williamr@2
    28
williamr@2
    29
// DATA TYPES
williamr@2
    30
williamr@2
    31
/**
williamr@2
    32
* RPointerArray based channel condition set list
williamr@2
    33
*/
williamr@2
    34
typedef RPointerArray<CSensrvChannelConditionSet> RSensrvChannelConditionSetList;
williamr@2
    35
williamr@2
    36
/**
williamr@2
    37
* Logical operator to be used in a condition set.
williamr@2
    38
* 
williamr@2
    39
* @see CSensrvChannelConditionSet
williamr@2
    40
*/
williamr@2
    41
enum TSensrvConditionSetType
williamr@2
    42
{
williamr@2
    43
    /** OR-operator for a channel condition set */
williamr@2
    44
    ESensrvOrConditionSet = 0,
williamr@2
    45
    /** AND-operator for a channel condtion set */
williamr@2
    46
    ESensrvAndConditionSet 
williamr@2
    47
};
williamr@2
    48
williamr@2
    49
williamr@2
    50
/**
williamr@2
    51
* CSensrvChannelConditionSet represents a set of conditions. A condition set is a container for one
williamr@2
    52
* or more conditions.
williamr@2
    53
* 
williamr@2
    54
* The data type of the value contained in each Condition, in a Condition Set, must have the same data type
williamr@2
    55
* as the data for the channel to which it is added. By default this should be a packaged data object of
williamr@2
    56
* the channel. See the channel specific headers in \epoc32\include\sensors\channels. If the channel type
williamr@2
    57
* requires a different type of value, that must be indicated clearly in the channel specific header
williamr@2
    58
* defining the channel.
williamr@2
    59
* 
williamr@2
    60
* The channel condition set combines channel conditions with either an AND-operator or an OR-operator. In
williamr@2
    61
* an AND-set, all conditions need to be met by single data item before a condition set is met. In an
williamr@2
    62
* OR-set, a single condition in the set needs to be met before a condition set is met. Certain condition
williamr@2
    63
* types (range conditions) require two condition objects (upper and lower limit) in a condition set for
williamr@2
    64
* the set to be valid.
williamr@2
    65
* 
williamr@2
    66
* The pair of conditions must both have the same index in the condition set and they are considered a
williamr@2
    67
* single channel condition.
williamr@2
    68
*
williamr@2
    69
* @see CSensrvChannelCondition
williamr@2
    70
* @lib sensrvutil.lib
williamr@2
    71
* @since S60 5.0
williamr@2
    72
*/
williamr@2
    73
NONSHARABLE_CLASS( CSensrvChannelConditionSet ): public CBase
williamr@2
    74
    {
williamr@2
    75
public:
williamr@2
    76
    /**
williamr@2
    77
    * Two-phase constructor
williamr@2
    78
    * 
williamr@2
    79
    * @since S60 5.0
williamr@2
    80
    * @param  aConditionSetType Defines logical operator to be used for the condition set.
williamr@2
    81
    * @return Pointer to created object
williamr@2
    82
    * @leave  KErrNoMemory
williamr@2
    83
    * @leave  One of the system-wide error codes  
williamr@2
    84
    */  
williamr@2
    85
    IMPORT_C static CSensrvChannelConditionSet* NewL
williamr@2
    86
                ( TSensrvConditionSetType aConditionSetType );
williamr@2
    87
williamr@2
    88
    /**
williamr@2
    89
    * Two-phase constructor
williamr@2
    90
    * 
williamr@2
    91
    * @since S60 5.0
williamr@2
    92
    * @param  aConditionSetType Defines logical operator to be used for the condition set.
williamr@2
    93
    * @return Pointer to created object
williamr@2
    94
    * @leave  KErrNoMemory
williamr@2
    95
    * @leave  One of the system-wide error codes
williamr@2
    96
    */  
williamr@2
    97
    IMPORT_C static CSensrvChannelConditionSet* NewLC
williamr@2
    98
                ( TSensrvConditionSetType aConditionSetType );
williamr@2
    99
    
williamr@2
   100
public:
williamr@2
   101
  
williamr@2
   102
    /**
williamr@2
   103
    * Get condition set type.
williamr@2
   104
    * 
williamr@2
   105
    * @return Type of the condition set
williamr@2
   106
    */    
williamr@2
   107
    virtual TSensrvConditionSetType ConditionSetType() const = 0;
williamr@2
   108
williamr@2
   109
    /**
williamr@2
   110
    * Adds a channel condition to the condition set. Ownership of the CSensrvChannelCondition
williamr@2
   111
    * is transferred to the CSensrvChannelConditionSet. The channel condition is deleted when
williamr@2
   112
    * this condition set is destroyed.
williamr@2
   113
    * 
williamr@2
   114
    * Single conditions added to the Condition Set using this operation must each have a
williamr@2
   115
    * different item index. Range conditions must have the same item index and they must also
williamr@2
   116
    * have complimentary parts. When the second part of a range condition is added, i.e. the
williamr@2
   117
    * condition has the same item index as a condition already in the set, it is checked to
williamr@2
   118
    * ensure it is the complimentary partner of the already added part. If it is not
williamr@2
   119
    * complimentary then the operation will leave with KErrArgument. The conditions at each
williamr@2
   120
    * different index whether single or range is considered an individua condition.  
williamr@2
   121
    * 
williamr@2
   122
    * Individual conditions do not need to have contiguous index values.  
williamr@2
   123
    * 
williamr@2
   124
    * @since S60 5.0
williamr@2
   125
    * @param  aChannelCondition Channel condition to be added
williamr@2
   126
    * @leave  KErrArgument If the condition is NULL, there is already a condition for the same index
williamr@2
   127
    *         in this set and the new condition is not a complementary part of range condition for that
williamr@2
   128
    *         existing condition.
williamr@2
   129
    * @leave  One of the system-wide error codes
williamr@2
   130
    * @see CSensrvChannelCondition    
williamr@2
   131
    */  
williamr@2
   132
    virtual void AddChannelConditionL
williamr@2
   133
            ( CSensrvChannelCondition* aChannelCondition ) = 0;
williamr@2
   134
williamr@2
   135
    /**
williamr@2
   136
    * Get all channel conditions in this condition set. Conditions with the same index (range conditions)
williamr@2
   137
    * are always in sequential slots in the returned array. Otherwise, conditions are in the order they
williamr@2
   138
    * were added.
williamr@2
   139
    * 
williamr@2
   140
    * @since S60 5.0
williamr@2
   141
    * @return Reference to a list of condition pointers
williamr@2
   142
    */
williamr@2
   143
    virtual const RSensrvChannelConditionList& AllConditions() const = 0;
williamr@2
   144
williamr@2
   145
public:
williamr@2
   146
    /**
williamr@2
   147
    * Default constructor. 
williamr@2
   148
    */
williamr@2
   149
    CSensrvChannelConditionSet();
williamr@2
   150
    };
williamr@2
   151
williamr@2
   152
williamr@2
   153
#endif //SENSRVCHANNELCONDITIONSET_H
williamr@2
   154
williamr@2
   155
// End of File
williamr@2
   156
williamr@2
   157