williamr@2: /* williamr@2: * Copyright (c) 2006 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: Data class for the area trigger condition. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #ifndef LBTTRIGGERCONDITIONAREA_H williamr@2: #define LBTTRIGGERCONDITIONAREA_H williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: class CLbtGeoAreaBase; williamr@2: williamr@2: /** williamr@2: * Data class for the trigger condition based on the geographical area and movement williamr@2: * of the terminal. williamr@2: * williamr@2: * The trigger condition specifies where and when a location trigger shall be williamr@2: * fired. williamr@2: * williamr@2: * Trigger area defines where the trigger shall be fired. It is a williamr@2: * geographical area. Currently, only geographical circular area williamr@2: * is supported by the system. williamr@2: * williamr@2: * Direction of movement defines when the trigger shall be fired. It specifies williamr@2: * if the trigger shall be fired wether the terminal enters or exits the trigger area. williamr@2: * williamr@2: * When a trigger has been fired, it will not be ready to be fired again until williamr@2: * the terminal has moved a certain distance ( "hysteresis distance" ) outside williamr@2: * of the trigger area. williamr@2: * williamr@2: * Hysteresis distance is defined by system and can't be accessed williamr@2: * by client applications. williamr@2: * williamr@2: * @lib lbt.lib williamr@2: * @since S60 5.1 williamr@2: */ williamr@2: class CLbtTriggerConditionArea : public CLbtTriggerConditionBase williamr@2: { williamr@2: public: // Data types williamr@2: /** williamr@2: * Specifies in which direction the location trigger is fired. williamr@2: */ williamr@2: enum TDirection williamr@2: { williamr@2: /** The trigger is fired when the terminal is entering the williamr@2: * trigger area. williamr@2: */ williamr@2: EFireOnEnter = 1, williamr@2: /** The trigger is fired when the terminal is exiting the williamr@2: * trigger area. williamr@2: */ williamr@2: EFireOnExit = 2 williamr@2: }; williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Constructs a new instance of trigger condition class based williamr@2: * on the geographical area and movement of the terminal. williamr@2: * williamr@2: * @panic ELbtErrArgument If the input trigger area is a williamr@2: * class of CLbtGeoRect. williamr@2: * williamr@2: * @param[in] aArea The trigger area. Only pointer to williamr@2: * CLbtGeoCircle object is supported. Ownership is transferred williamr@2: * to the returned CLbtTriggerConditionArea object. williamr@2: * @param[in] aDirection The direction( enter/exit ) of when a williamr@2: * trigger shall be fired. williamr@2: * @return A new instance of trigger condition class. williamr@2: */ williamr@2: IMPORT_C static CLbtTriggerConditionArea* NewL( williamr@2: CLbtGeoAreaBase* aArea, williamr@2: TDirection aDirection ); williamr@2: williamr@2: /** williamr@2: * Constructs a new instance of trigger condition class. williamr@2: * williamr@2: * If construction is successful, it returns s a pointer to the williamr@2: * trigger condition object. The returned object has no williamr@2: * trigger area set, and the direction is @p EFireOnEnter. williamr@2: * williamr@2: * @return A new instance of this class. williamr@2: */ williamr@2: IMPORT_C static CLbtTriggerConditionArea* NewL(); williamr@2: williamr@2: /** williamr@2: * Constructs a new instance of trigger condition class williamr@2: * and pushes it onto cleanup stack. williamr@2: * williamr@2: * If construction is successful, it returns s a pointer to the williamr@2: * trigger condition object. The returned object has no williamr@2: * trigger area set, and the direction is @p EFireOnEnter. williamr@2: * williamr@2: * @return A new instance of this class. williamr@2: */ williamr@2: IMPORT_C static CLbtTriggerConditionArea* NewLC(); williamr@2: williamr@2: /** williamr@2: * Returns CLbtTriggerConditionBase::ETriggerConditionArea. williamr@2: * williamr@2: * @return CLbtTriggerConditionBase::ETriggerConditionArea williamr@2: */ williamr@2: virtual TType Type() const; williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C virtual ~CLbtTriggerConditionArea(); williamr@2: williamr@2: public: // Member functions williamr@2: williamr@2: /** williamr@2: * Gets the direction that defines when a trigger shall be fired. williamr@2: * williamr@2: * If no direction has been set for the trigger, it will return williamr@2: * @p EFireOnEnter. williamr@2: * williamr@2: * @return The direction that specified when a trigger shall be fired. williamr@2: */ williamr@2: IMPORT_C TDirection Direction() const; williamr@2: williamr@2: /** williamr@2: * Sets the direction that defines when a trigger shall be fired. williamr@2: * williamr@2: * @param[in] aDirection The trigger direction. It defines when a trigger williamr@2: * shall be fired. williamr@2: */ williamr@2: IMPORT_C void SetDirection( williamr@2: TDirection aDirection ); williamr@2: williamr@2: /** williamr@2: * Gets trigger area. williamr@2: * williamr@2: * If the trigger area is not set before, NULL is returned. williamr@2: * Ownership of the returned trigger area is not transferred williamr@2: * to the client. williamr@2: * williamr@2: * @return Pointer to the trigger area. Ownership of returned williamr@2: * object is not transfered to the client. williamr@2: */ williamr@2: IMPORT_C CLbtGeoAreaBase* TriggerArea() const; williamr@2: williamr@2: /** williamr@2: * Sets trigger area. williamr@2: * williamr@2: * @panic ELbtErrArgument If the input trigger area is a williamr@2: * class of CLbtGeoRect. williamr@2: * @param[in] aArea The trigger area. Only pointer to williamr@2: * CLbtGeoCircle class is supported by current system. williamr@2: * Ownership is transferred to this object. williamr@2: */ williamr@2: IMPORT_C void SetTriggerArea( williamr@2: CLbtGeoAreaBase* aArea ); williamr@2: williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * Externalize method that subclass must implement. williamr@2: * @param[in] aStream Stream to which the object should be externalized. williamr@2: */ williamr@2: virtual void DoExternalizeL(RWriteStream& aStream)const; williamr@2: williamr@2: /** williamr@2: * Internalize method that subclass must implement. williamr@2: * @param[in] aStream Stream from which the object should be internalized. williamr@2: */ williamr@2: virtual void DoInternalizeL(RReadStream& aStream); williamr@2: williamr@2: williamr@2: private: williamr@2: /** williamr@2: * Default constructor. williamr@2: * williamr@2: * Trigger area is set as NULL and default direction williamr@2: * is @p EFireOnEnter. williamr@2: */ williamr@2: CLbtTriggerConditionArea(); williamr@2: williamr@2: /** williamr@2: * Symbian 2nd phase constructor. williamr@2: */ williamr@2: void ConstructL(); williamr@2: williamr@2: /** williamr@2: * Symbian 2nd phase constructor. williamr@2: */ williamr@2: void ConstructL(CLbtGeoAreaBase* aArea, williamr@2: TDirection aDirection); williamr@2: williamr@2: /** williamr@2: * By default, prohibit copy constructor williamr@2: */ williamr@2: CLbtTriggerConditionArea( const CLbtTriggerConditionArea& ); williamr@2: williamr@2: /** williamr@2: * Prohibit assigment operator williamr@2: */ williamr@2: CLbtTriggerConditionArea& operator= ( const CLbtTriggerConditionArea& ); williamr@2: williamr@2: williamr@2: private:// Data williamr@2: /** williamr@2: * Area williamr@2: */ williamr@2: CLbtGeoAreaBase* iArea; williamr@2: williamr@2: /** williamr@2: * Direction williamr@2: */ williamr@2: TDirection iDirection; williamr@2: williamr@2: /** williamr@2: * Reserved pointer for future extension williamr@2: */ williamr@2: TAny* iReserved; williamr@2: }; williamr@2: #endif // LBTTRIGGERCONDITIONAREA_H