Skip to main content

Class: TrafficInstrument

Defined in: src/sdk/instruments/Traffic.ts:133

Tracks aircraft traffic. Maintains a list of contacts, periodically updates their position, altitude, and reported heading, and uses these data to compute ground speed, ground track, and vertical speed.

Requires the topics defined in ClockEvents to be published to the event bus.

Implements​

Constructors​

Constructor​

new TrafficInstrument(bus, options): TrafficInstrument

Defined in: src/sdk/instruments/Traffic.ts:162

Creates a new instance of TrafficInstrument.

Parameters​

ParameterTypeDescription
busEventBusThe event bus.
optionsReadonly<TrafficInstrumentOptions>Options with which to configure this instrument.

Returns​

TrafficInstrument

Methods​

forEachContact()​

forEachContact(visitor): void

Defined in: src/sdk/instruments/Traffic.ts:214

Iterates through all tracked traffic contacts with a visitor function.

Parameters​

ParameterTypeDescription
visitor(contact) => voidA visitor function.

Returns​

void


getContact()​

getContact(uid): TrafficContact | undefined

Defined in: src/sdk/instruments/Traffic.ts:206

Retrieves a traffic contact by its assigned ID number.

Parameters​

ParameterTypeDescription
uidnumberan ID number.

Returns​

TrafficContact | undefined

the traffic contact with the assigned ID number, or undefined if no such contact exists.


init()​

init(): void

Defined in: src/sdk/instruments/Traffic.ts:222

Initializes this instrument. Once initialized, this instrument will automatically track and update traffic contacts. Initialization is asynchronous and is not guaranteed to have completed by the time this method returns.

Returns​

void

Implementation of​

Instrument.init


onUpdate()​

onUpdate(): void

Defined in: src/sdk/instruments/Traffic.ts:322

This method does nothing.

Returns​

void

Implementation of​

Instrument.onUpdate