Instead of using regular expressions on the pdf, extract the coach from the barcode that is stored as a 4 bit unsigned int in bits 30:6-31:1
Details
Diff Detail
- Repository
- R1003 KItinerary: Travel Reservation handling library
- Branch
- trenitalia_coach_number (branched from master)
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 16308 Build 16326: arc lint + arc unit
From all the samples that I was able to find, the only ones that do not match are the ones in Coach "11", where this area contains "1". All the other barcodes match. I think this could correspond to the less significant digit, and that the most significant one might be encoded somewhere else. I don't think there is any train that has more that 19 coaches, therefore this digit could be encoded in just one bit. I have a candidate (30:4), this matches with all my samples, but I don't have enough 2-digits-coach ticket to validate this hypothesis. Also I could not understand the meaning of bit 30:5 (that would be between the most significant digit and the last one)
Retried this with more samples: using 30:4 or even 30:3-30:4 for the second digit of the coach number on top of this yields correct results. However, this would mean coach number 9 cannot be represented, which seems very weird. 30:5 would be the natural place for that, but that's '1' for most of my small coach number samples.