|
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 SATUTIL_H |
|
21 #define SATUTIL_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <etelsat.h> // etel sat api |
|
26 #include <etelmm.h> // etel multimode api |
|
27 |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 //UCS2 coding |
|
32 const TUint8 KUCS2ArabicCoding = 0x80; |
|
33 const TUint8 KUCS2GreekCoding = 0x81; |
|
34 const TUint8 KUCS2TurkishCoding = 0x82; |
|
35 |
|
36 // USIM Status words |
|
37 const TUint8 KAtkSwDataNtfSw1NormalEnding = 0x90; |
|
38 const TUint8 KAtkSwDataNtfSw2NormalEnding = 0x00; |
|
39 const TUint8 KAtkSwDataNtfSw1busy = 0x93; |
|
40 |
|
41 const TUint8 KAllowed = 0x01; |
|
42 const TUint8 KModified = 0x02; |
|
43 const TUint8 KChanged = 0x03; |
|
44 const TUint8 KRejected = 0x04; |
|
45 const TUint8 KError = 0x08; |
|
46 const TUint8 KNoTonNpi = 0xFF; |
|
47 const TUint8 KTonNpiInternational = 0x91; |
|
48 const TUint8 KTonNpiUnknown = 0x81; |
|
49 |
|
50 |
|
51 // DATA TYPES |
|
52 |
|
53 // Sms data coding schemes |
|
54 enum TSmsDcs |
|
55 { |
|
56 ESmsUnknownOrReservedDcs = 0xFF, |
|
57 ESms7BitDcs = 0x00, |
|
58 ESms8BitDcs = 0x04, |
|
59 ESms16BitDcs = 0x08 |
|
60 }; |
|
61 |
|
62 |
|
63 // FORWARD DECLARATIONS |
|
64 class CBerTlv; |
|
65 class CTlv; |
|
66 |
|
67 |
|
68 // CLASS DECLARATION |
|
69 /** |
|
70 * SAT Transaction Id Message class. |
|
71 * Handles and stores the current ID of SAT messages, and |
|
72 * transaction ID setting and verifying. |
|
73 * |
|
74 * @lib simatktsy.lib |
|
75 * @since Series60_ver 2.6 |
|
76 */ |
|
77 class TTransIdMessage |
|
78 { |
|
79 public: |
|
80 |
|
81 /** |
|
82 * C++ default constructor. |
|
83 */ |
|
84 TTransIdMessage(); |
|
85 |
|
86 public: // New functions |
|
87 |
|
88 /** |
|
89 * Gets a new transaction id and saves it to transaction id |
|
90 * table. |
|
91 * @since Series60_ver 2.6 |
|
92 * @return none |
|
93 */ |
|
94 TUint8 GetTransactionId(); |
|
95 |
|
96 protected: // Data |
|
97 |
|
98 TUint8 iTransNum; |
|
99 }; |
|
100 |
|
101 |
|
102 /** |
|
103 * SAT Utility class. |
|
104 * This class includes small aid fuctions |
|
105 * for MMSAT specific use. |
|
106 * |
|
107 * @lib ?library |
|
108 * @since Series60_ver 2.6 |
|
109 */ |
|
110 class TSatUtility |
|
111 { |
|
112 private: // Constructors |
|
113 |
|
114 /** |
|
115 * C++ default constructor. Static utility library isn't meant to be |
|
116 * instanced |
|
117 * @since NCP 5.0 |
|
118 */ |
|
119 TSatUtility(); |
|
120 |
|
121 |
|
122 public: // New functions |
|
123 |
|
124 /** |
|
125 * Map TON and NPI to RSat TON and NPI values |
|
126 * @since Series60_ver 2.6 |
|
127 * @param aTonAndNpi: Source TON and NPI |
|
128 * @param aTon: Mapped Type of number |
|
129 * @param aNpi: Mapped Numbering plan |
|
130 * @return void: none |
|
131 */ |
|
132 static void GetTonAndNpi( TInt aTonAndNpi, RSat::TTypeOfNumber* aTon, |
|
133 RSat::TNumberingPlan* aNpi ); |
|
134 |
|
135 /** |
|
136 * Map TON and NPI to Etel MM TON and NPI values |
|
137 * @since NCP 5.0 |
|
138 * @param aTonAndNpi: Source TON and NPI |
|
139 * @param aTon: Mapped Type of number |
|
140 * @param aNpi: Mapped Numbering plan |
|
141 * @return void: none |
|
142 */ |
|
143 static void GetTonAndNpi( TInt aTonAndNpi, |
|
144 RMobilePhone::TMobileTON& aTon, RMobilePhone::TMobileNPI& aNpi ); |
|
145 |
|
146 /** |
|
147 * Converts 7-bit packed string to 8-bit unpacked format |
|
148 * @since Series60_ver 2.6 |
|
149 * @param aString is source |
|
150 * @param aOutput converted 8-bit unpacked string |
|
151 * @return void: none |
|
152 */ |
|
153 static void Packed7to8Unpacked( TPtrC8 aString, TDes8& aOutput ); |
|
154 |
|
155 /** |
|
156 * Converts UCS2 string to 7-bit packed format |
|
157 * @since Series60_ver 2.6 |
|
158 * @param aString: is source |
|
159 * @param aOutput: converted 7-bit packed string |
|
160 * @return void: none |
|
161 */ |
|
162 static void UCSToPacket7( TPtrC aString, TDes8& aOutput ); |
|
163 |
|
164 /** |
|
165 * Converts Binary Coded Decimal to ASCII |
|
166 * @since Series60_ver 2.6 |
|
167 * @param aTring is source |
|
168 * @param aOutput converted 8-bit string |
|
169 * @return void: none |
|
170 */ |
|
171 static void BCDToAscii( TPtrC8 aString, TDes8& aOutput ); |
|
172 |
|
173 /** |
|
174 * Converts Ascii string to Binary Coded Decimal |
|
175 * @since Series60_ver 2.6 |
|
176 * @param aString is source |
|
177 * @param aOutput converted 8-bit string |
|
178 */ |
|
179 static void AsciiToBCD(const TDesC8& aString, TDes8& aOutput ); |
|
180 |
|
181 /** |
|
182 * Remove expansion digit '.' from phone number string if present. |
|
183 * @since NCP 3.1 |
|
184 * @param aPhoneNumber Number to be converted |
|
185 * @return void: none |
|
186 */ |
|
187 static void RemoveExpansionDigit( TDes8& aPhoneNumber ); |
|
188 |
|
189 /** |
|
190 * Set Alpha identifier as a Unicode text string |
|
191 * and according to the alphabet used |
|
192 * @since Series60_ver 2.6 |
|
193 * @param aRawData input data that was extracted with |
|
194 * ETLV_AlphaIdentifier |
|
195 * @param aAlphaId output |
|
196 * @return void: none |
|
197 */ |
|
198 static void SetAlphaId( TPtrC8 aRawData, TDes& aAlphaId ); |
|
199 |
|
200 /** |
|
201 * Convert integer to BCD format. If number is more than 100 only last |
|
202 * two digits is converted. |
|
203 * @since Series60_ver 2.6 |
|
204 * @param aTime time |
|
205 * @return TUint8 converted BCD value |
|
206 */ |
|
207 static TUint8 ConvertToSemiOctet( TInt aTime ); |
|
208 |
|
209 /** |
|
210 * Browse a text in Unicode format, and for some specific characters |
|
211 * replace with the correct byte value |
|
212 * @since Series60_ver 2.6 |
|
213 * @param aOutput unicode format string |
|
214 * @param aInput input |
|
215 * @return None |
|
216 */ |
|
217 static void ConvertSms7ToUnicode16( TDes16& aOutput, TDesC8& aInput); |
|
218 |
|
219 /** |
|
220 * Converts unicode16 string to sms 7 |
|
221 * @since Series60_ver 2.6 |
|
222 * @param sms 7 string |
|
223 * @param unicode 16 |
|
224 * @return None |
|
225 */ |
|
226 static void ConvertUnicode16ToSms7( TDes8& aOutput, TDesC16& aInput); |
|
227 |
|
228 /** |
|
229 * Fill in a TDuration structure |
|
230 * @since Series60_ver 2.6 |
|
231 * @param aBerTlv tlv containing duration data |
|
232 * @param aTDuration duration structure |
|
233 * @return None |
|
234 */ |
|
235 static void FillDurationStructure( CBerTlv& aBerTlv, |
|
236 RSat::TDuration& aTDuration ); |
|
237 |
|
238 /** |
|
239 * Fill in a TIconId structure |
|
240 * @since Series60_ver 2.6 |
|
241 * @param tlv data containing icon address data |
|
242 * @param icon id structure |
|
243 * @param item number |
|
244 * @return None |
|
245 */ |
|
246 static void FillIconStructure( CBerTlv& aBerTlv, |
|
247 RSat::TIconId& aTIconId, TInt aItemNmb = 0 ); |
|
248 |
|
249 /** |
|
250 * Checks Sw1 and Sw2 bytes coming from Sim server |
|
251 * @since Series60_ver 2.6 |
|
252 * @param aSw1 status word 1 |
|
253 * @param aSw2 status word 2 |
|
254 * @return TInt8 Type of sim atk error |
|
255 */ |
|
256 static TInt8 Sw1Sw2Check( TUint8 aSw1, TUint8 aSw2 ); |
|
257 |
|
258 /** |
|
259 * Set Text string as a Unicode text string |
|
260 * @since Series60_ver 2.6 |
|
261 * @param aTextString text string |
|
262 * @param aText unicode output text string |
|
263 * @return None |
|
264 */ |
|
265 static void SetText( CTlv& aTextString, TDes& aText ); |
|
266 |
|
267 /** |
|
268 * Convert Alpha field text string to a Unicode text string. |
|
269 * @since Series60_ver 2.6 |
|
270 * @param aSource text string |
|
271 * @param aText unicode output text string |
|
272 * @return None |
|
273 */ |
|
274 static void ConvertAlphaFieldsToUnicode( TDesC8& aSource, |
|
275 TDes& aText ); |
|
276 |
|
277 /** |
|
278 * Finds whether the data coding scheme, coded in CBS format, |
|
279 * is 7-bit, 8-bit or 16-bit |
|
280 * @since Series60_ver 2.6 |
|
281 * @param aDcs Input data coding scheme |
|
282 * @param aIs7bit Output boolean indicating 7-bit DCS |
|
283 * @param aIs8bit Output boolean indicating 8-bit DCS |
|
284 * @param aIs16bit Output boolean indicating 16-bit DCS |
|
285 * @return None |
|
286 */ |
|
287 static TSmsDcs DecodeCbsDcs( const TUint8 aDcs ); |
|
288 |
|
289 /** |
|
290 * Get 16-bit word from descriptor |
|
291 * @since NCP 5.0 |
|
292 * @param aTarget 16-bit unsigned descriptor |
|
293 * @param aSource |
|
294 * @param aIndex to point location in descriptor from where to copy word |
|
295 * @return None |
|
296 */ |
|
297 static void GetWord( TUint16& aTarget, TDesC8& aSource, TInt aIndex ); |
|
298 |
|
299 /** |
|
300 * Set 16-bit word to descriptor |
|
301 * @since NCP 5.0 |
|
302 * @param aSource 16-bit unsigned descriptor |
|
303 * @param aTarget |
|
304 * @return None |
|
305 */ |
|
306 static void AppendWord( TUint16 aWord, TDes8& aTarget ); |
|
307 |
|
308 /** |
|
309 * Set Text string User Login and User Password data |
|
310 * @since PP 5.2 |
|
311 * @param aBerTlv tlv containing User Login and User Password data |
|
312 * @param aUserLogin User Login data |
|
313 * @param aUserPassword User Password data |
|
314 * @return None |
|
315 */ |
|
316 static void SetUserLoginAndUserPassword( CBerTlv& aBerTlv, |
|
317 RSat::TTextString& aUserLogin, |
|
318 RSat::TTextString& aUserPassword ); |
|
319 }; |
|
320 |
|
321 |
|
322 #endif // SATUTIL_H |
|
323 |
|
324 // End of File |