KDE PIM/KItinerary/ZSSK Barcode: Difference between revisions
< KDE PIM | KItinerary
Line 34: | Line 34: | ||
* 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. | * 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. | * class information is either provided as "[1|2].tr." ("trieda" is class) or "*" if there is no class. | ||
* network tickets (area-wide time-limited flat rate tickets), "SIEŤOVÝ", omit lines 28 and 29 | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 58: | Line 59: | ||
| 9 || date/time || departure time || | | 9 || date/time || departure time || | ||
|- | |- | ||
| 10 || date/time || end of validity | | 10 || date/time || end of validity || | ||
|- | |- | ||
| 11 || string || passenger name || | | 11 || string || passenger name || | ||
Line 68: | Line 69: | ||
| 14 || ? || ? || empty in all samples | | 14 || ? || ? || empty in all samples | ||
|- | |- | ||
| 15 || | | 15 || string || ? || set for network tickets? alpha-numeric id shown in the PDF below the passenger name | ||
|- | |- | ||
| 16 || ? || ? || empty in all samples | | 16 || ? || ? || empty in all samples | ||
Line 76: | Line 77: | ||
| 18 || ? || ? || 0 in all samples | | 18 || ? || ? || 0 in all samples | ||
|- | |- | ||
| 19 || date/time || ? || | | 19 || date/time || ? || can be 0 | ||
|- | |- | ||
| 20 || 7 digit number || discount program membership number || | | 20 || 7 digit number || discount program membership number || | ||
Line 88: | Line 89: | ||
| 24 || string || ticket name/title || e.g. "CESTOVNÝ LÍSTOK" | | 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 | | 25 || <string>": "<digit> || tariff name? || e.g. "OBYČAJNÝ" (ordinary), "KLASIK" 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) | | 26 || string || ticket type? || e.g. "JEDNOSMERNÁ CESTA" (one way) or SIEŤOVÝ (network ticket) | ||
|- | |- | ||
| 27 || ? || ? || empty in all samples | | 27 || ? || ? || empty in all samples | ||
|- | |- | ||
| 28 || "Z: "<string> || departure station name || | | 28 || "Z: "<string> || departure station name || omitted in network tickets (the below fields move up) | ||
|- | |- | ||
| 29 || "Do: "<string> || arrival station name || | | 29 || "Do: "<string> || arrival station name || omitted in network tickets (the below fields move up) | ||
|- | |- | ||
| 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 | | 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; similar for network tickets, but without the "Km: <number>" prefix | ||
|- | |- | ||
| 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, "9999" for network tickets | ||
|- | |- | ||
| 32 || ? || ? || empty in all samples | | 32 || ? || ? || empty in all samples |
Revision as of 15:49, 17 August 2023
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.
- network tickets (area-wide time-limited flat rate tickets), "SIEŤOVÝ", omit lines 28 and 29
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 | |
11 | string | passenger name | |
12 | ? | ? | 0 in all samples |
13 | ? | ? | empty in all samples |
14 | ? | ? | empty in all samples |
15 | string | ? | set for network tickets? alpha-numeric id shown in the PDF below the passenger name |
16 | ? | ? | empty in all samples |
17 | 1-3 digit number | ? | empty for bicycle addon tickets |
18 | ? | ? | 0 in all samples |
19 | date/time | ? | can be 0 |
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), "KLASIK" 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) or SIEŤOVÝ (network ticket) |
27 | ? | ? | empty in all samples |
28 | "Z: "<string> | departure station name | omitted in network tickets (the below fields move up) |
29 | "Do: "<string> | arrival station name | omitted in network tickets (the below fields move up) |
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; similar for network tickets, but without the "Km: <number>" prefix |
31 | "Vlak: "<number>["Vozeň: "<number>" Miesto: "<number>] | train/coach/seat numbers | coach/seat numbers are optional, "9999" for network tickets |
32 | ? | ? | empty in all samples |
33 | ? | ? | empty in all samples |