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 |
/**
|
|
17 |
@file
|
|
18 |
@internalAll
|
|
19 |
*/
|
|
20 |
|
|
21 |
#if !defined (__SMSPSTOR_H__)
|
|
22 |
#define __SMSPSTOR_H__
|
|
23 |
|
|
24 |
#include "gsmustor.h"
|
|
25 |
#include <logwrap.h>
|
|
26 |
|
|
27 |
/**
|
|
28 |
* @internalComponent
|
|
29 |
*/
|
|
30 |
_LIT(KReassemblyStoreName,"smsreast.dat"); //reassembly store name
|
|
31 |
const TInt KReassemblyStoreUidValue=0x1000089e;
|
|
32 |
const TUid KReassemblyStoreUid={KReassemblyStoreUidValue}; // Used for second uid of SAR stores
|
|
33 |
|
|
34 |
/**
|
|
35 |
* @internalComponent
|
|
36 |
*/
|
|
37 |
_LIT(KSegmentationStoreName,"smssegst.dat"); //segmentation store name
|
|
38 |
const TInt KSegmentationStoreUidValue=0x1000089f;
|
|
39 |
const TUid KSegmentationStoreUid={KSegmentationStoreUidValue}; // Used for second uid of SAR stores
|
|
40 |
const TInt KDefaultMaxmumNumberOfMessagesInSegmentationStore = 1000; //<Maximum number of messages in segmentation store
|
|
41 |
|
|
42 |
class CSmsMessage;
|
|
43 |
class TSmsAddr;
|
|
44 |
class TGsmSms;
|
|
45 |
|
|
46 |
// TSAREntry fields for the reassembly store
|
|
47 |
|
|
48 |
// Reference - concatenation reference
|
|
49 |
// Total - total number of PDUs in SMS message
|
|
50 |
// Count - number of PDUs received
|
|
51 |
// Data1 - DCS bits7to4 and min and max IEI
|
|
52 |
// Data2 - log server id
|
|
53 |
// Data3 - SMS PDU type
|
|
54 |
// Data4 - Storage
|
|
55 |
// Description1 - first 32 characters from buffer
|
|
56 |
// Description2 - original address
|
|
57 |
// Time - time on SMS message
|
|
58 |
|
|
59 |
/**
|
|
60 |
* @internalComponent
|
|
61 |
*/
|
|
62 |
class CSmsReassemblyStore : public CSARStore
|
|
63 |
{
|
|
64 |
public:
|
|
65 |
static CSmsReassemblyStore* NewL(RFs& aFs);
|
|
66 |
~CSmsReassemblyStore();
|
|
67 |
|
|
68 |
void MatchPDUToExistingMessage(const CSmsMessage& aSmsMessage, TInt& aIndex);
|
|
69 |
void UpdateExistingMessageL(const CSmsMessage& aSmsMessage,
|
|
70 |
const TGsmSms& aGsmSms, TInt aIndex,
|
|
71 |
TBool& aComplete,
|
|
72 |
TBool& aDuplicateMsgRef,
|
|
73 |
TBool& aDuplicateSlot);
|
|
74 |
|
|
75 |
void NewMessagePDUL(TInt& aIndex,CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms);
|
|
76 |
void GetMessageL(TInt aIndex,CSmsMessage& aSmsMessage);
|
|
77 |
TBool FindMessageL(const CSmsMessage& aSmsMessage, TBool aPassed, TInt& aIndex);
|
|
78 |
void SetPassedToClientL(TInt aIndex, TBool aPassed);
|
|
79 |
TBool PassedToClient(TInt aIndex) const;
|
|
80 |
void UpdateLogServerIdL(TInt aIndex, TLogId aLogServerId);
|
|
81 |
void OpenStoreL();
|
|
82 |
|
|
83 |
private:
|
|
84 |
void InternalizeEntryL(const TStreamId& aStreamId,CSmsMessage& aSmsMessage,CArrayFix<TInt>& aIndexArray,CArrayFix<TGsmSms>& aSmsArray);
|
|
85 |
void ExternalizeEntryL(TStreamId& aStreamId,const CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray);
|
|
86 |
|
|
87 |
static void PopulateEntry(TSmsReassemblyEntry& aEntry,const CSmsMessage& aSmsMessage,TInt aNumSmss);
|
|
88 |
void CreateEntryL(CSmsMessage& aSmsMessage,const CArrayFix<TInt>& aIndexArray,const CArrayFix<TGsmSms>& aSmsArray);
|
|
89 |
|
|
90 |
private:
|
|
91 |
CSmsReassemblyStore(RFs& aFs);
|
|
92 |
void ConstructL();
|
|
93 |
|
|
94 |
TTime iLastReceivedTime;
|
|
95 |
TTime iLastRealTime;
|
|
96 |
TFileName iFullPathBuf;
|
|
97 |
};
|
|
98 |
|
|
99 |
// TSAREntry fields for the segmentation store
|
|
100 |
|
|
101 |
// Reference - concatenation reference
|
|
102 |
// Total - total number of PDUs in SMS message
|
|
103 |
// Count - number of PDUs sent
|
|
104 |
// Data1 - total PDUs delivered<<16 and failed
|
|
105 |
// Data2 - log server id
|
|
106 |
// Data3 - validity period
|
|
107 |
// Data4 - type and min and max message reference
|
|
108 |
// Description1 - first 32 characters from buffer
|
|
109 |
// Description2 - original address
|
|
110 |
// Time - time on SMS message
|
|
111 |
|
|
112 |
|
|
113 |
/**
|
|
114 |
* @internalComponent
|
|
115 |
*/
|
|
116 |
|
|
117 |
class CSmsSegmentationStore : public CSARStore
|
|
118 |
{
|
|
119 |
public:
|
|
120 |
enum
|
|
121 |
{
|
|
122 |
ENullStatus=0x100,
|
|
123 |
EStatusComplete=0x00
|
|
124 |
};
|
|
125 |
|
|
126 |
/**
|
|
127 |
* @internalComponent
|
|
128 |
*/
|
|
129 |
class TSmsSegmentationStoreRefStatus
|
|
130 |
{
|
|
131 |
public:
|
|
132 |
inline TSmsSegmentationStoreRefStatus(TInt aRef=0, TInt aStatus=ENullStatus);
|
|
133 |
static TInt Compare(const TSmsSegmentationStoreRefStatus& aLeft, const TSmsSegmentationStoreRefStatus& aRight);
|
|
134 |
void InternalizeL(RReadStream& aStream);
|
|
135 |
void ExternalizeL(RWriteStream& aStream) const;
|
|
136 |
inline TInt Reference() const;
|
|
137 |
inline TInt Status() const;
|
|
138 |
inline void SetStatus(TInt aStatus);
|
|
139 |
|
|
140 |
private:
|
|
141 |
|
|
142 |
TInt iReference; //< Message reference number
|
|
143 |
TInt iStatus; //< Status for this message reference
|
|
144 |
};
|
|
145 |
|
|
146 |
/**
|
|
147 |
* @internalComponent
|
|
148 |
*/
|
|
149 |
class RSmsSegmentationStoreRefStatusArray : public RArray<TSmsSegmentationStoreRefStatus>
|
|
150 |
{
|
|
151 |
public:
|
|
152 |
inline RSmsSegmentationStoreRefStatusArray();
|
|
153 |
void InsertL(const TSmsSegmentationStoreRefStatus& aRefStatus);
|
|
154 |
TInt Find(const TSmsSegmentationStoreRefStatus& aRefStatus) const;
|
|
155 |
void CopyL(const RSmsSegmentationStoreRefStatusArray& aOther);
|
|
156 |
void ResetAllStatus(TInt aStatus=ENullStatus);
|
|
157 |
|
|
158 |
void InternalizeL(RReadStream& aStream);
|
|
159 |
void ExternalizeL(RWriteStream& aStream) const;
|
|
160 |
};
|
|
161 |
|
|
162 |
public:
|
|
163 |
static CSmsSegmentationStore* NewL(RFs& aFs);
|
|
164 |
~CSmsSegmentationStore();
|
|
165 |
|
|
166 |
TInt Next8BitReferenceL();
|
|
167 |
TInt Next16BitReferenceL();
|
|
168 |
|
|
169 |
void AddSubmitL(const TSmsAddr& aSmsAddr,CSmsMessage& aSubmit);
|
|
170 |
TBool AddCommandL(const TSmsAddr& aSmsAddr,const CSmsMessage& aCommand, RSmsSegmentationStoreRefStatusArray& aRefStatus);
|
|
171 |
TBool AddReferenceL(const CSmsMessage& aSmsMessage,TInt aReference);
|
|
172 |
TBool AddReferenceStatusPairL(const CSmsMessage& aSmsMessage,TInt aReference, TUint aSegmentSequenceNumber);
|
|
173 |
TBool AddStatusReportL(TInt& aIndex,TBool& aComplete,const CSmsMessage& aStatusReport);
|
|
174 |
void GetMessageL(TInt aIndex,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatus);
|
|
175 |
|
|
176 |
inline static TBool IsPermanentStatus(TInt aStatus);
|
|
177 |
TBool HasEntryWithLogIdL(TLogId,TInt&,TInt&);
|
|
178 |
void OpenStoreL();
|
|
179 |
|
|
180 |
private:
|
|
181 |
void InternalizeConcatenationReferencesL(const TStreamId& aStreamId,TInt& aReference8bit,TInt& aReference16bit);
|
|
182 |
void ExternalizeConcatenationReferencesL(TStreamId& aStreamId,TInt aReference8bit,TInt aReference16bit);
|
|
183 |
|
|
184 |
void InternalizeEntryL(const TStreamId& aStreamId,TSmsAddr& aSmsAddr,CSmsMessage& aSmsMessage, RSmsSegmentationStoreRefStatusArray& aRefStatus);
|
|
185 |
void ExternalizeEntryL(TStreamId& aStreamId,const TSmsAddr& aSmsAddr,const CSmsMessage& aSmsMessage, const RSmsSegmentationStoreRefStatusArray& aRefStatus);
|
|
186 |
|
|
187 |
static void PopulateEntry(TSmsSegmentationEntry& aEntry,/*const TSmsAddr& aSmsAddr,*/const CSmsMessage& aSmsMessage, const RSmsSegmentationStoreRefStatusArray& aRefStatus);
|
|
188 |
|
|
189 |
static TBool StatusArrayComplete(const RSmsSegmentationStoreRefStatusArray& aRefStatus, TSAREntry& aEntry);
|
|
190 |
|
|
191 |
CSmsSegmentationStore(RFs& aFs);
|
|
192 |
void ConstructL();
|
|
193 |
private:
|
|
194 |
TFileName iFullPathBuf;
|
|
195 |
};
|
|
196 |
|
|
197 |
#include "smspstor.inl"
|
|
198 |
|
|
199 |
#endif // !defined __SMSPSTOR_H__
|
|
200 |
|