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 |
// Header for a CActive based class that monitors for low disk space and
|
|
15 |
// is informed when a PDU is being received. Should memory be too low,
|
|
16 |
// an error code is returned causing a NAck. The class will then monitor
|
|
17 |
// for the point at which PDUs can be received again, and a Resume Reception
|
|
18 |
// will be sent to the network.
|
|
19 |
// The are two limits - a high limit for general SMSs and a low limit for
|
|
20 |
// class 0 SMSs. However there is only one way to resume reception of SMSs. So
|
|
21 |
// once a resume reception is sent, it resumes hoth types of SMSs. The algorithm
|
|
22 |
// is a bit simiplier because of this:
|
|
23 |
// IF sending non-Class 0 AND we are below the high limit THEN
|
|
24 |
// N'Ack SMS
|
|
25 |
// IF not waiting for free diskspace THEN
|
|
26 |
// Wait for free diskspace to rise above the high limit
|
|
27 |
// Resume SMS Reception.
|
|
28 |
// ELSE
|
|
29 |
// Continue waiting for either high limit or low limit
|
|
30 |
// Resume SMS Reception as previously intended
|
|
31 |
// END_IF
|
|
32 |
// ELSE IF sending Class 0 AND we are below the low limit THEN
|
|
33 |
// Wait for free diskspace to rise above the low limit
|
|
34 |
// Resume SMS Reception.
|
|
35 |
// END_IF
|
|
36 |
// Note that in the second and last case, SMS reception may be resumed before
|
|
37 |
// we are above the high limit, but in that case montioring will repeat when
|
|
38 |
// the next non-class 0 SMS is attempted to be delivered. This is necessary as
|
|
39 |
// there is no way to resume just class 0 SMSs.
|
|
40 |
//
|
|
41 |
//
|
|
42 |
|
|
43 |
/**
|
|
44 |
@file
|
|
45 |
@internalComponent
|
|
46 |
*/
|
|
47 |
|
|
48 |
|
|
49 |
#ifndef __SMSPMONDSK_H__
|
|
50 |
#define __SMSPMONDSK_H__
|
|
51 |
|
|
52 |
#include <etelmm.h>
|
|
53 |
#include <f32file.h>
|
|
54 |
|
|
55 |
|
|
56 |
/**
|
|
57 |
* The class is a simple active object derived state machine that monitors
|
|
58 |
* disk space needed for storage of incoming messages.
|
|
59 |
*/
|
|
60 |
class CSmsMonitorDiskSpace : public CActive
|
|
61 |
{
|
|
62 |
public:
|
|
63 |
static CSmsMonitorDiskSpace* NewL(MSmsComm& aSmsComm, RMobileSmsMessaging& aSmsMessaging, RFs& aFs);
|
|
64 |
~CSmsMonitorDiskSpace();
|
|
65 |
|
|
66 |
void CheckDiskSpaceForPDUL(TBool aPDUIsClass0);
|
|
67 |
|
|
68 |
protected:
|
|
69 |
void RunL();
|
|
70 |
void DoCancel();
|
|
71 |
|
|
72 |
private:
|
|
73 |
enum TSmsMonitorDiskSpaceState
|
|
74 |
{
|
|
75 |
ESmsMonitorDiskSpaceIdle,
|
|
76 |
ESmsMonitorDiskSpaceMonitorLowLimit,
|
|
77 |
ESmsMonitorDiskSpaceMonitorHighLimit,
|
|
78 |
ESmsMonitorDiskSpaceResumeReception
|
|
79 |
};
|
|
80 |
|
|
81 |
CSmsMonitorDiskSpace(MSmsComm& aSmsComm, RMobileSmsMessaging& aSmsMessaging, RFs& aFs);
|
|
82 |
void ConstructL();
|
|
83 |
|
|
84 |
void NotifyDiskSpace(TInt aLimit, TSmsMonitorDiskSpaceState aState);
|
|
85 |
void ResumeSmsReception();
|
|
86 |
TInt GetFreeDiskSpace();
|
|
87 |
|
|
88 |
TSmsMonitorDiskSpaceState iState;
|
|
89 |
RMobileSmsMessaging& iSmsMessaging;
|
|
90 |
RFs& iFs;
|
|
91 |
MSmsComm& iSmsComm;
|
|
92 |
TUint iLowLimit;
|
|
93 |
TUint iHighLimit;
|
|
94 |
TBool iNAckdClassZero;
|
|
95 |
TBool iNAckdClassOther;
|
|
96 |
|
|
97 |
#ifdef _DEBUG
|
|
98 |
TBool iInOODTesting ;
|
|
99 |
RProperty iFreeDiskSpaceProperty;
|
|
100 |
#endif
|
|
101 |
|
|
102 |
};
|
|
103 |
|
|
104 |
#endif // !defined __SMSPMONDSK_H__
|