diff options
Diffstat (limited to 'xplane.mjs')
-rw-r--r-- | xplane.mjs | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -4,11 +4,11 @@ const xplaneAddr = "localhost"; const xplanePort = 49000; const socket = dgram.createSocket("udp4"); -//socket.on('message', (msg, rinfo) => { -// console.log(msg, rinfo) -//}); -// -//socket.bind(10080); +socket.on("message", (msg, rinfo) => { + console.log(msg, rinfo); +}); + +socket.bind(10080); export const subscribeDataRef = async (dataRef) => { //const dataRef = "sim/flightmodel/position/indicated_airspeed"; @@ -19,7 +19,7 @@ export const subscribeDataRef = async (dataRef) => { off = buffer.writeInt32LE(0, off); // xint client off += buffer.write(dataRef, off); // char[400] dataref off = buffer.writeUInt8(0, off); // null terminated - console.log(Array.from(buffer)); + console.info(`x-plane dataref: ${dataRef}`); await socket.send(buffer, 0, buffer.length, xplanePort, xplaneAddr); }; @@ -33,4 +33,4 @@ export const sendCommand = async (cmd) => { await socket.send(buffer, 0, buffer.length, xplanePort, xplaneAddr); }; -//command("sim/GPS/g1000n1_hdg_down"); +//sendCommand("sim/GPS/g1000n1_hdg_down"); |