|
1 /* |
|
2 * Copyright (c) 2006,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: location triggering server client interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef LBTCONTAINERAO_H |
|
21 #define LBTCONTAINERAO_H |
|
22 |
|
23 #include <lbt.h> |
|
24 #include "lbtcontainer.h" |
|
25 #include "lbtcontainertriggerentry.h" |
|
26 #include "lbttriggerstoreinterface.h" |
|
27 #include "lbtcontainerlistoptions.h" |
|
28 #include "lbtcontainerAOOperation.h" |
|
29 #include "lbttriggerstoreobserver.h" |
|
30 |
|
31 class MLbtContainerOpObserver; |
|
32 NONSHARABLE_CLASS( CLbtContainerAO ) : public CActive, |
|
33 public MLbtTriggerStoreObserver |
|
34 { |
|
35 public: //constructor |
|
36 |
|
37 |
|
38 /** |
|
39 * Construct a trigger change event notifier object. |
|
40 * |
|
41 * When the object is constructed. The trigger change |
|
42 * notification request is not issued to the |
|
43 * Location Triggering Server. Client shall call |
|
44 * CLbtTriggerChangeEventNotifier::Start() to start |
|
45 * notification. |
|
46 * |
|
47 * @param[in] aLbt A reference to RLbt object. The subsession |
|
48 * must be opened. Otherwise a panic is raised. |
|
49 * @param[in] aObserver A reference to the |
|
50 * observer object to receive trigger change event. |
|
51 * @param[in] aPriority An integer specifying the |
|
52 * priority of this active object. CActive::TPriority |
|
53 * defines a standard set of priorities. |
|
54 * |
|
55 * @panic LocTriggering ELbtServerBadHandle If the |
|
56 * subsession of aLbt is not opened. |
|
57 */ |
|
58 |
|
59 static CLbtContainerAO* NewL(RPointerArray<MLbtTriggerStore>& aTriggerStores, |
|
60 RArray<CLbtContainer::TLbtTriggerStoreChangeObserver>& aObservers ); |
|
61 /** |
|
62 * Destructor. |
|
63 * |
|
64 * If the notification is started, the |
|
65 * destructor will cancel the notification. |
|
66 */ |
|
67 ~CLbtContainerAO(); |
|
68 |
|
69 void GetTriggersL( const RArray<TLbtTriggerId>& aTriggerIds, |
|
70 RPointerArray < CLbtContainerTriggerEntry >& aTriggers, |
|
71 TInt& aOpId, |
|
72 TRequestStatus& aStatus, |
|
73 TLbtSecurityPolicy aSecurityPolicy = KLbtNullSecurity ); |
|
74 |
|
75 |
|
76 void ListTriggersL( CLbtContainerListOptions* aFilter, |
|
77 RPointerArray<CLbtContainerTriggerEntry>& aTriggers, |
|
78 TInt aOpCode, |
|
79 TRequestStatus& aStatus, |
|
80 TLbtSecurityPolicy aSecurityPolicy); |
|
81 |
|
82 void UpdateTriggerL( CLbtContainerTriggerEntry& aEntry, |
|
83 TLbtTriggerDataMask aDataMask, |
|
84 TLbtTriggerAttributeFieldsMask aAttrMask, |
|
85 TInt aOpCode, |
|
86 TRequestStatus& aStatus, |
|
87 TLbtSecurityPolicy aSecurityPolicy); |
|
88 |
|
89 void UpdateTriggersStateL( CLbtTriggerEntry::TLbtTriggerState aState, |
|
90 CLbtContainerUpdateFilter* aFilter, |
|
91 TInt aOpCode, |
|
92 TLbtFireOnUpdate aFireOnUpdate, |
|
93 TRequestStatus& aStatus, |
|
94 TLbtSecurityPolicy aSecurityPolicy ); |
|
95 |
|
96 void UpdateTriggersValidityL( TLbtTriggerDynamicInfo::TLbtTriggerValidity aValidity, |
|
97 RArray<TLbtTriggerId>& aTriggerIds, |
|
98 TInt aOpCode, |
|
99 TRequestStatus& aStatus, |
|
100 TLbtSecurityPolicy aSecurityPolicy ); |
|
101 |
|
102 void UpdateTriggerFiredStateL( RArray<TLbtTriggerId>& aTriggerIds, |
|
103 TBool aFireBool, |
|
104 TInt aOpCode, |
|
105 TRequestStatus& aStatus ); |
|
106 |
|
107 void DeleteTriggersL( CLbtContainerUpdateFilter* aFilter, |
|
108 TInt aOpCode, |
|
109 TRequestStatus& aStatus, |
|
110 TLbtSecurityPolicy aSecurityPolicy ); |
|
111 |
|
112 void AddAsyncOpToQueue( CLbtContainerAOOperation* aAsyncOp); |
|
113 |
|
114 void StartNextAsyncOperation(); |
|
115 |
|
116 void CreateTriggerL(CLbtContainerTriggerEntry* aEntry,TInt aOpCode,TRequestStatus& aStatus); |
|
117 |
|
118 void CompleteAsyncRequest(TInt aErr); |
|
119 |
|
120 void CancelAsyncRequest(TInt aOpId); |
|
121 |
|
122 void NotifyTriggerStoreReadyToServe(); |
|
123 private: |
|
124 //Derived from CActive |
|
125 void RunL(); |
|
126 TInt RunError( TInt aError ); |
|
127 void DoCancel(); |
|
128 |
|
129 private: |
|
130 //C++ default constructor |
|
131 |
|
132 CLbtContainerAO(RPointerArray<MLbtTriggerStore>& aTriggerStores, |
|
133 RArray<CLbtContainer::TLbtTriggerStoreChangeObserver>& aObservers ); |
|
134 |
|
135 |
|
136 //Second phase constructor |
|
137 void ConstructL(); |
|
138 void NotifyListeners(); |
|
139 void ProcessFilter(TBool& aIsRequested,TLbtTriggerEventMask& aRequestedMask,TLbtTriggerEventMask& aEventMask); |
|
140 void SortTriggers(RPointerArray<CLbtContainerTriggerEntry>& aTriggers); |
|
141 void SortByName(RPointerArray<CLbtContainerTriggerEntry>& aTriggers); |
|
142 void SortByDistance(RPointerArray<CLbtContainerTriggerEntry>& aTriggers); |
|
143 void ReverseArray(RPointerArray<CLbtContainerTriggerEntry>& aTriggers); |
|
144 |
|
145 private: |
|
146 TRequestStatus* iClientStatus; |
|
147 |
|
148 TContainerAOOperation iAsyncRequest; |
|
149 |
|
150 RPointerArray<MLbtTriggerStore>& iTriggerStores; |
|
151 TInt iTriggerStoreCtr; |
|
152 RPointerArray <CLbtContainerAOOperation> iAsyncOpQueue; |
|
153 RArray<CLbtContainer::TLbtTriggerStoreChangeObserver>& iObservers; |
|
154 TLbtTriggerDataMask iDataMask; |
|
155 TLbtTriggerAttributeFieldsMask iAttrMask; |
|
156 CLbtListTriggerOptions::TLbtListTriggerSorting iSortingOption; |
|
157 }; |
|
158 |
|
159 #endif // LBTCONTAINERAO_H |
|
160 |