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