mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-07-26 09:18:39 +00:00
pretty pjlink plugin
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<h3>Connection Requirements</h3>
|
||||
<ul>
|
||||
<li>Requires no password on the projector</li>
|
||||
</ul>
|
||||
<li>Requires no password on the projector</li>
|
||||
</ul>
|
||||
|
||||
+25
-26
@@ -2,7 +2,7 @@ const md5 = require('md5');
|
||||
|
||||
exports.config = {
|
||||
defaultName: 'PJLink Projector',
|
||||
connectionType: "TCPsocket",
|
||||
connectionType: 'TCPsocket',
|
||||
heartbeatInterval: 5000,
|
||||
heartbeatTimeout: 15000,
|
||||
defaultPort: 4352,
|
||||
@@ -12,28 +12,29 @@ exports.config = {
|
||||
searchBuffer: Buffer.from([0x25, 0x32, 0x53, 0x52, 0x43, 0x48, 0x0d]),
|
||||
devicePort: 4352,
|
||||
listenPort: 4352,
|
||||
validateResponse (msg, info) {
|
||||
validateResponse(msg, info) {
|
||||
console.log(msg.toString());
|
||||
return msg.toString().indexOf('%2ACKN=') >= 0;
|
||||
}
|
||||
},
|
||||
},
|
||||
fields: [{
|
||||
key: "password",
|
||||
label: "Pass",
|
||||
type: "textinput",
|
||||
value: "",
|
||||
action: function(device){
|
||||
device.plugin.heartbeat(device);
|
||||
}
|
||||
}]
|
||||
}
|
||||
fields: [
|
||||
{
|
||||
key: 'password',
|
||||
label: 'Pass',
|
||||
type: 'textinput',
|
||||
value: '',
|
||||
action: function (device) {
|
||||
device.plugin.heartbeat(device);
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
exports.ready = function ready(device) {
|
||||
// Power status query
|
||||
// device.send("%1POWR ?\r");
|
||||
};
|
||||
|
||||
|
||||
const PJLinkCmds = [
|
||||
'%1POWR=',
|
||||
'%1INPT=',
|
||||
@@ -44,8 +45,8 @@ const PJLinkCmds = [
|
||||
'%1INF1=',
|
||||
'%1INF2=',
|
||||
'%2SNUM=',
|
||||
'%2SVER='
|
||||
]
|
||||
'%2SVER=',
|
||||
];
|
||||
|
||||
let passwordMD5 = false;
|
||||
let passwordSeed = false;
|
||||
@@ -123,35 +124,33 @@ exports.data = function data(device, message) {
|
||||
if (msg.substring(0, 8) === 'PJLINK 1') {
|
||||
passwordSeed = msg.substring(9, 17);
|
||||
passwordMD5 = md5(`${passwordSeed}${device.fields.password}`);
|
||||
device.data.authentication = "ON";
|
||||
device.data.authentication = 'ON';
|
||||
|
||||
device.send(
|
||||
`${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";
|
||||
} else if (msg.substring(0, 8) === 'PJLINK 0') {
|
||||
device.data.authentication = 'OFF';
|
||||
device.draw();
|
||||
|
||||
}else if(msg.startsWith('PJLINK ERRA')) {
|
||||
} else if (msg.startsWith('PJLINK ERRA')) {
|
||||
device.data.passwordOK = false;
|
||||
device.draw();
|
||||
}
|
||||
|
||||
if(PJLinkCmds.includes(msg.substring(0,7))){
|
||||
processPJLink(device,msg,this);
|
||||
if (PJLinkCmds.includes(msg.substring(0, 7))) {
|
||||
processPJLink(device, msg, this);
|
||||
device.data.passwordOK = true;
|
||||
}
|
||||
};
|
||||
|
||||
exports.heartbeat = function heartbeat(device) {
|
||||
passwordMD5 = md5(`${passwordSeed}${device.fields.password}`);
|
||||
if (device.fields.password.length>0) {
|
||||
if (device.fields.password.length > 0) {
|
||||
device.send(
|
||||
`${passwordMD5}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
|
||||
);
|
||||
}else{
|
||||
} else {
|
||||
device.send(
|
||||
`%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
|
||||
);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.ok {
|
||||
color: #79b757;
|
||||
}
|
||||
table{
|
||||
table {
|
||||
margin-bottom: 30px;
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user