|
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: Handles all the Asynchronous operations with the Location |
|
15 * Centre Client Session |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_LCASYNCOPERATION_H |
|
21 #define C_LCASYNCOPERATION_H |
|
22 |
|
23 // SYSTEM INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // USER INCLUDES |
|
27 #include "lclocationappfilter.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class RLcClientSession; |
|
31 class CLcBasicAppInfo; |
|
32 class CLcLocationAppInfoArray; |
|
33 class TLcLocationAppFilter; |
|
34 class RLcClientSession; |
|
35 class CBufFlat; |
|
36 |
|
37 /** |
|
38 * Observer class to notify the completion of the Asynchronous operation |
|
39 * @lib lcservice.lib |
|
40 * @since v5.0 |
|
41 */ |
|
42 class MLcAsynOperationObserver |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Notification for the Completion of the Asynchronous operation. |
|
47 * |
|
48 * @param[in] aError Error code for the completion of the Asynchronous |
|
49 * Operation. |
|
50 */ |
|
51 virtual void OperationComplete( TInt aError ) =0; |
|
52 }; |
|
53 |
|
54 /** |
|
55 * Handles all the Asynchronous operations to the Location Centre Server. |
|
56 * |
|
57 * @lib lcservice.lib |
|
58 * @since S60 v5.0 |
|
59 */ |
|
60 NONSHARABLE_CLASS( CLcAsyncOperation ) : public CActive |
|
61 { |
|
62 public: |
|
63 /** |
|
64 * Constructs a new instance of Location Centre interface. |
|
65 * |
|
66 * @param[in] aSession Reference to the Location Centre Client Session. |
|
67 * @param[in] aObserver Observer to notify the Completion of the Asynchronous |
|
68 * Operation. |
|
69 * @return The new instance of Location Centre interface object. |
|
70 * @leave System wide error code if the object creation fails. |
|
71 */ |
|
72 static CLcAsyncOperation* NewL( RLcClientSession& aSession, |
|
73 MLcAsynOperationObserver& aObserver ); |
|
74 |
|
75 /** |
|
76 * C++ Destructor. |
|
77 * Frees all the resources associated with this Location Centre |
|
78 * interface. |
|
79 */ |
|
80 virtual ~CLcAsyncOperation(); |
|
81 |
|
82 /** |
|
83 * Gets a filtered list of Location based Applications. |
|
84 * |
|
85 * @param[in] aLocationAppFilter Filtering parameters. |
|
86 * @param[in] CLcLocationAppInfoArray* Array of Location based Applications and |
|
87 * Contents/Services. |
|
88 */ |
|
89 void GetLocationApplicationsL( |
|
90 const TLcLocationAppFilter& aLocationAppFilter, |
|
91 CLcLocationAppInfoArray*& aAppInfoArray ); |
|
92 /** |
|
93 * Cancels an outstanding @ref GetLocationApplications request. |
|
94 */ |
|
95 void CancelGetLocationApplications(); |
|
96 |
|
97 private: |
|
98 /** |
|
99 * Default Constructor |
|
100 */ |
|
101 CLcAsyncOperation( RLcClientSession& aSession, |
|
102 MLcAsynOperationObserver& aObserver ); |
|
103 |
|
104 void ConstructL(); |
|
105 |
|
106 /** |
|
107 * Issues a self request to this Active Object. |
|
108 */ |
|
109 void GetLengthL(); |
|
110 |
|
111 /** |
|
112 * Re-issues a request to the Location Centre Server. The request which will be re-issued |
|
113 * will be the last request which was issued. |
|
114 */ |
|
115 void ReIssueRequestL(); |
|
116 |
|
117 private: // Inherited from Base classes |
|
118 /** |
|
119 * Inherited from CActive |
|
120 */ |
|
121 void RunL(); |
|
122 |
|
123 /** |
|
124 * Inherited from CActive |
|
125 */ |
|
126 void DoCancel(); |
|
127 |
|
128 /** |
|
129 * Inherited from CActive |
|
130 */ |
|
131 TInt RunError( TInt aError ); |
|
132 |
|
133 private: // Member Variables |
|
134 /** |
|
135 * Class declaration for holding the Location Application Information |
|
136 * array. |
|
137 */ |
|
138 class TLcAppInfoContainer |
|
139 { |
|
140 public: |
|
141 /** |
|
142 * Overloaded constructor which takes the reference of the |
|
143 * Application Information array. |
|
144 */ |
|
145 TLcAppInfoContainer( CLcLocationAppInfoArray*& aAppInfoArray ); |
|
146 |
|
147 public: |
|
148 /** |
|
149 * Reference to the Application Information array. |
|
150 */ |
|
151 CLcLocationAppInfoArray*& iAppInfoArray; |
|
152 }; |
|
153 |
|
154 /** |
|
155 * Enumeration for the State of Asynchronous operation |
|
156 */ |
|
157 enum TASyncOperation |
|
158 { |
|
159 ELcNoOperation, |
|
160 ELcGetAppLength, |
|
161 ELcGetApp |
|
162 }; |
|
163 |
|
164 /** |
|
165 * Reference to the Client session to the Location Centre Server. |
|
166 */ |
|
167 RLcClientSession& iClientSession; |
|
168 |
|
169 /** |
|
170 * Observer to notify the completion of the Asynchronous request. |
|
171 */ |
|
172 MLcAsynOperationObserver& iObserver; |
|
173 |
|
174 /** |
|
175 * Current State of operation |
|
176 */ |
|
177 TASyncOperation iOperation; |
|
178 |
|
179 /** |
|
180 * Location Application filter for this Application. |
|
181 */ |
|
182 TLcLocationAppFilter iAppFilter; |
|
183 |
|
184 /** |
|
185 * Buffer for exchanging information with the Location Centre Server. |
|
186 * |
|
187 * Owns |
|
188 */ |
|
189 CBufFlat* iBuffer; |
|
190 |
|
191 /** |
|
192 * Pointer to the above buffer |
|
193 */ |
|
194 TPtr8 iBufferPtr; |
|
195 |
|
196 /** |
|
197 * Place holder for the Location Centre Application Information |
|
198 * Array. |
|
199 */ |
|
200 TLcAppInfoContainer* iAppInfoArrayContainer; |
|
201 |
|
202 /** |
|
203 * IPC arguments |
|
204 */ |
|
205 TIpcArgs iIpcArgs; |
|
206 |
|
207 /** |
|
208 * Package buffer containing the Application Filter options. |
|
209 */ |
|
210 TPckg< TLcLocationAppFilter >* iFilterBuffer; |
|
211 }; |
|
212 |
|
213 #endif // C_LCASYNCOPERATION_H |