24
|
1 |
// Copyright (c) 1997-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 |
#include "mmtsy.h"
|
|
17 |
#include "testdef.h"
|
|
18 |
#include "ETELMM.H"
|
|
19 |
#include <et_clsvr.h>
|
|
20 |
#include "Dmmlog.h"
|
|
21 |
|
|
22 |
|
|
23 |
CListReadAllAttempt* CListReadAllAttempt::NewL(RMobilePhone::TClientId* aId, TTsyReqHandle aReqHandle)
|
|
24 |
{
|
|
25 |
CListReadAllAttempt* read=new(ELeave) CListReadAllAttempt(aId, aReqHandle);
|
|
26 |
CleanupStack::PushL(read);
|
|
27 |
read->ConstructL();
|
|
28 |
CleanupStack::Pop();
|
|
29 |
return read;
|
|
30 |
}
|
|
31 |
|
|
32 |
CListReadAllAttempt::CListReadAllAttempt(RMobilePhone::TClientId* aId, TTsyReqHandle aReqHandle)
|
|
33 |
:CBase()
|
|
34 |
{
|
|
35 |
iClient.iSessionHandle=aId->iSessionHandle;
|
|
36 |
iClient.iSubSessionHandle=aId->iSubSessionHandle;
|
|
37 |
iReqHandle=aReqHandle;
|
|
38 |
iListBuf = NULL;
|
|
39 |
}
|
|
40 |
|
|
41 |
void CListReadAllAttempt::ConstructL()
|
|
42 |
{
|
|
43 |
}
|
|
44 |
|
|
45 |
CListReadAllAttempt::~CListReadAllAttempt()
|
|
46 |
{
|
|
47 |
delete iListBuf;
|
|
48 |
}
|
|
49 |
|
|
50 |
/**************************************************************************/
|
|
51 |
//
|
|
52 |
// CSmsStoreDMmTsy
|
|
53 |
//
|
|
54 |
/**************************************************************************/
|
|
55 |
|
|
56 |
CSmsStoreDMmTsy* CSmsStoreDMmTsy::NewL(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac,
|
|
57 |
const TDesC& aName)
|
|
58 |
{
|
|
59 |
CSmsStoreDMmTsy* subsession=new(ELeave) CSmsStoreDMmTsy(aPhone,aFac,aName);
|
|
60 |
CleanupStack::PushL(subsession);
|
|
61 |
subsession->ConstructL();
|
|
62 |
CleanupStack::Pop();
|
|
63 |
return subsession;
|
|
64 |
}
|
|
65 |
|
|
66 |
void CSmsStoreDMmTsy::Init()
|
|
67 |
{}
|
|
68 |
|
|
69 |
CSmsStoreDMmTsy::CSmsStoreDMmTsy(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac,
|
|
70 |
const TDesC& aName)
|
|
71 |
:CSubSessionExtDummyBase(aFac), iPhone(aPhone)
|
|
72 |
{
|
|
73 |
iSmsStoreName=aName;
|
|
74 |
}
|
|
75 |
|
|
76 |
void CSmsStoreDMmTsy::ConstructL()
|
|
77 |
{
|
|
78 |
iSmsReadAll = new CArrayPtrFlat<CListReadAllAttempt>(1);
|
|
79 |
LOGTEXT(_L8("CSmsStoreDMmTsy created"));
|
|
80 |
}
|
|
81 |
|
|
82 |
CSmsStoreDMmTsy::~CSmsStoreDMmTsy()
|
|
83 |
{
|
|
84 |
for (TInt i=iSmsReadAll->Count()-1; i>=0; --i)
|
|
85 |
{
|
|
86 |
CListReadAllAttempt* ptr=iSmsReadAll->At(i);
|
|
87 |
iSmsReadAll->Delete(i);
|
|
88 |
delete ptr;
|
|
89 |
}
|
|
90 |
delete iSmsReadAll;
|
|
91 |
LOGTEXT(_L8("CSmsStoreDMmTsy destroyed"));
|
|
92 |
}
|
|
93 |
|
|
94 |
CTelObject* CSmsStoreDMmTsy::OpenNewObjectByNameL(const TDesC&)
|
|
95 |
{
|
|
96 |
User::Leave(KErrNotSupported);
|
|
97 |
return NULL;
|
|
98 |
}
|
|
99 |
|
|
100 |
CTelObject* CSmsStoreDMmTsy::OpenNewObjectL(TDes&)
|
|
101 |
{
|
|
102 |
User::Leave(KErrNotSupported);
|
|
103 |
return NULL;
|
|
104 |
}
|
|
105 |
|
|
106 |
CTelObject::TReqMode CSmsStoreDMmTsy::ReqModeL(const TInt aIpc)
|
|
107 |
{
|
|
108 |
CTelObject::TReqMode ret=0;
|
|
109 |
switch (aIpc)
|
|
110 |
{
|
|
111 |
|
|
112 |
//
|
|
113 |
// Normal Services
|
|
114 |
//
|
|
115 |
|
|
116 |
//
|
|
117 |
// Flow Controlled Services
|
|
118 |
//
|
|
119 |
case EMobilePhoneStoreRead:
|
|
120 |
case EMobilePhoneStoreWrite:
|
|
121 |
case EMobilePhoneStoreDelete:
|
|
122 |
case EMobilePhoneStoreDeleteAll:
|
|
123 |
case EMobilePhoneStoreReadAllPhase1:
|
|
124 |
case EMobilePhoneStoreReadAllPhase2:
|
|
125 |
case EMobilePhoneStoreGetInfo:
|
|
126 |
ret=KReqModeFlowControlObeyed;
|
|
127 |
break;
|
|
128 |
|
|
129 |
//
|
|
130 |
// Multiple Completion Services with Immediate Server Repost
|
|
131 |
// (Usually Notifications)
|
|
132 |
//
|
|
133 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
134 |
ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
135 |
break;
|
|
136 |
//
|
|
137 |
// Cancel Requests
|
|
138 |
//
|
|
139 |
case EMobilePhoneStoreGetInfoCancel:
|
|
140 |
case EMobilePhoneStoreReadCancel:
|
|
141 |
case EMobilePhoneStoreWriteCancel:
|
|
142 |
case EMobilePhoneStoreDeleteCancel:
|
|
143 |
case EMobilePhoneStoreDeleteAllCancel:
|
|
144 |
case EMobilePhoneStoreReadAllCancel:
|
|
145 |
case EMobilePhoneStoreNotifyStoreEventCancel:
|
|
146 |
default:
|
|
147 |
User::Leave(KErrNotSupported);
|
|
148 |
break;
|
|
149 |
}
|
|
150 |
return ret;
|
|
151 |
}
|
|
152 |
|
|
153 |
TInt CSmsStoreDMmTsy::RegisterNotification(const TInt aIpc)
|
|
154 |
{
|
|
155 |
switch (aIpc)
|
|
156 |
{
|
|
157 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
158 |
LOGTEXT(_L8("CSmsStoreDMmTsy: RegisterNotification - Store Event "));
|
|
159 |
return KErrNone;
|
|
160 |
default:
|
|
161 |
// Unknown or invalid IPC
|
|
162 |
LOGTEXT(_L8("CSmsStoreDMmTsy: Register error, unknown IPC"));
|
|
163 |
return KErrNotSupported;
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
TInt CSmsStoreDMmTsy::DeregisterNotification(const TInt aIpc)
|
|
168 |
{
|
|
169 |
switch (aIpc)
|
|
170 |
{
|
|
171 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
172 |
LOGTEXT(_L8("CSmsStoreDMmTsy: DeregisterNotification - Store Event "));
|
|
173 |
return KErrNone;
|
|
174 |
default:
|
|
175 |
// Unknown or invalid IPC
|
|
176 |
LOGTEXT(_L8("CSmsStoreDMmTsy: Deregister error, unknown IPC"));
|
|
177 |
return KErrNotSupported;
|
|
178 |
}
|
|
179 |
}
|
|
180 |
|
|
181 |
TInt CSmsStoreDMmTsy::NumberOfSlotsL(const TInt aIpc)
|
|
182 |
{
|
|
183 |
TInt numberOfSlots=1;
|
|
184 |
switch (aIpc)
|
|
185 |
{
|
|
186 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
187 |
LOGTEXT(_L8("CSmsStoreDMmTsy: Registered with 10 slots"));
|
|
188 |
numberOfSlots=10;
|
|
189 |
break;
|
|
190 |
default:
|
|
191 |
// Unknown or invalid Phone IPC
|
|
192 |
LOGTEXT(_L8("CSmsStoreDMmTsy: Number of Slots error, unknown IPC"));
|
|
193 |
User::Leave(KErrNotSupported);
|
|
194 |
break;
|
|
195 |
}
|
|
196 |
return numberOfSlots;
|
|
197 |
}
|
|
198 |
|
|
199 |
|
|
200 |
TInt CSmsStoreDMmTsy::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
|
|
201 |
const TDataPackage& aPackage)
|
|
202 |
{
|
|
203 |
TAny* dataPtr=aPackage.Ptr1();
|
|
204 |
TAny* dataPtr2=aPackage.Ptr2();
|
|
205 |
|
|
206 |
switch (aIpc)
|
|
207 |
{
|
|
208 |
case EMobilePhoneStoreRead:
|
|
209 |
return Read(aTsyReqHandle, aPackage.Des1n());
|
|
210 |
|
|
211 |
case EMobilePhoneStoreWrite:
|
|
212 |
return Write(aTsyReqHandle, aPackage.Des1n());
|
|
213 |
|
|
214 |
case EMobilePhoneStoreDelete:
|
|
215 |
return Delete(aTsyReqHandle,
|
|
216 |
REINTERPRET_CAST(TInt*,dataPtr));
|
|
217 |
|
|
218 |
case EMobilePhoneStoreDeleteAll:
|
|
219 |
return DeleteAll(aTsyReqHandle);
|
|
220 |
|
|
221 |
case EMobilePhoneStoreGetInfo:
|
|
222 |
return GetInfo(aTsyReqHandle,
|
|
223 |
REINTERPRET_CAST(RMobilePhoneStore::TMobilePhoneStoreInfoV1*, dataPtr));
|
|
224 |
|
|
225 |
case EMobilePhoneStoreReadAllPhase1:
|
|
226 |
return ReadAllPhase1(aTsyReqHandle,
|
|
227 |
REINTERPRET_CAST(CRetrieveMobilePhoneSmsList::TBatchRequestData*,dataPtr),
|
|
228 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
229 |
|
|
230 |
case EMobilePhoneStoreReadAllPhase2:
|
|
231 |
return ReadAllPhase2(aTsyReqHandle,
|
|
232 |
REINTERPRET_CAST(RMobilePhone::TClientId*,dataPtr),aPackage.Des2n());
|
|
233 |
|
|
234 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
235 |
return NotifyStoreEvent(aTsyReqHandle,
|
|
236 |
REINTERPRET_CAST(RMobilePhoneStore::TMobileStoreEvent*,dataPtr),
|
|
237 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
238 |
|
|
239 |
default:
|
|
240 |
return KErrNotSupported;
|
|
241 |
}
|
|
242 |
}
|
|
243 |
|
|
244 |
TInt CSmsStoreDMmTsy::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
245 |
{
|
|
246 |
switch (aIpc)
|
|
247 |
{
|
|
248 |
case EMobilePhoneStoreGetInfo:
|
|
249 |
return GetInfoCancel(aTsyReqHandle);
|
|
250 |
case EMobilePhoneStoreRead:
|
|
251 |
return ReadCancel(aTsyReqHandle);
|
|
252 |
case EMobilePhoneStoreWrite:
|
|
253 |
return WriteCancel(aTsyReqHandle);
|
|
254 |
case EMobilePhoneStoreDelete:
|
|
255 |
return DeleteCancel(aTsyReqHandle);
|
|
256 |
case EMobilePhoneStoreDeleteAll:
|
|
257 |
return DeleteAllCancel(aTsyReqHandle);
|
|
258 |
case EMobilePhoneStoreReadAllPhase1:
|
|
259 |
case EMobilePhoneStoreReadAllPhase2:
|
|
260 |
return ReadAllCancel(aTsyReqHandle);
|
|
261 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
262 |
return NotifyStoreEventCancel(aTsyReqHandle);
|
|
263 |
}
|
|
264 |
return KErrGeneral;
|
|
265 |
}
|
|
266 |
|
|
267 |
|
|
268 |
TInt CSmsStoreDMmTsy::Read(const TTsyReqHandle aTsyReqHandle, TDes8* aEntry)
|
|
269 |
{
|
|
270 |
LOGTEXT(_L8("CSmsStoreDMmTsy::Read called"));
|
|
271 |
|
|
272 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg* entryPckg = (RMobileSmsStore::TMobileGsmSmsEntryV1Pckg*)aEntry;
|
|
273 |
RMobileSmsStore::TMobileGsmSmsEntryV1& entry = (*entryPckg)();
|
|
274 |
|
|
275 |
if (entry.iIndex!=DMMTSY_SMS_STORE_INDEX1)
|
|
276 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
277 |
else
|
|
278 |
{
|
|
279 |
entry.iMsgData = DMMTSY_SMS_MESSAGE_PDU1;
|
|
280 |
entry.iMsgStatus =DMMTSY_SMS_STORE_STATUS1;
|
|
281 |
entry.iServiceCentre.iTelNumber = DMMTSY_PHONE_TEL_NUMBER;
|
|
282 |
entry.iServiceCentre.iTypeOfNumber = DMMTSY_PHONE_TON;
|
|
283 |
entry.iServiceCentre.iNumberPlan = DMMTSY_PHONE_NPI;
|
|
284 |
|
|
285 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
286 |
}
|
|
287 |
return KErrNone;
|
|
288 |
}
|
|
289 |
|
|
290 |
TInt CSmsStoreDMmTsy::ReadCancel(const TTsyReqHandle aTsyReqHandle)
|
|
291 |
{
|
|
292 |
LOGTEXT(_L8("CSmsStoreDMmTsy::ReadCancel called"));
|
|
293 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
294 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
295 |
return KErrNone;
|
|
296 |
}
|
|
297 |
|
|
298 |
TInt CSmsStoreDMmTsy::Write(const TTsyReqHandle aTsyReqHandle, TDesC8* aEntry)
|
|
299 |
{
|
|
300 |
LOGTEXT(_L8("CSmsStoreDMmTsy::Write called"));
|
|
301 |
|
|
302 |
RMobileSmsStore::TMobileCdmaSmsEntryV1Pckg* entryPckg = (RMobileSmsStore::TMobileCdmaSmsEntryV1Pckg*)aEntry;
|
|
303 |
RMobileSmsStore::TMobileCdmaSmsEntryV1& entry = (*entryPckg)();
|
|
304 |
|
|
305 |
if ((entry.iIndex != DMMTSY_SMS_STORE_INDEX2) ||
|
|
306 |
(entry.iMsgData.Compare(DMMTSY_SMS_MESSAGE_PDU2) != 0) ||
|
|
307 |
(entry.iMsgStatus != DMMTSY_SMS_STORE_STATUS2) ||
|
|
308 |
(entry.iRemoteParty.iTelNumber != DMMTSY_SMS_MESSAGE_REMOTEPARTYNUMBER2) ||
|
|
309 |
(entry.iTeleservice != DMMTSY_SMS_MESSAGE_TELESERVICE))
|
|
310 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
311 |
else
|
|
312 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
313 |
|
|
314 |
return KErrNone;
|
|
315 |
}
|
|
316 |
|
|
317 |
TInt CSmsStoreDMmTsy::WriteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
318 |
{
|
|
319 |
LOGTEXT(_L8("CSmsStoreDMmTsy::WriteCancel called"));
|
|
320 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
321 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
322 |
return KErrNone;
|
|
323 |
}
|
|
324 |
|
|
325 |
TInt CSmsStoreDMmTsy::Delete(const TTsyReqHandle aTsyReqHandle, TInt* aIndex)
|
|
326 |
{
|
|
327 |
LOGTEXT(_L8("CSmsStoreDMmTsy::Delete called"));
|
|
328 |
if (*aIndex!=DMMTSY_SMS_STORE_INDEX3)
|
|
329 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
330 |
else
|
|
331 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
332 |
return KErrNone;
|
|
333 |
}
|
|
334 |
|
|
335 |
TInt CSmsStoreDMmTsy::DeleteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
336 |
{
|
|
337 |
LOGTEXT(_L8("CSmsStoreDMmTsy::DeleteCancel called"));
|
|
338 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
339 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
340 |
return KErrNone;
|
|
341 |
}
|
|
342 |
|
|
343 |
TInt CSmsStoreDMmTsy::DeleteAll(const TTsyReqHandle aTsyReqHandle)
|
|
344 |
{
|
|
345 |
LOGTEXT(_L8("CSmsStoreDMmTsy::DeleteAll called"));
|
|
346 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
347 |
return KErrNone;
|
|
348 |
}
|
|
349 |
|
|
350 |
TInt CSmsStoreDMmTsy::DeleteAllCancel(const TTsyReqHandle aTsyReqHandle)
|
|
351 |
{
|
|
352 |
LOGTEXT(_L8("CSmsStoreDMmTsy::DeleteAllCancel called"));
|
|
353 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
354 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
355 |
return KErrNone;
|
|
356 |
}
|
|
357 |
|
|
358 |
TInt CSmsStoreDMmTsy::GetInfo(const TTsyReqHandle aTsyReqHandle, RMobilePhoneStore::TMobilePhoneStoreInfoV1* aInfo)
|
|
359 |
{
|
|
360 |
LOGTEXT(_L8("CSmsStoreDMmTsy::GetInfo called"));
|
|
361 |
|
|
362 |
aInfo->iName=DMMTSY_MESSAGE_STORE_NAME;
|
|
363 |
aInfo->iType=DMMTSY_MESSAGE_STORE_TYPE;
|
|
364 |
aInfo->iTotalEntries=DMMTSY_MESSAGE_STORE_TOTAL_ENTRIES;
|
|
365 |
aInfo->iUsedEntries=DMMTSY_MESSAGE_STORE_USED_ENTRIES;
|
|
366 |
aInfo->iCaps=DMMTSY_MESSAGE_STORE_CAPS;
|
|
367 |
|
|
368 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
369 |
return KErrNone;
|
|
370 |
}
|
|
371 |
|
|
372 |
TInt CSmsStoreDMmTsy::GetInfoCancel(const TTsyReqHandle aTsyReqHandle)
|
|
373 |
{
|
|
374 |
LOGTEXT(_L8("CSmsStoreDMmTsy::GetInfoCancel called"));
|
|
375 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
376 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
377 |
return KErrNone;
|
|
378 |
}
|
|
379 |
|
|
380 |
TInt CSmsStoreDMmTsy::NotifyStoreEvent(const TTsyReqHandle aTsyReqHandle,
|
|
381 |
RMobilePhoneStore::TMobileStoreEvent *aEvent,
|
|
382 |
TInt* aIndex)
|
|
383 |
{
|
|
384 |
if (!iNotifyStoreEvent++)
|
|
385 |
{
|
|
386 |
LOGTEXT(_L8("CSmsStoreDMmTsy::NotifyStoreEvent called"));
|
|
387 |
*aIndex=DMMTSY_SMS_STORE_INDEX4;
|
|
388 |
*aEvent=DMMTSY_MESSAGE_STORE_EVENT;
|
|
389 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
390 |
}
|
|
391 |
return KErrNone;
|
|
392 |
}
|
|
393 |
|
|
394 |
TInt CSmsStoreDMmTsy::NotifyStoreEventCancel(const TTsyReqHandle aTsyReqHandle)
|
|
395 |
{
|
|
396 |
LOGTEXT(_L8("CSmsStoreDMmTsy::NotifyStoreEventCancel called"));
|
|
397 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
398 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
399 |
return KErrNone;
|
|
400 |
}
|
|
401 |
|
|
402 |
TInt CSmsStoreDMmTsy::ReadAllPhase1(const TTsyReqHandle aTsyReqHandle, CRetrieveMobilePhoneSmsList::TBatchRequestData* aRequest, TInt* aBufSize)
|
|
403 |
{
|
|
404 |
LOGTEXT(_L8("CSmsStoreDMmTsy::ReadAllPhase1 called"));
|
|
405 |
TInt ret=KErrNone;
|
|
406 |
TInt leaveCode=KErrNone;
|
|
407 |
|
|
408 |
if (aRequest->iBatchRequest)
|
|
409 |
if ((aRequest->iBatchSize != DMMTSY_SMS_STORE_BATCH) ||
|
|
410 |
(aRequest->iStartIndex != DMMTSY_SMS_STORE_START))
|
|
411 |
leaveCode = KErrCorrupt;
|
|
412 |
|
|
413 |
if (leaveCode == KErrNone)
|
|
414 |
{
|
|
415 |
if (aRequest->iEntryType==DMMTSY_SMS_STORE_GSMENTRY_TYPE)
|
|
416 |
{
|
|
417 |
TRAP(leaveCode, ret=ProcessReadAllGsmPhase1L(aTsyReqHandle, &aRequest->iClient, aBufSize););
|
|
418 |
}
|
|
419 |
else
|
|
420 |
{
|
|
421 |
TRAP(leaveCode, ret=ProcessReadAllCdmaPhase1L(aTsyReqHandle, &aRequest->iClient, aBufSize););
|
|
422 |
}
|
|
423 |
}
|
|
424 |
|
|
425 |
if (leaveCode != KErrNone)
|
|
426 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
427 |
|
|
428 |
return ret;
|
|
429 |
};
|
|
430 |
|
|
431 |
TInt CSmsStoreDMmTsy::ProcessReadAllGsmPhase1L(const TTsyReqHandle aTsyReqHandle,
|
|
432 |
RMobilePhone::TClientId* aId,
|
|
433 |
TInt* aBufSize)
|
|
434 |
{
|
|
435 |
// read the list, store its content and then return size of this buffer to client
|
|
436 |
CMobilePhoneGsmSmsList* list=CMobilePhoneGsmSmsList::NewL();
|
|
437 |
CleanupStack::PushL(list);
|
|
438 |
|
|
439 |
RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
|
|
440 |
|
|
441 |
// fill up an example list
|
|
442 |
for (TInt index=0; index < DMMTSY_SMS_STORE_COUNT; index++)
|
|
443 |
{
|
|
444 |
switch (index)
|
|
445 |
{
|
|
446 |
case 0:
|
|
447 |
entry.iIndex = DMMTSY_SMS_STORE_INDEX1;
|
|
448 |
entry.iMsgData = DMMTSY_SMS_MESSAGE_PDU1;
|
|
449 |
entry.iServiceCentre.iTelNumber = DMMTSY_PHONE_TEL_NUMBER;
|
|
450 |
entry.iServiceCentre.iTypeOfNumber = DMMTSY_PHONE_TON;
|
|
451 |
entry.iServiceCentre.iNumberPlan = DMMTSY_PHONE_NPI;
|
|
452 |
entry.iMsgStatus = DMMTSY_SMS_STORE_STATUS1;
|
|
453 |
break;
|
|
454 |
case 1:
|
|
455 |
entry.iIndex = DMMTSY_SMS_STORE_INDEX2;
|
|
456 |
entry.iMsgData = DMMTSY_SMS_MESSAGE_PDU2;
|
|
457 |
entry.iServiceCentre.iTelNumber = DMMTSY_SMSP_STORE_SCA;
|
|
458 |
entry.iServiceCentre.iTypeOfNumber = DMMTSY_PHONE_TON;
|
|
459 |
entry.iServiceCentre.iNumberPlan = DMMTSY_PHONE_NPI;
|
|
460 |
entry.iMsgStatus = DMMTSY_SMS_STORE_STATUS2;
|
|
461 |
break;
|
|
462 |
case 2:
|
|
463 |
// No need to recopy other info parameters
|
|
464 |
// as they are identical to the ones in case 1 for this test
|
|
465 |
entry.iIndex=DMMTSY_SMS_STORE_INDEX3;
|
|
466 |
break;
|
|
467 |
case 3:
|
|
468 |
default:
|
|
469 |
// No need to recopy other info parameters
|
|
470 |
// as they are identical to the ones in case 1 for this test
|
|
471 |
entry.iIndex=DMMTSY_SMS_STORE_INDEX4;
|
|
472 |
break;
|
|
473 |
}
|
|
474 |
// Add the entry into the list, at the next empty location
|
|
475 |
list->AddEntryL(entry);
|
|
476 |
}
|
|
477 |
|
|
478 |
// Store the streamed list and the client ID
|
|
479 |
CListReadAllAttempt* read=CListReadAllAttempt::NewL(aId, aTsyReqHandle);
|
|
480 |
CleanupStack::PushL(read);
|
|
481 |
|
|
482 |
read->iListBuf = list->StoreLC();
|
|
483 |
CleanupStack::Pop(); // pop the CBufFlat allocated by StoreLC
|
|
484 |
|
|
485 |
iSmsReadAll->AppendL(read);
|
|
486 |
CleanupStack::Pop(); // pop the CListReadAllAttempt
|
|
487 |
|
|
488 |
// return the CBufFlat’s size to client
|
|
489 |
*aBufSize=(read->iListBuf)->Size();
|
|
490 |
|
|
491 |
// Complete first phase of list retrieval
|
|
492 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
493 |
CleanupStack::PopAndDestroy(); // pop&destroy list
|
|
494 |
return KErrNone;
|
|
495 |
}
|
|
496 |
|
|
497 |
|
|
498 |
TInt CSmsStoreDMmTsy::ProcessReadAllCdmaPhase1L(const TTsyReqHandle aTsyReqHandle,
|
|
499 |
RMobilePhone::TClientId* aId,
|
|
500 |
TInt* aBufSize)
|
|
501 |
{
|
|
502 |
// read the list, store its content and then return size of this buffer to client
|
|
503 |
CMobilePhoneCdmaSmsList* list=CMobilePhoneCdmaSmsList::NewL();
|
|
504 |
CleanupStack::PushL(list);
|
|
505 |
|
|
506 |
RMobileSmsStore::TMobileCdmaSmsEntryV1 entry;
|
|
507 |
|
|
508 |
// fill up an example list
|
|
509 |
for (TInt index=0; index < DMMTSY_SMS_STORE_COUNT; index++)
|
|
510 |
{
|
|
511 |
switch (index)
|
|
512 |
{
|
|
513 |
case 0:
|
|
514 |
entry.iIndex = DMMTSY_SMS_STORE_INDEX1;
|
|
515 |
entry.iMsgData = DMMTSY_SMS_MESSAGE_PDU1;
|
|
516 |
entry.iMsgStatus = DMMTSY_SMS_STORE_STATUS1;
|
|
517 |
entry.iRemoteParty.iTelNumber = DMMTSY_SMS_MESSAGE_REMOTEPARTYNUMBER1;
|
|
518 |
entry.iTeleservice = DMMTSY_SMS_MESSAGE_TELESERVICE;
|
|
519 |
break;
|
|
520 |
case 1:
|
|
521 |
entry.iIndex = DMMTSY_SMS_STORE_INDEX2;
|
|
522 |
entry.iMsgData = DMMTSY_SMS_MESSAGE_PDU2;
|
|
523 |
entry.iMsgStatus = DMMTSY_SMS_STORE_STATUS2;
|
|
524 |
break;
|
|
525 |
case 2:
|
|
526 |
// No need to recopy other info parameters
|
|
527 |
// as they are identical to the ones in case 1 for this test
|
|
528 |
entry.iIndex=DMMTSY_SMS_STORE_INDEX3;
|
|
529 |
break;
|
|
530 |
case 3:
|
|
531 |
default:
|
|
532 |
// No need to recopy other info parameters
|
|
533 |
// as they are identical to the ones in case 1 for this test
|
|
534 |
entry.iIndex=DMMTSY_SMS_STORE_INDEX4;
|
|
535 |
break;
|
|
536 |
}
|
|
537 |
// Add the entry into the list, at the next empty location
|
|
538 |
list->AddEntryL(entry);
|
|
539 |
}
|
|
540 |
|
|
541 |
// Store the streamed list and the client ID
|
|
542 |
CListReadAllAttempt* read=CListReadAllAttempt::NewL(aId,aTsyReqHandle);
|
|
543 |
CleanupStack::PushL(read);
|
|
544 |
|
|
545 |
read->iListBuf = list->StoreLC();
|
|
546 |
CleanupStack::Pop(); // pop the CBufFlat allocated by StoreLC
|
|
547 |
|
|
548 |
iSmsReadAll->AppendL(read);
|
|
549 |
CleanupStack::Pop(); // pop the CListReadAllAttempt
|
|
550 |
|
|
551 |
// return the CBufFlat’s size to client
|
|
552 |
*aBufSize=(read->iListBuf)->Size();
|
|
553 |
|
|
554 |
// Complete first phase of list retrieval
|
|
555 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
556 |
CleanupStack::PopAndDestroy(); // pop&destroy list
|
|
557 |
return KErrNone;
|
|
558 |
}
|
|
559 |
|
|
560 |
|
|
561 |
TInt CSmsStoreDMmTsy::ReadAllPhase2(TTsyReqHandle aTsyReqHandle, RMobilePhone::TClientId* aId, TDes8* aBuffer)
|
|
562 |
{
|
|
563 |
LOGTEXT(_L8("CSmsStoreDMmTsy::ReadAllPhase2 called"));
|
|
564 |
CListReadAllAttempt* read=NULL;
|
|
565 |
// Find the read attempt from this client
|
|
566 |
for (TInt i=0; i<iSmsReadAll->Count(); ++i)
|
|
567 |
{
|
|
568 |
read = iSmsReadAll->At(i);
|
|
569 |
if ((read->iClient.iSessionHandle==aId->iSessionHandle) &&
|
|
570 |
(read->iClient.iSubSessionHandle==aId->iSubSessionHandle))
|
|
571 |
{
|
|
572 |
TPtr8 bufPtr((read->iListBuf)->Ptr(0));
|
|
573 |
// Copy the streamed list to the client
|
|
574 |
aBuffer->Copy(bufPtr);
|
|
575 |
delete read;
|
|
576 |
iSmsReadAll->Delete(i);
|
|
577 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
578 |
return KErrNone;
|
|
579 |
}
|
|
580 |
}
|
|
581 |
// Should handle error case of not finding the matching client from read all phase 1
|
|
582 |
return KErrNotFound;
|
|
583 |
}
|
|
584 |
|
|
585 |
TInt CSmsStoreDMmTsy::ReadAllCancel(const TTsyReqHandle aTsyReqHandle)
|
|
586 |
{
|
|
587 |
LOGTEXT(_L8("CSmsStoreDMmTsy::ReadAllCancel called"));
|
|
588 |
|
|
589 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
590 |
|
|
591 |
// Remove the read all attempt from iSmsReadAll
|
|
592 |
CListReadAllAttempt* read=NULL;
|
|
593 |
for (TInt i=0; i<iSmsReadAll->Count(); ++i)
|
|
594 |
{
|
|
595 |
read = iSmsReadAll->At(i);
|
|
596 |
if (read->iReqHandle == aTsyReqHandle)
|
|
597 |
{
|
|
598 |
delete read;
|
|
599 |
iSmsReadAll->Delete(i);
|
|
600 |
break;
|
|
601 |
}
|
|
602 |
}
|
|
603 |
|
|
604 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
605 |
return KErrNone;
|
|
606 |
}
|
|
607 |
|
|
608 |
/**************************************************************************/
|
|
609 |
//
|
|
610 |
// CNamStoreDMmTsy
|
|
611 |
//
|
|
612 |
/**************************************************************************/
|
|
613 |
|
|
614 |
CNamStoreDMmTsy* CNamStoreDMmTsy::NewL(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac, const TDesC& aName)
|
|
615 |
{
|
|
616 |
CNamStoreDMmTsy* subsession=new(ELeave) CNamStoreDMmTsy(aPhone,aFac,aName);
|
|
617 |
CleanupStack::PushL(subsession);
|
|
618 |
subsession->ConstructL();
|
|
619 |
CleanupStack::Pop();
|
|
620 |
return subsession;
|
|
621 |
}
|
|
622 |
|
|
623 |
void CNamStoreDMmTsy::Init()
|
|
624 |
{}
|
|
625 |
|
|
626 |
CNamStoreDMmTsy::CNamStoreDMmTsy(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac, const TDesC& aName)
|
|
627 |
:CSubSessionExtDummyBase(aFac), iPhone(aPhone)
|
|
628 |
{
|
|
629 |
iNamStoreName=aName;
|
|
630 |
}
|
|
631 |
|
|
632 |
void CNamStoreDMmTsy::ConstructL()
|
|
633 |
{
|
|
634 |
iNamReadAll = new CArrayPtrFlat<CListReadAllAttempt>(1);
|
|
635 |
LOGTEXT(_L8("CNamStoreDMmTsy created"));
|
|
636 |
}
|
|
637 |
|
|
638 |
CNamStoreDMmTsy::~CNamStoreDMmTsy()
|
|
639 |
{
|
|
640 |
for (TInt i=iNamReadAll->Count()-1; i>=0; --i)
|
|
641 |
{
|
|
642 |
CListReadAllAttempt* ptr=iNamReadAll->At(i);
|
|
643 |
iNamReadAll->Delete(i);
|
|
644 |
delete ptr;
|
|
645 |
}
|
|
646 |
delete iNamReadAll;
|
|
647 |
LOGTEXT(_L8("CNamStoreDMmTsy destroyed"));
|
|
648 |
}
|
|
649 |
|
|
650 |
CTelObject* CNamStoreDMmTsy::OpenNewObjectByNameL(const TDesC&)
|
|
651 |
{
|
|
652 |
User::Leave(KErrNotSupported);
|
|
653 |
return NULL;
|
|
654 |
}
|
|
655 |
|
|
656 |
CTelObject* CNamStoreDMmTsy::OpenNewObjectL(TDes&)
|
|
657 |
{
|
|
658 |
User::Leave(KErrNotSupported);
|
|
659 |
return NULL;
|
|
660 |
}
|
|
661 |
|
|
662 |
CTelObject::TReqMode CNamStoreDMmTsy::ReqModeL(const TInt aIpc)
|
|
663 |
{
|
|
664 |
CTelObject::TReqMode ret=0;
|
|
665 |
switch (aIpc)
|
|
666 |
{
|
|
667 |
|
|
668 |
case EMobileNamStoreSetActiveNam:
|
|
669 |
break;
|
|
670 |
|
|
671 |
//
|
|
672 |
// Flow Controlled Services
|
|
673 |
//
|
|
674 |
case EMobilePhoneStoreRead:
|
|
675 |
case EMobilePhoneStoreWrite:
|
|
676 |
case EMobilePhoneStoreDelete:
|
|
677 |
case EMobilePhoneStoreDeleteAll:
|
|
678 |
case EMobilePhoneStoreReadAllPhase1:
|
|
679 |
case EMobilePhoneStoreReadAllPhase2:
|
|
680 |
case EMobilePhoneStoreReadAllV4Phase1:
|
|
681 |
case EMobilePhoneStoreReadAllV4Phase2:
|
|
682 |
case EMobilePhoneStoreGetInfo:
|
|
683 |
case EMobileNamStoreStoreAll:
|
|
684 |
case EMobileNamStoreStoreAllV4:
|
|
685 |
ret=KReqModeFlowControlObeyed;
|
|
686 |
break;
|
|
687 |
//
|
|
688 |
// Multiple Completion Services with Immediate Server Repost
|
|
689 |
// (Usually Notifications)
|
|
690 |
//
|
|
691 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
692 |
ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
693 |
break;
|
|
694 |
//
|
|
695 |
// Cancel Requests
|
|
696 |
//
|
|
697 |
case EMobilePhoneStoreGetInfoCancel:
|
|
698 |
case EMobilePhoneStoreReadCancel:
|
|
699 |
case EMobilePhoneStoreWriteCancel:
|
|
700 |
case EMobilePhoneStoreDeleteCancel:
|
|
701 |
case EMobilePhoneStoreDeleteAllCancel:
|
|
702 |
case EMobilePhoneStoreReadAllCancel:
|
|
703 |
case EMobilePhoneStoreNotifyStoreEventCancel:
|
|
704 |
case EMobileNamStoreStoreAllCancel:
|
|
705 |
case EMobileNamStoreStoreAllV4Cancel:
|
|
706 |
default:
|
|
707 |
User::Leave(KErrNotSupported);
|
|
708 |
break;
|
|
709 |
}
|
|
710 |
return ret;
|
|
711 |
}
|
|
712 |
|
|
713 |
TInt CNamStoreDMmTsy::RegisterNotification(const TInt aIpc)
|
|
714 |
{
|
|
715 |
switch (aIpc)
|
|
716 |
{
|
|
717 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
718 |
LOGTEXT(_L8("CNamStoreDMmTsy: RegisterNotification - Store Event "));
|
|
719 |
return KErrNone;
|
|
720 |
default:
|
|
721 |
// Unknown or invalid IPC
|
|
722 |
LOGTEXT(_L8("CSmsStoreDMmTsy: Register error, unknown IPC"));
|
|
723 |
return KErrNotSupported;
|
|
724 |
}
|
|
725 |
}
|
|
726 |
|
|
727 |
TInt CNamStoreDMmTsy::DeregisterNotification(const TInt aIpc)
|
|
728 |
{
|
|
729 |
switch (aIpc)
|
|
730 |
{
|
|
731 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
732 |
LOGTEXT(_L8("CNamStoreDMmTsy: DeregisterNotification - Store Event "));
|
|
733 |
return KErrNone;
|
|
734 |
default:
|
|
735 |
// Unknown or invalid IPC
|
|
736 |
LOGTEXT(_L8("CNamStoreDMmTsy: Deregister error, unknown IPC"));
|
|
737 |
return KErrNotSupported;
|
|
738 |
}
|
|
739 |
}
|
|
740 |
|
|
741 |
TInt CNamStoreDMmTsy::NumberOfSlotsL(const TInt aIpc)
|
|
742 |
{
|
|
743 |
TInt numberOfSlots=1;
|
|
744 |
switch (aIpc)
|
|
745 |
{
|
|
746 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
747 |
LOGTEXT(_L8("CNamStoreDMmTsy: Registered with 2 slot"));
|
|
748 |
numberOfSlots=2;
|
|
749 |
break;
|
|
750 |
default:
|
|
751 |
// Unknown or invalid Phone IPC
|
|
752 |
LOGTEXT(_L8("CNamStoreDMmTsy: Number of Slots error, unknown IPC"));
|
|
753 |
User::Leave(KErrNotSupported);
|
|
754 |
break;
|
|
755 |
}
|
|
756 |
return numberOfSlots;
|
|
757 |
}
|
|
758 |
|
|
759 |
|
|
760 |
TInt CNamStoreDMmTsy::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
|
|
761 |
const TDataPackage& aPackage)
|
|
762 |
{
|
|
763 |
TAny* dataPtr=aPackage.Ptr1();
|
|
764 |
TAny* dataPtr2=aPackage.Ptr2();
|
|
765 |
|
|
766 |
switch (aIpc)
|
|
767 |
{
|
|
768 |
case EMobilePhoneStoreRead:
|
|
769 |
return Read(aTsyReqHandle, aPackage.Des1n());
|
|
770 |
|
|
771 |
case EMobilePhoneStoreWrite:
|
|
772 |
return Write(aTsyReqHandle, aPackage.Des1n());
|
|
773 |
|
|
774 |
case EMobilePhoneStoreDelete:
|
|
775 |
return Delete(aTsyReqHandle,
|
|
776 |
REINTERPRET_CAST(TInt*,dataPtr));
|
|
777 |
|
|
778 |
case EMobilePhoneStoreDeleteAll:
|
|
779 |
return DeleteAll(aTsyReqHandle);
|
|
780 |
|
|
781 |
case EMobilePhoneStoreGetInfo:
|
|
782 |
return GetInfo(aTsyReqHandle,
|
|
783 |
REINTERPRET_CAST(RMobileNamStore::TMobileNamStoreInfoV1*, dataPtr));
|
|
784 |
|
|
785 |
case EMobilePhoneStoreReadAllPhase1:
|
|
786 |
return ReadAllPhase1(aTsyReqHandle,
|
|
787 |
REINTERPRET_CAST(CRetrieveMobilePhoneNamList::TNamRequestData*,dataPtr),
|
|
788 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
789 |
|
|
790 |
case EMobilePhoneStoreReadAllPhase2:
|
|
791 |
return ReadAllPhase2(aTsyReqHandle,
|
|
792 |
REINTERPRET_CAST(RMobilePhone::TClientId*,dataPtr),aPackage.Des2n());
|
|
793 |
|
|
794 |
case EMobilePhoneStoreReadAllV4Phase1:
|
|
795 |
return ReadAllPhase1V4(aTsyReqHandle,
|
|
796 |
REINTERPRET_CAST(CRetrieveMobilePhoneNamList::TNamRequestData*,dataPtr),
|
|
797 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
798 |
|
|
799 |
case EMobilePhoneStoreReadAllV4Phase2:
|
|
800 |
return ReadAllPhase2V4(aTsyReqHandle,
|
|
801 |
REINTERPRET_CAST(RMobilePhone::TClientId*,dataPtr),aPackage.Des2n());
|
|
802 |
|
|
803 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
804 |
return NotifyStoreEvent(aTsyReqHandle,
|
|
805 |
REINTERPRET_CAST(RMobilePhoneStore::TMobileStoreEvent*,dataPtr),
|
|
806 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
807 |
|
|
808 |
case EMobileNamStoreSetActiveNam:
|
|
809 |
return SetActiveNam(aTsyReqHandle,
|
|
810 |
REINTERPRET_CAST(TInt*,dataPtr));
|
|
811 |
|
|
812 |
case EMobileNamStoreStoreAll:
|
|
813 |
return StoreAll(aTsyReqHandle,REINTERPRET_CAST(TInt*,dataPtr),aPackage.Des2n());
|
|
814 |
|
|
815 |
case EMobileNamStoreStoreAllV4:
|
|
816 |
return StoreAllV4(aTsyReqHandle,REINTERPRET_CAST(TInt*,dataPtr),aPackage.Des2n());
|
|
817 |
|
|
818 |
default:
|
|
819 |
return KErrNotSupported;
|
|
820 |
}
|
|
821 |
}
|
|
822 |
|
|
823 |
TInt CNamStoreDMmTsy::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
824 |
{
|
|
825 |
switch (aIpc)
|
|
826 |
{
|
|
827 |
case EMobilePhoneStoreGetInfo:
|
|
828 |
return GetInfoCancel(aTsyReqHandle);
|
|
829 |
case EMobilePhoneStoreRead:
|
|
830 |
return ReadCancel(aTsyReqHandle);
|
|
831 |
case EMobilePhoneStoreWrite:
|
|
832 |
return WriteCancel(aTsyReqHandle);
|
|
833 |
case EMobilePhoneStoreDelete:
|
|
834 |
return DeleteCancel(aTsyReqHandle);
|
|
835 |
case EMobilePhoneStoreDeleteAll:
|
|
836 |
return DeleteAllCancel(aTsyReqHandle);
|
|
837 |
case EMobilePhoneStoreReadAllPhase1:
|
|
838 |
case EMobilePhoneStoreReadAllPhase2:
|
|
839 |
case EMobilePhoneStoreReadAllV4Phase1:
|
|
840 |
case EMobilePhoneStoreReadAllV4Phase2:
|
|
841 |
return ReadAllCancel(aTsyReqHandle);
|
|
842 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
843 |
return NotifyStoreEventCancel(aTsyReqHandle);
|
|
844 |
case EMobileNamStoreSetActiveNam:
|
|
845 |
return SetActiveNamCancel(aTsyReqHandle);
|
|
846 |
case EMobileNamStoreStoreAll:
|
|
847 |
case EMobileNamStoreStoreAllV4:
|
|
848 |
return StoreAllCancel(aTsyReqHandle);
|
|
849 |
}
|
|
850 |
return KErrGeneral;
|
|
851 |
}
|
|
852 |
|
|
853 |
|
|
854 |
void CNamStoreDMmTsy::InitNamEntry(RMobileNamStore::TMobileNamEntryV1& aEntry)
|
|
855 |
{
|
|
856 |
aEntry.iNamId = DMMTSY_NAM_STORE_NAMID;
|
|
857 |
aEntry.iParamIdentifier = DMMTSY_NAM_STORE_PARAM;
|
|
858 |
aEntry.iData = DMMTSY_NAM_STORE_DATA;
|
|
859 |
}
|
|
860 |
|
|
861 |
TInt CNamStoreDMmTsy::ValidateNamEntry(RMobileNamStore::TMobileNamEntryV1& aEntry)
|
|
862 |
{
|
|
863 |
if ((aEntry.iNamId != DMMTSY_NAM_STORE_NAMID) ||
|
|
864 |
(aEntry.iParamIdentifier != DMMTSY_NAM_STORE_PARAM) ||
|
|
865 |
(aEntry.iData.Compare(DMMTSY_NAM_STORE_DATA) != 0))
|
|
866 |
return KErrCorrupt;
|
|
867 |
else
|
|
868 |
return KErrNone;
|
|
869 |
}
|
|
870 |
|
|
871 |
void CNamStoreDMmTsy::InitNamEntry(RMobileNamStore::TMobileNamEntryV4& aEntry)
|
|
872 |
{
|
|
873 |
aEntry.iNamId = DMMTSY_NAM_STORE_NAMID;
|
|
874 |
aEntry.iParamIdentifier = DMMTSY_NAM_STORE_PARAM;
|
|
875 |
aEntry.iData = DMMTSY_NAM_STORE_DATA_V4;
|
|
876 |
}
|
|
877 |
|
|
878 |
TInt CNamStoreDMmTsy::ValidateNamEntry(RMobileNamStore::TMobileNamEntryV4& aEntry)
|
|
879 |
{
|
|
880 |
if ((aEntry.iNamId != DMMTSY_NAM_STORE_NAMID) ||
|
|
881 |
(aEntry.iParamIdentifier != DMMTSY_NAM_STORE_PARAM) ||
|
|
882 |
(aEntry.iData.Compare(DMMTSY_NAM_STORE_DATA_V4) != 0))
|
|
883 |
return KErrCorrupt;
|
|
884 |
else
|
|
885 |
return KErrNone;
|
|
886 |
}
|
|
887 |
|
|
888 |
TInt CNamStoreDMmTsy::Read(const TTsyReqHandle aTsyReqHandle, TDes8* aEntry)
|
|
889 |
{
|
|
890 |
LOGTEXT(_L8("CNamStoreDMmTsy::Read called"));
|
|
891 |
RMobileNamStore::TMobileNamEntryV1Pckg* entryPckg = (RMobileNamStore::TMobileNamEntryV1Pckg*)aEntry;
|
|
892 |
RMobileNamStore::TMobileNamEntryV4Pckg* entryV4Pckg = (RMobileNamStore::TMobileNamEntryV4Pckg*)aEntry;
|
|
893 |
|
|
894 |
RMobilePhone::TMultimodeType& entry = (*entryPckg)();
|
|
895 |
RMobileNamStore::TMobileNamEntryV1& entryV1 = (*entryPckg)();
|
|
896 |
RMobileNamStore::TMobileNamEntryV4& entryV4 = (*entryV4Pckg)();
|
|
897 |
|
|
898 |
if(entry.ExtensionId() == KETelExtMultimodeV1)
|
|
899 |
{
|
|
900 |
if (entryV1.iIndex!=DMMTSY_NAM_STORE_INDEX1)
|
|
901 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
902 |
else
|
|
903 |
{
|
|
904 |
InitNamEntry(entryV1);
|
|
905 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
906 |
}
|
|
907 |
}
|
|
908 |
else if(entry.ExtensionId() == KETelExtMultimodeV4)
|
|
909 |
{
|
|
910 |
if (entryV4.iIndex!=DMMTSY_NAM_STORE_INDEX1)
|
|
911 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
912 |
else
|
|
913 |
{
|
|
914 |
InitNamEntry(entryV4);
|
|
915 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
916 |
}
|
|
917 |
}
|
|
918 |
else
|
|
919 |
{
|
|
920 |
// if not multimode v1 or v4, there is a problem
|
|
921 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
922 |
}
|
|
923 |
|
|
924 |
return KErrNone;
|
|
925 |
}
|
|
926 |
|
|
927 |
TInt CNamStoreDMmTsy::ReadCancel(const TTsyReqHandle aTsyReqHandle)
|
|
928 |
{
|
|
929 |
LOGTEXT(_L8("CNamStoreDMmTsy::ReadCancel called"));
|
|
930 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
931 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
932 |
return KErrNone;
|
|
933 |
}
|
|
934 |
|
|
935 |
TInt CNamStoreDMmTsy::Write(const TTsyReqHandle aTsyReqHandle, TDesC8* aEntry)
|
|
936 |
{
|
|
937 |
LOGTEXT(_L8("CNamStoreDMmTsy::Write called"));
|
|
938 |
RMobileNamStore::TMobileNamEntryV1Pckg* entryPckg = (RMobileNamStore::TMobileNamEntryV1Pckg*)aEntry;
|
|
939 |
RMobileNamStore::TMobileNamEntryV4Pckg* entryV4Pckg = (RMobileNamStore::TMobileNamEntryV4Pckg*)aEntry;
|
|
940 |
|
|
941 |
RMobilePhone::TMultimodeType& entry = (*entryPckg)();
|
|
942 |
RMobileNamStore::TMobileNamEntryV1& entryV1 = (*entryPckg)();
|
|
943 |
RMobileNamStore::TMobileNamEntryV4& entryV4 = (*entryV4Pckg)();
|
|
944 |
|
|
945 |
if(entry.ExtensionId() == KETelExtMultimodeV1)
|
|
946 |
{
|
|
947 |
if ((entryV1.iIndex!=DMMTSY_NAM_STORE_INDEX2) || (ValidateNamEntry(entryV1) != KErrNone))
|
|
948 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
949 |
else
|
|
950 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
951 |
}
|
|
952 |
else if(entry.ExtensionId() == KETelExtMultimodeV4)
|
|
953 |
{
|
|
954 |
if ((entryV4.iIndex!=DMMTSY_NAM_STORE_INDEX2) || (ValidateNamEntry(entryV4) != KErrNone))
|
|
955 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
956 |
else
|
|
957 |
{
|
|
958 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
959 |
}
|
|
960 |
}
|
|
961 |
else
|
|
962 |
{
|
|
963 |
// if not multimode v1 or v4, there is a problem
|
|
964 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
965 |
}
|
|
966 |
return KErrNone;
|
|
967 |
}
|
|
968 |
|
|
969 |
TInt CNamStoreDMmTsy::WriteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
970 |
{
|
|
971 |
LOGTEXT(_L8("CNamStoreDMmTsy::WriteCancel called"));
|
|
972 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
973 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
974 |
return KErrNone;
|
|
975 |
}
|
|
976 |
|
|
977 |
TInt CNamStoreDMmTsy::Delete(const TTsyReqHandle aTsyReqHandle, TInt* aIndex)
|
|
978 |
{
|
|
979 |
LOGTEXT(_L8("CNamStoreDMmTsy::Delete called"));
|
|
980 |
if (*aIndex!=DMMTSY_NAM_STORE_INDEX1)
|
|
981 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
982 |
else
|
|
983 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
984 |
return KErrNone;
|
|
985 |
}
|
|
986 |
|
|
987 |
TInt CNamStoreDMmTsy::DeleteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
988 |
{
|
|
989 |
LOGTEXT(_L8("CNamStoreDMmTsy::DeleteCancel called"));
|
|
990 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
991 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
992 |
return KErrNone;
|
|
993 |
}
|
|
994 |
|
|
995 |
TInt CNamStoreDMmTsy::DeleteAll(const TTsyReqHandle aTsyReqHandle)
|
|
996 |
{
|
|
997 |
LOGTEXT(_L8("CNamStoreDMmTsy::DeleteAll called"));
|
|
998 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
999 |
return KErrNone;
|
|
1000 |
}
|
|
1001 |
|
|
1002 |
TInt CNamStoreDMmTsy::DeleteAllCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1003 |
{
|
|
1004 |
LOGTEXT(_L8("CNamStoreDMmTsy::DeleteAllCancel called"));
|
|
1005 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1006 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1007 |
return KErrNone;
|
|
1008 |
}
|
|
1009 |
|
|
1010 |
TInt CNamStoreDMmTsy::GetInfo(const TTsyReqHandle aTsyReqHandle, RMobileNamStore::TMobileNamStoreInfoV1* aInfo)
|
|
1011 |
{
|
|
1012 |
LOGTEXT(_L8("CNamStoreDMmTsy::GetInfo called"));
|
|
1013 |
aInfo->iName=DMMTSY_NAM_STORE_NAME;
|
|
1014 |
aInfo->iType=DMMTSY_NAM_STORE_TYPE;
|
|
1015 |
aInfo->iTotalEntries=DMMTSY_NAM_STORE_ENTRIES;
|
|
1016 |
aInfo->iUsedEntries=DMMTSY_NAM_STORE_USED;
|
|
1017 |
aInfo->iCaps=DMMTSY_NAM_STORE_CAPS;
|
|
1018 |
aInfo->iNamCount = DMMTSY_NAM_STORE_COUNT;
|
|
1019 |
aInfo->iActiveNam = DMMTSY_NAM_STORE_ACTIVE;
|
|
1020 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1021 |
|
|
1022 |
return KErrNone;
|
|
1023 |
}
|
|
1024 |
|
|
1025 |
TInt CNamStoreDMmTsy::GetInfoCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1026 |
{
|
|
1027 |
LOGTEXT(_L8("CNamStoreDMmTsy::GetInfoCancel called"));
|
|
1028 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1029 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1030 |
return KErrNone;
|
|
1031 |
}
|
|
1032 |
|
|
1033 |
TInt CNamStoreDMmTsy::NotifyStoreEvent(const TTsyReqHandle aTsyReqHandle,
|
|
1034 |
RMobilePhoneStore::TMobileStoreEvent *aEvent,
|
|
1035 |
TInt* aIndex)
|
|
1036 |
{
|
|
1037 |
if (!iNotifyStoreEvent++)
|
|
1038 |
{
|
|
1039 |
LOGTEXT(_L8("CNamStoreDMmTsy::NotifyStoreEvent called"));
|
|
1040 |
*aIndex=DMMTSY_NAM_STORE_INDEX2;
|
|
1041 |
*aEvent = DMMTSY_NAM_STORE_EVENT;
|
|
1042 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1043 |
}
|
|
1044 |
return KErrNone;
|
|
1045 |
}
|
|
1046 |
|
|
1047 |
TInt CNamStoreDMmTsy::NotifyStoreEventCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1048 |
{
|
|
1049 |
LOGTEXT(_L8("CNamStoreDMmTsy::NotifyStoreEventCancel called"));
|
|
1050 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1051 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1052 |
return KErrNone;
|
|
1053 |
}
|
|
1054 |
|
|
1055 |
TInt CNamStoreDMmTsy::ReadAllPhase1(const TTsyReqHandle aTsyReqHandle, CRetrieveMobilePhoneNamList::TNamRequestData* aRequestData, TInt* aBufSize)
|
|
1056 |
{
|
|
1057 |
LOGTEXT(_L8("CNamStoreDMmTsy::ReadAllPhase1 called"));
|
|
1058 |
TInt ret=KErrNone;
|
|
1059 |
TInt leaveCode=KErrNone;
|
|
1060 |
if (aRequestData->iNamId != DMMTSY_NAM_STORE_NAMID)
|
|
1061 |
leaveCode = KErrCorrupt;
|
|
1062 |
else
|
|
1063 |
{
|
|
1064 |
TRAP(leaveCode, ret=ProcessReadAllPhase1L(aTsyReqHandle, &aRequestData->iClient, aBufSize););
|
|
1065 |
}
|
|
1066 |
if (leaveCode != KErrNone)
|
|
1067 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
1068 |
return ret;
|
|
1069 |
};
|
|
1070 |
|
|
1071 |
TInt CNamStoreDMmTsy::ReadAllPhase1V4(const TTsyReqHandle aTsyReqHandle, CRetrieveMobilePhoneNamList::TNamRequestData* aRequestData, TInt* aBufSize)
|
|
1072 |
{
|
|
1073 |
LOGTEXT(_L8("CNamStoreDMmTsy::ReadAllPhase1V4 called"));
|
|
1074 |
TInt ret=KErrNone;
|
|
1075 |
TInt leaveCode=KErrNone;
|
|
1076 |
if (aRequestData->iNamId != DMMTSY_NAM_STORE_NAMID)
|
|
1077 |
leaveCode = KErrCorrupt;
|
|
1078 |
else
|
|
1079 |
{
|
|
1080 |
TRAP(leaveCode, ret=ProcessReadAllPhase1V4L(aTsyReqHandle, &aRequestData->iClient, aBufSize););
|
|
1081 |
}
|
|
1082 |
if (leaveCode != KErrNone)
|
|
1083 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
1084 |
return ret;
|
|
1085 |
};
|
|
1086 |
|
|
1087 |
TInt CNamStoreDMmTsy::ProcessReadAllPhase1L(const TTsyReqHandle aTsyReqHandle,
|
|
1088 |
RMobilePhone::TClientId* aId,
|
|
1089 |
TInt* aBufSize)
|
|
1090 |
{
|
|
1091 |
// read the list, store its content and then return size of this buffer to client
|
|
1092 |
CMobilePhoneNamList* list=CMobilePhoneNamList::NewL();
|
|
1093 |
CleanupStack::PushL(list);
|
|
1094 |
|
|
1095 |
RMobileNamStore::TMobileNamEntryV1 entry;
|
|
1096 |
|
|
1097 |
// fill up an example list
|
|
1098 |
for (TInt index=0; index < DMMTSY_NAM_STORE_COUNT; index++)
|
|
1099 |
{
|
|
1100 |
switch (index)
|
|
1101 |
{
|
|
1102 |
case 0:
|
|
1103 |
InitNamEntry(entry);
|
|
1104 |
entry.iIndex=DMMTSY_NAM_STORE_INDEX1;
|
|
1105 |
break;
|
|
1106 |
case 1:
|
|
1107 |
InitNamEntry(entry);
|
|
1108 |
entry.iIndex=DMMTSY_NAM_STORE_INDEX2;
|
|
1109 |
default:
|
|
1110 |
break;
|
|
1111 |
}
|
|
1112 |
// Add the entry into the list, at the next empty location
|
|
1113 |
list->AddEntryL(entry);
|
|
1114 |
}
|
|
1115 |
|
|
1116 |
// Store the streamed list and the client ID
|
|
1117 |
CListReadAllAttempt* read=CListReadAllAttempt::NewL(aId,aTsyReqHandle);
|
|
1118 |
CleanupStack::PushL(read);
|
|
1119 |
|
|
1120 |
read->iListBuf = list->StoreLC();
|
|
1121 |
CleanupStack::Pop(); // pop the CBufFlat allocated by StoreLC
|
|
1122 |
|
|
1123 |
iNamReadAll->AppendL(read);
|
|
1124 |
CleanupStack::Pop(); // pop the CListReadAllAttempt
|
|
1125 |
|
|
1126 |
// return the CBufFlat’s size to client
|
|
1127 |
*aBufSize=(read->iListBuf)->Size();
|
|
1128 |
|
|
1129 |
// Complete first phase of list retrieval
|
|
1130 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1131 |
CleanupStack::PopAndDestroy(); // pop&destroy list
|
|
1132 |
return KErrNone;
|
|
1133 |
}
|
|
1134 |
|
|
1135 |
TInt CNamStoreDMmTsy::ProcessReadAllPhase1V4L(const TTsyReqHandle aTsyReqHandle,
|
|
1136 |
RMobilePhone::TClientId* aId,
|
|
1137 |
TInt* aBufSize)
|
|
1138 |
{
|
|
1139 |
// read the list, store its content and then return size of this buffer to client
|
|
1140 |
CMobilePhoneNamListV4* list=CMobilePhoneNamListV4::NewL();
|
|
1141 |
CleanupStack::PushL(list);
|
|
1142 |
|
|
1143 |
RMobileNamStore::TMobileNamEntryV4 entry;
|
|
1144 |
|
|
1145 |
// fill up an example list
|
|
1146 |
for (TInt index=0; index < DMMTSY_NAM_STORE_COUNT; index++)
|
|
1147 |
{
|
|
1148 |
switch (index)
|
|
1149 |
{
|
|
1150 |
case 0:
|
|
1151 |
InitNamEntry(entry);
|
|
1152 |
entry.iIndex=DMMTSY_NAM_STORE_INDEX1;
|
|
1153 |
break;
|
|
1154 |
case 1:
|
|
1155 |
InitNamEntry(entry);
|
|
1156 |
entry.iIndex=DMMTSY_NAM_STORE_INDEX2;
|
|
1157 |
default:
|
|
1158 |
break;
|
|
1159 |
}
|
|
1160 |
// Add the entry into the list, at the next empty location
|
|
1161 |
list->AddEntryL(entry);
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
// Store the streamed list and the client ID
|
|
1165 |
CListReadAllAttempt* read=CListReadAllAttempt::NewL(aId,aTsyReqHandle);
|
|
1166 |
CleanupStack::PushL(read);
|
|
1167 |
|
|
1168 |
read->iListBuf = list->StoreLC();
|
|
1169 |
CleanupStack::Pop(); // pop the CBufFlat allocated by StoreLC
|
|
1170 |
|
|
1171 |
iNamReadAll->AppendL(read);
|
|
1172 |
CleanupStack::Pop(); // pop the CListReadAllAttempt
|
|
1173 |
|
|
1174 |
// return the CBufFlat’s size to client
|
|
1175 |
*aBufSize=(read->iListBuf)->Size();
|
|
1176 |
|
|
1177 |
// Complete first phase of list retrieval
|
|
1178 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1179 |
CleanupStack::PopAndDestroy(); // pop&destroy list
|
|
1180 |
return KErrNone;
|
|
1181 |
}
|
|
1182 |
|
|
1183 |
TInt CNamStoreDMmTsy::ReadAllPhase2(TTsyReqHandle aTsyReqHandle, RMobilePhone::TClientId* aId, TDes8* aBuffer)
|
|
1184 |
{
|
|
1185 |
LOGTEXT(_L8("CNamStoreDMmTsy::ReadAllPhase2 called"));
|
|
1186 |
CListReadAllAttempt* read=NULL;
|
|
1187 |
// Find the read attempt from this client
|
|
1188 |
for (TInt i=0; i<iNamReadAll->Count(); ++i)
|
|
1189 |
{
|
|
1190 |
read = iNamReadAll->At(i);
|
|
1191 |
if ((read->iClient.iSessionHandle==aId->iSessionHandle) &&
|
|
1192 |
(read->iClient.iSubSessionHandle==aId->iSubSessionHandle))
|
|
1193 |
{
|
|
1194 |
TPtr8 bufPtr((read->iListBuf)->Ptr(0));
|
|
1195 |
// Copy the streamed list to the client
|
|
1196 |
aBuffer->Copy(bufPtr);
|
|
1197 |
delete read;
|
|
1198 |
iNamReadAll->Delete(i);
|
|
1199 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
1200 |
return KErrNone;
|
|
1201 |
}
|
|
1202 |
}
|
|
1203 |
// Should handle error case of not finding the matching client from read all phase 1
|
|
1204 |
return KErrNotFound;
|
|
1205 |
}
|
|
1206 |
|
|
1207 |
TInt CNamStoreDMmTsy::ReadAllPhase2V4(TTsyReqHandle aTsyReqHandle, RMobilePhone::TClientId* aId, TDes8* aBuffer)
|
|
1208 |
{
|
|
1209 |
LOGTEXT(_L8("CNamStoreDMmTsy::ReadAllPhase2V4 called"));
|
|
1210 |
CListReadAllAttempt* read=NULL;
|
|
1211 |
// Find the read attempt from this client
|
|
1212 |
for (TInt i=0; i<iNamReadAll->Count(); ++i)
|
|
1213 |
{
|
|
1214 |
read = iNamReadAll->At(i);
|
|
1215 |
if ((read->iClient.iSessionHandle==aId->iSessionHandle) &&
|
|
1216 |
(read->iClient.iSubSessionHandle==aId->iSubSessionHandle))
|
|
1217 |
{
|
|
1218 |
TPtr8 bufPtr((read->iListBuf)->Ptr(0));
|
|
1219 |
// Copy the streamed list to the client
|
|
1220 |
aBuffer->Copy(bufPtr);
|
|
1221 |
delete read;
|
|
1222 |
iNamReadAll->Delete(i);
|
|
1223 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
1224 |
return KErrNone;
|
|
1225 |
}
|
|
1226 |
}
|
|
1227 |
// Should handle error case of not finding the matching client from read all phase 1
|
|
1228 |
return KErrNotFound;
|
|
1229 |
}
|
|
1230 |
|
|
1231 |
TInt CNamStoreDMmTsy::ReadAllCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1232 |
{
|
|
1233 |
LOGTEXT(_L8("CNamStoreDMmTsy::ReadAllCancel called"));
|
|
1234 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1235 |
|
|
1236 |
// Remove the read all attempt from iNamReadAll
|
|
1237 |
CListReadAllAttempt* read=NULL;
|
|
1238 |
for (TInt i=0; i<iNamReadAll->Count(); ++i)
|
|
1239 |
{
|
|
1240 |
read = iNamReadAll->At(i);
|
|
1241 |
if (read->iReqHandle == aTsyReqHandle)
|
|
1242 |
{
|
|
1243 |
delete read;
|
|
1244 |
iNamReadAll->Delete(i);
|
|
1245 |
break;
|
|
1246 |
}
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1250 |
return KErrNone;
|
|
1251 |
}
|
|
1252 |
|
|
1253 |
TInt CNamStoreDMmTsy::SetActiveNam(const TTsyReqHandle aTsyReqHandle, TInt *aNamId)
|
|
1254 |
{
|
|
1255 |
LOGTEXT(_L8("CNamStoreDMmTsy::SetActiveNam called"));
|
|
1256 |
|
|
1257 |
if (*aNamId != DMMTSY_NAM_STORE_NAMID)
|
|
1258 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1259 |
else
|
|
1260 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1261 |
|
|
1262 |
return KErrNone;
|
|
1263 |
}
|
|
1264 |
|
|
1265 |
TInt CNamStoreDMmTsy::SetActiveNamCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1266 |
{
|
|
1267 |
LOGTEXT(_L8("CNamStoreDMmTsy::SetActiveCancelled called"));
|
|
1268 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1269 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1270 |
return KErrNone;
|
|
1271 |
}
|
|
1272 |
|
|
1273 |
TInt CNamStoreDMmTsy::StoreAll(const TTsyReqHandle aTsyReqHandle, TInt* aNamId, TDes8* aBuffer)
|
|
1274 |
{
|
|
1275 |
LOGTEXT(_L8("CNamStoreDMmTsy::StoreAll called"));
|
|
1276 |
TInt ret=KErrNone;
|
|
1277 |
TInt leaveCode=KErrNone;
|
|
1278 |
if (*aNamId != DMMTSY_NAM_STORE_NAMID)
|
|
1279 |
leaveCode = KErrCorrupt;
|
|
1280 |
else
|
|
1281 |
{
|
|
1282 |
TRAP(leaveCode, ret=ProcessStoreAllL(aTsyReqHandle, aBuffer););
|
|
1283 |
}
|
|
1284 |
if (leaveCode != KErrNone)
|
|
1285 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
1286 |
return ret;
|
|
1287 |
}
|
|
1288 |
|
|
1289 |
TInt CNamStoreDMmTsy::StoreAllV4(const TTsyReqHandle aTsyReqHandle, TInt* aNamId, TDes8* aBuffer)
|
|
1290 |
{
|
|
1291 |
LOGTEXT(_L8("CNamStoreDMmTsy::StoreAll called"));
|
|
1292 |
TInt ret=KErrNone;
|
|
1293 |
TInt leaveCode=KErrNone;
|
|
1294 |
if (*aNamId != DMMTSY_NAM_STORE_NAMID)
|
|
1295 |
leaveCode = KErrCorrupt;
|
|
1296 |
else
|
|
1297 |
{
|
|
1298 |
TRAP(leaveCode, ret=ProcessStoreAllV4L(aTsyReqHandle, aBuffer););
|
|
1299 |
}
|
|
1300 |
if (leaveCode != KErrNone)
|
|
1301 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
1302 |
return ret;
|
|
1303 |
}
|
|
1304 |
|
|
1305 |
TInt CNamStoreDMmTsy::ProcessStoreAllL(TTsyReqHandle aTsyReqHandle, TDes8* aBuffer)
|
|
1306 |
{
|
|
1307 |
CMobilePhoneNamList* aNamList=CMobilePhoneNamList::NewL();
|
|
1308 |
CleanupStack::PushL(aNamList);
|
|
1309 |
|
|
1310 |
aNamList->RestoreL(*aBuffer);
|
|
1311 |
|
|
1312 |
RMobileNamStore::TMobileNamEntryV1 entry;
|
|
1313 |
|
|
1314 |
if (aNamList->Enumerate() != DMMTSY_NAM_STORE_COUNT)
|
|
1315 |
{
|
|
1316 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1317 |
return KErrNone;
|
|
1318 |
}
|
|
1319 |
|
|
1320 |
entry=aNamList->GetEntryL(0);
|
|
1321 |
|
|
1322 |
if ((entry.iIndex != DMMTSY_NAM_STORE_INDEX1) ||
|
|
1323 |
(ValidateNamEntry(entry) != KErrNone))
|
|
1324 |
{
|
|
1325 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1326 |
return KErrNone;
|
|
1327 |
}
|
|
1328 |
|
|
1329 |
entry=aNamList->GetEntryL(1);
|
|
1330 |
|
|
1331 |
if ((entry.iIndex != DMMTSY_NAM_STORE_INDEX2) ||
|
|
1332 |
(ValidateNamEntry(entry) != KErrNone))
|
|
1333 |
{
|
|
1334 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1335 |
return KErrNone;
|
|
1336 |
}
|
|
1337 |
|
|
1338 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1339 |
CleanupStack::PopAndDestroy(aNamList);
|
|
1340 |
return KErrNone;
|
|
1341 |
}
|
|
1342 |
|
|
1343 |
TInt CNamStoreDMmTsy::ProcessStoreAllV4L(TTsyReqHandle aTsyReqHandle, TDes8* aBuffer)
|
|
1344 |
{
|
|
1345 |
CMobilePhoneNamListV4* aNamList=CMobilePhoneNamListV4::NewL();
|
|
1346 |
CleanupStack::PushL(aNamList);
|
|
1347 |
|
|
1348 |
aNamList->RestoreL(*aBuffer);
|
|
1349 |
|
|
1350 |
RMobileNamStore::TMobileNamEntryV4 entry;
|
|
1351 |
|
|
1352 |
if (aNamList->Enumerate() != DMMTSY_NAM_STORE_COUNT)
|
|
1353 |
{
|
|
1354 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1355 |
return KErrNone;
|
|
1356 |
}
|
|
1357 |
|
|
1358 |
entry=aNamList->GetEntryL(0);
|
|
1359 |
|
|
1360 |
if(entry.ExtensionId() != KETelExtMultimodeV4)
|
|
1361 |
{
|
|
1362 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1363 |
return KErrNone;
|
|
1364 |
}
|
|
1365 |
|
|
1366 |
if ((entry.iIndex != DMMTSY_NAM_STORE_INDEX1) ||
|
|
1367 |
(ValidateNamEntry(entry) != KErrNone))
|
|
1368 |
{
|
|
1369 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1370 |
return KErrNone;
|
|
1371 |
}
|
|
1372 |
|
|
1373 |
entry=aNamList->GetEntryL(1);
|
|
1374 |
|
|
1375 |
if ((entry.iIndex != DMMTSY_NAM_STORE_INDEX2) ||
|
|
1376 |
(ValidateNamEntry(entry) != KErrNone))
|
|
1377 |
{
|
|
1378 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1379 |
return KErrNone;
|
|
1380 |
}
|
|
1381 |
|
|
1382 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1383 |
CleanupStack::PopAndDestroy(aNamList);
|
|
1384 |
return KErrNone;
|
|
1385 |
}
|
|
1386 |
|
|
1387 |
TInt CNamStoreDMmTsy::StoreAllCancel(TTsyReqHandle aTsyReqHandle)
|
|
1388 |
{
|
|
1389 |
LOGTEXT(_L8("CNamStoreDMmTsy::StoreAllCancel called"));
|
|
1390 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1391 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1392 |
return KErrNone;
|
|
1393 |
}
|
|
1394 |
|
|
1395 |
|
|
1396 |
/**************************************************************************/
|
|
1397 |
//
|
|
1398 |
// CONStoreDMmTsy
|
|
1399 |
//
|
|
1400 |
/**************************************************************************/
|
|
1401 |
|
|
1402 |
CONStoreDMmTsy* CONStoreDMmTsy::NewL(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac, const TDesC& aName)
|
|
1403 |
{
|
|
1404 |
CONStoreDMmTsy* subsession=new(ELeave) CONStoreDMmTsy(aPhone,aFac,aName);
|
|
1405 |
CleanupStack::PushL(subsession);
|
|
1406 |
subsession->ConstructL();
|
|
1407 |
CleanupStack::Pop();
|
|
1408 |
return subsession;
|
|
1409 |
}
|
|
1410 |
|
|
1411 |
void CONStoreDMmTsy::Init()
|
|
1412 |
{}
|
|
1413 |
|
|
1414 |
CONStoreDMmTsy::CONStoreDMmTsy(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac, const TDesC& aName)
|
|
1415 |
:CSubSessionExtDummyBase(aFac), iPhone(aPhone)
|
|
1416 |
{
|
|
1417 |
iONStoreName=aName;
|
|
1418 |
}
|
|
1419 |
|
|
1420 |
void CONStoreDMmTsy::ConstructL()
|
|
1421 |
{
|
|
1422 |
iONReadAll = new CArrayPtrFlat<CListReadAllAttempt>(1);
|
|
1423 |
LOGTEXT(_L8("CONStoreDMmTsy created"));
|
|
1424 |
}
|
|
1425 |
|
|
1426 |
CONStoreDMmTsy::~CONStoreDMmTsy()
|
|
1427 |
{
|
|
1428 |
for (TInt i=iONReadAll->Count()-1; i>=0; --i)
|
|
1429 |
{
|
|
1430 |
CListReadAllAttempt* ptr=iONReadAll->At(i);
|
|
1431 |
iONReadAll->Delete(i);
|
|
1432 |
delete ptr;
|
|
1433 |
}
|
|
1434 |
delete iONReadAll;
|
|
1435 |
LOGTEXT(_L8("CONStoreDMmTsy destroyed"));
|
|
1436 |
}
|
|
1437 |
|
|
1438 |
CTelObject* CONStoreDMmTsy::OpenNewObjectByNameL(const TDesC&)
|
|
1439 |
{
|
|
1440 |
User::Leave(KErrNotSupported);
|
|
1441 |
return NULL;
|
|
1442 |
}
|
|
1443 |
|
|
1444 |
CTelObject* CONStoreDMmTsy::OpenNewObjectL(TDes&)
|
|
1445 |
{
|
|
1446 |
User::Leave(KErrNotSupported);
|
|
1447 |
return NULL;
|
|
1448 |
}
|
|
1449 |
|
|
1450 |
CTelObject::TReqMode CONStoreDMmTsy::ReqModeL(const TInt aIpc)
|
|
1451 |
{
|
|
1452 |
CTelObject::TReqMode ret=0;
|
|
1453 |
switch (aIpc)
|
|
1454 |
{
|
|
1455 |
//
|
|
1456 |
// Flow Controlled Services
|
|
1457 |
//
|
|
1458 |
case EMobilePhoneStoreRead:
|
|
1459 |
case EMobilePhoneStoreWrite:
|
|
1460 |
case EMobilePhoneStoreDelete:
|
|
1461 |
case EMobilePhoneStoreDeleteAll:
|
|
1462 |
case EMobilePhoneStoreReadAllPhase1:
|
|
1463 |
case EMobilePhoneStoreReadAllPhase2:
|
|
1464 |
case EMobilePhoneStoreGetInfo:
|
|
1465 |
case EMobileONStoreStoreAll:
|
|
1466 |
ret=KReqModeFlowControlObeyed;
|
|
1467 |
break;
|
|
1468 |
//
|
|
1469 |
// Multiple Completion Services with Immediate Server Repost
|
|
1470 |
// (Usually Notifications)
|
|
1471 |
//
|
|
1472 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
1473 |
ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
1474 |
break;
|
|
1475 |
//
|
|
1476 |
// Cancel Requests
|
|
1477 |
//
|
|
1478 |
case EMobilePhoneStoreGetInfoCancel:
|
|
1479 |
case EMobilePhoneStoreReadCancel:
|
|
1480 |
case EMobilePhoneStoreWriteCancel:
|
|
1481 |
case EMobilePhoneStoreDeleteCancel:
|
|
1482 |
case EMobilePhoneStoreDeleteAllCancel:
|
|
1483 |
case EMobilePhoneStoreReadAllCancel:
|
|
1484 |
case EMobilePhoneStoreNotifyStoreEventCancel:
|
|
1485 |
case EMobileONStoreStoreAllCancel:
|
|
1486 |
default:
|
|
1487 |
User::Leave(KErrNotSupported);
|
|
1488 |
break;
|
|
1489 |
}
|
|
1490 |
return ret;
|
|
1491 |
}
|
|
1492 |
|
|
1493 |
TInt CONStoreDMmTsy::RegisterNotification(const TInt aIpc)
|
|
1494 |
{
|
|
1495 |
switch (aIpc)
|
|
1496 |
{
|
|
1497 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
1498 |
LOGTEXT(_L8("CONStoreDMmTsy: RegisterNotification - Store Event "));
|
|
1499 |
return KErrNone;
|
|
1500 |
default:
|
|
1501 |
// Unknown or invalid IPC
|
|
1502 |
LOGTEXT(_L8("CONStoreDMmTsy: Register error, unknown IPC"));
|
|
1503 |
return KErrNotSupported;
|
|
1504 |
}
|
|
1505 |
}
|
|
1506 |
|
|
1507 |
TInt CONStoreDMmTsy::DeregisterNotification(const TInt aIpc)
|
|
1508 |
{
|
|
1509 |
switch (aIpc)
|
|
1510 |
{
|
|
1511 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
1512 |
LOGTEXT(_L8("CONStoreDMmTsy: DeregisterNotification - Store Event "));
|
|
1513 |
return KErrNone;
|
|
1514 |
default:
|
|
1515 |
// Unknown or invalid IPC
|
|
1516 |
LOGTEXT(_L8("CONStoreDMmTsy: Deregister error, unknown IPC"));
|
|
1517 |
return KErrNotSupported;
|
|
1518 |
}
|
|
1519 |
}
|
|
1520 |
|
|
1521 |
TInt CONStoreDMmTsy::NumberOfSlotsL(const TInt aIpc)
|
|
1522 |
{
|
|
1523 |
TInt numberOfSlots=1;
|
|
1524 |
switch (aIpc)
|
|
1525 |
{
|
|
1526 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
1527 |
LOGTEXT(_L8("CONStoreDMmTsy: Registered with 2 slot"));
|
|
1528 |
numberOfSlots=2;
|
|
1529 |
break;
|
|
1530 |
default:
|
|
1531 |
// Unknown or invalid Phone IPC
|
|
1532 |
LOGTEXT(_L8("CONStoreDMmTsy: Number of Slots error, unknown IPC"));
|
|
1533 |
User::Leave(KErrNotSupported);
|
|
1534 |
break;
|
|
1535 |
}
|
|
1536 |
return numberOfSlots;
|
|
1537 |
}
|
|
1538 |
|
|
1539 |
|
|
1540 |
TInt CONStoreDMmTsy::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
|
|
1541 |
const TDataPackage& aPackage)
|
|
1542 |
{
|
|
1543 |
TAny* dataPtr=aPackage.Ptr1();
|
|
1544 |
TAny* dataPtr2=aPackage.Ptr2();
|
|
1545 |
|
|
1546 |
switch (aIpc)
|
|
1547 |
{
|
|
1548 |
case EMobilePhoneStoreRead:
|
|
1549 |
return Read(aTsyReqHandle, aPackage.Des1n());
|
|
1550 |
|
|
1551 |
case EMobilePhoneStoreWrite:
|
|
1552 |
return Write(aTsyReqHandle, aPackage.Des1n());
|
|
1553 |
|
|
1554 |
case EMobilePhoneStoreDelete:
|
|
1555 |
return Delete(aTsyReqHandle,
|
|
1556 |
REINTERPRET_CAST(TInt*,dataPtr));
|
|
1557 |
|
|
1558 |
case EMobilePhoneStoreDeleteAll:
|
|
1559 |
return DeleteAll(aTsyReqHandle);
|
|
1560 |
|
|
1561 |
case EMobilePhoneStoreGetInfo:
|
|
1562 |
return GetInfo(aTsyReqHandle,
|
|
1563 |
REINTERPRET_CAST(RMobileONStore::TMobileONStoreInfoV1*, dataPtr));
|
|
1564 |
|
|
1565 |
case EMobilePhoneStoreReadAllPhase1:
|
|
1566 |
return ReadAllPhase1(aTsyReqHandle,
|
|
1567 |
REINTERPRET_CAST(RMobilePhone::TClientId*,dataPtr),
|
|
1568 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
1569 |
|
|
1570 |
case EMobilePhoneStoreReadAllPhase2:
|
|
1571 |
return ReadAllPhase2(aTsyReqHandle,
|
|
1572 |
REINTERPRET_CAST(RMobilePhone::TClientId*,dataPtr),aPackage.Des2n());
|
|
1573 |
|
|
1574 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
1575 |
return NotifyStoreEvent(aTsyReqHandle,
|
|
1576 |
REINTERPRET_CAST(RMobilePhoneStore::TMobileStoreEvent*,dataPtr),
|
|
1577 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
1578 |
|
|
1579 |
case EMobileONStoreStoreAll:
|
|
1580 |
return StoreAll(aTsyReqHandle,aPackage.Des1n());
|
|
1581 |
|
|
1582 |
|
|
1583 |
default:
|
|
1584 |
return KErrNotSupported;
|
|
1585 |
}
|
|
1586 |
}
|
|
1587 |
|
|
1588 |
TInt CONStoreDMmTsy::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
1589 |
{
|
|
1590 |
switch (aIpc)
|
|
1591 |
{
|
|
1592 |
case EMobilePhoneStoreGetInfo:
|
|
1593 |
return GetInfoCancel(aTsyReqHandle);
|
|
1594 |
case EMobilePhoneStoreRead:
|
|
1595 |
return ReadCancel(aTsyReqHandle);
|
|
1596 |
case EMobilePhoneStoreWrite:
|
|
1597 |
return WriteCancel(aTsyReqHandle);
|
|
1598 |
case EMobilePhoneStoreDelete:
|
|
1599 |
return DeleteCancel(aTsyReqHandle);
|
|
1600 |
case EMobilePhoneStoreDeleteAll:
|
|
1601 |
return DeleteAllCancel(aTsyReqHandle);
|
|
1602 |
case EMobilePhoneStoreReadAllPhase1:
|
|
1603 |
case EMobilePhoneStoreReadAllPhase2:
|
|
1604 |
return ReadAllCancel(aTsyReqHandle);
|
|
1605 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
1606 |
return NotifyStoreEventCancel(aTsyReqHandle);
|
|
1607 |
case EMobileONStoreStoreAll:
|
|
1608 |
return StoreAllCancel(aTsyReqHandle);
|
|
1609 |
}
|
|
1610 |
return KErrGeneral;
|
|
1611 |
}
|
|
1612 |
|
|
1613 |
|
|
1614 |
void CONStoreDMmTsy::InitONEntry(RMobileONStore::TMobileONEntryV1& aEntry)
|
|
1615 |
{
|
|
1616 |
aEntry.iMode = DMMTSY_ON_STORE_ENTRY_MODE;
|
|
1617 |
aEntry.iText = DMMTSY_ON_STORE_ENTRY_TEXT;
|
|
1618 |
aEntry.iNumber.iTypeOfNumber = DMMTSY_PHONE_TON;
|
|
1619 |
aEntry.iNumber.iNumberPlan = DMMTSY_PHONE_NPI;
|
|
1620 |
aEntry.iNumber.iTelNumber = DMMTSY_PHONE_TEL_NUMBER;
|
|
1621 |
aEntry.iService = DMMTSY_ON_STORE_ENTRY_SERVICE;
|
|
1622 |
}
|
|
1623 |
|
|
1624 |
TInt CONStoreDMmTsy::ValidateONEntry(RMobileONStore::TMobileONEntryV1& aEntry)
|
|
1625 |
{
|
|
1626 |
if ((aEntry.iMode != DMMTSY_ON_STORE_ENTRY_MODE) ||
|
|
1627 |
(aEntry.iText.Compare(DMMTSY_ON_STORE_ENTRY_TEXT) != 0) ||
|
|
1628 |
(aEntry.iNumber.iTypeOfNumber != DMMTSY_PHONE_TON) ||
|
|
1629 |
(aEntry.iNumber.iNumberPlan != DMMTSY_PHONE_NPI) ||
|
|
1630 |
(aEntry.iNumber.iTelNumber.Compare(DMMTSY_PHONE_TEL_NUMBER) != 0) ||
|
|
1631 |
(aEntry.iService != DMMTSY_ON_STORE_ENTRY_SERVICE))
|
|
1632 |
return KErrCorrupt;
|
|
1633 |
else
|
|
1634 |
return KErrNone;
|
|
1635 |
}
|
|
1636 |
|
|
1637 |
TInt CONStoreDMmTsy::Read(const TTsyReqHandle aTsyReqHandle, TDes8* aEntry)
|
|
1638 |
{
|
|
1639 |
LOGTEXT(_L8("CONStoreDMmTsy::Read called"));
|
|
1640 |
RMobileONStore::TMobileONEntryV1Pckg* entryPckg = (RMobileONStore::TMobileONEntryV1Pckg*)aEntry;
|
|
1641 |
RMobileONStore::TMobileONEntryV1& entry = (*entryPckg)();
|
|
1642 |
|
|
1643 |
if (entry.iIndex!=DMMTSY_ON_STORE_INDEX1)
|
|
1644 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1645 |
else
|
|
1646 |
{
|
|
1647 |
InitONEntry(entry);
|
|
1648 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1649 |
}
|
|
1650 |
return KErrNone;
|
|
1651 |
}
|
|
1652 |
|
|
1653 |
TInt CONStoreDMmTsy::ReadCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1654 |
{
|
|
1655 |
LOGTEXT(_L8("CONStoreDMmTsy::ReadCancel called"));
|
|
1656 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1657 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1658 |
return KErrNone;
|
|
1659 |
}
|
|
1660 |
|
|
1661 |
TInt CONStoreDMmTsy::Write(const TTsyReqHandle aTsyReqHandle, TDesC8* aEntry)
|
|
1662 |
{
|
|
1663 |
LOGTEXT(_L8("CONStoreDMmTsy::Write called"));
|
|
1664 |
RMobileONStore::TMobileONEntryV1Pckg* entryPckg = (RMobileONStore::TMobileONEntryV1Pckg*)aEntry;
|
|
1665 |
RMobileONStore::TMobileONEntryV1& entry = (*entryPckg)();
|
|
1666 |
|
|
1667 |
if ((entry.iIndex!=DMMTSY_ON_STORE_INDEX2) || (ValidateONEntry(entry) != KErrNone))
|
|
1668 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1669 |
else
|
|
1670 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1671 |
|
|
1672 |
return KErrNone;
|
|
1673 |
}
|
|
1674 |
|
|
1675 |
TInt CONStoreDMmTsy::WriteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1676 |
{
|
|
1677 |
LOGTEXT(_L8("CONStoreDMmTsy::WriteCancel called"));
|
|
1678 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1679 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1680 |
return KErrNone;
|
|
1681 |
}
|
|
1682 |
|
|
1683 |
TInt CONStoreDMmTsy::Delete(const TTsyReqHandle aTsyReqHandle, TInt* aIndex)
|
|
1684 |
{
|
|
1685 |
LOGTEXT(_L8("CONStoreDMmTsy::Delete called"));
|
|
1686 |
if (*aIndex!=DMMTSY_ON_STORE_INDEX1)
|
|
1687 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1688 |
else
|
|
1689 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1690 |
return KErrNone;
|
|
1691 |
}
|
|
1692 |
|
|
1693 |
TInt CONStoreDMmTsy::DeleteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1694 |
{
|
|
1695 |
LOGTEXT(_L8("CONStoreDMmTsy::DeleteCancel called"));
|
|
1696 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1697 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1698 |
return KErrNone;
|
|
1699 |
}
|
|
1700 |
|
|
1701 |
TInt CONStoreDMmTsy::DeleteAll(const TTsyReqHandle aTsyReqHandle)
|
|
1702 |
{
|
|
1703 |
LOGTEXT(_L8("CONStoreDMmTsy::DeleteAll called"));
|
|
1704 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1705 |
return KErrNone;
|
|
1706 |
}
|
|
1707 |
|
|
1708 |
TInt CONStoreDMmTsy::DeleteAllCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1709 |
{
|
|
1710 |
LOGTEXT(_L8("CONStoreDMmTsy::DeleteAllCancel called"));
|
|
1711 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1712 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1713 |
return KErrNone;
|
|
1714 |
}
|
|
1715 |
|
|
1716 |
TInt CONStoreDMmTsy::GetInfo(const TTsyReqHandle aTsyReqHandle, RMobileONStore::TMobileONStoreInfoV1* aInfo)
|
|
1717 |
{
|
|
1718 |
LOGTEXT(_L8("CONStoreDMmTsy::GetInfo called"));
|
|
1719 |
aInfo->iName=DMMTSY_ON_STORE_NAME;
|
|
1720 |
aInfo->iType=DMMTSY_ON_STORE_TYPE;
|
|
1721 |
aInfo->iTotalEntries=DMMTSY_ON_STORE_ENTRIES;
|
|
1722 |
aInfo->iUsedEntries=DMMTSY_ON_STORE_USED;
|
|
1723 |
aInfo->iCaps=DMMTSY_ON_STORE_CAPS;
|
|
1724 |
|
|
1725 |
aInfo->iNumberLen = DMMTSY_ON_STORE_INFO_GSM_MAX_NUM;
|
|
1726 |
aInfo->iTextLen = DMMTSY_ON_STORE_INFO_GSM_MAX_TEXT;
|
|
1727 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1728 |
|
|
1729 |
return KErrNone;
|
|
1730 |
}
|
|
1731 |
|
|
1732 |
TInt CONStoreDMmTsy::GetInfoCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1733 |
{
|
|
1734 |
LOGTEXT(_L8("CONStoreDMmTsy::GetInfoCancel called"));
|
|
1735 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1736 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1737 |
return KErrNone;
|
|
1738 |
}
|
|
1739 |
|
|
1740 |
TInt CONStoreDMmTsy::NotifyStoreEvent(const TTsyReqHandle aTsyReqHandle,
|
|
1741 |
RMobilePhoneStore::TMobileStoreEvent *aEvent,
|
|
1742 |
TInt* aIndex)
|
|
1743 |
{
|
|
1744 |
if (!iNotifyStoreEvent++)
|
|
1745 |
{
|
|
1746 |
LOGTEXT(_L8("CONStoreDMmTsy::NotifyStoreEvent called"));
|
|
1747 |
*aIndex=DMMTSY_ON_STORE_INDEX2;
|
|
1748 |
*aEvent = DMMTSY_ON_STORE_EVENT;
|
|
1749 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1750 |
}
|
|
1751 |
return KErrNone;
|
|
1752 |
}
|
|
1753 |
|
|
1754 |
TInt CONStoreDMmTsy::NotifyStoreEventCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1755 |
{
|
|
1756 |
LOGTEXT(_L8("CONStoreDMmTsy::NotifyStoreEventCancel called"));
|
|
1757 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1758 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1759 |
return KErrNone;
|
|
1760 |
}
|
|
1761 |
|
|
1762 |
TInt CONStoreDMmTsy::ReadAllPhase1(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TClientId* aId, TInt* aBufSize)
|
|
1763 |
{
|
|
1764 |
LOGTEXT(_L8("CONStoreDMmTsy::ReadAllPhase1 called"));
|
|
1765 |
TInt ret=KErrNone;
|
|
1766 |
TInt leaveCode=KErrNone;
|
|
1767 |
TRAP(leaveCode, ret=ProcessReadAllPhase1L(aTsyReqHandle, aId, aBufSize););
|
|
1768 |
if (leaveCode != KErrNone)
|
|
1769 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
1770 |
return ret;
|
|
1771 |
};
|
|
1772 |
|
|
1773 |
TInt CONStoreDMmTsy::ProcessReadAllPhase1L(const TTsyReqHandle aTsyReqHandle,
|
|
1774 |
RMobilePhone::TClientId* aId,
|
|
1775 |
TInt* aBufSize)
|
|
1776 |
{
|
|
1777 |
// read the list, store its content and then return size of this buffer to client
|
|
1778 |
CMobilePhoneONList* list=CMobilePhoneONList::NewL();
|
|
1779 |
CleanupStack::PushL(list);
|
|
1780 |
|
|
1781 |
RMobileONStore::TMobileONEntryV1 entry;
|
|
1782 |
|
|
1783 |
// fill up an example list
|
|
1784 |
for (TInt index=0; index < DMMTSY_ON_STORE_COUNT; index++)
|
|
1785 |
{
|
|
1786 |
switch (index)
|
|
1787 |
{
|
|
1788 |
case 0:
|
|
1789 |
InitONEntry(entry);
|
|
1790 |
entry.iIndex=DMMTSY_ON_STORE_INDEX1;
|
|
1791 |
break;
|
|
1792 |
case 1:
|
|
1793 |
InitONEntry(entry);
|
|
1794 |
entry.iIndex=DMMTSY_ON_STORE_INDEX2;
|
|
1795 |
default:
|
|
1796 |
break;
|
|
1797 |
}
|
|
1798 |
// Add the entry into the list, at the next empty location
|
|
1799 |
list->AddEntryL(entry);
|
|
1800 |
}
|
|
1801 |
|
|
1802 |
// Store the streamed list and the client ID
|
|
1803 |
CListReadAllAttempt* read=CListReadAllAttempt::NewL(aId,aTsyReqHandle);
|
|
1804 |
CleanupStack::PushL(read);
|
|
1805 |
|
|
1806 |
read->iListBuf = list->StoreLC();
|
|
1807 |
CleanupStack::Pop(); // pop the CBufFlat allocated by StoreLC
|
|
1808 |
|
|
1809 |
iONReadAll->AppendL(read);
|
|
1810 |
CleanupStack::Pop(); // pop the CListReadAllAttempt
|
|
1811 |
|
|
1812 |
// return the CBufFlat’s size to client
|
|
1813 |
*aBufSize=(read->iListBuf)->Size();
|
|
1814 |
|
|
1815 |
// Complete first phase of list retrieval
|
|
1816 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1817 |
CleanupStack::PopAndDestroy(); // pop&destroy list
|
|
1818 |
return KErrNone;
|
|
1819 |
}
|
|
1820 |
|
|
1821 |
|
|
1822 |
TInt CONStoreDMmTsy::ReadAllPhase2(TTsyReqHandle aTsyReqHandle, RMobilePhone::TClientId* aId, TDes8* aBuffer)
|
|
1823 |
{
|
|
1824 |
LOGTEXT(_L8("CONStoreDMmTsy::ReadAllPhase2 called"));
|
|
1825 |
CListReadAllAttempt* read=NULL;
|
|
1826 |
// Find the read attempt from this client
|
|
1827 |
for (TInt i=0; i<iONReadAll->Count(); ++i)
|
|
1828 |
{
|
|
1829 |
read = iONReadAll->At(i);
|
|
1830 |
if ((read->iClient.iSessionHandle==aId->iSessionHandle) &&
|
|
1831 |
(read->iClient.iSubSessionHandle==aId->iSubSessionHandle))
|
|
1832 |
{
|
|
1833 |
TPtr8 bufPtr((read->iListBuf)->Ptr(0));
|
|
1834 |
// Copy the streamed list to the client
|
|
1835 |
aBuffer->Copy(bufPtr);
|
|
1836 |
delete read;
|
|
1837 |
iONReadAll->Delete(i);
|
|
1838 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
1839 |
return KErrNone;
|
|
1840 |
}
|
|
1841 |
}
|
|
1842 |
// Should handle error case of not finding the matching client from read all phase 1
|
|
1843 |
return KErrNotFound;
|
|
1844 |
}
|
|
1845 |
|
|
1846 |
|
|
1847 |
TInt CONStoreDMmTsy::ReadAllCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1848 |
{
|
|
1849 |
LOGTEXT(_L8("CONStoreDMmTsy::ReadAllCancel called"));
|
|
1850 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1851 |
|
|
1852 |
// Remove the read all attempt from iONReadAll
|
|
1853 |
CListReadAllAttempt* read=NULL;
|
|
1854 |
for (TInt i=0; i<iONReadAll->Count(); ++i)
|
|
1855 |
{
|
|
1856 |
read = iONReadAll->At(i);
|
|
1857 |
if (read->iReqHandle == aTsyReqHandle)
|
|
1858 |
{
|
|
1859 |
delete read;
|
|
1860 |
iONReadAll->Delete(i);
|
|
1861 |
break;
|
|
1862 |
}
|
|
1863 |
}
|
|
1864 |
|
|
1865 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1866 |
return KErrNone;
|
|
1867 |
}
|
|
1868 |
|
|
1869 |
|
|
1870 |
TInt CONStoreDMmTsy::StoreAll(const TTsyReqHandle aTsyReqHandle, TDes8* aBuffer)
|
|
1871 |
{
|
|
1872 |
LOGTEXT(_L8("CONStoreDMmTsy::StoreAll called"));
|
|
1873 |
TInt ret=KErrNone;
|
|
1874 |
TInt leaveCode=KErrNone;
|
|
1875 |
TRAP(leaveCode, ret=ProcessStoreAllL(aTsyReqHandle, aBuffer););
|
|
1876 |
if (leaveCode != KErrNone)
|
|
1877 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
1878 |
return ret;
|
|
1879 |
}
|
|
1880 |
|
|
1881 |
TInt CONStoreDMmTsy::ProcessStoreAllL(TTsyReqHandle aTsyReqHandle, TDes8* aBuffer)
|
|
1882 |
{
|
|
1883 |
CMobilePhoneONList* aONList=CMobilePhoneONList::NewL();
|
|
1884 |
CleanupStack::PushL(aONList);
|
|
1885 |
|
|
1886 |
aONList->RestoreL(*aBuffer);
|
|
1887 |
|
|
1888 |
RMobileONStore::TMobileONEntryV1 entry;
|
|
1889 |
|
|
1890 |
if (aONList->Enumerate() != DMMTSY_ON_STORE_COUNT)
|
|
1891 |
{
|
|
1892 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1893 |
return KErrNone;
|
|
1894 |
}
|
|
1895 |
|
|
1896 |
entry=aONList->GetEntryL(0);
|
|
1897 |
|
|
1898 |
if ((entry.iIndex != DMMTSY_ON_STORE_INDEX1) ||
|
|
1899 |
(ValidateONEntry(entry) != KErrNone))
|
|
1900 |
{
|
|
1901 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1902 |
return KErrNone;
|
|
1903 |
}
|
|
1904 |
|
|
1905 |
entry=aONList->GetEntryL(1);
|
|
1906 |
|
|
1907 |
if ((entry.iIndex != DMMTSY_ON_STORE_INDEX2) ||
|
|
1908 |
(ValidateONEntry(entry) != KErrNone))
|
|
1909 |
{
|
|
1910 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
1911 |
return KErrNone;
|
|
1912 |
}
|
|
1913 |
|
|
1914 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
1915 |
CleanupStack::PopAndDestroy(); // aONList
|
|
1916 |
return KErrNone;
|
|
1917 |
}
|
|
1918 |
|
|
1919 |
TInt CONStoreDMmTsy::StoreAllCancel(TTsyReqHandle aTsyReqHandle)
|
|
1920 |
{
|
|
1921 |
LOGTEXT(_L8("CONStoreDMmTsy::StoreAllCancel called"));
|
|
1922 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
1923 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1924 |
return KErrNone;
|
|
1925 |
}
|
|
1926 |
|
|
1927 |
|
|
1928 |
/**************************************************************************/
|
|
1929 |
//
|
|
1930 |
// CENStoreDMmTsy
|
|
1931 |
//
|
|
1932 |
/**************************************************************************/
|
|
1933 |
|
|
1934 |
CENStoreDMmTsy* CENStoreDMmTsy::NewL(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac, const TDesC& aName)
|
|
1935 |
{
|
|
1936 |
CENStoreDMmTsy* subsession=new(ELeave) CENStoreDMmTsy(aPhone,aFac,aName);
|
|
1937 |
CleanupStack::PushL(subsession);
|
|
1938 |
subsession->ConstructL();
|
|
1939 |
CleanupStack::Pop();
|
|
1940 |
return subsession;
|
|
1941 |
}
|
|
1942 |
|
|
1943 |
void CENStoreDMmTsy::Init()
|
|
1944 |
{}
|
|
1945 |
|
|
1946 |
CENStoreDMmTsy::CENStoreDMmTsy(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac, const TDesC& aName)
|
|
1947 |
:CSubSessionExtDummyBase(aFac), iPhone(aPhone)
|
|
1948 |
{
|
|
1949 |
iENStoreName=aName;
|
|
1950 |
}
|
|
1951 |
|
|
1952 |
void CENStoreDMmTsy::ConstructL()
|
|
1953 |
{
|
|
1954 |
iENReadAll = new CArrayPtrFlat<CListReadAllAttempt>(1);
|
|
1955 |
LOGTEXT(_L8("CENStoreDMmTsy created"));
|
|
1956 |
}
|
|
1957 |
|
|
1958 |
CENStoreDMmTsy::~CENStoreDMmTsy()
|
|
1959 |
{
|
|
1960 |
if (iENReadAll)
|
|
1961 |
{
|
|
1962 |
for (TInt i=iENReadAll->Count()-1; i>=0; --i)
|
|
1963 |
{
|
|
1964 |
CListReadAllAttempt* ptr=iENReadAll->At(i);
|
|
1965 |
iENReadAll->Delete(i);
|
|
1966 |
delete ptr;
|
|
1967 |
}
|
|
1968 |
}
|
|
1969 |
delete iENReadAll;
|
|
1970 |
LOGTEXT(_L8("CENStoreDMmTsy destroyed"));
|
|
1971 |
}
|
|
1972 |
|
|
1973 |
CTelObject* CENStoreDMmTsy::OpenNewObjectByNameL(const TDesC&)
|
|
1974 |
{
|
|
1975 |
User::Leave(KErrNotSupported);
|
|
1976 |
return NULL;
|
|
1977 |
}
|
|
1978 |
|
|
1979 |
CTelObject* CENStoreDMmTsy::OpenNewObjectL(TDes&)
|
|
1980 |
{
|
|
1981 |
User::Leave(KErrNotSupported);
|
|
1982 |
return NULL;
|
|
1983 |
}
|
|
1984 |
|
|
1985 |
CTelObject::TReqMode CENStoreDMmTsy::ReqModeL(const TInt aIpc)
|
|
1986 |
{
|
|
1987 |
CTelObject::TReqMode ret=0;
|
|
1988 |
switch (aIpc)
|
|
1989 |
{
|
|
1990 |
//
|
|
1991 |
// Non Flow controlled services
|
|
1992 |
//
|
|
1993 |
case EMobilePhoneStoreReadAllPhase2:
|
|
1994 |
break;
|
|
1995 |
//
|
|
1996 |
// Flow Controlled Services
|
|
1997 |
//
|
|
1998 |
case EMobilePhoneStoreRead:
|
|
1999 |
case EMobilePhoneStoreWrite:
|
|
2000 |
case EMobilePhoneStoreDelete:
|
|
2001 |
case EMobilePhoneStoreDeleteAll:
|
|
2002 |
case EMobilePhoneStoreReadAllPhase1:
|
|
2003 |
case EMobilePhoneStoreGetInfo:
|
|
2004 |
ret=KReqModeFlowControlObeyed;
|
|
2005 |
break;
|
|
2006 |
//
|
|
2007 |
// Multiple Completion Services with Immediate Server Repost
|
|
2008 |
// (Usually Notifications)
|
|
2009 |
//
|
|
2010 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2011 |
ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
2012 |
break;
|
|
2013 |
//
|
|
2014 |
// Cancel Requests
|
|
2015 |
//
|
|
2016 |
case EMobilePhoneStoreGetInfoCancel:
|
|
2017 |
case EMobilePhoneStoreReadCancel:
|
|
2018 |
case EMobilePhoneStoreWriteCancel:
|
|
2019 |
case EMobilePhoneStoreDeleteCancel:
|
|
2020 |
case EMobilePhoneStoreDeleteAllCancel:
|
|
2021 |
case EMobilePhoneStoreReadAllCancel:
|
|
2022 |
case EMobilePhoneStoreNotifyStoreEventCancel:
|
|
2023 |
default:
|
|
2024 |
User::Leave(KErrNotSupported);
|
|
2025 |
break;
|
|
2026 |
}
|
|
2027 |
return ret;
|
|
2028 |
}
|
|
2029 |
|
|
2030 |
TInt CENStoreDMmTsy::RegisterNotification(const TInt aIpc)
|
|
2031 |
{
|
|
2032 |
switch (aIpc)
|
|
2033 |
{
|
|
2034 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2035 |
LOGTEXT(_L8("CENStoreDMmTsy: RegisterNotification - Store Event "));
|
|
2036 |
return KErrNone;
|
|
2037 |
default:
|
|
2038 |
// Unknown or invalid IPC
|
|
2039 |
LOGTEXT(_L8("CENStoreDMmTsy: Register error, unknown IPC"));
|
|
2040 |
return KErrNotSupported;
|
|
2041 |
}
|
|
2042 |
}
|
|
2043 |
|
|
2044 |
TInt CENStoreDMmTsy::DeregisterNotification(const TInt aIpc)
|
|
2045 |
{
|
|
2046 |
switch (aIpc)
|
|
2047 |
{
|
|
2048 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2049 |
LOGTEXT(_L8("CENStoreDMmTsy: DeregisterNotification - Store Event "));
|
|
2050 |
return KErrNone;
|
|
2051 |
default:
|
|
2052 |
// Unknown or invalid IPC
|
|
2053 |
LOGTEXT(_L8("CENStoreDMmTsy: Deregister error, unknown IPC"));
|
|
2054 |
return KErrNotSupported;
|
|
2055 |
}
|
|
2056 |
}
|
|
2057 |
|
|
2058 |
TInt CENStoreDMmTsy::NumberOfSlotsL(const TInt aIpc)
|
|
2059 |
{
|
|
2060 |
TInt numberOfSlots=1;
|
|
2061 |
switch (aIpc)
|
|
2062 |
{
|
|
2063 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2064 |
LOGTEXT(_L8("CENStoreDMmTsy: Registered with 2 slot"));
|
|
2065 |
numberOfSlots=2;
|
|
2066 |
break;
|
|
2067 |
default:
|
|
2068 |
// Unknown or invalid Phone IPC
|
|
2069 |
LOGTEXT(_L8("CENStoreDMmTsy: Number of Slots error, unknown IPC"));
|
|
2070 |
User::Leave(KErrNotSupported);
|
|
2071 |
break;
|
|
2072 |
}
|
|
2073 |
return numberOfSlots;
|
|
2074 |
}
|
|
2075 |
|
|
2076 |
|
|
2077 |
TInt CENStoreDMmTsy::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
|
|
2078 |
const TDataPackage& aPackage)
|
|
2079 |
{
|
|
2080 |
TAny* dataPtr=aPackage.Ptr1();
|
|
2081 |
TAny* dataPtr2=aPackage.Ptr2();
|
|
2082 |
|
|
2083 |
switch (aIpc)
|
|
2084 |
{
|
|
2085 |
case EMobilePhoneStoreRead:
|
|
2086 |
return Read(aTsyReqHandle, aPackage.Des1n());
|
|
2087 |
|
|
2088 |
case EMobilePhoneStoreWrite:
|
|
2089 |
return Write(aTsyReqHandle, aPackage.Des1n());
|
|
2090 |
|
|
2091 |
case EMobilePhoneStoreDelete:
|
|
2092 |
return Delete(aTsyReqHandle,
|
|
2093 |
REINTERPRET_CAST(TInt*,dataPtr));
|
|
2094 |
|
|
2095 |
case EMobilePhoneStoreDeleteAll:
|
|
2096 |
return DeleteAll(aTsyReqHandle);
|
|
2097 |
|
|
2098 |
case EMobilePhoneStoreGetInfo:
|
|
2099 |
return GetInfo(aTsyReqHandle,
|
|
2100 |
REINTERPRET_CAST(RMobilePhoneStore::TMobilePhoneStoreInfoV1*, dataPtr));
|
|
2101 |
|
|
2102 |
case EMobilePhoneStoreReadAllPhase1:
|
|
2103 |
return ReadAllPhase1(aTsyReqHandle,
|
|
2104 |
REINTERPRET_CAST(RMobilePhone::TClientId*,dataPtr),
|
|
2105 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
2106 |
|
|
2107 |
case EMobilePhoneStoreReadAllPhase2:
|
|
2108 |
return ReadAllPhase2(aTsyReqHandle,
|
|
2109 |
REINTERPRET_CAST(RMobilePhone::TClientId*,dataPtr),aPackage.Des2n());
|
|
2110 |
|
|
2111 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2112 |
return NotifyStoreEvent(aTsyReqHandle,
|
|
2113 |
REINTERPRET_CAST(RMobilePhoneStore::TMobileStoreEvent*,dataPtr),
|
|
2114 |
REINTERPRET_CAST(TInt*,dataPtr2));
|
|
2115 |
|
|
2116 |
default:
|
|
2117 |
return KErrNotSupported;
|
|
2118 |
}
|
|
2119 |
}
|
|
2120 |
|
|
2121 |
TInt CENStoreDMmTsy::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
2122 |
{
|
|
2123 |
switch (aIpc)
|
|
2124 |
{
|
|
2125 |
case EMobilePhoneStoreGetInfo:
|
|
2126 |
return GetInfoCancel(aTsyReqHandle);
|
|
2127 |
case EMobilePhoneStoreRead:
|
|
2128 |
return ReadCancel(aTsyReqHandle);
|
|
2129 |
case EMobilePhoneStoreWrite:
|
|
2130 |
return WriteCancel(aTsyReqHandle);
|
|
2131 |
case EMobilePhoneStoreDelete:
|
|
2132 |
return DeleteCancel(aTsyReqHandle);
|
|
2133 |
case EMobilePhoneStoreDeleteAll:
|
|
2134 |
return DeleteAllCancel(aTsyReqHandle);
|
|
2135 |
case EMobilePhoneStoreReadAllPhase1:
|
|
2136 |
case EMobilePhoneStoreReadAllPhase2:
|
|
2137 |
return ReadAllCancel(aTsyReqHandle);
|
|
2138 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2139 |
return NotifyStoreEventCancel(aTsyReqHandle);
|
|
2140 |
}
|
|
2141 |
return KErrGeneral;
|
|
2142 |
}
|
|
2143 |
|
|
2144 |
|
|
2145 |
void CENStoreDMmTsy::InitENEntry(RMobileENStore::TMobileENEntryV1& aEntry)
|
|
2146 |
{
|
|
2147 |
aEntry.iNetworkSpecific = DMMTSY_EN_STORE_NS;
|
|
2148 |
aEntry.iMode = DMMTSY_EN_STORE_MODE;
|
|
2149 |
aEntry.iCountryCode = DMMTSY_EN_STORE_CC;
|
|
2150 |
aEntry.iIdentity = DMMTSY_EN_STORE_ID;
|
|
2151 |
aEntry.iNumber = DMMTSY_EN_STORE_NUM;
|
|
2152 |
aEntry.iAlphaId = DMMTSY_EN_STORE_AMBULANCE_ID;
|
|
2153 |
aEntry.iCallType = DMMTSY_EN_STORE_CALL_TYPE;
|
|
2154 |
}
|
|
2155 |
|
|
2156 |
TInt CENStoreDMmTsy::ValidateENEntry(RMobileENStore::TMobileENEntryV1& aEntry)
|
|
2157 |
{
|
|
2158 |
if ((aEntry.iNetworkSpecific != DMMTSY_EN_STORE_NS) ||
|
|
2159 |
(aEntry.iMode != DMMTSY_EN_STORE_MODE) ||
|
|
2160 |
(aEntry.iCountryCode.Compare(DMMTSY_EN_STORE_CC) != 0) ||
|
|
2161 |
(aEntry.iIdentity.Compare(DMMTSY_EN_STORE_ID) != 0) ||
|
|
2162 |
(aEntry.iNumber.Compare(DMMTSY_EN_STORE_NUM) != 0) ||
|
|
2163 |
(aEntry.iAlphaId.Compare(DMMTSY_EN_STORE_AMBULANCE_ID) != 0) ||
|
|
2164 |
(aEntry.iCallType != DMMTSY_EN_STORE_CALL_TYPE))
|
|
2165 |
return KErrCorrupt;
|
|
2166 |
else
|
|
2167 |
return KErrNone;
|
|
2168 |
}
|
|
2169 |
|
|
2170 |
TInt CENStoreDMmTsy::Read(const TTsyReqHandle aTsyReqHandle, TDes8* aEntry)
|
|
2171 |
{
|
|
2172 |
|
|
2173 |
LOGTEXT(_L8("CENStoreDMmTsy::Read called"));
|
|
2174 |
RMobileENStore::TMobileENEntryV1Pckg* entryPckg = (RMobileENStore::TMobileENEntryV1Pckg*)aEntry;
|
|
2175 |
RMobileENStore::TMobileENEntryV1& entry = (*entryPckg)();
|
|
2176 |
|
|
2177 |
if (entry.iIndex!=DMMTSY_EN_STORE_INDEX1)
|
|
2178 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
2179 |
else
|
|
2180 |
{
|
|
2181 |
InitENEntry(entry);
|
|
2182 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2183 |
}
|
|
2184 |
return KErrNone;
|
|
2185 |
}
|
|
2186 |
|
|
2187 |
TInt CENStoreDMmTsy::ReadCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2188 |
{
|
|
2189 |
LOGTEXT(_L8("CENStoreDMmTsy::ReadCancel called"));
|
|
2190 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2191 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2192 |
return KErrNone;
|
|
2193 |
}
|
|
2194 |
|
|
2195 |
TInt CENStoreDMmTsy::Write(const TTsyReqHandle aTsyReqHandle, TDesC8* aEntry)
|
|
2196 |
{
|
|
2197 |
|
|
2198 |
LOGTEXT(_L8("CENStoreDMmTsy::Write called"));
|
|
2199 |
RMobileENStore::TMobileENEntryV1Pckg* entryPckg = (RMobileENStore::TMobileENEntryV1Pckg*)aEntry;
|
|
2200 |
RMobileENStore::TMobileENEntryV1& entry = (*entryPckg)();
|
|
2201 |
|
|
2202 |
if ((entry.iIndex!=DMMTSY_EN_STORE_INDEX2) || (ValidateENEntry(entry) != KErrNone))
|
|
2203 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
2204 |
else
|
|
2205 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2206 |
|
|
2207 |
return KErrNone;
|
|
2208 |
}
|
|
2209 |
|
|
2210 |
TInt CENStoreDMmTsy::WriteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2211 |
{
|
|
2212 |
LOGTEXT(_L8("CENStoreDMmTsy::WriteCancel called"));
|
|
2213 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2214 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2215 |
return KErrNone;
|
|
2216 |
}
|
|
2217 |
|
|
2218 |
TInt CENStoreDMmTsy::Delete(const TTsyReqHandle aTsyReqHandle, TInt* aIndex)
|
|
2219 |
{
|
|
2220 |
LOGTEXT(_L8("CENStoreDMmTsy::Delete called"));
|
|
2221 |
|
|
2222 |
if (*aIndex!=DMMTSY_EN_STORE_INDEX1)
|
|
2223 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
2224 |
else
|
|
2225 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2226 |
|
|
2227 |
return KErrNone;
|
|
2228 |
}
|
|
2229 |
|
|
2230 |
TInt CENStoreDMmTsy::DeleteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2231 |
{
|
|
2232 |
LOGTEXT(_L8("CENStoreDMmTsy::DeleteCancel called"));
|
|
2233 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2234 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2235 |
return KErrNone;
|
|
2236 |
}
|
|
2237 |
|
|
2238 |
TInt CENStoreDMmTsy::DeleteAll(const TTsyReqHandle aTsyReqHandle)
|
|
2239 |
{
|
|
2240 |
LOGTEXT(_L8("CENStoreDMmTsy::DeleteAll called"));
|
|
2241 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2242 |
return KErrNone;
|
|
2243 |
}
|
|
2244 |
|
|
2245 |
TInt CENStoreDMmTsy::DeleteAllCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2246 |
{
|
|
2247 |
LOGTEXT(_L8("CENStoreDMmTsy::DeleteAllCancel called"));
|
|
2248 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2249 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2250 |
return KErrNone;
|
|
2251 |
}
|
|
2252 |
|
|
2253 |
TInt CENStoreDMmTsy::GetInfo(const TTsyReqHandle aTsyReqHandle, RMobilePhoneStore::TMobilePhoneStoreInfoV1* aInfo)
|
|
2254 |
{
|
|
2255 |
LOGTEXT(_L8("CENStoreDMmTsy::GetInfo called"));
|
|
2256 |
|
|
2257 |
aInfo->iName=DMMTSY_EN_STORE_NAME;
|
|
2258 |
aInfo->iType=DMMTSY_EN_STORE_TYPE;
|
|
2259 |
aInfo->iTotalEntries=DMMTSY_EN_STORE_ENTRIES;
|
|
2260 |
aInfo->iUsedEntries=DMMTSY_EN_STORE_USED;
|
|
2261 |
aInfo->iCaps=DMMTSY_EN_STORE_CAPS;
|
|
2262 |
|
|
2263 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2264 |
|
|
2265 |
return KErrNone;
|
|
2266 |
}
|
|
2267 |
|
|
2268 |
TInt CENStoreDMmTsy::GetInfoCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2269 |
{
|
|
2270 |
LOGTEXT(_L8("CENStoreDMmTsy::GetInfoCancel called"));
|
|
2271 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2272 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2273 |
return KErrNone;
|
|
2274 |
}
|
|
2275 |
|
|
2276 |
TInt CENStoreDMmTsy::NotifyStoreEvent(const TTsyReqHandle aTsyReqHandle,
|
|
2277 |
RMobilePhoneStore::TMobileStoreEvent *aEvent,
|
|
2278 |
TInt* aIndex)
|
|
2279 |
{
|
|
2280 |
if (!iNotifyStoreEvent++)
|
|
2281 |
{
|
|
2282 |
LOGTEXT(_L8("CENStoreDMmTsy::NotifyStoreEvent called"));
|
|
2283 |
*aIndex=DMMTSY_EN_STORE_INDEX2;
|
|
2284 |
*aEvent = DMMTSY_EN_STORE_EVENT;
|
|
2285 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2286 |
}
|
|
2287 |
return KErrNone;
|
|
2288 |
}
|
|
2289 |
|
|
2290 |
TInt CENStoreDMmTsy::NotifyStoreEventCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2291 |
{
|
|
2292 |
LOGTEXT(_L8("CENStoreDMmTsy::NotifyStoreEventCancel called"));
|
|
2293 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2294 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2295 |
return KErrNone;
|
|
2296 |
}
|
|
2297 |
|
|
2298 |
TInt CENStoreDMmTsy::ReadAllPhase1(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TClientId *aId, TInt* aBufSize)
|
|
2299 |
{
|
|
2300 |
LOGTEXT(_L8("CENStoreDMmTsy::ReadAllPhase1 called"));
|
|
2301 |
|
|
2302 |
TInt ret=KErrNone;
|
|
2303 |
TInt leaveCode=KErrNone;
|
|
2304 |
TRAP(leaveCode, ret=ProcessReadAllPhase1L(aTsyReqHandle, aId, aBufSize););
|
|
2305 |
if (leaveCode != KErrNone)
|
|
2306 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
2307 |
|
|
2308 |
return ret;
|
|
2309 |
}
|
|
2310 |
|
|
2311 |
TInt CENStoreDMmTsy::ProcessReadAllPhase1L(const TTsyReqHandle aTsyReqHandle,
|
|
2312 |
RMobilePhone::TClientId* aId,
|
|
2313 |
TInt* aBufSize)
|
|
2314 |
{
|
|
2315 |
// read the list, store its content and then return size of this buffer to client
|
|
2316 |
CMobilePhoneENList* list=CMobilePhoneENList::NewL();
|
|
2317 |
CleanupStack::PushL(list);
|
|
2318 |
|
|
2319 |
RMobileENStore::TMobileENEntryV1 entry;
|
|
2320 |
|
|
2321 |
// fill up an example list
|
|
2322 |
for (TInt index=0; index < DMMTSY_EN_STORE_COUNT; index++)
|
|
2323 |
{
|
|
2324 |
switch (index)
|
|
2325 |
{
|
|
2326 |
case 0:
|
|
2327 |
InitENEntry(entry);
|
|
2328 |
entry.iIndex=DMMTSY_EN_STORE_INDEX1;
|
|
2329 |
break;
|
|
2330 |
case 1:
|
|
2331 |
InitENEntry(entry);
|
|
2332 |
entry.iIndex=DMMTSY_EN_STORE_INDEX2;
|
|
2333 |
default:
|
|
2334 |
break;
|
|
2335 |
}
|
|
2336 |
// Add the entry into the list, at the next empty location
|
|
2337 |
list->AddEntryL(entry);
|
|
2338 |
}
|
|
2339 |
|
|
2340 |
// Store the streamed list and the client ID
|
|
2341 |
CListReadAllAttempt* read=CListReadAllAttempt::NewL(aId,aTsyReqHandle);
|
|
2342 |
CleanupStack::PushL(read);
|
|
2343 |
|
|
2344 |
read->iListBuf = list->StoreLC();
|
|
2345 |
CleanupStack::Pop(); // pop the CBufFlat allocated by StoreLC
|
|
2346 |
|
|
2347 |
iENReadAll->AppendL(read);
|
|
2348 |
CleanupStack::Pop(); // pop the CListReadAllAttempt
|
|
2349 |
|
|
2350 |
// return the CBufFlat’s size to client
|
|
2351 |
*aBufSize=(read->iListBuf)->Size();
|
|
2352 |
|
|
2353 |
// Complete first phase of list retrieval
|
|
2354 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2355 |
CleanupStack::PopAndDestroy(); // pop&destroy list
|
|
2356 |
return KErrNone;
|
|
2357 |
}
|
|
2358 |
|
|
2359 |
|
|
2360 |
TInt CENStoreDMmTsy::ReadAllPhase2(TTsyReqHandle aTsyReqHandle, RMobilePhone::TClientId* aId, TDes8* aBuffer)
|
|
2361 |
{
|
|
2362 |
LOGTEXT(_L8("CENStoreDMmTsy::ReadAllPhase2 called"));
|
|
2363 |
CListReadAllAttempt* read=NULL;
|
|
2364 |
// Find the read attempt from this client
|
|
2365 |
for (TInt i=0; i<iENReadAll->Count(); ++i)
|
|
2366 |
{
|
|
2367 |
read = iENReadAll->At(i);
|
|
2368 |
if ((read->iClient.iSessionHandle==aId->iSessionHandle) &&
|
|
2369 |
(read->iClient.iSubSessionHandle==aId->iSubSessionHandle))
|
|
2370 |
{
|
|
2371 |
TPtr8 bufPtr((read->iListBuf)->Ptr(0));
|
|
2372 |
// Copy the streamed list to the client
|
|
2373 |
aBuffer->Copy(bufPtr);
|
|
2374 |
delete read;
|
|
2375 |
iENReadAll->Delete(i);
|
|
2376 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
2377 |
return KErrNone;
|
|
2378 |
}
|
|
2379 |
}
|
|
2380 |
// Should handle error case of not finding the matching client from read all phase 1
|
|
2381 |
return KErrNotFound;
|
|
2382 |
}
|
|
2383 |
|
|
2384 |
|
|
2385 |
TInt CENStoreDMmTsy::ReadAllCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2386 |
{
|
|
2387 |
LOGTEXT(_L8("CENStoreDMmTsy::ReadAllCancel called"));
|
|
2388 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2389 |
|
|
2390 |
// Remove the read all attempt from iENReadAll
|
|
2391 |
CListReadAllAttempt* read=NULL;
|
|
2392 |
for (TInt i=0; i<iENReadAll->Count(); ++i)
|
|
2393 |
{
|
|
2394 |
read = iENReadAll->At(i);
|
|
2395 |
if (read->iReqHandle == aTsyReqHandle)
|
|
2396 |
{
|
|
2397 |
delete read;
|
|
2398 |
iENReadAll->Delete(i);
|
|
2399 |
break;
|
|
2400 |
}
|
|
2401 |
}
|
|
2402 |
|
|
2403 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2404 |
return KErrNone;
|
|
2405 |
}
|
|
2406 |
|
|
2407 |
|
|
2408 |
/**************************************************************************/
|
|
2409 |
//
|
|
2410 |
// CMobilePhoneBookStoreDMmTsy
|
|
2411 |
//
|
|
2412 |
/**************************************************************************/
|
|
2413 |
|
|
2414 |
CMobilePhoneBookStoreDMmTsy* CMobilePhoneBookStoreDMmTsy::NewL(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac, const TDesC& aName, const TDesC& aType)
|
|
2415 |
{
|
|
2416 |
CMobilePhoneBookStoreDMmTsy* subsession=new(ELeave) CMobilePhoneBookStoreDMmTsy(aPhone,aFac,aName,aType);
|
|
2417 |
CleanupStack::PushL(subsession);
|
|
2418 |
subsession->ConstructL();
|
|
2419 |
CleanupStack::Pop();
|
|
2420 |
return subsession;
|
|
2421 |
}
|
|
2422 |
|
|
2423 |
void CMobilePhoneBookStoreDMmTsy::Init()
|
|
2424 |
{}
|
|
2425 |
|
|
2426 |
CMobilePhoneBookStoreDMmTsy::CMobilePhoneBookStoreDMmTsy(CPhoneDMmTsy *aPhone, CPhoneFactoryDummyBase* aFac, const TDesC& aName, const TDesC& aType)
|
|
2427 |
:CSubSessionExtDummyBase(aFac), iPhone(aPhone)
|
|
2428 |
{
|
|
2429 |
iPhoneBookStoreName=aName;
|
|
2430 |
iIccType=aType;
|
|
2431 |
}
|
|
2432 |
|
|
2433 |
void CMobilePhoneBookStoreDMmTsy::ConstructL()
|
|
2434 |
{
|
|
2435 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy created"));
|
|
2436 |
}
|
|
2437 |
|
|
2438 |
CMobilePhoneBookStoreDMmTsy::~CMobilePhoneBookStoreDMmTsy()
|
|
2439 |
{
|
|
2440 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy destroyed"));
|
|
2441 |
}
|
|
2442 |
|
|
2443 |
CTelObject* CMobilePhoneBookStoreDMmTsy::OpenNewObjectByNameL(const TDesC&)
|
|
2444 |
{
|
|
2445 |
User::Leave(KErrNotSupported);
|
|
2446 |
return NULL;
|
|
2447 |
}
|
|
2448 |
|
|
2449 |
CTelObject* CMobilePhoneBookStoreDMmTsy::OpenNewObjectL(TDes&)
|
|
2450 |
{
|
|
2451 |
User::Leave(KErrNotSupported);
|
|
2452 |
return NULL;
|
|
2453 |
}
|
|
2454 |
|
|
2455 |
CTelObject::TReqMode CMobilePhoneBookStoreDMmTsy::ReqModeL(const TInt aIpc)
|
|
2456 |
{
|
|
2457 |
CTelObject::TReqMode ret=0;
|
|
2458 |
switch (aIpc)
|
|
2459 |
{
|
|
2460 |
//
|
|
2461 |
// Flow Controlled Services
|
|
2462 |
//
|
|
2463 |
case EMobilePhoneBookStoreRead:
|
|
2464 |
case EMobilePhoneBookStoreWrite:
|
|
2465 |
case EMobilePhoneStoreDelete:
|
|
2466 |
case EMobilePhoneStoreGetInfo:
|
|
2467 |
ret=KReqModeFlowControlObeyed;
|
|
2468 |
break;
|
|
2469 |
//
|
|
2470 |
// Multiple Completion Services with Immediate Server Repost
|
|
2471 |
// (Usually Notifications)
|
|
2472 |
//
|
|
2473 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2474 |
ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
2475 |
break;
|
|
2476 |
//
|
|
2477 |
// Cancel Requests
|
|
2478 |
//
|
|
2479 |
case EMobilePhoneStoreGetInfoCancel:
|
|
2480 |
case EMobilePhoneBookStoreReadCancel:
|
|
2481 |
case EMobilePhoneBookStoreWriteCancel:
|
|
2482 |
case EMobilePhoneStoreDeleteCancel:
|
|
2483 |
case EMobilePhoneStoreNotifyStoreEventCancel:
|
|
2484 |
default:
|
|
2485 |
User::Leave(KErrNotSupported);
|
|
2486 |
break;
|
|
2487 |
}
|
|
2488 |
return ret;
|
|
2489 |
}
|
|
2490 |
|
|
2491 |
TInt CMobilePhoneBookStoreDMmTsy::RegisterNotification(const TInt aIpc)
|
|
2492 |
{
|
|
2493 |
switch (aIpc)
|
|
2494 |
{
|
|
2495 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2496 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy: RegisterNotification - Store Event "));
|
|
2497 |
return KErrNotSupported;
|
|
2498 |
default:
|
|
2499 |
// Unknown or invalid IPC
|
|
2500 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy: Register error, unknown IPC"));
|
|
2501 |
return KErrNotSupported;
|
|
2502 |
}
|
|
2503 |
}
|
|
2504 |
|
|
2505 |
TInt CMobilePhoneBookStoreDMmTsy::DeregisterNotification(const TInt aIpc)
|
|
2506 |
{
|
|
2507 |
switch (aIpc)
|
|
2508 |
{
|
|
2509 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2510 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy: DeregisterNotification - Store Event "));
|
|
2511 |
return KErrNotSupported;
|
|
2512 |
default:
|
|
2513 |
// Unknown or invalid IPC
|
|
2514 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy: Deregister error, unknown IPC"));
|
|
2515 |
return KErrNotSupported;
|
|
2516 |
}
|
|
2517 |
}
|
|
2518 |
|
|
2519 |
TInt CMobilePhoneBookStoreDMmTsy::NumberOfSlotsL(const TInt aIpc)
|
|
2520 |
{
|
|
2521 |
TInt numberOfSlots=1;
|
|
2522 |
switch (aIpc)
|
|
2523 |
{
|
|
2524 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2525 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy: Registered with 2 slot"));
|
|
2526 |
User::Leave(KErrNotSupported);
|
|
2527 |
break;
|
|
2528 |
default:
|
|
2529 |
// Unknown or invalid Phone IPC
|
|
2530 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy: Number of Slots error, unknown IPC"));
|
|
2531 |
User::Leave(KErrNotSupported);
|
|
2532 |
break;
|
|
2533 |
}
|
|
2534 |
return numberOfSlots;
|
|
2535 |
}
|
|
2536 |
|
|
2537 |
|
|
2538 |
TInt CMobilePhoneBookStoreDMmTsy::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
|
|
2539 |
const TDataPackage& aPackage)
|
|
2540 |
{
|
|
2541 |
TAny* dataPtr=aPackage.Ptr1();
|
|
2542 |
TAny* dataPtr2=aPackage.Ptr2();
|
|
2543 |
|
|
2544 |
switch (aIpc)
|
|
2545 |
{
|
|
2546 |
case EMobilePhoneBookStoreRead:
|
|
2547 |
return Read(aTsyReqHandle,
|
|
2548 |
REINTERPRET_CAST(RMobilePhoneBookStore::TPBIndexAndNumEntries*,dataPtr),
|
|
2549 |
aPackage.Des2n());
|
|
2550 |
|
|
2551 |
case EMobilePhoneBookStoreWrite:
|
|
2552 |
return Write(aTsyReqHandle, aPackage.Des1n(), REINTERPRET_CAST(TInt*,dataPtr2));
|
|
2553 |
|
|
2554 |
case EMobilePhoneStoreDelete:
|
|
2555 |
return Delete(aTsyReqHandle,
|
|
2556 |
REINTERPRET_CAST(TInt*,dataPtr));
|
|
2557 |
|
|
2558 |
case EMobilePhoneStoreGetInfo:
|
|
2559 |
return GetInfo(aTsyReqHandle,
|
|
2560 |
REINTERPRET_CAST(TDes8*, dataPtr));
|
|
2561 |
|
|
2562 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2563 |
default:
|
|
2564 |
return KErrNotSupported;
|
|
2565 |
}
|
|
2566 |
}
|
|
2567 |
|
|
2568 |
TInt CMobilePhoneBookStoreDMmTsy::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
2569 |
{
|
|
2570 |
switch (aIpc)
|
|
2571 |
{
|
|
2572 |
case EMobilePhoneStoreGetInfo:
|
|
2573 |
return GetInfoCancel(aTsyReqHandle);
|
|
2574 |
case EMobilePhoneBookStoreRead:
|
|
2575 |
return ReadCancel(aTsyReqHandle);
|
|
2576 |
case EMobilePhoneBookStoreWrite:
|
|
2577 |
return WriteCancel(aTsyReqHandle);
|
|
2578 |
case EMobilePhoneStoreDelete:
|
|
2579 |
return DeleteCancel(aTsyReqHandle);
|
|
2580 |
case EMobilePhoneStoreNotifyStoreEvent:
|
|
2581 |
return KErrNotSupported;
|
|
2582 |
}
|
|
2583 |
return KErrGeneral;
|
|
2584 |
}
|
|
2585 |
|
|
2586 |
TInt CMobilePhoneBookStoreDMmTsy::Read(const TTsyReqHandle aTsyReqHandle,
|
|
2587 |
RMobilePhoneBookStore::TPBIndexAndNumEntries* aIndexAndEntries,
|
|
2588 |
TDes8* aPBData)
|
|
2589 |
{
|
|
2590 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy::Read called"));
|
|
2591 |
|
|
2592 |
if (aIndexAndEntries->iIndex!=DMMTSY_PHONEBOOK_STORE_INDEX1)
|
|
2593 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
2594 |
else
|
|
2595 |
{
|
|
2596 |
if(aIndexAndEntries->iNumSlots == DMMTSY_PHONE_ONE_ENTRY)
|
|
2597 |
*aPBData = DMMTSY_PHONE_BOOK_DATA1;
|
|
2598 |
else if(aIndexAndEntries->iNumSlots == DMMTSY_PHONE_NUM_OF_ENTRIES)
|
|
2599 |
*aPBData = DMMTSY_PHONE_BOOK_MULTIPLE_DATA;
|
|
2600 |
|
|
2601 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2602 |
}
|
|
2603 |
return KErrNone;
|
|
2604 |
}
|
|
2605 |
|
|
2606 |
TInt CMobilePhoneBookStoreDMmTsy::ReadCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2607 |
{
|
|
2608 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy::ReadCancel called"));
|
|
2609 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2610 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2611 |
return KErrNone;
|
|
2612 |
}
|
|
2613 |
|
|
2614 |
TInt CMobilePhoneBookStoreDMmTsy::Write(const TTsyReqHandle aTsyReqHandle, TDesC8* aPBData, TInt* aIndex)
|
|
2615 |
{
|
|
2616 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy::Write called"));
|
|
2617 |
|
|
2618 |
if ((*aIndex!=DMMTSY_PHONEBOOK_STORE_INDEX2) ||
|
|
2619 |
(aPBData->Compare(DMMTSY_PHONE_BOOK_DATA2) != 0))
|
|
2620 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
2621 |
else
|
|
2622 |
{
|
|
2623 |
// Test returned, allocated index
|
|
2624 |
*aIndex=DMMTSY_PHONEBOOK_STORE_INDEX1;
|
|
2625 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2626 |
}
|
|
2627 |
|
|
2628 |
return KErrNone;
|
|
2629 |
}
|
|
2630 |
|
|
2631 |
TInt CMobilePhoneBookStoreDMmTsy::WriteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2632 |
{
|
|
2633 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy::WriteCancel called"));
|
|
2634 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2635 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2636 |
return KErrNone;
|
|
2637 |
}
|
|
2638 |
|
|
2639 |
TInt CMobilePhoneBookStoreDMmTsy::Delete(const TTsyReqHandle aTsyReqHandle, TInt* aIndex)
|
|
2640 |
{
|
|
2641 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy::Delete called"));
|
|
2642 |
|
|
2643 |
if (*aIndex!=DMMTSY_PHONEBOOK_STORE_INDEX1)
|
|
2644 |
ReqCompleted(aTsyReqHandle,KErrCorrupt);
|
|
2645 |
else
|
|
2646 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2647 |
|
|
2648 |
return KErrNone;
|
|
2649 |
}
|
|
2650 |
|
|
2651 |
TInt CMobilePhoneBookStoreDMmTsy::DeleteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2652 |
{
|
|
2653 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy::DeleteCancel called"));
|
|
2654 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2655 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2656 |
return KErrNone;
|
|
2657 |
}
|
|
2658 |
|
|
2659 |
TInt CMobilePhoneBookStoreDMmTsy::GetInfo(const TTsyReqHandle aTsyReqHandle, TDes8* aInfo)
|
|
2660 |
{
|
|
2661 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy::GetInfo called"));
|
|
2662 |
|
|
2663 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV1* pbInfo = (RMobilePhoneBookStore::TMobilePhoneBookInfoV1*)aInfo;
|
|
2664 |
|
|
2665 |
if(pbInfo->ExtensionId()==RMobilePhoneStore::KETelMobilePhonebookStoreV1)
|
|
2666 |
{
|
|
2667 |
pbInfo->iName=DMMTSY_PHONEBOOK_STORE_NAME;
|
|
2668 |
pbInfo->iType=DMMTSY_PHONEBOOK_STORE_TYPE;
|
|
2669 |
pbInfo->iTotalEntries=DMMTSY_PHONEBOOK_STORE_ENTRIES;
|
|
2670 |
pbInfo->iUsedEntries=DMMTSY_PHONEBOOK_STORE_USED;
|
|
2671 |
pbInfo->iCaps=DMMTSY_PHONEBOOK_STORE_CAPS;
|
|
2672 |
pbInfo->iMaxNumLength = DMMTSY_PHONEBOOK_MAXNL;
|
|
2673 |
pbInfo->iMaxTextLength = DMMTSY_PHONEBOOK_MAXTL;
|
|
2674 |
pbInfo->iLocation = DMMTSY_PHONEBOOK_LOCATION;
|
|
2675 |
pbInfo->iIdentity = DMMTSY_PHONEBOOK_IDENTITY;
|
|
2676 |
pbInfo->iChangeCounter = DMMTSY_PHONEBOOK_CHANGECOUNT;
|
|
2677 |
}
|
|
2678 |
else if(pbInfo->ExtensionId()==RMobilePhoneStore::KETelMobilePhonebookStoreV2)
|
|
2679 |
{
|
|
2680 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV2* pbV2Info = (RMobilePhoneBookStore::TMobilePhoneBookInfoV2*)aInfo;
|
|
2681 |
pbV2Info->iName=DMMTSY_PHONEBOOK_STORE_NAME;
|
|
2682 |
pbV2Info->iType=DMMTSY_PHONEBOOK_STORE_TYPE;
|
|
2683 |
pbV2Info->iTotalEntries=DMMTSY_PHONEBOOK_STORE_ENTRIES;
|
|
2684 |
pbV2Info->iUsedEntries=DMMTSY_PHONEBOOK_STORE_USED;
|
|
2685 |
pbV2Info->iCaps=DMMTSY_PHONEBOOK_STORE_CAPS;
|
|
2686 |
pbV2Info->iMaxNumLength = DMMTSY_PHONEBOOK_MAXNL;
|
|
2687 |
pbV2Info->iMaxTextLength = DMMTSY_PHONEBOOK_MAXTL;
|
|
2688 |
pbV2Info->iLocation = DMMTSY_PHONEBOOK_LOCATION;
|
|
2689 |
pbV2Info->iIdentity = DMMTSY_PHONEBOOK_IDENTITY;
|
|
2690 |
pbV2Info->iChangeCounter = DMMTSY_PHONEBOOK_CHANGECOUNT;
|
|
2691 |
pbV2Info->iPhBkMode = DMMTSY_PHONEBOOK_TYPE;
|
|
2692 |
}
|
|
2693 |
else if(pbInfo->ExtensionId()==RMobilePhoneStore::KETelMobilePhonebookStoreV5)
|
|
2694 |
{
|
|
2695 |
RMobilePhoneBookStore::TMobilePhoneBookInfoV5* pbV5Info = (RMobilePhoneBookStore::TMobilePhoneBookInfoV5*)aInfo;
|
|
2696 |
pbV5Info->iName=DMMTSY_PHONEBOOK_STORE_NAME;
|
|
2697 |
pbV5Info->iType=DMMTSY_PHONEBOOK_STORE_TYPE;
|
|
2698 |
pbV5Info->iTotalEntries=DMMTSY_PHONEBOOK_STORE_ENTRIES;
|
|
2699 |
pbV5Info->iUsedEntries=DMMTSY_PHONEBOOK_STORE_USED;
|
|
2700 |
pbV5Info->iCaps=DMMTSY_PHONEBOOK_STORE_CAPS;
|
|
2701 |
pbV5Info->iMaxNumLength = DMMTSY_PHONEBOOK_MAXNL;
|
|
2702 |
pbV5Info->iMaxTextLength = DMMTSY_PHONEBOOK_MAXTL;
|
|
2703 |
pbV5Info->iLocation = DMMTSY_PHONEBOOK_LOCATION;
|
|
2704 |
pbV5Info->iIdentity = DMMTSY_PHONEBOOK_IDENTITY;
|
|
2705 |
pbV5Info->iChangeCounter = DMMTSY_PHONEBOOK_CHANGECOUNT;
|
|
2706 |
pbV5Info->iPhBkMode = DMMTSY_PHONEBOOK_TYPE;
|
|
2707 |
pbV5Info->iMaxSecondNames = DMMTSY_PHONEBOOK_MAXSECONDNAMES;
|
|
2708 |
pbV5Info->iMaxTextLengthSecondName = DMMTSY_PHONEBOOK_MAXTEXTLENSECONDNAME;
|
|
2709 |
pbV5Info->iMaxAdditionalNumbers = DMMTSY_PHONEBOOK_MAXADDNUM;
|
|
2710 |
pbV5Info->iMaxTextLengthAdditionalNumber = DMMTSY_PHONEBOOK_MAXTEXTLENADDNUM;
|
|
2711 |
pbV5Info->iMaxNumLengthAdditionalNumber = DMMTSY_PHONEBOOK_MAXNUMLENADDNUM;
|
|
2712 |
pbV5Info->iMaxGroupNames = DMMTSY_PHONEBOOK_MAXGROUPNAMES;
|
|
2713 |
pbV5Info->iMaxTextLengthGroupName = DMMTSY_PHONEBOOK_MAXTEXTLENGROUPNAME;
|
|
2714 |
pbV5Info->iMaxEmailAddr = DMMTSY_PHONEBOOK_MAXEMAILADDR;
|
|
2715 |
pbV5Info->iMaxTextLengthEmailAddr = DMMTSY_PHONEBOOK_MAXTEXTLENEMAILADDR;
|
|
2716 |
}
|
|
2717 |
iPhone->AddDelayedReq(aTsyReqHandle,this);
|
|
2718 |
|
|
2719 |
return KErrNone;
|
|
2720 |
}
|
|
2721 |
|
|
2722 |
TInt CMobilePhoneBookStoreDMmTsy::GetInfoCancel(const TTsyReqHandle aTsyReqHandle)
|
|
2723 |
{
|
|
2724 |
LOGTEXT(_L8("CMobilePhoneBookStoreDMmTsy::GetInfoCancel called"));
|
|
2725 |
iPhone->RemoveDelayedReq(aTsyReqHandle);
|
|
2726 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
2727 |
return KErrNone;
|
|
2728 |
}
|