|
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 <mmlist.h> |
|
20 #include <etelmm.h> |
|
21 #include "cmmbroadcasttsy.h" |
|
22 #include "cmmphonetsy.h" |
|
23 #include "CMmPrivateUtility.h" // Read all list class |
|
24 #include <ctsy/serviceapi/cmmsmsutility.h> |
|
25 #include "MmTsy_numberOfSlots.h" |
|
26 #include "cmmtsyreqhandlestore.h" |
|
27 #include <ctsy/pluginapi/cmmdatapackage.h> |
|
28 #include <ctsy/tflogger.h> |
|
29 #include "cmmnettsy.h" |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 CMmBroadcastTsy::CMmBroadcastTsy() |
|
34 { |
|
35 // Set number of WCDMA CBS Pages to 0 |
|
36 iWcdmaPageNumber = 0; |
|
37 |
|
38 // Defaut value for iWcdmaCbsPageLeft.it means that there are |
|
39 // no page left to send to upper layer |
|
40 iWcdmaCbsPageLeft = EFalse; |
|
41 |
|
42 // First page is always at index 0 |
|
43 iWcdmaCbsMsgPageIndex = 0; |
|
44 } |
|
45 |
|
46 void CMmBroadcastTsy::ConstructL() |
|
47 { |
|
48 TFLOGSTRING("TSY: CMmBroadcastTsy::ConstructL"); |
|
49 #ifdef REQHANDLE_TIMER |
|
50 // create req handle store |
|
51 iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this, iMmPhone, |
|
52 EMultimodeBroadcastMaxNumOfRequests, iBroadcastReqHandles ); |
|
53 #else |
|
54 // create req handle store |
|
55 iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( |
|
56 EMultimodeBroadcastMaxNumOfRequests, iBroadcastReqHandles ); |
|
57 #endif // REQHANDLE_TIMER |
|
58 |
|
59 // Reset all CMmBroadcastTsy variables |
|
60 ResetVariables(); |
|
61 |
|
62 // Maximun of subBlocks is 15 so let's put the granularity to 10 |
|
63 iCbsMsg = new( ELeave ) CArrayPtrFlat< TWcdmaCbsMsg >( 10 ); |
|
64 |
|
65 // register broadcast tsy in the message manager |
|
66 iMmPhone->MessageManager()->RegisterTsyObject( |
|
67 CMmMessageManagerBase::EBroadcastMessagingTsy, this ); |
|
68 } |
|
69 |
|
70 CMmBroadcastTsy* CMmBroadcastTsy::NewL( |
|
71 CMmPhoneTsy* aMmPhone ) |
|
72 { |
|
73 CMmBroadcastTsy* aMmBroadcastTsy = new ( ELeave ) CMmBroadcastTsy(); |
|
74 CleanupClosePushL( *aMmBroadcastTsy ); |
|
75 aMmBroadcastTsy->iMmPhone = aMmPhone; |
|
76 aMmBroadcastTsy->ConstructL(); |
|
77 CleanupStack::Pop(); |
|
78 |
|
79 return aMmBroadcastTsy; |
|
80 } |
|
81 |
|
82 CMmBroadcastTsy::~CMmBroadcastTsy() |
|
83 { |
|
84 TFLOGSTRING("TSY: CMmBroadcastTsy::~CMmBroadcastTsy"); |
|
85 if ( iMmPhone ) |
|
86 { |
|
87 // deregister tsy object from message manager |
|
88 iMmPhone->MessageManager()->DeregisterTsyObject(this); |
|
89 } |
|
90 |
|
91 delete iTsyReqHandleStore; |
|
92 iTsyReqHandleStore = NULL; |
|
93 |
|
94 // Delete iCbsMsg |
|
95 delete iCbsMsg; |
|
96 iCbsMsg = NULL; |
|
97 |
|
98 // Set pointers to NULL |
|
99 iMmPhone = NULL; |
|
100 iMessageManager = NULL; |
|
101 iReceiveCbMessagePtr = NULL; |
|
102 iReceiveCbMessageAttributesPtr = NULL; |
|
103 iNotifyFilterSettingChangePtr = NULL; |
|
104 |
|
105 } |
|
106 |
|
107 //---------------------------------------------------------------------------- |
|
108 // CMmBroadcastTsy::Init |
|
109 // Initialisation method |
|
110 // (other items were commented in a header). |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 void CMmBroadcastTsy::Init() |
|
114 { |
|
115 } |
|
116 |
|
117 //---------------------------------------------------------------------------- |
|
118 // CMmBroadcastTsy::ExtFunc |
|
119 // Handling of extended requests |
|
120 // (other items were commented in a header). |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 TInt CMmBroadcastTsy::ExtFunc( |
|
124 const TTsyReqHandle aTsyReqHandle, |
|
125 const TInt aIpc, |
|
126 const TDataPackage& aPackage ) |
|
127 { |
|
128 TInt ret( KErrNone ); |
|
129 TAny* dataPtr = aPackage.Ptr1(); |
|
130 TAny* dataPtr2 = aPackage.Ptr2(); |
|
131 |
|
132 switch ( aIpc ) |
|
133 { |
|
134 // Cell broadcast requests that doesn't need trapping |
|
135 case EMobileBroadcastMessagingGetCaps: |
|
136 ret = GetCaps( aTsyReqHandle, aPackage.Des1n() ); |
|
137 break; |
|
138 case EMobileBroadcastMessagingGetFilterSetting: |
|
139 ret = GetFilterSetting( aTsyReqHandle, reinterpret_cast< |
|
140 RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter*> |
|
141 ( dataPtr ) ); |
|
142 break; |
|
143 case EMobileBroadcastMessagingGetIdListPhase1: |
|
144 TRAP_IGNORE( ret = GetBroadcastIdListPhase1L( aTsyReqHandle, |
|
145 reinterpret_cast< CRetrieveMobilePhoneBroadcastIdList:: |
|
146 TGetBroadcastIdRequest* > ( dataPtr ), |
|
147 reinterpret_cast< TInt* > ( dataPtr2 ) ); ); |
|
148 break; |
|
149 case EMobileBroadcastMessagingGetIdListPhase2: |
|
150 ret = GetBroadcastIdListPhase2( aTsyReqHandle, |
|
151 reinterpret_cast< RMobilePhone::TClientId* > ( dataPtr ), |
|
152 aPackage.Des2n() ); |
|
153 break; |
|
154 // Cell broadcast requests that may need trapping |
|
155 default: |
|
156 // reset last tsy request type |
|
157 iReqHandleType = EMultimodeBroadcastReqHandleUnknown; |
|
158 |
|
159 TInt leaveCode( KErrNone ); |
|
160 TRAP( leaveCode, ret = DoExtFuncL( aTsyReqHandle, aIpc, |
|
161 aPackage ); ); |
|
162 |
|
163 if ( KErrNone != leaveCode ) |
|
164 { |
|
165 ReqCompleted( aTsyReqHandle, leaveCode ); |
|
166 } |
|
167 |
|
168 // save request handle |
|
169 if ( EMultimodeBroadcastReqHandleUnknown != iReqHandleType ) |
|
170 { |
|
171 #ifdef REQHANDLE_TIMER |
|
172 SetTypeOfResponse( iReqHandleType, aTsyReqHandle ); |
|
173 #else |
|
174 //Never comes here ? See SetTypeOfResponse. |
|
175 iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, |
|
176 aTsyReqHandle ); |
|
177 #endif // REQHANDLE_TIMER |
|
178 } |
|
179 break; |
|
180 } |
|
181 |
|
182 return ret; |
|
183 } |
|
184 |
|
185 //---------------------------------------------------------------------------- |
|
186 // CMmBroadcastTsy::DoExtFuncL |
|
187 // Handling of broadcast related requests that needs trapping |
|
188 // (other items were commented in a header). |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 TInt CMmBroadcastTsy::DoExtFuncL( |
|
192 const TTsyReqHandle aTsyReqHandle, |
|
193 const TInt aIpc, |
|
194 const TDataPackage& aPackage ) |
|
195 { |
|
196 TInt ret( KErrNone ); |
|
197 TAny* dataPtr = aPackage.Ptr1(); |
|
198 |
|
199 switch ( aIpc ) |
|
200 { |
|
201 // Cell broadcast requests that may need trapping |
|
202 case EMobileBroadcastMessagingReceiveMessage: |
|
203 ret = ReceiveMessageL( |
|
204 aTsyReqHandle, aPackage.Des1n(), aPackage.Des2n() ); |
|
205 break; |
|
206 case EMobileBroadcastMessagingSetFilterSetting: |
|
207 ret = SetFilterSettingL( aTsyReqHandle, |
|
208 reinterpret_cast< |
|
209 RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter* > |
|
210 ( dataPtr ) ); |
|
211 break; |
|
212 case EMobileBroadcastMessagingNotifyFilterSettingChange: |
|
213 ret = NotifyFilterSettingChange( reinterpret_cast< |
|
214 RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter* > |
|
215 ( dataPtr ) ); |
|
216 break; |
|
217 case EMobileBroadcastMessagingStoreIdList: |
|
218 ret = StoreBroadcastIdListL( aTsyReqHandle, aPackage.Des1n() ); |
|
219 break; |
|
220 default: |
|
221 ret = KErrNotSupported; |
|
222 break; |
|
223 } |
|
224 |
|
225 return ret; |
|
226 } |
|
227 |
|
228 //---------------------------------------------------------------------------- |
|
229 // CMmBroadcastTsy::CancelService |
|
230 // CancelService is called by the server when it is "cleaning-up" |
|
231 // any still outstanding asynchronous requests before closing a |
|
232 // client's sub-session. This will happen if a client closes its |
|
233 // R-class handle without cancelling outstanding asynchronous |
|
234 // requests on |
|
235 // (other items were commented in a header). |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 TInt CMmBroadcastTsy::CancelService( |
|
239 const TInt aIpc, |
|
240 const TTsyReqHandle aTsyReqHandle ) |
|
241 { |
|
242 TInt ret( KErrNone ); |
|
243 switch ( aIpc ) |
|
244 { |
|
245 case EMobileBroadcastMessagingNotifyFilterSettingChange: |
|
246 ret = NotifyFilterSettingChangeCancel ( aTsyReqHandle ); |
|
247 break; |
|
248 case EMobileBroadcastMessagingSetFilterSetting: |
|
249 case EMobileBroadcastMessagingStoreIdList: |
|
250 case EMobileBroadcastMessagingGetIdListPhase1: |
|
251 case EMobileBroadcastMessagingGetIdListPhase2: |
|
252 ret = KErrNone; |
|
253 break; |
|
254 // This cancel request may need message construction, |
|
255 // so trapping is needed |
|
256 case EMobileBroadcastMessagingReceiveMessage: |
|
257 // call cancel handling |
|
258 TRAPD( leaveCode, ( ret = ReceiveMessageCancelL( aTsyReqHandle ) ) ); |
|
259 if ( KErrNone != leaveCode ) |
|
260 { |
|
261 ReqCompleted( aTsyReqHandle, leaveCode ); |
|
262 } |
|
263 break; |
|
264 default: |
|
265 ret = KErrGeneral; |
|
266 break; |
|
267 } |
|
268 |
|
269 return ret; |
|
270 } |
|
271 |
|
272 //---------------------------------------------------------------------------- |
|
273 // CMmBroadcastTsy::ReqModeL |
|
274 // When the ETel server receives an "extension" client request, |
|
275 // it will pass the IPC request number down to the TSY in order |
|
276 // to find out what type of request it is |
|
277 // (other items were commented in a header). |
|
278 // --------------------------------------------------------------------------- |
|
279 // |
|
280 CTelObject::TReqMode CMmBroadcastTsy::ReqModeL( |
|
281 const TInt aIpc ) |
|
282 { |
|
283 CTelObject::TReqMode ret = 0; |
|
284 |
|
285 switch ( aIpc ) |
|
286 { |
|
287 // Non-Flow Controlled Services |
|
288 case EMobileBroadcastMessagingGetCaps: |
|
289 case EMobileBroadcastMessagingGetFilterSetting: |
|
290 case EMobileBroadcastMessagingGetIdListPhase1: |
|
291 case EMobileBroadcastMessagingGetIdListPhase2: |
|
292 case EMobileBroadcastMessagingStoreIdList: |
|
293 break; |
|
294 // Flow Controlled Services |
|
295 case EMobileBroadcastMessagingSetFilterSetting: |
|
296 ret = KReqModeFlowControlObeyed; |
|
297 break; |
|
298 // Multiple Completion Services with Immediate Server Repost |
|
299 // (Usually Notifications) |
|
300 case EMobileBroadcastMessagingReceiveMessage: |
|
301 case EMobileBroadcastMessagingNotifyFilterSettingChange: |
|
302 ret = KReqModeMultipleCompletionEnabled | |
|
303 KReqModeRePostImmediately; |
|
304 break; |
|
305 default: |
|
306 User::Leave ( KErrNotSupported ); |
|
307 break; |
|
308 } |
|
309 |
|
310 return ret; |
|
311 } |
|
312 |
|
313 //---------------------------------------------------------------------------- |
|
314 // CMmBroadcastTsy::NumberOfSlotsL |
|
315 // When the ETel server discovers that a request is "repost |
|
316 // immediately" it will ask the TSY how big a buffer it wants. |
|
317 // NumberOfSlotsL Returns number of slots to be used for given |
|
318 // requests |
|
319 // (other items were commented in a header). |
|
320 // --------------------------------------------------------------------------- |
|
321 // |
|
322 TInt CMmBroadcastTsy::NumberOfSlotsL( |
|
323 const TInt aIpc ) |
|
324 { |
|
325 TInt numberOfSlots = 1; |
|
326 switch ( aIpc ) |
|
327 { |
|
328 // Number of slots for the receive message |
|
329 case EMobileBroadcastMessagingReceiveMessage: |
|
330 numberOfSlots = KMmBroadcastMessagingReceiveMessageSlots; |
|
331 break; |
|
332 // Number of the slots for the notify changes |
|
333 case EMobileBroadcastMessagingNotifyFilterSettingChange: |
|
334 numberOfSlots = |
|
335 KMmBroadcastMessagingNotifyFilterSettingChangeSlots; |
|
336 break; |
|
337 default: |
|
338 // Unknown or invalid Broadcast IPC |
|
339 User::Leave ( KErrNotSupported ); |
|
340 break; |
|
341 } |
|
342 |
|
343 return numberOfSlots; |
|
344 } |
|
345 |
|
346 //---------------------------------------------------------------------------- |
|
347 // CMmBroadcastTsy::OpenNewObjectByNameL |
|
348 // Creates new object and returns a pointer to it |
|
349 // (other items were commented in a header). |
|
350 // --------------------------------------------------------------------------- |
|
351 // |
|
352 CTelObject* CMmBroadcastTsy::OpenNewObjectByNameL( |
|
353 const TDesC& /*aName*/ ) |
|
354 { |
|
355 User::Leave( KErrNotSupported ); |
|
356 //lint -e{527} "unreachable code" |
|
357 |
|
358 return NULL; |
|
359 } |
|
360 |
|
361 //---------------------------------------------------------------------------- |
|
362 // CMmBroadcastTsy::OpenNewObjectL |
|
363 // Creates new object and returns a pointer to it |
|
364 // (other items were commented in a header). |
|
365 // --------------------------------------------------------------------------- |
|
366 // |
|
367 CTelObject* CMmBroadcastTsy::OpenNewObjectL( |
|
368 TDes& /*aName*/ ) |
|
369 { |
|
370 User::Leave( KErrNotSupported ); |
|
371 //lint -e{527} "unreachable code" |
|
372 |
|
373 return NULL; |
|
374 } |
|
375 |
|
376 //---------------------------------------------------------------------------- |
|
377 // CMmBroadcastTsy::RegisterNotification |
|
378 // RegisterNotification is called when the server recognises |
|
379 // that this notification is being posted for the first time on |
|
380 // this sub-session object. It enables the TSY to "turn on" any |
|
381 // regular notification messages that it may receive from DOS |
|
382 // (other items were commented in a header). |
|
383 // --------------------------------------------------------------------------- |
|
384 // |
|
385 TInt CMmBroadcastTsy::RegisterNotification( |
|
386 const TInt aIpc ) |
|
387 { |
|
388 switch ( aIpc ) |
|
389 { |
|
390 case EMobileBroadcastMessagingReceiveMessage: |
|
391 case EMobileBroadcastMessagingNotifyFilterSettingChange: |
|
392 return KErrNone; |
|
393 default: |
|
394 // Unknown or invalid Broadcast IPC |
|
395 return KErrNotSupported; |
|
396 } |
|
397 } |
|
398 |
|
399 //---------------------------------------------------------------------------- |
|
400 // CMmBroadcastTsy::DeregisterNotification |
|
401 // DeregisterNotification is called when the server recognises |
|
402 // that this notification will not be posted again because the |
|
403 // last client to have a handle on this sub-session object has |
|
404 // just closed the handle. It enables the TSY to "turn off" any |
|
405 // regular notification messages that it may receive from DOS |
|
406 // (other items were commented in a header). |
|
407 // --------------------------------------------------------------------------- |
|
408 // |
|
409 TInt CMmBroadcastTsy::DeregisterNotification( |
|
410 const TInt aIpc ) |
|
411 { |
|
412 switch ( aIpc ) |
|
413 { |
|
414 case EMobileBroadcastMessagingReceiveMessage: |
|
415 case EMobileBroadcastMessagingNotifyFilterSettingChange: |
|
416 return KErrNone; |
|
417 default: |
|
418 // Unknown or invalid Broadcast IPC |
|
419 return KErrNotSupported; |
|
420 } |
|
421 } |
|
422 |
|
423 //---------------------------------------------------------------------------- |
|
424 // CMmBroadcastTsy::GetCaps |
|
425 // This method returns a class that reflects the broadcast |
|
426 // messaging capabilities of the phone. |
|
427 // (other items were commented in a header). |
|
428 // --------------------------------------------------------------------------- |
|
429 // |
|
430 TInt CMmBroadcastTsy::GetCaps( |
|
431 const TTsyReqHandle aTsyReqHandle, |
|
432 TDes8* aCaps ) |
|
433 { |
|
434 |
|
435 TInt ret( KErrArgument ); |
|
436 |
|
437 if ( aCaps ) |
|
438 { |
|
439 TInt paramLength = aCaps->MaxLength(); |
|
440 TInt expectedLength = sizeof( RMobileBroadcastMessaging::TMobileBroadcastCapsV1Pckg ); |
|
441 |
|
442 if (paramLength == expectedLength) |
|
443 { |
|
444 RMobileBroadcastMessaging::TMobileBroadcastCapsV1Pckg* cbsCapsPckg = |
|
445 reinterpret_cast< RMobileBroadcastMessaging::TMobileBroadcastCapsV1Pckg* > |
|
446 ( aCaps ); |
|
447 RMobileBroadcastMessaging::TMobileBroadcastCapsV1& cbsCaps = |
|
448 ( *cbsCapsPckg )(); |
|
449 |
|
450 cbsCaps.iModeCaps = RMobileBroadcastMessaging::KCapsGsmTpduFormat; |
|
451 |
|
452 #ifdef __WINS__ |
|
453 |
|
454 // force GSM+WCDMA capabilities for emulator testing |
|
455 cbsCaps.iModeCaps = RMobileBroadcastMessaging::KCapsWcdmaTpduFormat |
|
456 | RMobileBroadcastMessaging::KCapsGsmTpduFormat; |
|
457 |
|
458 #endif // __WINS__ |
|
459 |
|
460 // TSY supports only "accept all" and "reject all" filtering. |
|
461 cbsCaps.iFilterCaps = RMobileBroadcastMessaging::KCapsSimpleFilter; |
|
462 |
|
463 TFLOGSTRING3("TSY:CMmBroadcastTsy::GetCaps:Mode caps=0x%x, Filter caps=0x%x",cbsCaps.iModeCaps,cbsCaps.iFilterCaps); |
|
464 |
|
465 ret = KErrNone; |
|
466 ReqCompleted( aTsyReqHandle, ret ); |
|
467 } |
|
468 } |
|
469 |
|
470 return ret; |
|
471 } |
|
472 |
|
473 //---------------------------------------------------------------------------- |
|
474 // CMmBroadcastTsy::ReceiveMessageL |
|
475 // Activates routing of CB messages, and then waits for incoming CB messages |
|
476 // (other items were commented in a header). |
|
477 // --------------------------------------------------------------------------- |
|
478 // |
|
479 TInt CMmBroadcastTsy::ReceiveMessageL( |
|
480 const TTsyReqHandle aTsyReqHandle, |
|
481 TDes8* aMsgData, |
|
482 TDes8* aMsgAttributes ) |
|
483 { |
|
484 TInt ret = KErrArgument; |
|
485 |
|
486 if (aMsgData && aMsgAttributes) |
|
487 { |
|
488 |
|
489 RMobileBroadcastMessaging::TBroadcastPageData tempData; |
|
490 |
|
491 if (aMsgData->MaxLength() == tempData.MaxLength()) |
|
492 { |
|
493 RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 tempV1; |
|
494 RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg tempV1Pckg(tempV1); |
|
495 |
|
496 RMobileBroadcastMessaging::TMobileBroadcastAttributesV2 tempV2; |
|
497 RMobileBroadcastMessaging::TMobileBroadcastAttributesV2Pckg tempV2Pckg(tempV2); |
|
498 |
|
499 if ( (aMsgAttributes->MaxLength() == tempV1Pckg.MaxLength()) || (aMsgAttributes->MaxLength() == tempV2Pckg.MaxLength()) ) |
|
500 { |
|
501 ret = KErrNone; |
|
502 } |
|
503 |
|
504 if (ret == KErrNone) |
|
505 { |
|
506 iReceiveCbMessagePtr = aMsgData; |
|
507 iReceiveCbMessageAttributesPtr = aMsgAttributes; |
|
508 |
|
509 |
|
510 if ( iWcdmaCbsPageLeft ) |
|
511 { |
|
512 // currentpage increased, because pages left to deliver |
|
513 iWcdmaCurrentPage++; |
|
514 |
|
515 // there are previously received pages left |
|
516 CompleteReceivedWcdmaCbsMessagePageLeft(); |
|
517 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
518 } |
|
519 else if ( !iCbRoutingActivated ) |
|
520 { |
|
521 // DOS's CB routing is not activated |
|
522 TFLOGSTRING("TSY:CMmBroadcastTsy::ReceiveMessageL:DOS's CB routing is not activated, sending activation request."); |
|
523 |
|
524 //Create package |
|
525 CMmDataPackage package; |
|
526 |
|
527 TCbsCbmiAndLangAndFilter data; |
|
528 data.iSetting = RMobileBroadcastMessaging::EBroadcastAcceptAll; |
|
529 data.iCbmiStorage = KNullDesC; // deprecated |
|
530 data.iLanguageStorage = KNullDesC; // deprecated |
|
531 |
|
532 // Pack parameters |
|
533 package.PackData( &data ); |
|
534 |
|
535 // Send request to the Domestic OS layer. |
|
536 TInt error = iMmPhone->MessageManager()->HandleRequestL( |
|
537 EMobileBroadcastMessagingReceiveMessage, &package ); |
|
538 |
|
539 if ( KErrNone == error ) |
|
540 { |
|
541 iReqHandleType = EMultimodeBroadcastReceiveMessage; |
|
542 } |
|
543 else |
|
544 { |
|
545 // Message construction failed or phonet sender returned error |
|
546 ReqCompleted( aTsyReqHandle, error ); |
|
547 } |
|
548 } |
|
549 else |
|
550 { |
|
551 TFLOGSTRING("TSY:CMmBroadcastTsy::ReceiveMessageL:DOS's CB routing is activated, waiting for messages."); |
|
552 // routing is active, wait for messages from DOS |
|
553 iReqHandleType = EMultimodeBroadcastReceiveMessage; |
|
554 |
|
555 // currentpage set to zero - no pages to deliver |
|
556 iWcdmaCurrentPage = 0; |
|
557 } |
|
558 } |
|
559 } |
|
560 } |
|
561 |
|
562 return ret; |
|
563 } |
|
564 |
|
565 //---------------------------------------------------------------------------- |
|
566 // CMmBroadcastTsy::InternalCompleteCbRoutingRequest |
|
567 // Completes routing of CB messages request (does not include CB message) |
|
568 // (other items were commented in a header). |
|
569 // --------------------------------------------------------------------------- |
|
570 // |
|
571 void CMmBroadcastTsy::InternalCompleteCbRoutingRequest( |
|
572 TInt aError ) |
|
573 { |
|
574 TFLOGSTRING2("TSY:CMmBroadcastTsy::InternalCompleteCbRoutingRequest:error=%d.", aError); |
|
575 if ( KErrNone == aError ) |
|
576 { |
|
577 iCbRoutingActivated = ETrue; |
|
578 } |
|
579 else |
|
580 { |
|
581 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
582 EMultimodeBroadcastReceiveMessage ); |
|
583 |
|
584 if ( reqHandle ) |
|
585 { |
|
586 ReqCompleted( reqHandle, aError ); |
|
587 } |
|
588 } |
|
589 // Check if there are some WCDMA CBS Pages left to send to upper layer |
|
590 if ( ( iWcdmaCbsPageLeft ) && ( KErrNone == aError ) ) |
|
591 { |
|
592 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
593 EMultimodeBroadcastReceiveMessage ); |
|
594 |
|
595 if ( reqHandle ) |
|
596 { |
|
597 CompleteReceivedWcdmaCbsMessagePageLeft(); |
|
598 ReqCompleted( reqHandle, aError ); |
|
599 } |
|
600 } |
|
601 } |
|
602 |
|
603 //---------------------------------------------------------------------------- |
|
604 // CMmBroadcastTsy::CompleteReceivedWcdmaCbsMessagePageLeft |
|
605 // This method sends the pages left for WCDMA CBS message |
|
606 // (other items were commented in a header). |
|
607 // --------------------------------------------------------------------------- |
|
608 // |
|
609 void CMmBroadcastTsy::CompleteReceivedWcdmaCbsMessagePageLeft() |
|
610 { |
|
611 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceivedWcdmaCbsMessagePageLeft:Delivering page %d to client.", iWcdmaCbsMsgPageIndex); |
|
612 RMobileBroadcastMessaging::TMobileBroadcastAttributesV2Pckg* |
|
613 attrPckg = reinterpret_cast |
|
614 < RMobileBroadcastMessaging::TMobileBroadcastAttributesV2Pckg* > |
|
615 ( iReceiveCbMessageAttributesPtr ); |
|
616 |
|
617 RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& cbAttrib = |
|
618 ( *attrPckg )(); |
|
619 |
|
620 // The bit-mask flags indicating which attributes are present in this |
|
621 // instance |
|
622 cbAttrib.iFlags = |
|
623 ( RMobileBroadcastMessaging::KBroadcastDataFormat ); |
|
624 |
|
625 // WCDMA |
|
626 cbAttrib.iFormat = RMobileBroadcastMessaging::EFormatWcdmaTpdu; |
|
627 |
|
628 // Number of pages |
|
629 cbAttrib.iNumberOfPages = ( *iCbsMsg )[iWcdmaCbsMsgPageIndex] |
|
630 ->iNumberOfPages; |
|
631 |
|
632 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceiveMessageWcdmaCbs: cbAttrib.iNumberOfPages %x .", cbAttrib.iNumberOfPages); |
|
633 |
|
634 // Message Type |
|
635 cbAttrib.iMessageType = ( *iCbsMsg )[iWcdmaCbsMsgPageIndex] |
|
636 ->iMessageType; |
|
637 |
|
638 // Message ID |
|
639 cbAttrib.iMessageId = ( *iCbsMsg )[iWcdmaCbsMsgPageIndex]->iMessageId; |
|
640 |
|
641 // Serial Number |
|
642 cbAttrib.iSerialNum = ( *iCbsMsg )[iWcdmaCbsMsgPageIndex]->iSerialNum; |
|
643 |
|
644 // data coding scheme |
|
645 cbAttrib.iDCS = ( *iCbsMsg )[iWcdmaCbsMsgPageIndex]->iDCS; |
|
646 |
|
647 iReceiveCbMessagePtr->Copy( ( *iCbsMsg )[iWcdmaCbsMsgPageIndex]->iWcdmaCbsData.Ptr(), |
|
648 ( *iCbsMsg )[iWcdmaCbsMsgPageIndex]->iInfoLength ); |
|
649 |
|
650 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceivedWcdmaCbsMessagePageLeft: AppendFormat in use iWcdmaCurrentPage: %d.", iWcdmaCurrentPage ); |
|
651 _LIT8(KFormat, "%c"); |
|
652 |
|
653 // Append pagenumber to end of CBS message |
|
654 iReceiveCbMessagePtr->AppendFormat(KFormat, iWcdmaCurrentPage); |
|
655 |
|
656 // Increase by 1 the page index |
|
657 iWcdmaCbsMsgPageIndex++; |
|
658 |
|
659 // if all the pages have been sent to upper layer |
|
660 if ( iWcdmaCbsMsgPageIndex == iWcdmaPageNumber ) |
|
661 { |
|
662 // all the pages have been read so set variable to its default |
|
663 // value which means that there are no WCDMA CBS page to pass |
|
664 // to upper layer anymore |
|
665 iWcdmaCbsPageLeft = EFalse; |
|
666 iWcdmaCbsMsgPageIndex = 0; |
|
667 |
|
668 // Reset the array |
|
669 iCbsMsg->Reset(); |
|
670 } |
|
671 } |
|
672 |
|
673 //---------------------------------------------------------------------------- |
|
674 // CMmBroadcastTsy::CompleteReceiveMessage |
|
675 // This method completes routing of CB messages request |
|
676 // (includes message) |
|
677 // (other items were commented in a header). |
|
678 // --------------------------------------------------------------------------- |
|
679 // |
|
680 void CMmBroadcastTsy::CompleteReceiveMessageGsmCbs( |
|
681 TInt aError, |
|
682 CMmDataPackage* aDataPackage ) |
|
683 { |
|
684 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceiveMessageGsmCbs:error=%d.",aError); |
|
685 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
686 EMultimodeBroadcastReceiveMessage ); |
|
687 |
|
688 if ( reqHandle ) |
|
689 { |
|
690 if ( KErrNone == aError ) |
|
691 { |
|
692 TGsmCbsMsg cbsMsg; |
|
693 |
|
694 //Unpack data |
|
695 aDataPackage->UnPackData( cbsMsg ); |
|
696 |
|
697 RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg* |
|
698 attrPckg = reinterpret_cast |
|
699 < RMobileBroadcastMessaging:: |
|
700 TMobileBroadcastAttributesV1Pckg* > |
|
701 ( iReceiveCbMessageAttributesPtr ); |
|
702 |
|
703 RMobileBroadcastMessaging::TMobileBroadcastAttributesV1& |
|
704 cbAttrib = ( *attrPckg )(); |
|
705 |
|
706 cbAttrib.iFlags = |
|
707 ( RMobileBroadcastMessaging::KBroadcastDataFormat ); |
|
708 |
|
709 // GSM Mode |
|
710 cbAttrib.iFormat = RMobileBroadcastMessaging::EFormatGsmTpdu; |
|
711 |
|
712 iReceiveCbMessagePtr->Copy( cbsMsg.iCbsMsg ); |
|
713 } |
|
714 ReqCompleted( reqHandle, aError ); |
|
715 } |
|
716 } |
|
717 |
|
718 //---------------------------------------------------------------------------- |
|
719 // CMmBroadcastTsy::CompleteReceiveMessageWcdmaCbs |
|
720 // This method complete routing of Wcdma CB messages request |
|
721 // (include message) |
|
722 // (other items were commented in a header). |
|
723 // --------------------------------------------------------------------------- |
|
724 // |
|
725 void CMmBroadcastTsy::CompleteReceiveMessageWcdmaCbs( |
|
726 TInt aError, |
|
727 CMmDataPackage* aDataPackage ) |
|
728 { |
|
729 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceiveMessageWcdmaCbs:error=%d.", aError); |
|
730 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
731 EMultimodeBroadcastReceiveMessage ); |
|
732 |
|
733 // Reset array |
|
734 iCbsMsg->Reset(); |
|
735 |
|
736 // Set to EFalse |
|
737 iWcdmaCbsPageLeft = EFalse; |
|
738 |
|
739 if ( reqHandle ) |
|
740 { |
|
741 if ( KErrNone == aError ) |
|
742 { |
|
743 CArrayPtrFlat< TWcdmaCbsMsg >* cbsMsgTemp = NULL; |
|
744 |
|
745 // Unpack data |
|
746 aDataPackage->UnPackData( cbsMsgTemp, iWcdmaPageNumber ); |
|
747 |
|
748 if (iWcdmaPageNumber <= cbsMsgTemp->Count()) |
|
749 { |
|
750 // Copy the pages |
|
751 TRAPD( trapError, |
|
752 for ( TUint8 i = 0; i < iWcdmaPageNumber; i++ ) |
|
753 { |
|
754 iCbsMsg->AppendL( cbsMsgTemp->At( i ) ); |
|
755 } |
|
756 ); |
|
757 |
|
758 if ( KErrNone == trapError ) |
|
759 { |
|
760 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceiveMessageWcdmaCbs: %d pages received.",iWcdmaPageNumber); |
|
761 // first page. index is 0 |
|
762 iWcdmaCbsMsgPageIndex = 0; |
|
763 |
|
764 // currentpage is 1 at this state even if multipage cbs |
|
765 iWcdmaCurrentPage = 1; |
|
766 |
|
767 RMobileBroadcastMessaging::TMobileBroadcastAttributesV2Pckg* |
|
768 attrPckg = reinterpret_cast |
|
769 < RMobileBroadcastMessaging:: |
|
770 TMobileBroadcastAttributesV2Pckg* > |
|
771 ( iReceiveCbMessageAttributesPtr ); |
|
772 |
|
773 RMobileBroadcastMessaging::TMobileBroadcastAttributesV2& |
|
774 cbAttrib = ( *attrPckg )(); |
|
775 |
|
776 // The bit-mask flags indicating which attributes are present |
|
777 // in this instance |
|
778 cbAttrib.iFlags = |
|
779 ( RMobileBroadcastMessaging::KBroadcastDataFormat ); |
|
780 |
|
781 // WCDMA |
|
782 cbAttrib.iFormat = RMobileBroadcastMessaging::EFormatWcdmaTpdu; |
|
783 |
|
784 // Number of pages |
|
785 cbAttrib.iNumberOfPages = ( *iCbsMsg )[iWcdmaCbsMsgPageIndex] |
|
786 ->iNumberOfPages; |
|
787 |
|
788 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceiveMessageWcdmaCbs: cbAttrib.iNumberOfPages %x .", cbAttrib.iNumberOfPages); |
|
789 |
|
790 // Message Type |
|
791 cbAttrib.iMessageType = ( *iCbsMsg ) |
|
792 [iWcdmaCbsMsgPageIndex]->iMessageType; |
|
793 |
|
794 // Message ID |
|
795 cbAttrib.iMessageId = ( *iCbsMsg ) |
|
796 [iWcdmaCbsMsgPageIndex]->iMessageId; |
|
797 |
|
798 // Serial Number |
|
799 cbAttrib.iSerialNum = ( *iCbsMsg ) |
|
800 [iWcdmaCbsMsgPageIndex]->iSerialNum; |
|
801 |
|
802 // data coding scheme |
|
803 cbAttrib.iDCS = ( *iCbsMsg )[iWcdmaCbsMsgPageIndex]->iDCS; |
|
804 |
|
805 iReceiveCbMessagePtr->Copy( ( *iCbsMsg ) |
|
806 [iWcdmaCbsMsgPageIndex]->iWcdmaCbsData ); |
|
807 |
|
808 |
|
809 _LIT8(KFormat, "%c"); |
|
810 |
|
811 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceiveMessageWcdmaCbs: 1st Page - AppendFormat in use iWcdmaCurrentPage: %d.", iWcdmaCurrentPage ); |
|
812 // insert current pagenumber end of CBS message |
|
813 iReceiveCbMessagePtr->AppendFormat(KFormat, iWcdmaCurrentPage); |
|
814 |
|
815 // index of the pages begins at 0 |
|
816 if ( iWcdmaCbsMsgPageIndex == ( iWcdmaPageNumber -1 ) ) |
|
817 { |
|
818 // No page left to send to upper layer |
|
819 iWcdmaCbsPageLeft = EFalse; |
|
820 iWcdmaCbsMsgPageIndex = 0; |
|
821 |
|
822 // no pages left update current page |
|
823 iWcdmaCurrentPage = 0; |
|
824 |
|
825 // Reset the array |
|
826 iCbsMsg->Reset(); |
|
827 } |
|
828 else |
|
829 { |
|
830 // some pages are waiting to be send to upper layer |
|
831 iWcdmaCbsPageLeft = ETrue; |
|
832 // Increase by 1 the index of the pages |
|
833 iWcdmaCbsMsgPageIndex++; |
|
834 } |
|
835 } |
|
836 else |
|
837 { |
|
838 aError = trapError; |
|
839 } |
|
840 } |
|
841 else |
|
842 { |
|
843 aError = KErrCorrupt; |
|
844 } |
|
845 } |
|
846 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceiveMessageWcdmaCbs:Completing with error=%d.", aError); |
|
847 |
|
848 ReqCompleted( reqHandle, aError ); |
|
849 } |
|
850 } |
|
851 |
|
852 //---------------------------------------------------------------------------- |
|
853 // CMmBroadcastTsy::ReceiveMessageCancelL |
|
854 // This method releases routing of CB messages, and |
|
855 // cancels receiving of next incoming Broadcast Message |
|
856 // (other items were commented in a header). |
|
857 // --------------------------------------------------------------------------- |
|
858 // |
|
859 TInt CMmBroadcastTsy::ReceiveMessageCancelL( |
|
860 const TTsyReqHandle aTsyReqHandle ) |
|
861 { |
|
862 // Lets set this setting to null. Now TSY doesn't anymore try to send |
|
863 // incoming CB message to the client. |
|
864 iTsyReqHandleStore->ResetTsyReqHandle( |
|
865 EMultimodeBroadcastReceiveMessage ); |
|
866 |
|
867 if ( iCbRoutingActivated ) |
|
868 { |
|
869 TFLOGSTRING("TSY:CMmBroadcastTsy::ReceiveMessageCancelL:Routing was active, sending de-activation request."); |
|
870 // Create package |
|
871 CMmDataPackage package; |
|
872 |
|
873 TCbsCbmiAndLangAndFilter data; |
|
874 data.iSetting = RMobileBroadcastMessaging::EBroadcastAcceptNone; |
|
875 data.iCbmiStorage = KNullDesC; // deprecated |
|
876 data.iLanguageStorage = KNullDesC; // deprecated |
|
877 |
|
878 // Pack parameters |
|
879 package.PackData( &data ); |
|
880 |
|
881 // Send request to the Domestic OS layer. |
|
882 TInt ret = iMmPhone->MessageManager()->HandleRequestL( |
|
883 EMobileBroadcastMessagingReceiveMessageCancel, &package ); |
|
884 |
|
885 if ( KErrNone == ret ) |
|
886 { |
|
887 #ifdef REQHANDLE_TIMER |
|
888 SetTypeOfResponse( |
|
889 EMultimodeBroadcastReceiveMessageCancel, aTsyReqHandle ); |
|
890 #else |
|
891 iTsyReqHandleStore->SetTsyReqHandle( |
|
892 EMultimodeBroadcastReceiveMessageCancel, aTsyReqHandle ); |
|
893 #endif // REQHANDLE_TIMER |
|
894 } |
|
895 else // DOS call returned error |
|
896 { |
|
897 // This setting must be set to false |
|
898 iCbRoutingActivated = EFalse; |
|
899 |
|
900 // We have to complete this now, because Etel assumes that |
|
901 // cancel-requests never fail and doesn't call again |
|
902 // ReceiveMessage method (after canceling Etel crash if TSY try to |
|
903 // deliver next incoming CB message to Etel). Failing of CB |
|
904 // routing release request shouldn't be possible. |
|
905 ReqCompleted( aTsyReqHandle, ret ); |
|
906 } |
|
907 } |
|
908 else |
|
909 { |
|
910 TFLOGSTRING("TSY:CMmBroadcastTsy::ReceiveMessageCancelL:Routing was not active."); |
|
911 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
912 } |
|
913 |
|
914 return KErrNone; |
|
915 } |
|
916 |
|
917 //---------------------------------------------------------------------------- |
|
918 // CMmBroadcastTsy::CompleteReceiveMessageCancel |
|
919 // This method complete canceling of CB messages routing |
|
920 // (other items were commented in a header). |
|
921 // --------------------------------------------------------------------------- |
|
922 // |
|
923 void CMmBroadcastTsy::CompleteReceiveMessageCancel( |
|
924 TInt aError ) |
|
925 { |
|
926 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteReceiveMessageCancel:error=%d.",aError); |
|
927 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
928 EMultimodeBroadcastReceiveMessageCancel ); |
|
929 |
|
930 if ( reqHandle ) |
|
931 { |
|
932 // This setting must be set to false even if DOS returned error. |
|
933 iCbRoutingActivated = EFalse; |
|
934 |
|
935 if ( KErrNone == aError ) |
|
936 { |
|
937 ReqCompleted( reqHandle, KErrCancel ); |
|
938 } |
|
939 else |
|
940 { |
|
941 ReqCompleted( reqHandle, aError ); |
|
942 } |
|
943 } |
|
944 } |
|
945 |
|
946 //---------------------------------------------------------------------------- |
|
947 // CMmBroadcastTsy::GetFilterSetting |
|
948 // This method returns the current setting for the receipt of |
|
949 // broadcast messages. And completes the request to the client |
|
950 // using ReqCompleted |
|
951 // (other items were commented in a header). |
|
952 // --------------------------------------------------------------------------- |
|
953 // |
|
954 TInt CMmBroadcastTsy::GetFilterSetting( |
|
955 const TTsyReqHandle aTsyReqHandle, |
|
956 RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter* aSetting ) |
|
957 { |
|
958 *aSetting = iCbFilterSetting; |
|
959 TFLOGSTRING2("TSY:CMmBroadcastTsy::GetFilterSetting:Filter setting=0x%x.",iCbFilterSetting); |
|
960 |
|
961 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
962 |
|
963 return KErrNone; |
|
964 } |
|
965 |
|
966 //---------------------------------------------------------------------------- |
|
967 // CMmBroadcastTsy::SetFilterSettingL |
|
968 // This method returns the current setting for the receipt |
|
969 // of broadcast messages |
|
970 // (other items were commented in a header). |
|
971 // --------------------------------------------------------------------------- |
|
972 // |
|
973 TInt CMmBroadcastTsy::SetFilterSettingL( |
|
974 const TTsyReqHandle aTsyReqHandle, |
|
975 RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter const* aSetting ) |
|
976 { |
|
977 TFLOGSTRING3("TSY:CMmBroadcastTsy::SetFilterSettingL:Old filter setting=0x%x, setting to 0x%x.",iCbFilterSetting,*aSetting); |
|
978 if ( ( RMobileBroadcastMessaging::EBroadcastAcceptAll == *aSetting ) || |
|
979 ( RMobileBroadcastMessaging::EBroadcastAcceptNone == *aSetting ) ) |
|
980 { |
|
981 // We can complete this after response from DOS |
|
982 TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle( |
|
983 EMultimodeBroadcastReceiveMessage ); |
|
984 |
|
985 if ( iCbRoutingActivated || |
|
986 ( RMobileBroadcastMessaging::EBroadcastAcceptNone == |
|
987 iCbFilterSetting && |
|
988 reqHandle ) ) |
|
989 { |
|
990 iCbFilterTempSetting = *aSetting; |
|
991 |
|
992 // Create package |
|
993 CMmDataPackage package; |
|
994 |
|
995 TCbsCbmiAndLangAndFilter data; |
|
996 data.iSetting = iCbFilterTempSetting; |
|
997 data.iCbmiStorage = KNullDesC; // deprecated |
|
998 data.iLanguageStorage = KNullDesC; // deprecated |
|
999 |
|
1000 // Pack parameters |
|
1001 package.PackData( &data ); |
|
1002 |
|
1003 // Lets make new routing request so new filter settings can be |
|
1004 // delivered to DOS |
|
1005 TInt ret = iMmPhone->MessageManager()->HandleRequestL( |
|
1006 EMobileBroadcastMessagingSetFilterSetting, &package ); |
|
1007 |
|
1008 if ( KErrNone == ret ) |
|
1009 { |
|
1010 iReqHandleType = EMultimodeBroadcastSetFilterSetting; |
|
1011 } |
|
1012 else |
|
1013 { |
|
1014 // DOS call failed |
|
1015 ReqCompleted( aTsyReqHandle, ret ); |
|
1016 } |
|
1017 } |
|
1018 else |
|
1019 { |
|
1020 iCbFilterSetting = *aSetting; |
|
1021 |
|
1022 // CB routing is not activated. We can complete this now. |
|
1023 CompleteNotifyFilterSettingChange(); |
|
1024 |
|
1025 // Using CompleteNotifyFilterSettingChange() causes iReqHandleType to be modified so that |
|
1026 // the object thinks it has been asked to perform a notification request, rather than a set request. |
|
1027 iReqHandleType = EMultimodeBroadcastReqHandleUnknown; |
|
1028 |
|
1029 ReqCompleted( aTsyReqHandle, KErrNone ); |
|
1030 } |
|
1031 } |
|
1032 else |
|
1033 { |
|
1034 ReqCompleted( aTsyReqHandle, KErrNotSupported ); |
|
1035 } |
|
1036 |
|
1037 return KErrNone; |
|
1038 } |
|
1039 |
|
1040 //---------------------------------------------------------------------------- |
|
1041 // CMmBroadcastTsy::CompleteSetFilterSetting |
|
1042 // This method complete new filter setting sending |
|
1043 // (other items were commented in a header). |
|
1044 // --------------------------------------------------------------------------- |
|
1045 // |
|
1046 void CMmBroadcastTsy::CompleteSetFilterSetting( |
|
1047 TInt aError ) |
|
1048 { |
|
1049 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteSetFilterSetting:error=%d.",aError); |
|
1050 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1051 EMultimodeBroadcastSetFilterSetting ); |
|
1052 |
|
1053 if( reqHandle ) |
|
1054 { |
|
1055 if ( KErrNone == aError ) |
|
1056 { |
|
1057 iCbFilterSetting = iCbFilterTempSetting; |
|
1058 |
|
1059 if ( RMobileBroadcastMessaging::EBroadcastAcceptNone == |
|
1060 iCbFilterSetting ) |
|
1061 { |
|
1062 iCbRoutingActivated = EFalse; |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 iCbRoutingActivated = ETrue; |
|
1067 } |
|
1068 |
|
1069 CompleteNotifyFilterSettingChange(); |
|
1070 } |
|
1071 |
|
1072 if ( reqHandle ) |
|
1073 { |
|
1074 ReqCompleted( reqHandle, aError ); |
|
1075 } |
|
1076 |
|
1077 //complete the cancel request as well |
|
1078 CompleteReceiveMessageCancel( aError ); |
|
1079 } |
|
1080 } |
|
1081 |
|
1082 //---------------------------------------------------------------------------- |
|
1083 // CMmBroadcastTsy::NotifyFilterSettingChange |
|
1084 // This method allows a client to be notified if there is a |
|
1085 // change in the setting for the receipt of broadcast messages |
|
1086 // (other items were commented in a header). |
|
1087 // --------------------------------------------------------------------------- |
|
1088 // |
|
1089 TInt CMmBroadcastTsy::NotifyFilterSettingChange( |
|
1090 RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter* aSetting ) |
|
1091 { |
|
1092 TFLOGSTRING("TSY:CMmBroadcastTsy::NotifyFilterSettingChange."); |
|
1093 iReqHandleType = EMultimodeBroadcastNotifyFilterSetting; |
|
1094 iNotifyFilterSettingChangePtr = aSetting; |
|
1095 |
|
1096 return KErrNone; |
|
1097 } |
|
1098 |
|
1099 //---------------------------------------------------------------------------- |
|
1100 // CMmBroadcastTsy::NotifyFilterSettingChangeCancel |
|
1101 // This method cancels an outstanding asynchronous |
|
1102 // NotifyFilterSettingChange request |
|
1103 // (other items were commented in a header). |
|
1104 // --------------------------------------------------------------------------- |
|
1105 // |
|
1106 TInt CMmBroadcastTsy::NotifyFilterSettingChangeCancel( |
|
1107 const TTsyReqHandle aTsyReqHandle ) |
|
1108 { |
|
1109 TFLOGSTRING("TSY:CMmBroadcastTsy::NotifyFilterSettingChangeCancel."); |
|
1110 iTsyReqHandleStore->ResetTsyReqHandle( |
|
1111 EMultimodeBroadcastNotifyFilterSetting ); |
|
1112 ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
1113 iNotifyFilterSettingChangePtr = NULL; // reset pointer to client memory |
|
1114 |
|
1115 return KErrNone; |
|
1116 } |
|
1117 |
|
1118 //---------------------------------------------------------------------------- |
|
1119 // CMmBroadcastTsy::CompleteNotifyFilterSettingChange |
|
1120 // This method is called when some client change CB Filter Settings |
|
1121 // (other items were commented in a header). |
|
1122 // --------------------------------------------------------------------------- |
|
1123 // |
|
1124 void CMmBroadcastTsy::CompleteNotifyFilterSettingChange() |
|
1125 { |
|
1126 TFLOGSTRING("TSY:CMmBroadcastTsy::CompleteNotifyFilterSettingChange."); |
|
1127 TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( |
|
1128 EMultimodeBroadcastNotifyFilterSetting ); |
|
1129 |
|
1130 if ( reqHandle ) |
|
1131 { |
|
1132 if ( iNotifyFilterSettingChangePtr ) |
|
1133 { |
|
1134 *iNotifyFilterSettingChangePtr = iCbFilterSetting; |
|
1135 TFLOGSTRING2("TSY:CMmBroadcastTsy::CompleteNotifyFilterSettingChange.New filter setting is 0x%x.",iCbFilterSetting); |
|
1136 } |
|
1137 |
|
1138 ReqCompleted( reqHandle, KErrNone ); |
|
1139 } |
|
1140 } |
|
1141 |
|
1142 //---------------------------------------------------------------------------- |
|
1143 // CMmBroadcastTsy::GetBroadcastIdListPhase1L |
|
1144 // CBMI list is returned to the client in two phases. First phase |
|
1145 // returns how many bytes the streamed list is |
|
1146 // (other items were commented in a header). |
|
1147 // --------------------------------------------------------------------------- |
|
1148 // |
|
1149 TInt CMmBroadcastTsy::GetBroadcastIdListPhase1L( |
|
1150 const TTsyReqHandle , |
|
1151 CRetrieveMobilePhoneBroadcastIdList::TGetBroadcastIdRequest const* , |
|
1152 TInt* ) |
|
1153 { |
|
1154 // not supported. |
|
1155 TFLOGSTRING("TSY: CMmBroadcastTsy::GetBroadcastIdListPhase1L"); |
|
1156 return KErrNotSupported; |
|
1157 } |
|
1158 |
|
1159 //---------------------------------------------------------------------------- |
|
1160 // CMmBroadcastTsy::GetBroadcastIdListPhase2 |
|
1161 // CBMI list is returned to the client in two phases. In second |
|
1162 // phase TSY writes the entries into CMobilePhoneCbmiList using |
|
1163 // the AddEntryL method |
|
1164 // (other items were commented in a header). |
|
1165 // --------------------------------------------------------------------------- |
|
1166 // |
|
1167 TInt CMmBroadcastTsy::GetBroadcastIdListPhase2( |
|
1168 const TTsyReqHandle , |
|
1169 RMobilePhone::TClientId const* , |
|
1170 TDes8* ) |
|
1171 { |
|
1172 TFLOGSTRING("TSY:CMmBroadcastTsy::GetBroadcastIdListPhase2.List returned to client."); |
|
1173 return KErrNotSupported; |
|
1174 } |
|
1175 |
|
1176 //---------------------------------------------------------------------------- |
|
1177 // CMmBroadcastTsy::StoreBroadcastIdListL |
|
1178 // This method may be used to store a new version of the entire |
|
1179 // list of CBMI entries |
|
1180 // (other items were commented in a header). |
|
1181 // --------------------------------------------------------------------------- |
|
1182 // |
|
1183 TInt CMmBroadcastTsy::StoreBroadcastIdListL( |
|
1184 const TTsyReqHandle aTsyReqHandle, |
|
1185 TDes8 const* /*aBuffer*/ ) |
|
1186 { |
|
1187 TFLOGSTRING("TSY:CMmBroadcastTsy::StoreBroadcastIdListL."); |
|
1188 ReqCompleted( aTsyReqHandle, KErrNotSupported ); |
|
1189 |
|
1190 return KErrNone; |
|
1191 } |
|
1192 |
|
1193 //---------------------------------------------------------------------------- |
|
1194 // CMmBroadcastTsy::ResetVariables |
|
1195 // Reset used variables |
|
1196 // (other items were commented in a header). |
|
1197 // --------------------------------------------------------------------------- |
|
1198 // |
|
1199 void CMmBroadcastTsy::ResetVariables() |
|
1200 { |
|
1201 // Set accept all to the CB messages fiter setting |
|
1202 iCbFilterSetting = RMobileBroadcastMessaging::EBroadcastAcceptAll; |
|
1203 |
|
1204 // Set CB routing to unactivated |
|
1205 iCbRoutingActivated = EFalse; |
|
1206 |
|
1207 // Resets receive message variables |
|
1208 iReceiveCbMessagePtr = NULL; |
|
1209 iReceiveCbMessageAttributesPtr = NULL; |
|
1210 |
|
1211 // Reset CB notify variables |
|
1212 iNotifyFilterSettingChangePtr = NULL; |
|
1213 } |
|
1214 |
|
1215 #ifdef REQHANDLE_TIMER |
|
1216 //---------------------------------------------------------------------------- |
|
1217 // CMmBroadcastTsy::SetTypeOfResponse |
|
1218 // Sets the type of response for a given Handle. Automatic |
|
1219 // mode includes an automatic response in case of non response |
|
1220 // from the DOS in a specified time |
|
1221 // (other items were commented in a header). |
|
1222 // --------------------------------------------------------------------------- |
|
1223 // |
|
1224 void CMmBroadcastTsy::SetTypeOfResponse( |
|
1225 const TInt aReqHandleType, |
|
1226 const TTsyReqHandle aTsyReqHandle ) |
|
1227 { |
|
1228 TInt timeOut( 0 ); |
|
1229 |
|
1230 // example switch |
|
1231 switch ( aReqHandleType ) |
|
1232 { |
|
1233 case EMultimodeBroadcastReceiveMessageCancel: |
|
1234 timeOut = KMmBroadcastReceiveMessageCancel; |
|
1235 break; |
|
1236 case EMultimodeBroadcastSetFilterSetting: |
|
1237 timeOut = KMmBroadcastSetFilter; |
|
1238 break; |
|
1239 // Must not use timer: |
|
1240 // case EMultimodeBroadcastReceiveMessage: |
|
1241 // case EMultimodeBroadcastNotifyFilterSetting: |
|
1242 default: |
|
1243 // does not use timer |
|
1244 iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType, |
|
1245 aTsyReqHandle ); |
|
1246 break; |
|
1247 } |
|
1248 |
|
1249 if ( timeOut > 0 ) |
|
1250 { |
|
1251 // the timeout parameter is given in seconds. |
|
1252 iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType, aTsyReqHandle, |
|
1253 timeOut ); |
|
1254 } |
|
1255 } |
|
1256 |
|
1257 //---------------------------------------------------------------------------- |
|
1258 // CMmBroadcastTsy::Complete |
|
1259 // Completes the request due timer expiration |
|
1260 // (other items were commented in a header). |
|
1261 // --------------------------------------------------------------------------- |
|
1262 // |
|
1263 void CMmBroadcastTsy::Complete( |
|
1264 TInt aReqHandleType, |
|
1265 TInt aError ) |
|
1266 { |
|
1267 // All possible TSY req handle types are listed in the |
|
1268 // switch case below. |
|
1269 switch( aReqHandleType ) |
|
1270 { |
|
1271 //Cases handled with automatic completion |
|
1272 case EMultimodeBroadcastReceiveMessageCancel: |
|
1273 CompleteReceiveMessageCancel( aError ); |
|
1274 break; |
|
1275 case EMultimodeBroadcastSetFilterSetting: |
|
1276 CompleteSetFilterSetting( aError ); |
|
1277 break; |
|
1278 // Can't use timer: |
|
1279 // case EMultimodeBroadcastReceiveMessage: |
|
1280 // case EMultimodeBroadcastNotifyFilterSetting: |
|
1281 default: |
|
1282 ReqCompleted( iTsyReqHandleStore->ResetTsyReqHandle( |
|
1283 aReqHandleType ), aError ); |
|
1284 break; |
|
1285 } |
|
1286 } |
|
1287 #endif // REQHANDLE_TIMER |
|
1288 |
|
1289 // End of the file |
|
1290 |