|
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 BER_TLV_H |
|
21 #define BER_TLV_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> // base class cbase |
|
25 |
|
26 |
|
27 // CONSTANTS |
|
28 const TUint8 KTlvLengthStartPosition = 0x01; |
|
29 const TUint8 KTlvDataAreaStartPosition = 0x02; |
|
30 const TUint8 KTlvHeaderLength = 0x02; |
|
31 const TUint8 KTwoByteLengthCoding = 0x81; |
|
32 const TUint8 KMccAndMncLength = 0x03; |
|
33 const TUint8 KLocationAreaCodeLength = 0x02; |
|
34 const TUint8 KCApduLengthWithoutLc = 0x06; |
|
35 const TUint8 KCommonTlvHeaderLength = 0x02; |
|
36 const TUint8 KDefaultCommandNumber = 0x01; |
|
37 const TUint8 KDefaultGetInkeyCodingScheme = 0x04; |
|
38 const TUint8 KTagValueMask = 0x7f; |
|
39 const TUint8 KTagCrMask = 0x80; |
|
40 const TUint8 KMaxOneByteLength = 0x7f; |
|
41 |
|
42 |
|
43 // In 242 octets, it is possible to pack (242x8)/7=277 characters. |
|
44 // See ref. 3GPP TS 23.038. |
|
45 const TInt16 KTextBufferMaxSize = 277; |
|
46 const TUint8 KCommandQualifier = 4; |
|
47 const TUint8 KTlvMaxSize = 255; |
|
48 |
|
49 //Proactive SIM commands |
|
50 const TUint8 KRefresh = 0x01; |
|
51 const TUint8 KMoreTime = 0x02; |
|
52 const TUint8 KPollInterval = 0x03; |
|
53 const TUint8 KPollingOff = 0x04; |
|
54 const TUint8 KSetUpEventList = 0x05; |
|
55 const TUint8 KSetUpCall = 0x10; |
|
56 const TUint8 KSendSs = 0x11; |
|
57 const TUint8 KSendUssd = 0x12; |
|
58 const TUint8 KSendShortMessage = 0x13; |
|
59 const TUint8 KSendDtmf = 0x14; |
|
60 const TUint8 KLaunchBrowser = 0x15; |
|
61 const TUint8 KPlayTone = 0x20; |
|
62 const TUint8 KDisplayText = 0x21; |
|
63 const TUint8 KGetInkey = 0x22; |
|
64 const TUint8 KGetInput = 0x23; |
|
65 const TUint8 KSelectItem = 0x24; |
|
66 const TUint8 KSetUpMenu = 0x25; |
|
67 const TUint8 KProvideLocalInformation = 0x26; |
|
68 const TUint8 KTimerManagement = 0x27; |
|
69 const TUint8 KSetUpIdleModeText = 0x28; |
|
70 const TUint8 KPerformCardApdu = 0x30; |
|
71 const TUint8 KPowerOnCard = 0x31; |
|
72 const TUint8 KPowerOffCard = 0x32; |
|
73 const TUint8 KGetReaderStatus = 0x33; |
|
74 const TUint8 KRunAtCommand = 0x34; |
|
75 const TUint8 KLanguageNotification = 0x35; |
|
76 const TUint8 KOpenChannel = 0x40; |
|
77 const TUint8 KCloseChannel = 0x41; |
|
78 const TUint8 KReceiveData = 0x42; |
|
79 const TUint8 KSendData = 0x43; |
|
80 const TUint8 KGetChannelStatus = 0x44; |
|
81 const TUint8 KEndOfTheProactiveSession = 0x81; |
|
82 |
|
83 |
|
84 //TAG Values |
|
85 |
|
86 //BER-TLV tags |
|
87 //BER-TLV tags in ME to SIM direction |
|
88 const TUint8 KBerTlvSmsPpDownloadTag = 0xD1; |
|
89 const TUint8 KBerTlvCellBroadcastTag = 0xD2; |
|
90 const TUint8 KBerTlvMenuSelectionTag = 0xD3; |
|
91 const TUint8 KBerTlvCallControlTag = 0xD4; |
|
92 const TUint8 KBerTlvMoShortMessageControlTag = 0xD5; |
|
93 const TUint8 KBerTlvEventDownloadTag = 0xD6; |
|
94 const TUint8 KBerTlvTimerExpirationTag = 0xD7; |
|
95 |
|
96 //BER-TLV tags in SIM to ME direction |
|
97 const TUint8 KBerTlvProactiveSimCommandTag = 0xD0; |
|
98 |
|
99 //SIMPLE-TLV tags in both directions |
|
100 //TLV tags, Tag value, bits 1-7 (Range: '01' - '7E') |
|
101 const TUint8 KTlvCommandDetailsTag = 0x01; |
|
102 const TUint8 KTlvDeviceIdentityTag = 0x02; |
|
103 const TUint8 KTlvResultTag = 0x03; |
|
104 const TUint8 KTlvDurationTag = 0x04; |
|
105 const TUint8 KTlvAlphaIdentifierTag = 0x05; |
|
106 const TUint8 KTlvAddressTag = 0x06; |
|
107 const TUint8 KTlvCapabilityConfigurationParametersTag = 0x07; |
|
108 const TUint8 KTlvSubaddressTag = 0x08; |
|
109 const TUint8 KTlvSsStringTag = 0x09; |
|
110 const TUint8 KTlvUssdStringTag = 0x0A; |
|
111 const TUint8 KTlvSmsTpduTag = 0x0B; |
|
112 const TUint8 KTlvCellBroadcastPageTag = 0x0C; |
|
113 const TUint8 KTlvTextStringTag = 0x0D; |
|
114 const TUint8 KTlvToneTag = 0x0E; |
|
115 const TUint8 KTlvItemTag = 0x0F; |
|
116 const TUint8 KTlvItemIdentifierTag = 0x10; |
|
117 const TUint8 KTlvResponseLengthTag = 0x11; |
|
118 const TUint8 KTlvFileListTag = 0x12; |
|
119 const TUint8 KTlvLocationInformationTag = 0x13; |
|
120 const TUint8 KTlvImeiTag = 0x14; |
|
121 const TUint8 KTlvHelpRequestTag = 0x15; |
|
122 const TUint8 KTlvNetworkMeasurementResultsTag = 0x16; |
|
123 const TUint8 KTlvDefaultTextTag = 0x17; |
|
124 const TUint8 KTlvItemsNextActionIndicatorTag = 0x18; |
|
125 const TUint8 KTlvEventListTag = 0x19; |
|
126 const TUint8 KTlvCauseTag = 0x1A; |
|
127 const TUint8 KTlvLocationStatusTag = 0x1B; |
|
128 const TUint8 KTlvTransactionIdentifierTag = 0x1C; |
|
129 const TUint8 KTlvBccdChannelListTag = 0x1D; |
|
130 const TUint8 KTlvIconIdentifierTag = 0x1E; |
|
131 const TUint8 KTlvItemIconIdentifierListTag = 0x1F; |
|
132 const TUint8 KTlvCardReaderStatusTag = 0x20; |
|
133 const TUint8 KTlvCardAtrTag = 0x21; |
|
134 const TUint8 KTlvCApduTag = 0x22; |
|
135 const TUint8 KTlvRApduTag = 0x23; |
|
136 const TUint8 KTlvTimerIdentifierTag = 0x24; |
|
137 const TUint8 KTlvTimerValueTag = 0x25; |
|
138 const TUint8 KTlvDateTimeAndTimeZoneTag = 0x26; |
|
139 const TUint8 KTlvCallControlRequestedActionTag = 0x27; |
|
140 const TUint8 KTlvAtCommandTag = 0x28; |
|
141 const TUint8 KTlvAtResponseTag = 0x29; |
|
142 const TUint8 KTlvBcRepeatIndicatorTag = 0x2A; |
|
143 const TUint8 KTlvImmediateResponseTag = 0x2B; |
|
144 const TUint8 KTlvDtmfStringTag = 0x2C; |
|
145 const TUint8 KTlvLanguageTag = 0x2D; |
|
146 const TUint8 KTlvTimingAdvanceTag = 0x2E; |
|
147 const TUint8 KTlvAIDTag = 0x2F; |
|
148 const TUint8 KTlvBrowserIdentityTag = 0x30; |
|
149 const TUint8 KTlvUrlTag = 0x31; |
|
150 const TUint8 KTlvBearerTag = 0x32; |
|
151 const TUint8 KTlvProvisioningReferenceFileTag = 0x33; |
|
152 const TUint8 KTlvBrowserTerminationCauseTag = 0x34; |
|
153 const TUint8 KTlvBearerDescriptionTag = 0x35; |
|
154 const TUint8 KTlvChannelDataTag = 0x36; |
|
155 const TUint8 KTlvChannelDataLengthTag = 0x37; |
|
156 const TUint8 KTlvChannelStatusTag = 0x38; |
|
157 const TUint8 KTlvBufferSizeTag = 0x39; |
|
158 const TUint8 KTlvCardReaderIdentifierTag = 0x3A; |
|
159 const TUint8 KTlvTextStringTagUserPassword = 0x3B; |
|
160 const TUint8 KTlvSimMeTransportLevelTag = 0x3C; |
|
161 const TUint8 KTlvURLTag = 0x3D; |
|
162 const TUint8 KTlvOtherAddressTag = 0x3E; |
|
163 |
|
164 const TUint8 KTlvAccessTechnologyTag = 0x3F; |
|
165 const TUint8 KTlvESNTag = 0x46; |
|
166 const TUint8 KTlvNetworkAccessNameTag = 0x47; |
|
167 const TUint8 KTlvPdpContextActivationParametersTag = 0x52; |
|
168 |
|
169 const TUint8 KTlvTimerIdentifierTagCRBitOn = 0xA4; |
|
170 |
|
171 const TUint8 KTlvUtranMeasurementQualifierTag = 0x69; |
|
172 //TLV Coding |
|
173 |
|
174 // event download - Event list event coding |
|
175 const TUint8 KEventMTCall = 0x00; |
|
176 const TUint8 KEventCallConnected = 0x01; |
|
177 const TUint8 KEventCallDisconnected = 0x02; |
|
178 const TUint8 KEventLocationStatus = 0x03; |
|
179 const TUint8 KEventUserActivity = 0x04; |
|
180 const TUint8 KEventIdleScreenAvailable = 0x05; |
|
181 const TUint8 KEventCardReaderStatus = 0x06; |
|
182 const TUint8 KEventLanguageSelection = 0x07; |
|
183 const TUint8 KEventBrowserTermination = 0x08; |
|
184 const TUint8 KEventDataAvailable = 0x09; |
|
185 const TUint8 KEventChannelStatus = 0x0A; |
|
186 const TUint8 KEventAccessTechnologyChange = 0x0B; |
|
187 |
|
188 // event download - Location status coding |
|
189 const TUint8 KLocationStatusNormalService = 0x00; |
|
190 const TUint8 KLocationStatusLimitedService = 0x01; |
|
191 const TUint8 KLocationStatusNoService = 0x02; |
|
192 |
|
193 // event download - Browser termination coding |
|
194 const TUint8 KBrowserTerminationUser = 0x00; |
|
195 const TUint8 KBrowserTerminationError = 0x01; |
|
196 |
|
197 |
|
198 //REFRESH; |
|
199 const TUint8 KSimInitFullFileChangeNotification = 0x00; |
|
200 const TUint8 KFileChangeNotification = 0x01; |
|
201 const TUint8 KSimInitFileChangeNotification = 0x02; |
|
202 const TUint8 KSimInit = 0x03; |
|
203 const TUint8 KSimReset = 0x04; |
|
204 const TUint8 KUSIMApplicationReset = 0x05; |
|
205 const TUint8 K3GSessionReset = 0x06; |
|
206 const TUint8 KMaxPathLength = 16; |
|
207 |
|
208 |
|
209 //SET UP CALL; |
|
210 const TUint8 KSetUpCallIfNotCurrentlyBusy = 0x00; |
|
211 const TUint8 KSetUpCallIfNotCurrentlyBusyWithRedial = 0x01; |
|
212 const TUint8 KSetUpCallPuttingOtherCallsOnHold = 0x02; |
|
213 const TUint8 KSetUpCallPuttingOtherCallsOnHoldWithRedial = 0x03; |
|
214 const TUint8 KSetUpCallDisconnectingOtherCalls = 0x04; |
|
215 const TUint8 KSetUpCallDisconnectingOtherCallsWithRedial = 0x05; |
|
216 const TUint8 KAuthorityFormatIdentifier = 0x50; |
|
217 const TUint8 KMinutes = 0x00; |
|
218 const TUint8 KSeconds = 0x01; |
|
219 const TUint8 KTenthsOfSeconds = 0x02; |
|
220 |
|
221 |
|
222 //SEND SHORT MESSAGE; |
|
223 const TUint8 KSmsPackingRequiredMask = 0x01; |
|
224 const TUint8 KDCSAlphabetMask = 0x06; |
|
225 const TUint8 KSmsMaxSize = 160; |
|
226 const TUint8 KSmsMaxSizeWithoutPacking = 140; |
|
227 const TUint8 KSMSCommandMaxSize = 152; |
|
228 |
|
229 //DISPLAY TEXT, |
|
230 const TUint8 KPriorityMask = 0x01; |
|
231 const TUint8 KMessageClearMask = 0x80; |
|
232 |
|
233 //GET INKEY, |
|
234 const TUint8 KAlphabetMask = 0x01; |
|
235 const TUint8 KUCS2AlphabetMask = 0x02; |
|
236 const TUint8 KYesNoMask = 0x04; |
|
237 const TUint8 KImmediateDigitResponse = 0x08; |
|
238 const TUint8 KHelpAvailabilityMask = 0x80; |
|
239 |
|
240 //GET INPUT, |
|
241 const TUint8 KUserInputMask = 0x04; |
|
242 const TUint8 KGetInputSmsPackedMask = 0x08; |
|
243 const TUint8 KUCS2DCS = 0x08; |
|
244 const TUint8 K7BitDefaultSmsDCS = 0x00; |
|
245 const TUint8 K8BitDCS = 0x04; |
|
246 |
|
247 //SELECT ITEM. |
|
248 const TUint8 KSelectItemPresentationTypeMask = 0x01; |
|
249 const TUint8 KSelectItemChoiceOfNavigationMask = 0x02; |
|
250 const TUint8 KSelectItemSelectUsingSoftKeyMask = 0x04; |
|
251 |
|
252 //SET UP MENU. |
|
253 const TUint8 KSelectionUsingSoftKey = 0x01; |
|
254 |
|
255 //TIMER MANAGEMENT |
|
256 const TUint8 KDeactivateTimer = 0x01; |
|
257 const TUint8 KGetTimerValue = 0x02; |
|
258 |
|
259 //LAUNCH BROWSER |
|
260 const TUint8 KLaunchBrowserIfNotYetLaunched = 0x00; |
|
261 const TUint8 KUseExistingBrowser = 0x02; |
|
262 const TUint8 KCloseAndLaunchNewBrowser = 0x03; |
|
263 |
|
264 //PROVIDE LOCAL INFORMATION |
|
265 const TUint8 KNetworkModeGsm = 0x00; |
|
266 const TUint8 KNetworkModeUtran = 0x03; |
|
267 const TUint8 KIntraFrequencyMeasurements = 0x01; |
|
268 const TUint8 KInterFrequencyMeasurements = 0x02; |
|
269 const TUint8 KInterRatMeasurements = 0x03; |
|
270 // BEARER INDEPENDENT PROTOCOL |
|
271 const TUint8 KIPV4 = 0x21; |
|
272 const TUint8 KIPV6 = 0x57; |
|
273 |
|
274 //General result |
|
275 //All other values are reserved. |
|
276 //Results '0X' and '1X' indicate that the command has been performed. |
|
277 const TUint8 KCommandPerformedSuccessfully = 0x00; |
|
278 const TUint8 KCommandPerformedWithPartialComprehension = 0x01; |
|
279 const TUint8 KCommandPerformedWithMissingInformation = 0x02; |
|
280 const TUint8 KRefreshPerformedWithAdditionalEfsRead = 0x03; |
|
281 const TUint8 KCommandPerformedSuccessfullyIconCouldNotBeDisplayed = 0x04; |
|
282 const TUint8 KCommandPerformedButModifiedByCallControlBySim = 0x05; |
|
283 const TUint8 KCommandPerformedSuccessfullyLimitedService = 0x06; |
|
284 const TUint8 KCommandPerformedWithModification = 0x07; |
|
285 const TUint8 KProactiveSimSessionTerminatedByTheUser = 0x10; |
|
286 const TUint8 KBackwardMoveInTheProactiveSimSessionRequestedByTheUser = 0x11; |
|
287 const TUint8 KNoResponseFromUser = 0x12; |
|
288 const TUint8 KHelpInformationRequiredByTheUser = 0x13; |
|
289 const TUint8 KUssdOrSsTransactionTerminatedByTheUser = 0x14; |
|
290 |
|
291 //Results '2X' Indicate To The SIM That It May Be Worth Re-Trying The Command |
|
292 //At A Later Opportunity. |
|
293 const TUint8 KMeCurrentlyUnableToProcessCommand = 0x20; |
|
294 const TUint8 KNetworkCurrentlyUnableToProcessCommand = 0x21; |
|
295 const TUint8 KUserDidNotAcceptTheProactiveCommand = 0x22; |
|
296 const TUint8 KUserClearedDownCallBeforeConnectionOrNetworkRelease = 0x23; |
|
297 const TUint8 KActionInContradictionWithTheCurrentTimerState = 0x24; |
|
298 const TUint8 KInteractionWithCallControlBySimTemporaryProblem = 0x25; |
|
299 const TUint8 KLaunchBrowserGenericErrorCode = 0x26; |
|
300 |
|
301 //Results '3X' Indicate That It Is Not Worth The SIM Re-Trying With An |
|
302 //Identical Command, As It Will Only Get The Same Response. However, The |
|
303 //Decision To Retry Lies With The SIM Application. |
|
304 const TUint8 KCommandBeyondMeCapabilities = 0x30; |
|
305 const TUint8 KCommandTypeNotUnderstoodByMe = 0x31; |
|
306 const TUint8 KCommandDataNotUnderstoodByMe = 0x32; |
|
307 const TUint8 KCommandNumberNotKnownByMe = 0x33; |
|
308 const TUint8 KSsReturnError = 0x34; |
|
309 const TUint8 KSmsRpError = 0x35; |
|
310 const TUint8 KErrorRequiredValuesAreMissing = 0x36; |
|
311 const TUint8 KUssdReturnError = 0x37; |
|
312 const TUint8 KMultiplecardCommandsError = 0x38; |
|
313 const TUint8 KSimPermanentProblem = 0x39; |
|
314 const TUint8 KBearerIndependentProtocolError = 0x3a; |
|
315 |
|
316 //Additional information |
|
317 //Contents: For the general result "Command performed successfully", some |
|
318 // proactive commands require additional information in the command result. |
|
319 // This is defined in the subclauses below. For the general results '20', '21', |
|
320 // '26', '34', '35', '37', '38' and '39' and '3A', it is mandatory for the ME |
|
321 // to provide a specific cause value as additional information, as defined in |
|
322 // the subclauses below. For the other general results, the ME may optionally |
|
323 // supply additional information. If additional information is not supplied, |
|
324 // then the length of the value part of the data object need only contain the |
|
325 // general result. See 3GPP TS 11.14 V8.8.0, chapters 12.12.1 - 12.12.11 for |
|
326 // more details. |
|
327 |
|
328 //Additional information for ME problem |
|
329 //Additional information for network problem |
|
330 //Additional information for SS problem |
|
331 const TUint8 KNoSpecificCauseCanBeGiven = 0x00; |
|
332 const TUint8 KScreenIsBusy = 0x01; |
|
333 const TUint8 KMeCurrentlyBusyOnCall = 0x02; |
|
334 const TUint8 KMeCurrentlyBusyOnSsTransaction = 0x03; |
|
335 const TUint8 KNoService = 0x04; |
|
336 const TUint8 KAccessControlClassBar = 0x05; |
|
337 const TUint8 KRadioResourceNotGranted = 0x06; |
|
338 const TUint8 KNotInSpeechCall = 0x07; |
|
339 const TUint8 KMeCurrentlyBusyOnUssdTransaction = 0x08; |
|
340 const TUint8 KMeCurrentlyBusyOnSendDtmfCommand = 0x09; |
|
341 |
|
342 //Additional information for interaction with call control or MO SM control |
|
343 const TUint8 KActionNotAllowed = 0x01; |
|
344 const TUint8 KTypeOfRequestHasChanged = 0x02; |
|
345 |
|
346 //Additional information for MultipleCard commands |
|
347 const TUint8 KCardReaderRemovedOrNotPresent = 0x01; |
|
348 const TUint8 KCardRemovedOrNotPresent = 0x02; |
|
349 const TUint8 KCardReaderBusy = 0x03; |
|
350 const TUint8 KCardPoweredOff = 0x04; |
|
351 const TUint8 KCApduFormatError = 0x05; |
|
352 const TUint8 KMuteCard = 0x06; |
|
353 const TUint8 KTransmissionError = 0x07; |
|
354 const TUint8 KProtocolNotSupported = 0x08; |
|
355 const TUint8 KSpecifiedReaderNotValid = 0x09; |
|
356 |
|
357 //Additional information for Launch Browser problem |
|
358 const TUint8 KBearerUnavailable = 0x01; |
|
359 const TUint8 KBrowserUnavailable = 0x02; |
|
360 const TUint8 KMeUnableToReadTheProvisioningData = 0x03; |
|
361 |
|
362 //Additional information for Bearer Independent Protocol |
|
363 const TUint8 KNoChannelAvailable = 0x01; |
|
364 const TUint8 KChannelClosed = 0x02; |
|
365 const TUint8 KChannelIdentifierNotValid = 0x03; |
|
366 const TUint8 KRequestedBufferSizeNotAvailable = 0x04; |
|
367 const TUint8 KSecurityError = 0x05; |
|
368 const TUint8 KRequestedSimMeInterfaceTransportLevelNotAvailable = 0x06; |
|
369 |
|
370 //Source and Destination device identities are coded as follows: |
|
371 const TUint8 KKeypad = 0x01; |
|
372 const TUint8 KDisplay = 0x02; |
|
373 const TUint8 KEarpiece = 0x03; |
|
374 const TUint8 KAdditionalCardReader0 = 0x10; |
|
375 const TUint8 KAdditionalCardReader1 = 0x11; |
|
376 const TUint8 KAdditionalCardReader2 = 0x12; |
|
377 const TUint8 KAdditionalCardReader3 = 0x13; |
|
378 const TUint8 KAdditionalCardReader4 = 0x14; |
|
379 const TUint8 KAdditionalCardReader5 = 0x15; |
|
380 const TUint8 KAdditionalCardReader6 = 0x16; |
|
381 const TUint8 KAdditionalCardReader7 = 0x17; |
|
382 const TUint8 KChannel1 = 0x21; |
|
383 const TUint8 KChannel2 = 0x22; |
|
384 const TUint8 KChannel3 = 0x23; |
|
385 const TUint8 KChannel4 = 0x24; |
|
386 const TUint8 KChannel5 = 0x25; |
|
387 const TUint8 KChannel6 = 0x26; |
|
388 const TUint8 KChannel7 = 0x27; |
|
389 const TUint8 KSim = 0x81; |
|
390 const TUint8 KMe = 0x82; |
|
391 const TUint8 KNetwork = 0x83; |
|
392 |
|
393 |
|
394 // DATA TYPES |
|
395 |
|
396 // Tlv Specific Data Types |
|
397 enum TTlvSpesificDataType |
|
398 { |
|
399 ETLV_TonAndNpi, |
|
400 ETLV_DiallingNumberString, |
|
401 ETLV_AlphaIdentifier, |
|
402 ETLV_SubAddress, |
|
403 ETLV_CapabilityConfigurationParameters, |
|
404 ETLV_CellBroadcastPage, |
|
405 ETLV_CommandNumber, |
|
406 ETLV_TypeOfCommand, |
|
407 ETLV_CommandQualifier, |
|
408 ETLV_SourceDeviceIdentity, |
|
409 ETLV_DestinationDeviceIdentity, |
|
410 ETLV_TimeUnit, |
|
411 ETLV_TimeInteval, |
|
412 ETLV_IdentifierOfItem, |
|
413 ETLV_TextStringOfItem, |
|
414 ETLV_IdentifierOfItemChosen, |
|
415 ETLV_MinimumLengthOfResponse, |
|
416 ETLV_MaximumLengthOfResponse, |
|
417 ETLV_GeneralResult, |
|
418 ETLV_AdditionalInformationOnResult, |
|
419 ETLV_SmsTPdu, |
|
420 ETLV_DataCodingScheme, |
|
421 ETLV_SsOrUssdString, |
|
422 ETLV_TextString, |
|
423 ETLV_Tone, |
|
424 ETLV_UssdString, |
|
425 ETLV_NumberOfFiles, |
|
426 ETLV_Files, |
|
427 ETLV_LocationAreaCode, |
|
428 ETLV_CellIdentityValue, |
|
429 ETLV_MccAndMnc, |
|
430 ETLV_Imei, |
|
431 ETLV_NetworkMeasurementResults, |
|
432 ETLV_DefaultText, |
|
433 ETLV_ItemsNextActionIndicator, |
|
434 ETLV_EventList, |
|
435 ETLV_Cause, |
|
436 ETLV_LocationStatus, |
|
437 ETLV_TransactionIdentifier, |
|
438 ETLV_BcchChannelList, |
|
439 ETLV_IconIdentifier, |
|
440 ETLV_IconQualifier, |
|
441 ETLV_IconListQualifier, |
|
442 ETLV_IconIdentifierList, |
|
443 ETLV_CardReaderStatus, |
|
444 ETLV_CommandClassCLA, |
|
445 ETLV_CommandInstructionCodeIns, |
|
446 ETLV_P1Parameter, |
|
447 ETLV_P2Parameter, |
|
448 ETLV_Lc, |
|
449 ETLV_Data, |
|
450 ETLV_Le, |
|
451 ETLV_RApduData, |
|
452 ETLV_StatusWordSW1, |
|
453 ETLV_StatusWordSW2, |
|
454 ETLV_TimerIdentifier, |
|
455 ETLV_TimerValue, |
|
456 ETLV_DateTimeAndTimeZone, |
|
457 ETLV_AtCommand, |
|
458 ETLV_AtResponse, |
|
459 ETLV_BcRepeatIndicatorValues, |
|
460 ETLV_DtmfString, |
|
461 ETLV_Language, |
|
462 ETLV_MeStatus, |
|
463 ETLV_TimingAdvance, |
|
464 ETLV_BrowserIdentity, |
|
465 ETLV_Url, |
|
466 ETLV_ListOfBearers, |
|
467 ETLV_PathToProvisioningFile, |
|
468 ETLV_BrowserTerminationCause, |
|
469 ETLV_BearerType, |
|
470 ETLV_BearerParameters, |
|
471 ETLV_ChannelDataString, |
|
472 ETLV_ChannelDataLength, |
|
473 ETLV_BufferSize, |
|
474 ETLV_ChannelStatus, |
|
475 ETLV_IdentifierOfCardReader, |
|
476 ETLV_TypeOfAddress, |
|
477 ETLV_Address, |
|
478 ETLV_TransportProtocolType, |
|
479 ETLV_PortNumber, |
|
480 ETLV_NetworkAccessName, |
|
481 ETLV_CallControlRequestedAction, |
|
482 ETLV_Atr, |
|
483 ETLV_AID, |
|
484 ETLV_UtranMeasurementQualifier, |
|
485 ETLV_RemoteEntityAddressCoding, |
|
486 ETLV_RemoteEntityAddress |
|
487 }; |
|
488 |
|
489 |
|
490 // FORWARD DECLARATIONS |
|
491 class TIsiReceiveC; |
|
492 class CTlv; |
|
493 |
|
494 |
|
495 // CLASS DECLARATION |
|
496 /** |
|
497 * TTlvBase |
|
498 * TLV type: Tag Length Value(s) |
|
499 * Generic BER-TLV constructor class, can be used to create TLVs |
|
500 * You do not need to worry about lenghts; Example usage: |
|
501 * TTlv tlv; |
|
502 * tlv.Begin( KxxBerTag); <--- top level tag |
|
503 * tlv.AddTag( KxxxTag ) <--- simple tags |
|
504 * tlv.AddByte(...) <--- add values for this tag |
|
505 * tlv.AddByte(...) |
|
506 * .... add more simple tags and values.. |
|
507 * result = tlv.End(); <--- ends construction and returns |
|
508 * the ber-tlv |
|
509 * @lib SIMATKTSY.LIB |
|
510 * @since Series 60 Series60_2.6 |
|
511 */ |
|
512 class TTlvBase |
|
513 { |
|
514 public: // Constructor |
|
515 |
|
516 /** |
|
517 * Constructor |
|
518 * @since Series 60 Series60_2.6 |
|
519 * @param aData data to be inserted |
|
520 */ |
|
521 TTlvBase(TDes8& aData) : iLenIndex(0),iData(aData) {} |
|
522 |
|
523 public: |
|
524 |
|
525 /** |
|
526 * Begin TLV construction |
|
527 * @since Series 60 Series60_2.6 |
|
528 * @param aTag ber-tlv tag |
|
529 * @return None |
|
530 */ |
|
531 void Begin( TUint8 aTag ); |
|
532 |
|
533 /** |
|
534 * Start new simple TLV |
|
535 * @since Series 60 Series60_2.6 |
|
536 * @param aTag simple tag |
|
537 * @return None |
|
538 */ |
|
539 void AddTag( TUint8 aTag ); |
|
540 |
|
541 /** |
|
542 * Add byte value to simple TLV |
|
543 * @since Series 60 Series60_2.6 |
|
544 * @param aValue byte value |
|
545 * @return None |
|
546 */ |
|
547 void AddByte( TUint8 aValue ); |
|
548 |
|
549 /** |
|
550 * Add descriptor value to simple TLV |
|
551 * @since Series 60 Series60_2.6 |
|
552 * @param aValue descriptor value |
|
553 * @return None |
|
554 */ |
|
555 void AddData( const TDesC8& aValue ); |
|
556 |
|
557 |
|
558 /** |
|
559 * End tlv construction |
|
560 * @since Series 60 Series60_2.6 |
|
561 * @param None |
|
562 * @return TDesC8& descriptor containing BER-TLV |
|
563 */ |
|
564 const TDesC8& End(); |
|
565 |
|
566 /** |
|
567 * Return data, calculated without |
|
568 * top level tag. |
|
569 * @since Series 60 Series60_2.6 |
|
570 * @param None |
|
571 * @return TDesC8& descriptor containing BER-TLV |
|
572 */ |
|
573 const TDesC8& GetDataWithoutTopLevelTag(); |
|
574 |
|
575 |
|
576 protected: // Data |
|
577 |
|
578 TInt iLenIndex; |
|
579 TDes8& iData; |
|
580 }; |
|
581 |
|
582 /** |
|
583 * TTlvBuf |
|
584 * Type for Tag Length Value buffer. |
|
585 * Define tlv that is smaller than default max size of 255 |
|
586 * |
|
587 * @lib SIMATKTSY.LIB |
|
588 * @since Series 60 Series60_2.6 |
|
589 */ |
|
590 template <TInt S> |
|
591 class TTlvBuf : public TTlvBase |
|
592 { |
|
593 public: // Constructor |
|
594 |
|
595 /** |
|
596 * Constructor |
|
597 * @since Series 60 Series60_2.6 |
|
598 * @param iBuffer |
|
599 */ |
|
600 TTlvBuf() : TTlvBase( iBuffer ) {} |
|
601 |
|
602 private: // Data |
|
603 |
|
604 // Data buffer smaller than default maximum size of 255 |
|
605 TBuf8<S> iBuffer; |
|
606 }; |
|
607 |
|
608 /** |
|
609 * TTlv |
|
610 * Type for Tag Length Value buffer. |
|
611 * Default TLV with size of 255 |
|
612 * |
|
613 * @lib SIMATKTSY.LIB |
|
614 * @since Series 60 Series60_2.6 |
|
615 */ |
|
616 class TTlv : public TTlvBase |
|
617 { |
|
618 public: // Constructor |
|
619 |
|
620 /** |
|
621 * Constructor |
|
622 * @since Series 60 Series60_2.6 |
|
623 * @param iBuffer |
|
624 */ |
|
625 TTlv() : TTlvBase( iBuffer ) {} |
|
626 |
|
627 private: // Data |
|
628 |
|
629 // TLV must fit in APDU limits (255 bytes) |
|
630 // therefore the maximum possible TLV size is 255 |
|
631 TBuf8<255> iBuffer; |
|
632 }; |
|
633 |
|
634 /** |
|
635 * CTlvBase |
|
636 * TLV Base class. methods common for CTlv and CBerTlv |
|
637 * |
|
638 * @lib SIMATKTSY.LIB |
|
639 * @since Series 60 Series60_2.6 |
|
640 */ |
|
641 class CTlvBase : public CBase |
|
642 { |
|
643 public: |
|
644 |
|
645 /** |
|
646 * Constructor |
|
647 * @since Series 60 Series60_2.6 |
|
648 * @param iData |
|
649 */ |
|
650 CTlvBase() : iData( 0, 0 ) {} |
|
651 |
|
652 /** |
|
653 * Get pointer to TLV data |
|
654 * @since Series 60 Series60_2.6 |
|
655 * @return iData Pointer to TLV data |
|
656 */ |
|
657 TPtrC8 Data() const |
|
658 { |
|
659 return iData; |
|
660 } |
|
661 |
|
662 /** |
|
663 * Set TLV data |
|
664 * @since Series 60 Series60_2.6 |
|
665 * @param aData Data to be inserted |
|
666 * @return None |
|
667 */ |
|
668 void SetData |
|
669 ( |
|
670 TPtrC8 aData // TLV |
|
671 ) |
|
672 { |
|
673 iData.Set( aData ); |
|
674 } |
|
675 |
|
676 /** |
|
677 * Get total size, including tag |
|
678 * @since Series 60 Series60_2.6 |
|
679 * @return size |
|
680 */ |
|
681 TInt GetSize() const |
|
682 { |
|
683 return ( iData.Length() ); |
|
684 } |
|
685 |
|
686 /** |
|
687 * Get tag part of TLV |
|
688 * @since Series 60 Series60_2.6 |
|
689 * @return tag value |
|
690 */ |
|
691 TUint8 GetTag() const |
|
692 { |
|
693 return TUint8( iData[0] & KTagValueMask ); |
|
694 } |
|
695 |
|
696 /** |
|
697 * Returns true if comprehension flag is on |
|
698 * @since Series 60 Series60_2.6 |
|
699 * @return boolean |
|
700 */ |
|
701 TBool GetComprehensionRequired() const |
|
702 { |
|
703 return ( iData[0] & KTagCrMask ) ? ETrue : EFalse; |
|
704 } |
|
705 |
|
706 /** |
|
707 * Get length part of TLV |
|
708 * @since Series 60 Series60_2.6 |
|
709 * @return length |
|
710 */ |
|
711 TUint8 GetLength () const |
|
712 { |
|
713 return ( KTwoByteLengthCoding == iData[KTlvLengthStartPosition] ) ? |
|
714 iData[KTlvLengthStartPosition + 1] : |
|
715 iData[KTlvLengthStartPosition]; |
|
716 } |
|
717 |
|
718 /** |
|
719 * Get value part of TLV |
|
720 * @since Series 60 Series60_2.6 |
|
721 * @return value |
|
722 */ |
|
723 TPtrC8 GetValue() const |
|
724 { |
|
725 TInt offset = ( KTwoByteLengthCoding == iData[1] ) ? 1 : 0; |
|
726 return iData.Mid( 2+offset, iData[1+offset] ); |
|
727 } |
|
728 |
|
729 protected: // Data |
|
730 |
|
731 // Pointer to Tlv data |
|
732 TPtrC8 iData; |
|
733 }; |
|
734 |
|
735 /** |
|
736 * CBerTlv |
|
737 * CBerTlv contains methods to read BER-TLV data |
|
738 * |
|
739 * @lib SIMATKTSY.LIB |
|
740 * @since Series 60 Series60_2.6 |
|
741 */ |
|
742 class CBerTlv : public CTlvBase |
|
743 { |
|
744 |
|
745 public: // Constructor |
|
746 |
|
747 /** |
|
748 * Default constructor |
|
749 */ |
|
750 CBerTlv(); |
|
751 |
|
752 public: // New methods |
|
753 |
|
754 /** |
|
755 * Find tlv by tag value |
|
756 * @param aTlv |
|
757 * @param aTlvTagValue TlvTag |
|
758 * @param aItemNbr number of requested Tlv, default is 0 |
|
759 * @return TInt: KErrNone or KErrNotFound |
|
760 */ |
|
761 TInt TlvByTagValue( |
|
762 CTlv* aTlv, |
|
763 TUint8 aTlvTagValue, |
|
764 TInt aItemNbr = 0 ); |
|
765 |
|
766 /** |
|
767 * Find several tlvs by tag value |
|
768 * @since Series 60 Series60_2.6 |
|
769 * @param aSubBlock retruns tlvs |
|
770 * @param aSubBlockId TlvTag |
|
771 * @return TInt: KErrNone or KErrNotFound |
|
772 */ |
|
773 TInt TlvByTagValueMulti( CTlv* aTlv, TUint8 aTlvTag ); |
|
774 |
|
775 /** |
|
776 * Set ber-tlv from atk_generic_req isi-message. |
|
777 * @since NCP 5.0 |
|
778 * @param aIsiMessage ISI message |
|
779 * @return TInt: KErrNone or KErrNotFound |
|
780 */ |
|
781 TInt BerTlv( const TIsiReceiveC& aIsiMessage ); |
|
782 }; |
|
783 |
|
784 /** |
|
785 * CTlv |
|
786 * CTlv contains methods to read simple TLV data |
|
787 * |
|
788 * @lib SIMATKTSY.LIB |
|
789 * @since Series 60 Series60_2.6 |
|
790 */ |
|
791 class CTlv : public CTlvBase |
|
792 { |
|
793 public: // Constructor |
|
794 |
|
795 /** |
|
796 * Default constructor |
|
797 */ |
|
798 CTlv(); |
|
799 |
|
800 public: // New methods |
|
801 |
|
802 /** |
|
803 * Returns short info defined by aType. |
|
804 * @since Series 60 Series60_2.6 |
|
805 * TAtkSpesificDataType aType: wanted data type. |
|
806 * @return TUint8: wanted data. |
|
807 */ |
|
808 TUint8 GetShortInfo( TTlvSpesificDataType aType ); |
|
809 |
|
810 /** |
|
811 * Returns the Data defined by aType. Index and length of the |
|
812 * data depends on data type. |
|
813 * @since Series 60 Series60_2.6 |
|
814 * @param TAtkSpesificDataType aType: data type. |
|
815 * @return TptrC8: pointer to the data. |
|
816 */ |
|
817 TPtrC8 GetData( TTlvSpesificDataType aType ); |
|
818 |
|
819 /** |
|
820 * Returns long info by aType. |
|
821 * @since Series 60 Series60_2.6 |
|
822 * @param TAtkSpesificDataType aType: data type. |
|
823 * @return TUint8: returned data |
|
824 */ |
|
825 TUint16 GetLongInfo( TTlvSpesificDataType aType ); |
|
826 }; |
|
827 |
|
828 #endif // BER_TLV_H |
|
829 |
|
830 // End of File |