|
1 // Copyright (c) 2006-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 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "cmmsmstsy.h" |
|
20 #include "cmmphonetsy.h" |
|
21 #include "cmmsmsstoragetsy.h" |
|
22 #include "cmmsmsgsmext.h" |
|
23 #include "cmmtsyreqhandlestore.h" |
|
24 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
25 #include "MmTsy_numberOfSlots.h" |
|
26 #include <ctsy/serviceapi/cmmsmsutility.h> |
|
27 #include "cmmsmssendrequest.h" |
|
28 #include <ctsy/serviceapi/mstktsysatservice.h> |
|
29 #include "CMmCommonStaticUtility.h" |
|
30 #include <ctsy/serviceapi/gsmerror.h> |
|
31 #include <ctsy/pluginapi/cmmdatapackage.h> |
|
32 #include <etelsat.h> // for Sat MO SM Control error values |
|
33 |
|
34 |
|
35 // ======== MEMBER FUNCTIONS ======== |
|
36 |
|
37 CMmSmsTsy::CMmSmsTsy() |
|
38 { |
|
39 TFLOGSTRING("TSY: CMmSmsTsy::CMmSmsTsy: constructor"); |
|
40 } |
|
41 |
|
42 void CMmSmsTsy::ConstructL() |
|
43 { |
|
44 TFLOGSTRING("TSY: CMmSmsTsy::ConstructL"); |
|
45 #ifdef REQHANDLE_TIMER |
|
46 //create req handle store |
|
47 iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this, iMmPhone, |
|
48 EMultimodeSmsMaxNumOfRequests, iSmsReqHandles ); |
|
49 #else |
|
50 // create req handle store |
|
51 iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( |
|
52 EMultimodeSmsMaxNumOfRequests, iSmsReqHandles ); |
|
53 #endif // REQHANDLE_TIMER |
|
54 |
|
55 // Reset all CMmSmsTsy variables |
|
56 ResetVariables(); |
|
57 |
|
58 // SMS message array |
|
59 iSmsMsgArray = new ( ELeave ) CArrayPtrFlat<TSmsMsg>( 1 ); |
|
60 |
|
61 // Create GSM mode SMS extension |
|
62 iMmSmsExtInterface = CMmSmsGsmExt::NewL(); |
|
63 |
|
64 |
|
65 // register sms tsy in the message manager |
|
66 iMmPhone->MessageManager()->RegisterTsyObject( |
|
67 CMmMessageManagerBase::ESmsMessagingTsy, this ); |
|
68 |
|
69 // at startup, there is no pending Send request |
|
70 iSmsSendReq = NULL; |
|
71 |
|
72 // Initialise off-line/on-line mode variable with information |
|
73 // from PhoneTsy. After object construction, this information |
|
74 // will be updated using DOS indications. |
|
75 TRfStateInfo phoneRfInfo = iMmPhone->GetRfStateInfo(); |
|
76 if ( ERfsStateInfoInactive == phoneRfInfo ) |
|
77 { |
|
78 iIsOffline = ETrue; |
|
79 } |
|
80 else |
|
81 { |
|
82 iIsOffline = EFalse; |
|
83 } |
|
84 TFLOGSTRING2("TSY: CMmSmsTsy::ConstructL: iIsOffline has been initialised to %d", iIsOffline); |
|
85 |
|
86 // there's no pending ResumeSmsReception request at startup |
|
87 iResumeSmsReceptionPending = EFalse; |
|
88 |
|
89 // Initialization for sms NoFdnCheck |
|
90 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUnknown; |
|
91 |
|
92 iExpectAckOrNack = 0; |
|
93 |
|
94 } |
|
95 |
|
96 CMmSmsTsy* CMmSmsTsy::NewL( |
|
97 CMmPhoneTsy* aMmPhone ) |
|
98 { |
|
99 CMmSmsTsy* aMmSmsTsy = new ( ELeave ) CMmSmsTsy(); |
|
100 CleanupClosePushL(*aMmSmsTsy); |
|
101 aMmSmsTsy->iMmPhone = aMmPhone; |
|
102 aMmSmsTsy->ConstructL(); |
|
103 CleanupStack::Pop(); |
|
104 |
|
105 return aMmSmsTsy; |
|
106 } |
|
107 |
|
108 CMmSmsTsy::~CMmSmsTsy() |
|
109 { |
|
110 TFLOGSTRING("TSY: CMmSmsTsy::~CMmSmsTsy"); |
|
111 if ( iMmPhone ) |
|
112 { |
|
113 // deregister tsy object from message manager |
|
114 iMmPhone->MessageManager()->DeregisterTsyObject(this); |
|
115 |
|
116 // Release the SMS routing from DOS to TSY. |
|
117 // Send request to the Domestic OS layer. Ignore if it leaves |
|
118 TInt trapError = KErrNone; |
|
119 TRAP( trapError, iMmPhone->MessageManager()->HandleRequestL( |
|
120 EMmTsyDeactivateSmsRouting ); ); |
|
121 } |
|
122 |
|
123 // try to complete send sms message. |
|
124 if ( iTsySatMessaging ) |
|
125 { |
|
126 iTsySatMessaging->CompleteSendSmsMessage( KErrAccessDenied ); |
|
127 } |
|
128 |
|
129 if ( iTsyReqHandleStore ) |
|
130 { |
|
131 delete iTsyReqHandleStore; |
|
132 iTsyReqHandleStore = NULL; |
|
133 } |
|
134 |
|
135 if ( iSmsMsgArray ) |
|
136 { |
|
137 iSmsMsgArray->ResetAndDestroy(); |
|
138 delete iSmsMsgArray; |
|
139 iSmsMsgArray = NULL; |
|
140 } |
|
141 |
|
142 // Delete extension object |
|
143 if ( iMmSmsExtInterface ) |
|
144 { |
|
145 delete iMmSmsExtInterface; |
|
146 iMmSmsExtInterface = NULL; |
|
147 } |
|
148 |
|
149 if ( iMmPhone ) |
|
150 { |
|
151 iMmPhone->SetSmsSession( NULL ); |
|
152 iMmPhone = NULL; |
|
153 } |
|
154 |
|
155 if ( iSmsSendReq ) |
|
156 { |
|
157 delete iSmsSendReq; |
|
158 iSmsSendReq = NULL; |
|
159 } |
|
160 |
|
161 if ( iSMSPClientId ) |
|
162 { |
|
163 delete iSMSPClientId; |
|
164 iSMSPClientId = NULL; |
|
165 } |
|
166 |
|
167 // set pointers to NULL |
|
168 iMmSmsStorageTsy = NULL; |
|
169 iTsySatMessaging = NULL; |
|
170 iNotifyReceiveModeChangePtr = NULL; |
|
171 iReceiveMessageParamsPtr = NULL; |
|
172 iReceiveMessagePduPtr = NULL; |
|
173 iNotifySmsBearerPtr = NULL; |
|
174 iSendMessageMsgAttrPckgPtr = NULL; |
|
175 iGetMessageStoreInfoPtr = NULL; |
|
176 iStoreSmspBufferPtr = NULL; |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // CMmSmsTsy::Init |
|
181 // Initialisation method that is called from ETel Server |
|
182 // (other items were commented in a header). |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 void CMmSmsTsy::Init() |
|
186 { |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // CMmSmsTsy::OpenNewObjectByNameL |
|
191 // Creates new object and returns a pointer to it |
|
192 // (other items were commented in a header). |
|
193 // --------------------------------------------------------------------------- |
|
194 // |
|
195 CTelObject* CMmSmsTsy::OpenNewObjectByNameL( |
|
196 const TDesC& aName ) |
|
197 { |
|
198 if ( aName.Compare( KETelIccSmsStore ) == KErrNone ) |
|
199 { |
|
200 iMmSmsStorageTsy = CMmSmsStorageTsy::NewL( this, iMmPhone, |
|
201 iMmSmsExtInterface, iTsyReqHandleStore ); |
|
202 |
|
203 return iMmSmsStorageTsy; |
|
204 } |
|
205 |
|
206 // ME memory (KETelMeSmsStore) and combined memory (KETelCombinedSmsStore) |
|
207 // are not supported |
|
208 User::Leave( KErrNotSupported ); |
|
209 //lint -e{527} "unreachable code" |
|
210 |
|
211 return NULL; |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------------------------- |
|
215 // CMmSmsTsy::OpenNewObjectL |
|
216 // Creates new object and returns a pointer to it |
|
217 // (other items were commented in a header). |
|
218 // --------------------------------------------------------------------------- |
|
219 // |
|
220 CTelObject* CMmSmsTsy::OpenNewObjectL( |
|
221 TDes& /*aNewName*/ ) |
|
222 { |
|
223 // Not supported |
|
224 User::Leave( KErrNotSupported ); |
|
225 //lint -e{527} "unreachable code" |
|
226 |
|
227 return NULL; |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // CMmSmsTsy::ExtFunc |
|
232 // ExtFunc is called by the server when it has a "extended", |
|
233 // i.e. non-core ETel request for the TSY. To process a request handle, |
|
234 // request type and request data are passed to the TSY |
|
235 // (other items were commented in a header). |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 TInt CMmSmsTsy::ExtFunc( |
|
239 const TTsyReqHandle aTsyReqHandle, |
|
240 const TInt aIpc, |
|
241 const TDataPackage& aPackage ) |
|
242 { |
|
243 TAny* dataPtr = aPackage.Ptr1(); |
|
244 TInt ret( KErrNone ); |
|
245 |
|
246 // before processing further the request, check if offline mode status |
|
247 // is enabled and if the given request can be perfomed in that case. |
|
248 if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() && |
|
249 !IsRequestPossibleInOffline( aIpc ) ) |
|
250 { |
|
251 TFLOGSTRING2 ("TSY: Offline mode ON, request is not allowed: %d", aIpc ); |
|
252 TInt error = CMmCommonStaticUtility::EpocErrorCode( KErrGeneral, |
|
253 KErrGsmOfflineOpNotAllowed ); |
|
254 |
|
255 // Complete the request with appropiate error |
|
256 ReqCompleted ( aTsyReqHandle, error ); |
|
257 } |
|
258 else |
|
259 { |
|
260 switch ( aIpc ) |
|
261 { |
|
262 // SMS messaging requests that doesn't need trapping |
|
263 case EMobileSmsMessagingGetCaps: |
|
264 ret = GetCaps( aTsyReqHandle, aPackage.Des1n() ); |
|
265 break; |
|
266 case EMobileSmsMessagingGetReceiveMode: |
|
267 ret = GetReceiveMode( aTsyReqHandle, reinterpret_cast< |
|
268 RMobileSmsMessaging::TMobileSmsReceiveMode* >( dataPtr ) ); |
|
269 break; |
|
270 case EMobileSmsMessagingGetMoSmsBearer: |
|
271 ret = GetMoSmsBearer( aTsyReqHandle, reinterpret_cast< |
|
272 RMobileSmsMessaging::TMobileSmsBearer* >( dataPtr) ); |
|
273 break; |
|
274 case EMobileSmsMessagingSetMoSmsBearer: |
|
275 ret = SetMoSmsBearer( aTsyReqHandle, reinterpret_cast< |
|
276 RMobileSmsMessaging::TMobileSmsBearer*>( dataPtr) ); |
|
277 break; |
|
278 case EMobileSmsMessagingEnumerateMessageStores: |
|
279 ret = EnumerateMessageStores( aTsyReqHandle, |
|
280 reinterpret_cast< TInt* >( dataPtr ) ); |
|
281 break; |
|
282 case EMobileSmsMessagingGetSmspListPhase2: |
|
283 ret = ReadSmspListPhase2( aTsyReqHandle, reinterpret_cast< |
|
284 RMobilePhone::TClientId*>( dataPtr ), aPackage.Des2n() ); |
|
285 break; |
|
286 // SMS messaging requests that need trapping |
|
287 default: |
|
288 // reset last tsy request type |
|
289 iReqHandleType = EMultimodeSmsReqHandleUnknown; |
|
290 |
|
291 TInt leaveCode( KErrNone ); |
|
292 TRAP( leaveCode, ret = DoExtFuncL( aTsyReqHandle, aIpc, |
|
293 aPackage ); ); |
|
294 |
|
295 if ( KErrNone != leaveCode ) |
|
296 { |
|
297 TFLOGSTRING3("CMmSmsTsy: Leave trapped!, IPC=%d, error value:%d", aIpc, leaveCode ); |
|
298 ReqCompleted( aTsyReqHandle, leaveCode ); |
|
299 } |
|
300 |
|
301 //save request handle |
|
302 if ( EMultimodeSmsReqHandleUnknown != iReqHandleType ) |
|
303 { |
|
304 #ifdef REQHANDLE_TIMER |
|
305 SetTypeOfResponse( iReqHandleType, aTsyReqHandle ); |
|
306 #else |
|
307 //Never comes here. See SetTypeOfResponse. |
|
308 iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, |
|
309 aTsyReqHandle ); |
|
310 #endif // REQHANDLE_TIMER |
|
311 } |
|
312 break; |
|
313 } |
|
314 } |
|
315 |
|
316 return ret; |
|
317 } |
|
318 |
|
319 // --------------------------------------------------------------------------- |
|
320 // CMmSmsTsy::DoExtFuncL |
|
321 // DoExtFuncL calls messaging methods that can leave |
|
322 // (other items were commented in a header). |
|
323 // --------------------------------------------------------------------------- |
|
324 // |
|
325 TInt CMmSmsTsy::DoExtFuncL( |
|
326 const TTsyReqHandle aTsyReqHandle, |
|
327 const TInt aIpc, |
|
328 const TDataPackage& aPackage ) |
|
329 { |
|
330 TAny* dataPtr = aPackage.Ptr1(); |
|
331 TAny* dataPtr2 = aPackage.Ptr2(); |
|
332 |
|
333 TInt ret( KErrNone ); |
|
334 |
|
335 switch ( aIpc ) |
|
336 { |
|
337 // SMS messaging requests |
|
338 case EMobileSmsMessagingSetReceiveMode: |
|
339 ret = SetReceiveMode( aTsyReqHandle, reinterpret_cast< |
|
340 RMobileSmsMessaging::TMobileSmsReceiveMode* >( dataPtr ) ); |
|
341 break; |
|
342 case EMobileSmsMessagingNotifyReceiveModeChange: |
|
343 ret = NotifyReceiveModeChange( reinterpret_cast< |
|
344 RMobileSmsMessaging::TMobileSmsReceiveMode*>( dataPtr) ); |
|
345 break; |
|
346 case EMobileSmsMessagingReceiveMessage: |
|
347 ret = ReceiveMessageL( aTsyReqHandle, aPackage.Des1n(), |
|
348 aPackage.Des2n() ); |
|
349 break; |
|
350 case EMobileSmsMessagingAckSmsStored: |
|
351 ret = AckSmsStoredL( aTsyReqHandle, aPackage.Des1n(), |
|
352 reinterpret_cast< TBool* >( dataPtr2 ) ); |
|
353 break; |
|
354 case EMobileSmsMessagingNackSmsStored: |
|
355 ret = NackSmsStoredL( aTsyReqHandle, aPackage.Des1n(), |
|
356 reinterpret_cast< TInt* >( dataPtr2 ) ); |
|
357 break; |
|
358 case EMobileSmsMessagingResumeSmsReception: |
|
359 ret = ResumeSmsReceptionL( aTsyReqHandle ); |
|
360 break; |
|
361 case EMobileSmsMessagingNotifyMoSmsBearerChange: |
|
362 ret = NotifyMoSmsBearerChange( reinterpret_cast< |
|
363 RMobileSmsMessaging::TMobileSmsBearer*> ( dataPtr ) ); |
|
364 break; |
|
365 case EMobileSmsMessagingSendMessage: |
|
366 { |
|
367 iSmsNoFdnCheckFlag = ESmsNoFdnCheckNotUsed; |
|
368 ret = SendMessageL( aTsyReqHandle, aPackage.Des1n(), |
|
369 aPackage.Des2n() ); |
|
370 } |
|
371 break; |
|
372 case EMobileSmsMessagingSendMessageNoFdnCheck: |
|
373 { |
|
374 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUsed; |
|
375 ret = SendMessageL( aTsyReqHandle, aPackage.Des1n(), |
|
376 aPackage.Des2n() ); |
|
377 } |
|
378 break; |
|
379 case EMobileSmsMessagingGetMessageStoreInfo: |
|
380 ret = GetMessageStoreInfoL( aTsyReqHandle, |
|
381 reinterpret_cast< TInt* >( dataPtr ), aPackage.Des2n() ); |
|
382 break; |
|
383 case EMobileSmsMessagingGetSmspListPhase1: |
|
384 ret = ReadSmspListPhase1L( aTsyReqHandle, |
|
385 reinterpret_cast< RMobilePhone::TClientId*>( dataPtr ), |
|
386 reinterpret_cast< TInt* >( dataPtr2 ) ); |
|
387 break; |
|
388 case EMobileSmsMessagingNotifySmspListChange: |
|
389 ret = NotifySmspListChange(); |
|
390 break; |
|
391 case EMobileSmsMessagingStoreSmspList: |
|
392 ret = StoreSmspList( aTsyReqHandle, aPackage.Des1n() ); |
|
393 break; |
|
394 default: |
|
395 ret = KErrNotSupported; |
|
396 break; |
|
397 } |
|
398 |
|
399 return ret; |
|
400 } |
|
401 |
|
402 // --------------------------------------------------------------------------- |
|
403 // CMmSmsTsy::ReqModeL |
|
404 // When the ETel server receives an "extension" client request, |
|
405 // it will pass the IPC request number down to the TSY in order to find out |
|
406 // what type of request it is |
|
407 // (other items were commented in a header). |
|
408 // --------------------------------------------------------------------------- |
|
409 // |
|
410 CTelObject::TReqMode CMmSmsTsy::ReqModeL( |
|
411 const TInt aIpc ) |
|
412 { |
|
413 CTelObject::TReqMode ret = 0; |
|
414 switch ( aIpc ) |
|
415 { |
|
416 // Non-flow Controlled Services |
|
417 case EMobileSmsMessagingGetCaps: |
|
418 case EMobileSmsMessagingGetMoSmsBearer: |
|
419 case EMobileSmsMessagingSetMoSmsBearer: |
|
420 case EMobileSmsMessagingGetReceiveMode: |
|
421 case EMobileSmsMessagingEnumerateMessageStores: |
|
422 case EMobileSmsMessagingGetSmspListPhase2: |
|
423 case EMobileSmsMessagingAckSmsStored: |
|
424 case EMobileSmsMessagingNackSmsStored: |
|
425 case EMobileSmsMessagingSendMessage: |
|
426 case EMobileSmsMessagingSendMessageNoFdnCheck: |
|
427 case EMobileSmsMessagingResumeSmsReception: |
|
428 case EMobileSmsMessagingGetMessageStoreInfo: |
|
429 case EMobileSmsMessagingGetSmspListPhase1: |
|
430 case EMobileSmsMessagingStoreSmspList: |
|
431 case EMobileSmsMessagingSetReceiveMode: |
|
432 break; |
|
433 // Immediate Server Repost - but not multiple completion enabled |
|
434 case EMobileSmsMessagingReceiveMessage: |
|
435 ret = KReqModeRePostImmediately; |
|
436 break; |
|
437 // Multiple Completion Services with Immediate Server Repost |
|
438 case EMobileSmsMessagingNotifyReceiveModeChange: |
|
439 case EMobileSmsMessagingNotifyMoSmsBearerChange: |
|
440 case EMobileSmsMessagingNotifySmspListChange: |
|
441 ret = KReqModeMultipleCompletionEnabled | |
|
442 KReqModeRePostImmediately; |
|
443 break; |
|
444 default: |
|
445 User::Leave( KErrNotSupported ); |
|
446 break; |
|
447 } |
|
448 |
|
449 return ret; |
|
450 } |
|
451 |
|
452 //---------------------------------------------------------------------------- |
|
453 // CMmSmsTsy::NumberOfSlotsL |
|
454 // When the ETel server discovers that a request is "repost |
|
455 // immediately" it will ask the TSY how big a buffer it wants. |
|
456 // NumberOfSlotsL Returns number of slots to be used for given requests |
|
457 // (other items were commented in a header). |
|
458 // --------------------------------------------------------------------------- |
|
459 // |
|
460 TInt CMmSmsTsy::NumberOfSlotsL( |
|
461 const TInt aIpc ) |
|
462 { |
|
463 TInt numberOfSlots = 1; |
|
464 switch ( aIpc ) |
|
465 { |
|
466 case EMobileSmsMessagingReceiveMessage: |
|
467 numberOfSlots = KMmSmsMessagingReceiveMessageSlots; |
|
468 break; |
|
469 // It is safer that normal notification trigger value is three |
|
470 // => Slotlimits are defined according to the requirements of |
|
471 // environment, five for messagereception and three for normal |
|
472 // notifications |
|
473 case EMobileSmsMessagingNotifyReceiveModeChange: |
|
474 numberOfSlots = KMmSmsMessagingNotifyReceiveModeChangeSlots; |
|
475 break; |
|
476 case EMobileSmsMessagingNotifyMoSmsBearerChange: |
|
477 numberOfSlots = KMmSmsMessagingNotifyMoSmsBearerChangeSlots; |
|
478 break; |
|
479 case EMobileSmsMessagingNotifySmspListChange: |
|
480 numberOfSlots = KMmSmsMessagingNotifySmspListChangeSlots; |
|
481 break; |
|
482 default: |
|
483 User::Leave( KErrNotSupported ); |
|
484 break; |
|
485 } |
|
486 |
|
487 return numberOfSlots; |
|
488 } |
|
489 |
|
490 //---------------------------------------------------------------------------- |
|
491 // CMmSmsTsy::CancelService |
|
492 // CancelService is called by the server when it is |
|
493 // "cleaning-up" any still outstanding asynchronous requests before closing |
|
494 // a client's sub-session. This will happen if a client closes its R-class |
|
495 // handle without cancelling outstanding asynchronous requests on |
|
496 // (other items were commented in a header). |
|
497 // --------------------------------------------------------------------------- |
|
498 // |
|
499 TInt CMmSmsTsy::CancelService( |
|
500 const TInt aIpc, |
|
501 const TTsyReqHandle aTsyReqHandle ) |
|
502 { |
|
503 TInt ret( KErrNone ); |
|
504 |
|
505 switch ( aIpc ) |
|
506 { |
|
507 case EMobileSmsMessagingSetReceiveMode: |
|
508 ret = SetReceiveModeCancel( aTsyReqHandle ); |
|
509 break; |
|
510 case EMobileSmsMessagingNotifyReceiveModeChange: |
|
511 ret = NotifyReceiveModeChangeCancel( aTsyReqHandle ); |
|
512 break; |
|
513 case EMobileSmsMessagingSetMoSmsBearer: |
|
514 ret = SetMoSmsBearerCancel( aTsyReqHandle ); |
|
515 break; |
|
516 case EMobileSmsMessagingNotifyMoSmsBearerChange: |
|
517 ret = NotifyMoSmsBearerChangeCancel( aTsyReqHandle ); |
|
518 break; |
|
519 case EMobileSmsMessagingGetMessageStoreInfo: |
|
520 ret = GetMessageStoreInfoCancel( aTsyReqHandle ); |
|
521 break; |
|
522 case EMobileSmsMessagingGetSmspListPhase1: |
|
523 case EMobileSmsMessagingGetSmspListPhase2: |
|
524 ret = ReadAllSmspCancel( aTsyReqHandle ); |
|
525 break; |
|
526 case EMobileSmsMessagingNotifySmspListChange: |
|
527 ret = NotifySmspListChangeCancel( aTsyReqHandle ); |
|
528 break; |
|
529 case EMobileSmsMessagingSendMessage: |
|
530 case EMobileSmsMessagingAckSmsStored: |
|
531 case EMobileSmsMessagingNackSmsStored: |
|
532 case EMobileSmsMessagingResumeSmsReception: |
|
533 case EMobileSmsMessagingStoreSmspList: |
|
534 break; |
|
535 case EMobileSmsMessagingReceiveMessage: |
|
536 ret = ReceiveMessageCancel( aTsyReqHandle ); |
|
537 break; |
|
538 case EMobileSmsMessagingSendMessageNoFdnCheck: |
|
539 ret = SendMessageNoFdnCheckCancel( aTsyReqHandle ); |
|
540 break; |
|
541 default: |
|
542 ret = KErrGeneral; |
|
543 break; |
|
544 } |
|
545 |
|
546 return ret; |
|
547 } |
|
548 |
|
549 //---------------------------------------------------------------------------- |
|
550 // CMmSmsTsy::RegisterNotification |
|
551 // Called when the server recognises that this notification |
|
552 // is being posted for the first time on this sub-session object.It enables |
|
553 // the TSY to "turn on" any regular notification messages that it may |
|
554 // receive from DOS |
|
555 // (other items were commented in a header). |
|
556 // --------------------------------------------------------------------------- |
|
557 // |
|
558 TInt CMmSmsTsy::RegisterNotification( |
|
559 const TInt aIpc ) |
|
560 { |
|
561 TInt ret( KErrNotSupported ); |
|
562 |
|
563 switch ( aIpc ) |
|
564 { |
|
565 case EMobileSmsMessagingReceiveMessage: |
|
566 case EMobileSmsMessagingNotifyReceiveModeChange: |
|
567 case EMobileSmsMessagingNotifyMoSmsBearerChange: |
|
568 case EMobileSmsMessagingNotifySmspListChange: |
|
569 ret = KErrNone; |
|
570 break; |
|
571 default: |
|
572 ret = KErrNotSupported; |
|
573 } |
|
574 |
|
575 return ret; |
|
576 } |
|
577 |
|
578 //---------------------------------------------------------------------------- |
|
579 // CMmSmsTsy::DeregisterNotification |
|
580 // Called when the server recognises that this notification |
|
581 // will not be posted again because the last client to have |
|
582 // a handle on this sub-session object has just closed the handle. |
|
583 // It enables the TSY to "turn off" any regular notification messages that |
|
584 // it may receive from the DOS |
|
585 // (other items were commented in a header). |
|
586 // --------------------------------------------------------------------------- |
|
587 // |
|
588 TInt CMmSmsTsy::DeregisterNotification( |
|
589 const TInt aIpc ) |
|
590 { |
|
591 TInt ret( KErrNotSupported ); |
|
592 |
|
593 switch ( aIpc ) |
|
594 { |
|
595 case EMobileSmsMessagingReceiveMessage: |
|
596 case EMobileSmsMessagingNotifyReceiveModeChange: |
|
597 case EMobileSmsMessagingNotifyMoSmsBearerChange: |
|
598 case EMobileSmsMessagingNotifySmspListChange: |
|
599 ret = KErrNone; |
|
600 break; |
|
601 default: |
|
602 ret = KErrNotSupported; |
|
603 } |
|
604 |
|
605 return ret; |
|
606 } |
|
607 |
|
608 //---------------------------------------------------------------------------- |
|
609 // CMmSmsTsy::GetCaps |
|
610 // This method returns SMS messaging capabilities of the phone |
|
611 // (other items were commented in a header). |
|
612 // --------------------------------------------------------------------------- |
|
613 // |
|
614 TInt CMmSmsTsy::GetCaps( |
|
615 const TTsyReqHandle aTsyReqHandle, |
|
616 TDes8* aCaps ) |
|
617 { |
|
618 if(sizeof(RMobileSmsMessaging::TMobileSmsCapsV1) > aCaps->Size()) |
|
619 { |
|
620 return KErrArgument; |
|
621 } |
|
622 |
|
623 RMobileSmsMessaging::TMobileSmsCapsV1Pckg* smsCapsPckg = |
|
624 reinterpret_cast< RMobileSmsMessaging::TMobileSmsCapsV1Pckg* >( aCaps ); |
|
625 RMobileSmsMessaging::TMobileSmsCapsV1& smsCaps = ( *smsCapsPckg )(); |
|
626 |
|
627 // Capabilities depend on the TSY implementation. |
|
628 smsCaps.iSmsMode = KSmsGsmModeCaps; |
|
629 smsCaps.iSmsControl = KSmsControlCaps; |
|
630 |
|
631 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
632 |
|
633 return KErrNone; |
|
634 } |
|
635 |
|
636 //---------------------------------------------------------------------------- |
|
637 // CMmSmsTsy::GetReceiveMode |
|
638 // This method retrieves the current setting of the TSY-phone |
|
639 // incoming SMS receive mode |
|
640 // (other items were commented in a header). |
|
641 // --------------------------------------------------------------------------- |
|
642 // |
|
643 TInt CMmSmsTsy::GetReceiveMode( |
|
644 const TTsyReqHandle aTsyReqHandle, |
|
645 RMobileSmsMessaging::TMobileSmsReceiveMode* aReceiveMode ) |
|
646 { |
|
647 *aReceiveMode = iMobileSmsReceiveMode; |
|
648 |
|
649 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
650 |
|
651 return KErrNone; |
|
652 } |
|
653 |
|
654 //---------------------------------------------------------------------------- |
|
655 // CMmSmsTsy::SetReceiveMode |
|
656 // This method sets the setting of the TSY-phone incoming SMS receive mode |
|
657 // (other items were commented in a header). |
|
658 // --------------------------------------------------------------------------- |
|
659 // |
|
660 TInt CMmSmsTsy::SetReceiveMode( |
|
661 const TTsyReqHandle aTsyReqHandle, |
|
662 RMobileSmsMessaging::TMobileSmsReceiveMode const* aReceiveMode ) |
|
663 { |
|
664 if ( RMobileSmsMessaging::EReceiveUnstoredClientAck == *aReceiveMode ) |
|
665 { |
|
666 iMobileSmsReceiveMode = *aReceiveMode; |
|
667 |
|
668 CompleteNotifyReceiveModeChange(); |
|
669 |
|
670 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
671 } |
|
672 else |
|
673 { |
|
674 // EReceiveModeUnspecified, EReceiveStored, EReceiveUnstoredPhoneAck & |
|
675 // EReceiveAny modes not supported because of CS functionality. |
|
676 ReqCompleted( aTsyReqHandle, KErrNotSupported ); |
|
677 } |
|
678 |
|
679 return KErrNone; |
|
680 } |
|
681 |
|
682 //---------------------------------------------------------------------------- |
|
683 // CMmSmsTsy::SetReceiveModeCancel |
|
684 // This method is used to cancel the outstanding asynchronous |
|
685 // SetReceiveMode request |
|
686 // (other items were commented in a header). |
|
687 // --------------------------------------------------------------------------- |
|
688 // |
|
689 TInt CMmSmsTsy::SetReceiveModeCancel( |
|
690 const TTsyReqHandle aTsyReqHandle ) |
|
691 { |
|
692 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
693 |
|
694 return KErrNone; |
|
695 } |
|
696 |
|
697 //---------------------------------------------------------------------------- |
|
698 // CMmSmsTsy::NotifyReceiveModeChange |
|
699 // This method is used to notify the client if there is a |
|
700 // change to the receive mode setting |
|
701 // (other items were commented in a header). |
|
702 // --------------------------------------------------------------------------- |
|
703 // |
|
704 TInt CMmSmsTsy::NotifyReceiveModeChange( |
|
705 RMobileSmsMessaging::TMobileSmsReceiveMode* aReceiveMode ) |
|
706 { |
|
707 iReqHandleType = EMultimodeSmsNotifyReceiveModeChange; |
|
708 iNotifyReceiveModeChangePtr = aReceiveMode; |
|
709 |
|
710 return KErrNone; |
|
711 } |
|
712 |
|
713 //---------------------------------------------------------------------------- |
|
714 // CMmSmsTsy::NotifyReceiveModeChangeCancel |
|
715 // This method cancel notify receive mode change request |
|
716 // (other items were commented in a header). |
|
717 // --------------------------------------------------------------------------- |
|
718 // |
|
719 TInt CMmSmsTsy::NotifyReceiveModeChangeCancel( |
|
720 const TTsyReqHandle aTsyReqHandle ) |
|
721 { |
|
722 iTsyReqHandleStore->ResetTsyReqHandle( |
|
723 EMultimodeSmsNotifyReceiveModeChange ); |
|
724 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
725 iNotifyReceiveModeChangePtr = NULL; |
|
726 |
|
727 return KErrNone; |
|
728 } |
|
729 |
|
730 //---------------------------------------------------------------------------- |
|
731 // CMmSmsTsy::CompleteNotifyReceiveModeChange |
|
732 // This method completes notify receive mode change request |
|
733 // (other items were commented in a header). |
|
734 // --------------------------------------------------------------------------- |
|
735 // |
|
736 void CMmSmsTsy::CompleteNotifyReceiveModeChange() |
|
737 { |
|
738 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
739 EMultimodeSmsNotifyReceiveModeChange ); |
|
740 |
|
741 if ( reqHandle ) |
|
742 { |
|
743 if ( iNotifyReceiveModeChangePtr ) |
|
744 { |
|
745 *iNotifyReceiveModeChangePtr = iMobileSmsReceiveMode; |
|
746 } |
|
747 ReqCompleted( reqHandle, KErrNone ); |
|
748 iNotifyReceiveModeChangePtr = NULL; |
|
749 } |
|
750 } |
|
751 |
|
752 //---------------------------------------------------------------------------- |
|
753 // CMmSmsTsy::ReceiveMessageL |
|
754 // This method starts the reception of incoming unstored SMS |
|
755 // (other items were commented in a header). |
|
756 // --------------------------------------------------------------------------- |
|
757 // |
|
758 TInt CMmSmsTsy::ReceiveMessageL( |
|
759 const TTsyReqHandle aTsyReqHandle, |
|
760 TDes8* aMsgData, |
|
761 TDes8* aMsgAttributes ) |
|
762 { |
|
763 TFLOGSTRING("TSY: CMmSmsTsy::ReceiveMessageL\n"); |
|
764 |
|
765 if(sizeof(RMobileSmsMessaging::TMobileSmsReceiveAttributesV1) > aMsgAttributes->Size()) |
|
766 { |
|
767 return KErrArgument; |
|
768 } |
|
769 |
|
770 iReceiveMessagePduPtr = aMsgData; |
|
771 iReceiveMessageParamsPtr = aMsgAttributes; |
|
772 |
|
773 if ( iMmPhone->IsModemStatusReady() ) |
|
774 { |
|
775 // activate smsrouting only when modem status is ready |
|
776 ActivateSmsRoutingL(); |
|
777 } |
|
778 |
|
779 // Store request handle here. DeliverClass2ToSmsStack-method may complete |
|
780 // ReceiveMessage request |
|
781 #ifdef REQHANDLE_TIMER |
|
782 SetTypeOfResponse( EMultimodeSmsReceiveMessage, aTsyReqHandle ); |
|
783 #else |
|
784 iTsyReqHandleStore->SetTsyReqHandle( |
|
785 EMultimodeSmsReceiveMessage, aTsyReqHandle ); |
|
786 #endif // REQHANDLE_TIMER |
|
787 |
|
788 // Check if there is class 2 messages waiting in TSY's internal memory. |
|
789 DeliverClass2ToSmsStack(); |
|
790 |
|
791 return KErrNone; |
|
792 } |
|
793 |
|
794 //---------------------------------------------------------------------------- |
|
795 // CMmSmsTsy::ReceiveMessageCancel |
|
796 // This method cancels an MT message routing to the SMS |
|
797 // stack. TSY can not stop routing from SMS server because |
|
798 // otherwise SMS server routes incoming messages to SIM server. |
|
799 // Negative acknowledgement is sent to the network if message |
|
800 // comes when SMS stack routing is not activated |
|
801 // (other items were commented in a header). |
|
802 // --------------------------------------------------------------------------- |
|
803 // |
|
804 TInt CMmSmsTsy::ReceiveMessageCancel( |
|
805 const TTsyReqHandle aTsyReqHandle ) |
|
806 { |
|
807 iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeSmsReceiveMessage ); |
|
808 |
|
809 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
810 |
|
811 return KErrNone; |
|
812 } |
|
813 |
|
814 //---------------------------------------------------------------------------- |
|
815 // CMmSmsTsy::ActivateSmsRoutingL |
|
816 // Activate SMS routing |
|
817 // (other items were commented in a header). |
|
818 // --------------------------------------------------------------------------- |
|
819 // |
|
820 void CMmSmsTsy::ActivateSmsRoutingL() |
|
821 { |
|
822 if ( ( ERoutingNotActivated == iServerRoutingActivity ) || |
|
823 ( ERoutingActivating == iServerRoutingActivity ) ) |
|
824 { |
|
825 //Send request to the Domestic OS layer.. |
|
826 User::LeaveIfError( iMmPhone->MessageManager()->HandleRequestL( |
|
827 EMmTsyActivateSmsRouting ) ); |
|
828 iServerRoutingActivity = ERoutingActivating; |
|
829 } |
|
830 } |
|
831 |
|
832 //---------------------------------------------------------------------------- |
|
833 // CMmSmsTsy::CompleteActivateSmsRouting |
|
834 // This method completes Activation of SMS routing |
|
835 // (other items were commented in a header). |
|
836 // --------------------------------------------------------------------------- |
|
837 // |
|
838 void CMmSmsTsy::CompleteActivateSmsRouting( |
|
839 TInt aError, |
|
840 CMmDataPackage* aDataPackage ) |
|
841 { |
|
842 TUint8 aSmsRoutingStatus ( 0 ); |
|
843 aDataPackage->UnPackData( aSmsRoutingStatus ) ; |
|
844 |
|
845 if ( ( KErrNone == aError ) && |
|
846 ( KSmsRoutingActivated == aSmsRoutingStatus ) ) |
|
847 { |
|
848 TFLOGSTRING("TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing activated"); |
|
849 iServerRoutingActivity = ERoutingActivated; |
|
850 } |
|
851 else if ( ( KErrNone == aError ) && |
|
852 ( KSmsRoutingDeactivated == aSmsRoutingStatus ) ) |
|
853 { |
|
854 TFLOGSTRING("TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing not activated"); |
|
855 iServerRoutingActivity = ERoutingNotActivated; |
|
856 } |
|
857 else |
|
858 { |
|
859 TFLOGSTRING("TSY: CMmSmsTsy::CompleteActivateSmsRouting SMS routing activation failed"); |
|
860 iServerRoutingActivity = ERoutingNotActivated; |
|
861 |
|
862 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
863 EMultimodeSmsReceiveMessage ); |
|
864 |
|
865 if ( reqHandle ) |
|
866 { |
|
867 ReqCompleted( reqHandle, aError ); |
|
868 } |
|
869 } |
|
870 } |
|
871 |
|
872 //---------------------------------------------------------------------------- |
|
873 // CMmSmsTsy::CompleteReceiveMessage |
|
874 // This method completes reception of incoming unstored SMS |
|
875 // (other items were commented in a header). |
|
876 // --------------------------------------------------------------------------- |
|
877 // |
|
878 void CMmSmsTsy::CompleteReceiveMessage( |
|
879 TInt aError, |
|
880 CMmDataPackage* aDataPackage ) |
|
881 { |
|
882 TInt ret( KErrNone ); |
|
883 TBool smsInd( EFalse ); |
|
884 TSmsMsg* smsMsg; |
|
885 |
|
886 TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( |
|
887 EMultimodeSmsReceiveMessage ); |
|
888 |
|
889 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteReceiveMessage. iClientStorageFull: %d", iClientStorageFull ); |
|
890 |
|
891 // SMS successfully received |
|
892 if ( KErrNone == aError ) |
|
893 { |
|
894 //unpack received data |
|
895 aDataPackage->UnPackData( smsInd, smsMsg ); |
|
896 |
|
897 // is the SMS a class2 SMS or not. |
|
898 TBool smsClass2 = smsMsg->iSmsClass2; |
|
899 |
|
900 // if store is not full, receive new class2 message and get |
|
901 // notification |
|
902 if ( smsClass2 && ( 0 != smsMsg->iLocation ) && iMmSmsStorageTsy ) |
|
903 { |
|
904 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReceiveMessage. CompleteNotifyStoreEvent happens"); |
|
905 iMmSmsStorageTsy->CMmSmsStorageTsy::CompleteNotifyStoreEvent( |
|
906 smsMsg->iLocation, RMobilePhoneStore::KStoreEntryAdded ); |
|
907 } |
|
908 |
|
909 // if SMS is a Class2 and SMS Memories are full and SIM SMS Memory |
|
910 // not full |
|
911 if ( iClientStorageFull && smsClass2 ) |
|
912 { |
|
913 if ( reqHandle ) |
|
914 { |
|
915 // Store SMS in TSY's internal memory |
|
916 TRAP( ret, StoreClass2MessageL( smsMsg ) ); |
|
917 |
|
918 // Message is not delivered to SMS Stack.Deliver message to |
|
919 // SMS. Stack after SMS Stack has called ReceiveMessage.. |
|
920 smsMsg->iDeleteAfterClientAck = EFalse; |
|
921 |
|
922 #ifdef USING_CTSY_DISPATCHER |
|
923 CMmDataPackage package; |
|
924 TDesC8* msgData = NULL; |
|
925 package.PackData( &msgData ); |
|
926 |
|
927 // ignore if Acking fails |
|
928 TRAP_IGNORE( |
|
929 ret = iMmPhone->MessageManager()->HandleRequestL(EMobileSmsMessagingAckSmsStored, &package); |
|
930 ); |
|
931 iTsyReqHandleStore->ResetTsyReqHandle(EMultimodeSmsReceiveMessage); |
|
932 ReqCompleted(reqHandle, aError); |
|
933 #else |
|
934 // ignore if Acking fails |
|
935 TRAP_IGNORE( |
|
936 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
937 EMobileSmsMessagingAckSmsStored ); |
|
938 ); |
|
939 #endif //USING_CTSY_DISPATCHER |
|
940 } |
|
941 else |
|
942 { |
|
943 // Routing is activated, but SMS stack hasn't called |
|
944 // ReceiveMessage. Nack received message internally with cause |
|
945 // value "protocol error", otherwise SMS server releases |
|
946 // routings. |
|
947 CMmDataPackage package; |
|
948 TSmsMsg* nullSms = NULL; |
|
949 TInt rpCause( KErrGsmSMSMemoryCapacityExceeded ); |
|
950 package.PackData( &nullSms, &rpCause ); |
|
951 |
|
952 // ignore if Nacking fails |
|
953 TRAP_IGNORE( |
|
954 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
955 EMobileSmsMessagingNackSmsStored, &package ); |
|
956 ); |
|
957 } |
|
958 } |
|
959 else |
|
960 { |
|
961 // Class 0 or Class 1 or Class 2 message received. |
|
962 // This message has to be acknowledged to the network |
|
963 TInt rpError( KErrNone ); |
|
964 |
|
965 if ( reqHandle && !iClientStorageFull ) |
|
966 { |
|
967 // Deliver message to SMS stack |
|
968 if(smsMsg->iSmsMsg.Length() > iReceiveMessagePduPtr->MaxLength()) |
|
969 { |
|
970 ret = KErrArgument; |
|
971 } |
|
972 else |
|
973 { |
|
974 ret = iMmSmsExtInterface->CompleteReceiveMessage( smsMsg, |
|
975 iReceiveMessageParamsPtr, iReceiveMessagePduPtr ); |
|
976 } |
|
977 |
|
978 iTsyReqHandleStore->ResetTsyReqHandle( |
|
979 EMultimodeSmsReceiveMessage ); |
|
980 |
|
981 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReceiveMessage. Deliver SMS to the SMS stack"); |
|
982 ReqCompleted( reqHandle, ret ); |
|
983 |
|
984 // increase the count of expected acknowledgements |
|
985 if(ret == KErrNone) |
|
986 { |
|
987 iExpectAckOrNack++; |
|
988 } |
|
989 } |
|
990 else |
|
991 { |
|
992 // Routing is activated, but SMS stack hasn't called |
|
993 // ReceiveMessage. Nack received message internally with cause |
|
994 // value "protocol error", otherwise SMS server releases |
|
995 // routings. |
|
996 if (iClientStorageFull) |
|
997 { |
|
998 // SMS stack's memory is full. Nack message with error |
|
999 // MemoryExceeded |
|
1000 rpError = KErrGsmSMSMemoryCapacityExceeded; |
|
1001 } |
|
1002 else |
|
1003 { |
|
1004 rpError = KErrGsmSMSUnspecifiedProtocolError; |
|
1005 } |
|
1006 } |
|
1007 |
|
1008 if ( KErrNone != rpError ) |
|
1009 { |
|
1010 CMmDataPackage package; |
|
1011 TSmsMsg* nullSms = NULL; |
|
1012 package.PackData( &nullSms, &rpError ); |
|
1013 |
|
1014 // ignore if Nacking fails |
|
1015 TRAP_IGNORE( |
|
1016 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1017 EMobileSmsMessagingNackSmsStored, &package ); |
|
1018 ); |
|
1019 } |
|
1020 } |
|
1021 |
|
1022 // end of successful SMS reception |
|
1023 } |
|
1024 // error in SMS reception |
|
1025 else |
|
1026 { |
|
1027 //unpack received data - only one parameter information is needed |
|
1028 aDataPackage->UnPackData( smsInd ); |
|
1029 |
|
1030 // if SIM SMS Memory is full |
|
1031 if ( ( KErrGsmSMSUnspecifiedProtocolError == aError ) && |
|
1032 ( reqHandle ) ) |
|
1033 { |
|
1034 // SMS Memories not full |
|
1035 if ( !iClientStorageFull ) |
|
1036 { |
|
1037 CMmDataPackage package; |
|
1038 TSmsMsg* nullSms = NULL; |
|
1039 TInt rpCause( KErrGsmSMSUnspecifiedProtocolError ); |
|
1040 package.PackData( &nullSms, &rpCause ); |
|
1041 |
|
1042 // ignore if Nacking fails |
|
1043 TRAPD( trapError, |
|
1044 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1045 EMobileSmsMessagingNackSmsStored, &package ); ); |
|
1046 if ( KErrNone != trapError ) |
|
1047 { |
|
1048 ret = trapError; |
|
1049 } |
|
1050 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReceiveMessage.KErrGsmSMSUnspecifiedProtocolError "); |
|
1051 } |
|
1052 else // SMS Memory is full |
|
1053 { |
|
1054 CMmDataPackage package; |
|
1055 TSmsMsg* nullSms = NULL; |
|
1056 TInt rpCause( KErrGsmSMSMemoryCapacityExceeded ); |
|
1057 package.PackData( &nullSms, &rpCause ); |
|
1058 |
|
1059 // ignore if Nacking fails |
|
1060 TRAPD( trapError, |
|
1061 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1062 EMobileSmsMessagingNackSmsStored, &package ); ); |
|
1063 if ( KErrNone != trapError ) |
|
1064 { |
|
1065 ret = trapError; |
|
1066 } |
|
1067 } |
|
1068 } |
|
1069 else if ( ( KErrGsmSMSMemoryCapacityExceeded == aError ) && |
|
1070 ( reqHandle ) ) |
|
1071 { |
|
1072 CMmDataPackage package; |
|
1073 TSmsMsg* nullSms = NULL; |
|
1074 TInt rpCause( KErrGsmSMSMemoryCapacityExceeded ); |
|
1075 package.PackData( &nullSms, &rpCause ); |
|
1076 |
|
1077 // ignore if Nacking fails |
|
1078 TRAPD( trapError, |
|
1079 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1080 EMobileSmsMessagingNackSmsStored, &package ); |
|
1081 ); |
|
1082 if ( KErrNone != trapError ) |
|
1083 { |
|
1084 ret = trapError; |
|
1085 } |
|
1086 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReceiveMessage.KErrGsmSMSMemoryCapacityExceeded "); |
|
1087 } |
|
1088 else if ( !reqHandle ) |
|
1089 { |
|
1090 // Routing is activated, but SMS stack hasn't called |
|
1091 // ReceiveMessage. Nack received message internally with cause |
|
1092 // value "protocol error", otherwise SMS server releases |
|
1093 // routings |
|
1094 CMmDataPackage package; |
|
1095 TSmsMsg* nullSms = NULL; |
|
1096 TInt rpCause; |
|
1097 if (iClientStorageFull) |
|
1098 { |
|
1099 rpCause = KErrGsmSMSMemoryCapacityExceeded; |
|
1100 } |
|
1101 else |
|
1102 { |
|
1103 rpCause = KErrGsmSMSUnspecifiedProtocolError; |
|
1104 } |
|
1105 package.PackData( &nullSms, &rpCause ); |
|
1106 |
|
1107 // ignore if Nacking fails |
|
1108 TRAPD( trapError, |
|
1109 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1110 EMobileSmsMessagingNackSmsStored, &package ); |
|
1111 ); |
|
1112 if ( KErrNone != trapError ) |
|
1113 { |
|
1114 ret = trapError; |
|
1115 } |
|
1116 } |
|
1117 else if ( !smsInd ) |
|
1118 { |
|
1119 // Error occurred while handling incoming message or acknowledging |
|
1120 // received message |
|
1121 // Request handle exists (already checked above) |
|
1122 iTsyReqHandleStore->ResetTsyReqHandle( |
|
1123 EMultimodeSmsReceiveMessage ); |
|
1124 |
|
1125 ReqCompleted( reqHandle, aError ); |
|
1126 |
|
1127 // Incoming message handling failed. If client or TSY doesn't . |
|
1128 // ack incoming message, SMS Server may release all routings. |
|
1129 // Set iSmsServerRoutingActivity to FALSE so client can activate |
|
1130 // routings again. |
|
1131 iServerRoutingActivity = ERoutingNotActivated; |
|
1132 } |
|
1133 |
|
1134 if ( KErrNone != ret ) |
|
1135 { |
|
1136 // Nack of received message failed. SMS Server releases all |
|
1137 // routings. Set iSmsServerRoutingActivity to FALSE so client |
|
1138 // can activate routings again |
|
1139 iServerRoutingActivity = ERoutingNotActivated; |
|
1140 } |
|
1141 } |
|
1142 } |
|
1143 |
|
1144 //---------------------------------------------------------------------------- |
|
1145 // CMmSmsTsy::StoreClass2MessageL |
|
1146 // This method stores received Class 2 message in TSY's internal memory |
|
1147 // (other items were commented in a header). |
|
1148 // --------------------------------------------------------------------------- |
|
1149 // |
|
1150 void CMmSmsTsy::StoreClass2MessageL( |
|
1151 TSmsMsg const* aSmsMsg ) |
|
1152 { |
|
1153 TSmsMsg* smsMsg = new ( ELeave ) TSmsMsg(); |
|
1154 CleanupStack::PushL( smsMsg ); |
|
1155 |
|
1156 smsMsg->iDeleteAfterClientAck = aSmsMsg->iDeleteAfterClientAck; |
|
1157 smsMsg->iLocation = aSmsMsg->iLocation; |
|
1158 smsMsg->iMessageStatus = aSmsMsg->iMessageStatus; |
|
1159 smsMsg->iMobileScNPI = aSmsMsg->iMobileScNPI; |
|
1160 smsMsg->iMobileScTON = aSmsMsg->iMobileScTON; |
|
1161 smsMsg->iServiceCentre.Copy( aSmsMsg->iServiceCentre ); |
|
1162 smsMsg->iSmsMsg.Copy( aSmsMsg->iSmsMsg ); |
|
1163 |
|
1164 iSmsMsgArray->AppendL( smsMsg ); |
|
1165 |
|
1166 CleanupStack::Pop( smsMsg ); |
|
1167 // note: Lint doesn't understand the use of Pop and 'thinks' |
|
1168 // that there is a memory leak for smsMsg, we disable that warning with |
|
1169 // the following command |
|
1170 // lint -e429 |
|
1171 } |
|
1172 |
|
1173 //---------------------------------------------------------------------------- |
|
1174 // CMmSmsTsy::DeliverClass2ToSmsStack |
|
1175 // This method delivers a received Class 2 messages that are |
|
1176 // stored in TSY's internal memory to the SMS stack |
|
1177 // (other items were commented in a header). |
|
1178 // --------------------------------------------------------------------------- |
|
1179 // |
|
1180 void CMmSmsTsy::DeliverClass2ToSmsStack() |
|
1181 { |
|
1182 // Check if there is Class 2 messages in TSY's internal memory that can be |
|
1183 // now delivered to the SMS stack |
|
1184 TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( |
|
1185 EMultimodeSmsReceiveMessage ); |
|
1186 |
|
1187 if ( reqHandle && !iClientStorageFull ) |
|
1188 { |
|
1189 for ( TInt i = 0; i < iSmsMsgArray->Count(); i++ ) |
|
1190 { |
|
1191 if ( EFalse == iSmsMsgArray->At( i )->iDeleteAfterClientAck ) |
|
1192 { |
|
1193 TFLOGSTRING2("TSY: CMmSmsTsy::DeliverClass2ToSmsStack. Deliver SMS to the SMS stack. Array count: %d", iSmsMsgArray->Count()); |
|
1194 // TSY can now delete the message if SMS stack ack message |
|
1195 // successfully |
|
1196 iSmsMsgArray->At( i )->iDeleteAfterClientAck = ETrue; |
|
1197 |
|
1198 TInt ret = iMmSmsExtInterface->CompleteReceiveMessage( |
|
1199 iSmsMsgArray->At( i ), iReceiveMessageParamsPtr, |
|
1200 iReceiveMessagePduPtr ); |
|
1201 |
|
1202 // ReceiveMessage request completed Reset request handle |
|
1203 iTsyReqHandleStore->ResetTsyReqHandle( |
|
1204 EMultimodeSmsReceiveMessage ); |
|
1205 |
|
1206 // increase the count of expected acknowledgements |
|
1207 if(ret == KErrNone) |
|
1208 { |
|
1209 iExpectAckOrNack++; |
|
1210 } |
|
1211 |
|
1212 ReqCompleted( reqHandle, ret ); |
|
1213 break; |
|
1214 } |
|
1215 } |
|
1216 } |
|
1217 } |
|
1218 |
|
1219 //---------------------------------------------------------------------------- |
|
1220 // CMmSmsTsy::AckSmsStoredL |
|
1221 // Route RP-Ack request to active messagehandler |
|
1222 // (other items were commented in a header). |
|
1223 // --------------------------------------------------------------------------- |
|
1224 // |
|
1225 TInt CMmSmsTsy::AckSmsStoredL( |
|
1226 const TTsyReqHandle aTsyReqHandle, |
|
1227 const TDesC8* aMsgData, |
|
1228 TBool const * aMemoryFull ) |
|
1229 { |
|
1230 TFLOGSTRING2("TSY: CMmSmsTsy::AckSmsStored. aMemoryFull: %d",*aMemoryFull); |
|
1231 TTsyReqHandle getAckStoredMessageHandle = |
|
1232 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsAckStored ); |
|
1233 |
|
1234 if ( EMultimodeSmsReqHandleUnknown < getAckStoredMessageHandle ) |
|
1235 { |
|
1236 // Send request is already ongoing |
|
1237 ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
1238 } |
|
1239 else |
|
1240 if ( iExpectAckOrNack <= 0 ) |
|
1241 { |
|
1242 TFLOGSTRING("TSY: CMmSmsTsy::AckSmsStoredL. -> ReceiveMessage not requested - error returned "); |
|
1243 ReqCompleted( aTsyReqHandle, KErrNotReady ); |
|
1244 return KErrNone; |
|
1245 } |
|
1246 else |
|
1247 { |
|
1248 iClientStorageFull = *aMemoryFull; |
|
1249 TBool ackMessage( ETrue ); |
|
1250 |
|
1251 // Check if TSY has stored received Class 2 message to it's internal |
|
1252 // memory. TSY can now delete message from it's internal memory |
|
1253 // because SMS stack received message successfully. |
|
1254 for ( TInt i = 0; i < iSmsMsgArray->Count(); i++ ) |
|
1255 { |
|
1256 if ( EFalse != iSmsMsgArray->At( i )->iDeleteAfterClientAck && |
|
1257 KErrNone == aMsgData->CompareF( |
|
1258 iSmsMsgArray->At( i )->iSmsMsg ) ) |
|
1259 { |
|
1260 TFLOGSTRING3("TSY: CMmSmsTsy::AckSmsStored. Delete SMS: %d, Array count: %d",i,iSmsMsgArray->Count()); |
|
1261 delete iSmsMsgArray->At( i ); // Delete object from memory |
|
1262 iSmsMsgArray->Delete( i ); // Delete pointer from array |
|
1263 iSmsMsgArray->Compress(); |
|
1264 |
|
1265 // Class 2 message is already acknowledged to the network |
|
1266 // Complete request here and don't send ack to the . |
|
1267 // network. |
|
1268 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
1269 ackMessage = EFalse; |
|
1270 |
|
1271 // Check if there is more class 2 messages waiting in TSY's |
|
1272 // internal memory |
|
1273 DeliverClass2ToSmsStack(); |
|
1274 break; |
|
1275 } |
|
1276 } |
|
1277 |
|
1278 if ( ackMessage ) |
|
1279 { |
|
1280 // Pack data |
|
1281 CMmDataPackage package; |
|
1282 TDesC8* msgData = const_cast<TDesC8*>( aMsgData ); |
|
1283 package.PackData( &msgData ); |
|
1284 |
|
1285 TInt ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1286 EMobileSmsMessagingAckSmsStored, &package ); |
|
1287 |
|
1288 if ( KErrNone == ret ) |
|
1289 { |
|
1290 iReqHandleType = EMultimodeSmsAckStored; |
|
1291 } |
|
1292 else |
|
1293 { |
|
1294 // Message construction failed or phonet returned error |
|
1295 ReqCompleted( aTsyReqHandle, ret ); |
|
1296 |
|
1297 // Acknowledging failed. SMS Server will now release routings. |
|
1298 // Complete receive message request with KErrGeneral and |
|
1299 // set routing activity to false. SMS Stack makes new |
|
1300 // ReceiveMessage request. |
|
1301 TBool smsInd( EFalse ); |
|
1302 CMmDataPackage data; |
|
1303 TSmsMsg* nullSms = NULL; |
|
1304 data.PackData( &smsInd, &nullSms ); |
|
1305 CompleteReceiveMessage( KErrGeneral, &data ); |
|
1306 } |
|
1307 } |
|
1308 } |
|
1309 |
|
1310 // decrease the count of expeced acknowledgements |
|
1311 iExpectAckOrNack--; |
|
1312 |
|
1313 return KErrNone; |
|
1314 } |
|
1315 |
|
1316 //---------------------------------------------------------------------------- |
|
1317 // CMmSmsTsy::CompleteAckSmsStored |
|
1318 // Complete clients AckSmsStored request |
|
1319 // (other items were commented in a header). |
|
1320 // --------------------------------------------------------------------------- |
|
1321 // |
|
1322 void CMmSmsTsy::CompleteAckSmsStored( |
|
1323 TInt aError ) |
|
1324 { |
|
1325 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1326 EMultimodeSmsAckStored ); |
|
1327 if ( reqHandle ) |
|
1328 { |
|
1329 ReqCompleted( reqHandle, aError ); |
|
1330 } |
|
1331 } |
|
1332 |
|
1333 //---------------------------------------------------------------------------- |
|
1334 // CMmSmsTsy::NackSmsStored |
|
1335 // Route RP-Error request to messagehandler |
|
1336 // (other items were commented in a header). |
|
1337 // --------------------------------------------------------------------------- |
|
1338 // |
|
1339 TInt CMmSmsTsy::NackSmsStoredL( |
|
1340 const TTsyReqHandle aTsyReqHandle, |
|
1341 const TDesC8* aMsgData, |
|
1342 TInt* aRpCause ) |
|
1343 { |
|
1344 TFLOGSTRING2("TSY: CMmSmsTsy::NackSmsStored. aRpCause: %d",*aRpCause); |
|
1345 TTsyReqHandle nackHandle = |
|
1346 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsNackStored ); |
|
1347 |
|
1348 if ( 0 < nackHandle ) |
|
1349 { |
|
1350 // The request is already in processing because of previous request |
|
1351 // Complete request with status value informing the client about |
|
1352 // the situation. |
|
1353 ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
1354 } |
|
1355 else |
|
1356 if ( iExpectAckOrNack <= 0 ) |
|
1357 { |
|
1358 TFLOGSTRING("TSY: CMmSmsTsy::AckSmsStoredL. -> ReceiveMessage not requested - error returned "); |
|
1359 ReqCompleted( aTsyReqHandle, KErrNotReady ); |
|
1360 return KErrNone; |
|
1361 } |
|
1362 else |
|
1363 { |
|
1364 TBool nackMessage( ETrue ); |
|
1365 |
|
1366 // Check if TSY has stored received Class 2 message to it's internal |
|
1367 // memory. TSY can now delete message from it's internal memory |
|
1368 // because SMS stack received message successfully |
|
1369 for ( TInt i = 0; i < iSmsMsgArray->Count(); i++ ) |
|
1370 { |
|
1371 // Check if message is waiting SMS stack's acknowledging and |
|
1372 // message contents is same as aMsgData. |
|
1373 if ( EFalse != iSmsMsgArray->At( i )->iDeleteAfterClientAck && |
|
1374 KErrNone == aMsgData->CompareF( |
|
1375 iSmsMsgArray->At( i )->iSmsMsg ) ) |
|
1376 { |
|
1377 switch ( *aRpCause ) |
|
1378 { |
|
1379 // ETel specific value |
|
1380 case KErrGsmSMSMemoryCapacityExceeded: |
|
1381 // Defect in SMS stack. Stack sets TP cause value to the |
|
1382 // RP cause value TP-FCS 0xD3, RP cause 0x16 |
|
1383 // 0xD3:Memory Capacity Exceeded |
|
1384 iClientStorageFull = ETrue; |
|
1385 // without break statement, it will run "iSmsMsgArray->At( i )->iDeleteAfterClientAck = EFalse" in next case block. |
|
1386 case 0xD3: |
|
1387 // Deliver this message to SMS stack when SMS stack |
|
1388 // has enough memory. |
|
1389 iSmsMsgArray->At( i )->iDeleteAfterClientAck = EFalse; |
|
1390 break; |
|
1391 default: |
|
1392 // Delete message because SMS stack couldn't handle it. |
|
1393 // Delete object from memory |
|
1394 delete iSmsMsgArray->At( i ); |
|
1395 // Delete pointer from array |
|
1396 iSmsMsgArray->Delete( i ); |
|
1397 iSmsMsgArray->Compress(); |
|
1398 break; |
|
1399 } |
|
1400 |
|
1401 // Class 2 message is already acknowledged to the network by |
|
1402 // adaptation. Complete request here and don't send ack to the |
|
1403 // network. |
|
1404 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
1405 nackMessage = EFalse; |
|
1406 break; |
|
1407 } |
|
1408 } |
|
1409 |
|
1410 if ( nackMessage ) |
|
1411 { |
|
1412 CMmDataPackage package; |
|
1413 // packed parameter: pointer to TDesC8 (TPDU data) |
|
1414 // and TInt (RP cause) |
|
1415 TDesC8* tempMsgDataPtr = const_cast<TDesC8*>( aMsgData ); |
|
1416 package.PackData( &tempMsgDataPtr, aRpCause ); |
|
1417 |
|
1418 TInt ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1419 EMobileSmsMessagingNackSmsStored, &package ); |
|
1420 |
|
1421 if ( KErrNone == ret ) |
|
1422 { |
|
1423 iReqHandleType = EMultimodeSmsNackStored; |
|
1424 } |
|
1425 else |
|
1426 { |
|
1427 // Message construction failed or phonet sender returned |
|
1428 // error |
|
1429 ReqCompleted( aTsyReqHandle, ret ); |
|
1430 |
|
1431 // Acknowledging failed. SMS Server will now release routings. |
|
1432 // Complete receive message request with KErrGeneral and |
|
1433 // set routing activity to false. SMS Stack makes new |
|
1434 // ReceiveMessage request. |
|
1435 TBool smsInd( EFalse ); |
|
1436 CMmDataPackage data; |
|
1437 TSmsMsg* nullSms = NULL; |
|
1438 data.PackData( &smsInd, &nullSms ); |
|
1439 CompleteReceiveMessage( KErrGeneral, &data ); |
|
1440 } |
|
1441 } |
|
1442 } |
|
1443 |
|
1444 |
|
1445 // decrease the count of expeced acknowledgements |
|
1446 iExpectAckOrNack--; |
|
1447 |
|
1448 return KErrNone; |
|
1449 } |
|
1450 |
|
1451 //---------------------------------------------------------------------------- |
|
1452 // CMmSmsTsy::CompleteNackSmsStored |
|
1453 // Complete clients NackSmsStored request |
|
1454 // (other items were commented in a header). |
|
1455 // --------------------------------------------------------------------------- |
|
1456 // |
|
1457 void CMmSmsTsy::CompleteNackSmsStored( |
|
1458 TInt aError ) |
|
1459 { |
|
1460 // reset req handle. Returns the deleted req handle |
|
1461 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1462 EMultimodeSmsNackStored ); |
|
1463 if ( reqHandle ) |
|
1464 { |
|
1465 ReqCompleted( reqHandle, aError ); |
|
1466 } |
|
1467 } |
|
1468 |
|
1469 //---------------------------------------------------------------------------- |
|
1470 // CMmSmsTsy::ResumeSmsReception |
|
1471 // Notify SMS Server, that client have again free memory for incoming SMSes |
|
1472 // (other items were commented in a header). |
|
1473 // --------------------------------------------------------------------------- |
|
1474 // |
|
1475 TInt CMmSmsTsy::ResumeSmsReceptionL( |
|
1476 const TTsyReqHandle aTsyReqHandle ) |
|
1477 { |
|
1478 TFLOGSTRING("TSY: CMmSmsTsy::ResumeSmsReceptionL"); |
|
1479 TTsyReqHandle resumeHandle = |
|
1480 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsResumeReception ); |
|
1481 |
|
1482 if ( 0 < resumeHandle ) |
|
1483 { |
|
1484 // The request is already in processing because of previous request |
|
1485 // Complete request with status value informing the client about |
|
1486 // the situation |
|
1487 ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
1488 } |
|
1489 else if ( iIsOffline ) |
|
1490 { |
|
1491 // CS hardware is in off-line mode. We cannot issue this request |
|
1492 // now, but we will do it as soon as we are on-line again. See |
|
1493 // method SetOffline. |
|
1494 iResumeSmsReceptionPending = ETrue; |
|
1495 |
|
1496 // Complete with KErrNone. Client will never notice that the |
|
1497 // request was not yet sent to DOS. |
|
1498 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
1499 } |
|
1500 else |
|
1501 { |
|
1502 TInt ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1503 EMobileSmsMessagingResumeSmsReception ); |
|
1504 |
|
1505 if ( KErrNone == ret ) |
|
1506 { |
|
1507 iReqHandleType = EMultimodeSmsResumeReception; |
|
1508 } |
|
1509 else |
|
1510 { |
|
1511 // Message construction failed or phonet sender returned error |
|
1512 ReqCompleted( aTsyReqHandle, ret ); |
|
1513 } |
|
1514 } |
|
1515 |
|
1516 return KErrNone; |
|
1517 } |
|
1518 |
|
1519 //---------------------------------------------------------------------------- |
|
1520 // CMmSmsTsy::CompleteResumeSmsReception |
|
1521 // This method completes clients ResumeSmsReception request |
|
1522 // (other items were commented in a header). |
|
1523 // --------------------------------------------------------------------------- |
|
1524 // |
|
1525 void CMmSmsTsy::CompleteResumeSmsReception( |
|
1526 TInt aError ) |
|
1527 { |
|
1528 if ( KErrNone == aError ) |
|
1529 { |
|
1530 iClientStorageFull = EFalse; |
|
1531 } |
|
1532 |
|
1533 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1534 EMultimodeSmsResumeReception ); |
|
1535 if ( reqHandle ) |
|
1536 { |
|
1537 ReqCompleted( reqHandle, aError ); |
|
1538 } |
|
1539 |
|
1540 // Suspended SMS reception resumed. Check if there is class 2 messages |
|
1541 // waiting in TSY's internal memory. |
|
1542 DeliverClass2ToSmsStack(); |
|
1543 } |
|
1544 |
|
1545 //---------------------------------------------------------------------------- |
|
1546 // CMmSmsTsy::SetOffline |
|
1547 // Sets information about CS hardware mode (off-line/on-line) |
|
1548 // (other items were commented in a header). |
|
1549 // --------------------------------------------------------------------------- |
|
1550 // |
|
1551 void CMmSmsTsy::SetOffline( |
|
1552 TBool aIsOffline ) |
|
1553 { |
|
1554 TFLOGSTRING2("TSY: CMmSmsTsy::SetOffline has been called with %d", aIsOffline); |
|
1555 |
|
1556 if ( !aIsOffline && iIsOffline ) |
|
1557 { |
|
1558 // changing from off-line to on-line |
|
1559 if ( iResumeSmsReceptionPending ) |
|
1560 { |
|
1561 // now send the pending ResumeSmsReception |
|
1562 // request to DOS. We are not interested if the |
|
1563 // request has failed, and it has already been completed |
|
1564 // to the client (with KErrNone). See method ResumeSmsReception. |
|
1565 TInt trapError = KErrNone; |
|
1566 TRAP( trapError, iMmPhone->MessageManager()->HandleRequestL( |
|
1567 EMobileSmsMessagingResumeSmsReception ); |
|
1568 ); |
|
1569 iResumeSmsReceptionPending = EFalse; |
|
1570 } |
|
1571 } |
|
1572 iIsOffline = aIsOffline; |
|
1573 } |
|
1574 |
|
1575 //---------------------------------------------------------------------------- |
|
1576 // CMmSmsTsy::GetMoSmsBearer |
|
1577 // This method is used to retrieve the current setting for the |
|
1578 // bearer type used for sending SMS messages |
|
1579 // (other items were commented in a header). |
|
1580 // --------------------------------------------------------------------------- |
|
1581 // |
|
1582 TInt CMmSmsTsy::GetMoSmsBearer( |
|
1583 const TTsyReqHandle /*aTsyReqHandle*/, |
|
1584 RMobileSmsMessaging::TMobileSmsBearer* /*aBearer*/ ) |
|
1585 { |
|
1586 return KErrNotSupported; |
|
1587 } |
|
1588 |
|
1589 //---------------------------------------------------------------------------- |
|
1590 // CMmSmsTsy::SetMoSmsBearer |
|
1591 // This method sets the bearer type for sending SMS messages |
|
1592 // (other items were commented in a header). |
|
1593 // --------------------------------------------------------------------------- |
|
1594 // |
|
1595 TInt CMmSmsTsy::SetMoSmsBearer( |
|
1596 const TTsyReqHandle aTsyReqHandle, |
|
1597 RMobileSmsMessaging::TMobileSmsBearer* aBearer ) |
|
1598 { |
|
1599 TFLOGSTRING("TSY: CMmSmsTsy::SetMoSmsBearer called"); |
|
1600 |
|
1601 TTsyReqHandle setMoSmsBearerHandle = |
|
1602 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsSetMoSmsBearer ); |
|
1603 |
|
1604 if ( 0 < setMoSmsBearerHandle ) |
|
1605 { |
|
1606 // The request is already processing because of previous request. |
|
1607 // Complete request with status value informing the client about |
|
1608 // the situation. |
|
1609 ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
1610 } |
|
1611 else |
|
1612 { |
|
1613 if ( ( *aBearer == RMobileSmsMessaging::ESmsBearerPacketOnly ) || |
|
1614 ( *aBearer == RMobileSmsMessaging::ESmsBearerCircuitOnly ) || |
|
1615 ( *aBearer == RMobileSmsMessaging::ESmsBearerPacketPreferred ) || |
|
1616 ( *aBearer == RMobileSmsMessaging::ESmsBearerCircuitPreferred ) ) |
|
1617 { |
|
1618 TInt ret = KErrNone; |
|
1619 |
|
1620 CMmDataPackage package; |
|
1621 package.PackData( aBearer ); |
|
1622 |
|
1623 // Send request to the DOS layer. |
|
1624 TRAP_IGNORE( ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1625 EMobileSmsMessagingSetMoSmsBearer, &package ); ); |
|
1626 |
|
1627 if ( KErrNone == ret ) |
|
1628 { |
|
1629 #ifdef REQHANDLE_TIMER |
|
1630 SetTypeOfResponse( EMultimodeSmsSetMoSmsBearer, aTsyReqHandle ); |
|
1631 #else |
|
1632 iTsyReqHandleStore->SetTsyReqHandle( |
|
1633 EMultimodeSmsSetMoSmsBearer, aTsyReqHandle ); |
|
1634 #endif // REQHANDLE_TIMER |
|
1635 } |
|
1636 else |
|
1637 { |
|
1638 // Call to DOS failed |
|
1639 ReqCompleted( aTsyReqHandle, ret ); |
|
1640 } |
|
1641 } |
|
1642 else |
|
1643 { |
|
1644 ReqCompleted( aTsyReqHandle, KErrNotSupported ); |
|
1645 } |
|
1646 } |
|
1647 return KErrNone; |
|
1648 } |
|
1649 |
|
1650 //---------------------------------------------------------------------------- |
|
1651 // CMmSmsTsy::CompleteSetMoSmsBearer |
|
1652 // Complete clients SetMoSmsBearer request |
|
1653 // (other items were commented in a header). |
|
1654 // --------------------------------------------------------------------------- |
|
1655 // |
|
1656 void CMmSmsTsy::CompleteSetMoSmsBearer( |
|
1657 TInt aResult ) |
|
1658 { |
|
1659 // reset req handle. Returns the deleted req handle |
|
1660 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1661 EMultimodeSmsSetMoSmsBearer ); |
|
1662 |
|
1663 if ( reqHandle ) |
|
1664 { |
|
1665 ReqCompleted( reqHandle, aResult ); |
|
1666 } |
|
1667 } |
|
1668 |
|
1669 //---------------------------------------------------------------------------- |
|
1670 // CMmSmsTsy::SetMoSmsBearerCancel |
|
1671 // This method is used to cancel an outstanding asynchronous |
|
1672 // SetMoSmsBearer request |
|
1673 // (other items were commented in a header). |
|
1674 // --------------------------------------------------------------------------- |
|
1675 // |
|
1676 TInt CMmSmsTsy::SetMoSmsBearerCancel( |
|
1677 const TTsyReqHandle aTsyReqHandle ) |
|
1678 { |
|
1679 iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeSmsSetMoSmsBearer ); |
|
1680 |
|
1681 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
1682 |
|
1683 return KErrNone; |
|
1684 } |
|
1685 |
|
1686 //---------------------------------------------------------------------------- |
|
1687 // CMmSmsTsy::NotifyMoSmsBearerChange |
|
1688 // This method is used to notify the client if there is a |
|
1689 // change to the setting for the bearer type used for sending SMS messages |
|
1690 // (other items were commented in a header). |
|
1691 // --------------------------------------------------------------------------- |
|
1692 // |
|
1693 TInt CMmSmsTsy::NotifyMoSmsBearerChange( |
|
1694 RMobileSmsMessaging::TMobileSmsBearer* /*aBearer*/ ) |
|
1695 { |
|
1696 return KErrNotSupported; |
|
1697 } |
|
1698 |
|
1699 //---------------------------------------------------------------------------- |
|
1700 // CMmSmsTsy::NotifyMoSmsBearerChangeCancel |
|
1701 // This method is used to cancel an outstanding asynchronous |
|
1702 // NotifyMoSmsBearerChange request |
|
1703 // (other items were commented in a header). |
|
1704 // --------------------------------------------------------------------------- |
|
1705 // |
|
1706 TInt CMmSmsTsy::NotifyMoSmsBearerChangeCancel( |
|
1707 const TTsyReqHandle aTsyReqHandle ) |
|
1708 { |
|
1709 iTsyReqHandleStore->ResetTsyReqHandle( |
|
1710 EMultimodeSmsNotifyMoSmsBearerChange ); |
|
1711 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
1712 iNotifySmsBearerPtr = NULL; |
|
1713 |
|
1714 return KErrNone; |
|
1715 } |
|
1716 |
|
1717 //---------------------------------------------------------------------------- |
|
1718 // CMmSmsTsy::SendMessageL |
|
1719 // Routes send message to network request to message handler |
|
1720 // (other items were commented in a header). |
|
1721 // --------------------------------------------------------------------------- |
|
1722 // |
|
1723 TInt CMmSmsTsy::SendMessageL( |
|
1724 const TTsyReqHandle aTsyReqHandle, |
|
1725 TDes8* aMsgData, |
|
1726 TDes8* aMsgAttributes ) |
|
1727 { |
|
1728 TInt ret( KErrNone ); |
|
1729 |
|
1730 TTsyReqHandle getSendMessageHandle = |
|
1731 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsSendMessage ); |
|
1732 TTsyReqHandle getSendSatMessageHandle = |
|
1733 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsSendSatMessage ); |
|
1734 |
|
1735 TTsyReqHandle getSendMessageNoFdnHandle = |
|
1736 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsSendMessageNoFdnCheck ); |
|
1737 if ( ( EMultimodeSmsReqHandleUnknown < getSendMessageHandle ) |
|
1738 || ( EMultimodeSmsReqHandleUnknown < getSendSatMessageHandle ) |
|
1739 || ( EMultimodeSmsReqHandleUnknown < getSendMessageNoFdnHandle ) ) |
|
1740 { |
|
1741 // Send request is already ongoing |
|
1742 // (through ETel messaging or through SAT) |
|
1743 ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
1744 } |
|
1745 else if(sizeof(RMobileSmsMessaging::TMobileSmsReceiveAttributesV1) > aMsgAttributes->Size()) |
|
1746 { |
|
1747 ReqCompleted( aTsyReqHandle, KErrArgument ); |
|
1748 } |
|
1749 else |
|
1750 { |
|
1751 iSendMessageMsgAttrPckgPtr = aMsgAttributes; |
|
1752 |
|
1753 // Create package |
|
1754 CMmDataPackage package; |
|
1755 |
|
1756 // typecast for aMsgAttributes |
|
1757 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg* attsPckg = |
|
1758 reinterpret_cast< |
|
1759 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg* >( |
|
1760 aMsgAttributes ); |
|
1761 RMobileSmsMessaging::TMobileSmsSendAttributesV1& msgAttr = |
|
1762 ( *attsPckg )(); |
|
1763 |
|
1764 // structure for all sms parameters and data |
|
1765 TSendSmsDataAndAttributes sendData; |
|
1766 |
|
1767 sendData.iAttributes = &msgAttr; |
|
1768 sendData.iMsgData = aMsgData; |
|
1769 |
|
1770 if ( iSmsNoFdnCheckFlag == ESmsNoFdnCheckUsed ) |
|
1771 { |
|
1772 //set ipc |
|
1773 sendData.iIpc = EMobileSmsMessagingSendMessageNoFdnCheck; |
|
1774 } |
|
1775 if ( iSmsNoFdnCheckFlag == ESmsNoFdnCheckNotUsed ) |
|
1776 { |
|
1777 //set ipc |
|
1778 sendData.iIpc = EMobileSmsMessagingSendMessage; |
|
1779 } |
|
1780 |
|
1781 // Pack parameters |
|
1782 package.PackData( &sendData ); |
|
1783 |
|
1784 CSmsSendRequest* smsSendReq = new (ELeave) CSmsSendRequest(); |
|
1785 smsSendReq->SetSmsDataAndAttributes( sendData ); |
|
1786 |
|
1787 // save send request |
|
1788 iSmsSendReq = smsSendReq; |
|
1789 TFLOGSTRING("TSY: CMmSmsTsy::SendMessageL: Send request saved"); |
|
1790 |
|
1791 // send request to DOS |
|
1792 // packed parameter: TSendSmsDataAndAttributes |
|
1793 if ( iSmsNoFdnCheckFlag == ESmsNoFdnCheckUsed ) |
|
1794 { |
|
1795 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1796 EMobileSmsMessagingSendMessageNoFdnCheck, &package ); |
|
1797 } |
|
1798 if ( iSmsNoFdnCheckFlag == ESmsNoFdnCheckNotUsed ) |
|
1799 { |
|
1800 ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1801 EMobileSmsMessagingSendMessage, &package ); |
|
1802 } |
|
1803 |
|
1804 if ( KErrNone == ret ) |
|
1805 { |
|
1806 if ( iSmsNoFdnCheckFlag == ESmsNoFdnCheckUsed ) |
|
1807 { |
|
1808 //set request type |
|
1809 iReqHandleType = EMultimodeSmsSendMessageNoFdnCheck; |
|
1810 } |
|
1811 if ( iSmsNoFdnCheckFlag == ESmsNoFdnCheckNotUsed ) |
|
1812 { |
|
1813 //set request type |
|
1814 iReqHandleType = EMultimodeSmsSendMessage; |
|
1815 } |
|
1816 smsSendReq->IncreaseSendCounter(); |
|
1817 } |
|
1818 else |
|
1819 { |
|
1820 // Phonet returned error |
|
1821 delete smsSendReq; // Delete object |
|
1822 iSmsSendReq = NULL; // Reset pointer |
|
1823 // Message construction failed or phonet sender returned error |
|
1824 ReqCompleted( aTsyReqHandle, ret ); |
|
1825 // reset pointer to client memory |
|
1826 iSendMessageMsgAttrPckgPtr = NULL; |
|
1827 |
|
1828 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUnknown; |
|
1829 } |
|
1830 } |
|
1831 |
|
1832 return KErrNone; |
|
1833 } |
|
1834 |
|
1835 //---------------------------------------------------------------------------- |
|
1836 // CMmSmsTsy::CompleteSendMessage |
|
1837 // Complete SendMessage request |
|
1838 // (other items were commented in a header). |
|
1839 // --------------------------------------------------------------------------- |
|
1840 // |
|
1841 void CMmSmsTsy::CompleteSendMessage( |
|
1842 TInt aError, |
|
1843 CMmDataPackage* aDataPackage ) |
|
1844 { |
|
1845 if ( ( KErrNone != aError ) && ( KErrTimedOut != aError ) |
|
1846 && ( KErrGsmSMSOperationNotAllowed != |
|
1847 CMmCommonStaticUtility::ExtendedErrorCode ( aError ) ) |
|
1848 // FDB check failed |
|
1849 && ( KErrGsmSMSUnspecifiedProtocolError != |
|
1850 CMmCommonStaticUtility::ExtendedErrorCode ( aError ) ) |
|
1851 && ( KErrSatControl != |
|
1852 CMmCommonStaticUtility::ExtendedErrorCode ( aError ) ) |
|
1853 && ( !( iMmPhone->GetSatMessaging() && |
|
1854 iMmPhone->GetSatMessaging()->IsMoSmControlBySimActivated() ) ) |
|
1855 && ( NULL != iSmsSendReq ) && ( 2 >= |
|
1856 iSmsSendReq->GetSendCounter() ) ) |
|
1857 { |
|
1858 // DOS returned error to send request. Message might be tried to be |
|
1859 // resent (see method ResendSms). |
|
1860 // Timeout mechanism cannot access this part of code, ever. |
|
1861 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteSendMessage. Resend counter: %d", iSmsSendReq->GetSendCounter()); |
|
1862 } |
|
1863 else |
|
1864 { |
|
1865 // This is executed |
|
1866 // - if sending was successful |
|
1867 // - if there are no more resending attempts |
|
1868 // - if timer expires (called from the Complete of CMmSmsTsy class) |
|
1869 |
|
1870 // Delete send message entry from send array |
|
1871 if ( iSmsSendReq ) |
|
1872 { |
|
1873 delete iSmsSendReq; // Delete object |
|
1874 iSmsSendReq = NULL; // Reset pointer |
|
1875 } |
|
1876 |
|
1877 // reset req handle and complete request |
|
1878 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1879 EMultimodeSmsSendMessage ); |
|
1880 |
|
1881 if ( EMultimodeSmsReqHandleUnknown < reqHandle ) |
|
1882 { |
|
1883 // get values only if there was no error, and if return pointer to |
|
1884 // client is available |
|
1885 if ( KErrNone == aError && iSendMessageMsgAttrPckgPtr ) |
|
1886 { |
|
1887 TInt16 msgRef( 0 ); |
|
1888 TBuf8<RMobileSmsMessaging::KGsmTpduSize> smsMsg; |
|
1889 |
|
1890 aDataPackage->UnPackData( msgRef, smsMsg ); |
|
1891 |
|
1892 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg* attsPckg = |
|
1893 reinterpret_cast< |
|
1894 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg* >( |
|
1895 iSendMessageMsgAttrPckgPtr ); |
|
1896 RMobileSmsMessaging::TMobileSmsSendAttributesV1& msgAttr = |
|
1897 ( *attsPckg )(); |
|
1898 |
|
1899 msgAttr.iFlags = RMobileSmsMessaging::KMessageReference; |
|
1900 msgAttr.iMsgRef = static_cast< TUint16 >( msgRef ); |
|
1901 |
|
1902 if ( NULL != smsMsg.Length() ) |
|
1903 { |
|
1904 msgAttr.iSubmitReport.Copy(smsMsg); |
|
1905 msgAttr.iFlags |= RMobileSmsMessaging::KGsmSubmitReport; |
|
1906 } |
|
1907 } |
|
1908 |
|
1909 ReqCompleted( reqHandle, aError ); |
|
1910 // reset pointer to client memory |
|
1911 iSendMessageMsgAttrPckgPtr = NULL; |
|
1912 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUnknown; |
|
1913 } |
|
1914 } |
|
1915 |
|
1916 // Resend unsent message |
|
1917 ResendSms(); |
|
1918 } |
|
1919 |
|
1920 //---------------------------------------------------------------------------- |
|
1921 // CMmSmsTsy::SendSatMessage |
|
1922 // SimAtkTsy can send SMS messages to the network by calling this method |
|
1923 // (other items were commented in a header). |
|
1924 // --------------------------------------------------------------------------- |
|
1925 // |
|
1926 TInt CMmSmsTsy::SendSatMessage( |
|
1927 MStkTsySatService& aStkTsySatService, |
|
1928 TDes8* aSmsTpdu, |
|
1929 TDes16* aScAddress, |
|
1930 RMobilePhone::TMobileTON* aMobileTON, |
|
1931 RMobilePhone::TMobileNPI* aMobileNPI, |
|
1932 TBool aMoreToSend, |
|
1933 TTsyReqHandle aTsyReqHandle ) |
|
1934 { |
|
1935 iTsySatMessaging = &aStkTsySatService; |
|
1936 |
|
1937 TTsyReqHandle getSendMessageHandle = |
|
1938 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsSendMessage ); |
|
1939 TTsyReqHandle getSendSatMessageHandle = |
|
1940 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsSendSatMessage ); |
|
1941 |
|
1942 if ( ( EMultimodeSmsReqHandleUnknown < getSendMessageHandle ) |
|
1943 || ( EMultimodeSmsReqHandleUnknown < getSendSatMessageHandle ) ) |
|
1944 { |
|
1945 // Send request is already ongoing |
|
1946 // (through ETel messaging or through SAT) |
|
1947 iTsySatMessaging->CompleteSendSmsMessage( KErrServerBusy ); |
|
1948 } |
|
1949 else |
|
1950 { |
|
1951 |
|
1952 TRAPD( leaveCode, DoSendSatMessageL( aSmsTpdu, aScAddress, aMobileTON, |
|
1953 aMobileNPI, aMoreToSend, aTsyReqHandle ); ); |
|
1954 |
|
1955 if ( KErrNone != leaveCode ) |
|
1956 { |
|
1957 // Call to DOS failed |
|
1958 CompleteSendSatMessage( leaveCode ); |
|
1959 } |
|
1960 } |
|
1961 |
|
1962 return KErrNone; |
|
1963 } |
|
1964 |
|
1965 //---------------------------------------------------------------------------- |
|
1966 // CMmSmsTsy::DoSendSatMessageL |
|
1967 // SimAtkTsy can send SMS messages to the network by calling this method. |
|
1968 // This method TRAPs failures. |
|
1969 // (other items were commented in a header). |
|
1970 // --------------------------------------------------------------------------- |
|
1971 // |
|
1972 void CMmSmsTsy::DoSendSatMessageL( |
|
1973 TDes8* aSmsTpdu, |
|
1974 TDes16* aScAddress, |
|
1975 RMobilePhone::TMobileTON* aMobileTON, |
|
1976 RMobilePhone::TMobileNPI* aMobileNPI, |
|
1977 TBool aMoreToSend, |
|
1978 TTsyReqHandle aTsyReqHandle ) |
|
1979 { |
|
1980 // Leave if SendSatMessageL returns an error |
|
1981 User::LeaveIfError( SendSatMessageL( iMmPhone, aSmsTpdu, |
|
1982 aScAddress, aMobileTON, aMobileNPI, aMoreToSend ) ); |
|
1983 |
|
1984 #ifdef REQHANDLE_TIMER |
|
1985 SetTypeOfResponse( EMultimodeSmsSendSatMessage, aTsyReqHandle ); |
|
1986 #endif // REQHANDLE_TIMER |
|
1987 } |
|
1988 |
|
1989 //---------------------------------------------------------------------------- |
|
1990 // CMmSmsTsy::CompleteSendSatMessage |
|
1991 // Compelete SendSatMessage request to the MMSAT |
|
1992 // (other items were commented in a header). |
|
1993 // --------------------------------------------------------------------------- |
|
1994 // |
|
1995 void CMmSmsTsy::CompleteSendSatMessage( |
|
1996 TInt aError ) |
|
1997 { |
|
1998 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteSendSatMessage. Complete SAT SMS send Error: %d", aError); |
|
1999 iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeSmsSendSatMessage ); |
|
2000 |
|
2001 if ( iTsySatMessaging ) |
|
2002 { |
|
2003 iTsySatMessaging->CompleteSendSmsMessage( aError ); |
|
2004 } |
|
2005 |
|
2006 #ifdef USING_CTSY_DISPATCHER |
|
2007 |
|
2008 //the iTsySatMessaging is now Nulled on the complete |
|
2009 //open issue that if the iTsySatMessaging pointer (to the SIM ATK) is not nulled (i.e. the callback is |
|
2010 //not completed) and the CTSY is destructed after the SIM ATK then the CMmSmsTsy has a invalid pointer which |
|
2011 //is used in the CMmSmsTsy destructor |
|
2012 |
|
2013 iTsySatMessaging = NULL; |
|
2014 #endif //USING_CTSY_DISPATCHER |
|
2015 } |
|
2016 |
|
2017 //---------------------------------------------------------------------------- |
|
2018 // CMmSmsTsy::EnumerateMessageStores |
|
2019 // This methods returns the number of phone-side SMS message |
|
2020 // stores supported by the phone |
|
2021 // (other items were commented in a header). |
|
2022 // --------------------------------------------------------------------------- |
|
2023 // |
|
2024 TInt CMmSmsTsy::EnumerateMessageStores( |
|
2025 const TTsyReqHandle aTsyReqHandle, |
|
2026 TInt* aCount ) |
|
2027 { |
|
2028 *aCount = KSmsStoreNumber; |
|
2029 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
2030 |
|
2031 return KErrNone; |
|
2032 } |
|
2033 |
|
2034 //---------------------------------------------------------------------------- |
|
2035 // CMmSmsTsy::GetMessageStoreInfo |
|
2036 // This method gets used SMS entries and total number of SMS entries on SIM |
|
2037 // (other items were commented in a header). |
|
2038 // --------------------------------------------------------------------------- |
|
2039 // |
|
2040 TInt CMmSmsTsy::GetMessageStoreInfoL( |
|
2041 const TTsyReqHandle aTsyReqHandle, |
|
2042 TInt const* aIndex, |
|
2043 TDes8* aInfo ) |
|
2044 { |
|
2045 TTsyReqHandle getStoreInfoHandle = |
|
2046 iTsyReqHandleStore->GetTsyReqHandle( |
|
2047 EMultimodeSmsGetMessageStoreInfo ); |
|
2048 |
|
2049 if ( EMultimodeSmsReqHandleUnknown < getStoreInfoHandle ) |
|
2050 { |
|
2051 // The request is already in processing because of previous request. |
|
2052 // Complete request with status value informing the client about |
|
2053 // the situation. |
|
2054 ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
2055 } |
|
2056 else if ( (*aIndex >= KSmsStoreNumber) || (*aIndex < 0) ) |
|
2057 { |
|
2058 // First store number is "0" and SIM is only supported store |
|
2059 ReqCompleted( aTsyReqHandle, KErrArgument ); |
|
2060 } |
|
2061 else |
|
2062 { |
|
2063 iGetMessageStoreInfoPtr = aInfo; |
|
2064 // allow for EMobileSmsMessagingGetMessageStoreInfo immediate |
|
2065 // completion |
|
2066 #ifdef REQHANDLE_TIMER |
|
2067 SetTypeOfResponse( EMultimodeSmsGetMessageStoreInfo, aTsyReqHandle ); |
|
2068 #else |
|
2069 // Never comes here. See SetTypeOfResponse. |
|
2070 iTsyReqHandleStore->SetTsyReqHandle( EMultimodeSmsGetMessageStoreInfo, |
|
2071 aTsyReqHandle ); |
|
2072 #endif // REQHANDLE_TIMER |
|
2073 |
|
2074 //Send request to the Domestic OS layer. |
|
2075 TInt ret = iMmPhone->MessageManager()->HandleRequestL( |
|
2076 EMobileSmsMessagingGetMessageStoreInfo ); |
|
2077 |
|
2078 // DOS layer returned with error without completing request |
|
2079 if ( KErrNone != ret && iTsyReqHandleStore->ResetTsyReqHandle( |
|
2080 EMultimodeSmsGetMessageStoreInfo) ) |
|
2081 { |
|
2082 ReqCompleted( aTsyReqHandle, ret ); |
|
2083 } |
|
2084 } |
|
2085 |
|
2086 return KErrNone; |
|
2087 } |
|
2088 |
|
2089 //---------------------------------------------------------------------------- |
|
2090 // CMmSmsTsy::GetMessageStoreInfoCancel |
|
2091 // Cancel pending GetMessagestoreInfo request |
|
2092 // (other items were commented in a header). |
|
2093 // --------------------------------------------------------------------------- |
|
2094 // |
|
2095 TInt CMmSmsTsy::GetMessageStoreInfoCancel( |
|
2096 const TTsyReqHandle aTsyReqHandle ) |
|
2097 { |
|
2098 iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeSmsGetMessageStoreInfo ); |
|
2099 |
|
2100 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
2101 |
|
2102 return KErrNone; |
|
2103 } |
|
2104 |
|
2105 //---------------------------------------------------------------------------- |
|
2106 // CMmSmsTsy::CompleteGetMessageStoreInfo |
|
2107 // Complete GetMessageStoreInfo request to client |
|
2108 // (other items were commented in a header). |
|
2109 // --------------------------------------------------------------------------- |
|
2110 // |
|
2111 void CMmSmsTsy::CompleteGetMessageStoreInfo( |
|
2112 TInt aError, |
|
2113 CMmDataPackage* aDataPackage ) |
|
2114 { |
|
2115 TUint8 totalEntries( 0 ); |
|
2116 TInt usedEntries( 0 ); |
|
2117 |
|
2118 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
2119 EMultimodeSmsGetMessageStoreInfo ); |
|
2120 |
|
2121 if ( reqHandle ) |
|
2122 { |
|
2123 // Request was successful |
|
2124 if ( ( KErrNone == aError ) || ( KErrNotFound == aError ) ) |
|
2125 { |
|
2126 aDataPackage->UnPackData( totalEntries, usedEntries ); |
|
2127 |
|
2128 aError = iMmSmsExtInterface->MessageStoreInfo( |
|
2129 iGetMessageStoreInfoPtr, totalEntries, usedEntries ); |
|
2130 } |
|
2131 |
|
2132 iSmsNumOfLoc = totalEntries; |
|
2133 |
|
2134 ReqCompleted( reqHandle, aError ); |
|
2135 } |
|
2136 } |
|
2137 |
|
2138 //---------------------------------------------------------------------------- |
|
2139 // CMmSmsTsy::ReadSmspListPhase1L |
|
2140 // This method starts first phase of SMS Parameter sets |
|
2141 // retrieval On the first phase method store locations |
|
2142 // temporarely to the TSY. On the second phase method copies the |
|
2143 // list to the client |
|
2144 // (other items were commented in a header). |
|
2145 // --------------------------------------------------------------------------- |
|
2146 // |
|
2147 TInt CMmSmsTsy::ReadSmspListPhase1L( |
|
2148 const TTsyReqHandle aTsyReqHandle, |
|
2149 RMobilePhone::TClientId const* aId, |
|
2150 TInt* aBufSize ) |
|
2151 { |
|
2152 TFLOGSTRING("TSY: CMmSmsTsy::ReadSmspListPhase1L"); |
|
2153 |
|
2154 TTsyReqHandle readSmspHandle = iTsyReqHandleStore->GetTsyReqHandle( |
|
2155 EMultimodeSmsReadSmspListPhase1 ); |
|
2156 |
|
2157 if ( 0 < readSmspHandle ) |
|
2158 { |
|
2159 // The request is already processing because of previous request |
|
2160 // Complete request with status value informing the client about |
|
2161 // the situation. |
|
2162 ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
2163 } |
|
2164 else |
|
2165 { |
|
2166 // Lets check how many SMSP sets are there. |
|
2167 TInt ret = iMmPhone->MessageManager()->HandleRequestL( |
|
2168 EMobileSmsMessagingGetSmspListPhase1 ); |
|
2169 |
|
2170 if ( KErrNone == ret ) |
|
2171 { |
|
2172 iReqHandleType = EMultimodeSmsReadSmspListPhase1; |
|
2173 |
|
2174 iRetSMSPSize = aBufSize; |
|
2175 |
|
2176 // Copy client id (session and subsession handle). it's used for |
|
2177 // matching phase 1 and 2 of a request |
|
2178 |
|
2179 if ( iSMSPClientId ) |
|
2180 { |
|
2181 delete iSMSPClientId; |
|
2182 iSMSPClientId = NULL; |
|
2183 } |
|
2184 |
|
2185 iSMSPClientId = new ( ELeave ) RMobilePhone::TClientId( *aId ); |
|
2186 } |
|
2187 else |
|
2188 { |
|
2189 // Call to DOS failed |
|
2190 ReqCompleted( aTsyReqHandle, ret ); |
|
2191 } |
|
2192 } |
|
2193 |
|
2194 return KErrNone; |
|
2195 } |
|
2196 |
|
2197 //---------------------------------------------------------------------------- |
|
2198 // CMmSmsTsy::ReadSmspListPhase2 |
|
2199 // This method starts second phase of SMS Parameter sets retrieval. It is |
|
2200 // guaranteed that this is only called if phase 1 was completed with KErrNone. |
|
2201 // (other items were commented in a header). |
|
2202 // --------------------------------------------------------------------------- |
|
2203 // |
|
2204 TInt CMmSmsTsy::ReadSmspListPhase2( |
|
2205 TTsyReqHandle aTsyReqHandle, |
|
2206 RMobilePhone::TClientId const* aId, |
|
2207 TDes8* aBuffer ) |
|
2208 { |
|
2209 // Check if client id matches between phase 1 and phase 2 |
|
2210 if ( ( iSMSPClientId->iSessionHandle == aId->iSessionHandle ) && |
|
2211 ( iSMSPClientId->iSubSessionHandle == aId->iSubSessionHandle ) ) |
|
2212 { |
|
2213 // Copy the streamed list to the client |
|
2214 aBuffer->Copy( iSMSPList->Ptr( 0 ) ); |
|
2215 |
|
2216 iMmPhone->ReqCompleted( aTsyReqHandle, KErrNone ); |
|
2217 } |
|
2218 else |
|
2219 { |
|
2220 iMmPhone->ReqCompleted( aTsyReqHandle, KErrCorrupt ); |
|
2221 } |
|
2222 |
|
2223 // Reset the client Id |
|
2224 delete iSMSPClientId; |
|
2225 iSMSPClientId = NULL; |
|
2226 |
|
2227 // Reset the streamed list |
|
2228 delete iSMSPList; |
|
2229 iSMSPList = NULL; |
|
2230 |
|
2231 return KErrNone; |
|
2232 } |
|
2233 |
|
2234 //---------------------------------------------------------------------------- |
|
2235 // CMmSmsTsy::ReadAllSmspCancel |
|
2236 // This method cancels read all SMS Parameter sets request. |
|
2237 // This method can be called between phase1 and phase2 |
|
2238 // (other items were commented in a header). |
|
2239 // --------------------------------------------------------------------------- |
|
2240 // |
|
2241 TInt CMmSmsTsy::ReadAllSmspCancel( |
|
2242 const TTsyReqHandle aTsyReqHandle ) |
|
2243 { |
|
2244 iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeSmsReadSmspListPhase1 ); |
|
2245 |
|
2246 iRetSMSPSize = NULL; |
|
2247 |
|
2248 if ( iSMSPClientId ) |
|
2249 { |
|
2250 delete iSMSPClientId; |
|
2251 iSMSPClientId = NULL; |
|
2252 } |
|
2253 |
|
2254 if ( iSMSPList ) |
|
2255 { |
|
2256 delete iSMSPList; |
|
2257 iSMSPList = NULL; |
|
2258 } |
|
2259 |
|
2260 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
2261 |
|
2262 return KErrNone; |
|
2263 } |
|
2264 |
|
2265 //---------------------------------------------------------------------------- |
|
2266 // CMmSmsTsy::CreateSmspListL |
|
2267 // This method creates SMSP list from read entries. |
|
2268 // Method reads the list, and stores its content in iSMSPList. |
|
2269 // (other items were commented in a header). |
|
2270 // --------------------------------------------------------------------------- |
|
2271 // |
|
2272 void CMmSmsTsy::CreateSmspListL( |
|
2273 CArrayPtrFlat<TSmsParameters>& aSmspList ) |
|
2274 { |
|
2275 CMobilePhoneSmspList* list = CMobilePhoneSmspList::NewL(); |
|
2276 CleanupStack::PushL( list ); |
|
2277 |
|
2278 TUint8 amountOfSets = static_cast< TUint8 >( aSmspList.Count() ); |
|
2279 |
|
2280 RMobileSmsMessaging::TMobileSmspEntryV1 entry; |
|
2281 |
|
2282 // Runs until TSY's internal SMSP storage is empty |
|
2283 while ( 0 != aSmspList.Count() ) |
|
2284 { |
|
2285 TSmsParameters* smsParam = aSmspList.At( 0 ); |
|
2286 entry.iIndex = ( smsParam->iLocationNumber ); |
|
2287 |
|
2288 if ( smsParam->iAlphaTagPresent ) |
|
2289 { |
|
2290 entry.iText.Copy( smsParam->iAlphaTagData ); |
|
2291 } |
|
2292 else |
|
2293 { |
|
2294 entry.iText.SetLength( 0 ); |
|
2295 } |
|
2296 |
|
2297 entry.iValidParams = ( smsParam->iParameterIndicator ); |
|
2298 |
|
2299 TInt paramask = |
|
2300 KSmsGsmParametersIndMask & ( smsParam->iParameterIndicator ); |
|
2301 |
|
2302 if ( paramask & KDestinationAddress ) |
|
2303 { |
|
2304 entry.iDestination.iTypeOfNumber = ( smsParam->iMobileDeTON ); |
|
2305 entry.iDestination.iNumberPlan = ( smsParam->iMobileDeNPI ); |
|
2306 entry.iDestination.iTelNumber = ( smsParam->iDestinationAddress ); |
|
2307 } |
|
2308 |
|
2309 if ( paramask & KServiceCentreAddress ) |
|
2310 { |
|
2311 entry.iServiceCentre.iTypeOfNumber = ( smsParam->iMobileScTON ); |
|
2312 entry.iServiceCentre.iNumberPlan = ( smsParam->iMobileScNPI ); |
|
2313 entry.iServiceCentre.iTelNumber = |
|
2314 ( smsParam->iServiceCenterAddress ); |
|
2315 } |
|
2316 |
|
2317 if ( paramask & KProtocolID ) |
|
2318 { |
|
2319 entry.iProtocolId = ( smsParam->iProtocolId ); |
|
2320 } |
|
2321 |
|
2322 if ( paramask & KDataCodingScheme ) |
|
2323 { |
|
2324 entry.iDcs = ( smsParam->iDataCodingScheme ); |
|
2325 } |
|
2326 |
|
2327 if ( paramask & KValidityPeriod ) |
|
2328 { |
|
2329 entry.iValidityPeriod = ( smsParam->iValidityPeriod ); |
|
2330 } |
|
2331 |
|
2332 list->AddEntryL( entry ); |
|
2333 |
|
2334 // Delete handled SMSP set |
|
2335 delete smsParam; // Delete object |
|
2336 aSmspList.Delete( 0 ); // Delete pointer from array |
|
2337 aSmspList.Compress(); |
|
2338 } |
|
2339 |
|
2340 // Set maximum amount of SMSP sets to the list. |
|
2341 list->SetMaxNumberEntries( amountOfSets ); |
|
2342 |
|
2343 iSMSPList = list->StoreLC(); // creates new CBufFlat buffer and |
|
2344 // pushes it on cleanup stack |
|
2345 CleanupStack::Pop(); // pop the iSMSPList |
|
2346 |
|
2347 CleanupStack::PopAndDestroy(); // pop&destroy CMobilePhoneSmspList* list |
|
2348 } |
|
2349 |
|
2350 //---------------------------------------------------------------------------- |
|
2351 // CMmSmsTsy::CompleteReadAllSmspPhase1 |
|
2352 // Complete first phase of read all SMSP sets request, i.e. returns |
|
2353 // size of iSMSPList buffer to client. |
|
2354 // Parameter aDataPackage contains SMSP list in CArrayPtrFlat<TSmsParameters>. |
|
2355 // (other items were commented in a header). |
|
2356 // --------------------------------------------------------------------------- |
|
2357 // |
|
2358 void CMmSmsTsy::CompleteReadAllSmspPhase1( |
|
2359 TInt aError, |
|
2360 CMmDataPackage* aDataPackage ) |
|
2361 { |
|
2362 CArrayPtrFlat<TSmsParameters>* smsParams; |
|
2363 |
|
2364 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
2365 EMultimodeSmsReadSmspListPhase1 ); |
|
2366 |
|
2367 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteReadAllSmspPhase1 Complete read first phase error: %d",aError); |
|
2368 if ( KErrNone == aError ) |
|
2369 { |
|
2370 aDataPackage->UnPackData( &smsParams ); |
|
2371 if ( reqHandle ) |
|
2372 { |
|
2373 // Create the Smsp list |
|
2374 TInt trapError; |
|
2375 if( NULL == smsParams) |
|
2376 { |
|
2377 trapError = KErrGeneral; |
|
2378 } |
|
2379 else |
|
2380 { |
|
2381 TRAP( trapError, CreateSmspListL( *smsParams ); ); |
|
2382 } |
|
2383 |
|
2384 if ( KErrNone == trapError ) |
|
2385 { |
|
2386 *iRetSMSPSize = iSMSPList->Size(); |
|
2387 TFLOGSTRING("TSY: CMmSmsTsy::CompleteReadAllSmspPhase1: Phase 1 OK."); |
|
2388 // Complete first phase of read all SMSP sets |
|
2389 ReqCompleted( reqHandle, KErrNone ); |
|
2390 } |
|
2391 else |
|
2392 { |
|
2393 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteReadAllSmspPhase1: Could not create SMSP list, trapError=%d",trapError); |
|
2394 // Complete with error |
|
2395 ReqCompleted( reqHandle, trapError ); |
|
2396 } |
|
2397 } |
|
2398 } |
|
2399 else |
|
2400 { |
|
2401 if ( reqHandle ) |
|
2402 { |
|
2403 // Complete first phase of read all SMSP sets. |
|
2404 ReqCompleted( reqHandle, aError ); |
|
2405 } |
|
2406 } |
|
2407 iRetSMSPSize = NULL; |
|
2408 } |
|
2409 |
|
2410 //---------------------------------------------------------------------------- |
|
2411 // CMmSmsTsy::StoreSmspList |
|
2412 // This method start storing of new version of the entire list |
|
2413 // of SMSP entries prosess |
|
2414 // (other items were commented in a header). |
|
2415 // --------------------------------------------------------------------------- |
|
2416 // |
|
2417 TInt CMmSmsTsy::StoreSmspList( |
|
2418 const TTsyReqHandle aTsyReqHandle, |
|
2419 TDes8* aBuffer ) |
|
2420 { |
|
2421 TTsyReqHandle storeSmspListHandle = |
|
2422 iTsyReqHandleStore->GetTsyReqHandle( EMultimodeSmsStoreSmspList ); |
|
2423 |
|
2424 if ( 0 < storeSmspListHandle ) |
|
2425 { |
|
2426 // The request is already processing because of previous request. |
|
2427 // Complete request with status value informing the client about |
|
2428 // the situation. |
|
2429 ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
2430 } |
|
2431 else |
|
2432 { |
|
2433 iStoreSmspBufferPtr = aBuffer; |
|
2434 iStoreSmspIndex = 0; |
|
2435 |
|
2436 // We must store request handle here and not in ExtFunc-method. |
|
2437 // If SMSP list is empty we must complete store SMSP list request in |
|
2438 // ProcessStoreSmspListL-method and then we need request handle. |
|
2439 #ifdef REQHANDLE_TIMER |
|
2440 SetTypeOfResponse( EMultimodeSmsStoreSmspList, aTsyReqHandle ); |
|
2441 #else |
|
2442 iTsyReqHandleStore->SetTsyReqHandle( EMultimodeSmsStoreSmspList, |
|
2443 aTsyReqHandle ); |
|
2444 #endif // REQHANDLE_TIMER |
|
2445 CallProcessStoreSmspList(); |
|
2446 } |
|
2447 |
|
2448 return KErrNone; |
|
2449 } |
|
2450 |
|
2451 //---------------------------------------------------------------------------- |
|
2452 // CMmSmsTsy::InternalStoreSmspList |
|
2453 // This method check if there was error while updating last SMSP |
|
2454 //set. If there was no error it calls CompleteStoreSmspListL- method |
|
2455 // (other items were commented in a header). |
|
2456 // --------------------------------------------------------------------------- |
|
2457 // |
|
2458 void CMmSmsTsy::InternalStoreSmspList( |
|
2459 TInt aError ) |
|
2460 { |
|
2461 TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( |
|
2462 EMultimodeSmsStoreSmspList ); |
|
2463 |
|
2464 if ( reqHandle ) |
|
2465 { |
|
2466 if ( KErrNone == aError ) |
|
2467 { |
|
2468 // Lets continue storing prosess |
|
2469 CallProcessStoreSmspList(); |
|
2470 } |
|
2471 else |
|
2472 { |
|
2473 CompleteStoreSmspList( aError ); |
|
2474 } |
|
2475 } |
|
2476 } |
|
2477 |
|
2478 //---------------------------------------------------------------------------- |
|
2479 // CMmSmsTsy::CallProcessStoreSmspList |
|
2480 // This method calls ProcessStoreSmspListL-method |
|
2481 // (other items were commented in a header). |
|
2482 // --------------------------------------------------------------------------- |
|
2483 // |
|
2484 void CMmSmsTsy::CallProcessStoreSmspList() |
|
2485 { |
|
2486 TRAPD ( ret, ProcessStoreSmspListL(); ); |
|
2487 if ( ret != KErrNone ) |
|
2488 { |
|
2489 CompleteStoreSmspList( ret ); |
|
2490 } |
|
2491 } |
|
2492 |
|
2493 //---------------------------------------------------------------------------- |
|
2494 // CMmSmsTsy::ProcessStoreSmspListL |
|
2495 // This method gets one SMSP sets from clients list and calls |
|
2496 // DOS OR completes client's request |
|
2497 // (other items were commented in a header). |
|
2498 // --------------------------------------------------------------------------- |
|
2499 // |
|
2500 void CMmSmsTsy::ProcessStoreSmspListL() |
|
2501 { |
|
2502 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
|
2503 CleanupStack::PushL( smspList ); |
|
2504 |
|
2505 smspList->RestoreL( *iStoreSmspBufferPtr ); |
|
2506 |
|
2507 if ( smspList->Enumerate() > iStoreSmspIndex ) |
|
2508 { |
|
2509 RMobileSmsMessaging::TMobileSmspEntryV1 smsParam; |
|
2510 CMmDataPackage package; |
|
2511 |
|
2512 // Clients SMSP lists first location is 0 |
|
2513 smsParam = smspList->GetEntryL( iStoreSmspIndex ); |
|
2514 |
|
2515 iStoreSmspIndex++; |
|
2516 |
|
2517 // Pack parameters |
|
2518 package.PackData( &smsParam ); |
|
2519 |
|
2520 // Lets make new routing request so new CBMI list can be delivered to |
|
2521 // DOS |
|
2522 TInt ret = iMmPhone->MessageManager()->HandleRequestL( |
|
2523 EMobileSmsMessagingStoreSmspList, &package ); |
|
2524 |
|
2525 if ( KErrNone != ret ) |
|
2526 { |
|
2527 // Message construction failed or phonet sender |
|
2528 // returned error. Complete request in CallProsessStoreSmspList |
|
2529 // method |
|
2530 CompleteStoreSmspList( ret ); |
|
2531 } |
|
2532 } |
|
2533 |
|
2534 // All SMSP sets have successfully been stored |
|
2535 else |
|
2536 { |
|
2537 // Notify that SMSP set was updated in the store |
|
2538 CompleteNotifySmspListChange(); |
|
2539 |
|
2540 // Complete store SMSP list request to the client |
|
2541 CompleteStoreSmspList( KErrNone ); |
|
2542 } |
|
2543 |
|
2544 CleanupStack::PopAndDestroy(); // aSmspList |
|
2545 } |
|
2546 |
|
2547 //---------------------------------------------------------------------------- |
|
2548 // CMmSmsTsy::CompleteStoreSmspList |
|
2549 // Complete store SMSP list request |
|
2550 // (other items were commented in a header). |
|
2551 // --------------------------------------------------------------------------- |
|
2552 // |
|
2553 void CMmSmsTsy::CompleteStoreSmspList( |
|
2554 TInt aError ) |
|
2555 { |
|
2556 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
2557 EMultimodeSmsStoreSmspList ); |
|
2558 if ( reqHandle ) |
|
2559 { |
|
2560 ReqCompleted( reqHandle, aError ); |
|
2561 } |
|
2562 } |
|
2563 |
|
2564 //---------------------------------------------------------------------------- |
|
2565 // CMmSmsTsy::NotifySmspListChange |
|
2566 // This method activates notifying of SMS Parameter store events |
|
2567 // (other items were commented in a header). |
|
2568 // --------------------------------------------------------------------------- |
|
2569 // |
|
2570 TInt CMmSmsTsy::NotifySmspListChange() |
|
2571 { |
|
2572 iReqHandleType = EMultimodeSmsNotifySmspListChange; |
|
2573 |
|
2574 return KErrNone; |
|
2575 } |
|
2576 |
|
2577 //---------------------------------------------------------------------------- |
|
2578 // CMmSmsTsy::NotifySmspListChangeCancel |
|
2579 // This method cancels NotifyStoreEventCancel request |
|
2580 // (other items were commented in a header). |
|
2581 // --------------------------------------------------------------------------- |
|
2582 // |
|
2583 TInt CMmSmsTsy::NotifySmspListChangeCancel( |
|
2584 const TTsyReqHandle aTsyReqHandle ) |
|
2585 { |
|
2586 iTsyReqHandleStore->ResetTsyReqHandle( |
|
2587 EMultimodeSmsNotifySmspListChange ); |
|
2588 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
2589 |
|
2590 return KErrNone; |
|
2591 } |
|
2592 |
|
2593 //---------------------------------------------------------------------------- |
|
2594 // CMmSmsTsy::CompleteNotifySmspListChange |
|
2595 // This method is called when some of SMS parameter store events happen |
|
2596 // (other items were commented in a header). |
|
2597 // --------------------------------------------------------------------------- |
|
2598 // |
|
2599 void CMmSmsTsy::CompleteNotifySmspListChange() |
|
2600 { |
|
2601 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
2602 EMultimodeSmsNotifySmspListChange ); |
|
2603 if ( reqHandle ) |
|
2604 { |
|
2605 ReqCompleted( reqHandle, KErrNone ); |
|
2606 } |
|
2607 } |
|
2608 |
|
2609 //---------------------------------------------------------------------------- |
|
2610 // CMmSmsTsy::GetSmsNumOfLoc |
|
2611 // Get SMS number of Location on SIM card |
|
2612 // (other items were commented in a header). |
|
2613 // --------------------------------------------------------------------------- |
|
2614 // |
|
2615 TInt16 CMmSmsTsy::GetSmsNumOfLoc() |
|
2616 { |
|
2617 return static_cast< TInt16 >( iSmsNumOfLoc ); |
|
2618 } |
|
2619 |
|
2620 //---------------------------------------------------------------------------- |
|
2621 // CMmSmsTsy::SetSmsNumOfLoc |
|
2622 // Set SMS number of Location on SIM card to member variable |
|
2623 // (other items were commented in a header). |
|
2624 // --------------------------------------------------------------------------- |
|
2625 // |
|
2626 void CMmSmsTsy::SetSmsNumOfLoc( |
|
2627 TInt aSmsNumOfLoc ) |
|
2628 { |
|
2629 iSmsNumOfLoc = static_cast< TUint8 >( aSmsNumOfLoc ); |
|
2630 } |
|
2631 |
|
2632 //---------------------------------------------------------------------------- |
|
2633 // CMmSmsTsy::GetSmsStorageTsy |
|
2634 // Returns a pointer to the SMS Storage sub-session |
|
2635 // (other items were commented in a header). |
|
2636 // --------------------------------------------------------------------------- |
|
2637 // |
|
2638 CMmSmsStorageTsy* CMmSmsTsy::GetSmsStorageTsy() |
|
2639 { |
|
2640 return iMmSmsStorageTsy; |
|
2641 } |
|
2642 |
|
2643 //---------------------------------------------------------------------------- |
|
2644 // CMmSmsTsy::SetSmsStorageTsy |
|
2645 // Sets a new pointer to the SMS Storage sub-session |
|
2646 // (other items were commented in a header). |
|
2647 // --------------------------------------------------------------------------- |
|
2648 // |
|
2649 void CMmSmsTsy::SetSmsStorageTsy( |
|
2650 CMmSmsStorageTsy* aNewPointer ) |
|
2651 { |
|
2652 iMmSmsStorageTsy = aNewPointer; |
|
2653 } |
|
2654 |
|
2655 //---------------------------------------------------------------------------- |
|
2656 // CMmSmsTsy::ResetVariables |
|
2657 // Reset used variables |
|
2658 // (other items were commented in a header). |
|
2659 // --------------------------------------------------------------------------- |
|
2660 // |
|
2661 void CMmSmsTsy::ResetVariables() |
|
2662 { |
|
2663 // Resets routing activity variable. If routing is active in DOS |
|
2664 // this parameter is true. |
|
2665 iServerRoutingActivity = ERoutingNotActivated; |
|
2666 |
|
2667 // Resets mobile sms receive mode to EReceiveUnstoredClientAck. Mobile |
|
2668 // sms receive mode includes the receive mode type. |
|
2669 iMobileSmsReceiveMode = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
2670 |
|
2671 // Resets receive mode change notify variables. |
|
2672 iNotifyReceiveModeChangePtr = NULL; |
|
2673 |
|
2674 // Resets receive message variables. |
|
2675 iReceiveMessagePduPtr = NULL; |
|
2676 iReceiveMessageParamsPtr = NULL; |
|
2677 |
|
2678 // Resets sms bearer notify variables. |
|
2679 iNotifySmsBearerPtr = NULL; |
|
2680 |
|
2681 // Resets send message variables. |
|
2682 iSendMessageMsgAttrPckgPtr = NULL; |
|
2683 |
|
2684 // Resets get message store variables. |
|
2685 iGetMessageStoreInfoPtr = NULL; |
|
2686 |
|
2687 // Resets smsp (sms parameters) variables. |
|
2688 iRetSMSPSize = NULL; |
|
2689 iSMSPClientId = NULL; |
|
2690 iSMSPList = NULL; |
|
2691 |
|
2692 // Resets sms storage parameter variables. |
|
2693 iStoreSmspBufferPtr = NULL; |
|
2694 iStoreSmspIndex = NULL; |
|
2695 |
|
2696 // Resets sms storage tsy variable. |
|
2697 iMmSmsStorageTsy = NULL; |
|
2698 |
|
2699 // Resets SMS stack storage status variables |
|
2700 iClientStorageFull = EFalse; |
|
2701 |
|
2702 |
|
2703 //Set number of SMS locations on SIM card to 0 |
|
2704 iSmsNumOfLoc = 0; |
|
2705 } |
|
2706 |
|
2707 #ifdef REQHANDLE_TIMER |
|
2708 //---------------------------------------------------------------------------- |
|
2709 // CMmSmsTsy::SetTypeOfResponse |
|
2710 // Sets the type of response for a given Handle. Automatic |
|
2711 // mode includes an automatic response in case of non response |
|
2712 // from the DOS in a specified time |
|
2713 // (other items were commented in a header). |
|
2714 // --------------------------------------------------------------------------- |
|
2715 // |
|
2716 void CMmSmsTsy::SetTypeOfResponse( |
|
2717 const TInt aReqHandleType, |
|
2718 const TTsyReqHandle aTsyReqHandle ) |
|
2719 { |
|
2720 TInt timeOut( 0 ); |
|
2721 |
|
2722 switch ( aReqHandleType ) |
|
2723 { |
|
2724 // SMS specific requests |
|
2725 case EMultimodeSmsSetReceiveMode: |
|
2726 timeOut = KMmSmsSetReceiveMode; |
|
2727 break; |
|
2728 case EMultimodeSmsAckStored: |
|
2729 case EMultimodeSmsNackStored: |
|
2730 timeOut = KMmSmsAckNackMessage; |
|
2731 break; |
|
2732 case EMultimodeSmsSendMessage: |
|
2733 timeOut = KMmSmsSendMessage; |
|
2734 break; |
|
2735 case EMultimodeSmsSendMessageNoFdnCheck: |
|
2736 timeOut = KMmSmsSendMessageNoFdnCheckTimeOut; |
|
2737 break; |
|
2738 case EMultimodeSmsSendSatMessage: |
|
2739 timeOut = KMmSmsSendSatMessage; |
|
2740 break; |
|
2741 case EMultimodeSmsResumeReception: |
|
2742 timeOut = KMmSmsResumeSmsReception; |
|
2743 break; |
|
2744 case EMultimodeSmsGetMessageStoreInfo: |
|
2745 timeOut = KMmSmsGetMessageStoreInfo; |
|
2746 break; |
|
2747 case EMultimodeSmsReadSmspListPhase1: |
|
2748 case EMultimodeSmsStoreSmspList: |
|
2749 timeOut = KMmSmsReadAndStoreSmspList; |
|
2750 break; |
|
2751 // SMS storage specific requests |
|
2752 case EMultimodeSmsGetInfo: |
|
2753 timeOut = KMmSimSmsGetInfo; |
|
2754 break; |
|
2755 case EMultimodeSimStSmsWriteSms: |
|
2756 timeOut = KMmSimSmsWriteSms; |
|
2757 break; |
|
2758 case EMultimodeSimStSmsReadSms: |
|
2759 case EMultimodeSimStSmsEraseSms: |
|
2760 timeOut = KMmSimSmsReadDeleteSms; |
|
2761 break; |
|
2762 case EMultimodeSimStSmsEraseAllSms: |
|
2763 timeOut = KMmSimSmsDeleteAllSms; |
|
2764 break; |
|
2765 case EMultimodeSimStSmsReadAllSms: |
|
2766 timeOut = KMmSimSmsReadAllSms; |
|
2767 break; |
|
2768 // Must not use timer: |
|
2769 // case EMultimodeSmsReceiveMessage: |
|
2770 // case EMultimodeSmsNotifyReceiveModeChange: |
|
2771 // case EMultimodeSmsNotifyMoSmsBearerChange: |
|
2772 // case EMultimodeSmsNotifySmspListChange: |
|
2773 // case EMultimodeSmsMemoryNotifyStoreEvent: |
|
2774 default: |
|
2775 // does not use timer |
|
2776 iTsyReqHandleStore->SetTsyReqHandle( |
|
2777 aReqHandleType, aTsyReqHandle ); |
|
2778 break; |
|
2779 } |
|
2780 |
|
2781 if ( timeOut > 0 ) |
|
2782 { |
|
2783 // the timeout parameter is given in seconds. |
|
2784 iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType, aTsyReqHandle, |
|
2785 timeOut ); |
|
2786 } |
|
2787 } |
|
2788 |
|
2789 //---------------------------------------------------------------------------- |
|
2790 // CMmSmsTsy::Complete |
|
2791 // Completes the request due timer expiration |
|
2792 // (other items were commented in a header). |
|
2793 // --------------------------------------------------------------------------- |
|
2794 // |
|
2795 void CMmSmsTsy::Complete( |
|
2796 TInt aReqHandleType, |
|
2797 TInt aError ) |
|
2798 { |
|
2799 // All possible TSY req handle types are listed in the |
|
2800 // switch case below. |
|
2801 switch( aReqHandleType ) |
|
2802 { |
|
2803 // Cases handled with automatic completion |
|
2804 // SMS specific requests |
|
2805 case EMultimodeSmsAckStored: |
|
2806 CompleteAckSmsStored( aError ); |
|
2807 break; |
|
2808 case EMultimodeSmsNackStored: |
|
2809 CompleteNackSmsStored( aError ); |
|
2810 break; |
|
2811 case EMultimodeSmsSendMessage: |
|
2812 CompleteSendMessage( KErrTimedOut, NULL ); |
|
2813 break; |
|
2814 case EMultimodeSmsSendMessageNoFdnCheck: |
|
2815 CompleteSendMessageNoFdnCheck( KErrTimedOut, NULL ); |
|
2816 break; |
|
2817 case EMultimodeSmsSendSatMessage: |
|
2818 CompleteSendSatMessage( KErrTimedOut ); |
|
2819 break; |
|
2820 case EMultimodeSmsResumeReception: |
|
2821 CompleteResumeSmsReception( aError ); |
|
2822 break; |
|
2823 case EMultimodeSmsGetMessageStoreInfo: |
|
2824 CompleteGetMessageStoreInfo( aError, NULL ); |
|
2825 break; |
|
2826 case EMultimodeSmsReadSmspListPhase1: |
|
2827 CompleteReadAllSmspPhase1( aError, NULL ); |
|
2828 break; |
|
2829 case EMultimodeSmsStoreSmspList: |
|
2830 CompleteStoreSmspList( aError ); |
|
2831 break; |
|
2832 // SMS storage specific requests |
|
2833 case EMultimodeSmsGetInfo: |
|
2834 if ( iMmSmsStorageTsy ) |
|
2835 { |
|
2836 iMmSmsStorageTsy->CompleteGetInfo( aError, NULL ); |
|
2837 } |
|
2838 break; |
|
2839 case EMultimodeSimStSmsReadSms: |
|
2840 if ( iMmSmsStorageTsy ) |
|
2841 { |
|
2842 iMmSmsStorageTsy->CompleteReadSms( aError, NULL ); |
|
2843 } |
|
2844 break; |
|
2845 case EMultimodeSimStSmsWriteSms: |
|
2846 if ( iMmSmsStorageTsy ) |
|
2847 { |
|
2848 iMmSmsStorageTsy->CompleteWriteSms( aError, NULL ); |
|
2849 } |
|
2850 break; |
|
2851 case EMultimodeSimStSmsEraseSms: |
|
2852 if ( iMmSmsStorageTsy ) |
|
2853 { |
|
2854 iMmSmsStorageTsy->CompleteDeleteSms( aError ); |
|
2855 } |
|
2856 break; |
|
2857 case EMultimodeSimStSmsEraseAllSms: |
|
2858 if ( iMmSmsStorageTsy ) |
|
2859 { |
|
2860 iMmSmsStorageTsy->CompleteDeleteAllSms( aError ); |
|
2861 } |
|
2862 break; |
|
2863 case EMultimodeSimStSmsReadAllSms: |
|
2864 if ( iMmSmsStorageTsy ) |
|
2865 { |
|
2866 iMmSmsStorageTsy->CompleteReadAllSmsPhase1( aError, EFalse ); |
|
2867 } |
|
2868 break; |
|
2869 // Can't use timer: |
|
2870 // case EMultimodeSmsReceiveMessage: |
|
2871 // case EMultimodeSmsNotifyReceiveModeChange: |
|
2872 // case EMultimodeSmsNotifyMoSmsBearerChange: |
|
2873 // case EMultimodeSmsNotifySmspListChange: |
|
2874 // case EMultimodeSmsMemoryNotifyStoreEvent: |
|
2875 default: |
|
2876 ReqCompleted( iTsyReqHandleStore->ResetTsyReqHandle( |
|
2877 aReqHandleType ), aError ); |
|
2878 break; |
|
2879 } |
|
2880 } |
|
2881 |
|
2882 #endif // REQHANDLE_TIMER |
|
2883 |
|
2884 //---------------------------------------------------------------------------- |
|
2885 // CMmSmsTsy::SendSatMessageL |
|
2886 // SimAtkTsy can send SMS messages to the network by calling this method. |
|
2887 // This method can leave. |
|
2888 // (other items were commented in a header). |
|
2889 // --------------------------------------------------------------------------- |
|
2890 // |
|
2891 TInt CMmSmsTsy::SendSatMessageL( |
|
2892 CMmPhoneTsy* aMmPhone, |
|
2893 TDes8* aSmsTpdu, |
|
2894 TDes16* aScAddress, |
|
2895 RMobilePhone::TMobileTON* aMobileTON, |
|
2896 RMobilePhone::TMobileNPI* aMobileNPI, |
|
2897 TBool aMoreToSend ) |
|
2898 { |
|
2899 TInt ret( KErrNone ); |
|
2900 // Deliver attributes to message handler by using |
|
2901 // TMobileSmsSendAttributesV1 class. |
|
2902 RMobileSmsMessaging::TMobileSmsSendAttributesV1 msgAttrib; |
|
2903 |
|
2904 msgAttrib.iFlags = ( RMobileSmsMessaging::KSmsDataFormat | |
|
2905 RMobileSmsMessaging::KGsmServiceCentre | |
|
2906 RMobileSmsMessaging::KMoreToSend ); |
|
2907 |
|
2908 msgAttrib.iDataFormat = RMobileSmsMessaging::EFormatGsmTpdu; |
|
2909 |
|
2910 // if service center address length > 20 digits plus "+" sign |
|
2911 if ( aScAddress->Length() > ( KMaxAmountOfDigits + 1 ) ) |
|
2912 { |
|
2913 ret = KErrArgument; |
|
2914 } |
|
2915 else |
|
2916 { |
|
2917 msgAttrib.iGsmServiceCentre.iTelNumber.Copy( *aScAddress ); |
|
2918 msgAttrib.iGsmServiceCentre.iTypeOfNumber = *aMobileTON; |
|
2919 msgAttrib.iGsmServiceCentre.iNumberPlan = *aMobileNPI; |
|
2920 |
|
2921 msgAttrib.iMore = aMoreToSend; |
|
2922 |
|
2923 // create package |
|
2924 CMmDataPackage package; |
|
2925 |
|
2926 // structure for all sms parameters and data |
|
2927 TSendSmsDataAndAttributes sendData; |
|
2928 |
|
2929 sendData.iAttributes = &msgAttrib; |
|
2930 sendData.iMsgData = aSmsTpdu; |
|
2931 sendData.iIpc = EMmTsySmsSendSatMessage; |
|
2932 |
|
2933 // Pack parameters |
|
2934 package.PackData( &sendData ); |
|
2935 |
|
2936 // send request to DOS |
|
2937 ret = aMmPhone->MessageManager()->HandleRequestL( |
|
2938 EMmTsySmsSendSatMessage, &package ); |
|
2939 |
|
2940 if ( KErrNone == ret ) |
|
2941 { |
|
2942 iReqHandleType = EMultimodeSmsSendSatMessage; |
|
2943 } |
|
2944 } |
|
2945 |
|
2946 return ret; |
|
2947 } |
|
2948 |
|
2949 //---------------------------------------------------------------------------- |
|
2950 // CMmSmsTsy::ResendSms |
|
2951 // Resends unsent message which is stored in iSmsSendReq |
|
2952 // (other items were commented in a header). |
|
2953 // --------------------------------------------------------------------------- |
|
2954 // |
|
2955 void CMmSmsTsy::ResendSms() |
|
2956 { |
|
2957 if ( NULL != iSmsSendReq ) |
|
2958 { |
|
2959 // Create package |
|
2960 CMmDataPackage package; |
|
2961 |
|
2962 // structure for all sms parameters and data |
|
2963 TSendSmsDataAndAttributes sendData = |
|
2964 iSmsSendReq->GetSmsDataAndAttributes(); |
|
2965 |
|
2966 // Pack parameters |
|
2967 package.PackData( &sendData ); |
|
2968 |
|
2969 // send request to DOS |
|
2970 TInt ret = KErrNone; |
|
2971 TRAPD( trapError, ret = iMmPhone->MessageManager()->HandleRequestL( |
|
2972 sendData.iIpc, &package ); ); |
|
2973 |
|
2974 if ( ( KErrNone != ret ) || ( KErrNone != trapError ) ) |
|
2975 { |
|
2976 delete iSmsSendReq; // Delete object |
|
2977 iSmsSendReq = NULL; // Reset pointer |
|
2978 |
|
2979 // Response for send SMS request |
|
2980 if ( EMobileSmsMessagingSendMessage == sendData.iIpc ) |
|
2981 { |
|
2982 iSmsNoFdnCheckFlag = ESmsNoFdnCheckNotUsed; |
|
2983 CompleteSendMessage( KErrGeneral, NULL ); |
|
2984 } |
|
2985 // Response for send SAT SMS request |
|
2986 else if ( EMmTsySmsSendSatMessage == sendData.iIpc ) |
|
2987 { |
|
2988 CompleteSendSatMessage( KErrGeneral ); |
|
2989 } |
|
2990 // Response for send SMS NoFdnCheck request |
|
2991 else if ( EMobileSmsMessagingSendMessageNoFdnCheck == |
|
2992 sendData.iIpc ) |
|
2993 { |
|
2994 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUsed; |
|
2995 TFLOGSTRING2("TSY: CMmSmsTsy::ResendSms. EMobileSmsMessagingSendMessageNoFdnCheck: %d", sendData.iIpc); |
|
2996 CompleteSendMessageNoFdnCheck( KErrGeneral, NULL ); |
|
2997 } |
|
2998 } |
|
2999 else |
|
3000 { |
|
3001 iSmsSendReq->IncreaseSendCounter(); |
|
3002 } |
|
3003 } |
|
3004 } |
|
3005 |
|
3006 // --------------------------------------------------------------------------- |
|
3007 // CMmSmsTsy::IsRequestPossibleInOffLine |
|
3008 // Checks wether a ETel request can be performed or not while offline mode is |
|
3009 // enabled |
|
3010 // (other items were commented in a header). |
|
3011 // --------------------------------------------------------------------------- |
|
3012 // |
|
3013 TBool CMmSmsTsy::IsRequestPossibleInOffline( TInt aIpc ) const |
|
3014 { |
|
3015 TBool isRequestPossible ( ETrue ); |
|
3016 switch ( aIpc ) |
|
3017 { |
|
3018 case EMobileSmsMessagingSendMessage: //NO |
|
3019 case EMobileSmsMessagingSendMessageNoFdnCheck: //NO |
|
3020 isRequestPossible = EFalse; |
|
3021 break; |
|
3022 // case EMobileSmsMessagingSetReceiveMode: |
|
3023 // case EMobileSmsMessagingNotifyReceiveModeChange: |
|
3024 // case EMobileSmsMessagingReceiveMessage: |
|
3025 // case EMobileSmsMessagingAckSmsStored: |
|
3026 // case EMobileSmsMessagingNackSmsStored: |
|
3027 // case EMobileSmsMessagingResumeSmsReception: //request is possible |
|
3028 //(will be delayed |
|
3029 // and sent later, see |
|
3030 // ResumeSmsReception) |
|
3031 // case EMobileSmsMessagingNotifyMoSmsBearerChange: |
|
3032 // case EMobileSmsMessagingGetMessageStoreInfo: |
|
3033 // case EMobileSmsMessagingGetSmspListPhase1: |
|
3034 // case EMobileSmsMessagingNotifySmspListChange: |
|
3035 // case EMobileSmsMessagingStoreSmspList: |
|
3036 default: |
|
3037 break; |
|
3038 } |
|
3039 |
|
3040 return isRequestPossible; |
|
3041 } |
|
3042 |
|
3043 // --------------------------------------------------------------------------- |
|
3044 // CMmSmsTsy::SendMessageNoFdnCheckCancel |
|
3045 // Cancels SendMessageNoFdnCheck request. |
|
3046 // (other items were commented in a header). |
|
3047 // --------------------------------------------------------------------------- |
|
3048 // |
|
3049 TInt CMmSmsTsy::SendMessageNoFdnCheckCancel( |
|
3050 const TTsyReqHandle aTsyReqHandle ) |
|
3051 { |
|
3052 TFLOGSTRING("TSY: CMmSmsTsy::SendMessageNoFdnCheckCancel" ); |
|
3053 // Reset req handle. Returns the deleted req handle |
|
3054 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
3055 EMultimodeSmsSendMessageNoFdnCheck ); |
|
3056 |
|
3057 if ( EMultimodeSmsReqHandleUnknown < reqHandle ) |
|
3058 { |
|
3059 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
3060 |
|
3061 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUnknown; |
|
3062 } |
|
3063 |
|
3064 return KErrNone; |
|
3065 } |
|
3066 |
|
3067 //---------------------------------------------------------------------------- |
|
3068 // CMmSmsTsy::CompleteSendMessageNoFdnCheck |
|
3069 // Complete SendMessage request |
|
3070 // (other items were commented in a header). |
|
3071 // --------------------------------------------------------------------------- |
|
3072 // |
|
3073 void CMmSmsTsy::CompleteSendMessageNoFdnCheck( |
|
3074 TInt aError, |
|
3075 CMmDataPackage* aDataPackage ) |
|
3076 { |
|
3077 if ( ( KErrNone != aError ) && ( KErrTimedOut != aError ) |
|
3078 && ( KErrGsmSMSOperationNotAllowed != |
|
3079 CMmCommonStaticUtility::ExtendedErrorCode ( aError ) ) |
|
3080 // FDB check failed |
|
3081 && ( KErrGsmSMSUnspecifiedProtocolError != |
|
3082 CMmCommonStaticUtility::ExtendedErrorCode ( aError ) ) |
|
3083 && ( KErrSatControl != |
|
3084 CMmCommonStaticUtility::ExtendedErrorCode ( aError ) ) |
|
3085 && ( !( iMmPhone->GetSatMessaging() && |
|
3086 iMmPhone->GetSatMessaging()->IsMoSmControlBySimActivated() ) ) |
|
3087 && ( NULL != iSmsSendReq ) && ( 2 >= |
|
3088 iSmsSendReq->GetSendCounter() ) ) |
|
3089 { |
|
3090 // DOS returned error to send request. Message might be tried to be |
|
3091 // resent (see method ResendSms). |
|
3092 // Timeout mechanism cannot access this part of code, ever. |
|
3093 TFLOGSTRING2("TSY: CMmSmsTsy::CompleteSendMessageNoFdnCheck. Resend counter: %d", iSmsSendReq->GetSendCounter()); |
|
3094 } |
|
3095 else |
|
3096 { |
|
3097 // This is executed |
|
3098 // - if sending was successful |
|
3099 // - if there are no more resending attempts |
|
3100 // - if timer expires (called from the Complete of CMmSmsTsy class) |
|
3101 |
|
3102 // Delete send message entry from send array |
|
3103 if ( iSmsSendReq ) |
|
3104 { |
|
3105 delete iSmsSendReq; // Delete object |
|
3106 iSmsSendReq = NULL; // Reset pointer |
|
3107 } |
|
3108 |
|
3109 // reset req handle and complete request |
|
3110 TTsyReqHandle reqHandle = iTsyReqHandleStore-> |
|
3111 ResetTsyReqHandle( EMultimodeSmsSendMessageNoFdnCheck ); |
|
3112 |
|
3113 if ( EMultimodeSmsReqHandleUnknown < reqHandle ) |
|
3114 { |
|
3115 // get values only if there was no error, and if return pointer to |
|
3116 // client is available |
|
3117 if ( KErrNone == aError && iSendMessageMsgAttrPckgPtr ) |
|
3118 { |
|
3119 TInt16 msgRef( 0 ); |
|
3120 TBuf8<RMobileSmsMessaging::KGsmTpduSize> smsMsg; |
|
3121 |
|
3122 aDataPackage->UnPackData( msgRef, smsMsg ); |
|
3123 |
|
3124 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg* attsPckg = |
|
3125 reinterpret_cast< |
|
3126 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg* >( |
|
3127 iSendMessageMsgAttrPckgPtr ); |
|
3128 RMobileSmsMessaging::TMobileSmsSendAttributesV1& msgAttr = |
|
3129 ( *attsPckg )(); |
|
3130 |
|
3131 msgAttr.iFlags = RMobileSmsMessaging::KMessageReference; |
|
3132 msgAttr.iMsgRef = static_cast< TUint16 >( msgRef ); |
|
3133 |
|
3134 if ( NULL != smsMsg.Length() ) |
|
3135 { |
|
3136 msgAttr.iSubmitReport.Copy(smsMsg); |
|
3137 msgAttr.iFlags |= RMobileSmsMessaging::KGsmSubmitReport; |
|
3138 } |
|
3139 } |
|
3140 |
|
3141 ReqCompleted( reqHandle, aError ); |
|
3142 // reset pointer to client memory |
|
3143 iSendMessageMsgAttrPckgPtr = NULL; |
|
3144 |
|
3145 iSmsNoFdnCheckFlag = ESmsNoFdnCheckUnknown; |
|
3146 } |
|
3147 } |
|
3148 |
|
3149 // Resend unsent message |
|
3150 ResendSms(); |
|
3151 } |
|
3152 |
|
3153 |
|
3154 // End of File |