24
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
|
|
17 |
#include "smsppara.h"
|
|
18 |
#include "smsuset.h"
|
|
19 |
#include "smsulog.h"
|
|
20 |
#include "smspmain.h"
|
|
21 |
|
|
22 |
#include "gsmubuf.h"
|
|
23 |
#include "Gsmumsg.h"
|
|
24 |
#include <mmretrieve.h>
|
|
25 |
#include "SmsuTimer.h"
|
|
26 |
|
|
27 |
|
|
28 |
/**
|
|
29 |
* Constructor
|
|
30 |
*
|
|
31 |
* @param aSmsComm a reference to the protocol.
|
|
32 |
* @param aSmsSettings a reference to the global SMS settings.
|
|
33 |
* @param aSmsMessaging a reference to the ETEL SMS messaging subsession.
|
|
34 |
*
|
|
35 |
*/
|
|
36 |
CSmsParamsBase::CSmsParamsBase(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging)
|
|
37 |
: CSmsuActiveBase(KSmsSessionPriority),
|
|
38 |
iSmsComm(aSmsComm),
|
|
39 |
iSmsSettings(aSmsSettings),
|
|
40 |
iSmsMessaging(aSmsMessaging)
|
|
41 |
{
|
|
42 |
} // CSmsParamsBase::CSmsParamsBase
|
|
43 |
|
|
44 |
|
|
45 |
/**
|
|
46 |
* 2nd Phase of construction.
|
|
47 |
*
|
|
48 |
* Creates CSmsTimeout object.
|
|
49 |
*
|
|
50 |
*/
|
|
51 |
void CSmsParamsBase::ConstructL()
|
|
52 |
{
|
|
53 |
LOGSMSPROT1("CSmsParamsBase::ConstructL()");
|
|
54 |
|
|
55 |
ConstructTimeoutL();
|
|
56 |
} // CSmsParamsBase::ConstructL
|
|
57 |
|
|
58 |
|
|
59 |
/**
|
|
60 |
* 2 Phase constructor.
|
|
61 |
*
|
|
62 |
* @param aSmsComm a reference to the protocol.
|
|
63 |
* @param aSmsSettings a reference to the global SMS settings.
|
|
64 |
* @param aSmsMessaging a reference to the ETEL SMS messaging subsession.
|
|
65 |
* @leave Leaves if ContructL() leaves, or not enough memory is available.
|
|
66 |
* @return a new CSmsReadParams object.
|
|
67 |
*
|
|
68 |
*/
|
|
69 |
CSmsReadParams* CSmsReadParams::NewL(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging)
|
|
70 |
{
|
|
71 |
LOGSMSPROT1("CSmsReadParams::NewL()");
|
|
72 |
|
|
73 |
CSmsReadParams* smsReadParams=new(ELeave) CSmsReadParams(aSmsComm,aSmsSettings,aSmsMessaging);
|
|
74 |
CleanupStack::PushL(smsReadParams);
|
|
75 |
smsReadParams->ConstructL();
|
|
76 |
CleanupStack::Pop(smsReadParams);
|
|
77 |
return smsReadParams;
|
|
78 |
} // CSmsReadParams::NewL
|
|
79 |
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Destructor
|
|
83 |
*
|
|
84 |
* Cancel reading process and delete all created objects.
|
|
85 |
*
|
|
86 |
*/
|
|
87 |
CSmsReadParams::~CSmsReadParams()
|
|
88 |
{
|
|
89 |
Cancel();
|
|
90 |
delete iRetrieveMobilePhoneSmspList;
|
|
91 |
delete iMobilePhoneSmspList;
|
|
92 |
} // CSmsReadParams::~CSmsReadParams
|
|
93 |
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Start retrieving of SMS parameters. Called by CSmsProtocol.
|
|
97 |
*
|
|
98 |
* The behavour has been changed so that these parameters
|
|
99 |
* will always be retrieved from the TSY. [Previously the
|
|
100 |
* algorithm only retrieved the parameters from the TSY once
|
|
101 |
* and cached them so the TSY would not need to be polled if
|
|
102 |
* a client asked for the again, the assumption being that the
|
|
103 |
* SC number would never change. Subsequent client requests to
|
|
104 |
* read the SMS parameters would result in the cached parameters
|
|
105 |
* being returned rather than retrieving the parameters from the
|
|
106 |
* SIM. However this can cause problems (DEF40029) if the SIM is
|
|
107 |
* replaced with a new SIM that has an incorrect service center
|
|
108 |
* number: the stack can be requested to load the SMS parameters
|
|
109 |
* twice, once when the phone boots with the new SIM and again when
|
|
110 |
* the SIM is updated with the new Service Centre Number. If 2nd
|
|
111 |
* request only results in the cached parameters being returned then
|
|
112 |
* the incorrect SC Address will be returned.]
|
|
113 |
*
|
|
114 |
* @param aObserver a reference to the observer object.
|
|
115 |
*/
|
|
116 |
void CSmsReadParams::Start(MSmsMessageObserver& aObserver)
|
|
117 |
{
|
|
118 |
LOGSMSPROT1("CSmsReadParams::Start()");
|
|
119 |
|
|
120 |
__ASSERT_DEBUG(iSmsMessageObserver == NULL && iReport == NULL,
|
|
121 |
SmspPanic(KSmspPanicUnexpectedState));
|
|
122 |
|
|
123 |
//
|
|
124 |
// Store the observer interface object for and start the retrieve
|
|
125 |
// operation.
|
|
126 |
//
|
|
127 |
iSmsMessageObserver = &aObserver;
|
|
128 |
|
|
129 |
iRetrieveMobilePhoneSmspList->Start(iStatus);
|
|
130 |
|
|
131 |
TimedSetActive(iSmsSettings.Timeout());
|
|
132 |
} // CSmsReadParams::Start
|
|
133 |
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Start retrieving of SMS parameters. Called by CSmsWriteParams.
|
|
137 |
*
|
|
138 |
* The behavour has been changed so that these parameters
|
|
139 |
* will always be retrieved from the TSY. [Previously the
|
|
140 |
* algorithm only retrieved the parameters from the TSY once
|
|
141 |
* and cached them so the TSY would not need to be polled if
|
|
142 |
* a client asked for the again, the assumption being that the
|
|
143 |
* SC number would never change. Subsequent client requests to
|
|
144 |
* read the SMS parameters would result in the cached parameters
|
|
145 |
* being returned rather than retrieving the parameters from the
|
|
146 |
* SIM. However this can cause problems (DEF40029) if the SIM is
|
|
147 |
* replaced with a new SIM that has an incorrect service center
|
|
148 |
* number: the stack can be requested to load the SMS parameters
|
|
149 |
* twice, once when the phone boots with the new SIM and again when
|
|
150 |
* the SIM is updated with the new Service Centre Number. If 2nd
|
|
151 |
* request only results in the cached parameters being returned then
|
|
152 |
* the incorrect SC Address will be returned.]
|
|
153 |
*
|
|
154 |
* @param aStatus a reference to the outstanding request.
|
|
155 |
*/
|
|
156 |
void CSmsReadParams::Start(TRequestStatus& aStatus)
|
|
157 |
{
|
|
158 |
LOGSMSPROT1("CSmsReadParams::Start()");
|
|
159 |
|
|
160 |
__ASSERT_DEBUG(iSmsMessageObserver == NULL && iReport == NULL,
|
|
161 |
SmspPanic(KSmspPanicUnexpectedState));
|
|
162 |
|
|
163 |
//
|
|
164 |
// Store the TRequestStatus in the CSmsuActiveBase object for later
|
|
165 |
// completion and start the retrieve operation.
|
|
166 |
//
|
|
167 |
Queue(aStatus);
|
|
168 |
|
|
169 |
iRetrieveMobilePhoneSmspList->Start(iStatus);
|
|
170 |
|
|
171 |
TimedSetActive(iSmsSettings.Timeout());
|
|
172 |
} // CSmsReadParams::Start
|
|
173 |
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Retrieves parameter list from CRetrieveMobilePhoneSmspList object.
|
|
177 |
* Cancel timeout timer. Delete old SMSP list and retrieve new list from
|
|
178 |
* CMobilePhoneSmspList object if retrieving was successful.
|
|
179 |
*
|
|
180 |
* @leave Leave if RetrieveListL() leaves.
|
|
181 |
*/
|
|
182 |
void CSmsReadParams::DoRunL()
|
|
183 |
{
|
|
184 |
LOGSMSPROT2("CSmsReadParams::RunL [iStatus=%d]", iStatus.Int() );
|
|
185 |
|
|
186 |
//
|
|
187 |
// If the start retrieve was successful, then continue retrieving the list.
|
|
188 |
// A temporary variable is used to keep the old list until the new one is
|
|
189 |
// obtained successfully.
|
|
190 |
//
|
|
191 |
if (iStatus == KErrNone)
|
|
192 |
{
|
|
193 |
CMobilePhoneSmspList* tempList = iRetrieveMobilePhoneSmspList->RetrieveListL();
|
|
194 |
|
|
195 |
delete iMobilePhoneSmspList;
|
|
196 |
iMobilePhoneSmspList = tempList;
|
|
197 |
}
|
|
198 |
|
|
199 |
//
|
|
200 |
// DoRunL() will now return to CSmsuActiveBase which if the object
|
|
201 |
// is not active, will call Complete().
|
|
202 |
//
|
|
203 |
} // CSmsReadParams::DoRunL
|
|
204 |
|
|
205 |
|
|
206 |
/**
|
|
207 |
* Handles cancel read parameters request.
|
|
208 |
*
|
|
209 |
* Cancel timeout timer.
|
|
210 |
* Cancel also retrieving of parameters process.
|
|
211 |
* Call complete.
|
|
212 |
*/
|
|
213 |
void CSmsReadParams::DoCancel()
|
|
214 |
{
|
|
215 |
LOGSMSPROT1("CSmsReadParams::DoCancel()");
|
|
216 |
|
|
217 |
TimedSetActiveCancel();
|
|
218 |
|
|
219 |
//
|
|
220 |
// Cancel the request...
|
|
221 |
//
|
|
222 |
iRetrieveMobilePhoneSmspList->Cancel();
|
|
223 |
|
|
224 |
//
|
|
225 |
// Handle completion of this Active Object. Note that the object
|
|
226 |
// may well still be active at this point...
|
|
227 |
//
|
|
228 |
if (TimedOut())
|
|
229 |
{
|
|
230 |
Complete(KErrTimedOut);
|
|
231 |
}
|
|
232 |
else
|
|
233 |
{
|
|
234 |
Complete(KErrCancel);
|
|
235 |
}
|
|
236 |
} // CSmsReadParams::DoCancel
|
|
237 |
|
|
238 |
|
|
239 |
/**
|
|
240 |
* Constructor
|
|
241 |
*
|
|
242 |
* @param aSmsComm a reference to the protocol.
|
|
243 |
* @param aSmsSettings a reference to the global SMS settings.
|
|
244 |
* @param aSmsMessaging a reference to the ETEL SMS messaging subsession.
|
|
245 |
*
|
|
246 |
*/
|
|
247 |
CSmsReadParams::CSmsReadParams(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging):
|
|
248 |
CSmsParamsBase(aSmsComm,aSmsSettings,aSmsMessaging)
|
|
249 |
{
|
|
250 |
} // CSmsReadParams::CSmsReadParams
|
|
251 |
|
|
252 |
|
|
253 |
/**
|
|
254 |
* 2nd Phase of construction.
|
|
255 |
*
|
|
256 |
* Creates CRetrieveMobilePhoneSmspList object.
|
|
257 |
*
|
|
258 |
*/
|
|
259 |
void CSmsReadParams::ConstructL()
|
|
260 |
{
|
|
261 |
LOGSMSPROT1("CSmsReadParams::ConstructL()");
|
|
262 |
|
|
263 |
CSmsParamsBase::ConstructL();
|
|
264 |
|
|
265 |
iRetrieveMobilePhoneSmspList = CRetrieveMobilePhoneSmspList::NewL(iSmsMessaging);
|
|
266 |
} // CSmsReadParams::ConstructL
|
|
267 |
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Check validity of SMSP list. List shouldn't contain more entries that can be stored
|
|
271 |
* to phone-side storage.
|
|
272 |
* Set maximum number of enties value to the client's list.
|
|
273 |
*
|
|
274 |
* @param aMobilePhoneSmspList a reference to the CMobilePhoneSmspList object.
|
|
275 |
* @leave Leave if aMobilePhoneSmspList object contains too many SMSP sets.
|
|
276 |
*
|
|
277 |
*/
|
|
278 |
void CSmsReadParams::CheckListValidityL(CMobilePhoneSmspList& aMobilePhoneSmspList)
|
|
279 |
{
|
|
280 |
LOGSMSPROT1("CSmsReadParams::CheckListValidityL()");
|
|
281 |
|
|
282 |
//
|
|
283 |
// MaxNumberEntries method returns the maximum number of entries that can
|
|
284 |
// be stored in this list. This attribute is required because most phone-side
|
|
285 |
// storage will have an upper storage limit. If the TSY has not set this
|
|
286 |
// attribute during a list retrieval then the value returned will be -1.
|
|
287 |
//
|
|
288 |
if (iMobilePhoneSmspList->MaxNumberEntries() != -1)
|
|
289 |
{
|
|
290 |
if (aMobilePhoneSmspList.Enumerate() > iMobilePhoneSmspList->MaxNumberEntries())
|
|
291 |
{
|
|
292 |
User::Leave(KErrArgument);
|
|
293 |
}
|
|
294 |
|
|
295 |
aMobilePhoneSmspList.SetMaxNumberEntries(iMobilePhoneSmspList->MaxNumberEntries());
|
|
296 |
}
|
|
297 |
} // CSmsReadParams::CheckListValidityL
|
|
298 |
|
|
299 |
|
|
300 |
/**
|
|
301 |
* Store successfully saved parameters also to SMSPROT's internal memory. Actually
|
|
302 |
* StoreParameters takes ownership of aMobilePhoneSmspList.
|
|
303 |
*
|
|
304 |
* Delete old list and set iMobilePhoneSmspList to point to the new SMSP list.
|
|
305 |
*
|
|
306 |
* @param aMobilePhoneSmspList a reference to the CMobilePhoneSmspList object.
|
|
307 |
*
|
|
308 |
*/
|
|
309 |
void CSmsReadParams::StoreParameters(CMobilePhoneSmspList* aMobilePhoneSmspList)
|
|
310 |
{
|
|
311 |
LOGSMSPROT1("CSmsReadParams::StoreParameters()");
|
|
312 |
|
|
313 |
__ASSERT_DEBUG(iMobilePhoneSmspList != NULL && aMobilePhoneSmspList != NULL && iMobilePhoneSmspList->MaxNumberEntries() == aMobilePhoneSmspList->MaxNumberEntries(),SmspPanic(KSmspPanicCorruptedSmspList));
|
|
314 |
|
|
315 |
delete iMobilePhoneSmspList;
|
|
316 |
iMobilePhoneSmspList = aMobilePhoneSmspList;
|
|
317 |
} // CSmsReadParams::StoreParameters
|
|
318 |
|
|
319 |
|
|
320 |
/**
|
|
321 |
* Completes read request or cancel read request.
|
|
322 |
*
|
|
323 |
* Cancel timeout timer.
|
|
324 |
* Complete request to the CSmsWriteParams object or observer.
|
|
325 |
*
|
|
326 |
* @param aStatus a status value.
|
|
327 |
*
|
|
328 |
*/
|
|
329 |
void CSmsReadParams::Complete(TInt aStatus)
|
|
330 |
{
|
|
331 |
LOGSMSPROT1("CSmsReadParams::Complete()");
|
|
332 |
|
|
333 |
//
|
|
334 |
// Call the base function to perform the actual complete...
|
|
335 |
//
|
|
336 |
CSmsuActiveBase::Complete(aStatus);
|
|
337 |
|
|
338 |
if (iSmsMessageObserver != NULL &&
|
|
339 |
iSmsComm.ObserverIsPresent(*iSmsMessageObserver))
|
|
340 |
{
|
|
341 |
iSmsMessageObserver->ReadSmsParamsCompleted(aStatus, iMobilePhoneSmspList);
|
|
342 |
iSmsMessageObserver = NULL;
|
|
343 |
}
|
|
344 |
} // CSmsReadParams::Complete
|
|
345 |
|
|
346 |
|
|
347 |
/**
|
|
348 |
* 2 Phase constructor.
|
|
349 |
*
|
|
350 |
* @param aSmsComm a reference to the protocol.
|
|
351 |
* @param aSmsSettings a reference to the global SMS settings.
|
|
352 |
* @param aSmsMessaging a reference to the ETEL SMS messaging subsession.
|
|
353 |
* @param aSmsReadParams a reference to the CSmsReadParams object.
|
|
354 |
* @leave Leaves if ContructL() leaves, or not enough memory is available.
|
|
355 |
* @return a new CSmsReadParams object.
|
|
356 |
*
|
|
357 |
*/
|
|
358 |
CSmsWriteParams* CSmsWriteParams::NewL(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging,CSmsReadParams& aSmsReadParams)
|
|
359 |
{
|
|
360 |
LOGSMSPROT1("CSmsWriteParams::NewL()");
|
|
361 |
|
|
362 |
CSmsWriteParams* smsWriteParams=new(ELeave) CSmsWriteParams(aSmsComm,aSmsSettings,aSmsMessaging,aSmsReadParams);
|
|
363 |
CleanupStack::PushL(smsWriteParams);
|
|
364 |
smsWriteParams->ConstructL();
|
|
365 |
CleanupStack::Pop(smsWriteParams);
|
|
366 |
return smsWriteParams;
|
|
367 |
} // CSmsWriteParams::NewL
|
|
368 |
|
|
369 |
|
|
370 |
/**
|
|
371 |
* Destructor
|
|
372 |
*
|
|
373 |
* Cancel writing process and delete all created objects.
|
|
374 |
*
|
|
375 |
*/
|
|
376 |
CSmsWriteParams::~CSmsWriteParams()
|
|
377 |
{
|
|
378 |
Cancel();
|
|
379 |
delete iMobilePhoneSmspList;
|
|
380 |
} // CSmsWriteParams::~CSmsWriteParams
|
|
381 |
|
|
382 |
|
|
383 |
/**
|
|
384 |
* Start writing of SMS parameters process.
|
|
385 |
* Set state to ESmsParamsStoringList.
|
|
386 |
* Read parameters to SMSPROT's internal memory if client tries to write
|
|
387 |
* parameters before SMSPROT has read them. This is because SMSPROT has to
|
|
388 |
* deliver whole SMSP list while making StoreSmspList request to the MM ETel.
|
|
389 |
* If client deliver only some SMSP sets while making write request, we have
|
|
390 |
* to add missing SMSP sets to the clients list.
|
|
391 |
* Set timeout timer on.
|
|
392 |
*
|
|
393 |
* @param aObserver a reference to the observer object.
|
|
394 |
* @param aMobilePhoneSmspList a pointer to SMSP list to be saved.
|
|
395 |
*
|
|
396 |
*/
|
|
397 |
void CSmsWriteParams::Start(MSmsMessageObserver& aObserver,CMobilePhoneSmspList* aMobilePhoneSmspList)
|
|
398 |
{
|
|
399 |
LOGSMSPROT1("CSmsWriteParams::Start()");
|
|
400 |
|
|
401 |
__ASSERT_DEBUG(iState==ESmsParamsIdle,SmspPanic(KSmspPanicUnexpectedState));
|
|
402 |
|
|
403 |
iState = ESmsParamsStoringList;
|
|
404 |
|
|
405 |
iSmsMessageObserver= &aObserver;
|
|
406 |
iMobilePhoneSmspList=aMobilePhoneSmspList;
|
|
407 |
|
|
408 |
//
|
|
409 |
//Read parameters to SMSPROT's internal memory before starting writing process...
|
|
410 |
//
|
|
411 |
iSmsReadParams.Start(iStatus);
|
|
412 |
|
|
413 |
TimedSetActive(iSmsSettings.Timeout());
|
|
414 |
} // CSmsWriteParams::Start
|
|
415 |
|
|
416 |
|
|
417 |
/**
|
|
418 |
* Store SMSP list to phone. If storing was successful, store list also
|
|
419 |
* to CSmsReadParams object.
|
|
420 |
*
|
|
421 |
* Cancel timeout timer.
|
|
422 |
* State ESmsParamsStoringList:
|
|
423 |
* Change state to ESmsParamsStoringListToInternal.
|
|
424 |
* Check validity of SMSP list using CSmsReadParams objects services.
|
|
425 |
* After that makes StoreSmspList request to the MM ETel.
|
|
426 |
* Set timeout timer on.
|
|
427 |
* State ESmsParamsStoringListToInternal:
|
|
428 |
* Store successfully stored parameters to CSmsReadParams object.
|
|
429 |
*
|
|
430 |
* @leave Leaves if there was an error.
|
|
431 |
* @leave Leave if RetrieveListL() leaves.
|
|
432 |
* @leave Leave if StoreSmspListL() leaves.
|
|
433 |
* @leave Panic if RunL is called while object is in idle state.
|
|
434 |
*
|
|
435 |
*/
|
|
436 |
void CSmsWriteParams::DoRunL()
|
|
437 |
{
|
|
438 |
LOGSMSPROT2("CSmsWriteParams::DoRunL [iStatus=%d]", iStatus.Int() );
|
|
439 |
|
|
440 |
switch (iState)
|
|
441 |
{
|
|
442 |
case ESmsParamsStoringList:
|
|
443 |
{
|
|
444 |
//
|
|
445 |
// Request the list to be stored...
|
|
446 |
//
|
|
447 |
if (iStatus.Int() == KErrNone)
|
|
448 |
{
|
|
449 |
iState = ESmsParamsStoringListToInternal;
|
|
450 |
|
|
451 |
iSmsReadParams.CheckListValidityL(*iMobilePhoneSmspList);
|
|
452 |
iSmsMessaging.StoreSmspListL(iStatus, iMobilePhoneSmspList);
|
|
453 |
|
|
454 |
TimedSetActive(iSmsSettings.Timeout());
|
|
455 |
}
|
|
456 |
}
|
|
457 |
break;
|
|
458 |
|
|
459 |
case ESmsParamsStoringListToInternal:
|
|
460 |
{
|
|
461 |
//
|
|
462 |
// If the list was stored successfully, then store it internally.
|
|
463 |
//
|
|
464 |
if (iStatus.Int() == KErrNone)
|
|
465 |
{
|
|
466 |
iSmsReadParams.StoreParameters(iMobilePhoneSmspList);
|
|
467 |
|
|
468 |
//
|
|
469 |
// Set iMobilePhoneSmspList to NULL because it points now to SMSPROT's
|
|
470 |
// internal parameter storage.
|
|
471 |
//
|
|
472 |
iMobilePhoneSmspList = NULL;
|
|
473 |
}
|
|
474 |
}
|
|
475 |
break;
|
|
476 |
|
|
477 |
default:
|
|
478 |
{
|
|
479 |
SmspPanic(KSmspPanicUnexpectedState);
|
|
480 |
}
|
|
481 |
break;
|
|
482 |
}
|
|
483 |
|
|
484 |
//
|
|
485 |
// DoRunL() will now return to CSmsuActiveBase which if the object
|
|
486 |
// is not active, will call Complete().
|
|
487 |
//
|
|
488 |
} // CSmsWriteParams::DoRunL
|
|
489 |
|
|
490 |
|
|
491 |
/**
|
|
492 |
* Handles cancel write parameters request.
|
|
493 |
*
|
|
494 |
* Cancel timeout timer. Cancel reading and writing processes
|
|
495 |
* if they are running.
|
|
496 |
*
|
|
497 |
*/
|
|
498 |
void CSmsWriteParams::DoCancel()
|
|
499 |
{
|
|
500 |
LOGSMSPROT1("CSmsWriteParams::DoCancel()");
|
|
501 |
|
|
502 |
TimedSetActiveCancel();
|
|
503 |
|
|
504 |
switch (iState)
|
|
505 |
{
|
|
506 |
case ESmsParamsStoringList:
|
|
507 |
{
|
|
508 |
iSmsReadParams.Cancel();
|
|
509 |
}
|
|
510 |
break;
|
|
511 |
|
|
512 |
case ESmsParamsStoringListToInternal:
|
|
513 |
{
|
|
514 |
iSmsMessaging.CancelAsyncRequest(EMobileSmsMessagingStoreSmspList);
|
|
515 |
}
|
|
516 |
break;
|
|
517 |
|
|
518 |
default:
|
|
519 |
{
|
|
520 |
SmspPanic(KSmspPanicUnexpectedState);
|
|
521 |
}
|
|
522 |
break;
|
|
523 |
}
|
|
524 |
|
|
525 |
//
|
|
526 |
// Handle completion of this Active Object. Note that the object
|
|
527 |
// may well still be active at this point...
|
|
528 |
//
|
|
529 |
if (TimedOut())
|
|
530 |
{
|
|
531 |
Complete(KErrTimedOut);
|
|
532 |
}
|
|
533 |
else
|
|
534 |
{
|
|
535 |
Complete(KErrCancel);
|
|
536 |
}
|
|
537 |
} // CSmsWriteParams::DoCancel
|
|
538 |
|
|
539 |
|
|
540 |
/**
|
|
541 |
* Constructor
|
|
542 |
*
|
|
543 |
* @param aSmsComm a reference to the protocol.
|
|
544 |
* @param aSmsSettings a reference to the global SMS settings.
|
|
545 |
* @param aSmsMessaging a reference to the ETEL SMS messaging subsession.
|
|
546 |
* @param aSmsReadParams a reference to the CSmsReadParams object.
|
|
547 |
*
|
|
548 |
*/
|
|
549 |
CSmsWriteParams::CSmsWriteParams(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging,CSmsReadParams& aSmsReadParams):
|
|
550 |
CSmsParamsBase(aSmsComm,aSmsSettings,aSmsMessaging),
|
|
551 |
iState(ESmsParamsIdle),
|
|
552 |
iSmsReadParams(aSmsReadParams)
|
|
553 |
{
|
|
554 |
} // CSmsWriteParams::CSmsWriteParams
|
|
555 |
|
|
556 |
|
|
557 |
/**
|
|
558 |
* 2nd Phase of construction.
|
|
559 |
*
|
|
560 |
* Creates CSmsuTimeout object.
|
|
561 |
*
|
|
562 |
*/
|
|
563 |
void CSmsWriteParams::ConstructL()
|
|
564 |
{
|
|
565 |
LOGSMSPROT1("CSmsWriteParams::ConstructL()");
|
|
566 |
|
|
567 |
CSmsParamsBase::ConstructL();
|
|
568 |
} // CSmsWriteParams::ConstructL
|
|
569 |
|
|
570 |
|
|
571 |
/**
|
|
572 |
* Completes write request or cancel write request.
|
|
573 |
*
|
|
574 |
* Cancel timeout timer. Set state to ESmsParamsIdle. Complete request to the
|
|
575 |
* observer.
|
|
576 |
*
|
|
577 |
* @param aStatus a status value.
|
|
578 |
* @leave Panic if Complete is called while object is in ESmsParamsIdle state.
|
|
579 |
*
|
|
580 |
*/
|
|
581 |
void CSmsWriteParams::Complete(TInt aStatus)
|
|
582 |
{
|
|
583 |
LOGSMSPROT1("CSmsWriteParams::Complete()");
|
|
584 |
|
|
585 |
//
|
|
586 |
// Call the base function to perform the actual complete...
|
|
587 |
//
|
|
588 |
CSmsuActiveBase::Complete(aStatus);
|
|
589 |
|
|
590 |
delete iMobilePhoneSmspList;
|
|
591 |
iMobilePhoneSmspList = NULL;
|
|
592 |
|
|
593 |
iState = ESmsParamsIdle;
|
|
594 |
|
|
595 |
if (iSmsComm.ObserverIsPresent(*iSmsMessageObserver))
|
|
596 |
{
|
|
597 |
iSmsMessageObserver->WriteSmsParamsCompleted(aStatus);
|
|
598 |
iSmsMessageObserver = NULL;
|
|
599 |
}
|
|
600 |
} // CSmsWriteParams::Complete
|