0
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef _CMMSMSCACHE_H_
|
|
21 |
#define _CMMSMSCACHE_H_
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32def.h>
|
|
25 |
#include <e32base.h>
|
|
26 |
|
|
27 |
// CONSTANTS
|
|
28 |
//none
|
|
29 |
#define EMPTY_LOCATION 0xFF
|
|
30 |
|
|
31 |
// MACROS
|
|
32 |
//none
|
|
33 |
|
|
34 |
// DATA TYPES
|
|
35 |
//none
|
|
36 |
|
|
37 |
// EXTERNAL DATA STRUCTURES
|
|
38 |
//none
|
|
39 |
|
|
40 |
// FUNCTION PROTOTYPES
|
|
41 |
//none
|
|
42 |
|
|
43 |
// FORWARD DECLARATIONS
|
|
44 |
class TIsiReceiveC;
|
|
45 |
|
|
46 |
// CLASS DEFINITIONS
|
|
47 |
|
|
48 |
// DESCRIPTION
|
|
49 |
// SIM SMS cache: class declaration
|
|
50 |
// CMmSmsCache is auxillary class used by CMmSmsMessHandler to implement
|
|
51 |
// caching of SIM SMS messages. In boot SMS's are read from SIM and read
|
|
52 |
// resp's are cached to this cache (except empty slots, where a null ptr is
|
|
53 |
// put to the array). Basically there are three kinds of operations that can
|
|
54 |
// modify cache state:
|
|
55 |
// - read resp, save received isi msg to array (since all writes read SMS
|
|
56 |
// this works for them too)
|
|
57 |
// - delete isi msg from array if delete resp is ok.
|
|
58 |
// - out of memory/read error (if reading written sms), invalidates cache
|
|
59 |
// If cache is invalidated there are two ways it can be refilled:
|
|
60 |
// - CMmSmsMessHandler::GetSmsStoreInfo - initiate refill and wait
|
|
61 |
// - incoming SMS 2 - initiate refill and fail
|
|
62 |
//
|
|
63 |
class CMmSmsCache : public CBase
|
|
64 |
{
|
|
65 |
// METHODS
|
|
66 |
public:
|
|
67 |
/**
|
|
68 |
* Constructor
|
|
69 |
*/
|
|
70 |
CMmSmsCache();
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Destructor
|
|
74 |
*/
|
|
75 |
~CMmSmsCache();
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Reset cache to not ready state
|
|
79 |
*/
|
|
80 |
void Reset();
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Get the number of used entries from cache
|
|
84 |
* @return TInt number of used entries.
|
|
85 |
*/
|
|
86 |
TInt UsedEntries();
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Get the total number of entries in SIM
|
|
90 |
* @return TInt total number of entries
|
|
91 |
*/
|
|
92 |
TInt TotalEntries();
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Get cache status, this can be KErrNotReady (cache is being read)
|
|
96 |
* KErrNone (cache is ok and can be used)
|
|
97 |
* KErrNoMemory (cache was delete due to no memory)
|
|
98 |
* any other (cache is in error state and is unusable)
|
|
99 |
* @return TInt error code
|
|
100 |
*/
|
|
101 |
TInt Status();
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Set cache error state
|
|
105 |
*/
|
|
106 |
void SetStatus( TInt aError );
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Initialize cache to contain aTotal number of empty entries
|
|
110 |
* it is assumed that cache is Reset before call to this..
|
|
111 |
* @param aTotal total entries in sim
|
|
112 |
*/
|
|
113 |
void SetTotalEntriesL( TInt aTotal );
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Adds new entry to cache, if the cause of isi msg is not
|
|
117 |
* ok, then we add just a null pointer (to save space)
|
|
118 |
* returns true if element was cache and false
|
|
119 |
* if cache location is empty
|
|
120 |
* @param aFileData to add to cache
|
|
121 |
* @param aRecordId of the data
|
|
122 |
* @return TBool ETrue if entry was added empty
|
|
123 |
*/
|
|
124 |
TBool AddEntryL( const RMobileSmsStore::TMobileGsmSmsEntryV1* aEntry,
|
|
125 |
const TUint8 aRecordId );
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Get entry from cache, returns null if cache doesn't contain
|
|
129 |
* valid entry in the given location location range is in range
|
|
130 |
* [1... max sim sms slots]
|
|
131 |
* @param aLocation location to get entry from
|
|
132 |
* @return TIsiReceiveC* isi msg
|
|
133 |
*/
|
|
134 |
RMobileSmsStore::TMobileGsmSmsEntryV1* GetEntry( TInt aLocation );
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Return first free location in range [1... max sim sms slots]
|
|
138 |
* or zero if no free slots are found
|
|
139 |
* @return TUint location
|
|
140 |
*/
|
|
141 |
TUint FirstFreeLocation();
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Set the location to delete by Delete()
|
|
145 |
* @param aLocation location
|
|
146 |
*/
|
|
147 |
void SetDeleteLocation( TInt aLocation );
|
|
148 |
|
|
149 |
/**
|
|
150 |
* If delete location is set, then delete
|
|
151 |
*/
|
|
152 |
void Delete();
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Delete an element from cache
|
|
156 |
*/
|
|
157 |
void Delete( TInt aLocation );
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Empty all of cache
|
|
161 |
*/
|
|
162 |
void DeleteAll();
|
|
163 |
|
|
164 |
// ATTRIBUTES
|
|
165 |
private:
|
|
166 |
// cache error code
|
|
167 |
TInt iError;
|
|
168 |
|
|
169 |
// location to delete
|
|
170 |
TUint iDeleteLocation;
|
|
171 |
|
|
172 |
// SIM SMS contents, as a SIM_SMS_RESP.SIM_ST_SMS_READ
|
|
173 |
// ISI message.
|
|
174 |
// null ptr == empty, other == slot contains sms.
|
|
175 |
RArray<RMobileSmsStore::TMobileGsmSmsEntryV1*> iElements;
|
|
176 |
};
|
|
177 |
|
|
178 |
#endif // _CMMSMSCACHE_H_
|
|
179 |
|
|
180 |
//End of file
|