Skip to content

Commit

Permalink
Merge pull request #46 from Bannsaenger/master
Browse files Browse the repository at this point in the history
added ESTA code
  • Loading branch information
margau authored Dec 28, 2022
2 parents c7ea5f0 + 4287dc8 commit d19170d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ||
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d19170d

Please sign in to comment.