public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
278 stars 54 forks source link

journeys: supporting opt.changeTimePercent and opt.accessibility #87

Closed plSln closed 6 years ago

plSln commented 6 years ago

Hey, as described in this document: https://www.bmvi.de/SharedDocs/DE/Anlage/DG/hafas-rest-api.pdf?__blob=publicationFile , there should exist a "changeTimePercent"-Parameter.

Can you tell me, where I can add more optional parameters?

Thank you!

derhuerst commented 6 years ago

You have posted the docs of the HAFAS (open) REST API, whereas hafas-client talks to the mobile HAFAS API (the URL ends in mgate.exe).

So it may be that changeTimePercent

Where in the document is it documented?

plSln commented 6 years ago

Thanks for helping! Oh okay, i didnt see through these endpoints yet. It's documented at page 13, just search for: changeTimePer- cent . bildschirmfoto 2018-10-25 um 10 41 07

derhuerst commented 6 years ago

I will have a look at wether the mgate.exe endpoint supports it.

derhuerst commented 6 years ago

I've tried to just pass changeTimePercent to the mgate.exe endpoint. It doesn't seem to be supported, at least with this name, but maybe with a different one.

You bring this forward by finding a iOS or Android HAFAS app that supports it in the UI (check this incomplete iOS list, or search for "fahrinfo" in the App Store). I can then analyse MITM its traffic and find the name of the option.

plSln commented 6 years ago

Hey, I've found 2 apps which supports that parameter: the BVG Fahrtinfo and the Nürnberg Fahrtinfo App. img_46d353756563-1 img_0736

It's the configuration : "Gehgeschwindigkeit" , but I'm interested in the "Barrierefreiheit" parameter too. Does that help you?

derhuerst commented 6 years ago

I've found 2 apps which supports that parameter: the BVG Fahrtinfo [...]

Thanks, totally missed that even though I live in Berlin! Do you want to help implement this? I can tell you how. 😉 If not, I will do it.

[...] I'm interested in the "Barrierefreiheit" parameter too.

Theoretically hafas-client supports the accessibility parameter via opt.accessibility, but there are no tests that verify that it works, and I haven't used it in a while. So please have a look if it works according to your expectations (keep in mind that HAFAS itself is not very smart regarding accessibility).

plSln commented 6 years ago

Hey, I would really like to help you! The more important feature is changeTimePercent for me, so i would take a look at accessibility later.

derhuerst commented 6 years ago

I would really like to help you!

Thanks. I usually try to enable contributors as much as possible, in order to have a more open open source project, and in order to reduce my work.

Are you familiar with MITMing apps? The guide on writing a new profile explains how to do it.

  1. Try to send a request with the default value of "Gehgeschwindigkeit", and one with a non-default value.
  2. Compare the two requests to find the additional/changed parameter.
  3. If you succeeded, you can also submit a PR if you want (otherwise just post your findings here). The relevant place to add it is in `index.js.
plSln commented 6 years ago

nice quick tutorial, I've got in to it really quick! I've did some research and found out, that the parameter is named "gisFltrL". default: gisFltrL: [{meta: "foot_speed_normal" , mode: "FB", type: "M"}] fast: gisFltrL: [{meta: "foot_speed_fast" , mode: "FB", type: "M"}] slow: gisFltrL: [{meta: "foot_speed_slow" , mode: "FB", type: "M"}]

In the BVG App it has the effect I'm looking for, so I need 2 minutes longer for 300m, if I select slow walking. So I've tested it with 2 locations in Dresden, where I'm living and it has no effect, I need the same time, no matter what I select. Is behavior like this possible? So that parameters only working for a specific area?

derhuerst commented 6 years ago

I've did some research and found out, that the parameter is named gisFltrL.

  • default: gisFltrL: [{meta: "foot_speed_normal" , mode: "FB", type: "M"}]
  • fast: gisFltrL: [{meta: "foot_speed_fast" , mode: "FB", type: "M"}]
  • slow: gisFltrL: [{meta: "foot_speed_slow" , mode: "FB", type: "M"}]

Thanks! Do you want to PR or shall I implement it?

So I've tested it with 2 locations in Dresden, where I'm living and it has no effect, I need the same time, no matter what I select. Is behavior like this possible? So that parameters only working for a specific area?

We will try to force a connection that one can barely reach with fast walking speed, but can't reach with slow walking, and then assert that the computed connections are different.

plSln commented 6 years ago

I've created a PR.