|
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 file defines the container trigger entry class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <lbttriggerdynamicinfo.h> |
|
20 #include <lbtsessiontrigger.h> |
|
21 #include <lbtstartuptrigger.h> |
|
22 #include <lbttriggerentry.h> |
|
23 #include <lbttriggerconditionbase.h> |
|
24 #include <lbttriggerconditionarea.h> |
|
25 #include <lbtgeoareabase.h> |
|
26 #include <lbtgeocircle.h> |
|
27 #include <lbtgeorect.h> |
|
28 #include "lbtcontainertriggerentry.h" |
|
29 #include "lbtupdateasyncoperation.h" |
|
30 #include "lbtsecuritypolicy.h" |
|
31 #include "lbtlogger.h" |
|
32 |
|
33 // ======== MEMBER FUNCTIONS ======== |
|
34 // --------------------------------------------------------------------------- |
|
35 // CLbtUpdateAsyncOperation::NewL( |
|
36 // CLbtTriggerEntry* aEntry, |
|
37 // TLbtTriggerDynamicInfo* aDynInfo, |
|
38 // TLbtDerivedTriggerInfo* aDerivedInfo) |
|
39 // |
|
40 // (other items were commented in a header). |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CLbtUpdateAsyncOperation* CLbtUpdateAsyncOperation::NewL( |
|
44 CLbtContainerTriggerEntry& aEntry, |
|
45 TLbtTriggerDataMask aDataMask, |
|
46 TLbtTriggerAttributeFieldsMask aAttrMask, |
|
47 TRequestStatus& aClientStatus, |
|
48 TLbtSecurityPolicy aSecurityPolicy, |
|
49 TContainerAOOperation aUpdateOpType) |
|
50 { |
|
51 CLbtUpdateAsyncOperation* self=new( ELeave ) CLbtUpdateAsyncOperation(aSecurityPolicy); |
|
52 CleanupStack::PushL( self ); |
|
53 self->ConstructL(aEntry,aDataMask,aAttrMask,aClientStatus,aUpdateOpType); |
|
54 CleanupStack::Pop( self ); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CLbtUpdateAsyncOperation::NewL() |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CLbtUpdateAsyncOperation* CLbtUpdateAsyncOperation::NewL( RArray<TLbtTriggerId>& aTriggerIds, |
|
63 TRequestStatus& aClientStatus, |
|
64 TBool aFireBool, |
|
65 TLbtSecurityPolicy aSecurityPolicy, |
|
66 TContainerAOOperation aUpdateOpType ) |
|
67 { |
|
68 CLbtUpdateAsyncOperation* self=new( ELeave ) CLbtUpdateAsyncOperation(aSecurityPolicy); |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL(aTriggerIds, aClientStatus, aFireBool, aUpdateOpType); |
|
71 CleanupStack::Pop( self ); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CLbtUpdateAsyncOperation::NewL() |
|
77 // |
|
78 // (other items were commented in a header). |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 |
|
82 CLbtUpdateAsyncOperation* CLbtUpdateAsyncOperation::NewL( |
|
83 CLbtTriggerEntry::TLbtTriggerState aState, |
|
84 CLbtContainerUpdateFilter* aFilter, |
|
85 TLbtFireOnUpdate aFireOnUpdate, |
|
86 TRequestStatus& aClientStatus, |
|
87 TLbtSecurityPolicy aSecurityPolicy, |
|
88 TContainerAOOperation aUpdateOpType) |
|
89 { |
|
90 CLbtUpdateAsyncOperation* self = new( ELeave ) CLbtUpdateAsyncOperation(aSecurityPolicy); |
|
91 CleanupStack::PushL( self ); |
|
92 self->ConstructL( aState, |
|
93 aFilter, |
|
94 aFireOnUpdate, |
|
95 aClientStatus, |
|
96 aUpdateOpType); |
|
97 CleanupStack::Pop( self ); |
|
98 return self; |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CLbtUpdateAsyncOperation::NewL() |
|
103 // |
|
104 // (other items were commented in a header). |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 CLbtUpdateAsyncOperation* CLbtUpdateAsyncOperation::NewL( TLbtTriggerDynamicInfo::TLbtTriggerValidity aValidity, |
|
108 RArray<TLbtTriggerId> &aTriggerIds, |
|
109 TRequestStatus& aClientStatus, |
|
110 TLbtSecurityPolicy aSecurityPolicy, |
|
111 TContainerAOOperation aUpdateOpType ) |
|
112 { |
|
113 CLbtUpdateAsyncOperation* self=new( ELeave ) CLbtUpdateAsyncOperation(aSecurityPolicy); |
|
114 CleanupStack::PushL( self ); |
|
115 self->ConstructL(aValidity,aTriggerIds,aClientStatus,aUpdateOpType); |
|
116 CleanupStack::Pop( self ); |
|
117 return self; |
|
118 } |
|
119 // --------------------------------------------------------------------------- |
|
120 // CLbtUpdateAsyncOperation::ConstructL() |
|
121 // |
|
122 // (other items were commented in a header). |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 void CLbtUpdateAsyncOperation::ConstructL( CLbtContainerTriggerEntry& aEntry, |
|
126 TLbtTriggerDataMask aDataMask, |
|
127 TLbtTriggerAttributeFieldsMask aAttrMask, |
|
128 TRequestStatus& aClientStatus, |
|
129 TContainerAOOperation aUpdateOpType ) |
|
130 { |
|
131 iEntry = &aEntry; |
|
132 iDataMask = aDataMask; |
|
133 iAttrMask = aAttrMask; |
|
134 iClientStatus = &aClientStatus; |
|
135 iUpdateOpType = aUpdateOpType; |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // CLbtUpdateAsyncOperation::ConstructL() |
|
140 // |
|
141 // (other items were commented in a header). |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 void CLbtUpdateAsyncOperation::ConstructL( CLbtTriggerEntry::TLbtTriggerState aState, |
|
145 CLbtContainerUpdateFilter* aFilter, |
|
146 TLbtFireOnUpdate aFireOnUpdate, |
|
147 TRequestStatus& aClientStatus, |
|
148 TContainerAOOperation aUpdateOpType ) |
|
149 |
|
150 { |
|
151 iState = aState; |
|
152 iFilter = aFilter; |
|
153 iClientStatus = &aClientStatus; |
|
154 iUpdateOpType = aUpdateOpType; |
|
155 iFireOnUpdate = aFireOnUpdate; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // CLbtUpdateAsyncOperation::ConstructL() |
|
160 // |
|
161 // (other items were commented in a header). |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 void CLbtUpdateAsyncOperation::ConstructL( TLbtTriggerDynamicInfo::TLbtTriggerValidity aValidity, |
|
165 RArray <TLbtTriggerId>& aTriggerIds, |
|
166 TRequestStatus& aClientStatus, |
|
167 TContainerAOOperation aUpdateOpType) |
|
168 { |
|
169 FUNC_ENTER("CLbtUpdateAsyncOperation::ConstructL"); |
|
170 for(TInt i=0;i<aTriggerIds.Count();++i) |
|
171 { |
|
172 iTriggerIds.Append(aTriggerIds[i]); |
|
173 } |
|
174 iValidity = aValidity; |
|
175 iClientStatus = &aClientStatus; |
|
176 iUpdateOpType = aUpdateOpType; |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // CLbtUpdateAsyncOperation::ConstructL() |
|
181 // |
|
182 // (other items were commented in a header). |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 void CLbtUpdateAsyncOperation::ConstructL( RArray<TLbtTriggerId>& aTriggerIds, |
|
186 TRequestStatus& aClientStatus, |
|
187 TBool aFireBool, |
|
188 TContainerAOOperation aUpdateOpType ) |
|
189 { |
|
190 FUNC_ENTER("CLbtUpdateAsyncOperation::ConstructL"); |
|
191 for(TInt i=0;i<aTriggerIds.Count();++i) |
|
192 { |
|
193 iTriggerIds.Append(aTriggerIds[i]); |
|
194 } |
|
195 iClientStatus = &aClientStatus; |
|
196 iUpdateOpType = aUpdateOpType; |
|
197 iFireBool = aFireBool; |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CLbtUpdateAsyncOperation::StartAOOperation() |
|
202 // |
|
203 // (other items were commented in a header). |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 void CLbtUpdateAsyncOperation::StartAOOperationL(MLbtTriggerStore* aStore, TRequestStatus &aStatus) |
|
207 { |
|
208 FUNC_ENTER("CLbtUpdateAsyncOperation::StartAOOperationL"); |
|
209 aStatus = KRequestPending; |
|
210 switch(iUpdateOpType) |
|
211 { |
|
212 case EOpUpdateTrigger: |
|
213 { |
|
214 TRAPD(error,aStore->UpdateTriggerL( *iEntry, |
|
215 iDataMask, |
|
216 iAttrMask, |
|
217 iSecurityPolicy, |
|
218 aStatus)); |
|
219 |
|
220 if(error != KErrNone && aStatus == KRequestPending) |
|
221 { |
|
222 TRequestStatus* status = &aStatus; |
|
223 User::RequestComplete(status, error); |
|
224 } |
|
225 break; |
|
226 } |
|
227 case EOpUpdateTriggerState: |
|
228 { |
|
229 TRAPD(error, aStore->UpdateTriggersStateL( iState, |
|
230 iFilter, |
|
231 iFireOnUpdate, |
|
232 iSecurityPolicy, |
|
233 aStatus)); |
|
234 |
|
235 if(error != KErrNone && aStatus == KRequestPending) |
|
236 { |
|
237 TRequestStatus* status = &aStatus; |
|
238 User::RequestComplete(status, error); |
|
239 } |
|
240 break; |
|
241 } |
|
242 case EOpUpdateTriggersValidity: |
|
243 { |
|
244 TRAPD(error ,aStore->UpdateTriggersValidityL( iValidity, |
|
245 iTriggerIds, |
|
246 iSecurityPolicy, |
|
247 aStatus)); |
|
248 if(error != KErrNone && aStatus == KRequestPending) |
|
249 { |
|
250 TRequestStatus* status = &aStatus; |
|
251 User::RequestComplete(status, error); |
|
252 } |
|
253 break; |
|
254 } |
|
255 case EOpUpdateTriggersFiredState: |
|
256 { |
|
257 TRAPD(error, aStore->UpdateTriggerFiredStateL(iTriggerIds, iFireBool, aStatus)); |
|
258 |
|
259 if(error != KErrNotFound && aStatus == KRequestPending) |
|
260 { |
|
261 TRequestStatus* status = &aStatus; |
|
262 User::RequestComplete(status, error); |
|
263 } |
|
264 break; |
|
265 } |
|
266 default: |
|
267 { |
|
268 TRequestStatus* status = &aStatus; |
|
269 User::RequestComplete(status, KErrArgument); |
|
270 break; |
|
271 } |
|
272 } |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // CLbtUpdateAsyncOperation::~CLbtUpdateAsyncOperation() |
|
277 // --------------------------------------------------------------------------- |
|
278 // |
|
279 TContainerAOOperation CLbtUpdateAsyncOperation::GetAOOperationType() |
|
280 { |
|
281 return iUpdateOpType; |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------------------------- |
|
285 // CLbtUpdateAsyncOperation::GetStatus() |
|
286 // |
|
287 // (other items were commented in a header). |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 TRequestStatus* CLbtUpdateAsyncOperation::GetStatus() |
|
291 { |
|
292 return iClientStatus; |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CLbtUpdateAsyncOperation::~CLbtUpdateAsyncOperation() |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 CLbtUpdateAsyncOperation::~CLbtUpdateAsyncOperation() |
|
300 { |
|
301 iTriggerIds.Close(); |
|
302 delete iFilter; |
|
303 } |
|
304 |
|
305 // --------------------------------------------------------------------------- |
|
306 // Constructor |
|
307 // |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 CLbtUpdateAsyncOperation::CLbtUpdateAsyncOperation(TLbtSecurityPolicy aSecurityPolicy): |
|
311 iEntry(NULL), |
|
312 iFilter(NULL), |
|
313 iClientStatus(NULL), |
|
314 iSecurityPolicy(aSecurityPolicy) |
|
315 { |
|
316 |
|
317 |
|
318 } |
|
319 |
|
320 // end of file |