node-simconnect
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -14,19 +14,25 @@ const simConnect = require('../../build/Release/node-simconnect'); | ||
connectToSim(); | ||
// Open connection | ||
var res = simConnect.open("MyAppName", function(name) { | ||
setupDataRequests(name); | ||
}, function() { | ||
console.log("Quit.... :("); | ||
}, function(exception) { | ||
console.log("SimConnect exception: " + exception.name + " (" + exception.dwException + ", " + exception.dwSendID + ", " + exception.dwIndex + ", " + exception.cbData); | ||
}); | ||
function connectToSim() { | ||
console.log("Trying to connect...") | ||
if(res < 0) | ||
console.log("Failed to connect to sim"); | ||
var success = simConnect.open("MyAppName", function(name, version) { | ||
console.log("\n-----------------------------------------------\nConnected to: " + name + "\nSimConnect version: " + version + "\n-----------------------------------------------"); | ||
setupDataRequests(name); | ||
}, () => { | ||
console.log("Quit.... :("); | ||
connectToSim(); | ||
}, (exception) => { | ||
console.log("SimConnect exception: " + exception.name + " (" + exception.dwException + ", " + exception.dwSendID + ", " + exception.dwIndex + ", " + exception.cbData); | ||
}); | ||
if(!success) { | ||
setTimeout(() => { | ||
connectToSim(); | ||
}, 5000); | ||
} | ||
} | ||
@@ -45,4 +51,2 @@ | ||
console.log("\n-----------------------------------------------\nConnected to: " + name + "\n-----------------------------------------------"); | ||
// Set the aircraft's parking brake on | ||
@@ -83,19 +87,3 @@ simConnect.setDataOnSimObject("BRAKE PARKING POSITION:1", "Position", 1); | ||
simConnect.requestDataOnSimObject([ | ||
["LIGHT STROBE","Bool"], | ||
["LIGHT PANEL","Bool"], | ||
["LIGHT LANDING","Bool"], | ||
["LIGHT TAXI","Bool"], | ||
["LIGHT BEACON","Bool"], | ||
["LIGHT NAV","Bool"], | ||
["LIGHT LOGO","Bool"], | ||
["LIGHT WING","Bool"], | ||
["LIGHT RECOGNITION","Bool"], | ||
["LIGHT CABIN","Bool"], | ||
], function(data) { | ||
console.log(data); | ||
}, 0, SIMCONNECT_PERIOD_SIM_FRAME, SIMCONNECT_DATA_REQUEST_FLAG_CHANGED); | ||
// Continously check if sim is on ground. When aircraft hits the ground, get the vertical speed. | ||
// Check if sim is on ground. When aircraft hits the ground, get the vertical speed. | ||
simConnect.requestDataOnSimObject([["SIM ON GROUND","Bool"], ["VERTICAL SPEED","feet per minute"]], function(data) { | ||
@@ -102,0 +90,0 @@ if(data[0] == 0) |
{ | ||
"name": "node-simconnect", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Wrapper for the SimConnect SDK for FSX and Prepar3D (Windows)", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -24,3 +24,3 @@ # node-simconnect | ||
* or if you installed the package with npm, run `node-gyp configure rebuild --msvs_version=2013 --arch=ia32`. | ||
* If everything went well you should be able to run the simple example program: `node examples/nodejs/example.js` (note: FSX/P3D must be already running). | ||
* If everything went well you should be able to run the simple example program: `node examples/nodejs/example.js`. | ||
@@ -27,0 +27,0 @@ ### Using the wrapper in a Electron or NW.JS project |
Sorry, the diff of this file is not supported yet
36148
115