|
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 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef __SMS_PDU_DB_ITEMS_H__ |
|
22 #define __SMS_PDU_DB_ITEMS_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <etelmm.h> |
|
26 #include "gsmupdu.h" |
|
27 #include "gsmuetel.h" |
|
28 |
|
29 class CTestConfigItem; |
|
30 class CSmsMessage; |
|
31 class CSmsBufferBase; |
|
32 |
|
33 _LIT8(KSmsPduDbSubmit, "submit"); |
|
34 _LIT8(KSmsPduDbSubmitConcat, "submitconcat"); |
|
35 _LIT8(KSmsPduDbDeliver, "deliver"); |
|
36 _LIT8(KSmsPduDbDeliverConcat, "deliverconcat"); |
|
37 _LIT8(KSmsPduDbStatusReport, "statusreport"); |
|
38 _LIT8(KSmsPduDbCommand, "command"); |
|
39 _LIT8(KSmsPduDbMessage, "message"); |
|
40 _LIT8(KSmsPduDbSubmitReport, "submitreport"); |
|
41 _LIT8(KSmsPduDbDeliverReport, "deliverreport"); |
|
42 |
|
43 const TInt KSmsPduDbDelimiter = ','; |
|
44 const TInt KSmsPduDbTagStart = '<'; |
|
45 const TInt KSmsPduDbTagEnd = '>'; |
|
46 const TInt KSmsPduDbTagDelimitier = ';'; |
|
47 |
|
48 class CSmsPduDbBase : public CBase |
|
49 { |
|
50 public: |
|
51 |
|
52 enum |
|
53 { |
|
54 ESmsPduDbId = 0 |
|
55 }; |
|
56 |
|
57 public: |
|
58 |
|
59 IMPORT_C ~CSmsPduDbBase(); |
|
60 HBufC* DescriptionLC() const; |
|
61 |
|
62 protected: |
|
63 |
|
64 inline CSmsPduDbBase(); |
|
65 virtual void DecodeL(RFs& aFs, const CTestConfigItem& aItem)=0; //< Constructs the CSmsMessage |
|
66 |
|
67 public: |
|
68 |
|
69 TInt iId; |
|
70 TPtrC8 iDescription; |
|
71 CSmsMessage* iSmsMessage; |
|
72 TInt iSmsMessageError; //< Error if construction of CSmsMessage failed |
|
73 }; |
|
74 |
|
75 class CSmsPduDbPdu : public CSmsPduDbBase |
|
76 { |
|
77 private: |
|
78 |
|
79 enum TSmsPduDbPduPosition |
|
80 { |
|
81 EPdu = ESmsPduDbId + 1, |
|
82 EPduError, |
|
83 EPduDesc |
|
84 }; |
|
85 |
|
86 public: |
|
87 |
|
88 IMPORT_C static CSmsPduDbPdu* NewL(RFs& aFs, const CTestConfigItem& aItem, CSmsPDU::TSmsPDUType aType); |
|
89 IMPORT_C void GetHexPdu(TDes8& aHexPdu) const; |
|
90 |
|
91 protected: |
|
92 |
|
93 inline CSmsPduDbPdu(CSmsPDU::TSmsPDUType aType); |
|
94 void DecodeL(RFs& aFs, const CTestConfigItem& aItem); |
|
95 void ConstructSmsMessageL(RFs& aFs); |
|
96 void SetPduL(const TDesC8& aHexPdu); |
|
97 TBool IsMobileTerminatedL() const; |
|
98 |
|
99 public: |
|
100 |
|
101 CSmsPDU::TSmsPDUType iType; |
|
102 RMobileSmsMessaging::TMobileSmsGsmTpdu iPdu; |
|
103 TInt iDecodeError; |
|
104 }; |
|
105 |
|
106 class CSmsPduDbConcatSegment : public CSmsPduDbPdu |
|
107 { |
|
108 public: |
|
109 |
|
110 enum TSmsPduDbConcatPosition |
|
111 { |
|
112 EConcatSegment = ESmsPduDbId + 1, |
|
113 EConcatPdu, |
|
114 EConcatError, |
|
115 EConcatDesc |
|
116 }; |
|
117 |
|
118 public: |
|
119 |
|
120 IMPORT_C static CSmsPduDbConcatSegment* NewL(RFs& aFs, const CTestConfigItem& aItem, CSmsPDU::TSmsPDUType aType); |
|
121 |
|
122 private: |
|
123 |
|
124 inline CSmsPduDbConcatSegment(CSmsPDU::TSmsPDUType aType); |
|
125 void DecodeL(RFs& aFs, const CTestConfigItem& aItem); |
|
126 |
|
127 public: |
|
128 |
|
129 TInt iSegment; |
|
130 }; |
|
131 |
|
132 class CSmsPduDbConcat : public CSmsPduDbBase |
|
133 { |
|
134 public: |
|
135 |
|
136 inline CSmsPduDbConcat(); |
|
137 IMPORT_C ~CSmsPduDbConcat(); |
|
138 IMPORT_C void DecodeL(RFs& aFs); |
|
139 |
|
140 private: |
|
141 |
|
142 void DecodeL(RFs&, const CTestConfigItem&) {}; |
|
143 |
|
144 public: |
|
145 |
|
146 RPointerArray<CSmsPduDbConcatSegment> iSegments; |
|
147 }; |
|
148 |
|
149 |
|
150 class CSmsPduDbMessage : public CSmsPduDbPdu |
|
151 { |
|
152 private: |
|
153 |
|
154 enum TSmsPduDbMessagePosition |
|
155 { |
|
156 EMsgBody = ESmsPduDbId + 1, |
|
157 EMsgStatusReport, |
|
158 EMsgDCS, |
|
159 EMsgPID, |
|
160 EMsgDesc |
|
161 }; |
|
162 |
|
163 enum TSmsPduDbUnicodeChar |
|
164 { |
|
165 EUnicodeChar = 0, |
|
166 EUnicodeCharRepeat = 1 |
|
167 }; |
|
168 |
|
169 public: |
|
170 |
|
171 IMPORT_C static CSmsPduDbMessage* NewL(RFs& aFs, const CTestConfigItem& aItem, CSmsPDU::TSmsPDUType aType); |
|
172 |
|
173 private: |
|
174 |
|
175 inline CSmsPduDbMessage(CSmsPDU::TSmsPDUType aType); |
|
176 void DecodeL(RFs& aFs, const CTestConfigItem& aItem); |
|
177 void SetDataCodingScheme(TInt aDCS); |
|
178 void SetProtocolIdentifier(TInt aPID); |
|
179 void SetBufferL(const TDesC8& aBody, CSmsBufferBase& aBuffer); |
|
180 void AppendToBufferL(const TDesC8& aItem, CSmsBufferBase& aBuffer); |
|
181 void ParseUnicodeL(const TDesC8& aUnicode, CSmsBufferBase& aBuffer); |
|
182 void ProcessUnicodeL(TLex8& aBody, CSmsBufferBase& aBuffer); |
|
183 |
|
184 public: |
|
185 |
|
186 CArrayFixFlat<TGsmSms> iPdus; //< Pdus created by calling iSmsMessage->EncodeMessagePDUsL(). This is done in DecodeL() |
|
187 TInt iPdusError; //< Error if iSmsMessage->EncodeMessagePDUsL() left |
|
188 }; |
|
189 |
|
190 #include "smspdudbitems.inl" |
|
191 |
|
192 #endif |