Socket
Book a DemoInstallSign in
Socket

mode-s-aircraft-store

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mode-s-aircraft-store

A utility library for keeping track of active aircrafts and their position based on their Mode S messages

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

mode-s-aircraft-store

A utility library for keeping track of active aircrafts and their position based on their Mode S messages as decoded by mode-s-decoder.

Mode S is an aviation transponder interrogation mode used by Secondary Surveillance Radar (SSR) and Automatic Dependent Surveillance-Broadcast (ADS-B) systems.

For an example of this module in use, see AirplaneJS.

Build status js-standard-style

Installation

npm install mode-s-aircraft-store --save

Usage

const AircraftStore = require('mode-s-aircraft-store')

const store = new AircraftStore({
  timeout: 120000 // remove airplane from store if we haven't seen it for 2 minutes
})

// Add a Mode S message to the store.
// `message` is a decoded Mode S message generated by the mode-s-decoder module.
store.addMessage(message)

store.getAircrafts().forEach(function (aircraft) {
  console.log('Aircraft:\n' +
    `  ID: ${aircraft.icao}\n` +
    `  Altitude: ${aircraft.altitude}\n` +
    `  Speed: ${aircraft.speed}\n` +
    `  Heading: ${aircraft.heading}\n` +
    `  Latitude: ${aircraft.lat}\n` +
    `  Longitude: ${aircraft.lng}\n`)
})

API

store = new AircraftStore([options])

Initialize an AircraftStore instance.

Arguments:

  • options - An optional options object

The following options are available:

  • timeout - The number of milliseconds before an aircraft is removed from the store if no message from it have been seen (default: 120000)

store.addMessage(message)

Add a new message to the store.

The message must be a decoded Mode S message received in detect callback from the mode-s-decoder module.

aircrafts = store.getAircrafts()

Return an array of aircrafts currently in the store.

Each aircraft have the following properties:

  • icao - The aircraft ICAO identifier
  • count - The total number of messages received by this aircraft
  • seen - Timestamp of when the last message of this aircraft was seen (in number of milliseconds elapsed since 1 January 1970 00:00:00 UTC)
  • callsign - The aircraft callsign
  • altitude - The aircraft altitude
  • unit - The aircraft altitude unit. Use Decoder.UNIT_FEET and Decoder.UNIT_METERS from the mode-s-decoder module to determine the correct type
  • speed - The aircraft speed
  • heading - The aircraft heading
  • lat - The aircraft latitude
  • lng - The aircraft longitude

License

MIT

Keywords

modes

FAQs

Package last updated on 11 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts