mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
HVV profile
This commit is contained in:
parent
b3d75b567d
commit
3ab099b8e7
4 changed files with 144 additions and 0 deletions
33
p/hvv/index.js
Normal file
33
p/hvv/index.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict'
|
||||
|
||||
const products = require('./products')
|
||||
|
||||
const transformReqBody = (body) => {
|
||||
body.client = {type: 'AND', id: 'HVV', name: 'HVVPROD_ADHOC', v: '4020100'}
|
||||
body.ext = 'HVV.1'
|
||||
body.ver = '1.16'
|
||||
body.auth = {type: 'AID', aid: 'andcXUmC9Mq6hjrwDIGd2l3oiaMrTUzyH'}
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
const hvvProfile = {
|
||||
locale: 'de-DE',
|
||||
timezone: 'Europe/Berlin',
|
||||
endpoint: 'https://hvv-app.hafas.de/bin/mgate.exe',
|
||||
|
||||
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
|
||||
salt: Buffer.from('pqjM3iKEGOAhYbX76k9R5zutv', 'utf-8'),
|
||||
addMicMac: true,
|
||||
|
||||
transformReqBody,
|
||||
|
||||
products,
|
||||
|
||||
trip: true,
|
||||
radar: true,
|
||||
refreshJourney: true,
|
||||
reachableFrom: true
|
||||
}
|
||||
|
||||
module.exports = hvvProfile
|
92
p/hvv/products.js
Normal file
92
p/hvv/products.js
Normal file
|
@ -0,0 +1,92 @@
|
|||
'use strict'
|
||||
|
||||
module.exports = [ // todo: what is `512`?
|
||||
{
|
||||
id: 'subway',
|
||||
mode: 'train',
|
||||
bitmasks: [1],
|
||||
name: 'U-Bahn',
|
||||
short: 'U',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'suburban',
|
||||
mode: 'train',
|
||||
bitmasks: [2],
|
||||
name: 'S-Bahn',
|
||||
short: 'S',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'akn',
|
||||
mode: 'train',
|
||||
bitmasks: [4],
|
||||
name: 'AKN',
|
||||
short: 'A',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'regional-express-train',
|
||||
mode: 'train',
|
||||
bitmasks: [8],
|
||||
name: 'RegionalExpress',
|
||||
short: 'RE',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'regional-train',
|
||||
mode: 'train',
|
||||
bitmasks: [16],
|
||||
name: 'Regionalbahn',
|
||||
short: 'RB',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'ferry',
|
||||
mode: 'watercraft',
|
||||
bitmasks: [32],
|
||||
name: 'Fähre',
|
||||
short: 'F',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'bus',
|
||||
mode: 'bus',
|
||||
bitmasks: [128],
|
||||
name: 'Bus',
|
||||
short: 'Bus',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'express-bus',
|
||||
mode: 'bus',
|
||||
bitmasks: [256],
|
||||
name: 'Schnellbus',
|
||||
short: 'Schnellbus',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'anruf-sammel-taxi',
|
||||
mode: null, // todo
|
||||
bitmasks: [1024],
|
||||
name: 'Anruf-Sammel-Taxi',
|
||||
short: 'AST',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'long-distance-train',
|
||||
mode: 'train',
|
||||
bitmasks: [4096, 64],
|
||||
name: 'Fernzug',
|
||||
short: 'ICE/IC/EC/EN',
|
||||
default: false
|
||||
},
|
||||
{
|
||||
id: 'long-distance-bus',
|
||||
mode: 'bus',
|
||||
bitmasks: [2048],
|
||||
name: 'Fernbus',
|
||||
short: 'Fernbus',
|
||||
default: false
|
||||
}
|
||||
]
|
18
p/hvv/readme.md
Normal file
18
p/hvv/readme.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# HVV profile for `hafas-client`
|
||||
|
||||
[*Hamburger Verkehrsverbund (HVV)*](https://en.wikipedia.org/wiki/Hamburger_Verkehrsverbund) is the major local transport provider in [Hamburg](https://en.wikipedia.org/wiki/Hamburg). This profile adds *HVV*-specific customizations to `hafas-client`.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const createClient = require('hafas-client')
|
||||
const hvvProfile = require('hafas-client/p/hvv')
|
||||
|
||||
// create a client with HVV profile
|
||||
const client = createClient(hvvProfile, 'my-awesome-program')
|
||||
```
|
||||
|
||||
|
||||
## Customisations
|
||||
|
||||
- parses *HVV*-specific products (such as *AKN*)
|
|
@ -14,6 +14,7 @@ HAFAS endpoint | wrapper library | docs | example code | source code
|
|||
[*S-Bahn München*](https://en.wikipedia.org/wiki/Munich_S-Bahn) | - | [docs](p/sbahn-muenchen/readme.md) | [example code](p/sbahn-muenchen/example.js) | [src](p/sbahn-muenchen/index.js)
|
||||
*Saarfahrplan*/VGS ([Saarland](https://en.wikipedia.org/wiki/Saarland)) | - | [docs](p/saarfahrplan/readme.md) | [example code](p/saarfahrplan/example.js) | [src](p/saarfahrplan/index.js)
|
||||
[Société Nationale des Chemins de Fer Luxembourgeois (CFL)](https://en.wikipedia.org/wiki/Société_Nationale_des_Chemins_de_Fer_Luxembourgeois) | - | [docs](p/cfl/readme.md) | [example code](p/cfl/example.js) | [src](p/cfl/index.js)
|
||||
[Hamburg public transport (HVV)](https://en.wikipedia.org/wiki/Hamburger_Verkehrsverbund) | - | [docs](p/hvv/readme.md) | [example code](p/hvv/example.js) | [src](p/hvv/index.js)
|
||||
|
||||
There are also client libraries that use the library, but contain their own customisations:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue