1 /* |
|
2 * Copyright (c) 2002-2009 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 module contains the implementation of CPELogEvent class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cpelogevent.h" |
|
21 #include "cpeloginfo.h" |
|
22 #include "cpeloghandling.h" |
|
23 #include "cpeloghandlingcommand.h" |
|
24 #include <talogger.h> |
|
25 #include <logcli.h> |
|
26 #include <LogsApiConsts.h> |
|
27 |
|
28 |
|
29 // EXTERNAL DATA STRUCTURES |
|
30 //None |
|
31 |
|
32 // EXTERNAL FUNCTION PROTOTYPES |
|
33 //None |
|
34 |
|
35 // CONSTANTS |
|
36 const TInt KPhonebookTypeIdLength = 11; |
|
37 |
|
38 // Defined in \s60\app\contacts\logsui\EngineIncLogsEngConsts.h as KLogEventALS |
|
39 const TLogFlags KPELogEventALS = 0x4; |
|
40 |
|
41 const TInt KOneChar = 1; |
|
42 |
|
43 // MACROS |
|
44 //None |
|
45 |
|
46 // LOCAL CONSTANTS AND MACROS |
|
47 //None |
|
48 |
|
49 // MODULE DATA STRUCTURES |
|
50 //None |
|
51 |
|
52 // LOCAL FUNCTION PROTOTYPES |
|
53 //None |
|
54 |
|
55 // FORWARD DECLARATIONS |
|
56 //None |
|
57 |
|
58 |
|
59 // ==================== LOCAL FUNCTIONS ===================================== |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CPELogEvent::NewL |
|
63 // Two-phased constructor. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CPELogEvent* CPELogEvent::NewL |
|
67 ( |
|
68 CPELogHandling& aOwner, // Owner of the object |
|
69 CPELogHandlingCommand& aLogHandlingCommand |
|
70 ) |
|
71 { |
|
72 TEFLOGSTRING(KTAOBJECT, "LOG CPELogEvent::NewL start."); |
|
73 CPELogEvent* self = new ( ELeave ) CPELogEvent( aOwner, aLogHandlingCommand ); |
|
74 CleanupStack::PushL( self ); |
|
75 self->ConstructL(); |
|
76 CleanupStack::Pop( self ); |
|
77 TEFLOGSTRING(KTAOBJECT, "LOG CPELogEvent::NewL complete."); |
|
78 return self; |
|
79 } |
|
80 |
|
81 // Destructor |
|
82 /***************************************************** |
|
83 * Series 60 Customer / LOGENG |
|
84 * Series 60 LOGENG API |
|
85 *****************************************************/ |
|
86 CPELogEvent::~CPELogEvent |
|
87 ( |
|
88 // None |
|
89 ) |
|
90 { |
|
91 TEFLOGSTRING( KTAOBJECT, "LOG CPELogEvent::~CPELogEvent()" ); |
|
92 delete iEvent; |
|
93 delete iLogInfo; |
|
94 } |
|
95 |
|
96 |
|
97 // ================= MEMBER FUNCTIONS ======================================= |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CPELogEvent::CPELogEvent |
|
100 // C++ default constructor can NOT contain any code, that |
|
101 // might leave. |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 CPELogEvent::CPELogEvent |
|
105 ( |
|
106 CPELogHandling& aOwner, |
|
107 CPELogHandlingCommand& aLogHandlingCommand |
|
108 ) : iOwner( aOwner ), |
|
109 iLogHandlingCommand( aLogHandlingCommand ), |
|
110 iCompleted( EFalse ), |
|
111 iAdded( EFalse ), |
|
112 iSaveLeave( EFalse ) |
|
113 { |
|
114 } |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CPELogEvent::ConstructL |
|
117 // Symbian 2nd phase constructor can leave. |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 /***************************************************** |
|
121 * Series 60 Customer / LOGENG |
|
122 * Series 60 LOGENG API |
|
123 *****************************************************/ |
|
124 void CPELogEvent::ConstructL |
|
125 ( |
|
126 // None |
|
127 ) |
|
128 { |
|
129 iEvent = CLogEvent::NewL(); |
|
130 ResetEvent( ); |
|
131 iLogInfo = CPELogInfo::NewL(); |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CPELogEvent::Save |
|
136 // Saves the event to the log. |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 void CPELogEvent::SaveL() |
|
140 { |
|
141 iSaveLeave = ETrue; |
|
142 // iCopleted flag must be set before the function leave as it is used |
|
143 // in log subsytem recovery procedure in case of leave. |
|
144 if ( EPEStateIdle == iLogInfo->CallState() || iLogInfo->ForcedCompletion() ) |
|
145 { |
|
146 iCompleted = ETrue; |
|
147 } |
|
148 |
|
149 if ( !iAdded ) |
|
150 { |
|
151 TEFLOGSTRING2( KTAINT, "LOG CPELogEvent::SaveL() > CPELogHandlingCommand::AddEvent(), callId=%d", iLogInfo->CallId() ); |
|
152 SetPhoneNumberId(); |
|
153 SetEventTypeL(); |
|
154 SetLogEvent(); |
|
155 SetDuration(); |
|
156 SetServiceIdL(); |
|
157 |
|
158 if ( &iLogInfo->ContactLink() ) |
|
159 { |
|
160 SetContactLinkL(); |
|
161 } |
|
162 // event under processing will always be of index 0 in the queued array |
|
163 User::LeaveIfError( iLogHandlingCommand.AddEvent( *iEvent ) ); |
|
164 } |
|
165 else |
|
166 { |
|
167 TEFLOGSTRING2( KTAINT, "LOG CPELogEvent::SaveL() > CPELogHandlingCommand::ChangeEvent(), callId=%d", iLogInfo->CallId() ); |
|
168 SetLogEvent(); |
|
169 SetDuration(); |
|
170 User::LeaveIfError( iLogHandlingCommand.ChangeEvent( *iEvent ) ); |
|
171 } |
|
172 // indicates no leave happened in Save function |
|
173 iSaveLeave = EFalse; |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CPELogEvent::UpdateLogInfo |
|
178 // Update log database entry. |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 void CPELogEvent::UpdateLogInfoL |
|
182 ( |
|
183 const CPELogInfo& aLogInfo // Call information |
|
184 ) |
|
185 { |
|
186 // CPELogHandling generic loginfo must be replicated to this event |
|
187 iLogInfo->CopyL( aLogInfo ); |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CPELogEvent::ResetLogInfo |
|
192 // Reset log info. |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 void CPELogEvent::ResetLogInfo() |
|
196 { |
|
197 TEFLOGSTRING( KTAINT, "LOG CPELogEvent::ResetLogInfo: start" ); |
|
198 iLogInfo->Reset(); |
|
199 TEFLOGSTRING( KTAINT, "LOG CPELogEvent::ResetLogInfo: complete" ); |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CPELogEvent::ResetEvent |
|
204 // Reset event on the idle state. |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 /***************************************************** |
|
208 * Series 60 Customer / LOGENG |
|
209 * Series 60 LOGENG API |
|
210 *****************************************************/ |
|
211 void CPELogEvent::ResetEvent() |
|
212 { |
|
213 iAdded = EFalse; |
|
214 iCompleted = EFalse; |
|
215 iSaveLeave = EFalse; |
|
216 |
|
217 // CLogEvent -variables |
|
218 iEvent->SetId( KLogNullId ); |
|
219 iEvent->SetEventType( KNullUid ); |
|
220 iEvent->SetRemoteParty( KNullDesC ); |
|
221 iEvent->SetDirection( KNullDesC ); |
|
222 iEvent->SetTime( Time::NullTTime() ); |
|
223 iEvent->SetDurationType( KLogNullDurationType ); |
|
224 iEvent->SetDuration( KLogNullDuration ); |
|
225 iEvent->SetStatus( KNullDesC ); |
|
226 iEvent->SetSubject( KNullDesC ); |
|
227 iEvent->SetNumber( KNullDesC ); |
|
228 iEvent->SetContact( KNullContactId ); |
|
229 iEvent->SetLink( KLogNullLink ); |
|
230 iEvent->SetDescription( KNullDesC ); |
|
231 iEvent->ClearFlags( KLogFlagsMask ); |
|
232 TRAPD( error, iEvent->SetDataL( KNullDesC8 ) ); |
|
233 if ( error != KErrNone ) |
|
234 { |
|
235 // SetDataL leave should not cause log subsystem to fail. Just log the error. |
|
236 TEFLOGSTRING2( KTAERROR, "LOG CPELogEvent::Save()>CPELogHandlingCommand::ResetEvent(), error=%d", error ); |
|
237 } |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CPELogEvent::CallId |
|
242 // Get call id of the event. |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 TInt CPELogEvent::CallId |
|
246 ( |
|
247 // None |
|
248 ) |
|
249 { |
|
250 return iLogInfo->CallId(); |
|
251 } |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CPELogEvent::IsCompleted |
|
255 // Returns flag if the entry has been completed, ie. no further updates are expected |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 TBool CPELogEvent::IsCompleted |
|
259 ( |
|
260 // None |
|
261 ) |
|
262 { |
|
263 return iCompleted; |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CPELogEvent::Added |
|
268 // iAdded flag is set to ETrue |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 void CPELogEvent::SetAdded |
|
272 ( |
|
273 // None |
|
274 ) |
|
275 { |
|
276 iAdded = ETrue; |
|
277 } |
|
278 |
|
279 // ----------------------------------------------------------------------------- |
|
280 // CPELogEvent::SaveLeave |
|
281 // Return value of save leave flag |
|
282 // ----------------------------------------------------------------------------- |
|
283 // |
|
284 TBool CPELogEvent::SaveLeave |
|
285 ( |
|
286 // None |
|
287 ) |
|
288 { |
|
289 return iSaveLeave; |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // CPELogEvent::SetPhoneNumberId |
|
294 // Set event subject. |
|
295 // ----------------------------------------------------------------------------- |
|
296 // |
|
297 /***************************************************** |
|
298 * Series 60 Customer / LOGENG |
|
299 * Series 60 LOGENG API |
|
300 *****************************************************/ |
|
301 void CPELogEvent::SetPhoneNumberId() |
|
302 { |
|
303 TBuf<KPhonebookTypeIdLength> subject; |
|
304 subject.Zero(); |
|
305 |
|
306 switch ( iLogInfo->PhoneNumberId() ) |
|
307 { |
|
308 case EPEMobileNumber: |
|
309 subject.AppendNum( EPEUnknownNumber ); |
|
310 break; |
|
311 case EPETelephoneNumber: |
|
312 subject.AppendNum( EPEUnknownNumber ); |
|
313 break; |
|
314 case EPEPager: |
|
315 subject.AppendNum( EPEUnknownNumber ); |
|
316 break; |
|
317 case EPEFaxNumber: |
|
318 subject.AppendNum( EPEUnknownNumber ); |
|
319 break; |
|
320 case EPEAssistantNumber: |
|
321 subject.AppendNum( EPEUnknownNumber); |
|
322 break; |
|
323 case EPECarNumber: |
|
324 subject.AppendNum( EPEUnknownNumber); |
|
325 break; |
|
326 default: |
|
327 subject.AppendNum( EPEUnknownNumber ); |
|
328 break; |
|
329 } |
|
330 |
|
331 if ( subject.Length() > 0 ) |
|
332 { |
|
333 iEvent->SetSubject( subject ); |
|
334 } |
|
335 } |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CPEGsmLogsEntry::SetEventType |
|
339 // Set event type. |
|
340 // ----------------------------------------------------------------------------- |
|
341 // |
|
342 /***************************************************** |
|
343 * Series 60 Customer / LOGENG |
|
344 * Series 60 LOGENG API |
|
345 *****************************************************/ |
|
346 void CPELogEvent::SetEventTypeL() |
|
347 { |
|
348 switch ( iLogInfo->EventType() ) |
|
349 { |
|
350 case CPELogInfo::EPEVoiceEvent: |
|
351 |
|
352 { |
|
353 iEvent->SetEventType( KLogCallEventTypeUid ); |
|
354 } |
|
355 break; |
|
356 case CPELogInfo::EPEVideoCallEvent: |
|
357 { |
|
358 iEvent->SetEventType( KLogCallEventTypeUid ); |
|
359 iEvent->SetDataL( KLogsDataFldTag_VT ); |
|
360 TEFLOGSTRING( KTAINT, "LOG CPELogEvent::SetEventTypeL() video" ); |
|
361 } |
|
362 break; |
|
363 case CPELogInfo::EPEEmergecyEvent: |
|
364 { |
|
365 iEvent->SetEventType( KLogCallEventTypeUid ); |
|
366 iEvent->SetDataL( KLogsDataFldTag_Emergency ); |
|
367 TEFLOGSTRING( KTAINT, "LOG CPELogEvent::SetEventTypeK() Emergecy" ); |
|
368 } |
|
369 break; |
|
370 case CPELogInfo::EPEVoIPEvent: |
|
371 { |
|
372 iEvent->SetEventType( KLogCallEventTypeUid ); |
|
373 iEvent->SetDataL( KLogsDataFldTag_IP ); |
|
374 TEFLOGSTRING( KTAINT, "LOG CPELogEvent::SetEventTypeL() VoIP" ); |
|
375 } |
|
376 break; |
|
377 case CPELogInfo::EPEUnknownEvent: |
|
378 default: |
|
379 { |
|
380 iEvent->SetEventType( KLogCallEventTypeUid ); |
|
381 } |
|
382 break; |
|
383 } |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CPELogEvent::SetLogEvent |
|
388 // Set the rest of event information. |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 /***************************************************** |
|
392 * Series 60 Customer / LOGENG |
|
393 * Series 60 LOGENG API |
|
394 *****************************************************/ |
|
395 void CPELogEvent::SetLogEvent() |
|
396 { |
|
397 if( CCCECallParameters::ECCELineTypeAux == iLogInfo->CurrentLine() ) |
|
398 { |
|
399 iEvent->SetFlags( KPELogEventALS ); |
|
400 } |
|
401 if ( RMobileCall::EMobileOriginated == iLogInfo->CallDirection() ) |
|
402 { |
|
403 if ( CCCECallParameters::ECCELineTypeAux == iLogInfo->CurrentLine() ) |
|
404 { |
|
405 iEvent->SetDirection( iOwner.LogStringOutAlt( ) ); |
|
406 } |
|
407 else |
|
408 { |
|
409 iEvent->SetDirection( iOwner.LogStringOut( ) ); |
|
410 } |
|
411 } |
|
412 else if ( RMobileCall::EMobileTerminated == iLogInfo->CallDirection() ) |
|
413 { |
|
414 if ( iLogInfo->MissedCall() && EPEStateIdle == iLogInfo->CallState() ) |
|
415 { |
|
416 iEvent->SetDirection( iOwner.LogStringMissed( ) ); |
|
417 } |
|
418 else |
|
419 //Logging on states Connected and Idle |
|
420 { |
|
421 if ( CCCECallParameters::ECCELineTypeAux == iLogInfo->CurrentLine() ) |
|
422 { |
|
423 iEvent->SetDirection( iOwner.LogStringInAlt( ) ); |
|
424 } |
|
425 else |
|
426 { |
|
427 iEvent->SetDirection( iOwner.LogStringIn( ) ); |
|
428 } |
|
429 } |
|
430 } |
|
431 |
|
432 SetRemoteParty( *iEvent, *iLogInfo ); |
|
433 iEvent->SetStatus( iOwner.LogStringDelivery( ) ); |
|
434 |
|
435 SetRemoteContact( *iEvent, *iLogInfo ); |
|
436 |
|
437 if ( KNullDesC() != iLogInfo->MyAddress() ) |
|
438 { |
|
439 TRAPD( error, SetDataFieldL( KLogsDataFldTag_MA, iLogInfo->MyAddress() ) ); |
|
440 if ( error ) |
|
441 { |
|
442 TEFLOGSTRING2( KTAERROR, |
|
443 "LOG CPELogEvent::SetLogEvent()>SetDataFieldL(), error=%d", |
|
444 error ) |
|
445 } |
|
446 } |
|
447 } |
|
448 |
|
449 |
|
450 // ----------------------------------------------------------------------------- |
|
451 // CPELogEvent::SetDuration |
|
452 // Set the event duration |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 /***************************************************** |
|
456 * Series 60 Customer / LOGENG |
|
457 * Series 60 LOGENG API |
|
458 *****************************************************/ |
|
459 void CPELogEvent::SetDuration() |
|
460 { |
|
461 iEvent->SetDurationType( KLogDurationValid ); |
|
462 iEvent->SetDuration( static_cast <TLogDuration> ( iLogInfo->Duration().Int() ) ); |
|
463 |
|
464 #ifdef _DEBUG |
|
465 if ( EPEStateIdle == iLogInfo->CallState() ) |
|
466 { |
|
467 // debug logging of the event start time. |
|
468 TBuf<KPEESDWFormattedTimeLength> formattedTime; |
|
469 formattedTime.Zero(); |
|
470 TRAPD( error, iEvent->Time().FormatL( formattedTime, KPEESDWTimeFormat ) ); |
|
471 if( error == KErrNone ) |
|
472 { |
|
473 TEFLOGSTRING2( KTAINT, "LOG CPELogEvent::SetDuration() Idle state > formattedTime: %S", &formattedTime ); |
|
474 } |
|
475 else |
|
476 { |
|
477 TEFLOGSTRING( KTAERROR, "LOG CPELogEvent::SetDuration() Idle state > time conversion failed!"); |
|
478 } |
|
479 } |
|
480 #endif // _DEBUG |
|
481 } |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // CPELogEvent::SetServiceIdL |
|
485 // Set callers service id to log event. |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 void CPELogEvent::SetServiceIdL() |
|
489 { |
|
490 HBufC8* eventData = NULL; |
|
491 if ( iEvent->Data().Length() ) |
|
492 { |
|
493 // There are existing data logged. |
|
494 eventData = HBufC8::NewLC( iEvent->Data().Length() |
|
495 + KLogsDataFldNameDelimiter().Length() // separator |
|
496 + KLogsDataFldTag_ServiceId().Length() |
|
497 + KLogsDataFldValueDelimiter().Length() |
|
498 + KTUintCharLength ); |
|
499 |
|
500 // Copy existing data to temp buffer. |
|
501 eventData->Des().Copy( iEvent->Data() ); |
|
502 |
|
503 // Append tag separator. |
|
504 eventData->Des().Append( KLogsDataFldNameDelimiter ); |
|
505 } |
|
506 else |
|
507 { |
|
508 // No existing data logged. |
|
509 eventData = HBufC8::NewLC( |
|
510 KLogsDataFldTag_ServiceId().Length() |
|
511 + KLogsDataFldValueDelimiter().Length() |
|
512 + KTUintCharLength ); |
|
513 } |
|
514 |
|
515 // Append service id |
|
516 eventData->Des().Append( KLogsDataFldTag_ServiceId ); |
|
517 eventData->Des().Append( KLogsDataFldValueDelimiter ); |
|
518 eventData->Des().AppendNum( (TInt)iLogInfo->ServiceId() ); |
|
519 |
|
520 iEvent->SetDataL( *eventData ); |
|
521 TEFLOGSTRING( KTAINT, "LOG CPELogEvent::SetServiceIdL() Service id set ok" ); |
|
522 CleanupStack::PopAndDestroy( eventData ); |
|
523 } |
|
524 |
|
525 // ----------------------------------------------------------------------------- |
|
526 // Sets callers contact link to log event. |
|
527 // Contact link data might accidentally contain "\t"(KLogsDataFldNameDelimiter), |
|
528 // because of this, those "accidents" are stuffed with another "\t". They are |
|
529 // removed in logs handling side when data is read in. |
|
530 // ----------------------------------------------------------------------------- |
|
531 // |
|
532 void CPELogEvent::SetContactLinkL() |
|
533 { |
|
534 HBufC8* eventData = NULL; |
|
535 |
|
536 TPtrC8 pDelimiter( iLogInfo->ContactLink() ); |
|
537 TInt delimiterCount = 0; |
|
538 // Check how many "delimiters" data contains so that we can |
|
539 // reserve space for data duplication |
|
540 while ( KErrNotFound != pDelimiter.Find( KLogsDataFldNameDelimiter ) ) |
|
541 { |
|
542 // Skip first \t to see if there exists another one after that |
|
543 pDelimiter.Set( pDelimiter.Mid( pDelimiter.Find( KLogsDataFldNameDelimiter ) + KOneChar ) ); |
|
544 ++delimiterCount; |
|
545 } |
|
546 if ( iEvent->Data().Length() ) |
|
547 { |
|
548 // There is previous data logged |
|
549 eventData = HBufC8::NewLC( |
|
550 iEvent->Data().Length() |
|
551 + KLogsDataFldNameDelimiter().Length() // separator |
|
552 + KLogsDataFldTag_ContactLink().Length() |
|
553 + KLogsDataFldValueDelimiter().Length() |
|
554 + iLogInfo->ContactLink().Length() |
|
555 + delimiterCount ); |
|
556 |
|
557 // Copy previous data to temp buffer |
|
558 eventData->Des().Copy( iEvent->Data() ); |
|
559 |
|
560 // Append tag separator |
|
561 eventData->Des().Append( KLogsDataFldNameDelimiter ); |
|
562 } |
|
563 else |
|
564 { |
|
565 // No previous data logged. |
|
566 eventData = HBufC8::NewLC( |
|
567 KLogsDataFldTag_ContactLink().Length() |
|
568 + KLogsDataFldValueDelimiter().Length() |
|
569 + iLogInfo->ContactLink().Length() |
|
570 + delimiterCount ); |
|
571 } |
|
572 |
|
573 TPtr8 eventDataPtr( eventData->Des() ); |
|
574 eventDataPtr.Append( KLogsDataFldTag_ContactLink ); |
|
575 eventDataPtr.Append( KLogsDataFldValueDelimiter ); |
|
576 |
|
577 if ( delimiterCount ) |
|
578 { |
|
579 // Link data contained unintended \t chars |
|
580 TPtrC8 linkPtr( iLogInfo->ContactLink() ); |
|
581 TInt dataLength = 0; |
|
582 // Copy link data between \t chars |
|
583 for ( TInt i = 0; i < delimiterCount; i++ ) |
|
584 { |
|
585 // Plus one because we need length, not offset |
|
586 dataLength = linkPtr.Find( KLogsDataFldNameDelimiter ) + KOneChar; |
|
587 // Append from beginning of data, including \t |
|
588 eventDataPtr.Append( linkPtr.Left( dataLength ) ); |
|
589 // Add another \t |
|
590 eventDataPtr.Append( KLogsDataFldNameDelimiter ); |
|
591 linkPtr.Set( linkPtr.Mid( dataLength ) ); |
|
592 } |
|
593 // Copy rest of link data |
|
594 eventDataPtr.Append( linkPtr ); |
|
595 } |
|
596 else |
|
597 { |
|
598 // Link data didn't contain \t, so normal copy is possible |
|
599 eventDataPtr.Append( iLogInfo->ContactLink() ); |
|
600 } |
|
601 |
|
602 iEvent->SetDataL( *eventData ); |
|
603 TEFLOGSTRING( KTAINT, "LOG CPELogEvent::ContactLinkL() Contact link set ok" ); |
|
604 CleanupStack::PopAndDestroy( eventData ); |
|
605 } |
|
606 |
|
607 // ----------------------------------------------------------------------------- |
|
608 // CPELogEvent::SetDataFieldL |
|
609 // ----------------------------------------------------------------------------- |
|
610 // |
|
611 void CPELogEvent::SetDataFieldL( const TDesC8& aTag, const TDesC& aFieldData ) |
|
612 { |
|
613 __ASSERT_ALWAYS( aTag.Length() != 0 && aFieldData.Length() != 0 , |
|
614 User::Leave( KErrArgument ) ); |
|
615 |
|
616 if ( KErrNotFound == iEvent->Data().Find( aTag ) ) |
|
617 { |
|
618 HBufC8* eventData = NULL; |
|
619 const TInt fieldLength = aTag.Length() |
|
620 + KLogsDataFldValueDelimiter().Length() |
|
621 + aFieldData.Length(); |
|
622 const TInt oldDataFieldLength = iEvent->Data().Length(); |
|
623 |
|
624 if ( oldDataFieldLength != 0 ) |
|
625 { |
|
626 const TInt newDataFieldLength = oldDataFieldLength |
|
627 + KLogsDataFldNameDelimiter().Length() |
|
628 + fieldLength; |
|
629 |
|
630 eventData = HBufC8::NewLC( newDataFieldLength ); |
|
631 |
|
632 // Copy previous data |
|
633 eventData->Des().Copy( iEvent->Data() ); |
|
634 eventData->Des().Append( KLogsDataFldNameDelimiter ); |
|
635 } |
|
636 else |
|
637 { |
|
638 eventData = HBufC8::NewLC( fieldLength ); |
|
639 } |
|
640 |
|
641 // Add a new data field. |
|
642 eventData->Des().Append( aTag ); |
|
643 eventData->Des().Append( KLogsDataFldValueDelimiter ); |
|
644 eventData->Des().Append( aFieldData ); |
|
645 iEvent->SetDataL( *eventData ); |
|
646 |
|
647 CleanupStack::PopAndDestroy( eventData ); |
|
648 } |
|
649 } |
|
650 |
|
651 // ----------------------------------------------------------------------------- |
|
652 // CPELogEvent::SetRemoteParty |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 void CPELogEvent::SetRemoteParty( CLogEvent& aEvent, |
|
656 const CPELogInfo& aLogInfo ) |
|
657 { |
|
658 if ( KNullDesC() != aLogInfo.Name() ) |
|
659 { |
|
660 aEvent.SetRemoteParty( aLogInfo.Name() ); |
|
661 } |
|
662 } |
|
663 |
|
664 |
|
665 // ----------------------------------------------------------------------------- |
|
666 // CPELogEvent::SetRemoteContact |
|
667 // ----------------------------------------------------------------------------- |
|
668 // |
|
669 void CPELogEvent::SetRemoteContact( CLogEvent& aEvent, |
|
670 const CPELogInfo& aLogInfo ) |
|
671 { |
|
672 if ( KNullDesC() != aLogInfo.PhoneNumber() ) |
|
673 { |
|
674 aEvent.SetNumber( aLogInfo.PhoneNumber() ); |
|
675 } |
|
676 |
|
677 if ( KNullDesC() != aLogInfo.VoipAddress() ) |
|
678 { |
|
679 TRAPD( error, SetDataFieldL( KLogsDataFldTag_URL, aLogInfo.VoipAddress() ) ); |
|
680 if ( error ) |
|
681 { |
|
682 TEFLOGSTRING2( KTAERROR, |
|
683 "LOG CPELogEvent::SetLogEvent()>SetDataFieldL(), error=%d", error ) |
|
684 } |
|
685 } |
|
686 } |
|
687 |
|
688 |
|
689 // ================= OTHER EXPORTED FUNCTIONS =============================== |
|
690 |
|
691 // End of File |
|
692 |
|