locationtriggering/ltserver/ltserverlogic/inc/lbttriggermodifyaooperation.h
changeset 56 4e949f03ecc5
equal deleted inserted replaced
-1:000000000000 56:4e949f03ecc5
       
     1 /*
       
     2 * Copyright (c) 2007 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 "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Active Object operation for serving server logic requests
       
    15 *				 for modification or deletion of triggers.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_LBTTRIGGERMODIFYOOPERATION_H
       
    21 #define C_LBTTRIGGERMODIFYOOPERATION_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <e32base.h>
       
    25 #include <lbtcommon.h>
       
    26 #include "lbtaooperationbase.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MLbtAOObserver;
       
    30 class CLbtContainer;
       
    31 class CLbtContainerTriggerEntry;
       
    32 class CLbtSettingsManager;
       
    33 
       
    34 /**
       
    35  * Class declaration of active object operation
       
    36  * to service client requests. This object services
       
    37  * requests which require listing of triggers.
       
    38  * The IPC messages are provided to
       
    39  * this class to service the request asynchronously
       
    40  *
       
    41  * @since S60 v4.0
       
    42  */
       
    43 class CLbtTriggerModifyAOOperation : public CLbtAOOperationBase
       
    44 	{
       
    45 	public:
       
    46 	
       
    47 		/**
       
    48 	     * Instantiates a new object of 
       
    49 	     * CLbtTriggerModifyAOOperation
       
    50 	     *
       
    51 	     * @param[in] aObserver reference to the active
       
    52 	     * object observer
       
    53 	     * @param[in] aMessage the IPC request which the active 
       
    54 	     * object has to service. The active object takes responsibility
       
    55 	     * of completing this IPC request
       
    56 	     * @param aContainer reference to the container which holds
       
    57 	     * the reference to the logic processor
       
    58 	     */
       
    59 	    static CLbtTriggerModifyAOOperation* NewL( MLbtAOObserver& aObserver,
       
    60 				    							   const RMessage2& aMessage,
       
    61 				    							   CLbtContainer& aContainer,
       
    62 				    							   TInt aClientType,
       
    63 				    							   CLbtSettingsManager& aSettingsManager );
       
    64 	    
       
    65 	    /**
       
    66 	     * Destructor
       
    67 	     *
       
    68 	     */
       
    69 	    ~CLbtTriggerModifyAOOperation();
       
    70 	    
       
    71 	private:
       
    72 	
       
    73 		/**
       
    74 	     * 2nd phase constuctor for instantiating member variables
       
    75 	     *
       
    76 	     */
       
    77 		void ConstructL();
       
    78 		
       
    79 		/**
       
    80 	     * Default C++ Constructor
       
    81 	     *
       
    82 	     * @param[in] aObserver reference to the active object observer
       
    83 	     * @param[in] aMessage the IPC request which the active 
       
    84 	     * object has to service. The active object takes responsibility
       
    85 	     * of completing this IPC request
       
    86 	     * @param aContainer reference to the container which holds
       
    87 	     * the reference to the logic processor
       
    88 	     */
       
    89 	    CLbtTriggerModifyAOOperation( MLbtAOObserver& aObserver, 
       
    90 				    				  const RMessage2& aMessage,
       
    91 				    				  CLbtContainer& aContainer,
       
    92 				    				  TInt aClientType ,
       
    93 				    				  CLbtSettingsManager& aSettingsManager );
       
    94 	
       
    95 	public: // From CLbtAOOperationBase
       
    96 	
       
    97 	    /**
       
    98 	     * Starts the AO operation of serving the request	     
       
    99 	     *
       
   100 	     */ 
       
   101 		void StartOperationL();
       
   102 		
       
   103 		/**
       
   104 	     * Cancels Modify Operation.	     
       
   105 	     *
       
   106 	     */
       
   107 	     void CancelModifyOperation();
       
   108 				
       
   109 		/**
       
   110 		 * Returns the trigger id of the trigger which is being modified
       
   111 		 *
       
   112 		 * @return the trigger id of the trigger being modified. If the 
       
   113 		 * operation object modifies multiple triggers then KLbtNullTriggerId
       
   114 		 * is returned
       
   115 		 */
       
   116 		TLbtTriggerId GetTriggerId();
       
   117 
       
   118     public:
       
   119         RPointerArray<CLbtContainerTriggerEntry>& GetUpdatedTriggerList();
       
   120 
       
   121     private:
       
   122     
       
   123         void ListTriggersL();
       
   124         void UpdateTriggersL();
       
   125         CLbtTriggerEntry* CreateTriggerEntryLC( TInt aType );
       
   126         CLbtTriggerFilterBase* CreateTriggerFilterLC( TInt aType );
       
   127         CLbtTriggerFilterBase* InternalizeFilterFromIpcLC( 
       
   128             const RMessage2& aMessage, 
       
   129             const TInt aIpcSlot );
       
   130         CLbtTriggerEntry* InternalizeTriggerFromIpcLC( 
       
   131             const RMessage2& aMessage, 
       
   132             const TInt aIpcSlot );
       
   133         void HandleUpdateTriggerStateOpL();
       
   134         void HandleModifyTriggerStateOpL();
       
   135         void HandleDeleteTriggerOpL();
       
   136         TBool CheckEnabledTriggerCap();
       
   137 
       
   138     protected: // From CActive
       
   139     	void RunL();
       
   140     	void DoCancel();
       
   141 
       
   142     private: // Data
       
   143         enum TLbtModifyReqProcessingState
       
   144             {
       
   145             ENone = 0,
       
   146             EListTriggers,
       
   147             EUpdateTriggers
       
   148             };
       
   149 	private: // Data
       
   150 		
       
   151 		// The id of the trigger being modified (valid only if one trigger is being modified)
       
   152 		TLbtTriggerId iTriggerId;
       
   153 				
       
   154 		// Container trigger entry object
       
   155 		CLbtContainerTriggerEntry* iContainerEntry;
       
   156 		
       
   157 		// The state of the request processing
       
   158 		TLbtModifyReqProcessingState iState;
       
   159 		
       
   160 		// The pointer array which will be populated by the container
       
   161 		// based on the search
       
   162 		RPointerArray<CLbtContainerTriggerEntry> iUpdatedTriggerList;
       
   163 		
       
   164 		// Settings manager
       
   165 		CLbtSettingsManager& iSettingsManager;
       
   166 		
       
   167 		// Fire on updation flag
       
   168 		TLbtFireOnUpdate iFireOnUpdate;
       
   169 	};
       
   170 
       
   171 #endif // C_LBTTRIGGERMODIFYOOPERATION_H