|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "cphonebookdispatcher.h" |
|
17 |
|
18 #include <ctsy/ltsy/mltsydispatchphonebookinterface.h> |
|
19 #include <ctsy/pluginapi/mmmessagemanagercallback.h> |
|
20 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
21 |
|
22 |
|
23 #include <ctsy/ltsy/ltsylogger.h> |
|
24 #include "ctsydispatcherpanic.h" |
|
25 #include "tdispatcherholder.h" |
|
26 |
|
27 #include <ctsy/serviceapi/cmmgsmphonestorageutility.h> //for CStorageInfoData |
|
28 |
|
29 #include <ctsy/ltsy/cphonebookentry.h> |
|
30 |
|
31 #include <mpbutil.h> |
|
32 #include <ctsy/serviceapi/cmmgsmphonestorageutility.h> |
|
33 |
|
34 CPhonebookDispatcher::CPhonebookDispatcher( |
|
35 MLtsyDispatchFactoryV1& aLtsyFactory, |
|
36 MmMessageManagerCallback& aMessageManagerCallback, |
|
37 CRequestQueueOneShot& aRequestAsyncOneShot) |
|
38 : iLtsyFactoryV1(aLtsyFactory), |
|
39 iMessageManagerCallback(aMessageManagerCallback), |
|
40 iRequestAsyncOneShot(aRequestAsyncOneShot), |
|
41 iPhonebookCachePtrs(KPhonebookTypes), |
|
42 iPhonebookReadPtrs(KPhonebookTypes), |
|
43 iInitialisePhonebook(DispatcherPhonebook::EUnknown) |
|
44 { |
|
45 } // CPhonebookDispatcher::CPhonebookDispatcher |
|
46 |
|
47 |
|
48 CPhonebookDispatcher::~CPhonebookDispatcher() |
|
49 { |
|
50 iPhonebookCachePtrs.Reset(); |
|
51 iPhonebookReadPtrs.Reset(); |
|
52 if(iSmsListArray) |
|
53 { |
|
54 iSmsListArray->ResetAndDestroy(); |
|
55 } |
|
56 delete iSmsListArray; |
|
57 } // CPhonebookDispatcher::~CPhonebookDispatcher |
|
58 |
|
59 |
|
60 CPhonebookDispatcher* CPhonebookDispatcher::NewLC( |
|
61 MLtsyDispatchFactoryV1& aLtsyFactory, |
|
62 MmMessageManagerCallback& aMessageManagerCallback, |
|
63 CRequestQueueOneShot& aRequestAsyncOneShot) |
|
64 { |
|
65 TSYLOGENTRYEXIT; |
|
66 CPhonebookDispatcher* self = |
|
67 new (ELeave) CPhonebookDispatcher(aLtsyFactory, aMessageManagerCallback, aRequestAsyncOneShot); |
|
68 CleanupStack::PushL(self); |
|
69 self->ConstructL(); |
|
70 return self; |
|
71 } // CPhonebookDispatcher::NewLC |
|
72 |
|
73 |
|
74 CPhonebookDispatcher* CPhonebookDispatcher::NewL( |
|
75 MLtsyDispatchFactoryV1& aLtsyFactory, |
|
76 MmMessageManagerCallback& aMessageManagerCallback, |
|
77 CRequestQueueOneShot& aRequestAsyncOneShot) |
|
78 { |
|
79 TSYLOGENTRYEXIT; |
|
80 CPhonebookDispatcher* self = |
|
81 CPhonebookDispatcher::NewLC(aLtsyFactory, aMessageManagerCallback, aRequestAsyncOneShot); |
|
82 CleanupStack::Pop (self); |
|
83 return self; |
|
84 } // CPhonebookDispatcher::NewL |
|
85 |
|
86 |
|
87 void CPhonebookDispatcher::ConstructL() |
|
88 /** |
|
89 * Second phase constructor. |
|
90 */ |
|
91 { |
|
92 TSYLOGENTRYEXIT; |
|
93 |
|
94 iSmsListArray = new ( ELeave ) CArrayPtrFlat< TSmsMsg >( 1 ); |
|
95 // Get the Licensee LTSY interfaces related to Phonebook functionality |
|
96 // from the factory |
|
97 |
|
98 |
|
99 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookStoreReadEntry::KLtsyDispatchPhonebookStoreReadEntryApiId)) |
|
100 { |
|
101 TAny* storeReadEntryInterface = NULL; |
|
102 iLtsyFactoryV1.GetDispatchHandler( |
|
103 MLtsyDispatchPhonebookStoreReadEntry::KLtsyDispatchPhonebookStoreReadEntryApiId, |
|
104 storeReadEntryInterface); |
|
105 iLtsyDispatchPhonebookStoreReadEntry = |
|
106 static_cast<MLtsyDispatchPhonebookStoreReadEntry*>(storeReadEntryInterface); |
|
107 __ASSERT_DEBUG(iLtsyDispatchPhonebookStoreReadEntry, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
108 } |
|
109 |
|
110 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookStoreDeleteEntry::KLtsyDispatchPhonebookStoreDeleteEntryApiId)) |
|
111 { |
|
112 TAny* storeDeleteEntryInterface = NULL; |
|
113 iLtsyFactoryV1.GetDispatchHandler( |
|
114 MLtsyDispatchPhonebookStoreDeleteEntry::KLtsyDispatchPhonebookStoreDeleteEntryApiId, |
|
115 storeDeleteEntryInterface); |
|
116 iLtsyDispatchPhonebookStoreDeleteEntry = |
|
117 static_cast<MLtsyDispatchPhonebookStoreDeleteEntry*>(storeDeleteEntryInterface); |
|
118 __ASSERT_DEBUG(iLtsyDispatchPhonebookStoreDeleteEntry, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
119 } |
|
120 |
|
121 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookStoreCache::KLtsyDispatchPhonebookStoreCacheApiId)) |
|
122 { |
|
123 TAny* storeCacheInterface = NULL; |
|
124 iLtsyFactoryV1.GetDispatchHandler( |
|
125 MLtsyDispatchPhonebookStoreCache::KLtsyDispatchPhonebookStoreCacheApiId, |
|
126 storeCacheInterface); |
|
127 iLtsyDispatchPhonebookStoreCache = |
|
128 static_cast<MLtsyDispatchPhonebookStoreCache*>(storeCacheInterface); |
|
129 __ASSERT_DEBUG(iLtsyDispatchPhonebookStoreCache, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
130 } |
|
131 |
|
132 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookStoreGetPhonebookInfo::KLtsyDispatchPhonebookStoreGetPhonebookInfoApiId)) |
|
133 { |
|
134 TAny* storeGetPhonebookInfoInterface = NULL; |
|
135 iLtsyFactoryV1.GetDispatchHandler( |
|
136 MLtsyDispatchPhonebookStoreGetPhonebookInfo::KLtsyDispatchPhonebookStoreGetPhonebookInfoApiId, |
|
137 storeGetPhonebookInfoInterface); |
|
138 iLtsyDispatchPhonebookStoreGetPhonebookInfo = |
|
139 static_cast<MLtsyDispatchPhonebookStoreGetPhonebookInfo*>(storeGetPhonebookInfoInterface); |
|
140 __ASSERT_DEBUG(iLtsyDispatchPhonebookStoreGetPhonebookInfo, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
141 } |
|
142 |
|
143 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId)) |
|
144 { |
|
145 TAny* storeInitialiseInterface = NULL; |
|
146 iLtsyFactoryV1.GetDispatchHandler( |
|
147 MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId, |
|
148 storeInitialiseInterface); |
|
149 iLtsyDispatchPhonebookStoreInitialise = |
|
150 static_cast<MLtsyDispatchPhonebookStoreInitialise*>(storeInitialiseInterface); |
|
151 __ASSERT_DEBUG(iLtsyDispatchPhonebookStoreInitialise, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
152 } |
|
153 |
|
154 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookStoreDeleteAll::KLtsyDispatchPhonebookStoreDeleteAllApiId)) |
|
155 { |
|
156 TAny* storeDeleteAllInterface = NULL; |
|
157 iLtsyFactoryV1.GetDispatchHandler( |
|
158 MLtsyDispatchPhonebookStoreDeleteAll::KLtsyDispatchPhonebookStoreDeleteAllApiId, |
|
159 storeDeleteAllInterface); |
|
160 iLtsyDispatchPhonebookStoreDeleteAll = |
|
161 static_cast<MLtsyDispatchPhonebookStoreDeleteAll*>(storeDeleteAllInterface); |
|
162 __ASSERT_DEBUG(iLtsyDispatchPhonebookStoreDeleteAll, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
163 } |
|
164 |
|
165 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId)) |
|
166 { |
|
167 TAny* smsStoreReadAllInterface = NULL; |
|
168 iLtsyFactoryV1.GetDispatchHandler( |
|
169 MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, |
|
170 smsStoreReadAllInterface); |
|
171 iLtsyDispatchPhonebookSmsStoreReadAll = |
|
172 static_cast<MLtsyDispatchPhonebookSmsStoreReadAll*>(smsStoreReadAllInterface); |
|
173 __ASSERT_DEBUG(iLtsyDispatchPhonebookSmsStoreReadAll, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
174 } |
|
175 |
|
176 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookStoreWriteEntry::KLtsyDispatchPhonebookStoreWriteEntryApiId)) |
|
177 { |
|
178 TAny* storeWriteEntryInterface = NULL; |
|
179 iLtsyFactoryV1.GetDispatchHandler( |
|
180 MLtsyDispatchPhonebookStoreWriteEntry::KLtsyDispatchPhonebookStoreWriteEntryApiId, |
|
181 storeWriteEntryInterface); |
|
182 iLtsyDispatchPhonebookStoreWriteEntry = |
|
183 static_cast<MLtsyDispatchPhonebookStoreWriteEntry*>(storeWriteEntryInterface); |
|
184 __ASSERT_DEBUG(iLtsyDispatchPhonebookStoreWriteEntry, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
185 } |
|
186 |
|
187 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookGetPhoneStoreInfo::KLtsyDispatchPhonebookGetPhoneStoreInfoApiId)) |
|
188 { |
|
189 TAny* getPhoneStoreInfoInterface = NULL; |
|
190 iLtsyFactoryV1.GetDispatchHandler( |
|
191 MLtsyDispatchPhonebookGetPhoneStoreInfo::KLtsyDispatchPhonebookGetPhoneStoreInfoApiId, |
|
192 getPhoneStoreInfoInterface); |
|
193 iLtsyDispatchPhonebookGetPhoneStoreInfo = |
|
194 static_cast<MLtsyDispatchPhonebookGetPhoneStoreInfo*>(getPhoneStoreInfoInterface); |
|
195 __ASSERT_DEBUG(iLtsyDispatchPhonebookGetPhoneStoreInfo, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
196 } |
|
197 |
|
198 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId)) |
|
199 { |
|
200 TAny* smsStoreDeleteEntryInterface = NULL; |
|
201 iLtsyFactoryV1.GetDispatchHandler( |
|
202 MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, |
|
203 smsStoreDeleteEntryInterface); |
|
204 iLtsyDispatchPhonebookSmsStoreDeleteEntry = |
|
205 static_cast<MLtsyDispatchPhonebookSmsStoreDeleteEntry*>(smsStoreDeleteEntryInterface); |
|
206 __ASSERT_DEBUG(iLtsyDispatchPhonebookSmsStoreDeleteEntry, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
207 } |
|
208 |
|
209 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId)) |
|
210 { |
|
211 TAny* smsStoreDeleteAllInterface = NULL; |
|
212 iLtsyFactoryV1.GetDispatchHandler( |
|
213 MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId, |
|
214 smsStoreDeleteAllInterface); |
|
215 iLtsyDispatchPhonebookSmsStoreDeleteAll = |
|
216 static_cast<MLtsyDispatchPhonebookSmsStoreDeleteAll*>(smsStoreDeleteAllInterface); |
|
217 __ASSERT_DEBUG(iLtsyDispatchPhonebookSmsStoreDeleteAll, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
218 } |
|
219 |
|
220 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId)) |
|
221 { |
|
222 TAny* smsStoreGetInfoInterface = NULL; |
|
223 iLtsyFactoryV1.GetDispatchHandler( |
|
224 MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, |
|
225 smsStoreGetInfoInterface); |
|
226 iLtsyDispatchPhonebookSmsStoreGetInfo = |
|
227 static_cast<MLtsyDispatchPhonebookSmsStoreGetInfo*>(smsStoreGetInfoInterface); |
|
228 __ASSERT_DEBUG(iLtsyDispatchPhonebookSmsStoreGetInfo, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
229 } |
|
230 |
|
231 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId)) |
|
232 { |
|
233 TAny* smsStoreReadEntryInterface = NULL; |
|
234 iLtsyFactoryV1.GetDispatchHandler( |
|
235 MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, |
|
236 smsStoreReadEntryInterface); |
|
237 iLtsyDispatchPhonebookSmsStoreReadEntry = |
|
238 static_cast<MLtsyDispatchPhonebookSmsStoreReadEntry*>(smsStoreReadEntryInterface); |
|
239 __ASSERT_DEBUG(iLtsyDispatchPhonebookSmsStoreReadEntry, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
240 } |
|
241 |
|
242 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId)) |
|
243 { |
|
244 TAny* smsStoreWriteEntryInterface = NULL; |
|
245 iLtsyFactoryV1.GetDispatchHandler( |
|
246 MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, |
|
247 smsStoreWriteEntryInterface); |
|
248 iLtsyDispatchPhonebookSmsStoreWriteEntry = |
|
249 static_cast<MLtsyDispatchPhonebookSmsStoreWriteEntry*>(smsStoreWriteEntryInterface); |
|
250 __ASSERT_DEBUG(iLtsyDispatchPhonebookSmsStoreWriteEntry, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
251 } |
|
252 |
|
253 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchPhonebookFuncUnitId, MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId)) |
|
254 { |
|
255 TAny* storeCacheCancelInterface = NULL; |
|
256 iLtsyFactoryV1.GetDispatchHandler( |
|
257 MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId, |
|
258 storeCacheCancelInterface); |
|
259 iLtsyDispatchPhonebookStoreCacheCancel = |
|
260 static_cast<MLtsyDispatchPhonebookStoreCacheCancel*>(storeCacheCancelInterface); |
|
261 __ASSERT_DEBUG(iLtsyDispatchPhonebookStoreCacheCancel, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
262 } |
|
263 |
|
264 for(TInt i = 0; i < KPhonebookTypes; ++i) |
|
265 { |
|
266 iPhonebookCachePtrs.AppendL(NULL); //really only Fdn and Adn pointers will be stored with the current CTSY |
|
267 iPhonebookReadPtrs.AppendL(NULL); |
|
268 } |
|
269 |
|
270 } // CPhonebookDispatcher::ConstructL |
|
271 |
|
272 CPhoneBookStoreEntry* CPhonebookDispatcher::CreatePhoneBookStoreEntryLC(const CPhoneBookEntry& aPhoneBookEntry) const |
|
273 /** |
|
274 * Creates a CTSY CPhoneBookStoreEntry from a dispatcher CPhoneBookEntry, the created |
|
275 * entry is left on the cleanup stack. |
|
276 * |
|
277 * @param aPhoneBookEntry The entry to create a CPhoneBookStoreEntry from. |
|
278 * @return A pointer to the created CTSY entry. |
|
279 */ |
|
280 { |
|
281 CPhoneBookStoreEntry* ctsyPhoneBookStoreEntry = new (ELeave) CPhoneBookStoreEntry(); |
|
282 CleanupStack::PushL(ctsyPhoneBookStoreEntry); |
|
283 ctsyPhoneBookStoreEntry->ConstructL(); |
|
284 |
|
285 //the record number |
|
286 ctsyPhoneBookStoreEntry->iLocation = aPhoneBookEntry.GetIndex(); |
|
287 |
|
288 //allocate the buffer and copy the name |
|
289 ctsyPhoneBookStoreEntry->iText = HBufC::NewL(aPhoneBookEntry.GetFirstName().Length()); |
|
290 *(ctsyPhoneBookStoreEntry->iText) = aPhoneBookEntry.GetFirstName(); |
|
291 |
|
292 //allocate the buffer and copy the dialling number |
|
293 ctsyPhoneBookStoreEntry->iNumber = HBufC::NewL(aPhoneBookEntry.GetDiallingNumber().Length()); |
|
294 *(ctsyPhoneBookStoreEntry->iNumber) = aPhoneBookEntry.GetDiallingNumber(); |
|
295 |
|
296 TInt i = 0; |
|
297 //add the email address's |
|
298 const TInt KEmailAddresssCount = aPhoneBookEntry.GetEmailAddresss().Count(); |
|
299 for (i = 0; i < KEmailAddresssCount; ++i) |
|
300 { |
|
301 ctsyPhoneBookStoreEntry->iEmail->AppendL(aPhoneBookEntry.GetEmailAddresss()[i]); |
|
302 } |
|
303 |
|
304 //add the second names |
|
305 const TInt KSecondNamesCount = aPhoneBookEntry.GetSecondNames().Count(); |
|
306 for (i = 0; i < KSecondNamesCount; ++i) |
|
307 { |
|
308 ctsyPhoneBookStoreEntry->iSne->AppendL(aPhoneBookEntry.GetSecondNames()[i]); |
|
309 } |
|
310 |
|
311 //add the additional numbers |
|
312 const TInt KAdditionalNumbersCount = aPhoneBookEntry.GetAdditionalNumbers().Count(); |
|
313 for (i = 0; i < KAdditionalNumbersCount; ++i) |
|
314 { |
|
315 ctsyPhoneBookStoreEntry->iAnr->AppendL(aPhoneBookEntry.GetAdditionalNumbers()[i]); |
|
316 } |
|
317 |
|
318 return ctsyPhoneBookStoreEntry; |
|
319 } |
|
320 |
|
321 TInt CPhonebookDispatcher::FillPhoneBookEntry(const CPhoneBookStoreEntry& aPhoneBookStoreEntry, CPhoneBookEntry& aPhoneBookEntry) const |
|
322 /** |
|
323 * Fills a dispatcher CPhoneBookEntry from a CTSY CPhoneBookStoreEntry. |
|
324 * |
|
325 * @param aPhoneBookStoreEntry The CTSY phonebook entry to read from. |
|
326 * @param aPhoneBookEntry The dispatcher entry to be written to. |
|
327 * @return Error code, KErrNone is successful. |
|
328 */ |
|
329 { |
|
330 TInt error = KErrNone; |
|
331 |
|
332 aPhoneBookEntry.SetIndex(aPhoneBookStoreEntry.iLocation); |
|
333 if(aPhoneBookStoreEntry.iText && (error == KErrNone)) |
|
334 { |
|
335 error = aPhoneBookEntry.SetFirstName(*aPhoneBookStoreEntry.iText); |
|
336 } |
|
337 |
|
338 if(aPhoneBookStoreEntry.iNumber && (error == KErrNone)) |
|
339 { |
|
340 error = aPhoneBookEntry.SetDiallingNumber(*aPhoneBookStoreEntry.iNumber); |
|
341 } |
|
342 |
|
343 if(aPhoneBookStoreEntry.iEmail && (error == KErrNone)) |
|
344 { |
|
345 const TInt KEmailCount = aPhoneBookStoreEntry.iEmail->MdcaCount(); |
|
346 |
|
347 for(TInt i = 0; i < KEmailCount && (error == KErrNone); ++i) |
|
348 { |
|
349 error = aPhoneBookEntry.AddEmailAddress(aPhoneBookStoreEntry.iEmail->MdcaPoint(i)); |
|
350 } |
|
351 } |
|
352 |
|
353 if(aPhoneBookStoreEntry.iSne && (error == KErrNone)) |
|
354 { |
|
355 const TInt KSecondNameCount = aPhoneBookStoreEntry.iSne->MdcaCount(); |
|
356 |
|
357 for(TInt i = 0; i < KSecondNameCount && (error == KErrNone); ++i) |
|
358 { |
|
359 error = aPhoneBookEntry.AddSecondName(aPhoneBookStoreEntry.iSne->MdcaPoint(i)); |
|
360 } |
|
361 } |
|
362 |
|
363 if(aPhoneBookStoreEntry.iAnr && (error == KErrNone)) |
|
364 { |
|
365 const TInt KAdditionalNumberCount = aPhoneBookStoreEntry.iAnr->MdcaCount(); |
|
366 |
|
367 for(TInt i = 0; i < KAdditionalNumberCount && (error == KErrNone); ++i) |
|
368 { |
|
369 error = aPhoneBookEntry.AddAdditionalNumber(aPhoneBookStoreEntry.iAnr->MdcaPoint(i)); |
|
370 } |
|
371 } |
|
372 |
|
373 return error; |
|
374 } |
|
375 |
|
376 void CPhonebookDispatcher::FillCtsyPhoneBookStoreL(const TDesC8& aPhonebookEntries, |
|
377 CArrayPtrSeg<CPhoneBookStoreEntry>& aCtsyPhoneBook) |
|
378 /** |
|
379 * Fills the CTSY Store from the phonebook entries contained in a descriptor TLV. |
|
380 * |
|
381 * |
|
382 * @param aPhonebookEntries The TLV entries. |
|
383 * @param aCtsyPhoneBook The CTSY phonebook to fill. |
|
384 */ |
|
385 { |
|
386 //we need to create a copy of aPhoneBookEntry as the CPhoneBookBuffer can only be set with a TDes |
|
387 RBuf8 readBuffer; |
|
388 CleanupClosePushL(readBuffer); |
|
389 readBuffer.CreateL(aPhonebookEntries); |
|
390 |
|
391 CPhoneBookBuffer* phoneBookBuffer = new (ELeave) CPhoneBookBuffer(); |
|
392 CleanupStack::PushL(phoneBookBuffer); |
|
393 phoneBookBuffer->Set(&readBuffer); |
|
394 phoneBookBuffer->StartRead(); |
|
395 |
|
396 CPhoneBookEntry* phoneBookEntry = CPhoneBookEntry::NewLC(); |
|
397 |
|
398 TBool entryRead = EFalse; |
|
399 |
|
400 while(phoneBookBuffer->RemainingReadLength() > 0) |
|
401 { |
|
402 User::LeaveIfError(phoneBookEntry->InternalizeFromTlvEntry(*phoneBookBuffer,entryRead)); |
|
403 |
|
404 CPhoneBookStoreEntry* phoneBookStoreEntry = CreatePhoneBookStoreEntryLC(*phoneBookEntry); |
|
405 aCtsyPhoneBook.AppendL(phoneBookStoreEntry); //takes ownership |
|
406 CleanupStack::Pop(phoneBookStoreEntry); |
|
407 |
|
408 phoneBookEntry->Reset(); |
|
409 entryRead = ETrue; |
|
410 } |
|
411 |
|
412 CleanupStack::PopAndDestroy(phoneBookEntry); |
|
413 CleanupStack::PopAndDestroy(phoneBookBuffer); |
|
414 CleanupStack::PopAndDestroy(&readBuffer); |
|
415 } |
|
416 |
|
417 const TDesC& CPhonebookDispatcher::PhonebookName(DispatcherPhonebook::TPhonebook aPhonebookType) const |
|
418 /** |
|
419 * Converts phonebook enum type to a phonebook name descriptor. |
|
420 * |
|
421 * @param The phonebook type. |
|
422 * @return A TDeC reference containing the associated ETel name for the phonebook. |
|
423 */ |
|
424 { |
|
425 switch(aPhonebookType) |
|
426 { |
|
427 case DispatcherPhonebook::EIccAdn: |
|
428 return KETelIccAdnPhoneBook; |
|
429 case DispatcherPhonebook::EIccBdn: |
|
430 return KETelIccBdnPhoneBook; |
|
431 case DispatcherPhonebook::EIccSdn: |
|
432 return KETelIccSdnPhoneBook; |
|
433 case DispatcherPhonebook::EIccFdn: |
|
434 return KETelIccFdnPhoneBook; |
|
435 case DispatcherPhonebook::EIccVmb: |
|
436 return KETelIccVoiceMailBox; |
|
437 case DispatcherPhonebook::EIccMbdn: |
|
438 return KETelIccMbdnPhoneBook; |
|
439 case DispatcherPhonebook::EUnknown: |
|
440 default: |
|
441 return KNullDesC; |
|
442 } |
|
443 } |
|
444 |
|
445 DispatcherPhonebook::TPhonebook CPhonebookDispatcher::Phonebook(const TDesC& aPhonebookName) const |
|
446 /** |
|
447 * Converts a phonebook name descriptor into an enum type. |
|
448 * |
|
449 * @param aPhonebookName The phonebook name. |
|
450 * @return The phonebook enum type. |
|
451 */ |
|
452 { |
|
453 DispatcherPhonebook::TPhonebook phonebook = DispatcherPhonebook::EUnknown; |
|
454 |
|
455 if(aPhonebookName == KETelIccFdnPhoneBook) |
|
456 { |
|
457 phonebook = DispatcherPhonebook::EIccFdn; |
|
458 } |
|
459 else if(aPhonebookName == KETelIccAdnPhoneBook) |
|
460 { |
|
461 phonebook = DispatcherPhonebook::EIccAdn; |
|
462 } |
|
463 else if(aPhonebookName == KETelIccSdnPhoneBook) |
|
464 { |
|
465 phonebook = DispatcherPhonebook::EIccSdn; |
|
466 } |
|
467 else if(aPhonebookName == KETelIccBdnPhoneBook) |
|
468 { |
|
469 phonebook = DispatcherPhonebook::EIccBdn; |
|
470 } |
|
471 else if(aPhonebookName == KETelIccVoiceMailBox) |
|
472 { |
|
473 phonebook = DispatcherPhonebook::EIccVmb; |
|
474 } |
|
475 else if(aPhonebookName == KETelIccMbdnPhoneBook) |
|
476 { |
|
477 phonebook = DispatcherPhonebook::EIccMbdn; |
|
478 } |
|
479 |
|
480 return phonebook; |
|
481 } |
|
482 |
|
483 void CPhonebookDispatcher::PhonebookStoreToStorageInfo(const DispatcherPhonebook::TPhonebookStoreInfoV1& aPhonebookStoreInfo, CStorageInfoData& aStorageInfoData) const |
|
484 /** |
|
485 * Write data into a CTSY CStorageInfoData structure from a TPhonebookStoreInfoV1 dispatcher structure. |
|
486 * |
|
487 * @param aPhonebookStoreData The dispatcher structure to read from. |
|
488 * @param aStorageInfoData The CTSY structure to write to. |
|
489 */ |
|
490 { |
|
491 aStorageInfoData.iADNNumOfEntries = aPhonebookStoreInfo.iAdnTotalEntries; |
|
492 aStorageInfoData.iADNTextLengthMax = aPhonebookStoreInfo.iAdnMaximumTextLength; |
|
493 aStorageInfoData.iADNNumberLengthMax = aPhonebookStoreInfo.iAdnMaximumNumberLength; |
|
494 |
|
495 aStorageInfoData.iSNENumOfEntriesPerEntry = aPhonebookStoreInfo.iSecondNameMaximumFieldsPerEntry; |
|
496 aStorageInfoData.iSNETextLengthMax = aPhonebookStoreInfo.iSecondNameMaximumLength; |
|
497 |
|
498 aStorageInfoData.iEmailNumOfEntriesPerEntry = aPhonebookStoreInfo.iEmailMaximumFieldsPerEntry; |
|
499 aStorageInfoData.iEmailTextLengthMax = aPhonebookStoreInfo.iEmailMaximumLength; |
|
500 |
|
501 aStorageInfoData.iFDNNumOfEntries = aPhonebookStoreInfo.iFdnTotalEntries; |
|
502 aStorageInfoData.iFDNTextLengthMax = aPhonebookStoreInfo.iFdnMaximumTextLength; |
|
503 aStorageInfoData.iFDNNumberLengthMax = aPhonebookStoreInfo.iFdnMaximumNumberLength; |
|
504 |
|
505 aStorageInfoData.iSDNNumOfEntries = aPhonebookStoreInfo.iSdnTotalEntries; |
|
506 aStorageInfoData.iSDNTextLengthMax = aPhonebookStoreInfo.iSdnMaximumTextLength; |
|
507 aStorageInfoData.iSDNNumberLengthMax = aPhonebookStoreInfo.iSdnMaximumNumberLength; |
|
508 |
|
509 aStorageInfoData.iVMBXNumOfEntries = aPhonebookStoreInfo.iVmbTotalEntries; |
|
510 aStorageInfoData.iVMBXTextLengthMax = aPhonebookStoreInfo.iVmbMaximumTextLength; |
|
511 aStorageInfoData.iVMBXNumberLengthMax = aPhonebookStoreInfo.iVmbMaximumNumberLength; |
|
512 aStorageInfoData.iVMBXCaps = aPhonebookStoreInfo.iVmbCapabilities; |
|
513 |
|
514 aStorageInfoData.iANRNumOfEntriesPerEntry = aPhonebookStoreInfo.iAdditionalNumberMaximumFieldsPerEntry; |
|
515 aStorageInfoData.iANRNumLengthMax = aPhonebookStoreInfo.iAdditionalNumberMaximumLength; |
|
516 |
|
517 aStorageInfoData.iMBDNNumOfEntries = aPhonebookStoreInfo.iMbdnTotalEntries; |
|
518 aStorageInfoData.iMBDNTextLengthMax = aPhonebookStoreInfo.iMbdnMaximumTextLength; |
|
519 aStorageInfoData.iMBDNNumberLengthMax = aPhonebookStoreInfo.iMbdnMaximumNumberLength; |
|
520 aStorageInfoData.iMBDNCaps = aPhonebookStoreInfo.iMbdnCapabilities; |
|
521 } |
|
522 |
|
523 void CPhonebookDispatcher::FillSmsStoreListL(const DispatcherPhonebook::TSmsData& aSmsData, TInt aIndex, CArrayPtrFlat< TSmsMsg >& aSmsListArray) |
|
524 /* |
|
525 * Append a TSmsMsg to a sms array. |
|
526 * |
|
527 * @param aSmsData A entry of TSmSData where the information will be extracted from to form a TSmsMsg entry. |
|
528 * @param aIndex The index of the entry. |
|
529 * @param aSmsListArray The array where the TSmsMsg entry will be append to. |
|
530 */ |
|
531 { |
|
532 TSmsMsg* smsMsg = new (ELeave) TSmsMsg(); |
|
533 CleanupStack::PushL(smsMsg); |
|
534 |
|
535 smsMsg->iSmsMsg.Copy(aSmsData.iSmsMsg); |
|
536 smsMsg->iServiceCentre.Copy(aSmsData.iServiceCentre); |
|
537 smsMsg->iMobileScTON = aSmsData.iMobileScTON; |
|
538 smsMsg->iMobileScNPI = aSmsData.iMobileScNPI; |
|
539 smsMsg->iMessageStatus = aSmsData.iMessageStatus; |
|
540 smsMsg->iLocation = aIndex; |
|
541 aSmsListArray.AppendL(smsMsg, 1); // aSmsListArray has taken the ownership of the object |
|
542 |
|
543 CleanupStack::Pop(smsMsg); |
|
544 |
|
545 } |
|
546 |
|
547 void CPhonebookDispatcher::SetDispatcherHolder(TDispatcherHolder& aDispatcherHolder) |
|
548 /** |
|
549 * Set the dispatcher holder. |
|
550 * |
|
551 * @param aDispatcherHolder Reference to dispatcher holder. |
|
552 */ |
|
553 { |
|
554 TSYLOGENTRYEXIT; |
|
555 |
|
556 iDispatcherHolder = &aDispatcherHolder; |
|
557 } // CPhonebookDispatcher::SetDispatcherHolder |
|
558 |
|
559 TInt CPhonebookDispatcher::DispatchStoreReadEntryL(const CMmDataPackage* aDataPackage) |
|
560 /** |
|
561 * Unpack data related to EMmTsyPhoneBookStoreReadIPC |
|
562 * and pass request on to Licensee LTSY. |
|
563 * |
|
564 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
565 * the Licensee LTSY does not support this request. |
|
566 */ |
|
567 { |
|
568 TSYLOGENTRYEXIT; |
|
569 TInt ret = KErrNotSupported; |
|
570 |
|
571 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
572 |
|
573 // Call Handle... method in Licensee LTSY |
|
574 if (iLtsyDispatchPhonebookStoreReadEntry) |
|
575 { |
|
576 const CPhoneBookDataPackage& phoneBookDataPackage = *static_cast<const CPhoneBookDataPackage*>(aDataPackage); |
|
577 |
|
578 TName phonebookName(KNullDesC); |
|
579 phoneBookDataPackage.GetPhoneBookName(phonebookName); |
|
580 __ASSERT_DEBUG(phonebookName != KNullDesC, CtsyDispatcherPanic(EInvalidParameter)); |
|
581 |
|
582 RMobilePhoneBookStore::TPBIndexAndNumEntries* indexAndEntries = NULL; |
|
583 |
|
584 phoneBookDataPackage.UnPackData(indexAndEntries); |
|
585 |
|
586 __ASSERT_DEBUG(indexAndEntries, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
587 |
|
588 const DispatcherPhonebook::TPhonebook phonebookType = Phonebook(phonebookName); |
|
589 __ASSERT_DEBUG(phonebookType != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
590 |
|
591 |
|
592 |
|
593 ret = iLtsyDispatchPhonebookStoreReadEntry->HandleStoreReadEntryReqL(phonebookType,indexAndEntries->iIndex,indexAndEntries->iNumSlots); |
|
594 } |
|
595 |
|
596 return TSYLOGSETEXITERR(ret); |
|
597 } // CPhonebookDispatcher::DispatchStoreReadEntryL |
|
598 |
|
599 TInt CPhonebookDispatcher::DispatchStoreDeleteEntryL(const CMmDataPackage* aDataPackage) |
|
600 /** |
|
601 * Unpack data related to EMmTsyPhoneBookStoreDeleteIPC |
|
602 * and pass request on to Licensee LTSY. |
|
603 * |
|
604 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
605 * the Licensee LTSY does not support this request. |
|
606 */ |
|
607 { |
|
608 TSYLOGENTRYEXIT; |
|
609 TInt ret = KErrNotSupported; |
|
610 |
|
611 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
612 |
|
613 // Call Handle... method in Licensee LTSY |
|
614 if (iLtsyDispatchPhonebookStoreDeleteEntry) |
|
615 { |
|
616 const CPhoneBookDataPackage& phoneBookDataPackage = *static_cast<const CPhoneBookDataPackage*>(aDataPackage); |
|
617 |
|
618 TName phonebookName(KNullDesC); |
|
619 phoneBookDataPackage.GetPhoneBookName(phonebookName); |
|
620 __ASSERT_DEBUG(phonebookName != KNullDesC, CtsyDispatcherPanic(EInvalidParameter)); |
|
621 __ASSERT_DEBUG(Phonebook(phonebookName) != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
622 |
|
623 TInt deleteEntryIndex; |
|
624 phoneBookDataPackage.UnPackData(deleteEntryIndex); |
|
625 |
|
626 ret = iLtsyDispatchPhonebookStoreDeleteEntry->HandleStoreDeleteEntryReqL(Phonebook(phonebookName),deleteEntryIndex); |
|
627 } |
|
628 |
|
629 return TSYLOGSETEXITERR(ret); |
|
630 } // CPhonebookDispatcher::DispatchStoreDeleteEntryL |
|
631 |
|
632 TInt CPhonebookDispatcher::DispatchStoreCacheL(const CMmDataPackage* aDataPackage) |
|
633 /** |
|
634 * Unpack data related to EMmTsyPhoneBookStoreCacheIPC |
|
635 * and pass request on to Licensee LTSY. |
|
636 * |
|
637 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
638 * the Licensee LTSY does not support this request. |
|
639 */ |
|
640 { |
|
641 TSYLOGENTRYEXIT; |
|
642 TInt ret = KErrNotSupported; |
|
643 |
|
644 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
645 |
|
646 if (iLtsyDispatchPhonebookStoreCache) |
|
647 { |
|
648 const CPhoneBookDataPackage& phoneBookDataPackage = *static_cast<const CPhoneBookDataPackage*>(aDataPackage); |
|
649 |
|
650 TName phonebookName(KNullDesC); |
|
651 phoneBookDataPackage.GetPhoneBookName(phonebookName); |
|
652 __ASSERT_DEBUG(phonebookName != KNullDesC, CtsyDispatcherPanic(EInvalidParameter)); |
|
653 __ASSERT_DEBUG(Phonebook(phonebookName) != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
654 |
|
655 const DispatcherPhonebook::TPhonebook phonebookType = Phonebook(phonebookName); |
|
656 __ASSERT_DEBUG(phonebookType != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
657 |
|
658 // Call Handle... method in Licensee LTSY |
|
659 ret = iLtsyDispatchPhonebookStoreCache->HandleStoreCacheReqL(Phonebook(phonebookName)); |
|
660 } |
|
661 |
|
662 return TSYLOGSETEXITERR(ret); |
|
663 } // CPhonebookDispatcher::DispatchStoreCacheL |
|
664 |
|
665 TInt CPhonebookDispatcher::DispatchStoreGetInfoL(const CMmDataPackage* aDataPackage) |
|
666 /** |
|
667 * Unpack data related to EMmTsyPhoneBookStoreGetInfoIPC |
|
668 * and pass request on to Licensee LTSY. |
|
669 * |
|
670 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
671 * the Licensee LTSY does not support this request. |
|
672 */ |
|
673 { |
|
674 TSYLOGENTRYEXIT; |
|
675 TInt ret = KErrNotSupported; |
|
676 |
|
677 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
678 |
|
679 // Call Handle... method in Licensee LTSY |
|
680 if (iLtsyDispatchPhonebookStoreGetPhonebookInfo) |
|
681 { |
|
682 const CPhoneBookDataPackage& phoneBookDataPackage = *static_cast<const CPhoneBookDataPackage*>(aDataPackage); |
|
683 |
|
684 TName phonebookName; |
|
685 phoneBookDataPackage.GetPhoneBookName(phonebookName); |
|
686 __ASSERT_DEBUG(phonebookName != KNullDesC, CtsyDispatcherPanic(EInvalidParameter)); |
|
687 __ASSERT_DEBUG(Phonebook(phonebookName) != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
688 |
|
689 ret = iLtsyDispatchPhonebookStoreGetPhonebookInfo->HandleStoreGetPhonebookInfoReqL(Phonebook(phonebookName)); |
|
690 } |
|
691 |
|
692 return TSYLOGSETEXITERR(ret); |
|
693 } // CPhonebookDispatcher::DispatchStoreGetInfoL |
|
694 |
|
695 TInt CPhonebookDispatcher::DispatchStoreInitialiseL(const CMmDataPackage* aDataPackage) |
|
696 /** |
|
697 * Unpack data related to EMmTsyPhoneBookStoreInitIPC |
|
698 * and pass request on to Licensee LTSY. |
|
699 * |
|
700 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
701 * the Licensee LTSY does not support this request. |
|
702 */ |
|
703 { |
|
704 TSYLOGENTRYEXIT; |
|
705 TInt ret = KErrNotSupported; |
|
706 |
|
707 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
708 |
|
709 // Call Handle... method in Licensee LTSY |
|
710 if (iLtsyDispatchPhonebookStoreInitialise) |
|
711 { |
|
712 const CPhoneBookDataPackage& phoneBookDataPackage = *static_cast<const CPhoneBookDataPackage*>(aDataPackage); |
|
713 |
|
714 __ASSERT_DEBUG(iInitialisePhonebook == DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
715 |
|
716 TName phonebookName; |
|
717 phoneBookDataPackage.GetPhoneBookName(phonebookName); |
|
718 |
|
719 iInitialisePhonebook = Phonebook(phonebookName); |
|
720 |
|
721 __ASSERT_DEBUG(iInitialisePhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
722 |
|
723 ret = iLtsyDispatchPhonebookStoreInitialise->HandleStoreInitialiseReqL(); |
|
724 } |
|
725 |
|
726 return TSYLOGSETEXITERR(ret); |
|
727 } // CPhonebookDispatcher::DispatchStoreInitialiseL |
|
728 |
|
729 TInt CPhonebookDispatcher::DispatchStoreDeleteAllL(const CMmDataPackage* aDataPackage) |
|
730 /** |
|
731 * Unpack data related to EMmTsyPhoneBookStoreDeleteAllIPC |
|
732 * and pass request on to Licensee LTSY. |
|
733 * |
|
734 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
735 * the Licensee LTSY does not support this request. |
|
736 */ |
|
737 { |
|
738 TSYLOGENTRYEXIT; |
|
739 TInt ret = KErrNotSupported; |
|
740 |
|
741 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
742 |
|
743 // Call Handle... method in Licensee LTSY |
|
744 if (iLtsyDispatchPhonebookStoreDeleteAll) |
|
745 { |
|
746 const CPhoneBookDataPackage& phoneBookDataPackage = *static_cast<const CPhoneBookDataPackage*>(aDataPackage); |
|
747 |
|
748 TName phonebookName(KNullDesC); |
|
749 phoneBookDataPackage.GetPhoneBookName(phonebookName); |
|
750 __ASSERT_DEBUG(phonebookName != KNullDesC, CtsyDispatcherPanic(EInvalidParameter)); |
|
751 __ASSERT_DEBUG(Phonebook(phonebookName) != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
752 |
|
753 ret = iLtsyDispatchPhonebookStoreDeleteAll->HandleStoreDeleteAllReqL(Phonebook(phonebookName)); |
|
754 } |
|
755 |
|
756 return TSYLOGSETEXITERR(ret); |
|
757 } // CPhonebookDispatcher::DispatchStoreDeleteAllL |
|
758 |
|
759 TInt CPhonebookDispatcher::DispatchSmsStoreReadAllL() |
|
760 /** |
|
761 * Pass request for EMobilePhoneStoreReadAllPhase1 on to Licensee LTSY. |
|
762 * |
|
763 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
764 * the Licensee LTSY does not support this request. |
|
765 */ |
|
766 { |
|
767 TSYLOGENTRYEXIT; |
|
768 TInt ret = KErrNotSupported; |
|
769 |
|
770 // Call Handle... method in Licensee LTSY |
|
771 if (iLtsyDispatchPhonebookSmsStoreReadAll) |
|
772 { |
|
773 ret = iLtsyDispatchPhonebookSmsStoreReadAll->HandleSmsStoreReadAllReqL(); |
|
774 } |
|
775 |
|
776 return TSYLOGSETEXITERR(ret); |
|
777 } // CPhonebookDispatcher::DispatchSmsStoreReadAllL |
|
778 |
|
779 TInt CPhonebookDispatcher::DispatchStoreWriteEntryL(const CMmDataPackage* aDataPackage) |
|
780 /** |
|
781 * Unpack data related to EMmTsyPhoneBookStoreWriteIPC |
|
782 * and pass request on to Licensee LTSY. |
|
783 * |
|
784 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
785 * the Licensee LTSY does not support this request. |
|
786 */ |
|
787 { |
|
788 TSYLOGENTRYEXIT; |
|
789 TInt ret = KErrNotSupported; |
|
790 |
|
791 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
792 |
|
793 // Call Handle... method in Licensee LTSY |
|
794 if (iLtsyDispatchPhonebookStoreWriteEntry) |
|
795 { |
|
796 const CPhoneBookDataPackage& phoneBookDataPackage = *static_cast<const CPhoneBookDataPackage*>(aDataPackage); |
|
797 |
|
798 TName phonebookName(KNullDesC); |
|
799 phoneBookDataPackage.GetPhoneBookName(phonebookName); |
|
800 __ASSERT_DEBUG(phonebookName != KNullDesC, CtsyDispatcherPanic(EInvalidParameter)); |
|
801 __ASSERT_DEBUG(Phonebook(phonebookName) != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
802 |
|
803 TInt index; |
|
804 CPhoneBookStoreEntry* ctsyPhonebookEntry = NULL; |
|
805 |
|
806 phoneBookDataPackage.UnPackData(index,ctsyPhonebookEntry); |
|
807 __ASSERT_DEBUG(ctsyPhonebookEntry, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
808 |
|
809 //this will be used to convert the CPhoneBookStoreEntry to a TDesC8 containing a TLV |
|
810 CPhoneBookEntry* dispatchPhoneBookEntry = CPhoneBookEntry::NewLC(); |
|
811 |
|
812 //convert CPhoneBookStoreEntry to a CPhoneBookEntry |
|
813 User::LeaveIfError(FillPhoneBookEntry(*ctsyPhonebookEntry,*dispatchPhoneBookEntry)); |
|
814 ctsyPhonebookEntry = NULL; //don't need this anymore (CTSY owned) |
|
815 dispatchPhoneBookEntry->SetIndex(index); |
|
816 |
|
817 //the buffer for the TLV |
|
818 RBuf8 tlvEntry; |
|
819 CleanupClosePushL(tlvEntry); |
|
820 tlvEntry.CreateL(dispatchPhoneBookEntry->TlvLength()); |
|
821 |
|
822 CPhoneBookBuffer* phoneBookBuffer = new (ELeave) CPhoneBookBuffer(); |
|
823 CleanupStack::PushL(phoneBookBuffer); |
|
824 phoneBookBuffer->Set(&tlvEntry); |
|
825 //create the TLV |
|
826 User::LeaveIfError(dispatchPhoneBookEntry->ExternalizeToTlvEntry(*phoneBookBuffer)); |
|
827 |
|
828 CleanupStack::PopAndDestroy(phoneBookBuffer); |
|
829 |
|
830 ret = iLtsyDispatchPhonebookStoreWriteEntry->HandleStoreWriteEntryReqL(Phonebook(phonebookName),tlvEntry); |
|
831 |
|
832 CleanupStack::PopAndDestroy(&tlvEntry); |
|
833 CleanupStack::PopAndDestroy(dispatchPhoneBookEntry); |
|
834 } |
|
835 |
|
836 return TSYLOGSETEXITERR(ret); |
|
837 } // CPhonebookDispatcher::DispatchStoreWriteEntryL |
|
838 |
|
839 TInt CPhonebookDispatcher::DispatchGetPhoneStoreInfoL(const CMmDataPackage* aDataPackage) |
|
840 /** |
|
841 * Unpack data related to EMobilePhoneGetPhoneStoreInfo |
|
842 * and pass request on to Licensee LTSY. |
|
843 * |
|
844 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
845 * the Licensee LTSY does not support this request. |
|
846 */ |
|
847 { |
|
848 TSYLOGENTRYEXIT; |
|
849 TInt ret = KErrNotSupported; |
|
850 |
|
851 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
852 |
|
853 // Call Handle... method in Licensee LTSY |
|
854 if (iLtsyDispatchPhonebookGetPhoneStoreInfo) |
|
855 { |
|
856 //The CTSY treats it as a RMobilePhone::TMobileName but really ETel sends it as a TName |
|
857 RMobilePhone::TMobileName* storeNamePtr = NULL; |
|
858 aDataPackage->UnPackData(&storeNamePtr); |
|
859 __ASSERT_DEBUG(storeNamePtr, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
860 |
|
861 ret = iLtsyDispatchPhonebookGetPhoneStoreInfo->HandleGetPhoneStoreInfoReqL(*storeNamePtr); |
|
862 } |
|
863 |
|
864 return TSYLOGSETEXITERR(ret); |
|
865 } // CPhonebookDispatcher::DispatchGetPhoneStoreInfoL |
|
866 |
|
867 TInt CPhonebookDispatcher::DispatchSmsStoreDeleteEntryL(const CMmDataPackage* aDataPackage) |
|
868 /** |
|
869 * Unpack data related to EMobilePhoneStoreDelete |
|
870 * and pass request on to Licensee LTSY. |
|
871 * |
|
872 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
873 * the Licensee LTSY does not support this request. |
|
874 */ |
|
875 { |
|
876 TSYLOGENTRYEXIT; |
|
877 TInt ret = KErrNotSupported; |
|
878 |
|
879 // Unpack data for this request inside the if statement if required, |
|
880 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
881 |
|
882 // Call Handle... method in Licensee LTSY |
|
883 |
|
884 TInt index; |
|
885 aDataPackage->UnPackData(index); |
|
886 if (iLtsyDispatchPhonebookSmsStoreDeleteEntry) |
|
887 { |
|
888 ret = iLtsyDispatchPhonebookSmsStoreDeleteEntry->HandleSmsStoreDeleteEntryReqL(index); |
|
889 } |
|
890 |
|
891 return TSYLOGSETEXITERR(ret); |
|
892 } // CPhonebookDispatcher::DispatchSmsStoreDeleteEntryL |
|
893 |
|
894 TInt CPhonebookDispatcher::DispatchSmsStoreDeleteAllL() |
|
895 /** |
|
896 * Pass request for EMobilePhoneStoreDeleteAll on to Licensee LTSY. |
|
897 * |
|
898 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
899 * the Licensee LTSY does not support this request. |
|
900 */ |
|
901 { |
|
902 TSYLOGENTRYEXIT; |
|
903 TInt ret = KErrNotSupported; |
|
904 |
|
905 // Call Handle... method in Licensee LTSY |
|
906 if (iLtsyDispatchPhonebookSmsStoreDeleteAll) |
|
907 { |
|
908 ret = iLtsyDispatchPhonebookSmsStoreDeleteAll->HandleSmsStoreDeleteAllReqL(); |
|
909 } |
|
910 |
|
911 return TSYLOGSETEXITERR(ret); |
|
912 } // CPhonebookDispatcher::DispatchSmsStoreDeleteAllL |
|
913 |
|
914 TInt CPhonebookDispatcher::DispatchSmsStoreGetInfoL() |
|
915 /** |
|
916 * Pass request for EMobilePhoneStoreGetInfo on to Licensee LTSY. |
|
917 * |
|
918 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
919 * the Licensee LTSY does not support this request. |
|
920 */ |
|
921 { |
|
922 TSYLOGENTRYEXIT; |
|
923 TInt ret = KErrNotSupported; |
|
924 |
|
925 // Call handle method for EMobilePhoneStoreGetInfo in Licensee LTSY |
|
926 if (iLtsyDispatchPhonebookSmsStoreGetInfo) |
|
927 { |
|
928 ret = iLtsyDispatchPhonebookSmsStoreGetInfo->HandleSmsStoreGetInfoReqL(); |
|
929 } |
|
930 |
|
931 return TSYLOGSETEXITERR(ret); |
|
932 } // CPhonebookDispatcher::DispatchSmsStoreGetInfoL |
|
933 |
|
934 TInt CPhonebookDispatcher::DispatchSmsStoreReadEntryL(const CMmDataPackage* aDataPackage) |
|
935 /** |
|
936 * Unpack data related to EMobilePhoneStoreRead |
|
937 * and pass request on to Licensee LTSY. |
|
938 * |
|
939 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
940 * the Licensee LTSY does not support this request. |
|
941 */ |
|
942 { |
|
943 TSYLOGENTRYEXIT; |
|
944 TInt ret = KErrNotSupported; |
|
945 |
|
946 // Unpack data for this request inside the if statement if required, |
|
947 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
948 |
|
949 TInt index; |
|
950 aDataPackage->UnPackData(index); |
|
951 // Call Handle... method in Licensee LTSY |
|
952 if (iLtsyDispatchPhonebookSmsStoreReadEntry) |
|
953 { |
|
954 ret = iLtsyDispatchPhonebookSmsStoreReadEntry->HandleSmsStoreReadEntryReqL(index); |
|
955 } |
|
956 |
|
957 return TSYLOGSETEXITERR(ret); |
|
958 } // CPhonebookDispatcher::DispatchSmsStoreReadEntryL |
|
959 |
|
960 TInt CPhonebookDispatcher::DispatchSmsStoreWriteEntryL(const CMmDataPackage* aDataPackage) |
|
961 /** |
|
962 * Unpack data related to EMobilePhoneStoreWrite |
|
963 * and pass request on to Licensee LTSY. |
|
964 * |
|
965 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
966 * the Licensee LTSY does not support this request. |
|
967 */ |
|
968 { |
|
969 TSYLOGENTRYEXIT; |
|
970 TInt ret = KErrNotSupported; |
|
971 |
|
972 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
973 |
|
974 TDesC8** data = NULL; |
|
975 TInt* index = NULL; |
|
976 |
|
977 aDataPackage->UnPackData(&data,&index); |
|
978 |
|
979 if(!data || !index) |
|
980 { |
|
981 ret = KErrCorrupt; |
|
982 } |
|
983 else |
|
984 { |
|
985 RMobileSmsStore::TMobileGsmSmsEntryV1& mobileGsmSmsEntry = (static_cast<RMobileSmsStore::TMobileGsmSmsEntryV1Pckg&>(**data))(); |
|
986 |
|
987 //the CTSY packs index which is also set in the Gsm Sms Entry, this index is not passed though the interface |
|
988 //as a client can examine it from the MobileGsmSmsEntry, we assert here in case the CTSY sets one but not |
|
989 //the other |
|
990 __ASSERT_DEBUG(*index == mobileGsmSmsEntry.iIndex,CtsyDispatcherPanic(ESlotIndexesDontMatch)); |
|
991 if (*index != mobileGsmSmsEntry.iIndex) |
|
992 { |
|
993 //for urel build |
|
994 ret = KErrArgument; |
|
995 } |
|
996 // Call Handle... method in Licensee LTSY |
|
997 else if (iLtsyDispatchPhonebookSmsStoreWriteEntry) |
|
998 { |
|
999 ret = iLtsyDispatchPhonebookSmsStoreWriteEntry->HandleSmsStoreWriteEntryReqL(mobileGsmSmsEntry); |
|
1000 } |
|
1001 } |
|
1002 |
|
1003 return TSYLOGSETEXITERR(ret); |
|
1004 } // CPhonebookDispatcher::DispatchSmsStoreWriteEntryL |
|
1005 |
|
1006 TInt CPhonebookDispatcher::DispatchStoreCacheCancelL(const CMmDataPackage* aDataPackage) |
|
1007 /** |
|
1008 * Unpack data related to EMmTsyPhoneBookStoreCacheCancelIPC |
|
1009 * and pass request on to Licensee LTSY. |
|
1010 * |
|
1011 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
1012 * the Licensee LTSY does not support this request. |
|
1013 */ |
|
1014 { |
|
1015 TSYLOGENTRYEXIT; |
|
1016 TInt ret = KErrNotSupported; |
|
1017 |
|
1018 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
1019 |
|
1020 // Call Handle... method in Licensee LTSY |
|
1021 if (iLtsyDispatchPhonebookStoreCacheCancel) |
|
1022 { |
|
1023 const CPhoneBookDataPackage& phoneBookDataPackage = *static_cast<const CPhoneBookDataPackage*>(aDataPackage); |
|
1024 |
|
1025 TName phonebookName(KNullDesC); |
|
1026 phoneBookDataPackage.GetPhoneBookName(phonebookName); |
|
1027 __ASSERT_DEBUG(phonebookName != KNullDesC, CtsyDispatcherPanic(EInvalidParameter)); |
|
1028 __ASSERT_DEBUG(Phonebook(phonebookName) != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1029 |
|
1030 ret = iLtsyDispatchPhonebookStoreCacheCancel->HandleStoreCacheCancelReqL(Phonebook(phonebookName)); |
|
1031 } |
|
1032 |
|
1033 return TSYLOGSETEXITERR(ret); |
|
1034 } // CPhonebookDispatcher::DispatchStoreCacheCancelL |
|
1035 |
|
1036 |
|
1037 // |
|
1038 // Callback handlers follow |
|
1039 // |
|
1040 |
|
1041 |
|
1042 |
|
1043 void CPhonebookDispatcher::CallbackStoreResetCache(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook) |
|
1044 /** |
|
1045 * Callback function to be used by the request to complete |
|
1046 * CCtsyDispatcherCallback::CallbackPhonebookStoreResetCacheInd() |
|
1047 * |
|
1048 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1049 * @param aPhonebook The phonebook to reset the cache for. |
|
1050 */ |
|
1051 { |
|
1052 TSYLOGENTRYEXITARGS(_L8("aError=%d,aPhonebook=%d"), aError, aPhonebook); |
|
1053 |
|
1054 __ASSERT_DEBUG(aPhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1055 |
|
1056 CPhoneBookDataPackage phoneBookDataPackage; |
|
1057 phoneBookDataPackage.SetPhoneBookName(PhonebookName(aPhonebook)); |
|
1058 |
|
1059 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreResetCacheIPC, &phoneBookDataPackage, aError); |
|
1060 |
|
1061 } // CPhonebookDispatcher::CallbackStoreResetCache |
|
1062 |
|
1063 void CPhonebookDispatcher::CallbackStoreSetFdnPhonebookInfoInd(TInt aError, TInt aTotalEntries, TInt aMaxTextLength, TInt aMaxNumberLength) |
|
1064 /** |
|
1065 * Callback function to be used by the request to complete |
|
1066 * CCtsyDispatcherCallback::CallbackPhonebookStoreSetFdnPhonebookInfoInd() |
|
1067 * |
|
1068 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1069 * @param aTotalEntries The total number of entries in the Fdn phonebook. |
|
1070 * @param aMaxTextLength The maximum text length in the Fdn phonebook. |
|
1071 * @param aMaxNumberLength The maximum number length in the Fdn phonebook. |
|
1072 */ |
|
1073 { |
|
1074 TSYLOGENTRYEXITARGS(_L8("aError=%d,aTotalEntries=%d,aMaxTextLength=%d,aMaxNumberLength=%d"), |
|
1075 aError,aTotalEntries,aMaxTextLength,aMaxNumberLength); |
|
1076 |
|
1077 TName phoneBookName(KETelIccFdnPhoneBook); |
|
1078 CPhoneBookDataPackage phoneBookDataPackage; |
|
1079 phoneBookDataPackage.SetPhoneBookName(phoneBookName); |
|
1080 |
|
1081 TPBFdnInfo pbFdnInfo; |
|
1082 pbFdnInfo.iFDNNumOfEntries = aTotalEntries; |
|
1083 pbFdnInfo.iFDNNumberLengthMax = aMaxNumberLength; |
|
1084 pbFdnInfo.iFDNTextLengthMax = aMaxTextLength; |
|
1085 |
|
1086 phoneBookDataPackage.PackData(&pbFdnInfo); |
|
1087 |
|
1088 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreFdnInfoIPC, &phoneBookDataPackage, aError); |
|
1089 |
|
1090 } // CPhonebookDispatcher::CallbackStoreSetFdnPhonebookInfoInd |
|
1091 |
|
1092 void CPhonebookDispatcher::CallbackStoreReadEntry(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, const TDesC8& aPhonebookEntries) |
|
1093 /** |
|
1094 * Callback function to be used by the request to complete |
|
1095 * CCtsyDispatcherCallback::CallbackPhonebookStoreReadEntryComp() |
|
1096 * |
|
1097 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1098 * @param aPhonebook The phonebook of which the read request was made and which the enties are for. |
|
1099 * @param aPhonebookEntries The read entries from the phonebook encoded in a TLV, this can either be encoded directly |
|
1100 * via a CPhoneBookBuffer() or via the CPhoneBookEntry::ExternalizeToTlvEntry() utility. |
|
1101 * |
|
1102 * @see RMobilePhoneBookStore::Read() |
|
1103 * @see CPhoneBookBuffer() |
|
1104 * @see CPhoneBookEntry::ExternalizeToTlvEntry() |
|
1105 */ |
|
1106 { |
|
1107 TSYLOGENTRYEXITARGS(_L8("aError=%d,aPhonebook=%d"), aError, aPhonebook); |
|
1108 |
|
1109 __ASSERT_DEBUG(aPhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1110 |
|
1111 if (iPhonebookReadPtrs[aPhonebook] != NULL) |
|
1112 { |
|
1113 iPhonebookReadPtrs[aPhonebook] = NULL; |
|
1114 } |
|
1115 |
|
1116 if((aError == KErrNone) && (aPhonebook != DispatcherPhonebook::EUnknown)) |
|
1117 { |
|
1118 //fill the CTSY pointer |
|
1119 CArrayPtrSeg<CPhoneBookStoreEntry>* readEntries = new(ELeave) CArrayPtrSeg<CPhoneBookStoreEntry>(1); |
|
1120 iPhonebookReadPtrs[aPhonebook] = readEntries; |
|
1121 |
|
1122 TRAP(aError,FillCtsyPhoneBookStoreL(aPhonebookEntries,*(iPhonebookReadPtrs[aPhonebook]))); |
|
1123 } |
|
1124 |
|
1125 CPhoneBookDataPackage phoneBookDataPackage; |
|
1126 phoneBookDataPackage.SetPhoneBookName(PhonebookName(aPhonebook)); |
|
1127 phoneBookDataPackage.PackData(&(iPhonebookReadPtrs[aPhonebook])); |
|
1128 |
|
1129 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreReadIPC, &phoneBookDataPackage, aError); |
|
1130 |
|
1131 } // CPhonebookDispatcher::CallbackStoreReadEntry |
|
1132 |
|
1133 void CPhonebookDispatcher::CallbackStoreDeleteEntry(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, TInt aMaxNumberLength) |
|
1134 /** |
|
1135 * Callback function to be used by the request to complete |
|
1136 * CCtsyDispatcherCallback::CallbackPhonebookStoreDeleteEntryComp() |
|
1137 * |
|
1138 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1139 * @param aPhonebook The phonebook of which the delete request was made. |
|
1140 * @param aMaxNumberLength The new maximum number length possible in the phonebook, this field is |
|
1141 * only relevant to Fdn, Adn and Vmb phonebooks. |
|
1142 * |
|
1143 * @see RMobilePhoneBookStore::Delete() |
|
1144 */ |
|
1145 { |
|
1146 TSYLOGENTRYEXITARGS(_L8("aError=%d, aPhonebook=%d, aMaxNumberLength=%d"), aError, aPhonebook, aMaxNumberLength); |
|
1147 |
|
1148 __ASSERT_DEBUG(aPhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1149 |
|
1150 CPhoneBookDataPackage phoneBookDataPackage; |
|
1151 phoneBookDataPackage.SetPhoneBookName(PhonebookName(aPhonebook)); |
|
1152 |
|
1153 TPBEntryInfo pbEntryInfo; |
|
1154 pbEntryInfo.iLocation = 0; //not used the CTSY |
|
1155 pbEntryInfo.iMaxNumLength = aMaxNumberLength; |
|
1156 |
|
1157 phoneBookDataPackage.PackData(&pbEntryInfo); |
|
1158 |
|
1159 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreDeleteIPC, &phoneBookDataPackage, aError); |
|
1160 |
|
1161 } // CPhonebookDispatcher::CallbackStoreDeleteEntry |
|
1162 |
|
1163 void CPhonebookDispatcher::CallbackStoreCache(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, const TDesC8& aPhonebookEntries) |
|
1164 /** |
|
1165 * Callback function to be used by the request to complete |
|
1166 * CCtsyDispatcherCallback::CallbackPhonebookStoreCacheComp() |
|
1167 * |
|
1168 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1169 * @param aPhonebook The phonebook of which the cache entries are for (and the request was made from). |
|
1170 * @param aPhonebookEntries All entries from the phonebook encoded in a TLV, this can either be encoded directly |
|
1171 * via a CPhoneBookBuffer() or via the CPhoneBookEntry::ExternalizeToTlvEntry() utility. |
|
1172 * |
|
1173 * @see CPhoneBookBuffer() |
|
1174 * @see CPhoneBookEntry::ExternalizeToTlvEntry() |
|
1175 */ |
|
1176 { |
|
1177 TSYLOGENTRYEXITARGS(_L8("aError=%d,aPhonebook=%d"), aError, aPhonebook); |
|
1178 |
|
1179 __ASSERT_DEBUG(aPhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1180 |
|
1181 if (iPhonebookCachePtrs[aPhonebook] != NULL) |
|
1182 { |
|
1183 iPhonebookCachePtrs[aPhonebook] = NULL; |
|
1184 } |
|
1185 |
|
1186 if((aError == KErrNone) && (aPhonebook != DispatcherPhonebook::EUnknown)/* && (iPhonebookCachePtrs[aPhonebook])*/) |
|
1187 { |
|
1188 CArrayPtrSeg<CPhoneBookStoreEntry>* readEntries = new(ELeave) CArrayPtrSeg<CPhoneBookStoreEntry>(1); |
|
1189 iPhonebookCachePtrs[aPhonebook] = readEntries; |
|
1190 |
|
1191 TRAP(aError,FillCtsyPhoneBookStoreL(aPhonebookEntries, *(iPhonebookCachePtrs[aPhonebook]))); |
|
1192 |
|
1193 if(aError) |
|
1194 { |
|
1195 iPhonebookCachePtrs[aPhonebook]->ResetAndDestroy(); |
|
1196 } |
|
1197 } |
|
1198 CPhoneBookDataPackage phoneBookDataPackage; |
|
1199 phoneBookDataPackage.SetPhoneBookName(PhonebookName(aPhonebook)); |
|
1200 phoneBookDataPackage.PackData(&(iPhonebookCachePtrs[aPhonebook])); |
|
1201 |
|
1202 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreCacheIPC, &phoneBookDataPackage, aError); |
|
1203 } // CPhonebookDispatcher::CallbackStoreCache |
|
1204 |
|
1205 void CPhonebookDispatcher::CallbackStoreGetPhonebookInfo(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, TInt aUsedEntries) |
|
1206 /** |
|
1207 * Callback function to be used by the request to complete |
|
1208 * CCtsyDispatcherCallback::CallbackPhonebookStoreGetPhonebookInfoComp() |
|
1209 * |
|
1210 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1211 * @param aPhonebook The phonebook name of which the phonebook information is for. |
|
1212 * @param aUsedEntries The number of used entries in the phonebook. |
|
1213 * |
|
1214 * @see RMobilePhoneBookStore::GetInfo() |
|
1215 */ |
|
1216 { |
|
1217 TSYLOGENTRYEXITARGS(_L8("aError=%d, aPhonebook=%d, aUsedEntries=%d"), aError, aPhonebook, aUsedEntries); |
|
1218 |
|
1219 __ASSERT_DEBUG(aPhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1220 |
|
1221 CPhoneBookDataPackage phoneBookDataPackage; |
|
1222 phoneBookDataPackage.SetPhoneBookName(PhonebookName(aPhonebook)); |
|
1223 |
|
1224 phoneBookDataPackage.PackData(&aUsedEntries); |
|
1225 |
|
1226 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreGetInfoIPC, &phoneBookDataPackage, aError); |
|
1227 |
|
1228 } // CPhonebookDispatcher::CallbackStoreGetInfo |
|
1229 |
|
1230 void CPhonebookDispatcher::CallbackStoreInitialise(TInt aError, const DispatcherPhonebook::TPhonebookStoreInfoV1& aPhonebookStoreInfo) |
|
1231 /** |
|
1232 * Callback function to be used by the request to complete |
|
1233 * CCtsyDispatcherCallback::CallbackPhonebookStoreInitialiseComp() |
|
1234 * |
|
1235 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1236 * @param aPhonebookStoreInfo The information relating to the whole phonebook store. |
|
1237 */ |
|
1238 { |
|
1239 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
1240 |
|
1241 __ASSERT_DEBUG(iInitialisePhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1242 |
|
1243 CPhoneBookDataPackage phoneBookDataPackage; |
|
1244 phoneBookDataPackage.SetPhoneBookName(PhonebookName(iInitialisePhonebook)); |
|
1245 iInitialisePhonebook = DispatcherPhonebook::EUnknown; |
|
1246 |
|
1247 //CTSY C-Type class really a T-Type class so on the stack |
|
1248 CStorageInfoData storageInfoData; |
|
1249 |
|
1250 //convert the TPhonebookStoreInfoV1 to the CTSY CStorageInfoData |
|
1251 PhonebookStoreToStorageInfo(aPhonebookStoreInfo,storageInfoData); |
|
1252 |
|
1253 phoneBookDataPackage.PackData(&storageInfoData); |
|
1254 |
|
1255 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreInitIPC, &phoneBookDataPackage, aError); |
|
1256 |
|
1257 } // CPhonebookDispatcher::CallbackStoreInitialise |
|
1258 |
|
1259 void CPhonebookDispatcher::CallbackStoreDeleteAll(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, TInt aMaxNumberLength) |
|
1260 /** |
|
1261 * Callback function to be used by the request to complete |
|
1262 * CCtsyDispatcherCallback::CallbackPhonebookStoreDeleteAllComp() |
|
1263 * |
|
1264 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1265 * @param aPhonebook The phonebook name for which the delete all request was made. |
|
1266 * @param aMaxNumberLength The new maximum number length possible in the phonebook, this field is |
|
1267 * only relevant to Fdn, Adn and Vmb phonebooks. |
|
1268 * |
|
1269 * @see RMobilePhoneBookStore::DeleteAll() |
|
1270 */ |
|
1271 { |
|
1272 TSYLOGENTRYEXITARGS(_L8("aError=%d, aPhonebook=%d, aMaxNumberLength=%d"), aError, aPhonebook, aMaxNumberLength); |
|
1273 |
|
1274 __ASSERT_DEBUG(aPhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1275 |
|
1276 CPhoneBookDataPackage phoneBookDataPackage; |
|
1277 phoneBookDataPackage.SetPhoneBookName(PhonebookName(aPhonebook)); |
|
1278 |
|
1279 TPBEntryInfo pbEntryInfo; |
|
1280 pbEntryInfo.iLocation = 0; //not used in the CTSY |
|
1281 pbEntryInfo.iMaxNumLength = aMaxNumberLength; |
|
1282 |
|
1283 phoneBookDataPackage.PackData(&pbEntryInfo); |
|
1284 |
|
1285 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreDeleteAllIPC, &phoneBookDataPackage, aError); |
|
1286 } // CPhonebookDispatcher::CallbackStoreDeleteAll |
|
1287 |
|
1288 void CPhonebookDispatcher::CallbackSmsStoreReadAll(TInt aError, const DispatcherPhonebook::TSmsData& aSmsData, TInt aIndex, TBool aMoreToCome, TBool aReceivedClass2ToBeResent) |
|
1289 /** |
|
1290 * Callback function to be used by the request to complete |
|
1291 * CCtsyDispatcherCallback::CallbackPhonebookSmsStoreReadAllComp() |
|
1292 * |
|
1293 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1294 * @param aSmsData SMS data. |
|
1295 * @param aIndex index of the SMS entry. |
|
1296 * @param aMoreToCome ETrue if there will be other SMS entries, EFalse otherwise. |
|
1297 * @param aReceivedClass2ToBeResent ETrue if received class is to be resent, else EFalse. |
|
1298 * |
|
1299 * @see CRetrieveMobilePhoneSmsList::Start() |
|
1300 */ |
|
1301 { |
|
1302 TSYLOGENTRYEXITARGS(_L8("aError=%d, aIndex=%d"), aError, aIndex); |
|
1303 TInt errorCode = aError; |
|
1304 |
|
1305 if (errorCode == KErrNone) |
|
1306 { |
|
1307 TRAP(errorCode, FillSmsStoreListL(aSmsData, aIndex, *iSmsListArray)); |
|
1308 } |
|
1309 |
|
1310 if (!aMoreToCome || errorCode != KErrNone) |
|
1311 { |
|
1312 CMmDataPackage dataPackage; |
|
1313 dataPackage.PackData(&iSmsListArray, &aReceivedClass2ToBeResent); |
|
1314 |
|
1315 iMessageManagerCallback.Complete(EMobilePhoneStoreReadAllPhase1, &dataPackage, aError); |
|
1316 iSmsListArray->ResetAndDestroy(); |
|
1317 } |
|
1318 |
|
1319 } // CPhonebookDispatcher::CallbackSmsStoreReadAll |
|
1320 |
|
1321 void CPhonebookDispatcher::CallbackStoreWriteEntry(TInt aError, DispatcherPhonebook::TPhonebook aPhonebook, TUint16 aIndex, TInt aMaxNumberLength) |
|
1322 /** |
|
1323 * Callback function to be used by the request to complete |
|
1324 * CCtsyDispatcherCallback::CallbackPhonebookStoreWriteEntryComp() |
|
1325 * |
|
1326 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1327 * KErrGsmSimServSneFull, KErrGsmSimServAnrFull, or KErrGsmSimServEmailFull indicates one of the |
|
1328 * services is full and the field of the entry (e.g. Email) could not be written. |
|
1329 * In the cache case the field (e.g. Email) is not written to the cache but the other |
|
1330 * fields are written, the request is then completed with the error code. In the non-cache case |
|
1331 * the request is completed with the error code. |
|
1332 * @param aPhonebook The phonebook name for which the write request was made. |
|
1333 * @param aIndex The index to which the entry was written in the phonebook. |
|
1334 * @param aMaxNumberLength The new maximum number length possible in the phonebook, this field is |
|
1335 * only relevant to Fdn, Adn and Vmb phonebooks. |
|
1336 * |
|
1337 * @see RMobilePhoneBookStore::Write() |
|
1338 */ |
|
1339 { |
|
1340 TSYLOGENTRYEXITARGS(_L8("aError=%d,aPhonebook=%d,aIndex=%d,aMaxNumberLength=%d"), aError, aPhonebook, aIndex, aMaxNumberLength); |
|
1341 |
|
1342 __ASSERT_DEBUG(aPhonebook != DispatcherPhonebook::EUnknown, CtsyDispatcherPanic(EInvalidParameter)); |
|
1343 |
|
1344 CPhoneBookDataPackage phoneBookDataPackage; |
|
1345 phoneBookDataPackage.SetPhoneBookName(PhonebookName(aPhonebook)); |
|
1346 |
|
1347 TPBEntryInfo pbEntryInfo; |
|
1348 pbEntryInfo.iLocation = aIndex; |
|
1349 pbEntryInfo.iMaxNumLength = aMaxNumberLength; |
|
1350 |
|
1351 phoneBookDataPackage.PackData(&pbEntryInfo); |
|
1352 |
|
1353 iMessageManagerCallback.Complete(EMmTsyPhoneBookStoreWriteIPC, &phoneBookDataPackage, aError); |
|
1354 |
|
1355 } // CPhonebookDispatcher::CallbackStoreWriteEntry |
|
1356 |
|
1357 void CPhonebookDispatcher::CallbackGetPhoneStoreInfo(TInt aError, const RMobilePhoneStore::TMobilePhoneStoreInfoV1& aPhoneStoreInfo) |
|
1358 /** |
|
1359 * Callback function to be used by the request to complete |
|
1360 * CCtsyDispatcherCallback::CallbackPhonebookGetPhoneStoreInfoComp() |
|
1361 * |
|
1362 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1363 * @param aPhoneStoreInfo The phone store information. |
|
1364 * |
|
1365 * @see RMobilePhone::GetPhoneStoreInfo() |
|
1366 */ |
|
1367 { |
|
1368 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
1369 |
|
1370 CMmDataPackage dataPackage; |
|
1371 dataPackage.PackData(&const_cast<RMobilePhoneStore::TMobilePhoneStoreInfoV1&>(aPhoneStoreInfo)); |
|
1372 |
|
1373 iMessageManagerCallback.Complete(EMobilePhoneGetPhoneStoreInfo, &dataPackage, aError); |
|
1374 |
|
1375 } // CPhonebookDispatcher::CallbackGetPhoneStoreInfo |
|
1376 |
|
1377 void CPhonebookDispatcher::CallbackSmsStoreDeleteEntry(TInt aError) |
|
1378 /** |
|
1379 * Callback function to be used by the request to complete |
|
1380 * CCtsyDispatcherCallback::CallbackPhonebookSmsStoreDeleteEntryComp() |
|
1381 * |
|
1382 * @param aError The error code to be returned. |
|
1383 * |
|
1384 * @see RMobileSmsStore::Delete() |
|
1385 */ |
|
1386 { |
|
1387 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
1388 |
|
1389 iMessageManagerCallback.Complete(EMobilePhoneStoreDelete, aError); |
|
1390 |
|
1391 } // CPhonebookDispatcher::CallbackSmsStoreDeleteEntry |
|
1392 |
|
1393 void CPhonebookDispatcher::CallbackSmsStoreDeleteAll(TInt aError) |
|
1394 /** |
|
1395 * Callback function to be used by the request to complete |
|
1396 * CCtsyDispatcherCallback::CallbackPhonebookSmsStoreDeleteAllComp() |
|
1397 * |
|
1398 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
1399 * |
|
1400 * @see RMobileSmsStore::DeleteAll() |
|
1401 */ |
|
1402 { |
|
1403 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
1404 iMessageManagerCallback.Complete(EMobilePhoneStoreDeleteAll, aError); |
|
1405 |
|
1406 } // CPhonebookDispatcher::CallbackSmsStoreDeleteAll |
|
1407 |
|
1408 void CPhonebookDispatcher::CallbackSmsStoreGetInfo(TInt aError, TInt aTotalEntries, TInt aUsedEntries) |
|
1409 /** |
|
1410 * Callback function to be used by the request to complete |
|
1411 * CCtsyDispatcherCallback::CallbackPhonebookSmsStoreGetInfoComp() |
|
1412 * |
|
1413 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
1414 * @param aTotalEntries total number of entries in the SMS storage. |
|
1415 * @param aUsedEntries total number of used entries in the SMS storage. |
|
1416 * |
|
1417 * @see RMobileSmsStore::GetInfo() |
|
1418 */ |
|
1419 { |
|
1420 TSYLOGENTRYEXITARGS(_L8("aError=%d, aTotalEntries=%d, aUsedEntries=%d"), aError, aTotalEntries, aUsedEntries); |
|
1421 __ASSERT_DEBUG(aTotalEntries <= KMaxTotalEntries, CtsyDispatcherPanic(EInvalidParameter)); |
|
1422 |
|
1423 // Pack the data to return to the Common TSY |
|
1424 CMmDataPackage dataPackage; |
|
1425 dataPackage.PackData(&aTotalEntries, &aUsedEntries); |
|
1426 |
|
1427 if(aTotalEntries <= KMaxTotalEntries) |
|
1428 { |
|
1429 iMessageManagerCallback.Complete(EMobilePhoneStoreGetInfo, &dataPackage, aError); |
|
1430 } |
|
1431 else |
|
1432 { |
|
1433 iMessageManagerCallback.Complete(EMobilePhoneStoreGetInfo, &dataPackage, KErrCorrupt); |
|
1434 } |
|
1435 |
|
1436 } // CPhonebookDispatcher::CallbackSmsStoreGetInfo |
|
1437 |
|
1438 void CPhonebookDispatcher::CallbackSmsStoreReadEntry(TInt aError, const DispatcherPhonebook::TSmsData& aSmsData) |
|
1439 /** |
|
1440 * Callback function to be used by the request to complete |
|
1441 * CCtsyDispatcherCallback::CallbackPhonebookSmsStoreReadEntryComp() |
|
1442 * |
|
1443 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
1444 * @param aSmsData SMS data. |
|
1445 * |
|
1446 * @see RMobileSmsStore::Read() |
|
1447 */ |
|
1448 { |
|
1449 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
1450 |
|
1451 // Pack the data to return to the Common TSY |
|
1452 |
|
1453 TSmsMsg smsMsg; |
|
1454 smsMsg.iSmsMsg.Copy(aSmsData.iSmsMsg); |
|
1455 smsMsg.iServiceCentre.Copy(aSmsData.iServiceCentre); |
|
1456 smsMsg.iMobileScTON = aSmsData.iMobileScTON; |
|
1457 smsMsg.iMobileScNPI = aSmsData.iMobileScNPI; |
|
1458 smsMsg.iMessageStatus = aSmsData.iMessageStatus; |
|
1459 |
|
1460 CMmDataPackage dataPackage; |
|
1461 dataPackage.PackData(const_cast<TSmsMsg*>(&smsMsg)); |
|
1462 iMessageManagerCallback.Complete(EMobilePhoneStoreRead, &dataPackage, aError); |
|
1463 |
|
1464 } // CPhonebookDispatcher::CallbackSmsStoreReadEntry |
|
1465 |
|
1466 void CPhonebookDispatcher::CallbackSmsStoreWriteEntry(TInt aError, TInt aLocation, TBool aReceivedClass2ToBeResent) |
|
1467 /** |
|
1468 * Callback function to be used by the request to complete |
|
1469 * CCtsyDispatcherCallback::CallbackPhonebookSmsStoreWriteEntryComp() |
|
1470 * |
|
1471 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
1472 * @param aLocation location of the entry. |
|
1473 * @param aReceivedClass2ToBeResent ETrue if received class is to be resent, else EFalse. |
|
1474 * |
|
1475 * @see RMobileSmsStore::Write() |
|
1476 */ |
|
1477 { |
|
1478 TSYLOGENTRYEXITARGS(_L8("aError=%d, aLocation=%d, aReceivedClass2ToBeResent=%d"), aError, aLocation, aReceivedClass2ToBeResent); |
|
1479 __ASSERT_DEBUG(aLocation <= KMaxTotalEntries, CtsyDispatcherPanic(EInvalidParameter)); |
|
1480 |
|
1481 // Pack the data to return to the Common TSY |
|
1482 CMmDataPackage dataPackage; |
|
1483 dataPackage.PackData(&aLocation, &aReceivedClass2ToBeResent); |
|
1484 |
|
1485 if(aLocation <= KMaxTotalEntries) |
|
1486 { |
|
1487 iMessageManagerCallback.Complete(EMobilePhoneStoreWrite, &dataPackage, aError); |
|
1488 } |
|
1489 else |
|
1490 { |
|
1491 iMessageManagerCallback.Complete(EMobilePhoneStoreWrite, &dataPackage, KErrCorrupt); |
|
1492 } |
|
1493 |
|
1494 } // CPhonebookDispatcher::CallbackSmsStoreWriteEntry |
|
1495 |
|
1496 void CPhonebookDispatcher::CallbackSync(CRequestQueueOneShot::TIpcDataPackage& aIpcDataPackage) |
|
1497 /** |
|
1498 * Part of the MDispatcherCallback interface. Used to complete requests handled |
|
1499 * synchronously by the Licensee LTSY asynchronously back to the Common TSY. |
|
1500 * |
|
1501 * @param aIpcDataPackage Package encapsulating the request. |
|
1502 * |
|
1503 * @see MDispatcherCallback::CallbackSync |
|
1504 */ |
|
1505 { |
|
1506 TSYLOGENTRYEXIT; |
|
1507 |
|
1508 switch (aIpcDataPackage.iIpc) |
|
1509 { |
|
1510 |
|
1511 default: |
|
1512 LOG(_L8("WARNING: CPhonebookDispatcher::CallbackSync unhandled IPC=%d"), aIpcDataPackage.iIpc); |
|
1513 __ASSERT_DEBUG(NULL, CtsyDispatcherPanic(EUnhandledCtsyIpc)); |
|
1514 break; |
|
1515 } // switch (aIpcDataPackage.iIpc) |
|
1516 |
|
1517 } // CPhonebookDispatcher::CallbackSync |
|
1518 |
|
1519 |
|
1520 |