# mode-s-aircraft-store

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

Latest version **1.0.1** (published 2017-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install mode-s-aircraft-store
pnpm add mode-s-aircraft-store
yarn add mode-s-aircraft-store
bun add mode-s-aircraft-store
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-12-11 |
| First published | 2017-12-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Thomas Watson |
| Maintainers | watson |
| Keywords | modes, mode-s, adsb, ads-b, sdr, rtlsdr, rtl-sdr, librtlsdr, radio, aircraft, airplane, airplanes, plane, 1090, 1090mhz |

## Links

- npm: https://www.npmjs.com/package/mode-s-aircraft-store
- Repository: https://github.com/watson/mode-s-aircraft-store
- Homepage: https://github.com/watson/mode-s-aircraft-store#readme
- Issues: https://github.com/watson/mode-s-aircraft-store/issues
- npm.io page: https://npm.io/package/mode-s-aircraft-store

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-12-11
- 1.0.0 — 2017-12-10

## README

# 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](https://github.com/watson/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](https://github.com/watson/airplanejs).

[![Build status](https://travis-ci.org/watson/mode-s-aircraft-store.svg?branch=master)](https://travis-ci.org/watson/mode-s-aircraft-store)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

## Installation

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

## Usage

```js
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](https://github.com/watson/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

---
_Source: https://npm.io/package/mode-s-aircraft-store · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
