Matkakortti

Rating: 
4.857145
Your rating: None Average: 4.9 (7 votes)

Application for reading new HSL travel cards.

You only need this app if you have an HSL (Helsinki Region Transport) travel card.

Requires NFC support. Tested on Sony Xperia XA2 and Xperia 10.

Source code: https://github.com/monich/harbour-matkakortti

Screenshots: 

Keywords:

Application versions: 
AttachmentSizeDate
File harbour-matkakortti-1.0.6-14.1.armv7hl.rpm157.96 KB06/12/2019 - 03:38
File harbour-matkakortti-1.0.5-13.1.armv7hl.rpm157.52 KB05/12/2019 - 21:14
File harbour-matkakortti-1.0.4-12.1.armv7hl.rpm157.39 KB03/12/2019 - 02:30
File harbour-matkakortti-1.0.3-11.1.armv7hl.rpm156.88 KB30/11/2019 - 18:40
File harbour-matkakortti-1.0.2-10.1.armv7hl.rpm136.74 KB26/11/2019 - 04:12
File harbour-matkakortti-1.0.1-8.1.armv7hl.rpm131.09 KB24/11/2019 - 23:20
File harbour-matkakortti-1.0.0-7.1.armv7hl.rpm130.3 KB23/11/2019 - 03:06
Changelog: 
  • 1.0.6 (Dec 6 2019)
    - Mark group tickets in the history tab
    - Fixed system time change detection
  • 1.0.5 (Dec 5 2019)
    - Fixed total price for group tickets
  • 1.0.4 (Dec 2 2019)
    - Polish translation
  • 1.0.3 (Nov 30 2019)
    - Redesigned cover
    - Swedish translation
    - Chinese translation
  • 1.0.2 (Nov 26 2019)
    - Added journey history
    - Fixed Finnish translation
  • 1.0.1 (Nov 24 2019)
    - Fixed multi-zone mapping
  • 1.0.0 (Nov 23 2019)
    - Initial version

Comments

mugshot's picture

Additionally, is there any chance to implement the HSL tickets? Is it included in the open API?

slava's picture

If you mean the purchase history - yes, I'm planning to add it too. It's there, on the card, it's just a matter of parsing and displaying it. And yes, its format is documented too (pleasant surprise).

mugshot's picture

I was actually referring to buying a new ticket.

slava's picture

That's unlikely.

mugshot's picture

Ok. Is it supported by the HSL API, do you know? If "someone" likes and knows how to implement it.. :P

slava's picture

If you mean changing the contents of the card, that must involve use of authentication keys built into validators and devices in R-kioski or wherever you put money on it. I find it hard to imagine that the card would allow to modify its contents without any sort of authorization. On top of that, such a communication should be encrypted (and most likely is, if the guys who designed it, knew what they were doing) to prevent OTA interception of the keys.

AFAICT Oma Matkakortti android app doesn't update the card. If it did, it would be possible to decompile it and pull keys, APDUs or whatever out of it.

And no, there's nothing about it in that piece of documentation which I found on github. I also saw something on the HSL web side, describing the general architecture of the payment system, but I haven't really read it because my Finnish is not particularly good and I did't feel motivated enough to run it through Google trunslate.

If you mean buying tickets over the Internet, it's too boring, I wouldn't bother implementing that :)

mugshot's picture

Ah, not adding value to the card, but similar as the HSL Matkakortti Android App has, the abitily build a single ticket that's either charged from the mobile bill or credit card. HSL hasn't even implemented online balance yet (for example Turku has had it for over a decade), so no high hopes there.. :D
I can check if I find something regarding this from their documentation - unfortunately I can't help with the coding because of total lack of skills. :P

edit: This ticket API, https://sales-api.hsl.fi/
Note: Use of the HSL OpenMaaS API is free of charge.

jokureiska's picture

With XA2 Plus Dual SIM works fine.

mugshot's picture

For some reason it doesn't work on my XA2 (H4113). It does recognize the NFC state, but doesn't read my HSL card. And no errors in terminal either.
Edit: Also, github link goes to qrshare github. ☺

slava's picture

Fixed the link, thanks!

slava's picture

What if you try with charger connected?

mugshot's picture

Yep, that worked!

slava's picture

There's a problem with NFC on XA2 - it stops working when the battery charge falls below certain level (60% or so) and no charger is connected. NFC chip starts sending misterios notifications with GID=0x01 (RF Management) and OID=0x23 (there's no such OID in NCI spec). Since the documentation on the NFC chip (AFAICT it's pn553) is not publicly available, it's not possible to tell how to ask the chip to keep working :(

martonmiklos's picture

You are correct PN553E2EV is the NFC chip used in the XA2. Schematic is public for XA2: https://fccid.io/PY7-67442A/Schematics/Schematics-20171116-v1-PY7-67442A... thanks to the lazy Sony engineers who forgot to fill the FCC Confidentality request!

By looking the publicly available datasheet it has a 80C51 with builtin ROM.

 

It might be useful to peek through the HAL layers of these repositories looking for the 0x23 values:

https://github.com/NXPNFCProject

mugshot's picture

Ok, thanks for the info. Usually for me it's enough to check the balance at home before I take the train, so now that I know about the battery level issue I think I can live with it. :)

direc85's picture

That sounds like a firmware issue. I'd suggest you create a question over at TJC about this.

slava's picture

If somebody has any idea what this 0x01/0x23 thing is, please contact me!

TheJullus's picture

Love to see the first native app to use NFC for something useful. The app works well. Great work! (on XA2 Dual SIM)