pretty eos plugin

This commit is contained in:
2022-12-12 14:35:24 -06:00
parent ab32b67564
commit 1645480a08
2 changed files with 44 additions and 18 deletions
+10 -7
View File
@@ -2,14 +2,17 @@
<h4>Shell/ECU &rarr; Network</h4>
<ul>
<li>Enable <em>&#10004; TCP OSC</em>. The TCP format dropdown does not matter.</li>
<li>Enable <em>Third Party OSC</em></li>
<li>
Enable <em>&#10004; TCP OSC</em>. The TCP format dropdown does not matter.
</li>
<li>Enable <em>Third Party OSC</em></li>
</ul>
If the "Third Party OSC" option is not available, Eos must be updated to 3.1 or newer.
If the "Third Party OSC" option is not available, Eos must be updated to 3.1 or
newer.
<h4>System Settings &rarr; Show Control &rarr; OSC</h4>
<ul>
<li>Enable <em>&#10004; OSC RX</em></li>
<li>Enable <em>&#10004; OSC TX</em></li>
<li>All other fields may be left to defaults or blank.</li>
</ul>
<li>Enable <em>&#10004; OSC RX</em></li>
<li>Enable <em>&#10004; OSC TX</em></li>
<li>All other fields may be left to defaults or blank.</li>
</ul>
+34 -11
View File
@@ -4,8 +4,8 @@ const path = require('path');
const Cue = require('./cue');
exports.config = {
defaultName: "ETC Eos",
connectionType: "osc",
defaultName: 'ETC Eos',
connectionType: 'osc',
defaultPort: 3032,
mayChangePort: false,
searchOptions: {
@@ -17,9 +17,9 @@ exports.config = {
testPort: 3032,
validateResponse(msg, info) {
return msg.toString().indexOf('/eos/out');
}
}
}
},
},
};
exports.ready = function ready(_device) {
const device = _device;
@@ -53,7 +53,18 @@ exports.data = function data(_device, osc) {
device.send(`/eos/get/cue/${addressParts[4]}/index/${i}`);
}
} else if (
match(addressParts, [ 'eos', 'out', 'get','cue', '*', '*', '*', 'list', '*', '*',])
match(addressParts, [
'eos',
'out',
'get',
'cue',
'*',
'*',
'*',
'list',
'*',
'*',
])
) {
this.deviceInfoUpdate(device, 'status', 'ok');
if (
@@ -76,7 +87,19 @@ exports.data = function data(_device, osc) {
delete device.data.EOS.cueLists[addressParts[4]][addressParts[5]];
device.draw();
} else if (
match(addressParts, ['eos', 'out', 'get', 'cue', '*', '*', '*', 'actions', 'list', '*', '*'])
match(addressParts, [
'eos',
'out',
'get',
'cue',
'*',
'*',
'*',
'actions',
'list',
'*',
'*',
])
) {
if (osc.args.length === 3) {
device.data.EOS.cueLists[addressParts[4]][addressParts[5]][0].extLinks =
@@ -130,13 +153,13 @@ exports.heartbeat = function heartbeat(device) {
device.send('/eos/ping');
};
function match(testArray, patternArray){
function match(testArray, patternArray) {
let out = true;
if(testArray.length !== patternArray.length){
if (testArray.length !== patternArray.length) {
return false;
}
patternArray.forEach((patternPart, i)=> {
if(testArray[i] !== patternPart && patternPart !== "*"){
patternArray.forEach((patternPart, i) => {
if (testArray[i] !== patternPart && patternPart !== '*') {
out = false;
}
});