epoc32/include/mw/lbttriggerconditionarea.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     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
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Data class for the area trigger condition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef LBTTRIGGERCONDITIONAREA_H
       
    22 #define LBTTRIGGERCONDITIONAREA_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <lbttriggerconditionbase.h>
       
    26 
       
    27 class CLbtGeoAreaBase;
       
    28 
       
    29 /**
       
    30  *  Data class for the trigger condition based on the geographical area and movement
       
    31  *  of the terminal.
       
    32  *
       
    33  *  The trigger condition specifies where and when a location trigger shall be 
       
    34  *  fired.
       
    35  *
       
    36  *  Trigger area defines where the trigger shall be fired. It is a 
       
    37  *  geographical area. Currently, only geographical circular area
       
    38  *  is supported by the system. 
       
    39  *
       
    40  *  Direction of movement defines when the trigger shall be fired. It specifies
       
    41  *  if the trigger shall be fired wether the terminal enters or exits the trigger area.
       
    42  * 
       
    43  *  When a trigger has been fired, it will not be ready to be fired again until 
       
    44  *  the terminal has moved a certain distance ( "hysteresis distance" ) outside 
       
    45  *  of the trigger area. 
       
    46  *
       
    47  *  Hysteresis distance is defined by system and can't be accessed
       
    48  *  by client applications.
       
    49  *
       
    50  *  @lib lbt.lib
       
    51  *  @since S60 5.1
       
    52  */
       
    53 class CLbtTriggerConditionArea : public CLbtTriggerConditionBase
       
    54     {
       
    55 public:  // Data types
       
    56     /**
       
    57      *  Specifies in which direction the location trigger is fired.
       
    58      */
       
    59     enum TDirection
       
    60         {
       
    61         /** The trigger is fired when the terminal is entering the 
       
    62          * trigger area. 
       
    63          */
       
    64         EFireOnEnter = 1,
       
    65         /** The trigger is fired when the terminal is exiting the 
       
    66          * trigger area.
       
    67          */
       
    68         EFireOnExit  = 2 
       
    69         };
       
    70 
       
    71 public:  
       
    72     /**
       
    73      * Constructs a new instance of trigger condition class based
       
    74      * on the geographical area and movement of the terminal.
       
    75      *
       
    76      * @panic ELbtErrArgument If the input trigger area is a 
       
    77      * class of CLbtGeoRect.
       
    78      *
       
    79      * @param[in] aArea The trigger area. Only pointer to 
       
    80      * CLbtGeoCircle object is supported. Ownership is transferred
       
    81      * to the returned CLbtTriggerConditionArea object.
       
    82      * @param[in] aDirection The direction( enter/exit ) of when a 
       
    83      * trigger shall be fired. 
       
    84      * @return A new instance of trigger condition class.
       
    85      */
       
    86     IMPORT_C static CLbtTriggerConditionArea* NewL( 
       
    87         CLbtGeoAreaBase* aArea,
       
    88         TDirection aDirection );
       
    89 
       
    90     /**
       
    91      * Constructs a new instance of trigger condition class.
       
    92      *
       
    93      * If construction is successful, it returns s a pointer to the 
       
    94      * trigger condition object. The returned object has no 
       
    95      * trigger area set, and the direction is @p EFireOnEnter.
       
    96      *
       
    97      * @return A new instance of this class.
       
    98      */
       
    99     IMPORT_C static CLbtTriggerConditionArea* NewL();
       
   100 
       
   101     /**
       
   102      * Constructs a new instance of trigger condition class
       
   103      * and pushes it onto cleanup stack.
       
   104      *
       
   105      * If construction is successful, it returns s a pointer to the 
       
   106      * trigger condition object. The returned object has no 
       
   107      * trigger area set, and the direction is @p EFireOnEnter.
       
   108      *
       
   109      * @return A new instance of this class.
       
   110      */
       
   111     IMPORT_C static CLbtTriggerConditionArea* NewLC();
       
   112 
       
   113     /**
       
   114      * Returns CLbtTriggerConditionBase::ETriggerConditionArea.
       
   115      *
       
   116      * @return CLbtTriggerConditionBase::ETriggerConditionArea
       
   117      */
       
   118     virtual TType Type() const;
       
   119 
       
   120     /**
       
   121      * Destructor.
       
   122      */
       
   123     IMPORT_C virtual ~CLbtTriggerConditionArea();
       
   124 
       
   125 public: // Member functions
       
   126 
       
   127     /**
       
   128      * Gets the direction that defines when a trigger shall be fired.
       
   129      *
       
   130      * If no direction has been set for the trigger, it will return
       
   131      * @p EFireOnEnter.
       
   132      *
       
   133      * @return The direction that specified when a trigger shall be fired.
       
   134      */
       
   135     IMPORT_C TDirection Direction() const;
       
   136 
       
   137     /**
       
   138      * Sets the direction that defines when a trigger shall be fired.
       
   139      *
       
   140      * @param[in] aDirection The trigger direction. It defines when a trigger
       
   141      * shall be fired.
       
   142      */
       
   143     IMPORT_C void SetDirection( 
       
   144         TDirection aDirection );
       
   145 
       
   146     /**
       
   147      * Gets trigger area. 
       
   148      *
       
   149      * If the trigger area is not set before, NULL is returned.
       
   150      * Ownership of the returned trigger area is not transferred
       
   151      * to the client.
       
   152      *
       
   153      * @return Pointer to the trigger area. Ownership of returned
       
   154      * object is not transfered to the client.
       
   155      */
       
   156     IMPORT_C CLbtGeoAreaBase* TriggerArea() const;
       
   157 
       
   158     /**
       
   159      * Sets trigger area. 
       
   160      *
       
   161      * @panic ELbtErrArgument If the input trigger area is a 
       
   162      * class of CLbtGeoRect.
       
   163      * @param[in] aArea The trigger area. Only pointer to 
       
   164      * CLbtGeoCircle class is supported by current system. 
       
   165      * Ownership is transferred to this object.
       
   166      */
       
   167     IMPORT_C void SetTriggerArea( 
       
   168         CLbtGeoAreaBase* aArea );
       
   169         
       
   170     
       
   171 protected:
       
   172     /**
       
   173      * Externalize method that subclass must implement.
       
   174      * @param[in] aStream Stream to which the object should be externalized.
       
   175      */
       
   176 	virtual void DoExternalizeL(RWriteStream& aStream)const;
       
   177 	
       
   178 	/**
       
   179      * Internalize method that subclass must implement.
       
   180      * @param[in] aStream Stream from which the object should be internalized.
       
   181      */
       
   182 	virtual void DoInternalizeL(RReadStream& aStream);
       
   183 	
       
   184 	
       
   185 private:
       
   186     /**
       
   187      * Default constructor.
       
   188      *
       
   189      * Trigger area is set as NULL and default direction 
       
   190      * is @p EFireOnEnter.
       
   191      */
       
   192     CLbtTriggerConditionArea();
       
   193 
       
   194     /**
       
   195      *  Symbian 2nd phase constructor.
       
   196      */
       
   197     void ConstructL();
       
   198     
       
   199     /**
       
   200      *  Symbian 2nd phase constructor.
       
   201      */
       
   202     void ConstructL(CLbtGeoAreaBase* aArea,
       
   203         TDirection aDirection);  
       
   204     
       
   205     /**
       
   206      * By default, prohibit copy constructor
       
   207      */
       
   208     CLbtTriggerConditionArea( const CLbtTriggerConditionArea& );
       
   209     
       
   210     /**
       
   211      * Prohibit assigment operator
       
   212      */
       
   213     CLbtTriggerConditionArea& operator= ( const CLbtTriggerConditionArea& );
       
   214 
       
   215 
       
   216 private:// Data
       
   217     /**
       
   218      * Area
       
   219      */
       
   220     CLbtGeoAreaBase* iArea;
       
   221     
       
   222     /**
       
   223      * Direction
       
   224      */
       
   225     TDirection iDirection;
       
   226     
       
   227     /**
       
   228      * Reserved pointer for future extension
       
   229      */
       
   230     TAny* iReserved;
       
   231     };
       
   232 #endif // LBTTRIGGERCONDITIONAREA_H