wifi-on-ice-position-stream

1.0.1 • Public • Published

wifi-on-ice-position-stream

A stream of ICE positions, taken from the on-board WiFi.

npm version ISC-licensed support me via GitHub Sponsors chat with me on Twitter

Installation

npm install wifi-on-ice-position-stream

Usage

const createStream = require('wifi-on-ice-position-stream')

const positions = createStream()
positions.once('data', (position) => {
	console.log(position)
	positions.destroy()
})

createStream() returns a readable stream in object mode.

Each position/chunk is in the format of wifi-on-ice-portal-client with an additional clientTime field:

{
	ok: true,
	speed: 245,
	gpsOk: true,
	latitude: 51.86973533333333,
	longitude: 9.989614166666666,
	servicelevel: 'AVAILABLE_SERVICE',
	wagonClass: 'FIRST',
	serverTime: 1504698041985,
	clientTime: 1504698041872
}

You may pass these options to createStream(opt):

  • interval – How often to fetch the current position from the on-board WiFi, in milliseconds. Default: 5000
  • endOnTrainChange – End the stream as soon as the Triebzugnummer reported by the on-board WiFi changes, e.g. when your client accidentally connects to the WiFi of a different train. Default: true

Related

Contributing

If you have a question or have difficulties using wifi-on-ice-position-stream, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.

Package Sidebar

Install

npm i wifi-on-ice-position-stream

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

5.25 kB

Total Files

4

Last publish

Collaborators

  • derhuerst