KDE PIM/KItinerary/ZSSK Barcode: Difference between revisions

From KDE Community Wiki
Line 98: Line 98:
| 29 || "Do: "<string> || arrival station name ||
| 29 || "Do: "<string> || arrival station name ||
|-
|-
| 30 || "Km: "<number>" "("NO","ŽTO")"-"<string>"-"<class> || distance?/train type/class || train type is e.g. "R", "REX", "IC"; "NO" seen on tickets for people, "ŽTO" for tickets for bicycles; omitted in tickets with less than 34 lines
| 30 || "Km: "<number>" "("NO","ŽTO")"-"<string>"-"<class> || distance?/train type/class || train type is e.g. "R", "REX", "IC"; "NO" seen on tickets for people, "ŽTO" for tickets for bicycles or extra bags; omitted in tickets with less than 34 lines
|-
|-
| 31 || "Vlak: "<number>["Vozeň: "<number>" Miesto: "<number>] || train/coach/seat numbers || coach/seat numbers are optional
| 31 || "Vlak: "<number>["Vozeň: "<number>" Miesto: "<number>] || train/coach/seat numbers || coach/seat numbers are optional

Revision as of 15:59, 28 June 2022

Domestic Ticket

General Observation

  • Aztec barcode, in PDF or image
  • Variable length
  • For domestic tickets only, international ones use RCT2 in UIC 918.3 container
  • zlib compressed textual payload starting at offset 3.
  • zlib decompressed content is plain text and hardly larger than the full compressed data, which suggests the compressed data doesn't span the full length of the barcode (signature?).

Binary Structure

Offset Format Meaning Notes
0 0x04 ? fixed value
1-2 16 bit BE ? varies with length?
3-4 0x78 0x9C zlib marker
5+ zlib see below
? ? ? high entropy data, signature?
-16 0x00 ? last 16 bytes are always 0x00

Textual Payload Structure

  • 32-34 lines, delimited by 0x0A
  • if there are less than 32 lines, line 30 (and possibly 32 or 33) are omitted.
  • strings are UTF-8 encoded
  • date/time format: 8 digits, the first 4 digits are the days since 2009-01-01, the last four are the time in "hhmm" format. Local time/no timezone.
  • class information is either provided as "[1|2].tr." ("trieda" is class) or "*" if there is no class.
Index Format Meaning Notes
0 "P" fixed value
1 16 digit number ticket number
2 6-8 digit number ?
3 N.NN ticket price in EUR
4 N.NN price? 0.00 in all samples
5 N.NN price? 0.00 in all samples
6 string departure station name
7 string arrival station name
8 <number>"["<class>"]" train number and class
9 date/time departure time
10 date/time end of validity? this is encoded with one day more than printed in the PDF?
11 string passenger name
12 ? ? 0 in all samples
13 ? ? empty in all samples
14 ? ? empty in all samples
15 ? ? empty in all samples
16 ? ? empty in all samples
17 1-3 digit number ? empty for bicycle addon tickets
18 ? ? 0 in all samples
19 date/time ? ?
20 7 digit number discount program membership number
21 7 digit number ? can be empty, possibly related to the discount program?
22 "N" fixed value
23 "text" fixed value
24 string ticket name/title e.g. "CESTOVNÝ LÍSTOK"
25 <string>": "<digit> tariff name? e.g. "OBYČAJNÝ" (ordinary) or "KLASIK RP" (discount program), digit is 1 in all samples; both fields can be empty e.g. for bicycle addon tickets
26 string ticket type? e.g. "JEDNOSMERNÁ CESTA" (one way)
27 ? ? empty in all samples
28 "Z: "<string> departure station name
29 "Do: "<string> arrival station name
30 "Km: "<number>" "("NO","ŽTO")"-"<string>"-"<class> distance?/train type/class train type is e.g. "R", "REX", "IC"; "NO" seen on tickets for people, "ŽTO" for tickets for bicycles or extra bags; omitted in tickets with less than 34 lines
31 "Vlak: "<number>["Vozeň: "<number>" Miesto: "<number>] train/coach/seat numbers coach/seat numbers are optional
32 ? ? empty in all samples
33 ? ? empty in all samples