Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

msfs-simconnect-api-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msfs-simconnect-api-wrapper - npm Package Compare versions

Comparing version 2.0.0 to 2.0.2

4

CHANGELOG.md

@@ -0,1 +1,5 @@

v2.0.1
- fix exception on repeated airport:index calls.
v2.0.0

@@ -2,0 +6,0 @@

2

package.json
{
"name": "msfs-simconnect-api-wrapper",
"version": "2.0.0",
"version": "2.0.2",
"description": "A convenient SimConnect API for playing with Microsoft Flight Simulator 2020",

@@ -5,0 +5,0 @@ "main": "msfs-api.js",

@@ -134,26 +134,59 @@ /**

const SIMCONNECT_FACILITY_AIRPORT = 1000;
const AIRPORT_TYPE = SIMCONNECT_FACILITY_LIST_TYPE_AIRPORT;
function addAirportHandling(api) {
const { handle } = api;
let facilityDefinitionRegistered = false;
const TYPE = SIMCONNECT_FACILITY_LIST_TYPE_AIRPORT;
const IN_RANGE = api.nextId();
const OUT_OF_RANGE = api.nextId();
function registerFacilityDefinition(handle) {
if (facilityDefinitionRegistered) return;
facilityDefinitionRegistered = true;
handle.subscribeToFacilitiesEx1(TYPE, IN_RANGE, OUT_OF_RANGE);
const FA = SIMCONNECT_FACILITY_AIRPORT;
handle.on("airportList", (data) => {
const { requestID: id } = data;
// Airport
handle.addToFacilityDefinition(FA, "OPEN AIRPORT"); // Open
// work around the node-simconnect typo, if it still exists
if (data.aiports) {
data.airports ??= data.aiports;
delete data.aiports;
}
[
`LATITUDE`,
`LONGITUDE`,
`ALTITUDE`,
`MAGVAR`,
`NAME`,
`NAME64`,
`REGION`,
`N_RUNWAYS`,
].forEach((thing) => handle.addToFacilityDefinition(FA, thing));
// Are there in/out of range airports?
api.eventListeners[id]?.handlers.forEach((handle) => handle(data.airports));
});
// Runway
handle.addToFacilityDefinition(FA, "OPEN RUNWAY"); // "start of data" marker
[
`LATITUDE`,
`LONGITUDE`,
`ALTITUDE`,
`HEADING`,
`LENGTH`,
`WIDTH`,
`PATTERN_ALTITUDE`,
`SLOPE`,
`TRUE_SLOPE`,
`SURFACE`,
].forEach((thing) => handle.addToFacilityDefinition(FA, thing));
[
`PRIMARY_NUMBER`,
`PRIMARY_DESIGNATOR`,
`PRIMARY_ILS_TYPE`,
`PRIMARY_ILS_ICAO`,
`PRIMARY_ILS_REGION`,
].forEach((thing) => handle.addToFacilityDefinition(FA, thing));
[
`SECONDARY_NUMBER`,
`SECONDARY_DESIGNATOR`,
`SECONDARY_ILS_TYPE`,
`SECONDARY_ILS_ICAO`,
`SECONDARY_ILS_REGION`,
].forEach((thing) => handle.addToFacilityDefinition(FA, thing));
handle.addToFacilityDefinition(FA, "CLOSE RUNWAY"); // "end of data" marker
}

@@ -214,54 +247,6 @@

const FA = SIMCONNECT_FACILITY_AIRPORT;
registerFacilityDefinition(handle);
// Airport
handle.addToFacilityDefinition(FA, "OPEN AIRPORT"); // Open
const airportData = { ICAO: AIRPORT_ICAO, runways: [] };
[
`LATITUDE`,
`LONGITUDE`,
`ALTITUDE`,
`MAGVAR`,
`NAME`,
`NAME64`,
`REGION`,
`N_RUNWAYS`,
].forEach((thing) => handle.addToFacilityDefinition(FA, thing));
// Runway
handle.addToFacilityDefinition(FA, "OPEN RUNWAY"); // "start of data" marker
[
`LATITUDE`,
`LONGITUDE`,
`ALTITUDE`,
`HEADING`,
`LENGTH`,
`WIDTH`,
`PATTERN_ALTITUDE`,
`SLOPE`,
`TRUE_SLOPE`,
`SURFACE`,
].forEach((thing) => handle.addToFacilityDefinition(FA, thing));
[
`PRIMARY_NUMBER`,
`PRIMARY_DESIGNATOR`,
`PRIMARY_ILS_TYPE`,
`PRIMARY_ILS_ICAO`,
`PRIMARY_ILS_REGION`,
].forEach((thing) => handle.addToFacilityDefinition(FA, thing));
[
`SECONDARY_NUMBER`,
`SECONDARY_DESIGNATOR`,
`SECONDARY_ILS_TYPE`,
`SECONDARY_ILS_ICAO`,
`SECONDARY_ILS_REGION`,
].forEach((thing) => handle.addToFacilityDefinition(FA, thing));
handle.addToFacilityDefinition(FA, "CLOSE RUNWAY"); // "end of data" marker
const airportData = { runways: [] };
const handler = ({ data, type }) => {

@@ -276,3 +261,2 @@ // airport

const name64 = data.readString64();
const ICAO = AIRPORT_ICAO;
const region = data.readString8();

@@ -279,0 +263,0 @@ const runwayCount = data.readInt32();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc