|
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 "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: This header file describes the class that handles the storage |
|
15 * of triggers in RAM Structures. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_LBTCONTAINER_RAMTRIGGERS_MANAGER_H |
|
21 #define C_LBTCONTAINER_RAMTRIGGERS_MANAGER_H |
|
22 |
|
23 // system includes |
|
24 #include <e32base.h> |
|
25 |
|
26 // user includes |
|
27 #include "lbttriggerstoreinterface.h" |
|
28 |
|
29 class CLbtRamTriggerIdTree; |
|
30 class MLbtTriggerStoreObserver; |
|
31 class CLbtContainerFilterBase; |
|
32 |
|
33 /** |
|
34 * This class provides an abstraction to store and retrieve triggers |
|
35 * from RAM Structures. |
|
36 * |
|
37 * It internally utilizes RAM memory and stores the trigger information |
|
38 * in a efficient data structure. |
|
39 */ |
|
40 NONSHARABLE_CLASS( CLbtRamTriggersManager ) : public CActive, |
|
41 public MLbtTriggerStore |
|
42 { |
|
43 public: |
|
44 enum TOperation |
|
45 { |
|
46 EOperationNone, |
|
47 EOperationCreate, |
|
48 EOperationUpdateTrigger, |
|
49 EOperationDelete, |
|
50 EOperationUpdatingState, |
|
51 EOperationListing, |
|
52 EOperationGetTriggers |
|
53 }; |
|
54 |
|
55 /** |
|
56 * The Symbian 2 phase constructor. |
|
57 * This method creates a new instance of CLbtRamTriggersManager |
|
58 * |
|
59 * @return An instance of this class |
|
60 */ |
|
61 static CLbtRamTriggersManager* NewL( ); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CLbtRamTriggersManager(); |
|
67 |
|
68 /** |
|
69 * This method returns the list of triggers modified for a given operation |
|
70 * @param[out] aIdArray Contains the list of triggers modified for a given operation. |
|
71 */ |
|
72 void TriggersModified(RArray<TLbtTriggerModifiedInfo>& aArray); |
|
73 |
|
74 TInt GetCountOfEnabledAndValidTriggers(); |
|
75 |
|
76 protected: // from base class MLbtTriggerStore |
|
77 /** |
|
78 * This method returns the types of triggers that are supported in this |
|
79 * trigger store. |
|
80 * |
|
81 * @return a bitmask of the types of triggers supported by a trigger |
|
82 * store. |
|
83 */ |
|
84 virtual TTriggerTypeMask SupportedTriggerTypes(); |
|
85 |
|
86 void CreateTriggerL( CLbtContainerTriggerEntry &aEntry, |
|
87 TRequestStatus& aStatus); |
|
88 |
|
89 void GetTriggersL( RArray<TLbtTriggerId>& aTriggerIds, |
|
90 RPointerArray<CLbtContainerTriggerEntry>& aTriggers, |
|
91 TLbtSecurityPolicy& aSecurityPolicy, |
|
92 TRequestStatus &aStatus ); |
|
93 |
|
94 void ListTriggersL( CLbtContainerListOptions* aFilter, |
|
95 RPointerArray<CLbtContainerTriggerEntry>& aTriggers, |
|
96 TLbtSecurityPolicy& aSecurityPolicy, |
|
97 TRequestStatus &aStatus ); |
|
98 |
|
99 void FilterByAreaL( CLbtContainerListOptions* aFilter, |
|
100 RPointerArray<CLbtContainerTriggerEntry>& aTriggers, |
|
101 TLbtSecurityPolicy& aSecurityPolicy ); |
|
102 |
|
103 void FilterByAttributeL( CLbtContainerListOptions* aFilter, |
|
104 RPointerArray<CLbtContainerTriggerEntry>& aTriggers, |
|
105 TLbtSecurityPolicy& aSecurityPolicy ); |
|
106 |
|
107 |
|
108 void UpdateTriggerL( CLbtContainerTriggerEntry& aEntry, |
|
109 TLbtTriggerDataMask aDataMask, |
|
110 TLbtTriggerAttributeFieldsMask aAttrMask, |
|
111 TLbtSecurityPolicy& aSecurityPolicy, |
|
112 TRequestStatus& aStatus); |
|
113 |
|
114 void UpdateTriggersStateL( CLbtTriggerEntry::TLbtTriggerState aState, |
|
115 CLbtContainerUpdateFilter* aFilter, |
|
116 TLbtFireOnUpdate aFireOnUpdate, |
|
117 TLbtSecurityPolicy& aSecurityPolicy, |
|
118 TRequestStatus& aStatus); |
|
119 |
|
120 void UpdateTriggersValidityL( TLbtTriggerDynamicInfo::TLbtTriggerValidity aValidity, |
|
121 RArray<TLbtTriggerId>& aTriggerIds, |
|
122 TLbtSecurityPolicy& aSecurityPolicy, |
|
123 TRequestStatus& aStatus ); |
|
124 |
|
125 void UpdateTriggerFiredStateL( RArray<TLbtTriggerId>& aTriggerIds, |
|
126 TBool aFireBool, |
|
127 TRequestStatus& aStatus ); |
|
128 |
|
129 void DeleteTriggersL( CLbtContainerUpdateFilter* aFilter, |
|
130 TLbtSecurityPolicy& aSecurityPolicy, |
|
131 TRequestStatus& aStatus ); |
|
132 |
|
133 void DeleteTriggerL(TLbtTriggerId aTriggerId); |
|
134 |
|
135 void FilterCompositeL( CLbtContainerListOptions* aFilter, |
|
136 RPointerArray<CLbtContainerTriggerEntry>& aTriggers, |
|
137 TLbtSecurityPolicy& aSecurityPolicy ); |
|
138 |
|
139 void SetTimeTillCompaction(TTime /*aTime*/); |
|
140 |
|
141 /** |
|
142 * Used to check if the trigger store is busy |
|
143 * |
|
144 * @return ETrue if the store is busy EFalse otherwise |
|
145 */ |
|
146 TBool IsStoreBusy(); |
|
147 |
|
148 void SetStoreChangeObserver(MLbtTriggerStoreObserver* aObserver); |
|
149 |
|
150 TInt CancelCurrentOperation(); |
|
151 |
|
152 |
|
153 private: |
|
154 void AppendTriggerInfo(CLbtContainerTriggerEntry* aEntry); |
|
155 |
|
156 void SelfComplete(); |
|
157 |
|
158 void CompleteClientRequest(TInt aError); |
|
159 |
|
160 void HandleUpdateTriggerEventL(); |
|
161 |
|
162 void HandleListTriggerEventL(); |
|
163 |
|
164 void HandleDeleteTriggersEventL(); |
|
165 |
|
166 void HandleUpdateTriggersStateEventL(); |
|
167 |
|
168 void HandleGetTriggersEventL(); |
|
169 |
|
170 private: // From CActive |
|
171 void RunL(); |
|
172 TInt RunError(TInt aError); |
|
173 void DoCancel(); |
|
174 |
|
175 private: |
|
176 /** |
|
177 * C++ constructor |
|
178 */ |
|
179 CLbtRamTriggersManager(); |
|
180 |
|
181 /** |
|
182 * Symbian 2nd phase of construction |
|
183 */ |
|
184 void ConstructL(); |
|
185 |
|
186 /** |
|
187 * C++ Copy Constructor |
|
188 * The private copy constructor prevents the usage of copy constructors |
|
189 * with this class. |
|
190 */ |
|
191 CLbtRamTriggersManager(const CLbtRamTriggersManager& aRamTriggersManager); |
|
192 |
|
193 /** |
|
194 * Overload equality operator |
|
195 * The private overload of the equality operator prevents the usage of |
|
196 * equality operator with this class. |
|
197 */ |
|
198 CLbtRamTriggersManager& operator =(const CLbtRamTriggersManager& aRamTriggersManager); |
|
199 |
|
200 CLbtRamTriggerIdTree* iTriggerIdTree; |
|
201 |
|
202 RArray<TLbtTriggerModifiedInfo> iIdArray; |
|
203 |
|
204 TInt iCountOfEnabledAndValidTrigger; |
|
205 |
|
206 // Data member to hold the current operation underway |
|
207 TOperation iCurrentOperation; |
|
208 |
|
209 // The client status |
|
210 TRequestStatus* iClientStatus; |
|
211 |
|
212 // Data member to hold the trigger id which is under operation |
|
213 TLbtTriggerId iCurrentTriggerId; |
|
214 |
|
215 // Clients security policy |
|
216 TLbtSecurityPolicy iClientSecurityPolicy; |
|
217 |
|
218 // Pointer to clients trigger array |
|
219 RPointerArray<CLbtContainerTriggerEntry>* iClientTriggerArray; |
|
220 |
|
221 // Copy of client provided filter base |
|
222 CLbtContainerFilterBase* iFilterBase; |
|
223 |
|
224 // Client provided list options filter |
|
225 CLbtContainerListOptions* iFilter; |
|
226 |
|
227 // Iterator into modification array |
|
228 TInt iIterator; |
|
229 |
|
230 // Trigger state |
|
231 CLbtTriggerEntry::TLbtTriggerState iState; |
|
232 |
|
233 // Fire on update flag |
|
234 TLbtFireOnUpdate iFireOnUpdate; |
|
235 |
|
236 // Container trigger entry |
|
237 CLbtContainerTriggerEntry* iClientTriggerEntry; |
|
238 |
|
239 TLbtTriggerDataMask iDataMask; |
|
240 |
|
241 TLbtTriggerAttributeFieldsMask iAttrMask; |
|
242 }; |
|
243 |
|
244 |
|
245 #endif // C_LBTCONTAINER_RAMTRIGGERS_MANAGER_H |