0
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2009 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 |
// INCLUDE FILES
|
|
21 |
#include "ber_tlv.h" // ber-tlv classes
|
|
22 |
#include "satutil.h" // sat utility class
|
|
23 |
|
|
24 |
#include "tsylogger.h" // for logging
|
|
25 |
#include <tisi.h> // isi message
|
|
26 |
#include <uiccisi.h> // UICC server
|
|
27 |
#include "osttracedefinitions.h"
|
|
28 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
29 |
#include "ber_tlvtraces.h"
|
|
30 |
#endif
|
|
31 |
|
|
32 |
|
|
33 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
34 |
|
|
35 |
// -----------------------------------------------------------------------------
|
|
36 |
// TTlvBase::Begin
|
|
37 |
// Start ber-tlv construction
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
void TTlvBase::Begin
|
|
41 |
(
|
|
42 |
TUint8 aTag //tag
|
|
43 |
)
|
|
44 |
{
|
|
45 |
OstTrace0( TRACE_DETAILED, TTLVBASE_BEGIN, "TTlvBase::Begin" );
|
|
46 |
TFLOGSTRING("TSY: TTlvBase::Begin");
|
|
47 |
iData.Zero();
|
|
48 |
iData.Append( aTag );
|
|
49 |
iData.Append( 0 );
|
|
50 |
}
|
|
51 |
|
|
52 |
// -----------------------------------------------------------------------------
|
|
53 |
// TTlvBase::AddTag
|
|
54 |
// Start new simple tlv
|
|
55 |
// -----------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
void TTlvBase::AddTag
|
|
58 |
(
|
|
59 |
TUint8 aTag //tag
|
|
60 |
)
|
|
61 |
{
|
|
62 |
OstTrace0( TRACE_DETAILED, TTLVBASE_ADDTAG, "TTlvBase::AddTag" );
|
|
63 |
TFLOGSTRING("TSY: TTlvBase::AddTag");
|
|
64 |
iData.Append( aTag ); // tag
|
|
65 |
iData.Append( 0 ); // length
|
|
66 |
iLenIndex = iData.Length() - 1; // index to tag length
|
|
67 |
}
|
|
68 |
|
|
69 |
// -----------------------------------------------------------------------------
|
|
70 |
// TTlvBase::AddByte
|
|
71 |
// Add byte data to simple tlv
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
void TTlvBase::AddByte
|
|
75 |
(
|
|
76 |
TUint8 aValue
|
|
77 |
)
|
|
78 |
{
|
|
79 |
OstTrace0( TRACE_DETAILED, TTLVBASE_ADDBYTE, "TTlvBase::AddByte" );
|
|
80 |
TFLOGSTRING("TSY: TTlvBase::AddByte");
|
|
81 |
iData.Append( aValue );
|
|
82 |
iData[iLenIndex]++;
|
|
83 |
}
|
|
84 |
|
|
85 |
// -----------------------------------------------------------------------------
|
|
86 |
// TTlvBase::End
|
|
87 |
// Add desctiptor data to simple tlv
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
void TTlvBase::AddData
|
|
91 |
(
|
|
92 |
const TDesC8& aValue
|
|
93 |
)
|
|
94 |
{
|
|
95 |
OstTrace0( TRACE_DETAILED, TTLVBASE_ADDDATA, "TTlvBase::AddData" );
|
|
96 |
TFLOGSTRING("TSY: TTlvBase::AddData");
|
|
97 |
iData.Append( aValue );
|
|
98 |
iData[iLenIndex] = TUint8(iData[iLenIndex] + aValue.Length());
|
|
99 |
}
|
|
100 |
|
|
101 |
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
// TTlvBase::End
|
|
104 |
// End ber-tlv construction. Adds extra length byte to all simple
|
|
105 |
// TLVs that are longer than KMaxOneByteLength (0x7f) and
|
|
106 |
// returns descriptor to the new valid ber-tlv.
|
|
107 |
// -----------------------------------------------------------------------------
|
|
108 |
//
|
|
109 |
const TDesC8& TTlvBase::End()
|
|
110 |
{
|
|
111 |
OstTrace0( TRACE_DETAILED, TTLVBASE_END, "TTlvBase::End" );
|
|
112 |
TFLOGSTRING("TSY: TTlvBase::End");
|
|
113 |
|
|
114 |
_LIT8( KLenTag, "\x81" );
|
|
115 |
|
|
116 |
TInt i( 3 ); // index to tag length
|
|
117 |
|
|
118 |
// scan through all lenghts and insert 'length tag'
|
|
119 |
while ( i < iData.Length() )
|
|
120 |
{
|
|
121 |
if ( KMaxOneByteLength < iData[i] )
|
|
122 |
{
|
|
123 |
iData.Insert( i, KLenTag );
|
|
124 |
i++;
|
|
125 |
}
|
|
126 |
i += iData[i] + 2; // jump to next tag length
|
|
127 |
}
|
|
128 |
|
|
129 |
// calculate total ber-tlv length
|
|
130 |
iData[1] = TUint8( iData.Length() - 2 );
|
|
131 |
// insert 'length tag'
|
|
132 |
if ( KMaxOneByteLength < iData[1] )
|
|
133 |
{
|
|
134 |
iData.Insert( 1, KLenTag );
|
|
135 |
}
|
|
136 |
|
|
137 |
// done, return ber-tlv
|
|
138 |
return iData;
|
|
139 |
}
|
|
140 |
|
|
141 |
// -----------------------------------------------------------------------------
|
|
142 |
// TTlvBase::GetDataWithoutTopLevelTag
|
|
143 |
// End TLV construction. Adds extra length byte to all simpleV.
|
|
144 |
// TLVs that are longer than KMaxOneByteLength (0x7f) and
|
|
145 |
// returns descriptor to the valid tlvs. To be used without
|
|
146 |
// Begin(), nor End() in situations where TLV simple tags are
|
|
147 |
// used without top level tag.
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
const TDesC8& TTlvBase::GetDataWithoutTopLevelTag()
|
|
151 |
{
|
|
152 |
OstTrace0( TRACE_DETAILED, TTLVBASE_GETDATAWITHOUTTOPLEVELTAG, "TTlvBase::GetDataWithoutTopLevelTag" );
|
|
153 |
TFLOGSTRING("TSY: TTlvBase::GetDataWithoutTopLevelTag");
|
|
154 |
|
|
155 |
_LIT8( KLenTag, "\x81" );
|
|
156 |
|
|
157 |
TInt i( 1 ); // index to tag length
|
|
158 |
|
|
159 |
// scan through all lenghts and insert 'length tag'
|
|
160 |
while ( i < iData.Length() )
|
|
161 |
{
|
|
162 |
if ( KMaxOneByteLength < iData[i] )
|
|
163 |
{
|
|
164 |
iData.Insert( i, KLenTag );
|
|
165 |
i++;
|
|
166 |
}
|
|
167 |
i += iData[i] + 2; // jump to next tag length
|
|
168 |
}
|
|
169 |
|
|
170 |
// done, return ber-tlv
|
|
171 |
return iData;
|
|
172 |
|
|
173 |
}
|
|
174 |
|
|
175 |
// -----------------------------------------------------------------------------
|
|
176 |
// CBerTlv::CBerTlv
|
|
177 |
// C++ default constructor can NOT contain any code, that
|
|
178 |
// might leave.
|
|
179 |
// -----------------------------------------------------------------------------
|
|
180 |
//
|
|
181 |
CBerTlv::CBerTlv()
|
|
182 |
{
|
|
183 |
OstTrace0( TRACE_DETAILED, CBERTLV_CBERTLV, "CBerTlv::CBerTlv" );
|
|
184 |
TFLOGSTRING("TSY: CBerTlv::CBerTlv");
|
|
185 |
//none
|
|
186 |
}
|
|
187 |
|
|
188 |
// -----------------------------------------------------------------------------
|
|
189 |
// CBerTlv::TlvByTagValue
|
|
190 |
// Find TLV by tag value. aTlv is set to point to found TLV.
|
|
191 |
// If there are more than one TLV with the same tag then
|
|
192 |
// itemNbr can be used to select which one is returned.
|
|
193 |
// If no tags are found return KErrNotFound else KErrNone.
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
//
|
|
196 |
TInt CBerTlv::TlvByTagValue
|
|
197 |
(
|
|
198 |
CTlv* aTlv, //TLV
|
|
199 |
TUint8 aTlvTagValue, //TLV identifier
|
|
200 |
TInt aItemNbr //item number
|
|
201 |
)
|
|
202 |
{
|
|
203 |
OstTrace0( TRACE_DETAILED, CBERTLV_TLVBYTAGVALUE, "CBerTlv::TlvByTagValue" );
|
|
204 |
TFLOGSTRING("TSY: CBerTlv::TlvByTagValue");
|
|
205 |
TInt currentTlv( 0 );
|
|
206 |
TInt tlvLength( 0 );
|
|
207 |
TInt index( 0 );
|
|
208 |
|
|
209 |
//tlv start index
|
|
210 |
TInt ind( KCommonTlvHeaderLength );
|
|
211 |
TUint8 berTlvLength( 0 );
|
|
212 |
if ( KTwoByteLengthCoding == iData[KTlvLengthStartPosition] )
|
|
213 |
{
|
|
214 |
berTlvLength = iData[KTlvLengthStartPosition + 1];
|
|
215 |
ind = ind + 1;
|
|
216 |
}
|
|
217 |
else
|
|
218 |
{
|
|
219 |
berTlvLength = iData[KTlvLengthStartPosition];
|
|
220 |
}
|
|
221 |
|
|
222 |
for ( TInt i = 0; i < berTlvLength; i += tlvLength )
|
|
223 |
{
|
|
224 |
//first determine if the length of the TLV is coded with 1 or 2 bytes.
|
|
225 |
if ( KTwoByteLengthCoding == iData[ind + 1] )
|
|
226 |
{
|
|
227 |
//length is coded with 2 bytes -> 1 extra byte required to be
|
|
228 |
//added to total length. Also TLV header bytes (2) must be added
|
|
229 |
//to total length
|
|
230 |
tlvLength = iData[ind + 2] + KTlvHeaderLength + 1;
|
|
231 |
|
|
232 |
}
|
|
233 |
else
|
|
234 |
{
|
|
235 |
//TLV header bytes (2) must be added to total length
|
|
236 |
tlvLength = iData[ind + 1] + KTlvHeaderLength;
|
|
237 |
}
|
|
238 |
|
|
239 |
currentTlv = iData[ind]&KTagValueMask;
|
|
240 |
|
|
241 |
//check if TLV in current index is the one that we are searching for
|
|
242 |
if ( aTlvTagValue == currentTlv )
|
|
243 |
{
|
|
244 |
if( index == aItemNbr )
|
|
245 |
{
|
|
246 |
// check that len of tlv object to be search doesn't
|
|
247 |
// go outside BER-TLV object
|
|
248 |
if ( ( ind + tlvLength ) <= GetSize() )
|
|
249 |
{
|
|
250 |
// len of tlv object to be search is inside
|
|
251 |
// len of BER-TLV object
|
|
252 |
TPtrC8 data( iData.Mid( ind , tlvLength ) );
|
|
253 |
aTlv->SetData( data );
|
|
254 |
return KErrNone;
|
|
255 |
}
|
|
256 |
else
|
|
257 |
{
|
|
258 |
// len of tlv object to be search goes
|
|
259 |
// over len of BER-TLV object, let's return
|
|
260 |
// error value.
|
|
261 |
return KErrNotFound;
|
|
262 |
}
|
|
263 |
}
|
|
264 |
else
|
|
265 |
{
|
|
266 |
index++;
|
|
267 |
}
|
|
268 |
}
|
|
269 |
ind += tlvLength;
|
|
270 |
|
|
271 |
}
|
|
272 |
|
|
273 |
return KErrNotFound;
|
|
274 |
|
|
275 |
}
|
|
276 |
|
|
277 |
// -----------------------------------------------------------------------------
|
|
278 |
// CBerTlv::TlvByTagValueMulti
|
|
279 |
// Find several TLVs by tag value. It is assumed that TLVs are
|
|
280 |
// sequential. aTlv is set to point to TLV sequence.
|
|
281 |
// If no tags are found return KErrNotFound else KErrNone.
|
|
282 |
// -----------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
TInt CBerTlv::TlvByTagValueMulti
|
|
285 |
(
|
|
286 |
CTlv* aTlv, //TLV to fill
|
|
287 |
TUint8 aTlvTagValue // tag of tlv to find
|
|
288 |
)
|
|
289 |
{
|
|
290 |
OstTrace0( TRACE_DETAILED, CBERTLV_TLVBYTAGVALUEMULTI, "CBerTlv::TlvByTagValueMulti" );
|
|
291 |
TFLOGSTRING("TSY: CBerTlv::TlvByTagValueMulti");
|
|
292 |
|
|
293 |
TInt currentTlv( 0 );
|
|
294 |
TInt16 tlvLength( 0 );
|
|
295 |
TInt indMulti( 0 );
|
|
296 |
TInt16 multiLength( 0 );
|
|
297 |
//tlv start index
|
|
298 |
TInt ind( KCommonTlvHeaderLength );
|
|
299 |
TUint8 berTlvLength;
|
|
300 |
//first determine if the length of the BerTLV is coded with 1 or 2 bytes.
|
|
301 |
if ( KTwoByteLengthCoding == iData[KTlvLengthStartPosition] )
|
|
302 |
{
|
|
303 |
berTlvLength = iData[KTlvLengthStartPosition + 1];
|
|
304 |
ind = ind + 1;
|
|
305 |
}
|
|
306 |
else
|
|
307 |
{
|
|
308 |
berTlvLength = iData[KTlvLengthStartPosition];
|
|
309 |
}
|
|
310 |
|
|
311 |
for ( TInt i = 0; i < berTlvLength; i+= tlvLength)
|
|
312 |
{
|
|
313 |
//first determine if the length of the TLV is coded with 1 or 2 bytes.
|
|
314 |
if ( KTwoByteLengthCoding == iData[ind + 1] )
|
|
315 |
{
|
|
316 |
//length is coded with 2 bytes -> real length is in second byte.
|
|
317 |
// first byte is 81 and it is tag for 2 byte length coding.
|
|
318 |
tlvLength = (TInt16) ( iData[ind + 0x02] + KTlvHeaderLength + 1 );
|
|
319 |
}
|
|
320 |
else
|
|
321 |
{
|
|
322 |
//TLV header bytes (2) must be added to total length
|
|
323 |
tlvLength = (TInt16) ( iData[ind + 1] + KTlvHeaderLength );
|
|
324 |
}
|
|
325 |
|
|
326 |
currentTlv = iData[ind]&KTagValueMask;
|
|
327 |
|
|
328 |
//check if TLV in current index is the one that we are searching for
|
|
329 |
if ( ( aTlvTagValue == currentTlv ) && ( multiLength == 0x00 ) )
|
|
330 |
{
|
|
331 |
// save fist tag position
|
|
332 |
indMulti = ind;
|
|
333 |
multiLength = tlvLength;
|
|
334 |
|
|
335 |
}
|
|
336 |
// add length
|
|
337 |
if ( ( aTlvTagValue == currentTlv ) && ( indMulti != ind ) )
|
|
338 |
{
|
|
339 |
multiLength = (TInt16) ( multiLength + tlvLength );
|
|
340 |
}
|
|
341 |
|
|
342 |
// if last tag, return
|
|
343 |
if ( (i + tlvLength) >= berTlvLength )
|
|
344 |
{
|
|
345 |
TPtrC8 data = ( iData.Mid( indMulti , multiLength ) );
|
|
346 |
aTlv->SetData( data );
|
|
347 |
return KErrNone;
|
|
348 |
}
|
|
349 |
ind += tlvLength;
|
|
350 |
|
|
351 |
}
|
|
352 |
|
|
353 |
return KErrNotFound;
|
|
354 |
|
|
355 |
}
|
|
356 |
|
|
357 |
|
|
358 |
// -----------------------------------------------------------------------------
|
|
359 |
// CTlv::CTlv
|
|
360 |
// C++ default constructor can NOT contain any code, that
|
|
361 |
// might leave.
|
|
362 |
// -----------------------------------------------------------------------------
|
|
363 |
//
|
|
364 |
CTlv::CTlv()
|
|
365 |
{
|
|
366 |
OstTrace0( TRACE_DETAILED, CTLV_CTLV, "CTlv::CTlv" );
|
|
367 |
TFLOGSTRING("TSY: CTlv::CTlv");
|
|
368 |
//none
|
|
369 |
}
|
|
370 |
|
|
371 |
// -----------------------------------------------------------------------------
|
|
372 |
// CTlv::GetShortInfo
|
|
373 |
// Returns the short info (one byte).
|
|
374 |
// Returned data depends on data type.
|
|
375 |
// -----------------------------------------------------------------------------
|
|
376 |
//
|
|
377 |
TUint8 CTlv::GetShortInfo
|
|
378 |
(
|
|
379 |
TTlvSpesificDataType aType //Info spesific data type
|
|
380 |
)
|
|
381 |
{
|
|
382 |
OstTrace0( TRACE_DETAILED, CTLV_GETSHORTINFO, "CTlv::GetShortInfo" );
|
|
383 |
TFLOGSTRING("TSY: CTlv::GetShortInfo");
|
|
384 |
|
|
385 |
//information is generally at index 2. NOTE! This method should be optimised
|
|
386 |
//after the code maturity is high enough.
|
|
387 |
TInt ind ( KTlvDataAreaStartPosition );
|
|
388 |
TUint8 offset( 0 );
|
|
389 |
|
|
390 |
//first determine if the length of the TLV is coded with 1 or 2 bytes to
|
|
391 |
//determine the offset
|
|
392 |
if ( KTwoByteLengthCoding == iData[KTlvLengthStartPosition] )
|
|
393 |
{
|
|
394 |
offset = 1;
|
|
395 |
}
|
|
396 |
|
|
397 |
//Start getting the contents of TLV data
|
|
398 |
if ( ETLV_TonAndNpi == aType )
|
|
399 |
{
|
|
400 |
//TON/NPI is coded as for EFADN.
|
|
401 |
ind = KTlvDataAreaStartPosition + offset;
|
|
402 |
}
|
|
403 |
else if ( ETLV_CommandNumber == aType )
|
|
404 |
{
|
|
405 |
//Command number
|
|
406 |
//
|
|
407 |
//For contents and coding, see subclause 6.5.1.
|
|
408 |
ind = KTlvDataAreaStartPosition + offset;
|
|
409 |
}
|
|
410 |
else if ( ETLV_TypeOfCommand == aType )
|
|
411 |
{
|
|
412 |
//Type of command:
|
|
413 |
//
|
|
414 |
//Contents:
|
|
415 |
// The Type of Command specifies the required interpretation of the
|
|
416 |
// data objects which follow, and the required ME procedure.
|
|
417 |
//
|
|
418 |
//Coding:
|
|
419 |
// See section 13.4
|
|
420 |
// The ME shall respond to reserved values (i.e. values not listed)
|
|
421 |
// with the result "Command type not understood".
|
|
422 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
423 |
}
|
|
424 |
else if ( ETLV_CommandQualifier == aType )
|
|
425 |
{
|
|
426 |
//Command Qualifier:
|
|
427 |
//
|
|
428 |
//Contents:
|
|
429 |
// Qualifiers specific to the command. See 3GPP TS 11.14 V8.8.0,
|
|
430 |
// chapter 12.6 Command details for more details.
|
|
431 |
ind = KTlvDataAreaStartPosition + offset + 2;
|
|
432 |
}
|
|
433 |
else if ( ETLV_SourceDeviceIdentity == aType )
|
|
434 |
{
|
|
435 |
//Source device identity
|
|
436 |
//
|
|
437 |
//Contents:
|
|
438 |
// the source device for information held in the data objects which
|
|
439 |
// follow.
|
|
440 |
//
|
|
441 |
//Coding:
|
|
442 |
// both Source and Destination device identities are coded as follows:
|
|
443 |
// '01' = Keypad
|
|
444 |
// '02' = Display
|
|
445 |
// '03' = Earpiece
|
|
446 |
// '10' to '17' = Additional Card Reader x (0 to 7). Value assigned
|
|
447 |
// by ME.
|
|
448 |
// '21' to '27' = Channel x (1 to 7). Value assigned by ME (if class
|
|
449 |
// "e" is supported).
|
|
450 |
// '81' = SIM
|
|
451 |
// '82' = ME
|
|
452 |
// '83' = Network
|
|
453 |
// All other values are reserved.
|
|
454 |
ind = KTlvDataAreaStartPosition;
|
|
455 |
}
|
|
456 |
else if ( ETLV_DestinationDeviceIdentity == aType )
|
|
457 |
{
|
|
458 |
//Destination device identity
|
|
459 |
//
|
|
460 |
//Contents:
|
|
461 |
// the destination device for information held in the data objects
|
|
462 |
// which follow.
|
|
463 |
//
|
|
464 |
// NOTE: Only some combinations of Type of Command, Data Download type
|
|
465 |
// and Device identities are allowed defined in clause 14.
|
|
466 |
//
|
|
467 |
//Coding:
|
|
468 |
// both Source and Destination device identities are coded as follows:
|
|
469 |
// '01' = Keypad
|
|
470 |
// '02' = Display
|
|
471 |
// '03' = Earpiece
|
|
472 |
// '10' to '17' = Additional Card Reader x (0 to 7). Value assigned
|
|
473 |
// by ME.
|
|
474 |
// '21' to '27' = Channel x (1 to 7). Value assigned by ME (if class
|
|
475 |
// "e" is supported).
|
|
476 |
// '81' = SIM
|
|
477 |
// '82' = ME
|
|
478 |
// '83' = Network
|
|
479 |
// All other values are reserved.
|
|
480 |
ind = KTlvDataAreaStartPosition + 1;
|
|
481 |
}
|
|
482 |
else if ( ETLV_TimeUnit == aType )
|
|
483 |
{
|
|
484 |
//Time unit
|
|
485 |
//
|
|
486 |
//Contents:
|
|
487 |
// time unit used; minutes, seconds or tenths of seconds.
|
|
488 |
//
|
|
489 |
//Coding:
|
|
490 |
// '00' Minutes
|
|
491 |
// '01' Seconds
|
|
492 |
// '02' Tenths of seconds
|
|
493 |
// All other values are reserved.
|
|
494 |
ind = KTlvDataAreaStartPosition;
|
|
495 |
}
|
|
496 |
else if ( ETLV_TimeInteval == aType )
|
|
497 |
{
|
|
498 |
//Time interval
|
|
499 |
//
|
|
500 |
//Contents:
|
|
501 |
// the length of time required, expressed in units.
|
|
502 |
//
|
|
503 |
//Coding:
|
|
504 |
// The time interval is coded in integer multiples of the time unit
|
|
505 |
// used. The range is from 1 unit to 255 units. The encoding is:
|
|
506 |
// '00': reserved
|
|
507 |
// '01': 1 unit
|
|
508 |
// '02': 2 units
|
|
509 |
// : : :
|
|
510 |
// 'FF': 255 units
|
|
511 |
ind = KTlvDataAreaStartPosition + 1;
|
|
512 |
}
|
|
513 |
else if ( ETLV_IdentifierOfItem == aType )
|
|
514 |
{
|
|
515 |
//The identifier is a single byte between '01' and 'FF'. Each item
|
|
516 |
//shall have a unique identifier within an Item list.
|
|
517 |
ind = KTlvDataAreaStartPosition + offset;
|
|
518 |
}
|
|
519 |
else if ( ETLV_IdentifierOfItemChosen == aType )
|
|
520 |
{
|
|
521 |
//The identifier is a single byte between '01' and 'FF', exactly the
|
|
522 |
//same as for the Item data object. A null item identifier is
|
|
523 |
//coded '00'.
|
|
524 |
ind = KTlvDataAreaStartPosition;
|
|
525 |
}
|
|
526 |
else if ( ETLV_MinimumLengthOfResponse == aType )
|
|
527 |
{
|
|
528 |
//The range of length is between '00' and 'FF'. A minimum length coding
|
|
529 |
//of '00' indicates that there is no minimum length requirement; a
|
|
530 |
//maximum length coding of 'FF' indicates that there is no maximum
|
|
531 |
//length requirement. If a fixed length is required the minimum and
|
|
532 |
//maximum values are identical.
|
|
533 |
ind = KTlvDataAreaStartPosition;
|
|
534 |
}
|
|
535 |
else if ( ETLV_MaximumLengthOfResponse == aType )
|
|
536 |
{
|
|
537 |
//The range of length is between '00' and 'FF'. A minimum length coding
|
|
538 |
//of '00' indicates that there is no minimum length requirement; a
|
|
539 |
//maximum length coding of 'FF' indicates that there is no maximum
|
|
540 |
//length requirement. If a fixed length is required the minimum and
|
|
541 |
//maximum values are identical.
|
|
542 |
ind = KTlvDataAreaStartPosition + 1;
|
|
543 |
}
|
|
544 |
else if ( ETLV_GeneralResult == aType )
|
|
545 |
{
|
|
546 |
//General result
|
|
547 |
//
|
|
548 |
//Contents:
|
|
549 |
// General result specifies the result and indicates appropriate SIM
|
|
550 |
// action. See 3GPP TS 11.14 V8.8.0, chapter 12.12 Result for more
|
|
551 |
// details.
|
|
552 |
ind = KTlvDataAreaStartPosition + offset;
|
|
553 |
}
|
|
554 |
else if ( ETLV_DataCodingScheme == aType )
|
|
555 |
{
|
|
556 |
//Data coding scheme is coded as for SMS Data coding scheme defined
|
|
557 |
//in TS 23.038 [5].
|
|
558 |
ind = KTlvDataAreaStartPosition + offset;
|
|
559 |
}
|
|
560 |
else if ( ETLV_Tone == aType )
|
|
561 |
{
|
|
562 |
//Tone
|
|
563 |
//
|
|
564 |
//Contents:
|
|
565 |
// Tones can be either the standard supervisory tone, as defined in TS
|
|
566 |
//02.40 [18], or proprietary tones defined by the ME manufacturer. The
|
|
567 |
//code values for proprietary tones shall be supported by the ME. If
|
|
568 |
//proprietary tones are not supported the ME shall map these codings to
|
|
569 |
//tones that it can generate. The tones to be used are left as an
|
|
570 |
//implementation decision by the manufacturer.
|
|
571 |
//
|
|
572 |
//Coding:
|
|
573 |
// Standard supervisory tones:
|
|
574 |
// '01' Dial tone
|
|
575 |
// '02' Called subscriber busy
|
|
576 |
// '03' Congestion
|
|
577 |
// '04' Radio path acknowledge
|
|
578 |
// '05' Radio path not available / Call dropped
|
|
579 |
// '06' Error / Special information
|
|
580 |
// '07' Call waiting tone
|
|
581 |
// '08' Ringing tone
|
|
582 |
// ME proprietary tones:
|
|
583 |
// '10' General beep
|
|
584 |
// '11' Positive acknowledgement tone
|
|
585 |
// '12' Negative acknowledgement or error tone
|
|
586 |
// All other values are reserved.
|
|
587 |
ind = KTlvDataAreaStartPosition;
|
|
588 |
}
|
|
589 |
else if ( ETLV_NumberOfFiles == aType )
|
|
590 |
{
|
|
591 |
//Number of files:
|
|
592 |
//This is the number of files that will be described in the following
|
|
593 |
//list.
|
|
594 |
ind = KTlvDataAreaStartPosition + offset;
|
|
595 |
}
|
|
596 |
else if ( ETLV_LocationStatus == aType )
|
|
597 |
{
|
|
598 |
//Location status
|
|
599 |
//
|
|
600 |
//Contents:
|
|
601 |
// this data object indicates the current service state
|
|
602 |
// of the MS.
|
|
603 |
// - "Normal service" shall indicate that the MS is in a state
|
|
604 |
// where all requests for services are treated normally.
|
|
605 |
// - "Limited service" shall indicate that the MS is in a state
|
|
606 |
// where only emergency call services are offered.
|
|
607 |
// - "No service" shall indicate that the MS is in a state
|
|
608 |
// where no services are offered.
|
|
609 |
//
|
|
610 |
//Coding:
|
|
611 |
// Each byte in the event list shall be coded with one of
|
|
612 |
// the values below:
|
|
613 |
// - '00' = Normal service
|
|
614 |
// - '01' = Limited service
|
|
615 |
// - '02' = No service
|
|
616 |
ind = KTlvDataAreaStartPosition;
|
|
617 |
}
|
|
618 |
else if ( ETLV_IconQualifier == aType )
|
|
619 |
{
|
|
620 |
//Icon qualifier:
|
|
621 |
//Contents: The icon qualifier indicates to the ME how the icon is
|
|
622 |
//to be used.
|
|
623 |
//Coding:
|
|
624 |
//bit 1: 0 = icon is self-explanatory, i.e. if displayed, it
|
|
625 |
// replaces the alpha identifier or text string
|
|
626 |
// 1 = icon is not self-explanatory, i.e. if
|
|
627 |
// displayed, it shall be displayed together with
|
|
628 |
// the alpha identifier or text string
|
|
629 |
//bits 2?8 = 0 RFU.
|
|
630 |
ind = KTlvDataAreaStartPosition;
|
|
631 |
}
|
|
632 |
else if ( ETLV_IconIdentifier == aType )
|
|
633 |
{
|
|
634 |
//Icon identifier:
|
|
635 |
//Contents: The icon identifier addresses a record in EFIMG as
|
|
636 |
//defined in TS 11.11 [20].
|
|
637 |
//Coding: Binary.
|
|
638 |
ind = KTlvDataAreaStartPosition + 1;
|
|
639 |
}
|
|
640 |
else if ( ETLV_IconListQualifier == aType )
|
|
641 |
{
|
|
642 |
//Icon list qualifier:
|
|
643 |
//Contents: The icon list qualifier indicates to the ME how the
|
|
644 |
//icons are to be used.
|
|
645 |
//Coding:
|
|
646 |
//bit 1: 0 = icon is self-explanatory, i.e. if displayed, it
|
|
647 |
// replaces the item text
|
|
648 |
// 1 = icon is not self-explanatory, i.e. if displayed,
|
|
649 |
// it shall be displayed together with the item text
|
|
650 |
// bits 2?8 = 0 RFU.
|
|
651 |
|
|
652 |
//All icons in the list shall be treated in the same manner by the
|
|
653 |
//ME, i.e. either none of the icons in this list are displayed, or
|
|
654 |
//for each item its related icon is displayed.
|
|
655 |
ind = KTlvDataAreaStartPosition;
|
|
656 |
}
|
|
657 |
else if ( ETLV_CardReaderStatus == aType )
|
|
658 |
{
|
|
659 |
//Card reader status:
|
|
660 |
//Contents :
|
|
661 |
//This contains the identity of the card reader, and flags to
|
|
662 |
//indicate the status of the reader with respect to:
|
|
663 |
//- whether the card reader is removable or permanently connected;
|
|
664 |
//- whether the card reader is present (this can only be false if
|
|
665 |
// the card reader is removable)
|
|
666 |
//- whether the card reader present accepts ID-1 size cards (this
|
|
667 |
// can only be true if the card reader is present)
|
|
668 |
//- whether there is a card present in the card reader (this can
|
|
669 |
// only be true if the card reader is present)
|
|
670 |
//- whether power is being applied to the card (this can only be true if a card is present).
|
|
671 |
|
|
672 |
//Coding :
|
|
673 |
//The value of this byte indicates the identity and status of a
|
|
674 |
//card reader.
|
|
675 |
// bits 1-3 = identity of card reader x.
|
|
676 |
// bit 4 0 = Card reader is not removable
|
|
677 |
// 1 = Card reader is removable
|
|
678 |
// bit 5 0 = Card reader is not present
|
|
679 |
// 1 = Card reader is present
|
|
680 |
// bit 6 0 = Card reader present is not ID-1 size
|
|
681 |
// 1 = Card reader present is ID-1 size
|
|
682 |
// bit 7 0 = No card present
|
|
683 |
// 1 = Card is present in reader
|
|
684 |
// bit 8 0 = No card power ON
|
|
685 |
// 1 = Card in reader is power ON
|
|
686 |
ind = KTlvDataAreaStartPosition;
|
|
687 |
}
|
|
688 |
else if ( ETLV_CommandClassCLA == aType )
|
|
689 |
{
|
|
690 |
//This object contains the command APDU for Card x in the format
|
|
691 |
//defined in ISO/IEC 7816?4 [25]. Command class CLA, instruction
|
|
692 |
//code INS, P1 and P2 parameters, Lc, Data and Le are coded as
|
|
693 |
//defined in ISO/IEC 7816?4 [25]. Extended lengths are not
|
|
694 |
//supported.
|
|
695 |
//Note: The maximum size of the value part of this Simple TLV
|
|
696 |
//(value of X) is limited to 241 bytes, so the maximum length for
|
|
697 |
//the Data (value of Lc) in a Case 3 type of APDU is 236 bytes.
|
|
698 |
ind = KTlvDataAreaStartPosition + offset;
|
|
699 |
}
|
|
700 |
else if ( ETLV_CommandInstructionCodeIns == aType )
|
|
701 |
{
|
|
702 |
//This object contains the command APDU for Card x in the format
|
|
703 |
//defined in ISO/IEC 7816?4 [25]. Command class CLA, instruction
|
|
704 |
//code INS, P1 and P2 parameters, Lc, Data and Le are coded as
|
|
705 |
//defined in ISO/IEC 7816?4 [25]. Extended lengths are not
|
|
706 |
//supported.
|
|
707 |
//Note: The maximum size of the value part of this Simple TLV
|
|
708 |
//(value of X) is limited to 241 bytes, so the maximum length for
|
|
709 |
//the Data (value of Lc) in a Case 3 type of APDU is 236 bytes.
|
|
710 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
711 |
}
|
|
712 |
else if ( ETLV_P1Parameter == aType )
|
|
713 |
{
|
|
714 |
//This object contains the command APDU for Card x in the format
|
|
715 |
//defined in ISO/IEC 7816?4 [25]. Command class CLA, instruction
|
|
716 |
//code INS, P1 and P2 parameters, Lc, Data and Le are coded as
|
|
717 |
//defined in ISO/IEC 7816?4 [25]. Extended lengths are not
|
|
718 |
//supported.
|
|
719 |
//Note: The maximum size of the value part of this Simple TLV
|
|
720 |
//(value of X) is limited to 241 bytes, so the maximum length for
|
|
721 |
//the Data (value of Lc) in a Case 3 type of APDU is 236 bytes.
|
|
722 |
ind = KTlvDataAreaStartPosition + offset + 2;
|
|
723 |
}
|
|
724 |
else if ( ETLV_P2Parameter == aType )
|
|
725 |
{
|
|
726 |
//This object contains the command APDU for Card x in the format
|
|
727 |
//defined in ISO/IEC 7816?4 [25]. Command class CLA, instruction
|
|
728 |
//code INS, P1 and P2 parameters, Lc, Data and Le are coded as
|
|
729 |
//defined in ISO/IEC 7816?4 [25]. Extended lengths are not
|
|
730 |
//supported.
|
|
731 |
//Note: The maximum size of the value part of this Simple TLV
|
|
732 |
//(value of X) is limited to 241 bytes, so the maximum length for
|
|
733 |
//the Data (value of Lc) in a Case 3 type of APDU is 236 bytes.
|
|
734 |
ind = KTlvDataAreaStartPosition + offset + 3;
|
|
735 |
}
|
|
736 |
else if ( ETLV_Lc == aType )
|
|
737 |
{
|
|
738 |
//This object contains the command APDU for Card x in the format
|
|
739 |
//defined in ISO/IEC 7816?4 [25]. Command class CLA, instruction
|
|
740 |
//code INS, P1 and P2 parameters, Lc, Data and Le are coded as
|
|
741 |
//defined in ISO/IEC 7816?4 [25]. Extended lengths are not
|
|
742 |
//supported.
|
|
743 |
//Note: The maximum size of the value part of this Simple TLV
|
|
744 |
//(value of X) is limited to 241 bytes, so the maximum length for
|
|
745 |
//the Data (value of Lc) in a Case 3 type of APDU is 236 bytes.
|
|
746 |
if ( KCApduLengthWithoutLc < GetLongInfo( ETLV_Lc ) )
|
|
747 |
{
|
|
748 |
ind = KTlvDataAreaStartPosition + offset + 4;
|
|
749 |
}
|
|
750 |
else
|
|
751 |
{
|
|
752 |
return 0;
|
|
753 |
}
|
|
754 |
}
|
|
755 |
else if ( ETLV_Le == aType )
|
|
756 |
{
|
|
757 |
//This object contains the command APDU for Card x in the format
|
|
758 |
//defined in ISO/IEC 7816?4 [25]. Command class CLA, instruction
|
|
759 |
//code INS, P1 and P2 parameters, Lc, Data and Le are coded as
|
|
760 |
//defined in ISO/IEC 7816?4 [25]. Extended lengths are not
|
|
761 |
//supported.
|
|
762 |
//Note: The maximum size of the value part of this Simple TLV
|
|
763 |
//(value of X) is limited to 241 bytes, so the maximum length for
|
|
764 |
//the Data (value of Lc) in a Case 3 type of APDU is 236 bytes.
|
|
765 |
ind = KTlvDataAreaStartPosition + offset + 5 + GetShortInfo( ETLV_Lc );
|
|
766 |
}
|
|
767 |
else if ( ETLV_StatusWordSW1 == aType )
|
|
768 |
{
|
|
769 |
//This object contains the response APDU from Card x in the format
|
|
770 |
//defined in ISO/IEC 7816?4 [25]. The R-APDU data and status words SW1
|
|
771 |
//and SW2 are coded as defined in ISO/IEC 7816?4 [25]. It is possible
|
|
772 |
//for no R-APDU data to be present; this is indicated by the length of
|
|
773 |
//the data object.
|
|
774 |
//Note: The maximum size of the value part of this Simple TLV (value of
|
|
775 |
//X) is limited to 239 bytes, so the maximum length of the R-APDU data
|
|
776 |
//is 237 bytes.
|
|
777 |
ind = KTlvDataAreaStartPosition + offset
|
|
778 |
+ GetLength() - 2 + 1;
|
|
779 |
}
|
|
780 |
else if ( ETLV_StatusWordSW2 == aType )
|
|
781 |
{
|
|
782 |
//This object contains the response APDU from Card x in the format
|
|
783 |
//defined in ISO/IEC 7816?4 [25]. The R-APDU data and status words SW1
|
|
784 |
//and SW2 are coded as defined in ISO/IEC 7816?4 [25]. It is possible
|
|
785 |
//for no R-APDU data to be present; this is indicated by the length of
|
|
786 |
//the data object.
|
|
787 |
//Note: The maximum size of the value part of this Simple TLV (value of
|
|
788 |
//X) is limited to 239 bytes, so the maximum length of the R-APDU data
|
|
789 |
//is 237 bytes.
|
|
790 |
ind = KTlvDataAreaStartPosition + offset
|
|
791 |
+ GetLength() - 2 + 2;
|
|
792 |
}
|
|
793 |
else if ( ETLV_TimerIdentifier == aType )
|
|
794 |
{
|
|
795 |
//Timer identifier:
|
|
796 |
//Contents: identifier of a timer
|
|
797 |
//Coding:
|
|
798 |
//'01' Timer 1
|
|
799 |
//'02' Timer 2
|
|
800 |
//'03' Timer 3
|
|
801 |
//'04' Timer 4
|
|
802 |
//'05' Timer 5
|
|
803 |
//'06' Timer 6
|
|
804 |
//'07' Timer 7
|
|
805 |
//'08' Timer 8
|
|
806 |
//All other values are reserved
|
|
807 |
ind = KTlvDataAreaStartPosition;
|
|
808 |
}
|
|
809 |
else if ( ETLV_BcRepeatIndicatorValues == aType )
|
|
810 |
{
|
|
811 |
//Contents : The BC repeat indicator is structured exactly as defined
|
|
812 |
//in TS 04.08 [08], which may be alternate mode or sequential mode.
|
|
813 |
//
|
|
814 |
//Coding : '01' = Alternate mode
|
|
815 |
// '03' = Sequential mode
|
|
816 |
ind = KTlvDataAreaStartPosition;
|
|
817 |
}
|
|
818 |
else if ( ETLV_MeStatus == aType )
|
|
819 |
{
|
|
820 |
//Coding of ME status:
|
|
821 |
//'00' = ME is in the idle state
|
|
822 |
//'01' = ME is not in idle state
|
|
823 |
//'02' to'FF'= reserved values
|
|
824 |
ind = KTlvDataAreaStartPosition;
|
|
825 |
}
|
|
826 |
else if ( ETLV_TimingAdvance == aType )
|
|
827 |
{
|
|
828 |
//The Timing Advance is coded as for the Timing Advance information
|
|
829 |
//element in TS 04.08 [8], starting at octet 2 (the IEI is removed, as
|
|
830 |
//this information is duplicated by the data object tag).
|
|
831 |
ind = KTlvDataAreaStartPosition + 1;
|
|
832 |
}
|
|
833 |
else if ( ETLV_BrowserIdentity == aType )
|
|
834 |
{
|
|
835 |
//Coding :
|
|
836 |
//00 = Default Browser shall be used.
|
|
837 |
//Other values are RFU.
|
|
838 |
ind = KTlvDataAreaStartPosition;
|
|
839 |
}
|
|
840 |
else if ( ETLV_BrowserTerminationCause == aType )
|
|
841 |
{
|
|
842 |
//Coding:
|
|
843 |
//00 = User Termination.
|
|
844 |
//01 = Error Termination.
|
|
845 |
ind = KTlvDataAreaStartPosition;
|
|
846 |
}
|
|
847 |
else if ( ETLV_BearerType == aType )
|
|
848 |
{
|
|
849 |
//Bearer Type coding
|
|
850 |
//'0x00': Bearer type not set
|
|
851 |
//'0x01': CSD
|
|
852 |
//'0x02': GPRS
|
|
853 |
//'0x03': Default bearer for requested transport layer.
|
|
854 |
//'0x04': Local link technology independent
|
|
855 |
//'0x05': Bluetooth
|
|
856 |
//'0x06': IrDA
|
|
857 |
//'0x07': RS232
|
|
858 |
//'0x10': USB
|
|
859 |
ind = KTlvDataAreaStartPosition;
|
|
860 |
}
|
|
861 |
else if ( ETLV_ChannelDataLength == aType )
|
|
862 |
{
|
|
863 |
//The Channel data length codes :
|
|
864 |
//- either the number of bytes that are available in a channel buffer
|
|
865 |
// (Tx or Rx buffers negotiated during OPEN CHANNEL) using TERMINAL
|
|
866 |
// RESPONSE. Since the Tx or Rx buffer size can be larger than 255
|
|
867 |
// bytes, 'FF' means "more than 255 bytes are available".
|
|
868 |
//- or the number of bytes that are requested in a RECEIVE DATA command
|
|
869 |
ind = KTlvDataAreaStartPosition;
|
|
870 |
}
|
|
871 |
else if ( ETLV_TypeOfAddress == aType )
|
|
872 |
{
|
|
873 |
//A null Local address shall be coded with Length = '00', and no Value
|
|
874 |
//part. In that case, the ME shall request a dynamic address.
|
|
875 |
//
|
|
876 |
//Coding of Type of address: according to packet data protocol address
|
|
877 |
//in TS 04.08 [8].
|
|
878 |
//'21' = IPv4 address
|
|
879 |
//'97' = IPv6 address
|
|
880 |
//'others' = reserved
|
|
881 |
ind = KTlvDataAreaStartPosition;
|
|
882 |
}
|
|
883 |
else if ( ETLV_TransportProtocolType == aType )
|
|
884 |
{
|
|
885 |
//Transport protocol type coding:
|
|
886 |
//- '01' : UDP (as defined in RFC 768 [33])
|
|
887 |
//- '02' : TCP (as defined in RFC 793 [34])
|
|
888 |
//all other value are reserved
|
|
889 |
ind = KTlvDataAreaStartPosition;
|
|
890 |
}
|
|
891 |
else if ( ETLV_UtranMeasurementQualifier == aType )
|
|
892 |
{
|
|
893 |
// UTRAN Measurement Qualifier coding:
|
|
894 |
//'01' Intra-frequency measurements
|
|
895 |
//'02' Inter-frequency measurements
|
|
896 |
//'03' Inter-RAT (GSM) measurements
|
|
897 |
// All other values are reserved
|
|
898 |
ind = KTlvDataAreaStartPosition;
|
|
899 |
}
|
|
900 |
else if ( ETLV_RemoteEntityAddressCoding == aType )
|
|
901 |
{
|
|
902 |
// Remote Entity Address Coding Type:
|
|
903 |
// '00' IEEE-802 48-bit address
|
|
904 |
// '01' to 'FF' are reserved values
|
|
905 |
ind = KTlvDataAreaStartPosition;
|
|
906 |
}
|
|
907 |
else
|
|
908 |
{
|
|
909 |
// Data type did not match with any of enumerations
|
|
910 |
TFLOGSTRING2("TSY: CTlv::GetShortInfo, Unknown data type:0x%x", aType);
|
|
911 |
OstTrace1( TRACE_DETAILED, DUP1_CTLV_GETSHORTINFO, "CTlv::GetShortInfo Unknown data type: %{TTlvSpesificDataType}", aType );
|
|
912 |
|
|
913 |
}
|
|
914 |
|
|
915 |
return iData[ind];
|
|
916 |
|
|
917 |
}
|
|
918 |
|
|
919 |
// -----------------------------------------------------------------------------
|
|
920 |
// CTlv::GetData
|
|
921 |
// Returns the data. Returned data depends on data type.
|
|
922 |
// -----------------------------------------------------------------------------
|
|
923 |
//
|
|
924 |
TPtrC8 CTlv::GetData
|
|
925 |
(
|
|
926 |
TTlvSpesificDataType aType //Info spesific data type
|
|
927 |
)
|
|
928 |
{
|
|
929 |
OstTrace0( TRACE_DETAILED, CTLV_GETDATA, "CTlv::GetData" );
|
|
930 |
TFLOGSTRING("TSY: CTlv::GetData");
|
|
931 |
|
|
932 |
//information is generally at index 2.
|
|
933 |
TInt ind ( 2 );
|
|
934 |
TUint8 offset( 0 );
|
|
935 |
TInt length( 1 );
|
|
936 |
|
|
937 |
//first determine if the length of the TLV is coded with 1 or 2 bytes.
|
|
938 |
if ( KTwoByteLengthCoding == iData[KTlvLengthStartPosition] )
|
|
939 |
{
|
|
940 |
offset = 1;
|
|
941 |
}
|
|
942 |
|
|
943 |
//start getting TLV data elements
|
|
944 |
if ( ETLV_DiallingNumberString == aType )
|
|
945 |
{
|
|
946 |
ind = KTlvDataAreaStartPosition + 1 + offset;
|
|
947 |
//Dialling number string is coded as for EFADN, and may include
|
|
948 |
//DTMF separators and DTMF digits, which the ME shall send in the
|
|
949 |
//same way as for EFADN but without locally generating audible DTMF
|
|
950 |
//tones to the user.
|
|
951 |
//-----------------------------------------------------------
|
|
952 |
// Byte(s) | Description | Length |
|
|
953 |
//-----------------------------------------------------------
|
|
954 |
// 1 | Address tag | 1 |
|
|
955 |
// 2 to (Y-1)+2 | Length (X) | Y |
|
|
956 |
// (Y-1)+3 | TON and NPI | 1 |
|
|
957 |
// (Y-1)+4 to (Y-1)+X+2 | Dialling number string | X-1 |
|
|
958 |
//------------------------------------------------------------
|
|
959 |
length = GetLength() - 1;
|
|
960 |
}
|
|
961 |
else if ( ETLV_AlphaIdentifier == aType )
|
|
962 |
{
|
|
963 |
ind = KTlvDataAreaStartPosition + offset;
|
|
964 |
//The alpha identifier is coded as for EFADN. See TS 11.11 [20] for
|
|
965 |
//the coding of all EFs.
|
|
966 |
length = GetLength();
|
|
967 |
}
|
|
968 |
else if ( ETLV_SubAddress == aType )
|
|
969 |
{
|
|
970 |
ind = KTlvDataAreaStartPosition + offset;
|
|
971 |
//Subaddress contains information as defined for this purpose in
|
|
972 |
//TS 04.08 [8] (calling party subaddress or called party
|
|
973 |
//subaddress). All information defined in TS 04.08 shall be given
|
|
974 |
//in the value part of the data object, except the information
|
|
975 |
//element identifier and the length of subaddress contents (which
|
|
976 |
//is given by the length part of the data object).
|
|
977 |
length = GetLength();
|
|
978 |
}
|
|
979 |
else if ( ETLV_CapabilityConfigurationParameters == aType )
|
|
980 |
{
|
|
981 |
ind = KTlvDataAreaStartPosition + offset;
|
|
982 |
//Capability configuration parameters are coded as for EFCCP. If
|
|
983 |
//it is being provided by the SIM, the SIM shall supply all information
|
|
984 |
//required to complete the Bearer Capability Information Element in the
|
|
985 |
//Call Set-up message (see TS 04.08 [8]). Any unused bytes at the end
|
|
986 |
//of the value part shall be coded 'FF'. See TS 11.11 [20] for the
|
|
987 |
//coding of all EFs.
|
|
988 |
//
|
|
989 |
//NOTE: The second byte of this TLV contains the Length of the TLV and
|
|
990 |
//the third byte contains the Length of the bearer capability contents,
|
|
991 |
//followed by the actual contents.
|
|
992 |
|
|
993 |
length = GetLength();
|
|
994 |
}
|
|
995 |
else if ( ETLV_CellBroadcastPage == aType )
|
|
996 |
{
|
|
997 |
ind = KTlvDataAreaStartPosition;
|
|
998 |
//The Cell Broadcast page is formatted in the same way as described
|
|
999 |
//in TS 23.041 [7].
|
|
1000 |
length = GetLength();
|
|
1001 |
}
|
|
1002 |
else if ( ETLV_TextStringOfItem == aType )
|
|
1003 |
{
|
|
1004 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
1005 |
//The text string is coded in the same way as the alpha identifier
|
|
1006 |
//for EFADN. Any unused bytes at the end of the value part shall be
|
|
1007 |
//coded 'FF'.
|
|
1008 |
length = GetLength() - 1;
|
|
1009 |
}
|
|
1010 |
else if ( ETLV_AdditionalInformationOnResult == aType )
|
|
1011 |
{
|
|
1012 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
1013 |
//Contents: For the general result "Command performed successfully",
|
|
1014 |
//some proactive commands require additional information in the command
|
|
1015 |
//result. This is defined in the subclauses below. For the general
|
|
1016 |
//results '20', '21', '26', '34', '35', '37', '38' and '39' and '3A',
|
|
1017 |
//it is mandatory for the ME to provide a specific cause value as
|
|
1018 |
//additional information, as defined in the subclauses below. For the
|
|
1019 |
//other general results, the ME may optionally supply additional
|
|
1020 |
//information. If additional information is not supplied, then the
|
|
1021 |
//length of the value part of the data object need only contain the
|
|
1022 |
//general result.
|
|
1023 |
length = GetLength() - 1;
|
|
1024 |
}
|
|
1025 |
else if ( ETLV_SmsTPdu == aType )
|
|
1026 |
{
|
|
1027 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1028 |
//The TPDU is formatted as described in TS 23.040 [6]. Where the TPDU
|
|
1029 |
//is being sent from the SIM to the ME (to be forwarded to the
|
|
1030 |
//network), and where it includes a TP-Message-Reference which is to be
|
|
1031 |
//incremented by the ME for every outgoing message, the
|
|
1032 |
//TP-Message-Reference as provided by the SIM need not be the valid
|
|
1033 |
//value. TP-Message-Reference shall be checked and corrected by the ME
|
|
1034 |
//to the value described in TS 23.040 [6].
|
|
1035 |
length = GetLength();
|
|
1036 |
}
|
|
1037 |
else if ( ETLV_SsOrUssdString == aType )
|
|
1038 |
{
|
|
1039 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
1040 |
//SS or USSD control string are coded as for EFADN, where the ADN
|
|
1041 |
//record relates to a Supplementary Service Control string.
|
|
1042 |
//See TS 11.11 [20] for the coding of EFADN.
|
|
1043 |
length = GetLength() - 1;
|
|
1044 |
}
|
|
1045 |
else if ( ( ETLV_TextString == aType ) ||
|
|
1046 |
( ETLV_DefaultText == aType ) )
|
|
1047 |
{
|
|
1048 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
1049 |
//A null text string shall be coded with Length = '00', and no Value
|
|
1050 |
//part.
|
|
1051 |
length = GetLength() - 1;
|
|
1052 |
}
|
|
1053 |
else if ( ETLV_UssdString == aType )
|
|
1054 |
{
|
|
1055 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
1056 |
//The coding of the USSD string is defined in TS 02.30 [4].
|
|
1057 |
length = GetLength() - 1;
|
|
1058 |
}
|
|
1059 |
else if ( ETLV_Files == aType )
|
|
1060 |
{
|
|
1061 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
1062 |
//Files:
|
|
1063 |
//Full paths are given to files. Each of these shall be at least 4
|
|
1064 |
//octets in length (e.g. '3F002FE2' or '3F007F206FAD'). Each entry in
|
|
1065 |
//the file description is composed of two bytes, where the first byte
|
|
1066 |
//identifies the type of file (see TS 11.11). An entry in the file
|
|
1067 |
//description shall therefore always begin with '3FXX'. There can be
|
|
1068 |
//any number of Dedicated File entries between the Master File and
|
|
1069 |
//Elementary File. There shall be no delimiters between files, as this
|
|
1070 |
//is implied by the fact that the full path to any EF starts with
|
|
1071 |
//'3FXX' and ends with an Elementary type file.
|
|
1072 |
length = GetLength() - 1;
|
|
1073 |
}
|
|
1074 |
else if ( ETLV_MccAndMnc == aType )
|
|
1075 |
{
|
|
1076 |
ind = KTlvDataAreaStartPosition;
|
|
1077 |
//The mobile country code (MCC), the mobile network code (MNC), the
|
|
1078 |
//location area code (LAC) and the cell ID are coded as in
|
|
1079 |
//TS 04.08 [8].
|
|
1080 |
length = KMccAndMncLength;
|
|
1081 |
}
|
|
1082 |
else if ( ETLV_Imei == aType )
|
|
1083 |
{
|
|
1084 |
ind = KTlvDataAreaStartPosition;
|
|
1085 |
//The IMEI is coded as in TS 04.08 [8].
|
|
1086 |
length = GetLength();
|
|
1087 |
}
|
|
1088 |
else if ( ETLV_NetworkMeasurementResults == aType )
|
|
1089 |
{
|
|
1090 |
ind = KTlvDataAreaStartPosition;
|
|
1091 |
//The Network Measurement Results are coded as for the Measurement
|
|
1092 |
//Results information element in TS 04.08 [8], starting at octet 2 (the
|
|
1093 |
//IEI is removed, as this information is duplicated by the data object
|
|
1094 |
//tag).
|
|
1095 |
length = GetLength();
|
|
1096 |
}
|
|
1097 |
else if ( ETLV_ItemsNextActionIndicator == aType )
|
|
1098 |
{
|
|
1099 |
ind = KTlvDataAreaStartPosition;
|
|
1100 |
//Contents :
|
|
1101 |
//Each item of a list of items has a next action indicator coded on one
|
|
1102 |
//byte. The length of the Items Next Action Indicator list shall be the
|
|
1103 |
//number of items of the list of items (X shall be the number of items
|
|
1104 |
//in the list). The order of each item next action indicator, shall
|
|
1105 |
//reflect the order o the items in the list of items.
|
|
1106 |
|
|
1107 |
//The Item Next action indicator gives the possible actions that will
|
|
1108 |
//be initiated by the SIM in case of selection by the user.
|
|
1109 |
|
|
1110 |
//Coding : If the value is equal to '00' or if the value is reserved
|
|
1111 |
//(that is, value not listed), the ME shall ignore the next action
|
|
1112 |
//indicator type.
|
|
1113 |
|
|
1114 |
//See subclause 13.4 for further information.
|
|
1115 |
//Example :
|
|
1116 |
//For the following list of items :
|
|
1117 |
// - item #1;
|
|
1118 |
// - item #2;
|
|
1119 |
// - item #3;
|
|
1120 |
// - ....
|
|
1121 |
// - item #n,
|
|
1122 |
//the Items Next Action Indicator (NAI) shall be as follows :
|
|
1123 |
//
|
|
1124 |
// ------------------------------------------------------------
|
|
1125 |
// | Tag | Length | NAI#1 | NAI#2 | NAI#3 |
|
|
1126 |
// ------------------------------------------------------------
|
|
1127 |
|
|
1128 |
length = GetLength();
|
|
1129 |
}
|
|
1130 |
else if ( ETLV_EventList == aType )
|
|
1131 |
{
|
|
1132 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1133 |
//Event list
|
|
1134 |
//Contents: A list of events, of variable length. Each byte in the list
|
|
1135 |
//defines an event. Each event type shall not appear more than once
|
|
1136 |
//within the list.
|
|
1137 |
//Coding: Each byte in the event list shall be coded with one of the
|
|
1138 |
//values below:
|
|
1139 |
// - '00' = MT call
|
|
1140 |
// - '01' = Call connected
|
|
1141 |
// - '02' = Call disconnected
|
|
1142 |
// - '03' = Location status
|
|
1143 |
// - '04' = User activity
|
|
1144 |
// - '05' = Idle screen available
|
|
1145 |
// - '06' = Card reader status (if class "a" is supported)
|
|
1146 |
// - '07' = Language selection
|
|
1147 |
// - '08' = Browser Termination (if class "c" is supported)
|
|
1148 |
// - '09' = Data available (if class "e" is supported)
|
|
1149 |
// - '0A' = Channel status (if class "e" is supported)
|
|
1150 |
length = GetLength();
|
|
1151 |
}
|
|
1152 |
else if ( ETLV_Cause == aType )
|
|
1153 |
{
|
|
1154 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1155 |
//The Cause data object is coded as for the Cause call control
|
|
1156 |
//information element in TS 04.08 [8], starting at octet 3 (the IEI and
|
|
1157 |
//Length information are removed, as this information is duplicated by
|
|
1158 |
//the data object tag and length). Radio Link Timeout is indicated by
|
|
1159 |
//the Cause data object having a value part of zero length (only the
|
|
1160 |
//Tag and Length components are sent).
|
|
1161 |
length = GetLength();
|
|
1162 |
}
|
|
1163 |
else if ( ETLV_TransactionIdentifier == aType )
|
|
1164 |
{
|
|
1165 |
ind = KTlvDataAreaStartPosition;
|
|
1166 |
//Transaction identifier list
|
|
1167 |
//Contents: A list of transaction identifiers, of variable length. Each
|
|
1168 |
//byte in the list defines a transaction identifier. Each transaction
|
|
1169 |
//identifier shall not appear more than once within the list.
|
|
1170 |
//Coding: Each byte in the transaction identifier list shall be coded
|
|
1171 |
//as defined below:
|
|
1172 |
//bits 1 to 4 = RFU
|
|
1173 |
//bits 5 to 7 = value
|
|
1174 |
//bit 8 = flag
|
|
1175 |
//value and flag are coded as defined in TS 24.007 [23].
|
|
1176 |
length = GetLength();
|
|
1177 |
}
|
|
1178 |
else if ( ETLV_BcchChannelList == aType )
|
|
1179 |
{
|
|
1180 |
ind = KTlvDataAreaStartPosition;
|
|
1181 |
//BCCH channel list
|
|
1182 |
//Contents: the list of absolute RF channels for BCCH carriers, as
|
|
1183 |
//known by the ME from the SYSTEM INFORMATION messages. The BCCH
|
|
1184 |
//channel list is composed of one to three BCCH channel sub lists, each
|
|
1185 |
//sub list is derived from the set of frequencies defined by reference
|
|
1186 |
//neighbour cells description information element or elements. In the
|
|
1187 |
//latter case the set is the union of the different subsets defined by
|
|
1188 |
//the neighbour cells description information elements
|
|
1189 |
//(see TS 04.08 [8]). The length of the BCCH channel list field depends
|
|
1190 |
//on the length of the received BCCH channel list derived from the
|
|
1191 |
//different SYSTEM INFORMATION messages to be considered.
|
|
1192 |
//Coding: Each ARFCN is represented by 10 bits. Spare bit(s) are to be
|
|
1193 |
//filled with 0.
|
|
1194 |
|
|
1195 |
// Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1
|
|
1196 |
//---------------------------------------------------------------------
|
|
1197 |
// Byte 1 | ARFCN#1 (high part)
|
|
1198 |
// Byte 2 |ARFCN#1 (low part) ARFCN#2 (high part)
|
|
1199 |
// Byte 3 | ARFCN#2 (low part) ARFCN#3 (high part)
|
|
1200 |
// Byte n | n
|
|
1201 |
// ByteX-1| ARFCN#m-1 (low part) ARFCN#m (high part)
|
|
1202 |
// Byte X | ARFCN#m (low part) Spare Spare
|
|
1203 |
// (0) (0)
|
|
1204 |
|
|
1205 |
//SIM applications should take into account that early implementations
|
|
1206 |
//of SIM application toolkit may have coded this field differently,
|
|
1207 |
//because of an inconsistancy between the content and the coding of
|
|
1208 |
//this element in previous versions of 11.14. The SIM is able to
|
|
1209 |
//identify MEs that are using the coding described above by evaluating
|
|
1210 |
//the indication "BCCH Channel List coding" in the TERMINAL PROFILE
|
|
1211 |
//command.
|
|
1212 |
length = GetLength();
|
|
1213 |
}
|
|
1214 |
else if ( ETLV_CallControlRequestedAction == aType )
|
|
1215 |
{
|
|
1216 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1217 |
//Call control requested action
|
|
1218 |
//Contents: The action given in response to the ENVELOPE (CALL
|
|
1219 |
//CONTROL). It may contain, in the same order as given by the SIM, the
|
|
1220 |
//address or SS string, the capability configuration parameters, the
|
|
1221 |
//called party sub-address and the alpha identifier.
|
|
1222 |
|
|
1223 |
//Coding: as described in subclause 9.1.6, starting with the first
|
|
1224 |
//optional element given in the response data to the ENVELOPE (CALL
|
|
1225 |
//CONTROL).
|
|
1226 |
length = GetLength();
|
|
1227 |
}
|
|
1228 |
else if ( ETLV_IconIdentifierList == aType )
|
|
1229 |
{
|
|
1230 |
ind = KTlvDataAreaStartPosition + 1;
|
|
1231 |
//Icon identifier list:
|
|
1232 |
//Contents :
|
|
1233 |
//Each item of a list of items has an icon identifier coded on one
|
|
1234 |
//byte. The length of the Items icon identifier list shall be the
|
|
1235 |
//number of items of the list of items (X-1 shall be the number of
|
|
1236 |
//items in the list). The order of each item icon identifier, shall
|
|
1237 |
//reflect the order of the items in the list of items.
|
|
1238 |
//Each icon identifier addresses a record in EFIMG as defined in
|
|
1239 |
//TS 11.11 [20].
|
|
1240 |
|
|
1241 |
//Coding : Binary.
|
|
1242 |
//Example :
|
|
1243 |
//For the following list of items : - item #1
|
|
1244 |
// - item #2
|
|
1245 |
// - item #3
|
|
1246 |
// - ....
|
|
1247 |
// - item #n,
|
|
1248 |
|
|
1249 |
//the Items icon identifier list shall be as follows :
|
|
1250 |
//---------------------------------------------------------
|
|
1251 |
// Tag | Length |icon |icon |icon |
|
|
1252 |
//---------------------------------------------------------
|
|
1253 |
// | |identifier#1 |identifier#2 |identifier#3 |
|
|
1254 |
//---------------------------------------------------------
|
|
1255 |
length = GetLength() - 1;
|
|
1256 |
}
|
|
1257 |
else if ( ETLV_Atr == aType )
|
|
1258 |
{
|
|
1259 |
ind = KTlvDataAreaStartPosition;
|
|
1260 |
//ATR:
|
|
1261 |
//Contents :
|
|
1262 |
//This is the Answer To Reset returned by the card.
|
|
1263 |
|
|
1264 |
//Coding :
|
|
1265 |
//The coding of the Answer To Reset is defined in ISO/IEC 7816-3 [16].
|
|
1266 |
length = GetLength();
|
|
1267 |
}
|
|
1268 |
else if ( ETLV_Data == aType )
|
|
1269 |
{
|
|
1270 |
TUint8 dataLength( GetShortInfo( ETLV_Lc ) );
|
|
1271 |
if ( dataLength )
|
|
1272 |
{
|
|
1273 |
ind = KTlvDataAreaStartPosition + offset + 5;
|
|
1274 |
//This object contains the command APDU for Card x in the format
|
|
1275 |
//defined in ISO/IEC 7816?4 [25]. Command class CLA, instruction
|
|
1276 |
//code INS, P1 and P2 parameters, Lc, Data and Le are coded as
|
|
1277 |
//defined in ISO/IEC 7816?4 [25]. Extended lengths are not
|
|
1278 |
//supported.
|
|
1279 |
//Note: The maximum size of the value part of this Simple TLV
|
|
1280 |
//(value of X) is limited to 241 bytes, so the maximum length for
|
|
1281 |
//the Data (value of Lc) in a Case 3 type of APDU is 236 bytes.
|
|
1282 |
length = dataLength;
|
|
1283 |
}
|
|
1284 |
else
|
|
1285 |
{
|
|
1286 |
return 0;
|
|
1287 |
}
|
|
1288 |
}
|
|
1289 |
else if ( ETLV_RApduData == aType )
|
|
1290 |
{
|
|
1291 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1292 |
//This object contains the response APDU from Card x in the format
|
|
1293 |
//defined in ISO/IEC 7816?4 [25]. The R-APDU data and status words SW1
|
|
1294 |
//and SW2 are coded as defined in ISO/IEC 7816?4 [25]. It is possible
|
|
1295 |
//for no R-APDU data to be present; this is indicated by the length of
|
|
1296 |
//the data object.
|
|
1297 |
//Note: The maximum size of the value part of this Simple TLV (value of
|
|
1298 |
//X) is limited to 239 bytes, so the maximum length of the R-APDU data
|
|
1299 |
//is 237 bytes.
|
|
1300 |
length = GetLength() - 2;
|
|
1301 |
}
|
|
1302 |
else if ( ETLV_TimerValue == aType )
|
|
1303 |
{
|
|
1304 |
ind = KTlvDataAreaStartPosition;
|
|
1305 |
//Timer value:
|
|
1306 |
//Contents: value of a timer, expressed using the format hour, minute,
|
|
1307 |
//second.
|
|
1308 |
//Coding:
|
|
1309 |
// - byte 3: hour; this byte is coded exactly in the same way as the
|
|
1310 |
// hour field of the TP-Service-Centre-Time-Stamp in
|
|
1311 |
// TS 23.040 [6].
|
|
1312 |
// - byte 4: minute; this byte is coded exactly in the same way as
|
|
1313 |
// the minute field of the TP-Service-Centre-Time-Stamp in
|
|
1314 |
// TS 23.040 [6].
|
|
1315 |
// - byte 5: second; this byte is coded exactly in the same way as
|
|
1316 |
// the second field of the TP-Service-Centre-Time-Stamp in
|
|
1317 |
// TS 23.040 [6].
|
|
1318 |
length = GetLength();
|
|
1319 |
}
|
|
1320 |
else if ( ETLV_DateTimeAndTimeZone == aType )
|
|
1321 |
{
|
|
1322 |
ind = KTlvDataAreaStartPosition;
|
|
1323 |
//The Date-Time and Time zone is coded as for the Time Zone and Time
|
|
1324 |
//information element in TS 04.08 [8], starting at octet 2 (i.e. 1 byte
|
|
1325 |
//for year, month, day, hour, minute, second and time zone). Each byte
|
|
1326 |
//is encoded in exactly the same way as the corresponding field of the
|
|
1327 |
//TP-Service-Centre-Time-Stamp in TS 23.040 [6]. For the time zone
|
|
1328 |
//field, 'FF' indicates an unknown value.
|
|
1329 |
length = GetLength();
|
|
1330 |
}
|
|
1331 |
else if ( ETLV_AtCommand == aType )
|
|
1332 |
{
|
|
1333 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1334 |
//Contents :
|
|
1335 |
// The AT Command string is structured exactly as the AT Command line
|
|
1336 |
// as defined in GSM 27.007 [27], which may contain single or
|
|
1337 |
// concatenated AT commands.
|
|
1338 |
length = GetLength();
|
|
1339 |
}
|
|
1340 |
else if ( ETLV_AtResponse == aType )
|
|
1341 |
{
|
|
1342 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1343 |
//Contents:
|
|
1344 |
// The AT Response string is structured exactly as the response to a
|
|
1345 |
// command line as defined in GSM 27.007 [27], which may contain single
|
|
1346 |
// or concatenated responses appropriate to the issued AT command.
|
|
1347 |
// If the AT Response string is longer than the maximum length capable
|
|
1348 |
// of being transmitted to the SIM then the AT Response string shall be
|
|
1349 |
// truncated to this length by the ME.
|
|
1350 |
length = GetLength();
|
|
1351 |
}
|
|
1352 |
else if ( ETLV_DtmfString == aType )
|
|
1353 |
{
|
|
1354 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1355 |
//Contents : The DTMF string which can be single or multiple characters
|
|
1356 |
//is coded in BCD, in the same way as the Dialling number string
|
|
1357 |
//defined for EFADN in TS 11.11 [20]. It may include extended BCD
|
|
1358 |
//coding. There is no need for a DTMF control digit separator at the
|
|
1359 |
//beginning of the string, but if present it shall be interpreted as
|
|
1360 |
//PAUSE.
|
|
1361 |
length = GetLength();
|
|
1362 |
}
|
|
1363 |
else if ( ETLV_Url == aType )
|
|
1364 |
{
|
|
1365 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1366 |
//A null URL shall be coded with Length = '00', and no Value part. In
|
|
1367 |
//that case, the ME shall use the default URL.
|
|
1368 |
//
|
|
1369 |
//Coding :
|
|
1370 |
//The data used for the URL shall be coded as defined in [32] on using
|
|
1371 |
//the "SMS 7bits default alphabet" with bit 8 set to 0;
|
|
1372 |
length = GetLength();
|
|
1373 |
}
|
|
1374 |
else if ( ETLV_ListOfBearers == aType )
|
|
1375 |
{
|
|
1376 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1377 |
//The ME shall use this list to choose which bearers are allowed in
|
|
1378 |
//order of priority.
|
|
1379 |
|
|
1380 |
//Coding of the bearers :
|
|
1381 |
//'00' = SMS
|
|
1382 |
//'01' = CSD
|
|
1383 |
//'02' = USSD
|
|
1384 |
//'03' = GPRS
|
|
1385 |
//'04' to 'FF' = RFU.
|
|
1386 |
length = GetLength();
|
|
1387 |
}
|
|
1388 |
else if ( ETLV_PathToProvisioningFile == aType )
|
|
1389 |
{
|
|
1390 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1391 |
//Note : the path is the concatenation of file identifiers starting
|
|
1392 |
//from the Master File, e.g. : 3F007F206FXY...
|
|
1393 |
//The file shall contain a single unambiguous set of parameters
|
|
1394 |
//required to make the connection. The content of the file shall be
|
|
1395 |
//consistent with the format defined for provisioning information for
|
|
1396 |
//the requested type of browser.
|
|
1397 |
length = GetLength();
|
|
1398 |
}
|
|
1399 |
else if ( ETLV_BearerParameters == aType )
|
|
1400 |
{
|
|
1401 |
ind = KTlvDataAreaStartPosition + offset + 1;
|
|
1402 |
//see 3GPP spec: 12.52.1
|
|
1403 |
//12.52.1 Bearer parameters for CSD
|
|
1404 |
//12.52.2 Bearer parameters for GPRS / packet service
|
|
1405 |
//12.52.3 Default bearer
|
|
1406 |
length = GetLength() - 1;
|
|
1407 |
}
|
|
1408 |
else if ( ETLV_ChannelDataString == aType )
|
|
1409 |
{
|
|
1410 |
ind = KTlvDataAreaStartPosition + offset;
|
|
1411 |
//Contents:
|
|
1412 |
//The Channel data object contains application data read from or
|
|
1413 |
//written to a specific channel buffer in the ME.
|
|
1414 |
//Coding:
|
|
1415 |
//The Channel data string must be considered by the ME as binary coded
|
|
1416 |
//on 8 bits.
|
|
1417 |
length = GetLength();
|
|
1418 |
}
|
|
1419 |
else if ( ETLV_IdentifierOfCardReader == aType )
|
|
1420 |
{
|
|
1421 |
ind = KTlvDataAreaStartPosition;
|
|
1422 |
//Coding :
|
|
1423 |
//The identifier of card reader is coded in hexadecimal.
|
|
1424 |
length = GetLength();
|
|
1425 |
}
|
|
1426 |
else if ( ETLV_Address == aType )
|
|
1427 |
{
|
|
1428 |
ind = KTlvDataAreaStartPosition + 1;
|
|
1429 |
//Coding of address: according to packet data protocol address in
|
|
1430 |
//TS 04.08 [8].
|
|
1431 |
//If type of address indicates IPv4, the Address information in octet 4
|
|
1432 |
//to octet 7 contains the IPv4 address. Bit 8 of octet 4 represents the
|
|
1433 |
//most significant bit of the IP address and bit 1 of octet 7 the least
|
|
1434 |
//significant bit .
|
|
1435 |
//If type of address indicates IPv6, the Address information in octet 4
|
|
1436 |
//to octet 19 contains the IPv6 address. Bit 8 of octet 4 represents
|
|
1437 |
//the most significant bit of the IP address and bit 1 of octet 19 the
|
|
1438 |
//least significant bit.
|
|
1439 |
length = GetLength() - 1; // Length minus 1 because there is a byte
|
|
1440 |
//before the address data
|
|
1441 |
}
|
|
1442 |
else if ( ETLV_NetworkAccessName == aType )
|
|
1443 |
{
|
|
1444 |
ind = KTlvDataAreaStartPosition;
|
|
1445 |
//Content:
|
|
1446 |
//The Network Access Name is used to identify the Gateway entity, which
|
|
1447 |
//provides interworking with an external packet data network. For GPRS,
|
|
1448 |
//the Network Access Name is an APN.
|
|
1449 |
//Coding: As defined in TS 23.003 [36].
|
|
1450 |
length = GetLength();
|
|
1451 |
}
|
|
1452 |
else if ( ETLV_AID == aType )
|
|
1453 |
{
|
|
1454 |
ind = KTlvDataAreaStartPosition;
|
|
1455 |
// Application identifier as defined in TS 31.110
|
|
1456 |
// Byte(s) Description
|
|
1457 |
// 1 AID tag
|
|
1458 |
// 2 Length (X)
|
|
1459 |
// 3 to (X+2) AID
|
|
1460 |
|
|
1461 |
length = GetLength();
|
|
1462 |
}
|
|
1463 |
else if ( ETLV_RemoteEntityAddress == aType )
|
|
1464 |
{
|
|
1465 |
ind = KTlvDataAreaStartPosition + 1;
|
|
1466 |
// Remote Entity Address:
|
|
1467 |
// According to Coding Type
|
|
1468 |
// --------------------------------------------------
|
|
1469 |
// | Byte(s): | Description: | Length: |
|
|
1470 |
// --------------------------------------------------
|
|
1471 |
// | 1 | Item Tag | 1 |
|
|
1472 |
// | 2 to Y+1 | Lenght (X+1) | Y |
|
|
1473 |
// | Y+2 | Coding Type | 1 |
|
|
1474 |
// | Y+3 to Y+X+2 | Remote entity Address | X |
|
|
1475 |
// --------------------------------------------------
|
|
1476 |
// Length minus 1 because there is a coding type byte
|
|
1477 |
// before the remote entity address data
|
|
1478 |
length = GetLength() - 1;
|
|
1479 |
}
|
|
1480 |
else
|
|
1481 |
{
|
|
1482 |
// Data type did not match
|
|
1483 |
TFLOGSTRING2("TSY: CTlv::GetData, Unknown data type: 0x%x", aType );
|
|
1484 |
OstTrace1( TRACE_DETAILED, DUP2_CTLV_GETDATA, "CTlv::GetData Unknown data type: %{TTlvSpesificDataType}", aType );
|
|
1485 |
|
|
1486 |
}
|
|
1487 |
|
|
1488 |
return iData.Mid( ind, length );
|
|
1489 |
|
|
1490 |
}
|
|
1491 |
|
|
1492 |
// -----------------------------------------------------------------------------
|
|
1493 |
// CTlv::GetLongInfo
|
|
1494 |
// Returns the the data.
|
|
1495 |
// Returned data depends on data type.
|
|
1496 |
// -----------------------------------------------------------------------------
|
|
1497 |
//
|
|
1498 |
TUint16 CTlv::GetLongInfo
|
|
1499 |
(
|
|
1500 |
TTlvSpesificDataType aType //Info spesific data type
|
|
1501 |
)
|
|
1502 |
{
|
|
1503 |
OstTrace0( TRACE_DETAILED, CTLV_GETLONGINFO, "CTlv::GetLongInfo" );
|
|
1504 |
TFLOGSTRING("TSY: CTlv::GetLongInfo");
|
|
1505 |
|
|
1506 |
TUint16 ret( 0x0000 );
|
|
1507 |
|
|
1508 |
if ( ETLV_LocationAreaCode == aType )
|
|
1509 |
{
|
|
1510 |
//The mobile country code (MCC), the mobile network code (MNC), the
|
|
1511 |
//location area code (LAC) and the cell ID are coded as
|
|
1512 |
//in TS 04.08 [8].
|
|
1513 |
TSatUtility::GetWord
|
|
1514 |
( ret, iData, KTlvLengthStartPosition + KMccAndMncLength );
|
|
1515 |
}
|
|
1516 |
else if ( ETLV_CellIdentityValue == aType )
|
|
1517 |
{
|
|
1518 |
//The mobile country code (MCC), the mobile network code (MNC), the
|
|
1519 |
//location area code (LAC) and the cell ID are coded as
|
|
1520 |
//in TS 04.08 [8].
|
|
1521 |
TSatUtility::GetWord( ret, iData, KTlvLengthStartPosition
|
|
1522 |
+ KMccAndMncLength + KLocationAreaCodeLength );
|
|
1523 |
}
|
|
1524 |
else if ( ETLV_Language == aType )
|
|
1525 |
{
|
|
1526 |
//Coding:
|
|
1527 |
// each language code is a pair of alpha-numeric characters, defined in
|
|
1528 |
// ISO 639 [29]. Each alpha-numeric character shall be coded on one
|
|
1529 |
// byte using the SMS default 7-bit coded alphabet as defined in
|
|
1530 |
// TS 23.038 [5] with bit 8 set to 0.
|
|
1531 |
TSatUtility::GetWord( ret, iData, KTlvDataAreaStartPosition );
|
|
1532 |
}
|
|
1533 |
else if ( ETLV_BufferSize == aType )
|
|
1534 |
{
|
|
1535 |
//Coding:
|
|
1536 |
// The Buffer size codes the number of bytes requested by the SIM in an
|
|
1537 |
// OPEN CHANNEL command or what the ME can offer the SIM (placed in
|
|
1538 |
// TERMINAL RESPONSE).
|
|
1539 |
TSatUtility::GetWord( ret, iData, KTlvDataAreaStartPosition );
|
|
1540 |
}
|
|
1541 |
else if ( ETLV_ChannelStatus == aType )
|
|
1542 |
{
|
|
1543 |
//Contents :
|
|
1544 |
//The Channel status is a string of binary coded characters.
|
|
1545 |
//Coding of byte 3:
|
|
1546 |
//bit 1 to 3: Channel identifier : 1..7
|
|
1547 |
// Channel identifier 0 means "No channel available"
|
|
1548 |
//bit 4 to 7: RFU
|
|
1549 |
//bit 8: 0 = Link not established or PDP context not activated
|
|
1550 |
// 1 = Link established or PDP context activated
|
|
1551 |
//
|
|
1552 |
//Coding of byte 4:
|
|
1553 |
//- '00' = No further info can be given
|
|
1554 |
//- '01' = Not used
|
|
1555 |
//- '02' = Not used
|
|
1556 |
//- '03' = Not used
|
|
1557 |
//- '04' = Not used
|
|
1558 |
//- '05' = Link dropped
|
|
1559 |
//all other values are reserved for future use
|
|
1560 |
TSatUtility::GetWord( ret, iData, KTlvLengthStartPosition );
|
|
1561 |
}
|
|
1562 |
else if ( ETLV_PortNumber == aType )
|
|
1563 |
{
|
|
1564 |
//Port number coding: integer
|
|
1565 |
TSatUtility::GetWord( ret, iData, KTlvDataAreaStartPosition + 1 );
|
|
1566 |
}
|
|
1567 |
else
|
|
1568 |
{
|
|
1569 |
// Data type did not match
|
|
1570 |
TFLOGSTRING2("TSY: CTlv::GetLongInfo, Unknown data type:0x%x", aType );
|
|
1571 |
OstTrace1( TRACE_DETAILED, DUP1_CTLV_GETLONGINFO, "CTlv::GetLongInfo, Unknown data type: %{TTlvSpesificDataType}", aType );
|
|
1572 |
|
|
1573 |
}
|
|
1574 |
return ret;
|
|
1575 |
|
|
1576 |
}
|
|
1577 |
|
|
1578 |
|
|
1579 |
// -----------------------------------------------------------------------------
|
|
1580 |
// CBerTlv::BerTlv
|
|
1581 |
// Set ber-tlv to proactive sim command ber-tlv in
|
|
1582 |
// UICC_CAT_IND(UICC_CAT_FETCHED_CMD) ISI message.
|
|
1583 |
// -----------------------------------------------------------------------------
|
|
1584 |
//
|
|
1585 |
TInt CBerTlv::BerTlv( const TIsiReceiveC& aIsiMessage )
|
|
1586 |
{
|
|
1587 |
OstTrace0( TRACE_DETAILED, CBERTLV_BERTLV, "CBerTlv::BerTlv" );
|
|
1588 |
TFLOGSTRING("TSY: CBerTlv::BerTlv");
|
|
1589 |
|
|
1590 |
TInt result ( KErrNotFound );
|
|
1591 |
TUint16 berTlvLength( 0 );
|
|
1592 |
|
|
1593 |
// BER-TLV data is in subblock UICC_SB_APDU
|
|
1594 |
TUint uiccSbApduOffset( 0 );
|
|
1595 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
1596 |
ISI_HEADER_SIZE + SIZE_UICC_CAT_IND,
|
|
1597 |
UICC_SB_APDU,
|
|
1598 |
EIsiSubBlockTypeId16Len16,
|
|
1599 |
uiccSbApduOffset ) )
|
|
1600 |
{
|
|
1601 |
berTlvLength = aIsiMessage.Get16bit(
|
|
1602 |
uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDULENGTH );
|
|
1603 |
|
|
1604 |
// Check the proactive command tag
|
|
1605 |
if ( KBerTlvProactiveSimCommandTag == aIsiMessage.Get8bit(
|
|
1606 |
uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDU ) )
|
|
1607 |
{
|
|
1608 |
TPtrC8 data( aIsiMessage.GetData(
|
|
1609 |
uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDU,
|
|
1610 |
berTlvLength ) );
|
|
1611 |
SetData( data );
|
|
1612 |
result = KErrNone;
|
|
1613 |
}
|
|
1614 |
}
|
|
1615 |
return result;
|
|
1616 |
}
|
|
1617 |
|
|
1618 |
|
|
1619 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
1620 |
// none
|
|
1621 |
|
|
1622 |
//End Of File
|