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 "cmmenstoretsy.h"
|
|
20 |
#include "cmmtsyreqhandlestore.h"
|
|
21 |
#include "CMmPrivateUtility.h"
|
|
22 |
#include "MmTsy_numberOfSlots.h"
|
|
23 |
#include "MmTsy_timeoutdefs.h"
|
|
24 |
#include "cmmmessagemanagerbase.h"
|
|
25 |
#include <ctsy/pluginapi/cmmdatapackage.h>
|
|
26 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
|
|
27 |
|
|
28 |
// ======== MEMBER FUNCTIONS ========
|
|
29 |
|
|
30 |
CMmENStoreTsy::CMmENStoreTsy():
|
|
31 |
iReqHandleType(EMultimodeENStoreReqHandleUnknown)
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
void CMmENStoreTsy::ConstructL()
|
|
36 |
{
|
|
37 |
#ifdef REQHANDLE_TIMER
|
|
38 |
// Create req handle store
|
|
39 |
iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( this,
|
|
40 |
iMmPhone,
|
|
41 |
KMmTsyNumOfENStoreRequests,
|
|
42 |
iStorageReqHandles );
|
|
43 |
#else
|
|
44 |
// Create req handle store
|
|
45 |
iTsyReqHandleStore = CMmTsyReqHandleStore::NewL(
|
|
46 |
KMmTsyNumOfENStoreRequests,
|
|
47 |
iStorageReqHandles );
|
|
48 |
|
|
49 |
#endif
|
|
50 |
|
|
51 |
// Create GSM ENStore objects
|
|
52 |
iMmENStoreGsmExt = static_cast<CMmENStoreExtInterface*>(
|
|
53 |
CMmENStoreGsmExt::NewL( this ) );
|
|
54 |
|
|
55 |
// Set mode GSM
|
|
56 |
iMmENStoreExtInterface = iMmENStoreGsmExt;
|
|
57 |
|
|
58 |
// Construct ReadAllArray
|
|
59 |
iENStoreReadAllArray =
|
|
60 |
new ( ELeave ) CArrayPtrFlat<CListReadAllAttempt>( 1 );
|
|
61 |
|
|
62 |
//register conference call tsy in the message manager
|
|
63 |
iMmPhone->MessageManager()->RegisterTsyObject(
|
|
64 |
CMmMessageManagerBase::EENStoreTsy, this );
|
|
65 |
}
|
|
66 |
|
|
67 |
CMmENStoreTsy* CMmENStoreTsy::NewL(
|
|
68 |
CMmPhoneTsy* aMmPhone )
|
|
69 |
{
|
|
70 |
// Create EN store
|
|
71 |
CMmENStoreTsy* aMmENStoreTsy = new( ELeave ) CMmENStoreTsy();
|
|
72 |
CleanupClosePushL( *aMmENStoreTsy );
|
|
73 |
|
|
74 |
// Set MM Phone and phonet sender pointers
|
|
75 |
aMmENStoreTsy->iMmPhone = aMmPhone;
|
|
76 |
|
|
77 |
// Call construct
|
|
78 |
aMmENStoreTsy->ConstructL();
|
|
79 |
CleanupStack::Pop();
|
|
80 |
|
|
81 |
return aMmENStoreTsy;
|
|
82 |
}
|
|
83 |
|
|
84 |
CMmENStoreTsy::~CMmENStoreTsy()
|
|
85 |
{
|
|
86 |
TFLOGSTRING("TSY: CMmENStoreTsy::~CMmENStoreTsy");
|
|
87 |
|
|
88 |
if (iMmPhone )
|
|
89 |
{
|
|
90 |
// deregister tsy object from message manager
|
|
91 |
iMmPhone->MessageManager()->DeregisterTsyObject( this );
|
|
92 |
}
|
|
93 |
|
|
94 |
// Delete TSY request handle store if it exist
|
|
95 |
if ( NULL != iTsyReqHandleStore )
|
|
96 |
{
|
|
97 |
delete iTsyReqHandleStore;
|
|
98 |
iTsyReqHandleStore = NULL;
|
|
99 |
}
|
|
100 |
|
|
101 |
// Delete ENStoreGsmExt
|
|
102 |
delete iMmENStoreGsmExt;
|
|
103 |
iMmENStoreGsmExt = NULL;
|
|
104 |
|
|
105 |
// Delete ENStoreReadAll array
|
|
106 |
iENStoreReadAllArray->ResetAndDestroy();
|
|
107 |
delete iENStoreReadAllArray;
|
|
108 |
iENStoreReadAllArray = NULL;
|
|
109 |
|
|
110 |
iReadENStoreEntryPtr = 0;
|
|
111 |
iENStoreInfoChanged = 0;
|
|
112 |
iNotifyENStoreEventPtr = 0;
|
|
113 |
iNotifyENStoreEventIndexPtr = 0;
|
|
114 |
iReadAllBufSizePtr = 0;
|
|
115 |
iMmPhone = 0;
|
|
116 |
iMmENStoreExtInterface = 0;
|
|
117 |
iTsyReqHandleStore = 0;
|
|
118 |
}
|
|
119 |
|
|
120 |
// ---------------------------------------------------------------------------
|
|
121 |
// CMmENStoreTsy::Init
|
|
122 |
// Initialisation method that is called from ETel Server.
|
|
123 |
// This is an initialization method for the class functionality.
|
|
124 |
// Generally initization method inits e.g. class attributes.
|
|
125 |
// In this case, this method is not needed.
|
|
126 |
// (other items were commented in a header).
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
void CMmENStoreTsy::Init()
|
|
130 |
{
|
|
131 |
}
|
|
132 |
|
|
133 |
// ---------------------------------------------------------------------------
|
|
134 |
// CMmENStoreTsy::OpenNewObjectByNameL
|
|
135 |
// This method opens extendable sub-sessions.
|
|
136 |
// (other items were commented in a header).
|
|
137 |
// ---------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
CTelObject* CMmENStoreTsy::OpenNewObjectByNameL(
|
|
140 |
const TDesC& )
|
|
141 |
{
|
|
142 |
// Not supported
|
|
143 |
User::Leave( KErrNotSupported );
|
|
144 |
//lint -e{527} "unreachable code"
|
|
145 |
return NULL;
|
|
146 |
}
|
|
147 |
|
|
148 |
// ---------------------------------------------------------------------------
|
|
149 |
// CMmENStoreTsy::OpenNewObjectL
|
|
150 |
// This method opens extendable sub-sessions.
|
|
151 |
// (other items were commented in a header).
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
CTelObject* CMmENStoreTsy::OpenNewObjectL(
|
|
155 |
TDes& )
|
|
156 |
{
|
|
157 |
// Not supported
|
|
158 |
User::Leave( KErrNotSupported );
|
|
159 |
//lint -e{527} "unreachable code"
|
|
160 |
|
|
161 |
return NULL;
|
|
162 |
}
|
|
163 |
|
|
164 |
// ---------------------------------------------------------------------------
|
|
165 |
// CMmENStoreTsy::ReqModeL
|
|
166 |
// To ask what type of flow control is used for the IPC number.
|
|
167 |
// (other items were commented in a header).
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
//
|
|
170 |
CTelObject::TReqMode CMmENStoreTsy::ReqModeL(
|
|
171 |
const TInt aIpc )
|
|
172 |
{
|
|
173 |
CTelObject::TReqMode ret = 0;
|
|
174 |
|
|
175 |
// Match the request IPC
|
|
176 |
switch ( aIpc )
|
|
177 |
{
|
|
178 |
// Non Flow controlled services
|
|
179 |
case EMobilePhoneStoreReadAllPhase2:
|
|
180 |
break;
|
|
181 |
// Flow Controlled Services
|
|
182 |
case EMobilePhoneStoreRead:
|
|
183 |
case EMobilePhoneStoreWrite:
|
|
184 |
case EMobilePhoneStoreDelete:
|
|
185 |
case EMobilePhoneStoreDeleteAll:
|
|
186 |
case EMobilePhoneStoreReadAllPhase1:
|
|
187 |
case EMobilePhoneStoreGetInfo:
|
|
188 |
ret = KReqModeFlowControlObeyed;
|
|
189 |
break;
|
|
190 |
// Multiple Completion Services with Immediate Server Repost
|
|
191 |
// (Usually Notifications)
|
|
192 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
193 |
ret = KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
194 |
break;
|
|
195 |
// Cancel Requests
|
|
196 |
// Listed here just for reference
|
|
197 |
// case EMobilePhoneStoreGetInfoCancel:
|
|
198 |
// case EMobilePhoneStoreReadCancel:
|
|
199 |
// case EMobilePhoneStoreWriteCancel:
|
|
200 |
// case EMobilePhoneStoreDeleteCancel:
|
|
201 |
// case EMobilePhoneStoreDeleteAllCancel:
|
|
202 |
// case EMobilePhoneStoreReadAllCancel:
|
|
203 |
// case EMobilePhoneStoreNotifyStoreEventCancel:
|
|
204 |
default:
|
|
205 |
User::Leave( KErrNotSupported );
|
|
206 |
}
|
|
207 |
|
|
208 |
return ret;
|
|
209 |
}
|
|
210 |
|
|
211 |
// ---------------------------------------------------------------------------
|
|
212 |
// CMmENStoreTsy::RegisterNotification
|
|
213 |
// Enables the TSY to "turn on" any regular notification.
|
|
214 |
// (other items were commented in a header).
|
|
215 |
// ---------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
TInt CMmENStoreTsy::RegisterNotification(
|
|
218 |
const TInt aIpc )
|
|
219 |
{
|
|
220 |
// Initalize ret value
|
|
221 |
TInt ret( KErrNotSupported );
|
|
222 |
|
|
223 |
// Match the request IPC
|
|
224 |
switch ( aIpc )
|
|
225 |
{
|
|
226 |
// Not supported, but for possible future use
|
|
227 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
228 |
ret = KErrNone;
|
|
229 |
break;
|
|
230 |
|
|
231 |
default:
|
|
232 |
// Unknown or invalid IPC.
|
|
233 |
// ret already initialized KErrNotSupported,
|
|
234 |
// do nothing
|
|
235 |
break;
|
|
236 |
}
|
|
237 |
|
|
238 |
return ret;
|
|
239 |
}
|
|
240 |
|
|
241 |
// ---------------------------------------------------------------------------
|
|
242 |
// CMmENStoreTsy::DeregisterNotification
|
|
243 |
// Enables the TSY to "turn off" any regular notification.
|
|
244 |
// (other items were commented in a header).
|
|
245 |
// ---------------------------------------------------------------------------
|
|
246 |
//
|
|
247 |
TInt CMmENStoreTsy::DeregisterNotification(
|
|
248 |
const TInt aIpc )
|
|
249 |
{
|
|
250 |
// Initalize ret value
|
|
251 |
TInt ret( KErrNotSupported );
|
|
252 |
|
|
253 |
// Match the request IPC
|
|
254 |
switch ( aIpc )
|
|
255 |
{
|
|
256 |
// Not supported, but for possible future use
|
|
257 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
258 |
ret = KErrNone;
|
|
259 |
break;
|
|
260 |
|
|
261 |
default:
|
|
262 |
// Unknown or invalid IPC.
|
|
263 |
// ret already initialized KErrNotSupported,
|
|
264 |
// do nothing
|
|
265 |
break;
|
|
266 |
}
|
|
267 |
|
|
268 |
return ret;
|
|
269 |
}
|
|
270 |
|
|
271 |
// ---------------------------------------------------------------------------
|
|
272 |
// CMmENStoreTsy::NumberOfSlotsL
|
|
273 |
// To ask the TSY how big buffer it wants.
|
|
274 |
// (other items were commented in a header).
|
|
275 |
// ---------------------------------------------------------------------------
|
|
276 |
//
|
|
277 |
TInt CMmENStoreTsy::NumberOfSlotsL(
|
|
278 |
const TInt aIpc )
|
|
279 |
{
|
|
280 |
// Initialize number of slots to one
|
|
281 |
TInt numberOfSlots = 1;
|
|
282 |
|
|
283 |
// Match IPC
|
|
284 |
switch ( aIpc )
|
|
285 |
{
|
|
286 |
// Not supported, but for possible future use
|
|
287 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
288 |
numberOfSlots = KMmENStoreNotifyStoreEventSlots;
|
|
289 |
break;
|
|
290 |
|
|
291 |
default:
|
|
292 |
// Unknown or invalid EN storage IPC
|
|
293 |
User::Leave( KErrNotSupported );
|
|
294 |
break;
|
|
295 |
}
|
|
296 |
|
|
297 |
return numberOfSlots;
|
|
298 |
}
|
|
299 |
|
|
300 |
// ---------------------------------------------------------------------------
|
|
301 |
// CMmENStoreTsy::ExtFunc
|
|
302 |
// Handling of extended requests.
|
|
303 |
// (other items were commented in a header).
|
|
304 |
// ---------------------------------------------------------------------------
|
|
305 |
//
|
|
306 |
TInt CMmENStoreTsy::ExtFunc(
|
|
307 |
const TTsyReqHandle aTsyReqHandle,
|
|
308 |
const TInt aIpc,
|
|
309 |
const TDataPackage& aPackage )
|
|
310 |
{
|
|
311 |
// Initialize ret and trap error
|
|
312 |
TInt ret = KErrNone;
|
|
313 |
TInt trapError = KErrNone;
|
|
314 |
|
|
315 |
// Ensure the ReqHandleType is unset.
|
|
316 |
// This will detect cases where this method indirectly calls itself
|
|
317 |
// (e.g. servicing a client call that causes a self-reposting notification to complete and thus repost).
|
|
318 |
// Such cases are not supported because iReqHandleType is in the context of this class instance,
|
|
319 |
// not this request, and we don't want the values set by the inner request and the outer request
|
|
320 |
// interfering with each other.
|
|
321 |
__ASSERT_DEBUG(iReqHandleType==EMultimodeENStoreReqHandleUnknown, User::Invariant());
|
|
322 |
|
|
323 |
// Trap and call function that dispatches function requests
|
|
324 |
TRAP ( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ); );
|
|
325 |
|
|
326 |
// Check was there an error
|
|
327 |
if ( trapError != KErrNone )
|
|
328 |
{
|
|
329 |
// Complete with error if trap error
|
|
330 |
ReqCompleted( aTsyReqHandle, trapError );
|
|
331 |
}
|
|
332 |
else if ( ret != KErrNone )
|
|
333 |
{
|
|
334 |
// Complete with error if return value error
|
|
335 |
ReqCompleted( aTsyReqHandle, ret );
|
|
336 |
}
|
|
337 |
|
|
338 |
// Save request handle
|
|
339 |
if ( EMultimodeENStoreReqHandleUnknown != iReqHandleType )
|
|
340 |
{
|
|
341 |
#ifdef REQHANDLE_TIMER
|
|
342 |
SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
|
|
343 |
#else
|
|
344 |
iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, aTsyReqHandle );
|
|
345 |
#endif
|
|
346 |
// We've finished with this value now. Clear it so it doesn't leak
|
|
347 |
// up to any other instances of this method down the call stack
|
|
348 |
iReqHandleType = EMultimodeENStoreReqHandleUnknown;
|
|
349 |
}
|
|
350 |
|
|
351 |
return KErrNone;
|
|
352 |
}
|
|
353 |
|
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
// CMmENStoreTsy::DoExtFuncL
|
|
356 |
// Dispatches extension function requests.
|
|
357 |
// (other items were commented in a header).
|
|
358 |
// ---------------------------------------------------------------------------
|
|
359 |
//
|
|
360 |
TInt CMmENStoreTsy::DoExtFuncL(
|
|
361 |
const TTsyReqHandle aTsyReqHandle,
|
|
362 |
const TInt aIpc,
|
|
363 |
const TDataPackage& aPackage )
|
|
364 |
{
|
|
365 |
|
|
366 |
// Initialize return value
|
|
367 |
TInt ret( KErrNotSupported );
|
|
368 |
|
|
369 |
TAny* dataPtr = aPackage.Ptr1();
|
|
370 |
TAny* dataPtr2 = aPackage.Ptr2();
|
|
371 |
|
|
372 |
switch ( aIpc )
|
|
373 |
{
|
|
374 |
case EMobilePhoneStoreRead:
|
|
375 |
ret = Read( aTsyReqHandle, aPackage.Des1n() );
|
|
376 |
break;
|
|
377 |
case EMobilePhoneStoreGetInfo:
|
|
378 |
ret = GetInfo(
|
|
379 |
REINTERPRET_CAST( RMobilePhoneStore::TMobilePhoneStoreInfoV1*,
|
|
380 |
dataPtr ) );
|
|
381 |
break;
|
|
382 |
case EMobilePhoneStoreReadAllPhase1:
|
|
383 |
ret = ReadAllPhase1( aTsyReqHandle,
|
|
384 |
REINTERPRET_CAST( RMobilePhone::TClientId*, dataPtr ),
|
|
385 |
REINTERPRET_CAST( TInt*, dataPtr2 ) );
|
|
386 |
break;
|
|
387 |
case EMobilePhoneStoreReadAllPhase2:
|
|
388 |
ret = ReadAllPhase2( aTsyReqHandle,
|
|
389 |
REINTERPRET_CAST( RMobilePhone::TClientId*, dataPtr ),
|
|
390 |
aPackage.Des2n() );
|
|
391 |
break;
|
|
392 |
|
|
393 |
// Not supported functions completes here
|
|
394 |
// EMobilePhoneStoreWrite
|
|
395 |
// EMobilePhoneStoreDelete
|
|
396 |
// EMobilePhoneStoreDeleteAll
|
|
397 |
// EMobilePhoneStoreNotifyStoreEvent
|
|
398 |
default:
|
|
399 |
// Do nothing, ret already set KErrNotSupported
|
|
400 |
break;
|
|
401 |
}
|
|
402 |
|
|
403 |
return ret;
|
|
404 |
}
|
|
405 |
|
|
406 |
// ---------------------------------------------------------------------------
|
|
407 |
// CMmENStoreTsy::CancelService
|
|
408 |
// To cancel any extension requests.
|
|
409 |
// (other items were commented in a header).
|
|
410 |
// ---------------------------------------------------------------------------
|
|
411 |
//
|
|
412 |
TInt CMmENStoreTsy::CancelService(
|
|
413 |
const TInt aIpc,
|
|
414 |
const TTsyReqHandle aTsyReqHandle )
|
|
415 |
{
|
|
416 |
// Initialize return value
|
|
417 |
TInt ret( KErrGeneral );
|
|
418 |
|
|
419 |
// Match cancel request using IPC
|
|
420 |
switch ( aIpc )
|
|
421 |
{
|
|
422 |
case EMobilePhoneStoreGetInfo:
|
|
423 |
ret = GetInfoCancel( aTsyReqHandle );
|
|
424 |
break;
|
|
425 |
case EMobilePhoneStoreRead:
|
|
426 |
ret = ReadCancel( aTsyReqHandle );
|
|
427 |
break;
|
|
428 |
case EMobilePhoneStoreReadAllPhase1:
|
|
429 |
case EMobilePhoneStoreReadAllPhase2:
|
|
430 |
ret = ReadAllCancel( aTsyReqHandle );
|
|
431 |
break;
|
|
432 |
// Not possible to call cancel functions below because
|
|
433 |
// request function is not supported, and returns immediately.
|
|
434 |
// these functions will never even called. Added here just to
|
|
435 |
// possible future purpose.
|
|
436 |
// case EMobilePhoneStoreWrite:
|
|
437 |
// case EMobilePhoneStoreDelete:
|
|
438 |
// case EMobilePhoneStoreDeleteAll:
|
|
439 |
// case EMobilePhoneStoreNotifyStoreEvent:
|
|
440 |
default:
|
|
441 |
// Do nothing, ret initialized KErrGeneral
|
|
442 |
break;
|
|
443 |
}
|
|
444 |
|
|
445 |
return ret;
|
|
446 |
}
|
|
447 |
|
|
448 |
// ---------------------------------------------------------------------------
|
|
449 |
// CMmENStoreTsy::Read
|
|
450 |
// Read one entry from EN store.
|
|
451 |
// (other items were commented in a header).
|
|
452 |
// ---------------------------------------------------------------------------
|
|
453 |
//
|
|
454 |
TInt CMmENStoreTsy::Read(
|
|
455 |
const TTsyReqHandle aTsyReqHandle,
|
|
456 |
TDes8* aEntry )
|
|
457 |
{
|
|
458 |
TInt ret( KErrArgument );
|
|
459 |
|
|
460 |
// Unpack entry parameters
|
|
461 |
RMobileENStore::TMobileENEntryV1Pckg* entryPckg = REINTERPRET_CAST
|
|
462 |
( RMobileENStore::TMobileENEntryV1Pckg*, aEntry );
|
|
463 |
RMobileENStore::TMobileENEntryV1& entry = ( *entryPckg )();
|
|
464 |
|
|
465 |
// Check that client uses valid location index
|
|
466 |
if (0 < entry.iIndex && sizeof( RMobileENStore::TMobileENEntryV1 ) <= aEntry->MaxLength())
|
|
467 |
{
|
|
468 |
// Forward request to GSM Extension
|
|
469 |
ret = iMmENStoreExtInterface->Read(
|
|
470 |
EMmTsyENStoreReadIPC, entry.iIndex );
|
|
471 |
}
|
|
472 |
|
|
473 |
// ISI message construction failed or phonet sender returned error
|
|
474 |
if ( KErrNone != ret )
|
|
475 |
{
|
|
476 |
ReqCompleted( aTsyReqHandle, ret );
|
|
477 |
}
|
|
478 |
else
|
|
479 |
{
|
|
480 |
// Save tsy req handle type
|
|
481 |
iReqHandleType = EMultimodeENStoreRead;
|
|
482 |
|
|
483 |
// Set internal EN entry pointer
|
|
484 |
iReadENStoreEntryPtr = aEntry;
|
|
485 |
}
|
|
486 |
|
|
487 |
return KErrNone;
|
|
488 |
}
|
|
489 |
|
|
490 |
// ---------------------------------------------------------------------------
|
|
491 |
// CMmENStoreTsy::CompleteRead
|
|
492 |
// Complete read one entry from EN store
|
|
493 |
// (other items were commented in a header).
|
|
494 |
// ---------------------------------------------------------------------------
|
|
495 |
//
|
|
496 |
void CMmENStoreTsy::CompleteRead(
|
|
497 |
TInt aResult,
|
|
498 |
CMmDataPackage* aDataPackage )
|
|
499 |
{
|
|
500 |
// Reset req handle. Returns the deleted req handle
|
|
501 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
502 |
EMultimodeENStoreRead );
|
|
503 |
|
|
504 |
// Check that request handle was valid
|
|
505 |
if ( EMultimodeENStoreReqHandleUnknown != reqHandle )
|
|
506 |
{
|
|
507 |
if ( KErrNone == aResult )
|
|
508 |
{
|
|
509 |
// Response information
|
|
510 |
TENStoreResponse* enStoreResp = NULL;
|
|
511 |
|
|
512 |
//unpack data
|
|
513 |
if ( aDataPackage )
|
|
514 |
{
|
|
515 |
aDataPackage->UnPackData( &enStoreResp );
|
|
516 |
}
|
|
517 |
|
|
518 |
// Get entry
|
|
519 |
RMobileENStore::TMobileENEntryV1Pckg* entryPckg =
|
|
520 |
REINTERPRET_CAST( RMobileENStore::TMobileENEntryV1Pckg*,
|
|
521 |
iReadENStoreEntryPtr );
|
|
522 |
RMobileENStore::TMobileENEntryV1& entry = ( *entryPckg )();
|
|
523 |
|
|
524 |
// Fill TMobileENEntryV1 entry
|
|
525 |
// OBS! iCountryCode, iIdentity
|
|
526 |
// iAlphaId cannot be filled, no info from SIM Server
|
|
527 |
entry.iNetworkSpecific = EFalse;
|
|
528 |
entry.iMode = RMobilePhone::ENetworkModeUnknown;
|
|
529 |
|
|
530 |
if ( &enStoreResp )
|
|
531 |
{
|
|
532 |
entry.iNumber.Copy( enStoreResp->iECCNumber );
|
|
533 |
entry.iIndex = enStoreResp->iLocation;
|
|
534 |
}
|
|
535 |
|
|
536 |
//Complete request to success
|
|
537 |
ReqCompleted( reqHandle, KErrNone );
|
|
538 |
}
|
|
539 |
else
|
|
540 |
{
|
|
541 |
// Complete with error
|
|
542 |
ReqCompleted( reqHandle, aResult );
|
|
543 |
}
|
|
544 |
}
|
|
545 |
}
|
|
546 |
|
|
547 |
// ---------------------------------------------------------------------------
|
|
548 |
// CMmENStoreTsy::ReadCancel
|
|
549 |
// Cancel read one entry from EN store
|
|
550 |
// (other items were commented in a header).
|
|
551 |
// ---------------------------------------------------------------------------
|
|
552 |
//
|
|
553 |
TInt CMmENStoreTsy::ReadCancel(
|
|
554 |
const TTsyReqHandle aTsyReqHandle )
|
|
555 |
{
|
|
556 |
iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeENStoreRead );
|
|
557 |
|
|
558 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
559 |
|
|
560 |
return KErrNone;
|
|
561 |
}
|
|
562 |
|
|
563 |
// ---------------------------------------------------------------------------
|
|
564 |
// CMmENStoreTsy::GetInfo
|
|
565 |
// Get EN store info (capabilities)
|
|
566 |
// (other items were commented in a header).
|
|
567 |
// ---------------------------------------------------------------------------
|
|
568 |
//
|
|
569 |
TInt CMmENStoreTsy::GetInfo(
|
|
570 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1* aInfo )
|
|
571 |
{
|
|
572 |
// Initialize ret value
|
|
573 |
TInt ret( KErrNone );
|
|
574 |
|
|
575 |
// if aInfo is not correct type, complete request with KErrArgument
|
|
576 |
if( RMobilePhoneStore::KETelMobilePhoneStoreV1 != aInfo->ExtensionId() )
|
|
577 |
{
|
|
578 |
ret = KErrArgument;
|
|
579 |
}
|
|
580 |
|
|
581 |
else
|
|
582 |
{
|
|
583 |
// Set get info internal pointer
|
|
584 |
iENStoreInfoChanged = aInfo;
|
|
585 |
|
|
586 |
// Request to GSM extension, get used entries,
|
|
587 |
// -1 as a index param-> specified location param not needed
|
|
588 |
ret = iMmENStoreExtInterface->Read( EMmTsyENStoreGetInfoIPC, -1 );
|
|
589 |
|
|
590 |
if ( ret == KErrNone )
|
|
591 |
{
|
|
592 |
iReqHandleType = EMultimodeENStoreGetInfo;
|
|
593 |
}
|
|
594 |
|
|
595 |
}
|
|
596 |
|
|
597 |
return ret;
|
|
598 |
}
|
|
599 |
|
|
600 |
// ---------------------------------------------------------------------------
|
|
601 |
// CMmENStoreTsy::CompleteGetInfo
|
|
602 |
// Complete get EN store info (capabilities)
|
|
603 |
// (other items were commented in a header).
|
|
604 |
// ---------------------------------------------------------------------------
|
|
605 |
//
|
|
606 |
void CMmENStoreTsy::CompleteGetInfo(
|
|
607 |
TInt aResult,
|
|
608 |
CMmDataPackage* aDataPackage )
|
|
609 |
{
|
|
610 |
// Reset req handle. Returns the deleted req handle
|
|
611 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
612 |
EMultimodeENStoreGetInfo );
|
|
613 |
|
|
614 |
// Request handle was valid
|
|
615 |
if ( EMultimodeENStoreReqHandleUnknown != reqHandle )
|
|
616 |
{
|
|
617 |
// No errors
|
|
618 |
if ( KErrNone == aResult )
|
|
619 |
{
|
|
620 |
// The number of used entries
|
|
621 |
TInt usedEntries( 0 );
|
|
622 |
|
|
623 |
// Unpack data
|
|
624 |
if ( aDataPackage )
|
|
625 |
{
|
|
626 |
aDataPackage->UnPackData( usedEntries );
|
|
627 |
}
|
|
628 |
|
|
629 |
// The name of the store
|
|
630 |
iENStoreInfoChanged->iName = KETelEmergencyNumberStore;
|
|
631 |
|
|
632 |
// The type of entry in the phone-side store
|
|
633 |
iENStoreInfoChanged->iType =
|
|
634 |
RMobilePhoneStore::EEmergencyNumberStore;
|
|
635 |
|
|
636 |
// Indicates the capabilities of the store
|
|
637 |
// EN store can be only read one entry at time or whole store.
|
|
638 |
// Write and delete is prohibited.
|
|
639 |
iENStoreInfoChanged->iCaps = KENStoreCaps;
|
|
640 |
|
|
641 |
// Indicates the current number of used entries
|
|
642 |
iENStoreInfoChanged->iUsedEntries = usedEntries;
|
|
643 |
|
|
644 |
// Indicates the total numbetr of entries, GSM 11.11
|
|
645 |
iENStoreInfoChanged->iTotalEntries = KEccStorageNumberMaxCount;
|
|
646 |
}
|
|
647 |
|
|
648 |
ReqCompleted( reqHandle, aResult );
|
|
649 |
}
|
|
650 |
}
|
|
651 |
|
|
652 |
// ---------------------------------------------------------------------------
|
|
653 |
// CMmENStoreTsy::GetInfoCancel
|
|
654 |
// Cancel get EN store info (capabilities)
|
|
655 |
// (other items were commented in a header).
|
|
656 |
// ---------------------------------------------------------------------------
|
|
657 |
//
|
|
658 |
TInt CMmENStoreTsy::GetInfoCancel(
|
|
659 |
const TTsyReqHandle aTsyReqHandle )
|
|
660 |
{
|
|
661 |
iTsyReqHandleStore->ResetTsyReqHandle( EMultimodeENStoreGetInfo );
|
|
662 |
|
|
663 |
// Complete with KErrCancel
|
|
664 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
665 |
|
|
666 |
return KErrNone;
|
|
667 |
}
|
|
668 |
|
|
669 |
// ---------------------------------------------------------------------------
|
|
670 |
// CMmENStoreTsy::ReadAllPhase1
|
|
671 |
// Read all EN store entries, first phase
|
|
672 |
// (other items were commented in a header).
|
|
673 |
// ---------------------------------------------------------------------------
|
|
674 |
//
|
|
675 |
TInt CMmENStoreTsy::ReadAllPhase1(
|
|
676 |
const TTsyReqHandle aTsyReqHandle,
|
|
677 |
const RMobilePhone::TClientId* aId,
|
|
678 |
TInt* aBufSize )
|
|
679 |
{
|
|
680 |
// Initialize ret value
|
|
681 |
TInt ret( KErrNone );
|
|
682 |
|
|
683 |
// Set buffer size and client ID
|
|
684 |
iReadAllBufSizePtr = aBufSize;
|
|
685 |
iReadAllId = *aId;
|
|
686 |
|
|
687 |
// Request to GSM extension
|
|
688 |
ret = iMmENStoreExtInterface->Read( EMmTsyENStoreReadAllPhase1IPC, -1 );
|
|
689 |
|
|
690 |
// error returned
|
|
691 |
if ( KErrNone != ret )
|
|
692 |
{
|
|
693 |
ReqCompleted( aTsyReqHandle, ret );
|
|
694 |
}
|
|
695 |
else
|
|
696 |
{
|
|
697 |
// Save tsy req handle type
|
|
698 |
iReqHandleType = EMultimodeENStoreReadAll;
|
|
699 |
}
|
|
700 |
|
|
701 |
return KErrNone;
|
|
702 |
}
|
|
703 |
|
|
704 |
// ---------------------------------------------------------------------------
|
|
705 |
// CMmENStoreTsy::CompleteReadAllPhase1L
|
|
706 |
// Read all EN store entries, complete first phase
|
|
707 |
// (other items were commented in a header).
|
|
708 |
// ---------------------------------------------------------------------------
|
|
709 |
//
|
|
710 |
TInt CMmENStoreTsy::CompleteReadAllPhase1L(
|
|
711 |
TInt aResult,
|
|
712 |
CMmDataPackage* aDataPackage )
|
|
713 |
{
|
|
714 |
// EN number array
|
|
715 |
CArrayPtrFlat<TENStoreResponse>* ECCArray = NULL;
|
|
716 |
//unpack data
|
|
717 |
// Reset req handle. Returns the deleted req handle
|
|
718 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
719 |
EMultimodeENStoreReadAll );
|
|
720 |
|
|
721 |
// Check that the request is still ongoing
|
|
722 |
if ( EMultimodeENStoreReqHandleUnknown != reqHandle )
|
|
723 |
{
|
|
724 |
// Check aError is KErrNone and aECCArray contains entries
|
|
725 |
if ( KErrNone == aResult )
|
|
726 |
{
|
|
727 |
aDataPackage->UnPackData( ECCArray );
|
|
728 |
|
|
729 |
// Read the list, store its content and then return size of this
|
|
730 |
// buffer to client
|
|
731 |
CMobilePhoneENList* list = CMobilePhoneENList::NewL();
|
|
732 |
CleanupStack::PushL( list );
|
|
733 |
|
|
734 |
// Create an entry variable to fill ENStore list
|
|
735 |
RMobileENStore::TMobileENEntryV1 entry;
|
|
736 |
|
|
737 |
//Reset iCountryCode, iIdentity and iAlphaId. We can't provide
|
|
738 |
//this information
|
|
739 |
entry.iCountryCode.Zero();
|
|
740 |
entry.iIdentity.Zero();
|
|
741 |
entry.iAlphaId.Zero();
|
|
742 |
|
|
743 |
entry.iNetworkSpecific = ETrue;
|
|
744 |
entry.iMode = RMobilePhone::ENetworkModeGsm;
|
|
745 |
|
|
746 |
// Loop until TSY's internal ENStorage is empty
|
|
747 |
while ( !( 0 == ECCArray->Count() ) )
|
|
748 |
{
|
|
749 |
// Used entry is always deleted at the end of this loop, and
|
|
750 |
// then compressed. Therefore first item always red.
|
|
751 |
TENStoreResponse* enStoreMsg = ECCArray->At( 0 );
|
|
752 |
|
|
753 |
entry.iNumber.SetLength( 0 ); //Set length to 0 before copying
|
|
754 |
entry.iNumber.Copy( enStoreMsg->iECCNumber );
|
|
755 |
entry.iIndex = enStoreMsg->iLocation;
|
|
756 |
|
|
757 |
// Add to ENStore list
|
|
758 |
list->AddEntryL( entry );
|
|
759 |
|
|
760 |
// Delete internal list member
|
|
761 |
delete enStoreMsg;
|
|
762 |
ECCArray->Delete( 0 );
|
|
763 |
ECCArray->Compress();
|
|
764 |
}
|
|
765 |
|
|
766 |
// Store the streamed list and the client ID
|
|
767 |
CListReadAllAttempt* read =
|
|
768 |
CListReadAllAttempt::NewL( &iReadAllId );
|
|
769 |
CleanupStack::PushL( read );
|
|
770 |
|
|
771 |
// Set list
|
|
772 |
read->iListBuf = list->StoreLC();
|
|
773 |
CleanupStack::Pop(); // Pop the CBufFlat allocated by StoreLC
|
|
774 |
|
|
775 |
// Append list EN entry array
|
|
776 |
iENStoreReadAllArray->AppendL( read );
|
|
777 |
CleanupStack::Pop( read ); // Pop the CListReadAllAttempt
|
|
778 |
|
|
779 |
// Return the CBufFlat’s size to client
|
|
780 |
*iReadAllBufSizePtr = ( read->iListBuf )->Size();
|
|
781 |
|
|
782 |
// Complete first phase of list retrieval
|
|
783 |
ReqCompleted( reqHandle, KErrNone );
|
|
784 |
CleanupStack::PopAndDestroy( list ); // Pop & destroy list
|
|
785 |
}
|
|
786 |
// PMM store doesn't contain emergency numbers
|
|
787 |
else
|
|
788 |
{
|
|
789 |
ReqCompleted( reqHandle, aResult );
|
|
790 |
}
|
|
791 |
}
|
|
792 |
return KErrNone;
|
|
793 |
}
|
|
794 |
|
|
795 |
// ---------------------------------------------------------------------------
|
|
796 |
// CMmENStoreTsy::ReadAllPhase2
|
|
797 |
// Read all EN store entries, second phase
|
|
798 |
// (other items were commented in a header).
|
|
799 |
// ---------------------------------------------------------------------------
|
|
800 |
//
|
|
801 |
TInt CMmENStoreTsy::ReadAllPhase2(
|
|
802 |
TTsyReqHandle aTsyReqHandle,
|
|
803 |
const RMobilePhone::TClientId* aId,
|
|
804 |
TDes8* aBuffer )
|
|
805 |
{
|
|
806 |
// Initialize ret value
|
|
807 |
TInt ret( KErrCorrupt );
|
|
808 |
|
|
809 |
// Set read pointer to NULL
|
|
810 |
CListReadAllAttempt* read = NULL;
|
|
811 |
|
|
812 |
// Find the read attempt from this client
|
|
813 |
for ( TInt i = 0; ( i < iENStoreReadAllArray->Count() ) &&
|
|
814 |
( KErrCorrupt == ret ); ++i )
|
|
815 |
{
|
|
816 |
// Get and set item from array
|
|
817 |
// This is not deleted later on within this function if session
|
|
818 |
// handle and subsession handle does not match.
|
|
819 |
// Someone else 'owns' this data.
|
|
820 |
read = iENStoreReadAllArray->At( i );
|
|
821 |
|
|
822 |
// Check that session and client are rigth ones
|
|
823 |
if ( ( read->iClient.iSessionHandle == aId->iSessionHandle ) &&
|
|
824 |
( read->iClient.iSubSessionHandle == aId->iSubSessionHandle ) )
|
|
825 |
{
|
|
826 |
// Set pointer to list buffer
|
|
827 |
TPtr8 bufPtr( ( read->iListBuf )->Ptr( 0 ) );
|
|
828 |
// Copy the streamed list to the client
|
|
829 |
aBuffer->Copy( bufPtr );
|
|
830 |
|
|
831 |
// Delete read and item from internal array
|
|
832 |
delete read;
|
|
833 |
iENStoreReadAllArray->Delete( i );
|
|
834 |
|
|
835 |
// Complete request
|
|
836 |
ReqCompleted( aTsyReqHandle, KErrNone );
|
|
837 |
// Set ret to KErrNone so that loop can exit
|
|
838 |
ret = KErrNone;
|
|
839 |
}
|
|
840 |
}
|
|
841 |
|
|
842 |
// Check ret value
|
|
843 |
if ( KErrCorrupt == ret )
|
|
844 |
{
|
|
845 |
// Doesn't found the matching client for read all phase 1
|
|
846 |
iENStoreReadAllArray->ResetAndDestroy();
|
|
847 |
ReqCompleted( aTsyReqHandle, ret );
|
|
848 |
}
|
|
849 |
|
|
850 |
return KErrNone;
|
|
851 |
}
|
|
852 |
|
|
853 |
// ---------------------------------------------------------------------------
|
|
854 |
// CMmENStoreTsy::ReadAllCancel
|
|
855 |
// Cancel read all EN store entries
|
|
856 |
// (other items were commented in a header).
|
|
857 |
// ---------------------------------------------------------------------------
|
|
858 |
//
|
|
859 |
TInt CMmENStoreTsy::ReadAllCancel(
|
|
860 |
const TTsyReqHandle aTsyReqHandle )
|
|
861 |
{
|
|
862 |
// Reset req handle. Returns the deleted req handle
|
|
863 |
iTsyReqHandleStore->ResetTsyReqHandle(
|
|
864 |
EMultimodeENStoreReadAll );
|
|
865 |
|
|
866 |
// Remove the read all attempt
|
|
867 |
CListReadAllAttempt* read = NULL;
|
|
868 |
|
|
869 |
// Check that read all array does not contain any data.
|
|
870 |
// If it does, delete it.
|
|
871 |
// NOTE: functions request mode "Flow control obeyed" currently blocks
|
|
872 |
// request so that only one client can request data at the time.
|
|
873 |
// Therefore, loop-functionality is not needed.
|
|
874 |
// Just check that is there
|
|
875 |
if ( iENStoreReadAllArray->Count() > 0x0 )
|
|
876 |
{
|
|
877 |
read = iENStoreReadAllArray->At( 0 );
|
|
878 |
delete read;
|
|
879 |
iENStoreReadAllArray->Delete( 0 );
|
|
880 |
}
|
|
881 |
|
|
882 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
883 |
|
|
884 |
return KErrNone;
|
|
885 |
}
|
|
886 |
|
|
887 |
#ifdef REQHANDLE_TIMER
|
|
888 |
// ---------------------------------------------------------------------------
|
|
889 |
// CMmENStoreTsy::SetTypeOfResponse
|
|
890 |
// Gets the type of response for a given Handle.
|
|
891 |
// (other items were commented in a header).
|
|
892 |
// ---------------------------------------------------------------------------
|
|
893 |
//
|
|
894 |
void CMmENStoreTsy::SetTypeOfResponse(
|
|
895 |
const TInt aReqHandleType,
|
|
896 |
const TTsyReqHandle aTsyReqHandle )
|
|
897 |
{
|
|
898 |
TInt timeOut( 0 );
|
|
899 |
|
|
900 |
//example switch
|
|
901 |
switch ( aReqHandleType )
|
|
902 |
{
|
|
903 |
case EMultimodeENStoreRead:
|
|
904 |
timeOut = KMmENStoreReadTimeOut;
|
|
905 |
break;
|
|
906 |
case EMultimodeENStoreGetInfo:
|
|
907 |
timeOut = KMmENGetInfoTimeOut;
|
|
908 |
break;
|
|
909 |
|
|
910 |
//Must not use timer:
|
|
911 |
// - all notifications
|
|
912 |
//case EMultimodeENStoreNotifyStoreEvent:
|
|
913 |
// - 2nd phase methods (when two phase lists are used)
|
|
914 |
//case EMultimodeENStoreReadAll
|
|
915 |
default:
|
|
916 |
//does not use timer
|
|
917 |
iTsyReqHandleStore->SetTsyReqHandle(
|
|
918 |
aReqHandleType,
|
|
919 |
aTsyReqHandle );
|
|
920 |
break;
|
|
921 |
}
|
|
922 |
|
|
923 |
if ( timeOut > 0 )
|
|
924 |
{
|
|
925 |
//the timeout parameter is given in seconds.
|
|
926 |
iTsyReqHandleStore->SetTsyReqHandle(
|
|
927 |
aReqHandleType,
|
|
928 |
aTsyReqHandle,
|
|
929 |
timeOut );
|
|
930 |
}
|
|
931 |
}
|
|
932 |
|
|
933 |
// ---------------------------------------------------------------------------
|
|
934 |
// CMmENStoreTsy::Complete
|
|
935 |
// Completes the request due timer expiration
|
|
936 |
// (other items were commented in a header).
|
|
937 |
// ---------------------------------------------------------------------------
|
|
938 |
//
|
|
939 |
void CMmENStoreTsy::Complete(
|
|
940 |
TInt aReqHandleType,
|
|
941 |
TInt aError )
|
|
942 |
{
|
|
943 |
//All possible TSY req handle types are listed in the
|
|
944 |
//switch case below.
|
|
945 |
switch( aReqHandleType )
|
|
946 |
{
|
|
947 |
case EMultimodeENStoreRead:
|
|
948 |
CompleteRead( aError, NULL );
|
|
949 |
break;
|
|
950 |
case EMultimodeENStoreGetInfo:
|
|
951 |
CompleteGetInfo( aError, NULL );
|
|
952 |
break;
|
|
953 |
|
|
954 |
//Can't use timer:
|
|
955 |
// - all notifications
|
|
956 |
//case EMultimodeENStoreNotifyStoreEvent:
|
|
957 |
// - 2nd phase methods (when two phase lists are used)
|
|
958 |
//case EMultimodeENStoreReadAll
|
|
959 |
default:
|
|
960 |
ReqCompleted( iTsyReqHandleStore->ResetTsyReqHandle(
|
|
961 |
aReqHandleType ), aError );
|
|
962 |
break;
|
|
963 |
}
|
|
964 |
}
|
|
965 |
#endif // REQHANDLE_TIMER
|
|
966 |
|
|
967 |
// ---------------------------------------------------------------------------
|
|
968 |
// CMmENStoreTsy::Phone
|
|
969 |
// Returns pointer to CMmPhoneTsy object
|
|
970 |
// (other items were commented in a header).
|
|
971 |
// ---------------------------------------------------------------------------
|
|
972 |
//
|
|
973 |
CMmPhoneTsy* CMmENStoreTsy::Phone()
|
|
974 |
{
|
|
975 |
return iMmPhone;
|
|
976 |
}
|
|
977 |
|
|
978 |
// End of File
|