Home Reference Source Repository
public class | source

Station

Extends:

events~EventEmitter → Station

Handles everything a Station should. Brings Serial, data parsing, database saving and the backend connection together.

Constructor Summary

Public Constructor
public

Sets up all relevant class instances (Serial, parsers...) and events listeners.

Member Summary

Public Members
public

Backend connector instance.

public

Classifier instance.

public

db: PouchDB

Database instance, internal to the station.

public

logDB: PouchDB

Log database instance, internal to the station.

public

Name/ID of the station

public

Serial instance with the parser attached.

Private Members
private

_log: Bunyan

Logger instance.

Method Summary

Public Methods
public

Cleanup function to be run before exiting.

public

Returns a list of available serialports and tries to find which ones are the T-Minus transceiver (sets [portInfo].recommend to true) and sorts them with recommended ones first.

Public Constructors

public constructor(name: String) source

Sets up all relevant class instances (Serial, parsers...) and events listeners.

Params:

NameTypeAttributeDescription
name String

Station name.

Public Members

public backend: Backend source

Backend connector instance.

public classifier: Classifier source

Classifier instance.

public db: PouchDB source

Database instance, internal to the station.

public logDB: PouchDB source

Log database instance, internal to the station.

public name: String source

Name/ID of the station

public serial: Serial source

Serial instance with the parser attached.

Private Members

private _log: Bunyan source

Logger instance.

Public Methods

public cleanup(): Promise source

Cleanup function to be run before exiting. Closes the serialport and runs Backend#cleanup.

Return:

Promise

Promise that completes when all is clean.

public getAvailablePorts(): Promise<Array> source

Returns a list of available serialports and tries to find which ones are the T-Minus transceiver (sets [portInfo].recommend to true) and sorts them with recommended ones first.

Return:

Promise<Array>

List of serialports.