Merge pull request #23 from stagehacks/new-plugin-format

New plugin format
This commit is contained in:
sparks-alec
2022-12-11 03:50:09 -05:00
committed by GitHub
17 changed files with 366 additions and 216 deletions
+13 -11
View File
@@ -1,16 +1,18 @@
const _ = require('lodash');
exports.defaultName = "Art-Net";
exports.connectionType = 'UDPsocket';
exports.heartbeatInterval = 10000;
exports.searchOptions = {
type: 'UDPsocket',
searchBuffer: Buffer.from([0x00]),
devicePort: 6454,
listenPort: 6454,
validateResponse (msg, info, devices) {
return msg.toString('utf8', 0, 7) === "Art-Net";
exports.config = {
defaultName: "Art-Net",
connectionType: "UDPsocket",
heartbeatInterval: 10000,
searchOptions: {
type: 'UDPsocket',
searchBuffer: Buffer.from([0x00]),
devicePort: 6454,
listenPort: 6454,
mayChangePort: false,
validateResponse (msg, info, devices) {
return msg.toString('utf8', 0, 7) === "Art-Net";
}
}
};
+17 -14
View File
@@ -3,20 +3,23 @@ const fs = require('fs');
const path = require('path');
const Cue = require('./cue');
exports.defaultName = 'ETC Eos';
exports.connectionType = 'osc';
exports.searchOptions = {
type: 'TCPport',
searchBuffer: Buffer.from(
'\xc0/eos/ping\x00\x00\x2c\x00\x00\x00\xc0',
'ascii'
),
testPort: 3032,
validateResponse(msg, info) {
return msg.toString().indexOf('/eos/out');
},
};
exports.defaultPort = 3032;
exports.config = {
defaultName: "ETC Eos",
connectionType: "osc",
defaultPort: 3032,
mayChangePort: false,
searchOptions: {
type: 'TCPport',
searchBuffer: Buffer.from(
'\xc0/eos/ping\x00\x00\x2c\x00\x00\x00\xc0',
'ascii'
),
testPort: 3032,
validateResponse(msg, info) {
return msg.toString().indexOf('/eos/out');
}
}
}
exports.ready = function ready(_device) {
const device = _device;
+54 -19
View File
@@ -1,19 +1,32 @@
const md5 = require('md5');
exports.defaultName = 'PJLink Projector';
exports.connectionType = 'TCPsocket';
exports.heartbeatInterval = 5000;
exports.heartbeatTimeout = 15000;
exports.searchOptions = {
type: 'UDPsocket',
searchBuffer: Buffer.from([0x25, 0x32, 0x53, 0x52, 0x43, 0x48, 0x0d]),
devicePort: 4352,
listenPort: 4352,
validateResponse (msg, info) {
return msg.toString().indexOf('%2ACKN=') >= 0;
exports.config = {
defaultName: 'PJLink Projector',
connectionType: "TCPsocket",
heartbeatInterval: 5000,
heartbeatTimeout: 15000,
defaultPort: 4352,
mayChangePort: false,
searchOptions: {
type: 'UDPsocket',
searchBuffer: Buffer.from([0x25, 0x32, 0x53, 0x52, 0x43, 0x48, 0x0d]),
devicePort: 4352,
listenPort: 4352,
validateResponse (msg, info) {
console.log(msg.toString());
return msg.toString().indexOf('%2ACKN=') >= 0;
}
},
};
exports.defaultPort = 4352;
fields: [{
key: "password",
label: "Pass",
type: "textinput",
value: "",
action: function(device){
device.plugin.heartbeat(device);
}
}]
}
exports.ready = function ready(device) {
// Power status query
@@ -34,7 +47,8 @@ const PJLinkCmds = [
'%2SVER='
]
let password = false;
let passwordMD5 = false;
let passwordSeed = false;
function processPJLink(_device, str, that) {
const arr = str.split('%');
@@ -104,21 +118,42 @@ exports.data = function data(device, message) {
this.deviceInfoUpdate(device, 'status', 'ok');
const msg = message.toString();
//console.log(msg);
if (msg.substring(0, 8) === 'PJLINK 1') {
password = md5(`${msg.substring(9, 17)}JBMIAProjectorLink`);
passwordSeed = msg.substring(9, 17);
passwordMD5 = md5(`${passwordSeed}${device.fields.password}`);
device.data.authentication = "ON";
device.send(
`${password}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
`${passwordMD5}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
);
device.draw();
}else if(msg.substring(0, 8) === 'PJLINK 0') {
device.data.authentication = "OFF";
device.draw();
}else if(msg.startsWith('PJLINK ERRA')) {
device.data.passwordOK = false;
device.draw();
}
if(PJLinkCmds.includes(msg.substring(0,7))){
processPJLink(device,msg,this)
processPJLink(device,msg,this);
device.data.passwordOK = true;
}
};
exports.heartbeat = function heartbeat(device) {
if (password) {
passwordMD5 = md5(`${passwordSeed}${device.fields.password}`);
if (device.fields.password.length>0) {
device.send(
`${password}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
`${passwordMD5}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
);
}else{
device.send(
`%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
);
}
device.draw();
+4
View File
@@ -7,3 +7,7 @@
.ok {
color: #79b757;
}
table{
margin-bottom: 30px;
width: 350px;
}
+15
View File
@@ -92,4 +92,19 @@
<td>Version</td>
<td><div><%= data.version %></div></td>
</tr>
</table>
<table class="cv-table">
<tr>
<td>Authentication</td>
<td>
<% if(!data.passwordOK){ %>
<div class='error'>INCORRECT PASSWORD</div>
<% }else if(data.authentication=="ON"){ %>
<div class='ok'>ON</div>
<% }else{ %>
<div class='error'><%= data.authentication %></div>
<% } %>
</td>
</tr>
</table>
+22 -9
View File
@@ -2,6 +2,27 @@ const _ = require('lodash');
const fs = require('fs');
const path = require('path');
exports.config = {
defaultName: "QLab",
connectionType: "osc",
heartbeatInterval: 50,
heartbeatTimeout: 2000,
mayChangePort: true,
searchOptions: {
type: 'Bonjour',
bonjourName: 'qlab',
},
fields: [{
key: "passcode",
label: "Pass",
type: "textinput",
value: "",
action: function(device){
device.send('/workspaces');
}
}]
}
let lastElapsedUpdate = Date.now();
let interval = 5;
let heartbeatCount = 0;
@@ -16,14 +37,6 @@ const cueTemplate = _.template(fs.readFileSync(path.join(__dirname, `cue.ejs`)))
const tileTemplate = _.template(fs.readFileSync(path.join(__dirname, `tile.ejs`)));
const cartTemplate = _.template(fs.readFileSync(path.join(__dirname, `cart.ejs`)));
exports.defaultName = 'QLab';
exports.connectionType = 'osc';
exports.heartbeatInterval = 50;
exports.heartbeatTimeout = 2000;
exports.searchOptions = {
type: 'Bonjour',
bonjourName: 'qlab',
};
exports.ready = function ready(device) {
device.send(`/version`);
@@ -54,7 +67,7 @@ exports.data = function data(_device, oscData) {
cueLists: {},
cues: {}
}
device.send(`/workspace/${wksp.uniqueID}/connect`);
device.send(`/workspace/${wksp.uniqueID}/connect`, device.fields.passcode);
});
}else if(match(oscAddressParts, ["reply", "workspace", "*", "connect"])){
+16 -13
View File
@@ -1,18 +1,21 @@
const _ = require('lodash');
exports.defaultName = 'sACN';
exports.connectionType = 'multicast';
exports.defaultPort = 5568;
exports.heartbeatInterval = 5000;
exports.searchOptions = {
type: "multicast",
address: getMulticastGroup(1),
port: 5568,
validateResponse (msg, info) {
return msg.toString('utf8', 4, 13) === "ASC-E1.17";
},
};
exports.defaultPort = 5568;
exports.config = {
defaultName: "sACN",
connectionType: "multicast",
defaultPort: 5568,
heartbeatInterval: 5000,
defaultPort: 5568,
mayChangePort: false,
searchOptions: {
type: "multicast",
address: getMulticastGroup(1),
port: 5568,
validateResponse (msg, info) {
return msg.toString('utf8', 4, 13) === "ASC-E1.17";
}
}
}
exports.ready = function ready(device) {
+15 -12
View File
@@ -1,15 +1,18 @@
exports.defaultName = 'Dataton Watchout';
exports.connectionType = 'TCPsocket';
exports.heartbeatInterval = 500;
exports.searchOptions = {
type: 'TCPport',
searchBuffer: Buffer.from('authenticate 1\n', 'ascii'),
testPort: 3040,
validateResponse (msg, info) {
return msg.toString().substring(0, 5) === 'Ready';
},
};
exports.defaultPort = 3040;
exports.config = {
defaultName: "Dataton Watchout",
connectionType: "TCPsocket",
heartbeatInterval: 500,
defaultPort: 3040,
mayChangePort: false,
searchOptions: {
type: 'TCPport',
searchBuffer: Buffer.from('authenticate 1\n', 'ascii'),
testPort: 3040,
validateResponse (msg, info) {
return msg.toString().substring(0, 5) === 'Ready';
}
}
}
exports.ready = function ready(device) {
device.send('authenticate 1\n');
+16 -13
View File
@@ -1,16 +1,19 @@
exports.defaultName = 'X32 Mixer';
exports.connectionType = 'osc-udp';
exports.heartbeatInterval = 9000;
exports.searchOptions = {
type: 'UDPsocket',
searchBuffer: Buffer.from([0x2f, 0x78, 0x69, 0x6e, 0x66, 0x6f]),
devicePort: 10023,
listenPort: 0,
validateResponse(msg, info) {
return msg.toString().indexOf('/xinfo') === 0;
},
};
exports.defaultPort = 10023;
exports.config = {
defaultName: "X32 Mixer",
connectionType: "osc-udp",
heartbeatInterval: 9000,
defaultPort: 10023,
mayChangePort: false,
searchOptions: {
type: 'UDPsocket',
searchBuffer: Buffer.from([0x2f, 0x78, 0x69, 0x6e, 0x66, 0x6f]),
devicePort: 10023,
listenPort: 0,
validateResponse(msg, info) {
return msg.toString().indexOf('/xinfo') === 0;
}
}
}
exports.ready = function ready(device) {
const d = device;
+16 -13
View File
@@ -1,16 +1,19 @@
exports.defaultName = 'X Air Mixer';
exports.connectionType = 'UDPsocket';
exports.heartbeatInterval = 10000;
exports.searchOptions = {
type: 'UDPsocket',
searchBuffer: Buffer.from([0x2f, 0x78, 0x69, 0x6e, 0x66, 0x6f]),
devicePort: 10024,
listenPort: 0,
validateResponse(msg, info) {
return msg.toString().indexOf('/xinfo') === 0;
},
};
exports.defaultPort = 10024;
exports.config = {
defaultName: "X Air Mixer",
connectionType: "UDPsocket",
heartbeatInterval: 10000,
defaultPort: 10024,
mayChangePort: false,
searchOptions: {
type: 'UDPsocket',
searchBuffer: Buffer.from([0x2f, 0x78, 0x69, 0x6e, 0x66, 0x6f]),
devicePort: 10024,
listenPort: 0,
validateResponse(msg, info) {
return msg.toString().indexOf('/xinfo') === 0;
}
}
}
exports.ready = function ready(device) {
const d = device;