|
1 /* |
|
2 * Copyright (c) 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: Implementation of SIM card contacts handling using the new |
|
15 * Virtual Phonebook API |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "HtiSimDirHandler.h" |
|
21 #include "HtiPIMServicePlugin.h" |
|
22 |
|
23 #include <HtiDispatcherInterface.h> |
|
24 #include <HtiLogging.h> |
|
25 |
|
26 #include <mmtsy_names.h> |
|
27 #include <mpbutil.h> |
|
28 // EXTERNAL DATA STRUCTURES |
|
29 |
|
30 // EXTERNAL FUNCTION PROTOTYPES |
|
31 |
|
32 // CONSTANTS |
|
33 const TInt KSimInfoResponseLength = 12; |
|
34 const TInt KOneSimContactBufferSize = 512; |
|
35 // MACROS |
|
36 // LOCAL CONSTANTS AND MACROS |
|
37 _LIT8( KErrorUnrecognizedCommand, "Unrecognized command" ); |
|
38 _LIT8( KErrorInvalidParameters, "Invalid command parameters" ); |
|
39 _LIT8( KErrorImportFailed, "Contact import failed" ); |
|
40 _LIT8( KErrorDeleteFailed, "Failed to delete contact" ); |
|
41 _LIT8( KErrorSimCardInfoFailed, "Failed to get SIM card info" ); |
|
42 _LIT8( KErrorFieldNotSupported, "Field is not supported"); |
|
43 _LIT8( KErrorFieldTooBig, "Filed is too long"); |
|
44 //_LIT8( KErrorSimStoreOpenFailed, "Failed to open SIM contact store" ); |
|
45 //_LIT8( KErrorSimStoreUnavailable, "SIM contact store unavailable" ); |
|
46 //_LIT8( KErrorContactOperationFailed, "SIM contact operation failed" ); |
|
47 |
|
48 // MODULE DATA STRUCTURES |
|
49 |
|
50 // LOCAL FUNCTION PROTOTYPES |
|
51 |
|
52 // FORWARD DECLARATIONS |
|
53 |
|
54 // ============================ MEMBER FUNCTIONS =============================== |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CHtiSimDirHandler::NewL |
|
58 // Two-phased constructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 CHtiSimDirHandler* CHtiSimDirHandler::NewL() |
|
61 { |
|
62 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::NewL" ); |
|
63 CHtiSimDirHandler* self = new (ELeave) CHtiSimDirHandler(); |
|
64 CleanupStack::PushL(self); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop(); |
|
67 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::NewL" ); |
|
68 return self; |
|
69 } |
|
70 |
|
71 // ---------------------------------------------------------------------------- |
|
72 // CHtiSimDirHandler::CHtiSimDirHandler |
|
73 // C++ default constructor can NOT contain any code, that |
|
74 // might leave. |
|
75 // ---------------------------------------------------------------------------- |
|
76 CHtiSimDirHandler::CHtiSimDirHandler() : |
|
77 iIsBusy(EFalse), iStoreIsOpen(EFalse) |
|
78 { |
|
79 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::CHtiSimDirHandler" ); |
|
80 |
|
81 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::CHtiSimDirHandler" ); |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CHtiSimDirHandler::~CHtiSimDirHandler |
|
86 // Destructor. |
|
87 // ----------------------------------------------------------------------------- |
|
88 CHtiSimDirHandler::~CHtiSimDirHandler() |
|
89 { |
|
90 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::~CHtiSimDirHandler" ); |
|
91 iEtelStore.Close(); |
|
92 iEtelPhone.Close(); |
|
93 iEtelServer.Close(); |
|
94 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::~CHtiSimDirHandler" ); |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CHtiSimDirHandler::ConstructL |
|
99 // Symbian 2nd phase constructor can leave. |
|
100 // ----------------------------------------------------------------------------- |
|
101 void CHtiSimDirHandler::ConstructL() |
|
102 { |
|
103 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::ConstructL" ); |
|
104 |
|
105 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::ConstructL" ); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CHtiSimDirHandler::SetDispatcher |
|
110 // Sets the dispatcher pointer. |
|
111 // ----------------------------------------------------------------------------- |
|
112 |
|
113 void CHtiSimDirHandler::SetDispatcher(MHtiDispatcher* aDispatcher) |
|
114 { |
|
115 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SetDispatcher" ); |
|
116 iDispatcher = aDispatcher; |
|
117 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SetDispatcher" ); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CHtiSimDirHandler::ProcessMessageL |
|
122 // Parses the received message and calls handler functions. |
|
123 // ----------------------------------------------------------------------------- |
|
124 void CHtiSimDirHandler::ProcessMessageL(const TDesC8& aMessage, |
|
125 THtiMessagePriority /*aPriority*/) |
|
126 { |
|
127 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::ProcessMessageL" ); |
|
128 |
|
129 if (iStoreIsOpen == EFalse) |
|
130 { |
|
131 User::LeaveIfError(iEtelServer.Connect()); |
|
132 User::LeaveIfError(iEtelServer.LoadPhoneModule(KMmTsyModuleName)); |
|
133 User::LeaveIfError(iEtelPhone.Open(iEtelServer, KMmTsyPhoneName)); |
|
134 User::LeaveIfError(iEtelStore.Open(iEtelPhone, KETelIccAdnPhoneBook)); |
|
135 HTI_LOG_TEXT( "SIM card open" ); |
|
136 iStoreIsOpen = ETrue; |
|
137 } |
|
138 |
|
139 if (iIsBusy) |
|
140 { |
|
141 HTI_LOG_TEXT( "HtiSimDirHandler is busy - leaving" ); |
|
142 User::Leave(KErrInUse); |
|
143 } |
|
144 |
|
145 // Will be set to EFalse in the SendOkMsgL or SendErrorMessageL methods. |
|
146 iIsBusy = ETrue; |
|
147 |
|
148 // Zero legth of aMessage tested already in CHtiPIMServicePlugin. |
|
149 // Other sanity checks must be done here. |
|
150 TInt err = KErrNone; |
|
151 TUint8 command = aMessage.Ptr()[0]; |
|
152 switch (command) |
|
153 { |
|
154 case CHtiPIMServicePlugin::ESimCardInfo: |
|
155 { |
|
156 TRAP(err ,HandleSimCardInfoL(aMessage.Right(aMessage.Length() - 1))); |
|
157 break; |
|
158 } |
|
159 case CHtiPIMServicePlugin::EImportSimContact: |
|
160 { |
|
161 TRAP(err ,HandleSimContactImportL(aMessage.Right(aMessage.Length() - 1))); |
|
162 break; |
|
163 } |
|
164 case CHtiPIMServicePlugin::EDeleteSimContact: |
|
165 { |
|
166 TRAP(err ,HandleSimContactDeleteL(aMessage.Right(aMessage.Length() - 1))); |
|
167 break; |
|
168 } |
|
169 default: |
|
170 { |
|
171 SendErrorMessageL(KErrArgument, KErrorUnrecognizedCommand); |
|
172 return; |
|
173 } |
|
174 } |
|
175 |
|
176 if (err != KErrNone) |
|
177 { |
|
178 iIsBusy = EFalse; |
|
179 User::Leave(err); |
|
180 } |
|
181 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::ProcessMessageL" ); |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // CHtiSimDirHandler::IsBusy |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 TBool CHtiSimDirHandler::IsBusy() |
|
189 { |
|
190 return iIsBusy; |
|
191 } |
|
192 |
|
193 // ---------------------------------------------------------------------------- |
|
194 // CHtiSimDirHandler::HandleSimCardInfoL |
|
195 // Gets information about the SIM card. |
|
196 // ---------------------------------------------------------------------------- |
|
197 void CHtiSimDirHandler::HandleSimCardInfoL(const TDesC8& aData) |
|
198 { |
|
199 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimCardInfoL" ); |
|
200 if (aData.Length() != 0) |
|
201 { |
|
202 HTI_LOG_TEXT( "CHtiSimDirHandler: wrong length of data" ); |
|
203 SendErrorMessageL(KErrArgument, KErrorInvalidParameters); |
|
204 return; |
|
205 } |
|
206 |
|
207 RMobilePhoneBookStore::TMobilePhoneBookInfoV5 etelStoreInfo; |
|
208 RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg etelStoreInfoPckg(etelStoreInfo); |
|
209 |
|
210 TRequestStatus requestStatus; |
|
211 iEtelStore.GetInfo(requestStatus, (TDes8&) etelStoreInfoPckg); |
|
212 User::WaitForRequest(requestStatus); |
|
213 if (requestStatus.Int() != KErrNone) |
|
214 { |
|
215 HTI_LOG_TEXT( "CHtiSimDirHandler: Failed to get SIM card info" ); |
|
216 SendErrorMessageL(requestStatus.Int(), KErrorSimCardInfoFailed); |
|
217 return; |
|
218 } |
|
219 |
|
220 // Create and send response message |
|
221 TBuf8<KSimInfoResponseLength> reply; |
|
222 reply.Append(etelStoreInfo.iMaxSecondNames > 0 ? etelStoreInfo.iMaxSecondNames : 0); |
|
223 reply.Append(etelStoreInfo.iMaxAdditionalNumbers > 0 ? etelStoreInfo.iMaxAdditionalNumbers : 0); |
|
224 reply.Append(etelStoreInfo.iMaxEmailAddr > 0 ? etelStoreInfo.iMaxEmailAddr : 0); |
|
225 reply.Append(etelStoreInfo.iMaxTextLength > 0 ? etelStoreInfo.iMaxTextLength : 0); |
|
226 reply.Append(etelStoreInfo.iMaxNumLength > 0 ? etelStoreInfo.iMaxNumLength : 0); |
|
227 reply.Append(etelStoreInfo.iMaxTextLengthSecondName > 0 ? |
|
228 etelStoreInfo.iMaxTextLengthSecondName : 0); |
|
229 reply.Append(etelStoreInfo.iMaxNumLengthAdditionalNumber > 0? |
|
230 etelStoreInfo.iMaxNumLengthAdditionalNumber : 0); |
|
231 reply.Append(etelStoreInfo.iMaxTextLengthEmailAddr > 0 ? etelStoreInfo.iMaxTextLengthEmailAddr : 0); |
|
232 reply.Append( ( TUint8* ) ( &etelStoreInfo.iTotalEntries ), 2 ); |
|
233 reply.Append( ( TUint8* ) ( &etelStoreInfo.iUsedEntries ), 2 ); |
|
234 SendOkMsgL(reply); |
|
235 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimCardInfoL" ); |
|
236 } |
|
237 |
|
238 // ---------------------------------------------------------------------------- |
|
239 // CHtiSimDirHandler::HandleSimContactImportL |
|
240 // Imports the contact to SIM card. |
|
241 // ---------------------------------------------------------------------------- |
|
242 void CHtiSimDirHandler::HandleSimContactImportL(const TDesC8& aData) |
|
243 { |
|
244 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimContactImportL" ); |
|
245 |
|
246 if(CheckImportMsg(aData) == EFalse) |
|
247 { |
|
248 return; |
|
249 } |
|
250 |
|
251 RBuf8 buffer; |
|
252 buffer.CreateL(KOneSimContactBufferSize); |
|
253 CleanupClosePushL(buffer); |
|
254 CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer(); |
|
255 CleanupStack::PushL(pbBuffer); |
|
256 pbBuffer->Set(&buffer); |
|
257 |
|
258 //add new enty tag |
|
259 User::LeaveIfError(pbBuffer->AddNewEntryTag()); |
|
260 |
|
261 TInt offset = 0; |
|
262 TInt fieldCount = aData[offset]; |
|
263 offset++; |
|
264 |
|
265 for (TInt i = 0; i < fieldCount; i++) |
|
266 { |
|
267 HTI_LOG_FORMAT( "Processing field %d", i + 1 ); |
|
268 |
|
269 TContactFieldType type = (TContactFieldType) aData[offset]; |
|
270 offset++; |
|
271 TInt fieldLength = aData[offset]; |
|
272 offset++; |
|
273 HBufC* fieldData = HBufC::NewLC(fieldLength); |
|
274 fieldData->Des().Copy(aData.Mid(offset, fieldLength)); |
|
275 switch (type) |
|
276 { |
|
277 case ENameField: |
|
278 User::LeaveIfError(pbBuffer->PutTagAndValue( |
|
279 RMobilePhoneBookStore::ETagPBText, fieldData->Des())); |
|
280 break; |
|
281 case ESecondNameField: |
|
282 User::LeaveIfError(pbBuffer->PutTagAndValue( |
|
283 RMobilePhoneBookStore::ETagPBSecondName, |
|
284 fieldData->Des())); |
|
285 break; |
|
286 case EPhoneNumberField: |
|
287 User::LeaveIfError( |
|
288 pbBuffer->PutTagAndValue( |
|
289 RMobilePhoneBookStore::ETagPBNumber, |
|
290 fieldData->Des())); |
|
291 break; |
|
292 case EEMailField: |
|
293 User::LeaveIfError(pbBuffer->PutTagAndValue( |
|
294 RMobilePhoneBookStore::ETagPBEmailAddress, |
|
295 fieldData->Des())); |
|
296 break; |
|
297 case EAdditNumberField: |
|
298 User::LeaveIfError(pbBuffer->AddNewNumberTag()); |
|
299 User::LeaveIfError( |
|
300 pbBuffer->PutTagAndValue( |
|
301 RMobilePhoneBookStore::ETagPBNumber, |
|
302 fieldData->Des())); |
|
303 break; |
|
304 default: |
|
305 HTI_LOG_FORMAT( "Unknown field type %d", type ); |
|
306 User::Leave(KErrArgument); |
|
307 break; |
|
308 } |
|
309 CleanupStack::PopAndDestroy(); // fieldData |
|
310 offset += fieldLength; |
|
311 } |
|
312 |
|
313 // save contact into sim card |
|
314 TInt index = -1; |
|
315 TRequestStatus status; |
|
316 //store the entry in the first free location and then return |
|
317 //this location within index when it completes the request |
|
318 iEtelStore.Write(status, buffer, index); |
|
319 User::WaitForRequest(status); |
|
320 if(status.Int() != KErrNone) |
|
321 { |
|
322 HTI_LOG_TEXT("Failed to add SIM contact"); |
|
323 SendErrorMessageL( status.Int(), KErrorImportFailed ); |
|
324 } |
|
325 else |
|
326 { |
|
327 HTI_LOG_TEXT( "SIM contact added" ); |
|
328 TBuf8<4> idBuf; |
|
329 idBuf.Append( ( TUint8* ) &index, 4 ); |
|
330 SendOkMsgL( idBuf ); |
|
331 } |
|
332 CleanupStack::PopAndDestroy(2); // buffer, pbBuffer |
|
333 |
|
334 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimContactImportL" ); |
|
335 } |
|
336 |
|
337 // ---------------------------------------------------------------------------- |
|
338 // CHtiSimDirHandler::HandleSimContactDeleteL |
|
339 // Creates a contact view containing the contacts to be deleted. |
|
340 // ---------------------------------------------------------------------------- |
|
341 void CHtiSimDirHandler::HandleSimContactDeleteL(const TDesC8& aData) |
|
342 { |
|
343 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimContactDeleteL" ); |
|
344 TInt dataLength = aData.Length(); |
|
345 if ( dataLength != 0 && dataLength != 4 ) |
|
346 { |
|
347 HTI_LOG_TEXT( "CHtiSimDirHandler: Wrong length of data" ) |
|
348 SendErrorMessageL( KErrArgument, KErrorInvalidParameters ); |
|
349 return; |
|
350 } |
|
351 |
|
352 TRequestStatus status; |
|
353 if (dataLength == 0) //delete all |
|
354 { |
|
355 iEtelStore.DeleteAll(status); |
|
356 HTI_LOG_TEXT("Delete all SIM contacts"); |
|
357 } |
|
358 else //delete one contact with given id |
|
359 { |
|
360 TInt id = aData[0] + (aData[1] << 8) + (aData[2] << 16) + (aData[3] |
|
361 << 24); |
|
362 HTI_LOG_FORMAT( "Delete SIM contact with id %d", id ); |
|
363 iEtelStore.Delete(status, id); |
|
364 } |
|
365 |
|
366 User::WaitForRequest(status); |
|
367 if(status.Int() != KErrNone) |
|
368 { |
|
369 HTI_LOG_TEXT("Failed to delete contact(s)"); |
|
370 SendErrorMessageL( status.Int(), KErrorDeleteFailed ); |
|
371 } |
|
372 else |
|
373 { |
|
374 HTI_LOG_TEXT("SIM contact(s) deleted"); |
|
375 SendOkMsgL( KNullDesC8 ); |
|
376 } |
|
377 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimContactDeleteL" ); |
|
378 } |
|
379 |
|
380 // ---------------------------------------------------------------------------- |
|
381 // CHtiSimDirHandler::CheckImportMsg |
|
382 // Validates the syntax of import contact message. |
|
383 // ---------------------------------------------------------------------------- |
|
384 TBool CHtiSimDirHandler::CheckImportMsg(const TDesC8& aData) |
|
385 { |
|
386 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::CheckImportMsg" ); |
|
387 // Import command syntax: |
|
388 // amount of fields (1 byte) __ |
|
389 // type of field (1 byte) | |
|
390 // length of data field (1 byte) | repeated <amount of fields> times |
|
391 // field data (variable) __| |
|
392 |
|
393 TInt length = aData.Length(); |
|
394 if (length < 4) // min length 4 bytes |
|
395 { |
|
396 HTI_LOG_FORMAT( "Message too short %d", length ); |
|
397 SendErrorMessageL( KErrArgument, KErrorInvalidParameters ); |
|
398 return EFalse; |
|
399 } |
|
400 |
|
401 RMobilePhoneBookStore::TMobilePhoneBookInfoV5 etelStoreInfo; |
|
402 RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg etelStoreInfoPckg(etelStoreInfo); |
|
403 |
|
404 TRequestStatus requestStatus; |
|
405 iEtelStore.GetInfo(requestStatus, (TDes8&) etelStoreInfoPckg); |
|
406 User::WaitForRequest(requestStatus); |
|
407 if (requestStatus.Int() != KErrNone) |
|
408 { |
|
409 HTI_LOG_TEXT( "CHtiSimDirHandler: Failed to get SIM card info" ); |
|
410 SendErrorMessageL(requestStatus.Int(), KErrorSimCardInfoFailed); |
|
411 return EFalse; |
|
412 } |
|
413 TInt offset = 0; |
|
414 TInt fieldCount = aData[offset]; |
|
415 HTI_LOG_FORMAT( "Fields %d", fieldCount ); |
|
416 if (fieldCount < 1) // must be at least one field |
|
417 { |
|
418 SendErrorMessageL( KErrArgument, KErrorInvalidParameters ); |
|
419 return EFalse; |
|
420 } |
|
421 |
|
422 offset++; |
|
423 TInt fieldsFound = 0; |
|
424 while (offset < length) |
|
425 { |
|
426 fieldsFound++; |
|
427 TContactFieldType fieldType = (TContactFieldType) aData[offset]; |
|
428 HTI_LOG_FORMAT( "Field type %d", fieldType ); |
|
429 TInt maxLength = 0; |
|
430 if(fieldType == ENameField) |
|
431 { |
|
432 maxLength = etelStoreInfo.iMaxTextLength; |
|
433 } |
|
434 else if(fieldType == ESecondNameField) |
|
435 { |
|
436 maxLength = etelStoreInfo.iMaxTextLengthSecondName; |
|
437 } |
|
438 else if(fieldType == EPhoneNumberField) |
|
439 { |
|
440 maxLength = etelStoreInfo.iMaxNumLength; |
|
441 } |
|
442 else if(fieldType == EEMailField) |
|
443 { |
|
444 maxLength = etelStoreInfo.iMaxTextLengthEmailAddr; |
|
445 } |
|
446 else if(fieldType == EAdditNumberField) |
|
447 { |
|
448 maxLength = etelStoreInfo.iMaxNumLengthAdditionalNumber; |
|
449 } |
|
450 else |
|
451 { |
|
452 HTI_LOG_TEXT("Unknown field type"); |
|
453 SendErrorMessageL( KErrArgument, KErrorInvalidParameters ); |
|
454 return EFalse; // invalid field type |
|
455 } |
|
456 |
|
457 if(maxLength <= 0) |
|
458 { |
|
459 HTI_LOG_TEXT("Field not supported"); |
|
460 SendErrorMessageL(KErrArgument, KErrorFieldNotSupported); |
|
461 return EFalse; |
|
462 } |
|
463 |
|
464 offset++; // the type of field byte |
|
465 if (offset >= length) |
|
466 { |
|
467 SendErrorMessageL( KErrArgument, KErrorInvalidParameters ); |
|
468 return EFalse; |
|
469 } |
|
470 TInt fieldLength = aData[offset]; |
|
471 HTI_LOG_FORMAT( "Field length %d", fieldLength ); |
|
472 if (fieldLength < 1) |
|
473 { |
|
474 SendErrorMessageL( KErrArgument, KErrorInvalidParameters ); |
|
475 return EFalse; // Field data can not be empty |
|
476 } |
|
477 else if(fieldLength > maxLength) |
|
478 { |
|
479 HTI_LOG_TEXT("The length of field is too long"); |
|
480 SendErrorMessageL( KErrArgument, KErrorFieldTooBig ); |
|
481 return EFalse; |
|
482 } |
|
483 offset++; // advance over the length of data byte |
|
484 offset += fieldLength; // and the field data |
|
485 } |
|
486 |
|
487 if (offset == length && fieldsFound == fieldCount) |
|
488 { |
|
489 HTI_LOG_TEXT( "Message OK" ); |
|
490 return ETrue; |
|
491 } |
|
492 |
|
493 SendErrorMessageL( KErrArgument, KErrorInvalidParameters ); |
|
494 return EFalse; |
|
495 } |
|
496 |
|
497 // ---------------------------------------------------------------------------- |
|
498 // CHtiSimDirHandler::SendOkMsgL |
|
499 // Helper function for sending response messages. |
|
500 // ---------------------------------------------------------------------------- |
|
501 void CHtiSimDirHandler::SendOkMsgL(const TDesC8& aData) |
|
502 { |
|
503 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SendOkMsgL" ); |
|
504 iIsBusy = EFalse; // Done with the current request |
|
505 User::LeaveIfNull(iDispatcher); |
|
506 HBufC8* temp = HBufC8::NewL(aData.Length() + 1); |
|
507 TPtr8 response = temp->Des(); |
|
508 response.Append((TChar) CHtiPIMServicePlugin::EResultOk); |
|
509 response.Append(aData); |
|
510 User::LeaveIfError(iDispatcher->DispatchOutgoingMessage(temp, |
|
511 KPIMServiceUid)); |
|
512 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SendOkMsgL" ); |
|
513 } |
|
514 |
|
515 // ---------------------------------------------------------------------------- |
|
516 // CHtiSimDirHandler::SendErrorMessageL |
|
517 // Helper function for sending error response messages. |
|
518 // ---------------------------------------------------------------------------- |
|
519 void CHtiSimDirHandler::SendErrorMessageL(TInt aError, |
|
520 const TDesC8& aDescription) |
|
521 { |
|
522 HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SendErrorMessageL" ); |
|
523 iIsBusy = EFalse; // Done with the current request |
|
524 User::LeaveIfNull(iDispatcher); |
|
525 User::LeaveIfError(iDispatcher->DispatchOutgoingErrorMessage(aError, |
|
526 aDescription, KPIMServiceUid)); |
|
527 HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SendErrorMessageL" ); |
|
528 } |
|
529 |
|
530 // End of file |