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 <etelmm.h>
|
|
20 |
#include "cmmsmsstoragetsy.h"
|
|
21 |
#include "cmmphonetsy.h"
|
|
22 |
#include "cmmsmstsy.h"
|
|
23 |
#include "cmmsmsextinterface.h"
|
|
24 |
#include "MmTsy_numberOfSlots.h"
|
|
25 |
#include <ctsy/pluginapi/cmmdatapackage.h>
|
|
26 |
#include <ctsy/tflogger.h>
|
|
27 |
|
|
28 |
// ======== MEMBER FUNCTIONS ========
|
|
29 |
|
|
30 |
CMmSmsStorageTsy::CMmSmsStorageTsy():
|
|
31 |
iReqHandleType(CMmSmsTsy::EMultimodeSmsReqHandleUnknown)
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
void CMmSmsStorageTsy::ConstructL()
|
|
36 |
{
|
|
37 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::ConstructL\n");
|
|
38 |
ResetVariables();
|
|
39 |
|
|
40 |
iSmsListArray = new ( ELeave ) CArrayPtrFlat<TSmsMsg>( 1 );
|
|
41 |
iSmsReadAllArray = new ( ELeave ) CArrayPtrFlat<CListReadAllAttempt>( 1 );
|
|
42 |
|
|
43 |
// register sms storage tsy in the message manager
|
|
44 |
iMmPhone->MessageManager()->RegisterTsyObject(
|
|
45 |
CMmMessageManagerBase::EPhoneStoreTsy, this );
|
|
46 |
}
|
|
47 |
|
|
48 |
CMmSmsStorageTsy* CMmSmsStorageTsy::NewL(
|
|
49 |
CMmSmsTsy* aMmSmsTsy,
|
|
50 |
CMmPhoneTsy* aMmPhone,
|
|
51 |
CMmSmsExtInterface* aMmSmsExtInterface,
|
|
52 |
CMmTsyReqHandleStore* aMmTsyReqHandleStore )
|
|
53 |
{
|
|
54 |
CMmSmsStorageTsy* subsession = new ( ELeave ) CMmSmsStorageTsy();
|
|
55 |
CleanupClosePushL( *subsession );
|
|
56 |
subsession->iMmSmsTsy = aMmSmsTsy;
|
|
57 |
subsession->iMmPhone = aMmPhone;
|
|
58 |
subsession->iMmSmsExtInterface = aMmSmsExtInterface;
|
|
59 |
subsession->iMmTsyReqHandleStore = aMmTsyReqHandleStore;
|
|
60 |
subsession->ConstructL();
|
|
61 |
CleanupStack::Pop(subsession);
|
|
62 |
|
|
63 |
return subsession;
|
|
64 |
}
|
|
65 |
|
|
66 |
CMmSmsStorageTsy::~CMmSmsStorageTsy()
|
|
67 |
{
|
|
68 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::~CMmSmsStorageTsy");
|
|
69 |
if ( iMmPhone )
|
|
70 |
{
|
|
71 |
// deregister tsy object from message manager
|
|
72 |
iMmPhone->MessageManager()->DeregisterTsyObject(this);
|
|
73 |
}
|
|
74 |
|
|
75 |
if ( iSmsListArray )
|
|
76 |
{
|
|
77 |
delete iSmsListArray;
|
|
78 |
}
|
|
79 |
iSmsListArray = NULL;
|
|
80 |
|
|
81 |
iSmsReadAllArray->ResetAndDestroy();
|
|
82 |
if ( iSmsReadAllArray )
|
|
83 |
{
|
|
84 |
delete iSmsReadAllArray;
|
|
85 |
}
|
|
86 |
iSmsReadAllArray = NULL;
|
|
87 |
|
|
88 |
// Set pointers to NULL
|
|
89 |
iMmTsyReqHandleStore = NULL;
|
|
90 |
iMmPhone = NULL;
|
|
91 |
iMmSmsExtInterface = NULL;
|
|
92 |
iGetInfoInfoPtr = NULL;
|
|
93 |
iNotifySmsStoreEventIndexPtr = NULL;
|
|
94 |
iReadSmsEntryPtr = NULL;
|
|
95 |
iReadAllBufSizePtr = NULL;
|
|
96 |
iWriteSmsEntryPtr = NULL;
|
|
97 |
iNotifySmsStoreEventPtr = NULL;
|
|
98 |
|
|
99 |
|
|
100 |
// Set CMmSmsTsy's SmsStoragePointer to NULL
|
|
101 |
iMmSmsTsy->SetSmsStorageTsy( NULL );
|
|
102 |
iMmSmsTsy = NULL;
|
|
103 |
}
|
|
104 |
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
// CMmSmsStorageTsy::Init
|
|
107 |
// Initialisation method
|
|
108 |
// (other items were commented in a header).
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
//
|
|
111 |
void CMmSmsStorageTsy::Init()
|
|
112 |
{
|
|
113 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::Init.");
|
|
114 |
// Send request to the Domestic OS layer.
|
|
115 |
TRAP_IGNORE( iMmPhone->MessageManager()->HandleRequestL(
|
|
116 |
EMobilePhoneStoreGetInfo ); );
|
|
117 |
}
|
|
118 |
|
|
119 |
// ---------------------------------------------------------------------------
|
|
120 |
// CMmSmsStorageTsy::ExtFunc
|
|
121 |
// Handle sms storage related requests that doesn't need
|
|
122 |
// trapping or call DoExtFuncL-method
|
|
123 |
// (other items were commented in a header).
|
|
124 |
// ---------------------------------------------------------------------------
|
|
125 |
//
|
|
126 |
TInt CMmSmsStorageTsy::ExtFunc(
|
|
127 |
const TTsyReqHandle aTsyReqHandle,
|
|
128 |
const TInt aIpc,
|
|
129 |
const TDataPackage& aPackage )
|
|
130 |
{
|
|
131 |
TInt ret( KErrNone );
|
|
132 |
TAny* dataPtr = aPackage.Ptr1();
|
|
133 |
|
|
134 |
switch ( aIpc )
|
|
135 |
{
|
|
136 |
// SMS storage requests that doesn't need trapping
|
|
137 |
case EMobilePhoneStoreReadAllPhase2:
|
|
138 |
ret = ReadAllSmsPhase2( aTsyReqHandle,
|
|
139 |
REINTERPRET_CAST( RMobilePhone::TClientId*, dataPtr ),
|
|
140 |
aPackage.Des2n() );
|
|
141 |
break;
|
|
142 |
// SMS storage requests that need trapping
|
|
143 |
default:
|
|
144 |
// Ensure the ReqHandleType is unset.
|
|
145 |
// This will detect cases where this method indirectly calls itself
|
|
146 |
// (e.g. servicing a client call that causes a self-reposting notification to complete and thus repost).
|
|
147 |
// Such cases are not supported because iReqHandleType is in the context of this class instance,
|
|
148 |
// not this request, and we don't want the values set by the inner request and the outer request
|
|
149 |
// interfering with each other.
|
|
150 |
__ASSERT_DEBUG(iReqHandleType==CMmSmsTsy::EMultimodeSmsReqHandleUnknown, User::Invariant());
|
|
151 |
|
|
152 |
TInt leaveCode( KErrNone );
|
|
153 |
TRAP( leaveCode, ret = DoExtFuncL( aTsyReqHandle, aIpc,
|
|
154 |
aPackage ); );
|
|
155 |
|
|
156 |
if ( KErrNone != leaveCode )
|
|
157 |
{
|
|
158 |
ReqCompleted( aTsyReqHandle, leaveCode );
|
|
159 |
}
|
|
160 |
|
|
161 |
// save request handle
|
|
162 |
if ( CMmSmsTsy::EMultimodeSmsReqHandleUnknown != iReqHandleType )
|
|
163 |
{
|
|
164 |
#ifdef REQHANDLE_TIMER
|
|
165 |
iMmSmsTsy->SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
|
|
166 |
#else
|
|
167 |
// Never comes here. See SetTypeOfResponse.
|
|
168 |
iMmTsyReqHandleStore->SetTsyReqHandle( iReqHandleType,
|
|
169 |
aTsyReqHandle );
|
|
170 |
#endif // REQHANDLE_TIMER
|
|
171 |
// We've finished with this value now. Clear it so it doesn't leak
|
|
172 |
// up to any other instances of this method down the call stack
|
|
173 |
iReqHandleType = CMmSmsTsy::EMultimodeSmsReqHandleUnknown;
|
|
174 |
}
|
|
175 |
break;
|
|
176 |
}
|
|
177 |
|
|
178 |
return ret;
|
|
179 |
}
|
|
180 |
|
|
181 |
// ---------------------------------------------------------------------------
|
|
182 |
// CMmSmsStorageTsy::DoExtFunc
|
|
183 |
// Handling of sms storage related requests that needs trapping
|
|
184 |
// (other items were commented in a header).
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
//
|
|
187 |
TInt CMmSmsStorageTsy::DoExtFuncL(
|
|
188 |
const TTsyReqHandle aTsyReqHandle,
|
|
189 |
const TInt aIpc,
|
|
190 |
const TDataPackage& aPackage )
|
|
191 |
{
|
|
192 |
TAny* dataPtr = aPackage.Ptr1();
|
|
193 |
TAny* dataPtr2 = aPackage.Ptr2();
|
|
194 |
|
|
195 |
TInt ret( KErrNone );
|
|
196 |
|
|
197 |
switch ( aIpc )
|
|
198 |
{
|
|
199 |
// SMS message storage requests
|
|
200 |
case EMobilePhoneStoreGetInfo:
|
|
201 |
ret = GetInfoL( aTsyReqHandle, aPackage.Des1n() );
|
|
202 |
break;
|
|
203 |
case EMobilePhoneStoreRead:
|
|
204 |
ret = ReadSmsL( aTsyReqHandle, aPackage.Des1n() );
|
|
205 |
break;
|
|
206 |
case EMobilePhoneStoreWrite:
|
|
207 |
ret = WriteSmsL( aTsyReqHandle, aPackage.Des1n() );
|
|
208 |
break;
|
|
209 |
case EMobilePhoneStoreDelete:
|
|
210 |
ret = DeleteSmsL( aTsyReqHandle,
|
|
211 |
REINTERPRET_CAST( TInt*, dataPtr ) );
|
|
212 |
break;
|
|
213 |
case EMobilePhoneStoreDeleteAll:
|
|
214 |
ret = DeleteAllSmsL( aTsyReqHandle );
|
|
215 |
break;
|
|
216 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
217 |
ret = NotifySmsStoreEvent( REINTERPRET_CAST(
|
|
218 |
RMobilePhoneStore::TMobileStoreEvent*, dataPtr ),
|
|
219 |
REINTERPRET_CAST( TInt*, dataPtr2 ) );
|
|
220 |
break;
|
|
221 |
case EMobilePhoneStoreReadAllPhase1:
|
|
222 |
ret = ReadAllSmsPhase1L( aTsyReqHandle, REINTERPRET_CAST(
|
|
223 |
CRetrieveMobilePhoneSmsList::TBatchRequestData*, dataPtr ),
|
|
224 |
REINTERPRET_CAST( TInt*, dataPtr2 ) );
|
|
225 |
break;
|
|
226 |
default:
|
|
227 |
ret = KErrNotSupported;
|
|
228 |
break;
|
|
229 |
}
|
|
230 |
|
|
231 |
return ret;
|
|
232 |
}
|
|
233 |
|
|
234 |
// ---------------------------------------------------------------------------
|
|
235 |
// CMmSmsStorageTsy::CancelService
|
|
236 |
// CancelService is called by the server when it is
|
|
237 |
// "cleaning-up" any still outstanding asynchronous requests before closing
|
|
238 |
// a client's sub-session. This will happen if a client closes its R-class
|
|
239 |
// handle without cancelling outstanding asynchronous requests on
|
|
240 |
// (other items were commented in a header).
|
|
241 |
// ---------------------------------------------------------------------------
|
|
242 |
//
|
|
243 |
TInt CMmSmsStorageTsy::CancelService(
|
|
244 |
const TInt aIpc,
|
|
245 |
const TTsyReqHandle aTsyReqHandle )
|
|
246 |
{
|
|
247 |
TInt ret( KErrNone );
|
|
248 |
|
|
249 |
switch ( aIpc )
|
|
250 |
{
|
|
251 |
case EMobilePhoneStoreGetInfo:
|
|
252 |
ret = GetInfoCancel( aTsyReqHandle );
|
|
253 |
break;
|
|
254 |
case EMobilePhoneStoreRead:
|
|
255 |
ret = ReadSmsCancel( aTsyReqHandle );
|
|
256 |
break;
|
|
257 |
case EMobilePhoneStoreWrite:
|
|
258 |
case EMobilePhoneStoreDelete:
|
|
259 |
case EMobilePhoneStoreDeleteAll:
|
|
260 |
ret = KErrNone;
|
|
261 |
break;
|
|
262 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
263 |
ret = NotifySmsStoreEventCancel( aTsyReqHandle );
|
|
264 |
break;
|
|
265 |
case EMobilePhoneStoreReadAllPhase1:
|
|
266 |
case EMobilePhoneStoreReadAllPhase2:
|
|
267 |
ret = ReadAllSmsCancel( aTsyReqHandle );
|
|
268 |
break;
|
|
269 |
default:
|
|
270 |
ret = KErrGeneral;
|
|
271 |
break;
|
|
272 |
}
|
|
273 |
|
|
274 |
return ret;
|
|
275 |
}
|
|
276 |
|
|
277 |
// ---------------------------------------------------------------------------
|
|
278 |
// CMmSmsStorageTsy::ReqModeL
|
|
279 |
// When the ETel server receives an "extension" client request,
|
|
280 |
// it will pass the IPC request number down to the TSY in order to find out
|
|
281 |
// what type of request it is
|
|
282 |
// (other items were commented in a header).
|
|
283 |
// ---------------------------------------------------------------------------
|
|
284 |
//
|
|
285 |
CTelObject::TReqMode CMmSmsStorageTsy::ReqModeL(
|
|
286 |
const TInt aIpc )
|
|
287 |
{
|
|
288 |
CTelObject::TReqMode ret( 0 );
|
|
289 |
switch ( aIpc )
|
|
290 |
{
|
|
291 |
// Non-flow Controlled Services
|
|
292 |
case EMobilePhoneStoreGetInfo:
|
|
293 |
case EMobilePhoneStoreRead:
|
|
294 |
case EMobilePhoneStoreWrite:
|
|
295 |
case EMobilePhoneStoreDelete:
|
|
296 |
case EMobilePhoneStoreDeleteAll:
|
|
297 |
case EMobilePhoneStoreReadAllPhase1:
|
|
298 |
case EMobilePhoneStoreReadAllPhase2:
|
|
299 |
break;
|
|
300 |
// Multiple Completion Services with Immediate Server Repost
|
|
301 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
302 |
ret = KReqModeMultipleCompletionEnabled |
|
|
303 |
KReqModeRePostImmediately;
|
|
304 |
break;
|
|
305 |
default:
|
|
306 |
User::Leave( KErrNotSupported );
|
|
307 |
break;
|
|
308 |
}
|
|
309 |
|
|
310 |
return ret;
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------------------------
|
|
314 |
// CMmSmsStorageTsy::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 requests
|
|
318 |
// (other items were commented in a header).
|
|
319 |
// ---------------------------------------------------------------------------
|
|
320 |
//
|
|
321 |
TInt CMmSmsStorageTsy::NumberOfSlotsL(
|
|
322 |
const TInt aIpc )
|
|
323 |
{
|
|
324 |
TInt numberOfSlots( 1 );
|
|
325 |
|
|
326 |
switch ( aIpc )
|
|
327 |
{
|
|
328 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
329 |
numberOfSlots = KMmPhoneStoreNotifyStoreEventSlots;
|
|
330 |
break;
|
|
331 |
default:
|
|
332 |
User::Leave( KErrNotSupported );
|
|
333 |
break;
|
|
334 |
}
|
|
335 |
|
|
336 |
return numberOfSlots;
|
|
337 |
}
|
|
338 |
|
|
339 |
// ---------------------------------------------------------------------------
|
|
340 |
// CMmSmsStorageTsy::OpenNewObjectL
|
|
341 |
// This method opens extendable sub-sessions
|
|
342 |
// (other items were commented in a header).
|
|
343 |
// ---------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
CTelObject* CMmSmsStorageTsy::OpenNewObjectL(
|
|
346 |
TDes& /*aName*/ )
|
|
347 |
{
|
|
348 |
User::Leave( KErrNotSupported );
|
|
349 |
//lint -e{527} "unreachable code"
|
|
350 |
|
|
351 |
return NULL;
|
|
352 |
}
|
|
353 |
|
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
// CMmSmsStorageTsy::OpenNewObjectByNameL
|
|
356 |
// This method opens extendable sub-sessions
|
|
357 |
// (other items were commented in a header).
|
|
358 |
// ---------------------------------------------------------------------------
|
|
359 |
//
|
|
360 |
CTelObject* CMmSmsStorageTsy::OpenNewObjectByNameL(
|
|
361 |
const TDesC& /*aName*/ )
|
|
362 |
{
|
|
363 |
User::Leave( KErrNotSupported );
|
|
364 |
//lint -e{527} "unreachable code"
|
|
365 |
|
|
366 |
return NULL;
|
|
367 |
}
|
|
368 |
|
|
369 |
// ---------------------------------------------------------------------------
|
|
370 |
// CMmSmsStorageTsy::RegisterNotification
|
|
371 |
// Called when the server recognises that this notification
|
|
372 |
// is being posted for the first time on this sub-session object.
|
|
373 |
// It enables the TSY to "turn on" any regular notification messages that it
|
|
374 |
// may receive from DOS
|
|
375 |
// (other items were commented in a header).
|
|
376 |
// ---------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
TInt CMmSmsStorageTsy::RegisterNotification(
|
|
379 |
const TInt aIpc )
|
|
380 |
{
|
|
381 |
TInt ret( KErrNone );
|
|
382 |
|
|
383 |
switch ( aIpc )
|
|
384 |
{
|
|
385 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
386 |
ret = KErrNone;
|
|
387 |
break;
|
|
388 |
default:
|
|
389 |
ret = KErrNotSupported;
|
|
390 |
break;
|
|
391 |
}
|
|
392 |
|
|
393 |
return ret;
|
|
394 |
}
|
|
395 |
|
|
396 |
// ---------------------------------------------------------------------------
|
|
397 |
// CMmSmsStorageTsy::DeregisterNotification
|
|
398 |
// Called when the server recognises that this notification
|
|
399 |
// will not be posted again because the last client to have
|
|
400 |
// a handle on this sub-session object has just closed the handle.
|
|
401 |
// It enables the TSY to "turn off" any regular notification messages that
|
|
402 |
// it may receive from the DOS
|
|
403 |
// (other items were commented in a header).
|
|
404 |
// ---------------------------------------------------------------------------
|
|
405 |
//
|
|
406 |
TInt CMmSmsStorageTsy::DeregisterNotification(
|
|
407 |
const TInt aIpc )
|
|
408 |
{
|
|
409 |
TInt ret( KErrNotSupported );
|
|
410 |
|
|
411 |
switch ( aIpc )
|
|
412 |
{
|
|
413 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
414 |
ret = KErrNone;
|
|
415 |
break;
|
|
416 |
default:
|
|
417 |
ret = KErrNotSupported;
|
|
418 |
break;
|
|
419 |
}
|
|
420 |
|
|
421 |
return ret;
|
|
422 |
}
|
|
423 |
|
|
424 |
// ---------------------------------------------------------------------------
|
|
425 |
// CMmSmsStorageTsy::GetInfoL
|
|
426 |
// This method start getting info prosess from selected store (SIM)
|
|
427 |
// (other items were commented in a header).
|
|
428 |
// ---------------------------------------------------------------------------
|
|
429 |
//
|
|
430 |
TInt CMmSmsStorageTsy::GetInfoL(
|
|
431 |
const TTsyReqHandle aTsyReqHandle,
|
|
432 |
TDes8* aSmsStoreInfoPckg )
|
|
433 |
{
|
|
434 |
|
|
435 |
TInt ret = KErrArgument;
|
|
436 |
|
|
437 |
if (aSmsStoreInfoPckg)
|
|
438 |
{
|
|
439 |
|
|
440 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 temp;
|
|
441 |
TPckg<RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg> tempPckg(temp);
|
|
442 |
|
|
443 |
TInt expectedLength = tempPckg.MaxLength();
|
|
444 |
TInt paramLength = aSmsStoreInfoPckg->MaxLength();
|
|
445 |
|
|
446 |
if (paramLength >= expectedLength)
|
|
447 |
{
|
|
448 |
TTsyReqHandle getInfoHandle = iMmTsyReqHandleStore->GetTsyReqHandle(
|
|
449 |
CMmSmsTsy::EMultimodeSmsGetInfo );
|
|
450 |
|
|
451 |
if ( CMmSmsTsy::EMultimodeSmsReqHandleUnknown < getInfoHandle )
|
|
452 |
{
|
|
453 |
// The request is already in processing because of previous request.
|
|
454 |
// Complete request with status value informing the client about
|
|
455 |
// the situation.
|
|
456 |
ReqCompleted( aTsyReqHandle, KErrServerBusy );
|
|
457 |
}
|
|
458 |
else
|
|
459 |
{
|
|
460 |
iGetInfoInfoPtr = aSmsStoreInfoPckg;
|
|
461 |
|
|
462 |
// allow for EMobilePhoneStoreGetInfo immediate completion
|
|
463 |
#ifdef REQHANDLE_TIMER
|
|
464 |
iMmSmsTsy->SetTypeOfResponse( CMmSmsTsy::EMultimodeSmsGetInfo,
|
|
465 |
aTsyReqHandle );
|
|
466 |
#else
|
|
467 |
// Never comes here. See SetTypeOfResponse.
|
|
468 |
iMmTsyReqHandleStore->SetTsyReqHandle(
|
|
469 |
CMmSmsTsy::EMultimodeSmsGetInfo, aTsyReqHandle );
|
|
470 |
#endif // REQHANDLE_TIMER
|
|
471 |
|
|
472 |
// Send request to the Domestic OS layer.
|
|
473 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
474 |
EMobilePhoneStoreGetInfo );
|
|
475 |
|
|
476 |
// dos layer returned with error and didn't complete request
|
|
477 |
if ( ret != KErrNone && iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
478 |
CMmSmsTsy::EMultimodeSmsGetInfo) )
|
|
479 |
{
|
|
480 |
ReqCompleted( aTsyReqHandle, ret );
|
|
481 |
}
|
|
482 |
}
|
|
483 |
|
|
484 |
ret = KErrNone;
|
|
485 |
}
|
|
486 |
}
|
|
487 |
|
|
488 |
return ret;
|
|
489 |
}
|
|
490 |
|
|
491 |
// ---------------------------------------------------------------------------
|
|
492 |
// CMmSmsStorageTsy::GetInfoCancel
|
|
493 |
// This method cancel GetInfo request
|
|
494 |
// (other items were commented in a header).
|
|
495 |
// ---------------------------------------------------------------------------
|
|
496 |
//
|
|
497 |
TInt CMmSmsStorageTsy::GetInfoCancel(
|
|
498 |
const TTsyReqHandle aTsyReqHandle )
|
|
499 |
{
|
|
500 |
iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
501 |
CMmSmsTsy::EMultimodeSmsGetInfo );
|
|
502 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
503 |
|
|
504 |
return KErrNone;
|
|
505 |
}
|
|
506 |
|
|
507 |
// ---------------------------------------------------------------------------
|
|
508 |
// CMmSmsStorageTsy::CompleteGetInfo
|
|
509 |
// Complete Clients GetInfo request
|
|
510 |
// (other items were commented in a header).
|
|
511 |
// ---------------------------------------------------------------------------
|
|
512 |
//
|
|
513 |
void CMmSmsStorageTsy::CompleteGetInfo(
|
|
514 |
TInt aResult,
|
|
515 |
CMmDataPackage* aDataPackage )
|
|
516 |
{
|
|
517 |
TUint8 totalEntries( 0 );
|
|
518 |
TInt usedEntries( 0 );
|
|
519 |
|
|
520 |
TTsyReqHandle reqHandle = iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
521 |
CMmSmsTsy::EMultimodeSmsGetInfo );
|
|
522 |
|
|
523 |
if ( ( KErrNone == aResult ) || ( KErrNotFound == aResult ) )
|
|
524 |
{
|
|
525 |
aDataPackage->UnPackData( totalEntries, usedEntries );
|
|
526 |
}
|
|
527 |
iTotalEntries = totalEntries;
|
|
528 |
iUsedEntries = usedEntries;
|
|
529 |
|
|
530 |
// set the member variable to aTotalEntries. It Will be used
|
|
531 |
// when it writes SMS on SIM card
|
|
532 |
iMmSmsTsy->SetSmsNumOfLoc ( totalEntries );
|
|
533 |
|
|
534 |
if ( reqHandle )
|
|
535 |
{
|
|
536 |
// Request was compeleted successfully
|
|
537 |
if ( ( KErrNone == aResult ) || ( KErrNotFound == aResult ) )
|
|
538 |
{
|
|
539 |
aResult = iMmSmsExtInterface->StoreInfo(
|
|
540 |
iGetInfoInfoPtr, totalEntries, usedEntries );
|
|
541 |
}
|
|
542 |
ReqCompleted( reqHandle, aResult );
|
|
543 |
}
|
|
544 |
}
|
|
545 |
|
|
546 |
// ---------------------------------------------------------------------------
|
|
547 |
// CMmSmsStorageTsy::ReadSmsL
|
|
548 |
// This method start SMS message reading process from selected location
|
|
549 |
// (other items were commented in a header).
|
|
550 |
// ---------------------------------------------------------------------------
|
|
551 |
//
|
|
552 |
TInt CMmSmsStorageTsy::ReadSmsL(
|
|
553 |
const TTsyReqHandle aTsyReqHandle,
|
|
554 |
TDes8* aSmsPckg )
|
|
555 |
{
|
|
556 |
TInt ret( KErrArgument );
|
|
557 |
|
|
558 |
if ( aSmsPckg )
|
|
559 |
{
|
|
560 |
TInt paramLength = aSmsPckg->MaxLength();
|
|
561 |
|
|
562 |
RMobileSmsStore::TMobileGsmSmsEntryV1 temp;
|
|
563 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg tempPckg(temp);
|
|
564 |
|
|
565 |
TInt expectedLength = tempPckg.MaxLength();
|
|
566 |
|
|
567 |
if (paramLength == expectedLength)
|
|
568 |
{
|
|
569 |
|
|
570 |
TTsyReqHandle readSmsHandle = iMmTsyReqHandleStore->GetTsyReqHandle(
|
|
571 |
CMmSmsTsy::EMultimodeSimStSmsReadSms );
|
|
572 |
|
|
573 |
if ( CMmSmsTsy::EMultimodeSmsReqHandleUnknown < readSmsHandle )
|
|
574 |
{
|
|
575 |
// The request is already in processing because of previous request.
|
|
576 |
// Complete request with status value informing the client about
|
|
577 |
// the situation.
|
|
578 |
ReqCompleted( aTsyReqHandle, KErrServerBusy );
|
|
579 |
}
|
|
580 |
else
|
|
581 |
{
|
|
582 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg* smsPckg =
|
|
583 |
reinterpret_cast< RMobileSmsStore::TMobileGsmSmsEntryV1Pckg* >
|
|
584 |
( aSmsPckg );
|
|
585 |
RMobileSmsStore::TMobileGsmSmsEntryV1& smsEntry = ( *smsPckg )();
|
|
586 |
|
|
587 |
iReadSmsEntryPtr = aSmsPckg;
|
|
588 |
|
|
589 |
CMmDataPackage package;
|
|
590 |
package.PackData( &smsEntry.iIndex );
|
|
591 |
|
|
592 |
|
|
593 |
// allow for EMobilePhoneStoreRead immediate completion
|
|
594 |
#ifdef REQHANDLE_TIMER
|
|
595 |
iMmSmsTsy->SetTypeOfResponse( CMmSmsTsy::EMultimodeSimStSmsReadSms,
|
|
596 |
aTsyReqHandle );
|
|
597 |
#else
|
|
598 |
// Never comes here. See SetTypeOfResponse.
|
|
599 |
iMmTsyReqHandleStore->SetTsyReqHandle(
|
|
600 |
CMmSmsTsy::EMultimodeSimStSmsReadSms, aTsyReqHandle );
|
|
601 |
#endif // REQHANDLE_TIMER
|
|
602 |
|
|
603 |
// send request to DOS layer
|
|
604 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
605 |
EMobilePhoneStoreRead, &package );
|
|
606 |
|
|
607 |
// DOS layer returned error (without completing request)
|
|
608 |
if ( KErrNone != ret && iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
609 |
CMmSmsTsy::EMultimodeSimStSmsReadSms ))
|
|
610 |
{
|
|
611 |
ReqCompleted( aTsyReqHandle, ret );
|
|
612 |
}
|
|
613 |
}
|
|
614 |
ret = KErrNone;
|
|
615 |
}
|
|
616 |
}
|
|
617 |
|
|
618 |
return ret;
|
|
619 |
}
|
|
620 |
|
|
621 |
// ---------------------------------------------------------------------------
|
|
622 |
// CMmSmsStorageTsy::ReadSmsCancel
|
|
623 |
// This method cancels Read request
|
|
624 |
// (other items were commented in a header).
|
|
625 |
// ---------------------------------------------------------------------------
|
|
626 |
//
|
|
627 |
TInt CMmSmsStorageTsy::ReadSmsCancel(
|
|
628 |
const TTsyReqHandle aTsyReqHandle )
|
|
629 |
{
|
|
630 |
iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
631 |
CMmSmsTsy::EMultimodeSimStSmsReadSms );
|
|
632 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
633 |
|
|
634 |
return KErrNone;
|
|
635 |
}
|
|
636 |
|
|
637 |
// ---------------------------------------------------------------------------
|
|
638 |
// CMmSmsStorageTsy::CompleteReadSms
|
|
639 |
// Complete Clients Read Sms request
|
|
640 |
// (other items were commented in a header).
|
|
641 |
// ---------------------------------------------------------------------------
|
|
642 |
//
|
|
643 |
void CMmSmsStorageTsy::CompleteReadSms(
|
|
644 |
TInt aResult,
|
|
645 |
CMmDataPackage* aDataPackage )
|
|
646 |
{
|
|
647 |
TFLOGSTRING2("TSY: CMmSmsStorageTsy::CompleteReadSms. Error: %d",aResult);
|
|
648 |
TTsyReqHandle reqHandle = iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
649 |
CMmSmsTsy::EMultimodeSimStSmsReadSms );
|
|
650 |
|
|
651 |
if ( reqHandle )
|
|
652 |
{
|
|
653 |
if ( KErrNone == aResult )
|
|
654 |
{
|
|
655 |
TSmsMsg* smsMsg;
|
|
656 |
aDataPackage->UnPackData( &smsMsg );
|
|
657 |
aResult = UnpackSmsReadEntryPackage( iReadSmsEntryPtr, smsMsg );
|
|
658 |
}
|
|
659 |
ReqCompleted( reqHandle, aResult );
|
|
660 |
}
|
|
661 |
}
|
|
662 |
|
|
663 |
// ---------------------------------------------------------------------------
|
|
664 |
// CMmSmsStorageTsy::WriteSmsL
|
|
665 |
// This method start SMS message writing prosess to the
|
|
666 |
// selected location
|
|
667 |
// (other items were commented in a header).
|
|
668 |
// ---------------------------------------------------------------------------
|
|
669 |
//
|
|
670 |
TInt CMmSmsStorageTsy::WriteSmsL(
|
|
671 |
const TTsyReqHandle aTsyReqHandle,
|
|
672 |
TDesC8* aSmsPckg )
|
|
673 |
{
|
|
674 |
TTsyReqHandle writeSmsHandle = iMmTsyReqHandleStore->GetTsyReqHandle(
|
|
675 |
CMmSmsTsy::EMultimodeSimStSmsWriteSms );
|
|
676 |
|
|
677 |
if ( sizeof( RMobilePhoneStore::TMobilePhoneStoreEntryV1 ) > aSmsPckg->Length() )
|
|
678 |
{
|
|
679 |
TFLOGSTRING ("TSY: CMmSmsStorageTsy::WriteSms bad size argument");
|
|
680 |
// Complete the request with appropiate error
|
|
681 |
return KErrArgument;
|
|
682 |
}
|
|
683 |
|
|
684 |
if ( CMmSmsTsy::EMultimodeSmsReqHandleUnknown < writeSmsHandle )
|
|
685 |
{
|
|
686 |
// The request is already in processing because of previous request.
|
|
687 |
// Complete request with status value informing the client about
|
|
688 |
// the situation.
|
|
689 |
ReqCompleted( aTsyReqHandle, KErrServerBusy );
|
|
690 |
}
|
|
691 |
else
|
|
692 |
{
|
|
693 |
TInt ret (0 );
|
|
694 |
|
|
695 |
// typecast for aEntry
|
|
696 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg* entryPckg =
|
|
697 |
reinterpret_cast< RMobileSmsStore::TMobileGsmSmsEntryV1Pckg* >
|
|
698 |
( aSmsPckg );
|
|
699 |
RMobileSmsStore::TMobileGsmSmsEntryV1 entry = ( *entryPckg )();
|
|
700 |
|
|
701 |
iWriteSmsEntryPtr = aSmsPckg;
|
|
702 |
|
|
703 |
// pack data
|
|
704 |
CMmDataPackage package;
|
|
705 |
package.PackData( &aSmsPckg, &entry.iIndex );
|
|
706 |
|
|
707 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
708 |
EMobilePhoneStoreWrite, &package );
|
|
709 |
|
|
710 |
if ( KErrNone == ret )
|
|
711 |
{
|
|
712 |
iReqHandleType = CMmSmsTsy::EMultimodeSimStSmsWriteSms;
|
|
713 |
}
|
|
714 |
else
|
|
715 |
{
|
|
716 |
// Message construction failed or phonet sender returned error
|
|
717 |
ReqCompleted( aTsyReqHandle, ret );
|
|
718 |
}
|
|
719 |
}
|
|
720 |
|
|
721 |
return KErrNone;
|
|
722 |
}
|
|
723 |
|
|
724 |
// ---------------------------------------------------------------------------
|
|
725 |
// CMmSmsStorageTsy::CompleteWriteSms
|
|
726 |
// Complete Clients WriteSms request
|
|
727 |
// (other items were commented in a header).
|
|
728 |
// ---------------------------------------------------------------------------
|
|
729 |
//
|
|
730 |
void CMmSmsStorageTsy::CompleteWriteSms(
|
|
731 |
TInt aResult,
|
|
732 |
CMmDataPackage* aDataPackage )
|
|
733 |
{
|
|
734 |
TFLOGSTRING2("TSY: CMmSmsStorageTsy::CompleteWriteSms. Error: %d",aResult);
|
|
735 |
TTsyReqHandle reqHandle = iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
736 |
CMmSmsTsy::EMultimodeSimStSmsWriteSms );
|
|
737 |
|
|
738 |
if ( reqHandle )
|
|
739 |
{
|
|
740 |
TUint8 location( 0 );
|
|
741 |
TBool receivedClass2ToBeResent ( EFalse );
|
|
742 |
if( aDataPackage )
|
|
743 |
{
|
|
744 |
aDataPackage->UnPackData( location, receivedClass2ToBeResent );
|
|
745 |
}
|
|
746 |
if ( KErrNone == aResult )
|
|
747 |
{
|
|
748 |
TInt ret = UnpackSmsWriteEntryPackage( iWriteSmsEntryPtr,
|
|
749 |
location );
|
|
750 |
|
|
751 |
CompleteNotifyStoreEvent( location,
|
|
752 |
RMobilePhoneStore::KStoreEntryAdded );
|
|
753 |
|
|
754 |
ReqCompleted( reqHandle, ret );
|
|
755 |
}
|
|
756 |
else
|
|
757 |
{
|
|
758 |
// SIM full
|
|
759 |
if ( KErrDiskFull == aResult )
|
|
760 |
{
|
|
761 |
CompleteNotifyStoreEvent( -1, RMobilePhoneStore::KStoreFull );
|
|
762 |
}
|
|
763 |
ReqCompleted( reqHandle, aResult );
|
|
764 |
}
|
|
765 |
|
|
766 |
if ( receivedClass2ToBeResent )
|
|
767 |
{
|
|
768 |
// silently IGNORE if call to DOS fails
|
|
769 |
TInt trapError = 0;
|
|
770 |
TRAP( trapError, iMmPhone->MessageManager()->HandleRequestL(
|
|
771 |
EMobileSmsMessagingResumeSmsReception ); );
|
|
772 |
}
|
|
773 |
}
|
|
774 |
}
|
|
775 |
|
|
776 |
// ---------------------------------------------------------------------------
|
|
777 |
// CMmSmsStorageTsy::DeleteSmsL
|
|
778 |
// This method start SMS message deleting prosess on the
|
|
779 |
// selected location
|
|
780 |
// (other items were commented in a header).
|
|
781 |
// ---------------------------------------------------------------------------
|
|
782 |
//
|
|
783 |
TInt CMmSmsStorageTsy::DeleteSmsL(
|
|
784 |
const TTsyReqHandle aTsyReqHandle,
|
|
785 |
TInt* aIndex )
|
|
786 |
{
|
|
787 |
TTsyReqHandle deleteSmsHandle = iMmTsyReqHandleStore->GetTsyReqHandle(
|
|
788 |
CMmSmsTsy::EMultimodeSimStSmsEraseSms );
|
|
789 |
|
|
790 |
if ( 0 < deleteSmsHandle )
|
|
791 |
{
|
|
792 |
// The request is already in processing because of previous request.
|
|
793 |
// Complete request with status value informing the client about
|
|
794 |
// the situation.
|
|
795 |
ReqCompleted( aTsyReqHandle, KErrServerBusy );
|
|
796 |
}
|
|
797 |
else
|
|
798 |
{
|
|
799 |
iDeleteSmsIndex = *aIndex;
|
|
800 |
|
|
801 |
CMmDataPackage package;
|
|
802 |
package.PackData( aIndex );
|
|
803 |
|
|
804 |
TInt ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
805 |
EMobilePhoneStoreDelete, &package );
|
|
806 |
|
|
807 |
if ( KErrNone == ret )
|
|
808 |
{
|
|
809 |
iReqHandleType = CMmSmsTsy::EMultimodeSimStSmsEraseSms;
|
|
810 |
}
|
|
811 |
else
|
|
812 |
{
|
|
813 |
// Message construction failed or phonet sender returned error
|
|
814 |
ReqCompleted( aTsyReqHandle, ret );
|
|
815 |
}
|
|
816 |
}
|
|
817 |
|
|
818 |
return KErrNone;
|
|
819 |
}
|
|
820 |
|
|
821 |
// ---------------------------------------------------------------------------
|
|
822 |
// CMmSmsStorageTsy::CompleteDeleteSms
|
|
823 |
// Complete Clients DeleteSms request
|
|
824 |
// (other items were commented in a header).
|
|
825 |
// ---------------------------------------------------------------------------
|
|
826 |
//
|
|
827 |
void CMmSmsStorageTsy::CompleteDeleteSms(
|
|
828 |
TInt aResult )
|
|
829 |
{
|
|
830 |
TFLOGSTRING2("TSY: CMmSmsStorageTsy::CompleteDeleteSms. Error: %d", aResult);
|
|
831 |
TTsyReqHandle reqHandle = iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
832 |
CMmSmsTsy::EMultimodeSimStSmsEraseSms );
|
|
833 |
|
|
834 |
if ( reqHandle )
|
|
835 |
{
|
|
836 |
if ( KErrNone == aResult )
|
|
837 |
{
|
|
838 |
// Notify that one entry was deleted from the store.
|
|
839 |
CompleteNotifyStoreEvent( iDeleteSmsIndex,
|
|
840 |
RMobilePhoneStore::KStoreEntryDeleted );
|
|
841 |
}
|
|
842 |
ReqCompleted( reqHandle, aResult );
|
|
843 |
}
|
|
844 |
}
|
|
845 |
|
|
846 |
// ---------------------------------------------------------------------------
|
|
847 |
// CMmSmsStorageTsy::DeleteAllSmsL
|
|
848 |
// This method start Delete all messages prosess on the selected
|
|
849 |
// Store. Method make SimStSms Erase Request where location of
|
|
850 |
// slot (KDeleteAllSmsMessagesIndex) is zero. It means that all
|
|
851 |
// memory locations are erased
|
|
852 |
// (other items were commented in a header).
|
|
853 |
// ---------------------------------------------------------------------------
|
|
854 |
//
|
|
855 |
TInt CMmSmsStorageTsy::DeleteAllSmsL(
|
|
856 |
const TTsyReqHandle aTsyReqHandle )
|
|
857 |
{
|
|
858 |
TTsyReqHandle deleteAllSmsHandle = iMmTsyReqHandleStore->GetTsyReqHandle(
|
|
859 |
CMmSmsTsy::EMultimodeSimStSmsEraseAllSms );
|
|
860 |
|
|
861 |
if ( 0 < deleteAllSmsHandle )
|
|
862 |
{
|
|
863 |
// The request is already in processing because of previous request.
|
|
864 |
// Complete request with status value informing the client about
|
|
865 |
// the situation.
|
|
866 |
ReqCompleted( aTsyReqHandle, KErrServerBusy );
|
|
867 |
}
|
|
868 |
else
|
|
869 |
{
|
|
870 |
// Send request to the Domestic OS layer.
|
|
871 |
TInt ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
872 |
EMobilePhoneStoreDeleteAll );
|
|
873 |
|
|
874 |
if ( KErrNone == ret )
|
|
875 |
{
|
|
876 |
iReqHandleType = CMmSmsTsy::EMultimodeSimStSmsEraseAllSms;
|
|
877 |
}
|
|
878 |
else
|
|
879 |
{
|
|
880 |
// Message construction failed or phonet sender returned error
|
|
881 |
ReqCompleted( aTsyReqHandle, ret );
|
|
882 |
}
|
|
883 |
}
|
|
884 |
|
|
885 |
return KErrNone;
|
|
886 |
}
|
|
887 |
|
|
888 |
// ---------------------------------------------------------------------------
|
|
889 |
// CMmSmsStorageTsy::CompleteDeleteAllSms
|
|
890 |
// Complete Clients DeleteAllSms request
|
|
891 |
// (other items were commented in a header).
|
|
892 |
// ---------------------------------------------------------------------------
|
|
893 |
//
|
|
894 |
void CMmSmsStorageTsy::CompleteDeleteAllSms(
|
|
895 |
TInt aResult )
|
|
896 |
{
|
|
897 |
TFLOGSTRING2( "TSY: CMmSmsStorageTsy::CompleteDeleteAllSms. Error: %d", aResult );
|
|
898 |
TTsyReqHandle reqHandle = iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
899 |
CMmSmsTsy::EMultimodeSimStSmsEraseAllSms );
|
|
900 |
|
|
901 |
if ( reqHandle )
|
|
902 |
{
|
|
903 |
if ( KErrNone == aResult )
|
|
904 |
{
|
|
905 |
// Notify that all messages were deleted from the store.
|
|
906 |
CompleteNotifyStoreEvent( -1, RMobilePhoneStore::KStoreEmpty );
|
|
907 |
}
|
|
908 |
ReqCompleted( reqHandle, aResult );
|
|
909 |
}
|
|
910 |
}
|
|
911 |
|
|
912 |
// ---------------------------------------------------------------------------
|
|
913 |
// CMmSmsStorageTsy::NotifySmsStoreEvent
|
|
914 |
// This method activates notifying of SMS store events
|
|
915 |
// (other items were commented in a header).
|
|
916 |
// ---------------------------------------------------------------------------
|
|
917 |
//
|
|
918 |
TInt CMmSmsStorageTsy::NotifySmsStoreEvent(
|
|
919 |
RMobilePhoneStore::TMobileStoreEvent* aEvent,
|
|
920 |
TInt* aIndex )
|
|
921 |
{
|
|
922 |
iReqHandleType = CMmSmsTsy::EMultimodeSimSmsNotifyStoreEvent;
|
|
923 |
iNotifySmsStoreEventPtr = aEvent;
|
|
924 |
iNotifySmsStoreEventIndexPtr = aIndex;
|
|
925 |
|
|
926 |
return KErrNone;
|
|
927 |
}
|
|
928 |
|
|
929 |
// ---------------------------------------------------------------------------
|
|
930 |
// CMmSmsStorageTsy::NotifyStoreEventCancel
|
|
931 |
// This method cancels NotifyStoreEventCancel request
|
|
932 |
// (other items were commented in a header).
|
|
933 |
// ---------------------------------------------------------------------------
|
|
934 |
//
|
|
935 |
TInt CMmSmsStorageTsy::NotifySmsStoreEventCancel(
|
|
936 |
const TTsyReqHandle aTsyReqHandle )
|
|
937 |
{
|
|
938 |
iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
939 |
CMmSmsTsy::EMultimodeSimSmsNotifyStoreEvent );
|
|
940 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
941 |
|
|
942 |
return KErrNone;
|
|
943 |
}
|
|
944 |
|
|
945 |
// ---------------------------------------------------------------------------
|
|
946 |
// CMmSmsStorageTsy::CompleteNotifyStoreEvent
|
|
947 |
// This method is called when some of SMS store events happen
|
|
948 |
// (other items were commented in a header).
|
|
949 |
// ---------------------------------------------------------------------------
|
|
950 |
//
|
|
951 |
void CMmSmsStorageTsy::CompleteNotifyStoreEvent(
|
|
952 |
TInt aLocation,
|
|
953 |
TUint32 aEvent )
|
|
954 |
{
|
|
955 |
TTsyReqHandle reqHandle = iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
956 |
CMmSmsTsy::EMultimodeSimSmsNotifyStoreEvent );
|
|
957 |
|
|
958 |
// if new entry has been added to Store, get correct notification
|
|
959 |
if ( RMobilePhoneStore::KStoreEntryAdded == aEvent )
|
|
960 |
{
|
|
961 |
// if store has space, get "StoreAdded" notifications
|
|
962 |
iUsedEntries++;
|
|
963 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::StoreEntryAdded notifications");
|
|
964 |
if ( iUsedEntries == iTotalEntries )
|
|
965 |
{
|
|
966 |
// if store gets full after class2 message, get "StoreAdded and
|
|
967 |
// StoreFull" notifications
|
|
968 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::StoreEntryAdded and StoreFull notifications");
|
|
969 |
aEvent = ( RMobilePhoneStore::KStoreFull |
|
|
970 |
RMobilePhoneStore::KStoreEntryAdded );
|
|
971 |
}
|
|
972 |
}
|
|
973 |
// if one or more entry has been deleted from store, get correct
|
|
974 |
// notifications
|
|
975 |
if ( RMobilePhoneStore::KStoreEntryDeleted == aEvent )
|
|
976 |
{
|
|
977 |
// if entry has been deleted from store, get "EntryDeleted"
|
|
978 |
// notification
|
|
979 |
iUsedEntries--;
|
|
980 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::StoreEntryDeleted notifications");
|
|
981 |
if ( (iUsedEntries+1) == iTotalEntries )
|
|
982 |
{
|
|
983 |
// if store has been full, after deleting get notifications
|
|
984 |
// "EntryDeleted" and "StoreHasSpace"
|
|
985 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::StoreEntryDeleted and StoreHasSpace notifications");
|
|
986 |
aEvent = ( RMobilePhoneStore::KStoreHasSpace |
|
|
987 |
RMobilePhoneStore::KStoreEntryDeleted );
|
|
988 |
}
|
|
989 |
if ( 0 == iUsedEntries )
|
|
990 |
{
|
|
991 |
aEvent = (
|
|
992 |
RMobilePhoneStore::KStoreEmpty
|
|
993 |
| RMobilePhoneStore::KStoreEntryDeleted );
|
|
994 |
}
|
|
995 |
|
|
996 |
}
|
|
997 |
|
|
998 |
if ( reqHandle )
|
|
999 |
{
|
|
1000 |
|
|
1001 |
TUint32* smsStoreEvent = REINTERPRET_CAST( TUint32*,
|
|
1002 |
iNotifySmsStoreEventPtr );
|
|
1003 |
|
|
1004 |
*smsStoreEvent = aEvent;
|
|
1005 |
*iNotifySmsStoreEventIndexPtr = aLocation;
|
|
1006 |
|
|
1007 |
TFLOGSTRING3("TSY: CMmSmsStorageTsy::CompleteNotifyStoreEvent:notified client about event=0x%x, location=%d", aEvent, aLocation );
|
|
1008 |
ReqCompleted( reqHandle, KErrNone );
|
|
1009 |
}
|
|
1010 |
}
|
|
1011 |
|
|
1012 |
// ---------------------------------------------------------------------------
|
|
1013 |
// CMmSmsStorageTsy::ReadAllSmsPhase1L
|
|
1014 |
// This method starts first phase of SMS messages retrieval. On
|
|
1015 |
// the first phase method store locations temporarely to the TSY.
|
|
1016 |
// On the second phase method copy the streamed list to the
|
|
1017 |
// client
|
|
1018 |
// (other items were commented in a header).
|
|
1019 |
// ---------------------------------------------------------------------------
|
|
1020 |
//
|
|
1021 |
TInt CMmSmsStorageTsy::ReadAllSmsPhase1L(
|
|
1022 |
const TTsyReqHandle aTsyReqHandle,
|
|
1023 |
CRetrieveMobilePhoneSmsList::TBatchRequestData const* aRequest,
|
|
1024 |
TInt* aBufSize )
|
|
1025 |
{
|
|
1026 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::ReadAllSmsPhase1L");
|
|
1027 |
TInt ret( KErrNone );
|
|
1028 |
|
|
1029 |
TTsyReqHandle readAllSmsHandle = iMmTsyReqHandleStore->GetTsyReqHandle(
|
|
1030 |
CMmSmsTsy::EMultimodeSimStSmsReadAllSms );
|
|
1031 |
|
|
1032 |
if ( CMmSmsTsy::EMultimodeSmsReqHandleUnknown < readAllSmsHandle )
|
|
1033 |
{
|
|
1034 |
// The request is already in processing because of previous request.
|
|
1035 |
// Complete request with status value informing the client about
|
|
1036 |
// the situation.
|
|
1037 |
ReqCompleted( aTsyReqHandle, KErrServerBusy );
|
|
1038 |
}
|
|
1039 |
else if ( aRequest->iBatchRequest ||
|
|
1040 |
iMmSmsExtInterface->GetSupportedEntry() != aRequest->iEntryType )
|
|
1041 |
{
|
|
1042 |
// Client is asking for batch of SMS store entries or CDMA SMS store
|
|
1043 |
// entries. This feature is not supported.
|
|
1044 |
ReqCompleted( aTsyReqHandle, KErrNotSupported );
|
|
1045 |
}
|
|
1046 |
else
|
|
1047 |
{
|
|
1048 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::ReadAllSmsPhase1. SMS reading starts.");
|
|
1049 |
// Client is asking for all SMS store entries
|
|
1050 |
iReadAllBufSizePtr = aBufSize;
|
|
1051 |
iReadAllId = aRequest->iClient;
|
|
1052 |
|
|
1053 |
// Lets reset the array
|
|
1054 |
iSmsListArray->Reset();
|
|
1055 |
|
|
1056 |
// SMS storage contains messages
|
|
1057 |
if ( 0 < iMmSmsTsy->GetSmsNumOfLoc () )
|
|
1058 |
{
|
|
1059 |
// allow for EMobilePhoneStoreReadAllPhase1 immediate completion
|
|
1060 |
#ifdef REQHANDLE_TIMER
|
|
1061 |
iMmSmsTsy->SetTypeOfResponse(
|
|
1062 |
CMmSmsTsy::EMultimodeSimStSmsReadAllSms, aTsyReqHandle );
|
|
1063 |
#else
|
|
1064 |
iMmTsyReqHandleStore->SetTsyReqHandle(
|
|
1065 |
CMmSmsTsy::EMultimodeSimStSmsReadAllSms, aTsyReqHandle );
|
|
1066 |
#endif // REQHANDLE_TIMER
|
|
1067 |
|
|
1068 |
// Lets read first message from store
|
|
1069 |
// First index is 1
|
|
1070 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
1071 |
EMobilePhoneStoreReadAllPhase1 );
|
|
1072 |
|
|
1073 |
if ( KErrNone != ret )
|
|
1074 |
{
|
|
1075 |
TFLOGSTRING2("TSY: CMmSmsStorageTsy::ReadAllSmsPhase1L - and the returned value for EMobilePhoneStoreReadAllPhase1:%d", ret);
|
|
1076 |
(void)iMmTsyReqHandleStore->ResetTsyReqHandle( CMmSmsTsy::EMultimodeSimStSmsReadAllSms );
|
|
1077 |
// the returned value from ResetTsyReqHandle is not needed.
|
|
1078 |
}
|
|
1079 |
}
|
|
1080 |
// SMS Storage contains 0 messages
|
|
1081 |
else
|
|
1082 |
{
|
|
1083 |
ret = KErrNotFound;
|
|
1084 |
}
|
|
1085 |
|
|
1086 |
// DOS layer returned with error
|
|
1087 |
if ( ret != KErrNone )
|
|
1088 |
{
|
|
1089 |
TFLOGSTRING3("TSY: CMmSmsStorageTsy::ReadAllSmsPhase1L aTsyReqHandle: %d and ret:%d", aTsyReqHandle, ret);
|
|
1090 |
ReqCompleted( aTsyReqHandle, ret );
|
|
1091 |
}
|
|
1092 |
|
|
1093 |
}
|
|
1094 |
|
|
1095 |
return KErrNone;
|
|
1096 |
}
|
|
1097 |
|
|
1098 |
// ---------------------------------------------------------------------------
|
|
1099 |
// CMmSmsStorageTsy::ReadAllSmsPhase2
|
|
1100 |
// This method handle and complete second phase of SMS messages retrieval
|
|
1101 |
// (other items were commented in a header).
|
|
1102 |
// ---------------------------------------------------------------------------
|
|
1103 |
//
|
|
1104 |
TInt CMmSmsStorageTsy::ReadAllSmsPhase2(
|
|
1105 |
const TTsyReqHandle aTsyReqHandle,
|
|
1106 |
RMobilePhone::TClientId const* aId,
|
|
1107 |
TDes8* aBuffer )
|
|
1108 |
{
|
|
1109 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::ReadAllSmsPhase2");
|
|
1110 |
CListReadAllAttempt* read = NULL;
|
|
1111 |
|
|
1112 |
// Find the read attempt from this client
|
|
1113 |
for ( TInt i = 0 ; i < iSmsReadAllArray->Count() ; ++i )
|
|
1114 |
{
|
|
1115 |
read = iSmsReadAllArray->At( i );
|
|
1116 |
if ( ( read->iClient.iSessionHandle == aId->iSessionHandle ) &&
|
|
1117 |
( read->iClient.iSubSessionHandle == aId->iSubSessionHandle ) )
|
|
1118 |
{
|
|
1119 |
TPtr8 bufPtr( ( read->iListBuf )->Ptr( 0 ) );
|
|
1120 |
// Copy the streamed list to the client
|
|
1121 |
aBuffer->Copy( bufPtr );
|
|
1122 |
delete read;
|
|
1123 |
iSmsReadAllArray->Delete( i );
|
|
1124 |
ReqCompleted( aTsyReqHandle, KErrNone );
|
|
1125 |
|
|
1126 |
return KErrNone;
|
|
1127 |
}
|
|
1128 |
}
|
|
1129 |
|
|
1130 |
// Doesn't found the matching client from read all phase 1
|
|
1131 |
iSmsReadAllArray->ResetAndDestroy();
|
|
1132 |
ReqCompleted( aTsyReqHandle, KErrCorrupt );
|
|
1133 |
|
|
1134 |
return KErrNone;
|
|
1135 |
}
|
|
1136 |
|
|
1137 |
// ---------------------------------------------------------------------------
|
|
1138 |
// CMmSmsStorageTsy::ReadAllSmsCancel
|
|
1139 |
// This method cancels read all SMSes request
|
|
1140 |
// (other items were commented in a header).
|
|
1141 |
// ---------------------------------------------------------------------------
|
|
1142 |
//
|
|
1143 |
TInt CMmSmsStorageTsy::ReadAllSmsCancel(
|
|
1144 |
const TTsyReqHandle aTsyReqHandle )
|
|
1145 |
{
|
|
1146 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::ReadAllSmsCancel");
|
|
1147 |
iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
1148 |
CMmSmsTsy::EMultimodeSimStSmsReadAllSms );
|
|
1149 |
|
|
1150 |
iSmsListArray->Reset();
|
|
1151 |
iSmsReadAllArray->ResetAndDestroy();
|
|
1152 |
|
|
1153 |
ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
1154 |
|
|
1155 |
return KErrNone;
|
|
1156 |
}
|
|
1157 |
|
|
1158 |
// ---------------------------------------------------------------------------
|
|
1159 |
// CMmSmsStorageTsy::RetrieveSmsListReadSmsL
|
|
1160 |
// Complete SimStSmsReadReq request and calls CompleteReadAllSmsPhase1-method
|
|
1161 |
// (other items were commented in a header).
|
|
1162 |
// ---------------------------------------------------------------------------
|
|
1163 |
//
|
|
1164 |
void CMmSmsStorageTsy::RetrieveSmsListReadSmsL(
|
|
1165 |
TInt aResult,
|
|
1166 |
CMmDataPackage* aDataPackage )
|
|
1167 |
{
|
|
1168 |
TFLOGSTRING("TSY: CMmSmsStorageTsy::RetrieveSmsListReadSmsL");
|
|
1169 |
|
|
1170 |
TTsyReqHandle reqHandle = iMmTsyReqHandleStore->GetTsyReqHandle(
|
|
1171 |
CMmSmsTsy::EMultimodeSimStSmsReadAllSms );
|
|
1172 |
|
|
1173 |
// Flag which wil indicates if Class2 SMS has been received while
|
|
1174 |
// it was reading the SMS Slots.
|
|
1175 |
TBool receivedClass2ToBeReSent;
|
|
1176 |
|
|
1177 |
CArrayPtrFlat<TSmsMsg>* tempSmsListArray = NULL;
|
|
1178 |
|
|
1179 |
if ( reqHandle )
|
|
1180 |
{
|
|
1181 |
aDataPackage->UnPackData( tempSmsListArray, receivedClass2ToBeReSent );
|
|
1182 |
|
|
1183 |
for ( TInt i = 0; i < tempSmsListArray->Count(); i++ )
|
|
1184 |
{
|
|
1185 |
iSmsListArray->AppendL( tempSmsListArray->At( i ) );
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
tempSmsListArray->Reset();
|
|
1189 |
tempSmsListArray = NULL;
|
|
1190 |
|
|
1191 |
// if last slot was empty or used
|
|
1192 |
if ( ( KErrNotFound == aResult ) || ( KErrNone == aResult ) )
|
|
1193 |
{
|
|
1194 |
if ( 0 < iSmsListArray->Count() )
|
|
1195 |
{
|
|
1196 |
// Store contained SMS messages
|
|
1197 |
TInt ret = iMmSmsExtInterface->CompleteReadAllSmsPhase1L(
|
|
1198 |
iSmsListArray, // SMS message list storage array
|
|
1199 |
iReadAllId, // Read all SMS messages Id
|
|
1200 |
iSmsReadAllArray, // Read all SMS messages array
|
|
1201 |
iReadAllBufSizePtr // Read all SMS messages pointer
|
|
1202 |
);
|
|
1203 |
CompleteReadAllSmsPhase1( ret, receivedClass2ToBeReSent );
|
|
1204 |
}
|
|
1205 |
else
|
|
1206 |
{
|
|
1207 |
// Store was empty
|
|
1208 |
CompleteReadAllSmsPhase1( KErrNotFound,
|
|
1209 |
receivedClass2ToBeReSent );
|
|
1210 |
}
|
|
1211 |
}
|
|
1212 |
else
|
|
1213 |
{
|
|
1214 |
CompleteReadAllSmsPhase1( aResult, receivedClass2ToBeReSent );
|
|
1215 |
}
|
|
1216 |
}
|
|
1217 |
}
|
|
1218 |
|
|
1219 |
// ---------------------------------------------------------------------------
|
|
1220 |
// CMmSmsStorageTsy::CompleteReadAllSmsPhase1
|
|
1221 |
// This method completes client's ReadAllSmsPhase1 request
|
|
1222 |
// (other items were commented in a header).
|
|
1223 |
// ---------------------------------------------------------------------------
|
|
1224 |
//
|
|
1225 |
void CMmSmsStorageTsy::CompleteReadAllSmsPhase1(
|
|
1226 |
TInt aResult,
|
|
1227 |
TBool aReceivedClass2ToBeReSent )
|
|
1228 |
{
|
|
1229 |
TFLOGSTRING2("TSY: CMmSmsStorageTsy::CompleteReadAllSmsPhase1. Complete read first phase error: %d", aResult);
|
|
1230 |
TTsyReqHandle reqHandle = iMmTsyReqHandleStore->ResetTsyReqHandle(
|
|
1231 |
CMmSmsTsy::EMultimodeSimStSmsReadAllSms );
|
|
1232 |
if ( reqHandle )
|
|
1233 |
{
|
|
1234 |
// Complete first phase of list retrieval
|
|
1235 |
ReqCompleted( reqHandle, aResult );
|
|
1236 |
iSmsListArray->Reset();
|
|
1237 |
|
|
1238 |
TFLOGSTRING2("TSY: CMmSmsStorageTsy::CompleteReadAllSmsPhase1 aReceivedClass2ToBeReSent: %d",aReceivedClass2ToBeReSent);
|
|
1239 |
if ( aReceivedClass2ToBeReSent )
|
|
1240 |
{
|
|
1241 |
// silently IGNORE if call to DOS fails
|
|
1242 |
TInt trapError = 0;
|
|
1243 |
TRAP( trapError, iMmPhone->MessageManager()->HandleRequestL(
|
|
1244 |
EMobileSmsMessagingResumeSmsReception ); );
|
|
1245 |
}
|
|
1246 |
}
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
// ---------------------------------------------------------------------------
|
|
1250 |
// CMmSmsStorageTsy::GetTsyReqHandleStore
|
|
1251 |
// Get pointer to Tsy request handle store
|
|
1252 |
// (other items were commented in a header).
|
|
1253 |
// ---------------------------------------------------------------------------
|
|
1254 |
//
|
|
1255 |
CMmTsyReqHandleStore* CMmSmsStorageTsy::GetTsyReqHandleStore()
|
|
1256 |
{
|
|
1257 |
// TAN to be removed before releasing?
|
|
1258 |
return iMmTsyReqHandleStore;
|
|
1259 |
}
|
|
1260 |
|
|
1261 |
// ---------------------------------------------------------------------------
|
|
1262 |
// CMmSmsStorageTsy::ResetVariables
|
|
1263 |
// Reset all used variables
|
|
1264 |
// (other items were commented in a header).
|
|
1265 |
// ---------------------------------------------------------------------------
|
|
1266 |
//
|
|
1267 |
void CMmSmsStorageTsy::ResetVariables()
|
|
1268 |
{
|
|
1269 |
// get info variables
|
|
1270 |
iGetInfoInfoPtr = NULL;
|
|
1271 |
|
|
1272 |
// read sms variables
|
|
1273 |
iReadSmsEntryPtr = NULL;
|
|
1274 |
|
|
1275 |
// write sms variables
|
|
1276 |
iWriteSmsEntryPtr = NULL;
|
|
1277 |
|
|
1278 |
// notify SMS store event
|
|
1279 |
iNotifySmsStoreEventPtr = NULL;
|
|
1280 |
iNotifySmsStoreEventIndexPtr = NULL;
|
|
1281 |
|
|
1282 |
// read all parameter sets variables
|
|
1283 |
iReadAllBufSizePtr = NULL;
|
|
1284 |
iUsedEntries = 0;
|
|
1285 |
iTotalEntries = 0;
|
|
1286 |
}
|
|
1287 |
|
|
1288 |
// ---------------------------------------------------------------------------
|
|
1289 |
// CMmSmsStorageTsy::UnpackSmsReadEntryPackage
|
|
1290 |
// This method unpack a entry package and set contents of a message to the
|
|
1291 |
// entry.
|
|
1292 |
// (other items were commented in a header).
|
|
1293 |
// ---------------------------------------------------------------------------
|
|
1294 |
//
|
|
1295 |
TInt CMmSmsStorageTsy::UnpackSmsReadEntryPackage(
|
|
1296 |
TAny* aReadSmsEntryPtr,
|
|
1297 |
TSmsMsg* aSmsMsg )
|
|
1298 |
{
|
|
1299 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg* entryPckg =
|
|
1300 |
REINTERPRET_CAST( RMobileSmsStore::TMobileGsmSmsEntryV1Pckg*,
|
|
1301 |
aReadSmsEntryPtr );
|
|
1302 |
RMobileSmsStore::TMobileGsmSmsEntryV1& entry = ( *entryPckg )();
|
|
1303 |
|
|
1304 |
switch( aSmsMsg->iMessageStatus )
|
|
1305 |
{
|
|
1306 |
case KSimSmsMoNotSent: //0x07
|
|
1307 |
entry.iMsgStatus = RMobileSmsStore::EStoredMessageUnsent;
|
|
1308 |
break;
|
|
1309 |
case KSimSmsStatusReportReqNotReceived: //0x0D
|
|
1310 |
case KSimSmsMoSent: //0x05
|
|
1311 |
entry.iMsgStatus = RMobileSmsStore::EStoredMessageSent;
|
|
1312 |
break;
|
|
1313 |
case KSimSmsMtRead: //0x01
|
|
1314 |
entry.iMsgStatus = RMobileSmsStore::EStoredMessageRead;
|
|
1315 |
break;
|
|
1316 |
case KSimSmsMtNotRead: //0x03
|
|
1317 |
entry.iMsgStatus = RMobileSmsStore::EStoredMessageUnread;
|
|
1318 |
break;
|
|
1319 |
case KSimSmsStatusReportReqReceivedNotStored: //0x15
|
|
1320 |
case KSimSmsStatusReportReqReceivedStored: //0x1D
|
|
1321 |
entry.iMsgStatus = RMobileSmsStore::EStoredMessageDelivered;
|
|
1322 |
break;
|
|
1323 |
default:
|
|
1324 |
entry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
|
|
1325 |
break;
|
|
1326 |
}
|
|
1327 |
|
|
1328 |
// TMobileSmsFixedEntryV1 information
|
|
1329 |
entry.iMsgData.Copy( aSmsMsg->iSmsMsg );
|
|
1330 |
|
|
1331 |
// Lets handle Service Centre address
|
|
1332 |
entry.iServiceCentre.iTypeOfNumber = aSmsMsg->iMobileScTON;
|
|
1333 |
entry.iServiceCentre.iNumberPlan = aSmsMsg->iMobileScNPI;
|
|
1334 |
entry.iServiceCentre.iTelNumber.Copy( aSmsMsg->iServiceCentre );
|
|
1335 |
|
|
1336 |
return KErrNone;
|
|
1337 |
}
|
|
1338 |
|
|
1339 |
// ---------------------------------------------------------------------------
|
|
1340 |
// CMmSmsStorageTsy::UnpackSmsWriteEntryPackage
|
|
1341 |
// This method unpack a entry package and set location of the slot to the
|
|
1342 |
// entry.
|
|
1343 |
// (other items were commented in a header).
|
|
1344 |
// ---------------------------------------------------------------------------
|
|
1345 |
//
|
|
1346 |
TInt CMmSmsStorageTsy::UnpackSmsWriteEntryPackage(
|
|
1347 |
TAny* aWriteSmsEntryPtr,
|
|
1348 |
TInt aLocation )
|
|
1349 |
{
|
|
1350 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg*
|
|
1351 |
entryPckg = REINTERPRET_CAST
|
|
1352 |
( RMobileSmsStore::TMobileGsmSmsEntryV1Pckg*, aWriteSmsEntryPtr );
|
|
1353 |
RMobileSmsStore::TMobileGsmSmsEntryV1& entry = ( *entryPckg )();
|
|
1354 |
|
|
1355 |
// Let's copy location index
|
|
1356 |
entry.iIndex = aLocation;
|
|
1357 |
|
|
1358 |
return KErrNone;
|
|
1359 |
}
|
|
1360 |
|
|
1361 |
// End of File
|