From 501c322d049943a3dfd138b5e6662cb2b5b093be Mon Sep 17 00:00:00 2001 From: Bannsaenger Date: Tue, 27 Dec 2022 15:53:25 +0100 Subject: [PATCH 1/2] added ESTA code --- lib.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib.js b/lib.js index f62bf46..d3a6695 100644 --- a/lib.js +++ b/lib.js @@ -7,6 +7,8 @@ const os = require('os'); const Netmask = require('netmask').Netmask; const winston = require('winston'); +const swap16 = (val) => { return ((val & 0xFF) << 8) | ((val >> 8) & 0xFF); }; + // ArtDMX Header for jspack var ArtDmxHeaderFormat = '!7sBHHBBBBH'; // ArtDMX Payload for jspack @@ -22,6 +24,7 @@ class dmxnet { constructor(options = {}) { // Parse all options and set defaults this.oem = options.oem || 0x2908; // OEM code hex + this.esta = options.esta || 0x0000; // ESTA code hex this.port = options.listen || 6454; // Port listening for incoming data this.sName = options.sName || 'dmxnet'; // Shortname this.lName = options.lName || @@ -180,7 +183,7 @@ class dmxnet { // 2 bytes Firmware version, netSwitch, subSwitch, OEM-Code 0x0001, s.net, s.subnet, this.oem, // Ubea, status1, 2 bytes ESTA - 0, status, 0, + 0, status, swap16(this.esta), // short name (18), long name (63), stateString (63) this.sName.substring(0, 16), this.lName.substring(0, 63), stateString, // 2 bytes num ports, 4*portTypes @@ -229,7 +232,7 @@ class dmxnet { // 2 bytes Firmware version, netSwitch, subSwitch, OEM-Code 0x0001, r.net, r.subnet, this.oem, // Ubea, status1, 2 bytes ESTA - 0, status, 0, + 0, status, swap16(this.esta), // short name (18), long name (63), stateString (63) this.sName.substring(0, 16), this.lName.substring(0, 63), stateString, // 2 bytes num ports, 4*portTypes @@ -277,7 +280,7 @@ class dmxnet { // 2 bytes Firmware version, netSwitch, subSwitch, OEM-Code 0x0001, netSwitch, subSwitch, this.oem, // Ubea, status1, 2 bytes ESTA - 0, status, 0, + 0, status, swap16(this.esta), // short name (18), long name (63), stateString (63) this.sName.substring(0, 16), this.lName.substring(0, 63), stateString, // 2 bytes num ports, 4*portTypes From 4287dc857b98f83e957c2af7e8d155ac6f922c5e Mon Sep 17 00:00:00 2001 From: Bannsaenger Date: Wed, 28 Dec 2022 11:01:21 +0100 Subject: [PATCH 2/2] added esta code --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 61ae4be..910504c 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,8 @@ Options: ```javascript { log: { level: 'info' }, // Winston logger options - oem: 0, //OEM Code from artisticlicense, default to dmxnet OEM. + oem: 0, // OEM Code from artisticlicense, default to dmxnet OEM. + esta: 0, // ESTA Manufacturer ID from https://tsp.esta.org, default to ESTA/PLASA (0x0000) sName: "Text", // 17 char long node description, default to "dmxnet" lName: "Long description", // 63 char long node description, default to "dmxnet - OpenSource ArtNet Transceiver" hosts: ["127.0.0.1"] // Interfaces to listen to, all by default