|
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 <ctsy/serviceapi/cmmsmsutility.h> |
|
17 #include "csmsdispatcher.h" |
|
18 |
|
19 #include <ctsy/ltsy/mltsydispatchsmsinterface.h> |
|
20 #include <ctsy/pluginapi/mmmessagemanagercallback.h> |
|
21 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
22 |
|
23 #include <ctsy/ltsy/ltsylogger.h> |
|
24 #include "ctsydispatcherpanic.h" |
|
25 #include "tdispatcherholder.h" |
|
26 |
|
27 CSmsDispatcher::CSmsDispatcher( |
|
28 MLtsyDispatchFactoryV1& aLtsyFactory, |
|
29 MmMessageManagerCallback& aMessageManagerCallback, |
|
30 CRequestQueueOneShot& aRequestAsyncOneShot) |
|
31 : iLtsyFactoryV1(aLtsyFactory), |
|
32 iMessageManagerCallback(aMessageManagerCallback), |
|
33 iRequestAsyncOneShot(aRequestAsyncOneShot) |
|
34 { |
|
35 } // CSmsDispatcher::CSmsDispatcher |
|
36 |
|
37 |
|
38 CSmsDispatcher::~CSmsDispatcher() |
|
39 { |
|
40 if(iLtsyDataList) |
|
41 { |
|
42 iLtsyDataList->ResetAndDestroy(); |
|
43 delete iLtsyDataList; |
|
44 } |
|
45 } // CSmsDispatcher::~CSmsDispatcher |
|
46 |
|
47 |
|
48 CSmsDispatcher* CSmsDispatcher::NewLC( |
|
49 MLtsyDispatchFactoryV1& aLtsyFactory, |
|
50 MmMessageManagerCallback& aMessageManagerCallback, |
|
51 CRequestQueueOneShot& aRequestAsyncOneShot) |
|
52 { |
|
53 TSYLOGENTRYEXIT; |
|
54 CSmsDispatcher* self = |
|
55 new (ELeave) CSmsDispatcher(aLtsyFactory, aMessageManagerCallback, aRequestAsyncOneShot); |
|
56 CleanupStack::PushL(self); |
|
57 self->ConstructL(); |
|
58 return self; |
|
59 } // CSmsDispatcher::NewLC |
|
60 |
|
61 |
|
62 CSmsDispatcher* CSmsDispatcher::NewL( |
|
63 MLtsyDispatchFactoryV1& aLtsyFactory, |
|
64 MmMessageManagerCallback& aMessageManagerCallback, |
|
65 CRequestQueueOneShot& aRequestAsyncOneShot) |
|
66 { |
|
67 TSYLOGENTRYEXIT; |
|
68 CSmsDispatcher* self = |
|
69 CSmsDispatcher::NewLC(aLtsyFactory, aMessageManagerCallback, aRequestAsyncOneShot); |
|
70 CleanupStack::Pop (self); |
|
71 return self; |
|
72 } // CSmsDispatcher::NewL |
|
73 |
|
74 |
|
75 void CSmsDispatcher::ConstructL() |
|
76 /** |
|
77 * Second phase constructor. |
|
78 */ |
|
79 { |
|
80 TSYLOGENTRYEXIT; |
|
81 |
|
82 // Get the Licensee LTSY interfaces related to Sms functionality |
|
83 // from the factory |
|
84 |
|
85 |
|
86 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsSendSatSms::KLtsyDispatchSmsSendSatSmsApiId)) |
|
87 { |
|
88 TAny* sendSatSmsInterface = NULL; |
|
89 iLtsyFactoryV1.GetDispatchHandler( |
|
90 MLtsyDispatchSmsSendSatSms::KLtsyDispatchSmsSendSatSmsApiId, |
|
91 sendSatSmsInterface); |
|
92 iLtsyDispatchSmsSendSatSms = |
|
93 static_cast<MLtsyDispatchSmsSendSatSms*>(sendSatSmsInterface); |
|
94 __ASSERT_DEBUG(iLtsyDispatchSmsSendSatSms, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
95 } |
|
96 |
|
97 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId)) |
|
98 { |
|
99 TAny* getSmsStoreInfoInterface = NULL; |
|
100 iLtsyFactoryV1.GetDispatchHandler( |
|
101 MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId, |
|
102 getSmsStoreInfoInterface); |
|
103 iLtsyDispatchSmsGetSmsStoreInfo = |
|
104 static_cast<MLtsyDispatchSmsGetSmsStoreInfo*>(getSmsStoreInfoInterface); |
|
105 __ASSERT_DEBUG(iLtsyDispatchSmsGetSmsStoreInfo, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
106 } |
|
107 |
|
108 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId)) |
|
109 { |
|
110 TAny* getSmspListInterface = NULL; |
|
111 iLtsyFactoryV1.GetDispatchHandler( |
|
112 MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, |
|
113 getSmspListInterface); |
|
114 iLtsyDispatchSmsGetSmspList = |
|
115 static_cast<MLtsyDispatchSmsGetSmspList*>(getSmspListInterface); |
|
116 __ASSERT_DEBUG(iLtsyDispatchSmsGetSmspList, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
117 } |
|
118 |
|
119 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId)) |
|
120 { |
|
121 TAny* nackSmsStoredInterface = NULL; |
|
122 iLtsyFactoryV1.GetDispatchHandler( |
|
123 MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, |
|
124 nackSmsStoredInterface); |
|
125 iLtsyDispatchSmsNackSmsStored = |
|
126 static_cast<MLtsyDispatchSmsNackSmsStored*>(nackSmsStoredInterface); |
|
127 __ASSERT_DEBUG(iLtsyDispatchSmsNackSmsStored, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
128 } |
|
129 |
|
130 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId)) |
|
131 { |
|
132 TAny* ackSmsStoredInterface = NULL; |
|
133 iLtsyFactoryV1.GetDispatchHandler( |
|
134 MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId, |
|
135 ackSmsStoredInterface); |
|
136 iLtsyDispatchSmsAckSmsStored = |
|
137 static_cast<MLtsyDispatchSmsAckSmsStored*>(ackSmsStoredInterface); |
|
138 __ASSERT_DEBUG(iLtsyDispatchSmsAckSmsStored, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
139 } |
|
140 |
|
141 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId)) |
|
142 { |
|
143 TAny* resumeSmsReceptionInterface = NULL; |
|
144 iLtsyFactoryV1.GetDispatchHandler( |
|
145 MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId, |
|
146 resumeSmsReceptionInterface); |
|
147 iLtsyDispatchSmsResumeSmsReception = |
|
148 static_cast<MLtsyDispatchSmsResumeSmsReception*>(resumeSmsReceptionInterface); |
|
149 __ASSERT_DEBUG(iLtsyDispatchSmsResumeSmsReception, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
150 } |
|
151 |
|
152 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId)) |
|
153 { |
|
154 TAny* sendSmsMessageInterface = NULL; |
|
155 iLtsyFactoryV1.GetDispatchHandler( |
|
156 MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId, |
|
157 sendSmsMessageInterface); |
|
158 iLtsyDispatchSmsSendSmsMessage = |
|
159 static_cast<MLtsyDispatchSmsSendSmsMessage*>(sendSmsMessageInterface); |
|
160 __ASSERT_DEBUG(iLtsyDispatchSmsSendSmsMessage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
161 } |
|
162 |
|
163 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsSendSmsMessageNoFdnCheck::KLtsyDispatchSmsSendSmsMessageNoFdnCheckApiId)) |
|
164 { |
|
165 TAny* sendSmsMessageNoFdnCheckInterface = NULL; |
|
166 iLtsyFactoryV1.GetDispatchHandler( |
|
167 MLtsyDispatchSmsSendSmsMessageNoFdnCheck::KLtsyDispatchSmsSendSmsMessageNoFdnCheckApiId, |
|
168 sendSmsMessageNoFdnCheckInterface); |
|
169 iLtsyDispatchSmsSendSmsMessageNoFdnCheck = |
|
170 static_cast<MLtsyDispatchSmsSendSmsMessageNoFdnCheck*>(sendSmsMessageNoFdnCheckInterface); |
|
171 __ASSERT_DEBUG(iLtsyDispatchSmsSendSmsMessageNoFdnCheck, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
172 } |
|
173 |
|
174 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsSetMoSmsBearer::KLtsyDispatchSmsSetMoSmsBearerApiId)) |
|
175 { |
|
176 TAny* setMoSmsBearerInterface = NULL; |
|
177 iLtsyFactoryV1.GetDispatchHandler( |
|
178 MLtsyDispatchSmsSetMoSmsBearer::KLtsyDispatchSmsSetMoSmsBearerApiId, |
|
179 setMoSmsBearerInterface); |
|
180 iLtsyDispatchSmsSetMoSmsBearer = |
|
181 static_cast<MLtsyDispatchSmsSetMoSmsBearer*>(setMoSmsBearerInterface); |
|
182 __ASSERT_DEBUG(iLtsyDispatchSmsSetMoSmsBearer, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
183 } |
|
184 |
|
185 if(iLtsyFactoryV1.IsDispatchInterfaceSupported(KDispatchSmsFuncUnitId, MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId)) |
|
186 { |
|
187 TAny* storeSmspListInterface = NULL; |
|
188 iLtsyFactoryV1.GetDispatchHandler( |
|
189 MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, |
|
190 storeSmspListInterface); |
|
191 iLtsyDispatchSmsStoreSmspListEntry = |
|
192 static_cast<MLtsyDispatchSmsStoreSmspListEntry*>(storeSmspListInterface); |
|
193 __ASSERT_DEBUG(iLtsyDispatchSmsStoreSmspListEntry, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
194 } |
|
195 |
|
196 iLtsyDataList = new( ELeave ) CArrayPtrFlat< TSmsParameters >( 10 ); |
|
197 |
|
198 } // CSmsDispatcher::ConstructL |
|
199 |
|
200 void CSmsDispatcher::SetDispatcherHolder(TDispatcherHolder& aDispatcherHolder) |
|
201 /** |
|
202 * Set the dispatcher holder. |
|
203 * |
|
204 * @param aDispatcherHolder Reference to dispatcher holder. |
|
205 */ |
|
206 { |
|
207 TSYLOGENTRYEXIT; |
|
208 |
|
209 iDispatcherHolder = &aDispatcherHolder; |
|
210 } // CSmsDispatcher::SetDispatcherHolder |
|
211 |
|
212 TInt CSmsDispatcher::DispatchActivateSmsRoutingL() |
|
213 /** |
|
214 * Unpack data related to EMmTsyActivateSmsRouting |
|
215 * This is not passed to LTSY but just completed by dispatch layer |
|
216 * |
|
217 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
218 * the Licensee LTSY does not support this request. |
|
219 */ |
|
220 { |
|
221 TSYLOGENTRYEXIT; |
|
222 // Trigger async one shot completer |
|
223 |
|
224 CRequestQueueOneShot::TIpcDataPackage* dataPackage = new (ELeave) CRequestQueueOneShot::TIpcDataPackage; |
|
225 dataPackage->iIpc = EMmTsyActivateSmsRouting; |
|
226 dataPackage->iResultCode = KErrNone; |
|
227 dataPackage->iDataPackage = NULL; |
|
228 dataPackage->iDispatcherCallback = this; |
|
229 iRequestAsyncOneShot.QueueRequest(*dataPackage); |
|
230 |
|
231 return TSYLOGSETEXITERR(KErrNone); |
|
232 } // CSmsDispatcher::DispatchActivateSmsRoutingL |
|
233 |
|
234 |
|
235 TInt CSmsDispatcher::DispatchSendSatSmsL(const CMmDataPackage* aDataPackage) |
|
236 /** |
|
237 * Unpack data related to EMmTsySmsSendSatMessage |
|
238 * and pass request on to Licensee LTSY. |
|
239 * |
|
240 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
241 * the Licensee LTSY does not support this request. |
|
242 */ |
|
243 { |
|
244 TSYLOGENTRYEXIT; |
|
245 TInt ret = KErrNotSupported; |
|
246 |
|
247 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
248 |
|
249 TSendSmsDataAndAttributes* data = NULL; |
|
250 aDataPackage->UnPackData(&data); |
|
251 |
|
252 __ASSERT_DEBUG(data, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
253 __ASSERT_DEBUG(data->iAttributes, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
254 __ASSERT_DEBUG(data->iMsgData, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
255 |
|
256 // Call Handle... method in Licensee LTSY |
|
257 if (iLtsyDispatchSmsSendSatSms) |
|
258 { |
|
259 ret = iLtsyDispatchSmsSendSatSms->HandleSendSatSmsReqL( *(data->iMsgData), |
|
260 (data->iAttributes->iDataFormat), |
|
261 (data->iAttributes->iGsmServiceCentre), |
|
262 (data->iAttributes->iMore) |
|
263 ); |
|
264 } |
|
265 |
|
266 return TSYLOGSETEXITERR(ret); |
|
267 } // CSmsDispatcher::DispatchSendSatSmsL |
|
268 |
|
269 TInt CSmsDispatcher::DispatchGetSmsStoreInfoL() |
|
270 /** |
|
271 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
272 * the Licensee LTSY does not support this request. |
|
273 */ |
|
274 { |
|
275 TSYLOGENTRYEXIT; |
|
276 TInt ret = KErrNotSupported; |
|
277 |
|
278 // Call Handle... method in Licensee LTSY |
|
279 if (iLtsyDispatchSmsGetSmsStoreInfo) |
|
280 { |
|
281 ret = iLtsyDispatchSmsGetSmsStoreInfo->HandleGetSmsStoreInfoReqL(); |
|
282 } |
|
283 |
|
284 return TSYLOGSETEXITERR(ret); |
|
285 } // CSmsDispatcher::DispatchGetSmsStoreInfoL |
|
286 |
|
287 TInt CSmsDispatcher::DispatchGetSmspListL() |
|
288 /** |
|
289 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
290 * the Licensee LTSY does not support this request. |
|
291 */ |
|
292 { |
|
293 TSYLOGENTRYEXIT; |
|
294 TInt ret = KErrNotSupported; |
|
295 |
|
296 // Call Handle... method in Licensee LTSY |
|
297 if (iLtsyDispatchSmsGetSmspList) |
|
298 { |
|
299 ret = iLtsyDispatchSmsGetSmspList->HandleGetSmspListReqL(); |
|
300 } |
|
301 |
|
302 return TSYLOGSETEXITERR(ret); |
|
303 } // CSmsDispatcher::DispatchGetSmspListL |
|
304 |
|
305 TInt CSmsDispatcher::DispatchNackSmsStoredL(const CMmDataPackage* aDataPackage) |
|
306 /** |
|
307 * Unpack data related to EMobileSmsMessagingNackSmsStored |
|
308 * and pass request on to Licensee LTSY. |
|
309 * |
|
310 * @param aDataPackage Contains packed pointer to TDesC8 (TPDU data) and TInt (RP cause) |
|
311 * |
|
312 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
313 * the Licensee LTSY does not support this request. |
|
314 */ |
|
315 { |
|
316 TSYLOGENTRYEXIT; |
|
317 TInt ret = KErrNotSupported; |
|
318 |
|
319 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
320 |
|
321 // Call Handle... method in Licensee LTSY |
|
322 if (iLtsyDispatchSmsNackSmsStored) |
|
323 { |
|
324 TDesC8* msgPtr = NULL; |
|
325 TInt rpCause; |
|
326 aDataPackage->UnPackData(msgPtr, rpCause); |
|
327 |
|
328 if(msgPtr) |
|
329 { |
|
330 ret = iLtsyDispatchSmsNackSmsStored->HandleNackSmsStoredReqL(*msgPtr, rpCause); |
|
331 } |
|
332 else |
|
333 { |
|
334 ret = iLtsyDispatchSmsNackSmsStored->HandleNackSmsStoredReqL(rpCause); |
|
335 } |
|
336 |
|
337 } |
|
338 |
|
339 return TSYLOGSETEXITERR(ret); |
|
340 } // CSmsDispatcher::DispatchNackSmsStoredL |
|
341 |
|
342 TInt CSmsDispatcher::DispatchAckSmsStoredL(const CMmDataPackage* aDataPackage) |
|
343 /** |
|
344 * Unpack data related to EMobileSmsMessagingAckSmsStored |
|
345 * and pass request on to Licensee LTSY. |
|
346 * |
|
347 * @param aDataPackage contains the TPDU defined for a SMS-DELIVER-REPORT |
|
348 * |
|
349 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
350 * the Licensee LTSY does not support this request. |
|
351 */ |
|
352 { |
|
353 TSYLOGENTRYEXIT; |
|
354 TInt ret = KErrNotSupported; |
|
355 |
|
356 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
357 |
|
358 // Call Handle... method in Licensee LTSY |
|
359 if (iLtsyDispatchSmsAckSmsStored) |
|
360 { |
|
361 TDesC8* msgPtr = NULL; |
|
362 aDataPackage->UnPackData(msgPtr); |
|
363 |
|
364 if(msgPtr) |
|
365 { |
|
366 ret = iLtsyDispatchSmsAckSmsStored->HandleAckSmsStoredReqL(*msgPtr); |
|
367 } |
|
368 else |
|
369 { |
|
370 ret = iLtsyDispatchSmsAckSmsStored->HandleAckSmsStoredReqL(); |
|
371 } |
|
372 } |
|
373 |
|
374 return TSYLOGSETEXITERR(ret); |
|
375 } // CSmsDispatcher::DispatchAckSmsStoredL |
|
376 |
|
377 TInt CSmsDispatcher::DispatchResumeSmsReceptionL() |
|
378 /** |
|
379 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
380 * the Licensee LTSY does not support this request. |
|
381 */ |
|
382 { |
|
383 TSYLOGENTRYEXIT; |
|
384 TInt ret = KErrNotSupported; |
|
385 |
|
386 // Call Handle... method in Licensee LTSY |
|
387 if (iLtsyDispatchSmsResumeSmsReception) |
|
388 { |
|
389 ret = iLtsyDispatchSmsResumeSmsReception->HandleResumeSmsReceptionReqL(); |
|
390 } |
|
391 |
|
392 return TSYLOGSETEXITERR(ret); |
|
393 } // CSmsDispatcher::DispatchResumeSmsReceptionL |
|
394 |
|
395 TInt CSmsDispatcher::DispatchSendSmsMessageL(const CMmDataPackage* aDataPackage) |
|
396 /** |
|
397 * Unpack data related to EMobileSmsMessagingSendMessage |
|
398 * and pass request on to Licensee LTSY. |
|
399 * |
|
400 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
401 * the Licensee LTSY does not support this request. |
|
402 */ |
|
403 { |
|
404 TSYLOGENTRYEXIT; |
|
405 TInt ret = KErrNotSupported; |
|
406 |
|
407 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
408 |
|
409 // Call Handle... method in Licensee LTSY |
|
410 if (iLtsyDispatchSmsSendSmsMessage) |
|
411 { |
|
412 TSendSmsDataAndAttributes* data = NULL; |
|
413 aDataPackage->UnPackData(&data); |
|
414 |
|
415 __ASSERT_DEBUG(data, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
416 __ASSERT_DEBUG(data->iAttributes, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
417 __ASSERT_DEBUG(data->iMsgData, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
418 |
|
419 ret = iLtsyDispatchSmsSendSmsMessage->HandleSendSmsMessageReqL( (data->iAttributes->iDestination), |
|
420 *(data->iMsgData), |
|
421 (data->iAttributes->iDataFormat), |
|
422 (data->iAttributes->iGsmServiceCentre), |
|
423 (data->iAttributes->iMore) |
|
424 ); |
|
425 } |
|
426 |
|
427 return TSYLOGSETEXITERR(ret); |
|
428 } // CSmsDispatcher::DispatchSendSmsMessageL |
|
429 |
|
430 TInt CSmsDispatcher::DispatchSendSmsMessageNoFdnCheckL(const CMmDataPackage* aDataPackage) |
|
431 /** |
|
432 * Unpack data related to EMobileSmsMessagingSendMessageNoFdnCheck |
|
433 * and pass request on to Licensee LTSY. |
|
434 * |
|
435 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
436 * the Licensee LTSY does not support this request. |
|
437 */ |
|
438 { |
|
439 TSYLOGENTRYEXIT; |
|
440 TInt ret = KErrNotSupported; |
|
441 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
442 |
|
443 // Call Handle... method in Licensee LTSY |
|
444 if (iLtsyDispatchSmsSendSmsMessageNoFdnCheck) |
|
445 { |
|
446 TSendSmsDataAndAttributes* data = NULL; |
|
447 aDataPackage->UnPackData(&data); |
|
448 |
|
449 __ASSERT_DEBUG(data, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
450 __ASSERT_DEBUG(data->iAttributes, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
451 __ASSERT_DEBUG(data->iMsgData, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
452 |
|
453 ret = iLtsyDispatchSmsSendSmsMessageNoFdnCheck->HandleSendSmsMessageNoFdnCheckReqL( (data->iAttributes->iDestination), |
|
454 *(data->iMsgData), |
|
455 (data->iAttributes->iDataFormat), |
|
456 (data->iAttributes->iGsmServiceCentre), |
|
457 (data->iAttributes->iMore) |
|
458 ); |
|
459 } |
|
460 |
|
461 return TSYLOGSETEXITERR(ret); |
|
462 } // CSmsDispatcher::DispatchSendSmsMessageNoFdnCheckL |
|
463 |
|
464 TInt CSmsDispatcher::DispatchSetMoSmsBearerL(const CMmDataPackage* aDataPackage) |
|
465 /** |
|
466 * Unpack data related to EMobileSmsMessagingSetMoSmsBearer |
|
467 * and pass request on to Licensee LTSY. |
|
468 * |
|
469 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
470 * the Licensee LTSY does not support this request. |
|
471 */ |
|
472 { |
|
473 TSYLOGENTRYEXIT; |
|
474 TInt ret = KErrNotSupported; |
|
475 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
476 |
|
477 // Call Handle... method in Licensee LTSY |
|
478 if (iLtsyDispatchSmsSendSmsMessageNoFdnCheck) |
|
479 { |
|
480 RMobileSmsMessaging::TMobileSmsBearer* data = NULL; |
|
481 aDataPackage->UnPackData(&data); |
|
482 __ASSERT_DEBUG(data, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
483 |
|
484 ret = iLtsyDispatchSmsSetMoSmsBearer->HandleSetMoSmsBearerReqL(*data); |
|
485 } |
|
486 return TSYLOGSETEXITERR(ret); |
|
487 } // CSmsDispatcher::DispatchSetMoSmsBearerL |
|
488 |
|
489 TInt CSmsDispatcher::DispatchStoreSmspListEntryL(const CMmDataPackage* aDataPackage) |
|
490 /** |
|
491 * Unpack data related to EMobileSmsMessagingStoreSmspList |
|
492 * and pass request on to Licensee LTSY. |
|
493 * |
|
494 * @return Returns error code returned by the Licensee LTSY or KErrNotSupported if |
|
495 * the Licensee LTSY does not support this request. |
|
496 */ |
|
497 { |
|
498 TSYLOGENTRYEXIT; |
|
499 TInt ret = KErrNotSupported; |
|
500 |
|
501 __ASSERT_DEBUG(aDataPackage, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
502 |
|
503 if (iLtsyDispatchSmsStoreSmspListEntry) |
|
504 { |
|
505 RMobileSmsMessaging::TMobileSmspEntryV1* data = NULL; |
|
506 aDataPackage->UnPackData(&data); |
|
507 |
|
508 __ASSERT_DEBUG(data, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
509 |
|
510 ret = iLtsyDispatchSmsStoreSmspListEntry->HandleStoreSmspListEntryReqL(*data); |
|
511 } |
|
512 |
|
513 return TSYLOGSETEXITERR(ret); |
|
514 } // CSmsDispatcher::DispatchStoreSmspListL |
|
515 |
|
516 |
|
517 // |
|
518 // Callback handlers follow |
|
519 // |
|
520 |
|
521 void CSmsDispatcher::CallbackActivateSmsRouting(CRequestQueueOneShot::TIpcDataPackage* aDataPackage) |
|
522 /** |
|
523 * Callback function to be used by the request to complete . |
|
524 * |
|
525 * @param aDataPackage Package containing the IPC, return data and result code to be completed to CTSY |
|
526 */ |
|
527 { |
|
528 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aDataPackage->iResultCode); |
|
529 |
|
530 if (!aDataPackage->iCleanupOnly) |
|
531 { |
|
532 CMmDataPackage dataPackage; |
|
533 TUint8 smsRouting = KSmsRoutingActivated; |
|
534 dataPackage.PackData(static_cast<TUint8*>(&smsRouting)); |
|
535 iMessageManagerCallback.Complete(EMmTsyActivateSmsRouting, &dataPackage, aDataPackage->iResultCode); |
|
536 } |
|
537 delete aDataPackage; |
|
538 } // CSmsDispatcher::CallbackActivateSmsRouting |
|
539 |
|
540 |
|
541 void CSmsDispatcher::CallbackNotifyReceiveSmsMessage(TInt aError, TBool aInd, const TSmsMsg& aSmsMessage) |
|
542 /** |
|
543 * Callback function to be used by the request to complete |
|
544 * CCtsyDispatcherCallback::CallbackSmsNotifyReceiveSmsMessageInd() |
|
545 * |
|
546 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
547 * @param aInd Set routing activity on/off. |
|
548 * @param aSmsMessage Used to buffer incoming SMSes to the TSY. |
|
549 */ |
|
550 { |
|
551 TSYLOGENTRYEXITARGS(_L8("aError=%d, aInd=%d"), aError, aInd); |
|
552 |
|
553 TSmsMsg* smsMessagePtr = &const_cast<TSmsMsg&>(aSmsMessage); |
|
554 |
|
555 // Pack the data to return to the Common TSY |
|
556 CMmDataPackage dataPackage; |
|
557 dataPackage.PackData(&aInd, &smsMessagePtr); |
|
558 |
|
559 iMessageManagerCallback.Complete(EMobileSmsMessagingReceiveMessage, &dataPackage, aError); |
|
560 |
|
561 } // CSmsDispatcher::CallbackNotifyReceiveSmsMessage |
|
562 |
|
563 void CSmsDispatcher::CallbackSendSatSms(TInt aError) |
|
564 /** |
|
565 * Callback function to be used by the request to complete |
|
566 * CCtsyDispatcherCallback::CallbackSmsSendSatSmsComp() |
|
567 * |
|
568 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
569 */ |
|
570 { |
|
571 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
572 |
|
573 iMessageManagerCallback.Complete(EMmTsySmsSendSatMessage, aError); |
|
574 |
|
575 } // CSmsDispatcher::CallbackSendSatSms |
|
576 |
|
577 void CSmsDispatcher::CallbackGetSmsStoreInfo(TInt aError, TInt aTotalEntries, TInt aUsedEntries) |
|
578 /** |
|
579 * Callback function to be used by the request to complete |
|
580 * CCtsyDispatcherCallback::CallbackSmsGetSmsStoreInfoComp() |
|
581 * |
|
582 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
583 * @param aTotalEntries Indicates the total number of entries that may be held in this store. |
|
584 * @param aUsedEntries Indicates the current number of entries held in this store. |
|
585 */ |
|
586 { |
|
587 TSYLOGENTRYEXITARGS(_L8("aError=%d, aTotalEntries=%d, aUsedEntries=%d"), aError, aTotalEntries, aUsedEntries); |
|
588 |
|
589 __ASSERT_DEBUG(aTotalEntries >= 0 && aTotalEntries <= 255, CtsyDispatcherPanic(EBadLength)); |
|
590 |
|
591 // Pack the data to return to the Common TSY |
|
592 TUint8 tempVar = static_cast<TUint8>(aTotalEntries); |
|
593 CMmDataPackage dataPackage; |
|
594 dataPackage.PackData(&tempVar, &aUsedEntries); |
|
595 |
|
596 iMessageManagerCallback.Complete(EMobileSmsMessagingGetMessageStoreInfo, &dataPackage, aError); |
|
597 |
|
598 } // CSmsDispatcher::CallbackGetSmsStoreInfo |
|
599 |
|
600 void CSmsDispatcher::CallbackGetSmspList(TInt aError, const TDesC& aServiceCenterAddress, const TDesC& aDestinationAddress, |
|
601 const TDesC& aAlphaTagData, const DispatcherSim::TSmsParameters& aSmsParameters, TBool aMoreToCome) |
|
602 /** |
|
603 * Callback function to be used by the request to complete |
|
604 * CCtsyDispatcherCallback::CallbackSmsGetSmspListComp() |
|
605 * |
|
606 * @param aError KErrNone on success, or another error code indicating the error otherwise. |
|
607 * @param aServiceCenterAddress Service center address. |
|
608 * @param aDestinationAddress Destination address. |
|
609 * @param aAlphaTagData Alpha tag data. |
|
610 * @param aSmsParameters Sms parametets. |
|
611 * @param aMoreToCome Are more elements to come. |
|
612 */ |
|
613 { |
|
614 TSYLOGENTRYEXITARGS(_L8("aError=%d, aMoreToCome=%d"), aError, aMoreToCome); |
|
615 |
|
616 if(aError != KErrNone) |
|
617 { |
|
618 __ASSERT_DEBUG(aMoreToCome==EFalse, CtsyDispatcherPanic(EInvalidParameter)); |
|
619 } |
|
620 |
|
621 //A TRAP new (Eleave) here is expensive, do a non overloaded new operator and check for NULL. |
|
622 TSmsParameters* smsParamsPtr = new TSmsParameters(); |
|
623 if (!smsParamsPtr) |
|
624 { |
|
625 // not proceeding |
|
626 __ASSERT_DEBUG(NULL, CtsyDispatcherPanic(EInvalidNullPtr)); |
|
627 return; |
|
628 } |
|
629 // allocation ok: |
|
630 |
|
631 __ASSERT_DEBUG( (aServiceCenterAddress.Length() < KMaxAddressBufferSize) , CtsyDispatcherPanic(EBadLength)); |
|
632 smsParamsPtr->iServiceCenterAddress.Copy(aServiceCenterAddress); |
|
633 |
|
634 __ASSERT_DEBUG( (aDestinationAddress.Length() < KMaxAddressBufferSize) , CtsyDispatcherPanic(EBadLength)); |
|
635 smsParamsPtr->iDestinationAddress.Copy(aDestinationAddress); |
|
636 |
|
637 __ASSERT_DEBUG( (aAlphaTagData.Length() < RMobileSmsMessaging::KMaxSmspTextSize) , CtsyDispatcherPanic(EBadLength)); |
|
638 smsParamsPtr->iAlphaTagData.Copy(aAlphaTagData); |
|
639 |
|
640 smsParamsPtr->iLocationNumber = aSmsParameters.iLocationNumber; |
|
641 smsParamsPtr->iParameterIndicator = aSmsParameters.iParameterIndicator; |
|
642 smsParamsPtr->iProtocolId = aSmsParameters.iProtocolId; |
|
643 smsParamsPtr->iDataCodingScheme = aSmsParameters.iDataCodingScheme; |
|
644 smsParamsPtr->iValidityPeriod = aSmsParameters.iValidityPeriod; |
|
645 smsParamsPtr->iMobileScTON = aSmsParameters.iMobileScTON; |
|
646 smsParamsPtr->iMobileScNPI = aSmsParameters.iMobileScNPI; |
|
647 smsParamsPtr->iMobileDeTON = aSmsParameters.iMobileDeTON; |
|
648 smsParamsPtr->iMobileDeNPI = aSmsParameters.iMobileDeNPI; |
|
649 smsParamsPtr->iAlphaTagPresent = aSmsParameters.iAlphaTagPresent; |
|
650 |
|
651 TRAPD(err,iLtsyDataList->AppendL(smsParamsPtr)); |
|
652 if(err != KErrNone) |
|
653 { |
|
654 delete smsParamsPtr; |
|
655 smsParamsPtr = NULL; |
|
656 } |
|
657 |
|
658 if (!aMoreToCome) |
|
659 { |
|
660 // Pack the data to return to the Common TSY |
|
661 CMmDataPackage dataPackage; |
|
662 dataPackage.PackData(iLtsyDataList); |
|
663 |
|
664 iMessageManagerCallback.Complete(EMobileSmsMessagingGetSmspListPhase1, &dataPackage, aError); |
|
665 |
|
666 // handle case, when error on completion: |
|
667 if(aError != KErrNone) |
|
668 { |
|
669 iLtsyDataList->ResetAndDestroy(); |
|
670 } |
|
671 else |
|
672 { |
|
673 iLtsyDataList->Reset(); |
|
674 } |
|
675 } |
|
676 |
|
677 } // CSmsDispatcher::CallbackGetSmspList |
|
678 |
|
679 void CSmsDispatcher::CallbackNackSmsStored(TInt aError) |
|
680 /** |
|
681 * Callback function to be used by the request to complete |
|
682 * CCtsyDispatcherCallback::CallbackSmsNackSmsStoredComp() |
|
683 * |
|
684 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
685 */ |
|
686 { |
|
687 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
688 |
|
689 iMessageManagerCallback.Complete(EMobileSmsMessagingNackSmsStored, aError); |
|
690 |
|
691 } // CSmsDispatcher::CallbackNackSmsStored |
|
692 |
|
693 void CSmsDispatcher::CallbackAckSmsStored(TInt aError) |
|
694 /** |
|
695 * Callback function to be used by the request to complete |
|
696 * CCtsyDispatcherCallback::CallbackSmsAckSmsStoredComp() |
|
697 * |
|
698 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
699 */ |
|
700 { |
|
701 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
702 |
|
703 iMessageManagerCallback.Complete(EMobileSmsMessagingAckSmsStored, aError); |
|
704 |
|
705 } // CSmsDispatcher::CallbackAckSmsStored |
|
706 |
|
707 void CSmsDispatcher::CallbackResumeSmsReception(TInt aError) |
|
708 /** |
|
709 * Callback function to be used by the request to complete |
|
710 * CCtsyDispatcherCallback::CallbackSmsResumeSmsReceptionComp() |
|
711 * |
|
712 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
713 */ |
|
714 { |
|
715 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
716 |
|
717 iMessageManagerCallback.Complete(EMobileSmsMessagingResumeSmsReception, aError); |
|
718 } // CSmsDispatcher::CallbackResumeSmsReception |
|
719 |
|
720 void CSmsDispatcher::CallbackSendSmsMessage(TInt aError, |
|
721 TInt aMsgRef, const TDesC8& aSmsSubmitReport) |
|
722 /** |
|
723 * Callback function to be used by the request to complete CCtsyDispatcherCallback::CallbackSmsSendSmsMessageComp(). |
|
724 * |
|
725 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
726 * @param aMsgRef the message reference assigned to a sent message. |
|
727 * @param aSmsSubmitReport message string, , which is expected to be a buffer with |
|
728 * a maximum size of RMobileSmsMessaging::KGsmTpduSize |
|
729 */ |
|
730 { |
|
731 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
732 |
|
733 __ASSERT_DEBUG( (aSmsSubmitReport.Length() < RMobileSmsMessaging::KGsmTpduSize) , CtsyDispatcherPanic(EBadLength)); |
|
734 |
|
735 // Pack the data to return to the Common TSY |
|
736 CMmDataPackage dataPackage; |
|
737 TPtrC8 submitReport(aSmsSubmitReport); |
|
738 |
|
739 dataPackage.PackData(&aMsgRef, &submitReport ); |
|
740 iMessageManagerCallback.Complete(EMobileSmsMessagingSendMessage, &dataPackage, aError); |
|
741 } // CSmsDispatcher::CallbackSendSmsMessage |
|
742 |
|
743 void CSmsDispatcher::CallbackSendSmsMessageNoFdnCheck(TInt aError, |
|
744 TInt aMsgRef, const TDesC8& aSmsSubmitReport) |
|
745 /** |
|
746 * Callback function to be used by the request to complete |
|
747 * CCtsyDispatcherCallback::CallbackSmsSendSmsMessageNoFdnCheckComp(). |
|
748 * |
|
749 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
750 * @param aMsgRef the message reference assigned to a sent message. |
|
751 * @param aSmsSubmitReport message string, , which is expected to be a buffer with |
|
752 * a maximum size of RMobileSmsMessaging::KGsmTpduSize |
|
753 */ |
|
754 { |
|
755 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
756 |
|
757 __ASSERT_DEBUG( (aSmsSubmitReport.Length() < RMobileSmsMessaging::KGsmTpduSize) , CtsyDispatcherPanic(EBadLength)); |
|
758 |
|
759 // Pack the data to return to the Common TSY |
|
760 CMmDataPackage dataPackage; |
|
761 TBuf8<RMobileSmsMessaging::KGsmTpduSize> submitReport = aSmsSubmitReport; |
|
762 |
|
763 dataPackage.PackData(&aMsgRef, &submitReport ); |
|
764 iMessageManagerCallback.Complete(EMobileSmsMessagingSendMessageNoFdnCheck, &dataPackage, aError); |
|
765 } // CSmsDispatcher::CallbackSendSmsMessageNoFdnCheck |
|
766 |
|
767 void CSmsDispatcher::CallbackSetMoSmsBearer(TInt aError) |
|
768 /** |
|
769 * Callback function to be used by the request to complete |
|
770 * CCtsyDispatcherCallback::CallbackSmsSetMoSmsBearerComp() |
|
771 * |
|
772 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
773 */ |
|
774 { |
|
775 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
776 |
|
777 iMessageManagerCallback.Complete(EMobileSmsMessagingSetMoSmsBearer, aError); |
|
778 |
|
779 } // CSmsDispatcher::CallbackSetMoSmsBearer |
|
780 |
|
781 void CSmsDispatcher::CallbackStoreSmspListEntry(TInt aError) |
|
782 /** |
|
783 * Callback function to be used by the request to complete |
|
784 * CCtsyDispatcherCallback::CallbackSmsStoreSmspListComp() |
|
785 * |
|
786 * @param aError The error code to be returned to the CTSY Dispatcher. |
|
787 */ |
|
788 { |
|
789 TSYLOGENTRYEXITARGS(_L8("aError=%d"), aError); |
|
790 iMessageManagerCallback.Complete(EMobileSmsMessagingStoreSmspList, aError); |
|
791 } // CSmsDispatcher::CallbackStoreSmspList |
|
792 |
|
793 void CSmsDispatcher::CallbackSync(CRequestQueueOneShot::TIpcDataPackage& aIpcDataPackage) |
|
794 /** |
|
795 * Part of the MDispatcherCallback interface. Used to complete requests handled |
|
796 * synchronously by the Licensee LTSY asynchronously back to the Common TSY. |
|
797 * |
|
798 * @param aIpcDataPackage Package encapsulating the request. |
|
799 * |
|
800 * @see MDispatcherCallback::CallbackSync |
|
801 */ |
|
802 { |
|
803 TSYLOGENTRYEXIT; |
|
804 |
|
805 switch (aIpcDataPackage.iIpc) |
|
806 { |
|
807 case EMmTsyActivateSmsRouting: |
|
808 CallbackActivateSmsRouting(&aIpcDataPackage); |
|
809 break; |
|
810 default: |
|
811 LOG(_L8("WARNING: CSmsDispatcher::CallbackSync unhandled IPC=%d"), aIpcDataPackage.iIpc); |
|
812 __ASSERT_DEBUG(NULL, CtsyDispatcherPanic(EUnhandledCtsyIpc)); |
|
813 break; |
|
814 } // switch (aIpcDataPackage.iIpc) |
|
815 |
|
816 } // CSmsDispatcher::CallbackSync |
|
817 |
|
818 |
|
819 |