|
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 the License "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: Header file for location SAPI core implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_LOGINTERFACE_H |
|
20 #define C_LOGINTERFACE_H |
|
21 |
|
22 #include <LiwCommon.h> |
|
23 #include "serviceerrno.h" |
|
24 |
|
25 /** |
|
26 * Forward Declarations |
|
27 */ |
|
28 class CLoggingService ; |
|
29 |
|
30 /** |
|
31 * error message |
|
32 */ |
|
33 |
|
34 const TInt KMaxMsgSize = 256; |
|
35 const TInt KMaxKeySize = 128; |
|
36 _LIT( KInvalid, "Invalid" ); |
|
37 _LIT( KMissing, " Missing" ); |
|
38 _LIT( KMsgErr, "Logging:"); |
|
39 _LIT( KColon, ":"); |
|
40 _LIT8( KErrorMessage, "ErrorMessage"); |
|
41 _LIT( KErrLogCmdName, "Invalid commandName" ); |
|
42 _LIT( KErrMissingCallback, "Missing Callback" ); |
|
43 _LIT(KInterfaceMissing,"Logging: Interface name missing"); |
|
44 |
|
45 |
|
46 /** |
|
47 * Content Type |
|
48 */ |
|
49 _LIT(KContentType , "Log") ; |
|
50 |
|
51 /** |
|
52 * ContentType Key |
|
53 */ |
|
54 _LIT8(KContentTypeKey , "Type") ; |
|
55 /** |
|
56 * Error Indntifier in Output parameter list |
|
57 */ |
|
58 _LIT8(KErrorCode , "ErrorCode") ; |
|
59 |
|
60 |
|
61 /** |
|
62 * Operations on the IDatasource(Logging) interface |
|
63 */ |
|
64 _LIT8(KCmdAdd , "Add") ; |
|
65 _LIT8(KCmdDelete , "Delete") ; |
|
66 _LIT8(KCmdGetList ,"GetList") ; |
|
67 _LIT8(KCmdRequestNotification ,"RequestNotification") ; |
|
68 _LIT8(KCmdCancel ,"Cancel") ; |
|
69 |
|
70 |
|
71 /** |
|
72 * Transaction id, which will be part of outparamlist for asynchronous request |
|
73 */ |
|
74 _LIT8(KTransactionId, "TransactionID"); |
|
75 |
|
76 /** |
|
77 * Event map that contains the details of the event to be logged |
|
78 */ |
|
79 _LIT8(KEventDetails , "Item") ; |
|
80 |
|
81 /** |
|
82 * Filter for getlist operation |
|
83 */ |
|
84 _LIT8(KFilter , "Filter") ; |
|
85 |
|
86 /** |
|
87 * DelayInterval |
|
88 */ |
|
89 _LIT8(KDelayTime , "DelayTime") ; |
|
90 |
|
91 /** |
|
92 * Key for identifying the type of the event in event map |
|
93 */ |
|
94 _LIT8(KEventTypeKey , "EventType") ; |
|
95 |
|
96 /** |
|
97 * Key for identifying the remote party in event map |
|
98 */ |
|
99 _LIT8(KRemotePartyKey , "RemoteParty") ; |
|
100 |
|
101 /** |
|
102 * Key for identifying the direction in event map |
|
103 */ |
|
104 _LIT8(KDirectionKey , "Direction") ; |
|
105 |
|
106 /** |
|
107 * Key for identifying the time in event map |
|
108 */ |
|
109 _LIT8(KEventTimeKey , "EventTime") ; |
|
110 |
|
111 /** |
|
112 * Key for identifying the duration in event map |
|
113 */ |
|
114 _LIT8(KEventDurationKey , "EventDuration") ; |
|
115 |
|
116 /** |
|
117 * Key for identifying the deliverystatus in event map |
|
118 */ |
|
119 _LIT8(KDeliveryStatusKey , "DeliveryStatus") ; |
|
120 |
|
121 /** |
|
122 * Key for identifying the subject in event map |
|
123 */ |
|
124 _LIT8(KSubjectKey , "Subject") ; |
|
125 |
|
126 /** |
|
127 * Key for identifying the phonenumber in event map |
|
128 */ |
|
129 _LIT8(KPhoneNumberKey , "PhoneNumber") ; |
|
130 |
|
131 /** |
|
132 * Key for identifying the description in event map |
|
133 */ |
|
134 _LIT8(KDescriptionKey , "Description") ; |
|
135 |
|
136 /** |
|
137 * Key for identifying the eventdata in event map |
|
138 */ |
|
139 _LIT8(KEventDataKey , "EventData") ; |
|
140 |
|
141 /** |
|
142 * Key for identifying the link in event map |
|
143 */ |
|
144 _LIT8(KLinkKey , "Link") ; |
|
145 |
|
146 /** |
|
147 * Key for the flags fields |
|
148 */ |
|
149 _LIT8(KFlagsKey , "LogFlags") ; |
|
150 |
|
151 /** |
|
152 * EndTime Key, for getlist filter |
|
153 */ |
|
154 _LIT8(KEndTimeKey , "EndTime") ; |
|
155 |
|
156 /** |
|
157 * Error Code |
|
158 */ |
|
159 _LIT8(KErrCode , "ErrorCode") ; |
|
160 |
|
161 /** |
|
162 * Key for RecentList for Filter |
|
163 */ |
|
164 _LIT8(KRecentListKey , "RecentList") ; |
|
165 |
|
166 /** |
|
167 * Key for id |
|
168 */ |
|
169 _LIT8(KLogId , "id") ; |
|
170 |
|
171 /** |
|
172 * Key for Data Map |
|
173 */ |
|
174 _LIT8(KData , "Data") ; |
|
175 |
|
176 /** |
|
177 * output returnvalue key |
|
178 */ |
|
179 _LIT8(KResponse,"ReturnValue"); |
|
180 |
|
181 |
|
182 /** |
|
183 * Forward declarations |
|
184 */ |
|
185 class MLiwInterface ; |
|
186 class CLogIter ; |
|
187 |
|
188 /** |
|
189 * This class provides the Calendar SAPI interface to LIW Framework |
|
190 */ |
|
191 class CLoggingInterface : public CBase, public MLiwInterface |
|
192 { |
|
193 public : |
|
194 |
|
195 /** |
|
196 *Enums for position pased parsing |
|
197 */ |
|
198 enum |
|
199 { |
|
200 EIndex0 = 0 , |
|
201 EIndex1 , |
|
202 EIndex2 , |
|
203 EIndex3 , |
|
204 |
|
205 /** |
|
206 * Event Types |
|
207 */ |
|
208 EKLogCallEventType = 0, |
|
209 EKLogDataEventType , |
|
210 EKLogFaxEventType , |
|
211 EKLogShortMessageEventType , |
|
212 EKLogPacketDataEventType , |
|
213 EKEventTypeNotPresent =-1, |
|
214 /** |
|
215 * RecentList types |
|
216 */ |
|
217 EKLogNullRecentList = -1 , |
|
218 EKLogRecentIncomingCalls = 1, |
|
219 EKLogRecentOutgoingCalls , |
|
220 EKLogRecentMissedCalls , |
|
221 |
|
222 |
|
223 /** |
|
224 * Event Status |
|
225 */ |
|
226 |
|
227 EStatusPending = 0 , |
|
228 EStatusSent, |
|
229 EStatusFalied, |
|
230 EStatusNone , |
|
231 EStatusDone , |
|
232 EStatusNotSent, |
|
233 EStatusScheduled, |
|
234 EStatusNotPresent =-1, |
|
235 /** |
|
236 * Event Flags |
|
237 */ |
|
238 EKLogEventContactSearched = 0 , |
|
239 EKLogEventRead , |
|
240 EFlagNotPresent =-1, |
|
241 |
|
242 /** |
|
243 * Direction flags |
|
244 */ |
|
245 EIncomingEvent = 0, |
|
246 EOutgoingEvent , |
|
247 EIncomingEventAlternateline, |
|
248 EOutgoingEventAlternateline, |
|
249 EFetchedEvent , |
|
250 EMissedEvent , |
|
251 EMissedEventAlternateline, |
|
252 EDirectionNotPresent = -1, |
|
253 }; |
|
254 |
|
255 public: |
|
256 |
|
257 /** |
|
258 * NewL: Two phased construction |
|
259 */ |
|
260 static CLoggingInterface* NewL(); |
|
261 |
|
262 /** |
|
263 * NewLC: Creates an instance of CLoggingServiceClass |
|
264 * Two Phased constructor |
|
265 * returns newly allocated object. |
|
266 */ |
|
267 static CLoggingInterface* NewLC() ; |
|
268 |
|
269 /** |
|
270 * Destructor. |
|
271 */ |
|
272 virtual ~CLoggingInterface(); |
|
273 |
|
274 /** |
|
275 * ExecuteCmdL parses the input parameters and then calls an appropriate method on iLoggingServic |
|
276 * |
|
277 * @param aCmdName the name of the service command which the consumer wants to invoke |
|
278 * @param aInParamList the input parameter list, can be empty list |
|
279 * @param [in,out] aOutParamList the output parameter list, can be empty lis. The |
|
280 * service provider can use the output parameter list to fill in necessary return values |
|
281 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
282 * @param aCallback callback to be registered by consumer application |
|
283 * |
|
284 * @see TLiwServiceCmdOptions |
|
285 * @see CLiwGenericParamList |
|
286 * @see MLiwNotifyCallback |
|
287 */ |
|
288 |
|
289 virtual void ExecuteCmdL( const TDesC8& aCmdName, |
|
290 const CLiwGenericParamList& aInParamList, |
|
291 CLiwGenericParamList& aOutParamList, |
|
292 TUint aCmdOptions = 0, |
|
293 MLiwNotifyCallback* aCallback = 0 ); |
|
294 |
|
295 |
|
296 /** |
|
297 * ConvertToSapiError function |
|
298 */ |
|
299 static TInt ConvertToSapiError( TInt aSymbianErrorCode ); |
|
300 |
|
301 /** |
|
302 * Closes the interface |
|
303 */ |
|
304 virtual void Close(); |
|
305 |
|
306 protected: |
|
307 |
|
308 /** |
|
309 * ConstructL(): Internal method to construct members |
|
310 */ |
|
311 void ConstructL() ; |
|
312 |
|
313 /** |
|
314 * Default constructor |
|
315 */ |
|
316 CLoggingInterface() ; |
|
317 |
|
318 /** |
|
319 * Internal CmdExecute function which parses the input parameters |
|
320 * this function is called by ExecuteCmdL() function |
|
321 * |
|
322 * @param aCmdName the name of the service command which the consumer wants to invoke |
|
323 * @param aInParamList the input parameter list, can be empty list |
|
324 * @param [in,out] aOutParamList the output parameter list, can be empty lis. The |
|
325 * service provider can use the output parameter list to fill in necessary return values |
|
326 * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh. |
|
327 * @param aCallback callback to be registered by consumer application |
|
328 * @see TLiwServiceCmdOptions |
|
329 * @see CLiwGenericParamList |
|
330 * @see MLiwNotifyCallback |
|
331 * |
|
332 */ |
|
333 |
|
334 void CmdExecuteL( const TDesC8& aCmdName, |
|
335 const CLiwGenericParamList& aInParamList , |
|
336 CLiwGenericParamList& aOutParamList, |
|
337 TUint aCmdOptions, |
|
338 MLiwNotifyCallback* aCallback ); |
|
339 |
|
340 /** |
|
341 * Internal utility method, used for Add from the core class |
|
342 * |
|
343 * @param aParam, input paramater containg the eventdetails. |
|
344 * @param aCallback, callback address for notification requests. |
|
345 * @param aTransId, transaction id. |
|
346 */ |
|
347 |
|
348 TInt32 AddEventL( const TLiwGenericParam *eventdetails , |
|
349 TUint& aTansId , |
|
350 TUint aCmdOptions, |
|
351 MLiwNotifyCallback *aCallBack = NULL ) ; |
|
352 |
|
353 /** |
|
354 * Internal utility method, used to getlist from the core class |
|
355 * |
|
356 * @param aFilter, filter for getlist on core class |
|
357 * @param aIter, Valure result argument(TransactionId for async calls) |
|
358 * @param aCallback, callback method for async events |
|
359 */ |
|
360 |
|
361 CLogIter* GetListL( const TLiwGenericParam *aFilter , |
|
362 TUint& aTransId, |
|
363 TUint aCmdOptions, |
|
364 MLiwNotifyCallback *aCallBack = NULL) ; |
|
365 |
|
366 /** |
|
367 * Internal utility method, used for notification registration |
|
368 * |
|
369 * @param aParam, input paramater containg the delay details/ |
|
370 * @param aCallback, callback address for notification requests. |
|
371 * @param aTransId, transaction id. |
|
372 */ |
|
373 TInt RequestNotificationsL( const TLiwGenericParam *aParam , |
|
374 MLiwNotifyCallback *aCallback , |
|
375 TUint& aTransId, |
|
376 TUint aCmdOptions ) ; |
|
377 |
|
378 /** |
|
379 * Internal utility method, used for Delete from the core class |
|
380 * |
|
381 * @param aParam, input paramater containg the logid |
|
382 * @param aCallback, callback address for notification requests. |
|
383 * @param aTransId, transaction id. |
|
384 */ |
|
385 |
|
386 TInt DeleteEventL( const TLiwGenericParam *aParam, |
|
387 TUint& aTansId, |
|
388 TUint aCmdOptions, |
|
389 MLiwNotifyCallback *aCallBack = NULL ); |
|
390 |
|
391 /** |
|
392 * IncorrectValueL function |
|
393 */ |
|
394 void IncorrectValueL( const TDesC8* aErrorArgument ); |
|
395 |
|
396 /** |
|
397 * MissingValueL function |
|
398 */ |
|
399 void MissingValueL( const TDesC8* aErrorArgument ); |
|
400 |
|
401 /** |
|
402 * CheckInputTypeL function |
|
403 */ |
|
404 void CheckInputTypeL( const TLiwVariant* aSource, |
|
405 LIW::TVariantTypeId aExpectedtype, |
|
406 const TDesC8* aErrorArgument ); |
|
407 |
|
408 private: |
|
409 |
|
410 /** |
|
411 * Handle to core location class for performing location operations |
|
412 */ |
|
413 |
|
414 CLoggingService *iLogService ; |
|
415 |
|
416 /** |
|
417 * ErrorString |
|
418 */ |
|
419 |
|
420 HBufC16* iErrorString; |
|
421 |
|
422 }; |
|
423 |
|
424 |
|
425 #endif //C_LOGINTERFACE_H |