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
Attachment | Size | Date |
---|---|---|
![]() | 157.96 KB | 06/12/2019 - 03:38 |
![]() | 157.52 KB | 05/12/2019 - 21:14 |
![]() | 157.39 KB | 03/12/2019 - 02:30 |
![]() | 156.88 KB | 30/11/2019 - 18:40 |
![]() | 136.74 KB | 26/11/2019 - 04:12 |
![]() | 131.09 KB | 24/11/2019 - 23:20 |
![]() | 130.3 KB | 23/11/2019 - 03:06 |
Comments
mugshot
Sat, 2019/11/23 - 22:28
Permalink
Additionally, is there any chance to implement the HSL tickets? Is it included in the open API?
slava
Sat, 2019/11/23 - 22:37
Permalink
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
Sat, 2019/11/23 - 22:47
Permalink
I was actually referring to buying a new ticket.
slava
Sat, 2019/11/23 - 23:54
Permalink
That's unlikely.
mugshot
Sun, 2019/11/24 - 11:52
Permalink
Ok. Is it supported by the HSL API, do you know? If "someone" likes and knows how to implement it.. :P
slava
Sun, 2019/11/24 - 14:38
Permalink
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
Sun, 2019/11/24 - 19:37
Permalink
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
Sat, 2019/11/23 - 13:35
Permalink
With XA2 Plus Dual SIM works fine.
mugshot
Sat, 2019/11/23 - 13:48
Permalink
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
Sat, 2019/11/23 - 14:56
Permalink
Fixed the link, thanks!
slava
Sat, 2019/11/23 - 14:50
Permalink
What if you try with charger connected?
mugshot
Sat, 2019/11/23 - 16:52
Permalink
Yep, that worked!
slava
Sat, 2019/11/23 - 17:13
Permalink
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
Tue, 2019/11/26 - 13:08
Permalink
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
Sat, 2019/11/23 - 22:26
Permalink
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
Sat, 2019/11/23 - 18:30
Permalink
That sounds like a firmware issue. I'd suggest you create a question over at TJC about this.
slava
Sat, 2019/11/23 - 17:30
Permalink
If somebody has any idea what this 0x01/0x23 thing is, please contact me!
TheJullus
Sat, 2019/11/23 - 13:04
Permalink
Love to see the first native app to use NFC for something useful. The app works well. Great work! (on XA2 Dual SIM)