+<% let selected = workspace.selected.includes(cue.uniqueID) ? "selected": "" %>
-
+<% if(cueKeys && cueKeys.parent){ %>
-
- <% if(cue.broken){ %>
-
+
- <% }else if(cue.running){ %>
-
-
- <% }else if(cue.paused){ %>
-
-
- <% }else if(cue.loaded){ %>
-
-
- <% }else if(cue.flagged){ %>
-
-
- <% }else{ %>
+
+
- <% } %>
-
- <% if(cue.type == "Group" && cue.groupMode){ %>
-
-
- <% }else{ %>
-
-
- <% } %>
+
+
+ <% if(cueKeys.isBroken){ %>
+
+
+ <% }else if(cueKeys.isRunning){ %>
+
+
+ <% }else if(cueKeys.isPaused){ %>
+
+
+ <% }else if(cueKeys.isLoaded){ %>
+
+
+ <% }else if(cueKeys.isFlagged){ %>
+
+
+ <% }else{ %>
+
+ <% } %>
+
-
-
- <%= cue.number || " " %>
-
-
- <% for(let i=0; i
-
- <% if(cue.cues && cue.cues.length==0 && i==cue.nestedGroupModes.length-1){ %>
-
-
- <% }else if(cue.cues && i==cue.nestedGroupModes.length-1){ %>
-
-
- <% }else if(cue.nestedGroupPosition[i]<=0){ %>
- <% if(i
-
-
- <% }else{ %>
-
-
- <% } %>
-
- <% }else if(i
-
-
- <% }else{ %>
-
-
- <% } %>
-
-
- <% } %>
-
-
-
-
-
-
- <% if(cue.type=="Group"){ %>
- <% if(cue.cues.length==0){ %>
- <%= cue.listName %>
+
+ <% if(cueKeys.type == "Group" && cueKeys.mode){ %>
+
<% }else{ %>
- <%= cue.listName %>
+
<% } %>
- <% }else if(cue.nestedGroupPosition[1]==0){ %>
- <%= cue.listName %>
-
- <% }else{ %>
- <%= cue.listName %>
-
- <% } %>
- <%= cue.target %>
+
+ <%= cueKeys.number || " " %>
+
+
+ <% let nextCue = cueKeys.cueInWorkspace.parent.cues[cueKeys.cueInWorkspace.sortIndex+1]; %>
+
+
+ <% for(let i=0; i
+ <% let parent = cueKeys.parentKeys[i+1]; %>
+ <% %>
+
+ <% if(cueKeys.type=="Group" && cueKeys.cues.length==0 && i==cueKeys.parentKeys.length-1){ %>
+
+
+ <% }else if(cueKeys.type=="Group" && i==cueKeys.parentKeys.length-1){ %>
+
+
+ <%}else if(parent){%>
+
+ <% let parentCues = parent.cueInWorkspace.cues %>
+ <% let lastCueInMe = parentCues[parentCues.length-1]%>
+
+ <% while(lastCueInMe.type=="Group" && lastCueInMe.cues.length){
+ parentCues = lastCueInMe.cues;
+ lastCueInMe = parentCues[parentCues.length-1];
+ } %>
+
+ <% if(lastCueInMe.uniqueID == cueKeys.uniqueID){ %>
+
+
+ <% }else{ %>
+
+
+
+ <% } %>
+
+
+ <% }else if(cueKeys.parentKeys[i]){ %>
+ <% let nextCue2 = cueKeys.parentKeys[i].cues[cueKeys.cueInWorkspace.sortIndex+1]; %>
+
+ <% if(!nextCue2){ %>
+
+
+ <% }else{ %>
+
+
+ <% } %>
+
+
+ <% } %>
+
+ <% } %>
+
+
+
+
+
+ <% if(cue.type=="Group"){ %>
+
+ <% if(cue.cues && cue.cues.length==0){ %>
+ <%= cueKeys.listName %>
+
+ <% }else{ %>
+ <%= cueKeys.listName %>
+
+ <% } %>
+
+ <% }else if(!nextCue){ %>
+ <%= cueKeys.listName %>
+
+ <% }else{ %>
+ <%= cueKeys.listName %>
+
+ <% } %>
+
+
+ <% if(cueKeys.currentCueTarget){ %>
+ <%= allCues[cueKeys.currentCueTarget].number || allCues[cueKeys.currentCueTarget].listName %>
- <% if(cue.preWait){ %>
- <%= elapsedTime(cue.preWait, cue.preWaitElapsed, "preWait", cue) %>
+ <% }else{ %>
+
- <% }else{ %>
- 00:00.00
-
- <% } %>
+ <% } %>
+
- <% let cueTypesWithAction = ["Audio", "Mic", "Video", "Camera", "Text", "Light", "Fade", "Network", "MIDI File", "Timecode", "Wait"]; %>
- <% if((cue.type=="Group" && cue.groupMode==3) || cueTypesWithAction.indexOf(cue.type)>=0){ %>
- <%= elapsedTime(cue.duration, cue.actionElapsed, "action", cue) %>
+
+ <% if(cueKeys.preWait){ %>
+ <%= elapsedTime(cueKeys.preWait, cueKeys.preWaitElapsed, "preWait", cueKeys) %>
- <% }else{ %>
-
+ <% }else{ %>
+ 00:00.00
- <% } %>
+ <% } %>
- <% if(cue.postWait){ %>
- <%= elapsedTime(cue.postWait, cue.postWaitElapsed, "postWait", cue) %>
+
+ <% let cueTypesWithAction = ["Audio", "Mic", "Video", "Camera", "Text", "Light", "Fade", "Network", "MIDI File", "Timecode", "Wait"]; %>
+ <% if((cueKeys.type=="Group" && cueKeys.mode==3) || (cueKeys.type=="Group" && cueKeys.mode==6) || cueTypesWithAction.includes(cueKeys.type)){ %>
+ <%= elapsedTime(cueKeys.duration, cueKeys.actionElapsed, "action", cueKeys) %>
- <% }else{ %>
- 00:00.00
+ <% }else{ %>
+
- <% } %>
+ <% } %>
+
+
+
+ <% if(cueKeys.postWait){ %>
+ <%= elapsedTime(cueKeys.postWait, cueKeys.postWaitElapsed, "postWait", cueKeys) %>
+
+ <% }else{ %>
+ 00:00.00
+
+ <% } %>
- <% if(cue.continueMode==2){ %>
-
+
+ <% if(cueKeys.continueMode==2){ %>
+
- <% }else if(cue.continueMode==1){ %>
-
+ <% }else if(cueKeys.continueMode==1){ %>
+
- <% }else{ %>
-
+ <% }else{ %>
+
- <% } %>
+ <% } %>
-<%
- function prettyFormatTime(seconds){
+
+ <% }else{ %>
+
+
+
+
+
+ <%= cue.number || " " %>
+ <%= cue.listName %>
+
+ 00:00.00
+
+ 00:00.00
+
+
+
+<% } %>
+
+<%
+function prettyFormatTime(seconds){
if(!seconds){
return "00:00.00";
}
@@ -151,14 +212,14 @@
return string.substring(startIndex, string.length-2)
}
- function elapsedTime(def, value, type, cue){
+function elapsedTime(def, value, type, cue){
- if(type=="action" && cue.paused){
+ if(type=="action" && cue.isPaused){
value-=cue.preWait;
}
let border, fill;
- if(cue.paused){
+ if(cue.isPaused){
border = "#f6e737";
fill = "rgba(255, 240, 60, 0.7)";
}else{
@@ -171,7 +232,7 @@
let percent = value/def*100;
let bg = `style='background: black; background: linear-gradient(90deg, ${fill} ${percent}%, transparent ${percent}%);`;
- if(cue.paused){
+ if(cue.isPaused){
bg+= "outline-color: "+border+";";
bg+= "color: white;";
}
@@ -179,7 +240,7 @@
return `${prettyFormatTime(Math.min(def, value))}`;
- }else if(type=="postWait" || type=="action"){
+ }else if(type=="postWait" && cue.continueMode==0){
return `
${prettyFormatTime(def)} `;
}else{
diff --git a/plugins/qlab/cuelist.ejs b/plugins/qlab/cuelist.ejs
index d345be0..558e420 100644
--- a/plugins/qlab/cuelist.ejs
+++ b/plugins/qlab/cuelist.ejs
@@ -1,13 +1,13 @@
-
<%= workspace.displayName %> — <%= cueList.displayName %>
+
<%= workspace.displayName %> — <%= cueList.listName %>
-
+
Number
+ Name
- Q
@@ -18,17 +18,17 @@
Target
- Pre Wait
- Action
- Post Wait
+ Pre-Wait
+ Duration
+ Post-Wait
- <% for(const cue_id in cueList.cues){ %>
- <%= displayCueRow(cueList.cues[cue_id]) %>
+ <% for(let i=0; i
+ <%= displayCueRow(cueList.cues[i]) %>
<% } %>
@@ -36,18 +36,13 @@
<%
-
-
-
function displayCueRow(q){
- let html = "";
-
- html+= rowTemplate({cue: allCues[q.uniqueID], allCues: allCues, workspace: workspace});
+ let html = rowTemplate({cue: q, allCues: allCues, workspace: workspace});
if(q.cues){
- q.cues.forEach(q =>{
- html+=displayCueRow(q);
- })
+ for(let i=0; i {
- device.data.workspaces[wksp.uniqueID] = {
- uniqueID: wksp.uniqueID,
- displayName: wksp.displayName,
- cueLists: {},
- cues: {},
- };
- device.send(`/workspace/${wksp.uniqueID}/connect`, device.fields.passcode);
- });
-
- if (Object.keys(device.data.workspaces).length === 0) {
- device.data.permission = 'no workspaces';
- device.draw();
- }
- } else if (match(oscAddressParts, ['reply', 'workspace', '*', 'connect'])) {
- device.send(`/workspace/${oscAddressParts[2]}/updates`, [{ type: 'i', value: 1 }]);
- device.send(`/workspace/${oscAddressParts[2]}/cueLists`);
- } else if (match(oscAddressParts, ['reply', 'workspace', '*', 'cueLists'])) {
- this.deviceInfoUpdate(device, 'status', 'ok');
- const workspace = device.data.workspaces[oscAddressParts[2]];
- const json = JSON.parse(oscData.args[0]);
-
- workspace.cueLists = {};
- workspace.cues = {};
+ let json = [];
+ try {
+ json = JSON.parse(oscData.args[0]);
+ } catch (err) {
+ // a handful of messages don't respond with JSON
+ }
+ if (Object.keys(json).length > 0) {
if (json.status === 'denied') {
- device.data.permission = 'denied';
- device.draw();
- } else if (json.data) {
- device.data.permission = 'ok';
-
- json.data.forEach((cueList) => {
- workspace.cueLists[cueList.uniqueID] = cueList;
- addCueToWorkspace(workspace, cueList);
- });
-
- device.draw();
-
- setTimeout(() => {
- json.data.forEach((ql) => {
- workspace.cueLists[ql.uniqueID] = ql;
- getValuesForKeys(device, json.workspace_id, ql);
- });
- }, 0);
- }
- } else if (
- match(oscAddressParts, ['reply', 'cue_id', '*', 'children']) ||
- match(oscAddressParts, ['reply', 'workspace', '*', 'cue_id', '*', 'children'])
- ) {
- const json = JSON.parse(oscData.args[0]);
- const workspace = device.data.workspaces[json.workspace_id];
- const cueID = json.address.substring(55, 91);
- const cue = workspace.cues[cueID];
-
- if (!_.isEqual(cue.cues, json.data)) {
- workspace.cueLists[cueID].cues = json.data;
- addCueToWorkspace(workspace, workspace.cueLists[cueID]);
- device.draw();
- getValuesForKeys(device, json.workspace_id, cue);
- }
- } else if (
- match(oscAddressParts, ['reply', 'cue_id', '*', 'valuesForKeys']) ||
- match(oscAddressParts, ['reply', 'workspace', '*', 'cue_id', '*', 'valuesForKeys'])
- ) {
- const json = JSON.parse(oscData.args[0]);
- const cueValues = json.data;
- const workspace = device.data.workspaces[json.workspace_id];
- let cue = workspace.cues[cueValues.uniqueID];
-
- if (!cue) {
- workspace.cues[cueValues.uniqueID] = {};
- cue = workspace.cues[cueValues.uniqueID];
- }
-
- cue.uniqueID = cueValues.uniqueID;
- cue.number = cueValues.number;
- cue.name = cueValues.name;
- cue.listName = cueValues.listName;
- cue.displayName = cueValues.displayName;
- cue.broken = cueValues.isBroken;
- cue.running = cueValues.isRunning;
- cue.loaded = cueValues.isLoaded;
- cue.flagged = cueValues.isFlagged;
- cue.paused = cueValues.isPaused;
- cue.type = cueValues.type;
- // cue.cues = cueValues.children;
- cue.preWait = cueValues.preWait;
- cue.postWait = cueValues.postWait;
- cue.duration = cueValues.currentDuration;
- cue.colorName = cueValues.colorName;
- cue.continueMode = cueValues.continueMode;
- cue.groupMode = cueValues.mode;
- cue.parent = cueValues.parent;
- cue.cartRows = cueValues.cartRows;
- cue.cartColumns = cueValues.cartColumns;
- cue.cartPosition = cueValues.cartPosition;
- cue.preWaitElapsed = cueValues.preWaitElapsed;
- cue.actionElapsed = cueValues.actionElapsed;
- cue.postWaitElapsed = cueValues.postWaitElapsed;
-
- // QLab 5 fix
- if (cueValues.type === 'Group' || cueValues.type === 'Cue List') {
- cue.cues = cueValues.children;
- } else {
- cue.cues = undefined;
- }
-
- const nestedGroupModes = [];
- const nestedGroupPosition = [];
-
- let obj = cue;
- let sum = 0;
-
- if (obj.cues) {
- sum += obj.cues.length;
- }
-
- while (obj.parent !== '[root group of cue lists]') {
- let pos = _.findIndex(workspace.cues[obj.parent].cues, {
- uniqueID: obj.uniqueID,
- });
- pos = Math.abs(pos - workspace.cues[obj.parent].cues.length) - 1;
-
- if (obj.cues === undefined) {
- sum += pos;
+ if (device.data.workspaces[json.workspace_id]) {
+ device.data.workspaces[json.workspace_id].permission = 'denied';
}
-
- nestedGroupPosition.unshift(sum);
-
- if (obj.cues) {
- sum += pos;
- nestedGroupModes.unshift(obj.groupMode);
- } else {
- nestedGroupModes.unshift(workspace.cues[obj.parent].groupMode);
- }
-
- obj = workspace.cues[obj.parent];
+ return;
}
-
- cue.nestedGroupModes = nestedGroupModes;
- cue.nestedGroupPosition = nestedGroupPosition;
-
- device.update('updateCueData', {
- cue,
- allCues: workspace.cues,
- workspace,
- });
- } else if (match(oscAddressParts, ['reply', 'cue_id', '*', 'preWaitElapsed'])) {
- const oscArgs = JSON.parse(oscData.args[0]);
- if (oscArgs.status !== 'error') {
- const workspace = device.data.workspaces[oscArgs.workspace_id];
- if (workspace) {
- const cue = workspace.cues[oscArgs.address.substring(55, 91)];
-
- if (cue) {
- cue.preWaitElapsed = oscArgs.data;
- lastElapsedUpdate = Date.now();
-
- device.update('updateCueData', {
- cue,
- allCues: workspace.cues,
- workspace,
- });
- }
- }
- }
- } else if (match(oscAddressParts, ['reply', 'cue_id', '*', 'actionElapsed'])) {
- const oscArgs = JSON.parse(oscData.args[0]);
- if (oscArgs.status !== 'error') {
- const workspace = device.data.workspaces[oscArgs.workspace_id];
- if (workspace) {
- const cue = workspace.cues[oscArgs.address.substring(55, 91)];
-
- if (cue) {
- cue.actionElapsed = oscArgs.data;
- lastElapsedUpdate = Date.now();
-
- device.update('updateCueData', {
- cue,
- allCues: workspace.cues,
- workspace,
- });
- }
- }
- }
- } else if (match(oscAddressParts, ['reply', 'cue_id', '*', 'postWaitElapsed'])) {
- const oscArgs = JSON.parse(oscData.args[0]);
- if (oscArgs.status !== 'error') {
- const workspace = device.data.workspaces[oscArgs.workspace_id];
- if (workspace) {
- const cue = workspace.cues[oscArgs.address.substring(55, 91)];
-
- if (cue) {
- cue.postWaitElapsed = oscArgs.data;
- lastElapsedUpdate = Date.now();
-
- device.update('updateCueData', {
- cue,
- allCues: workspace.cues,
- workspace,
- });
- }
- }
- }
- } else if (match(oscAddressParts, ['update', 'workspace', '*', 'cue_id', '*'])) {
- const workspace = device.data.workspaces[oscAddressParts[2]];
-
- if (workspace) {
- const cueLists = Object.keys(workspace.cueLists);
- const cueID = oscAddressParts[4];
-
- if (cueID !== '[root group of cue lists') {
- if (cueLists.includes(cueID)) {
- device.send(`/workspace/${workspace.uniqueID}/cue_id/${cueID}/children`);
- }
-
- device.send(`/workspace/${oscAddressParts[2]}/cue_id/${cueID}/valuesForKeys`, [
- { type: 's', value: valuesForKeysString },
- ]);
- }
- }
- } else if (match(oscAddressParts, ['update', 'workspace', '*'])) {
- // occurs when cue lists are reordered or a list is deleted
- device.send(`/workspace/${oscAddressParts[2]}/cueLists`);
- } else if (match(oscAddressParts, ['update', 'workspace', '*', 'dashboard'])) {
- // this workspace might be new, let's check
- if (device.data.workspaces[oscAddressParts[2]] === undefined) {
+ if (json.status === 'error') {
device.send('/workspaces');
+ return;
}
- } else if (match(oscAddressParts, ['update', 'workspace', '*', 'cueList', '*', 'playbackPosition'])) {
- const workspace = device.data.workspaces[oscAddressParts[2]];
+ }
- if (workspace) {
- const cue = workspace.cues[oscData.args[0]];
+ if (oscData.address === '/reply/workspaces') {
+ for (let i = 0; i < json.data.length; i++) {
+ device.data.workspaces[json.data[i].uniqueID] = {
+ version: json.data[i].version,
+ displayName: json.data[i].displayName,
+ port: json.data[i].port,
+ udpReplyPort: json.data[i].udpReplyPort,
+ cueLists: [],
+ selected: [],
+ };
+ device.data.version = json.data[i].version;
+ device.data.workspaces[json.data[i].uniqueID].permission = 'ok';
+ device.send(`/workspace/${json.data[i].uniqueID}/connect`, device.fields.passcode);
+ }
- if (cue) {
- workspace.playbackPosition = oscData.args[0] ? cue.uniqueID : '';
- device.update('updatePlaybackPosition', { cue });
- }
- }
- } else if (match(oscAddressParts, ['update', 'workspace', '*', 'disconnect'])) {
- delete device.data.workspaces[oscAddressParts[2]];
- if (Object.keys(device.data.workspaces).length === 0) {
- device.data.permission = 'no workspaces';
- }
+ this.deviceInfoUpdate(device, 'status', 'ok');
device.draw();
- } else if (match(oscAddressParts, ['reply', 'thump'])) {
- // intermittent connection check even if nothing's happening
- } else {
- // console.log(address)
+ } else if (/reply\/workspace\/.*\/connect/.test(oscData.address)) {
+ if (json.data === 'badpass') {
+ device.data.workspaces[json.workspace_id].permission = 'badpass';
+ } else {
+ device.data.workspaces[json.workspace_id].permission = 'ok';
+ device.send(`/workspace/${msgAddr[2]}/cueLists`);
+ device.send(`/workspace/${msgAddr[2]}/updates`, [{ type: 'i', value: 1 }]);
+ }
+ } else if (/reply\/workspace\/.*\/cueLists/.test(oscData.address)) {
+ insertChildCues(device, device.data.workspaces[msgAddr[2]].cueLists, json.data, '[root group of cue lists]');
+ } else if (/reply\/cue_id\/.*\/valuesForKeys/.test(oscData.address)) {
+ const keyValues = json.data;
+ let cue = device.data.cueKeys[msgAddr[2]];
+
+ if (cue === undefined) {
+ device.data.cueKeys[msgAddr[2]] = {};
+ cue = device.data.cueKeys[msgAddr[2]];
+ }
+ cue.uniqueID = keyValues.uniqueID;
+ cue.number = keyValues.number;
+ cue.listName = keyValues.listName;
+ cue.isBroken = keyValues.isBroken;
+ cue.isRunning = keyValues.isRunning;
+ cue.isLoaded = keyValues.isLoaded;
+ cue.isFlagged = keyValues.isFlagged;
+ cue.type = keyValues.type;
+ cue.cues = keyValues.children;
+ cue.preWait = keyValues.preWait;
+ cue.postWait = keyValues.postWait;
+ cue.duration = keyValues.duration;
+ cue.colorName = keyValues.colorName;
+ cue.continueMode = keyValues.continueMode;
+ cue.mode = keyValues.mode;
+ cue.parent = keyValues.parent;
+ cue.cartRows = keyValues.cartRows;
+ cue.cartColumns = keyValues.cartColumns;
+ cue.cartPosition = keyValues.cartPosition;
+ cue.displayName = keyValues.displayName;
+ cue.preWaitElapsed = keyValues.preWaitElapsed;
+ cue.actionElapsed = keyValues.actionElapsed;
+ cue.postWaitElapsed = keyValues.postWaitElapsed;
+ cue.isPaused = keyValues.isPaused;
+ cue.currentCueTarget = keyValues.currentCueTarget;
+ cue.armed = keyValues.armed;
+ cue.notes = keyValues.notes;
+
+ if (keyValues.isRunning) {
+ device.data.lastElapsedMessage = device.data.ticks;
+ }
+
+ if (cue.parent !== '[root group of cue lists]') {
+ cue.parent = device.data.cueKeys[cue.parent];
+ }
+
+ if (cue.type === 'Cue List' || cue.type === 'Group' || cue.type === 'Cart') {
+ if (device.data.cueKeys[msgAddr[2]].cueInWorkspace && cue.cues) {
+ insertChildCues(
+ device,
+ device.data.cueKeys[msgAddr[2]].cueInWorkspace.cues,
+ [...keyValues.children],
+ device.data.cueKeys[msgAddr[2]].cueInWorkspace
+ );
+ }
+ device.draw();
+ }
+
+ if (cue.type !== 'Cue List' && cue.type !== 'Cart') {
+ device.update('updateCueRow', { cue, workspace: device.data.workspaces[json.workspace_id] });
+ }
+ } else if (/reply\/cue_id\/(.*)\/(.*)Elapsed/.test(oscData.address)) {
+ const workspace = device.data.workspaces[json.workspace_id];
+ let cueID;
+ let keyName;
+ device.data.lastElapsedMessage = device.data.ticks;
+
+ if (workspace?.version.startsWith('5.')) {
+ const addrParts = json.address.split('/');
+ cueID = addrParts[4];
+ keyName = addrParts[5];
+ } else {
+ const addrParts = json.address.split('/');
+ cueID = addrParts[2];
+ keyName = addrParts[3];
+ }
+
+ device.data.cueKeys[cueID][keyName] = json.data;
+
+ device.update('updateCueRow', { cue: device.data.cueKeys[cueID], workspace });
+ } else if (/reply\/workspace\/.*\/selectedCues/.test(oscData.address)) {
+ const workspace = device.data.workspaces[msgAddr[2]];
+ if (!workspace) {
+ return;
+ }
+ workspace.selected = [];
+ for (let i = 0; i < json.data.length; i++) {
+ workspace.selected.push(json.data[i].uniqueID);
+ }
+ device.update('updatePlaybackAndSelected', { workspace: device.data.workspaces[json.workspace_id] });
+ } else if (/update\/workspace\/.*\/cue_id\/.*/.test(oscData.address)) {
+ device.send(`/cue_id/${msgAddr[4]}/valuesForKeys`, [{ type: 's', value: valuesForKeysString }]);
+ } else if (/update\/workspace\/.*\/cueList\/.*\/playbackPosition/.test(oscData.address)) {
+ const workspace = device.data.workspaces[msgAddr[2]];
+ if (workspace) {
+ workspace.playbackPosition = oscData.args[0];
+ device.update('updatePlaybackAndSelected', { workspace: device.data.workspaces[msgAddr[2]] });
+ }
+ } else if (/update\/workspace\/.*\/dashboard/.test(oscData.address)) {
+ device.send(`/workspace/${msgAddr[2]}/selectedCues`);
+ device.send(`/cue_id/active/preWaitElapsed`);
}
};
-exports.update = function update(device, doc, updateType, data) {
- if (updateType === 'updateCueData') {
+exports.update = function update(device, _doc, updateType, data) {
+ const doc = _doc;
+ if (updateType === 'updateCueRow') {
const $elem = doc.getElementById(data.cue.uniqueID);
-
if ($elem) {
- if (data.cue.type === 'Cue List') {
- $elem.outerHTML = `${data.workspace.displayName} — ${data.cue.name} `;
- } else if (data.cue.type === 'Cart') {
- $elem.outerHTML = cartTemplate({
- tileTemplate,
- cueList: data.cue,
- allCues: data.workspace.cues,
+ if (data.cue.parent.type === 'Cart') {
+ $elem.outerHTML = device.templates.tile({
+ allCues: device.data.cueKeys,
+ cue: data.cue,
+ workspace: data.workspace,
});
- } else if (data.cue.cartPosition && data.cue.cartPosition[0] !== 0) {
- // checking that the parent cue is a cart cue
- const parentCue = data.workspace.cues[data.cue.parent];
- if (parentCue && parentCue.type === 'Cart') {
- $elem.outerHTML = tileTemplate(data);
- } else {
- $elem.outerHTML = cueTemplate(data);
- }
} else {
- $elem.outerHTML = cueTemplate(data);
+ $elem.outerHTML = device.templates.cue({
+ allCues: device.data.cueKeys,
+ cue: data.cue,
+ workspace: data.workspace,
+ });
}
}
- } else if (updateType === 'updatePlaybackPosition') {
- Array.from(doc.getElementsByClassName('playback-position')).forEach(($elem, index, array) => {
- $elem.classList.remove('playback-position');
+ } else if (updateType === 'updatePlaybackAndSelected') {
+ Array.from(doc.querySelectorAll('.selected')).forEach(($el) => {
+ $el.classList.remove('selected');
+ });
+ Array.from(doc.querySelectorAll('.playback-position')).forEach(($el) => {
+ $el.classList.remove('playback-position');
});
- const $elem = doc.getElementById(data.cue.uniqueID);
- $elem.classList.add('playback-position');
- $elem.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ for (let i = 0; i < data.workspace.selected.length; i++) {
+ const $elem = doc.getElementById(data.workspace.selected[i]);
+ if ($elem) {
+ $elem.classList.add('selected');
+ }
+ }
+
+ const $playheadInfo = doc.getElementById('playhead-information');
+ const $playheadName = doc.getElementById('playhead-name');
+ const $playheadNotes = doc.getElementById('playhead-notes');
+
+ if (data.workspace.playbackPosition) {
+ const $cueRow = doc.getElementById(data.workspace.playbackPosition);
+ if ($cueRow) {
+ $cueRow.classList.add('playback-position');
+ $cueRow.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ }
+
+ const cue = device.data.cueKeys[data.workspace.playbackPosition];
+ if (cue && $playheadName) {
+ $playheadName.setAttribute('class', `playhead-name cartColor-${cue.colorName} playhead-disarmed`);
+ $playheadInfo.classList.add('playhead-active');
+ if (cue.number) {
+ $playheadName.innerHTML = `${cue.number} • ${cue.displayName}`;
+ } else {
+ $playheadName.innerHTML = cue.displayName;
+ }
+ if (cue.notes) {
+ $playheadNotes.innerHTML = cue.notes;
+ } else {
+ $playheadNotes.innerHTML = 'Notes ';
+ }
+ if (!cue.armed) {
+ $playheadName.classList.add('playhead-disarmed');
+ } else {
+ $playheadName.classList.remove('playhead-disarmed');
+ }
+ }
+ } else {
+ $playheadName.setAttribute('class', `playhead-name`);
+ $playheadName.innerHTML = '[no cue on standby] ';
+ $playheadNotes.innerHTML = '';
+ $playheadInfo.classList.remove('playhead-active');
+ }
}
};
-function addCueToWorkspace(_workspace, cue) {
- const workspace = _workspace;
- workspace.cues[cue.uniqueID] = cue;
- workspace.cues[cue.uniqueID].nestedGroupModes = [];
- workspace.cues[cue.uniqueID].nestedGroupPosition = [];
-
- if (cue.cues) {
- // this cue has children so add them as well
- cue.cues.forEach((childCue) => {
- addCueToWorkspace(workspace, childCue);
- });
- }
-}
-
-function getValuesForKeys(device, workspaceID, cue) {
- device.send(`/workspace/${workspaceID}/cue_id/${cue.uniqueID}/valuesForKeys`, [
- { type: 's', value: valuesForKeysString },
- ]);
- if (cue.cues) {
- cue.cues.forEach((childCue) => {
- getValuesForKeys(device, workspaceID, childCue);
- });
- }
-}
-
-function match(testArray, patternArray) {
- let out = true;
- if (testArray.length !== patternArray.length) {
- return false;
- }
- patternArray.forEach((patternPart, i) => {
- if (testArray[i] !== patternPart && patternPart !== '*') {
- out = false;
- }
- });
- return out;
-}
-
-exports.heartbeat = function heartbeat(device) {
- heartbeatCount++;
-
- if (Date.now() - lastElapsedUpdate > 300) {
- interval = 24;
- } else {
- interval = 1;
- }
-
- if (heartbeatCount % 20 === 0 && device.data.workspaces && Object.keys(device.data.workspaces).length === 0) {
- device.send(`/version`);
- device.send('/workspaces');
- }
-
- if (heartbeatCount % 16 === 0) {
+exports.heartbeat = function heartbeat(_device) {
+ const device = _device;
+ device.data.ticks++;
+ if (device.data.ticks % 10 === 0) {
device.send(`/thump`);
}
-
- if (heartbeatCount % interval === 0 && device.data.workspaces && Object.keys(device.data.workspaces).length > 0) {
+ if (device.data.ticks - device.data.lastElapsedMessage < 5) {
device.send(`/cue_id/active/preWaitElapsed`);
- device.send(`/cue_id/active/actionElapsed`);
device.send(`/cue_id/active/postWaitElapsed`);
+ device.send(`/cue_id/active/actionElapsed`);
}
};
+
+function insertChildCues(_device, _oldCues, newCues, _parent) {
+ const device = _device;
+ const newIDs = _.keyBy(newCues, 'uniqueID');
+ const oldCues = _oldCues;
+ const parent = _parent;
+
+ if (!oldCues) {
+ return;
+ }
+
+ for (let i = 0; i < oldCues.length; i++) {
+ const oldCue = oldCues[i];
+
+ if (!newIDs[oldCue.uniqueID]) {
+ oldCues.splice(i, 1);
+ i--;
+ }
+
+ const indexOfOldCueInNew = _.findIndex(newCues, (o) => o.uniqueID === oldCue.uniqueID);
+
+ if (indexOfOldCueInNew >= 0) {
+ const newCue = newCues[indexOfOldCueInNew];
+ oldCues[i].armed = newCue.armed;
+ oldCues[i].colorName = newCue.colorName;
+ oldCues[i].colorNameLive = newCue['colorName/live'];
+
+ oldCues[i].flagged = newCue.flagged;
+ oldCues[i].listName = newCue.listName;
+ oldCues[i].name = newCue.name;
+ oldCues[i].number = newCue.number;
+ oldCues[i].type = newCue.type;
+ oldCues[i].sortIndex = indexOfOldCueInNew;
+ oldCues[i].parent = parent;
+
+ newCue.used = true;
+
+ let keys = device.data.cueKeys[oldCues[i].uniqueID];
+ if (!keys) {
+ device.data.cueKeys[oldCues[i].uniqueID] = {};
+ keys = device.data.cueKeys[oldCues[i].uniqueID];
+ }
+
+ keys.cueInWorkspace = oldCues[i];
+
+ if (oldCues[i].type === 'Group' || oldCues[i].type === 'Cue List' || oldCues[i].type === 'Cart') {
+ insertChildCues(device, oldCues[i].cues, newCue.cues, oldCues[i]);
+ }
+ }
+ }
+ for (let i = 0; i < newCues.length; i++) {
+ const newCue = newCues[i];
+ if (newCue.used !== true) {
+ const newIndex = oldCues.push({
+ armed: newCue.armed,
+ colorName: newCue.colorName,
+ colorNameLive: newCue['colorName/live'],
+ flagged: newCue.flagged,
+ listName: newCue.listName,
+ name: newCue.name,
+ number: newCue.number,
+ type: newCue.type,
+ uniqueID: newCue.uniqueID,
+ sortIndex: i,
+ parent,
+ });
+
+ const freshCue = oldCues[newIndex - 1];
+
+ let keys = device.data.cueKeys[freshCue.uniqueID];
+ if (!keys) {
+ device.data.cueKeys[freshCue.uniqueID] = {};
+ keys = device.data.cueKeys[freshCue.uniqueID];
+ }
+
+ if (freshCue.parent === '[root group of cue lists]') {
+ keys.parentKeys = [];
+ } else {
+ keys.parentKeys = [...device.data.cueKeys[freshCue.parent.uniqueID].parentKeys];
+ keys.parentKeys.push(device.data.cueKeys[freshCue.parent.uniqueID]);
+ }
+
+ device.send(`/cue_id/${newCue.uniqueID}/valuesForKeys`, [{ type: 's', value: valuesForKeysString }]);
+
+ keys.cueInWorkspace = freshCue;
+
+ if (freshCue.type === 'Group' || freshCue.type === 'Cue List' || oldCues[i].type === 'Cart') {
+ freshCue.cues = [];
+ insertChildCues(device, freshCue.cues, newCue.cues, freshCue);
+ }
+ }
+ }
+ oldCues.sort((a, b) => a.sortIndex - b.sortIndex);
+}
diff --git a/plugins/qlab/styles.css b/plugins/qlab/styles.css
index 65d297e..48ebf39 100644
--- a/plugins/qlab/styles.css
+++ b/plugins/qlab/styles.css
@@ -1,3 +1,6 @@
+body {
+ margin-bottom: 200px !important;
+}
table {
background-color: #323232;
border: 0px;
@@ -33,61 +36,60 @@ td img {
}
tr:nth-child(even) {
- background: #323232;
+ background: #2d2d2d;
}
tr:nth-child(odd) {
- background: #2c2c2c;
+ background: #262626;
}
-tr:nth-child(even).q-red {
- background: linear-gradient(to top, #2c2c2c, #4c3130 1px);
-}
tr:nth-child(odd).q-red {
- background: linear-gradient(to top, #323232, #513635 1px);
+ background: linear-gradient(to top, #262626, #49302f 1px);
}
-.q-red td:first-of-type {
- padding-left: 5px;
- border-left: 5px #ff4242 solid;
+tr:nth-child(even).q-red {
+ background: linear-gradient(to top, #2d2c2d, #513635 1px);
+}
+.q-red td.playhead {
+ background: linear-gradient(to right, #ff4242 55%, transparent 55%);
+}
+
+tr:nth-child(odd).q-orange {
+ background: linear-gradient(to top, #262626, #443526 1px);
}
tr:nth-child(even).q-orange {
- background: linear-gradient(to top, #2c2c2c, #4b3e2a 1px);
+ background: linear-gradient(to top, #2d2c2d, #4a3b2c 1px);
}
-tr:nth-child(odd).q-orange {
- background: linear-gradient(to top, #323232, #514330 1px);
+.q-orange td.playhead {
+ background: linear-gradient(to right, #ffa500 55%, transparent 55%);
}
-.q-orange td:first-of-type {
- padding-left: 5px;
- border-left: 5px #ffa500 solid;
+
+tr:nth-child(odd).q-green {
+ background: linear-gradient(to top, #262626, #2d3d27 1px);
}
tr:nth-child(even).q-green {
- background: linear-gradient(to top, #2c2c2c, #2d452d 1px);
+ background: linear-gradient(to top, #2d2c2d, #32422e 1px);
}
-tr:nth-child(odd).q-green {
- background: linear-gradient(to top, #323232, #324b33 1px);
+.q-green td.playhead {
+ background: linear-gradient(to right, #01d52f 55%, transparent 55%);
}
-.q-green td:first-of-type {
- padding-left: 5px;
- border-left: 5px #01d52f solid;
+
+tr:nth-child(odd).q-blue {
+ background: linear-gradient(to top, #262626, #292d40 1px);
}
tr:nth-child(even).q-blue {
- background: linear-gradient(to top, #2c2c2c, #323647 1px);
+ background: linear-gradient(to top, #2d2c2d, #2f3346 1px);
}
-tr:nth-child(odd).q-blue {
- background: linear-gradient(to top, #323232, #363b4b 1px);
+.q-blue td.playhead {
+ background: linear-gradient(to right, #536de0 55%, transparent 55%);
}
-.q-blue td:first-of-type {
- padding-left: 5px;
- border-left: 5px #536de0 solid;
+
+tr:nth-child(odd).q-purple {
+ background: linear-gradient(to top, #262626, #342639 1px);
}
tr:nth-child(even).q-purple {
- background: linear-gradient(to top, #2c2c2c, #39273d 1px);
+ background: linear-gradient(to top, #2d2c2d, #382c3f 1px);
}
-tr:nth-child(odd).q-purple {
- background: linear-gradient(to top, #323232, #433147 1px);
-}
-.q-purple td:first-of-type {
- padding-left: 5px;
- border-left: 5px #a601c0 solid;
+.q-purple td.playhead {
+ background: linear-gradient(to right, #a601c0 55%, transparent 55%);
}
tr.q-armed-false td {
@@ -96,13 +98,22 @@ tr.q-armed-false td {
}
tr.playback-position {
- background-image: none !important;
- background: #1557da !important;
- color: white !important;
+ background: #444 !important;
+ color: white;
+}
+tr.playback-position td.playhead {
+ padding: 0px;
+}
+tr.playback-position td.playhead::before {
+ content: url(img/playhead.png);
}
tr.playback-position .q-gray-text {
color: white !important;
}
+tr.selected {
+ background: #1557da !important;
+ color: white !important;
+}
.gLeft {
height: 24px;
@@ -140,22 +151,19 @@ tr.playback-position .q-gray-text {
border-radius: 6px;
}
.gMode-1 {
- border-color: #5a5a87;
+ border-color: #48477f;
}
.gMode-2 {
- border-color: #5a5a87;
+ border-color: #48477f;
}
.gMode-3 {
- border-color: #429242;
+ border-color: #43a424;
}
.gMode-4 {
- border-color: #925fc0;
-}
-.gMode-4 {
- border-color: #925fc0;
+ border-color: #7f26a5;
}
.gMode-6 {
- border-color: #d05b15;
+ border-color: #ee6a21;
}
.gMode-,
.gMode-0 {
@@ -172,6 +180,12 @@ tr.playback-position .q-gray-text {
font-size: 14px;
text-align: center;
}
+.q-target {
+ text-align: center;
+ font-size: 12px;
+ padding-left: 5px;
+ padding-right: 5px;
+}
.q-gray-text {
color: #424242;
}
@@ -193,6 +207,10 @@ tr.playback-position .q-gray-text {
box-sizing: border-box;
padding: 3px;
}
+.cartCueWrapper.selected .cartCue {
+ border-color: #89b4db;
+ box-shadow: #89b4db 0px 0px 2px 3px;
+}
.cartCue {
height: 100%;
box-sizing: border-box;
@@ -209,27 +227,27 @@ tr.playback-position .q-gray-text {
right: 13px;
top: 13px;
}
-.cartColor-red {
- border-color: #ff4242;
- background-color: #9b3726;
+div.cartColor-red {
+ border-color: #e7443a;
+ background-color: #942f27;
}
-.cartColor-orange {
- border-color: #ffa500;
- background-color: #ad6026;
+div.cartColor-orange {
+ border-color: #f18f28;
+ background-color: #a95023;
}
-.cartColor-green {
- border-color: #01d52f;
- background-color: #397f27;
+div.cartColor-green {
+ border-color: #4ebf32;
+ background-color: #397824;
}
-.cartColor-blue {
- border-color: #536de0;
- background-color: #304893;
+div.cartColor-blue {
+ border-color: #3a54cf;
+ background-color: #25378a;
}
-.cartColor-purple {
- border-color: #a601c0;
- background-color: #592d74;
+div.cartColor-purple {
+ border-color: #7e25a5;
+ background-color: #4c2269;
}
-.cartColor-none {
+div.cartColor-none {
border-color: #95929f;
background-color: #3b3b3b;
}
@@ -243,6 +261,53 @@ tr.playback-position .q-gray-text {
box-shadow: 0px 0px 3px 3px #88b3db, inset 0px 0px 5px #88b3db;
}
+#playhead-information {
+ width: 80%;
+ height: 120px;
+ position: fixed;
+ bottom: 30px;
+ left: 10%;
+ padding: 16px;
+ box-sizing: border-box;
+
+ background-color: #2e2d2d;
+ border: #424242 3px solid;
+ border-radius: 4px;
+ box-shadow: black 0px 0px 20px 5px;
+}
+#playhead-information.playhead-active {
+ border-color: #4cbe34;
+}
+.playhead-name {
+ width: 100%;
+ padding: 6px 12px;
+ box-sizing: border-box;
+ margin-bottom: 12px;
+
+ background-color: #434343;
+ border: #434343 1px solid;
+ font-size: 18px;
+ color: white;
+ border-radius: 3px;
+}
+.playhead-disarmed {
+ background: url('img/disarmed-pattern-light.png');
+ background-attachment: fixed;
+}
+#playhead-notes {
+ width: 100%;
+ padding: 6px 8px;
+ box-sizing: border-box;
+ height: 36px;
+
+ border: #5c5b5b 1px solid;
+ font-size: 18px;
+ color: #9a9a99;
+ border-radius: 3px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
@media screen and (min-width: 0px) and (max-width: 750px) {
.hide-medium {
display: none;
diff --git a/plugins/qlab/template.ejs b/plugins/qlab/template.ejs
index 09084b1..1703091 100644
--- a/plugins/qlab/template.ejs
+++ b/plugins/qlab/template.ejs
@@ -3,36 +3,42 @@
QLab <%= data.version || "" %>
-<%
- const fs = require('fs');
- let _ = require('lodash');
- const path = require('path');
- let cueTemplate = _.template(fs.readFileSync(path.join(__dirname, `/plugins/qlab/cue.ejs`)));
- let tileTemplate = _.template(fs.readFileSync(path.join(__dirname, `/plugins/qlab/tile.ejs`)));
- let cartTemplate = _.template(fs.readFileSync(path.join(__dirname, `/plugins/qlab/cart.ejs`)));
- let listTemplate = _.template(fs.readFileSync(path.join(__dirname, `/plugins/qlab/cuelist.ejs`)));
-%>
+
+<% const workspaceKeys = Object.keys(data.workspaces); %>
+
+<% if(workspaceKeys.length==0){ %>
+ QLab is open but there isn't an open Workspace
+<% } %>
+
- <% if(data.permission=="ok"){
- for(const workspace_id in data.workspaces){
- const workspace = data.workspaces[workspace_id];
- for(const cueList_id in workspace.cueLists){
- const ql = workspace.cueLists[cueList_id]; %>
-
- <% if(ql.type=="Cue List"){ %>
- <%= listTemplate({cueList: ql, allCues: workspace.cues, rowTemplate: cueTemplate, workspace: workspace}) %>
- <% }else if(ql.type=="Cart"){ %>
- <%= cartTemplate({cueList: ql, allCues: workspace.cues, tileTemplate: tileTemplate}) %>
- <% } %>
+<% for(let i=0; i
+ <% const workspace = data.workspaces[workspaceKeys[i]]; %>
-<% }}}else if(data.permission=="no workspaces"){ %>
+ <% if(workspace.permission=="ok"){ %>
- QLab is launched but there are no open Workspaces
+ <% for(let j=0; j
+ <% const cueList = workspace.cueLists[j]; %>
-<% }else if(data.permission=="denied"){ %>
+ <% if(cueList.type=="Cue List"){ %>
+ <%= templates.cuelist({cueList: cueList, allCues: data.cueKeys, rowTemplate: templates.cue, workspace: workspace}) %>
+ <% }else if(cueList.type=="Cart"){ %>
+ <%= templates.cart({cueList: cueList, allCues: data.cueKeys, tileTemplate: templates.tile, workspace: workspace}) %>
+ <% } %>
- Incorrect Passcode or OSC Access Permissions
- QLab Documentation: OSC Access Tab
+ <% } %>
+
+ <% }else{ %>
+
+ <%= workspace.displayName %> — Incorrect Passcode or OSC Access Permissions
+ QLab Documentation: OSC Access Tab
+
+ <% } %>
<% } %>
+
+
+
diff --git a/plugins/qlab/tile.ejs b/plugins/qlab/tile.ejs
index ca8e9e2..df8d5f6 100644
--- a/plugins/qlab/tile.ejs
+++ b/plugins/qlab/tile.ejs
@@ -1,17 +1,17 @@
<%
-
let height = 0;
let width = 0;
let left = 0;
let top = 0;
+ let cueKeys = allCues[cue.uniqueID];
+ let parent = allCues[cue.parent];
+ if(cueKeys.parent){
+ width = 100/cueKeys.parent.cartColumns;
+ height = 600/cueKeys.parent.cartRows;
- if(cue.parent){
- width = 100/allCues[cue.parent].cartColumns;
- height = 600/allCues[cue.parent].cartRows;
-
- top = (cue.cartPosition[0]-1)*height;
- left = (cue.cartPosition[1]-1)*width;
+ top = (cueKeys.cartPosition[0]-1)*height;
+ left = (cueKeys.cartPosition[1]-1)*width;
}
let style = `style="left:${left}%; top:${top}px; width:${width }%; height:${height}px;"`;
@@ -21,17 +21,21 @@
>
- <% if(cue.broken){ %>
+ <% if(cueKeys.isBroken){ %>
- <% }else if(cue.running){ %>
+ <% }else if(cueKeys.isRunning){ %>
<% }else{ %>
<% } %>
-
-
<%= cue.number %> • <%= cue.displayName %>
+
+
+ <%= cueKeys.number %>
+ <% if(cueKeys.number){ %> • <% } %>
+ <%= cueKeys.displayName %>
+
\ No newline at end of file
diff --git a/plugins/sacn/icon.png b/plugins/sacn/icon.png
index ef9783e..8f0b8e3 100644
Binary files a/plugins/sacn/icon.png and b/plugins/sacn/icon.png differ
diff --git a/plugins/sacn/icon.psd b/plugins/sacn/icon.psd
deleted file mode 100644
index 9e2d797..0000000
Binary files a/plugins/sacn/icon.psd and /dev/null differ
diff --git a/plugins/sacn/main.js b/plugins/sacn/main.js
index 7f3c176..0fe9eb5 100644
--- a/plugins/sacn/main.js
+++ b/plugins/sacn/main.js
@@ -55,10 +55,7 @@ exports.data = function data(_device, buf) {
universe.priority = buf.readUInt8(108);
universe.cid = buf.toString('hex', 22, 38);
universe.slots = buf.slice(126);
-
- if (buf.readUInt8(125) !== 0) {
- universe.startCode = buf.readUInt8(125);
- }
+ universe.startCode = buf.readUInt8(125);
device.data.source = buf.toString('utf8', 44, 108);
device.displayName = `${device.data.source} sACN`;
@@ -70,12 +67,12 @@ exports.data = function data(_device, buf) {
universe.slotElems = [];
universe.slotElemsSet = false;
- if (universe.priority > 0) {
+ if (universe.priority > 0 && universe.startCode === 0) {
device.draw();
device.update('elementCache');
}
}
- if (universe.priority > 0) {
+ if (universe.priority > 0 && universe.startCode === 0) {
device.update('universeData', {
universeIndex,
universe,
@@ -115,7 +112,7 @@ exports.update = function update(_device, doc, updateType, updateData) {
} else if (data.startCode === 0xcc) {
$code.textContent = 'RDM';
}
- } else {
+ } else if (data.universe.startCode === 0) {
device.draw();
device.update('elementCache');
}
diff --git a/plugins/shure/channel.js b/plugins/shure/channel.js
index dbdaf05..563105e 100644
--- a/plugins/shure/channel.js
+++ b/plugins/shure/channel.js
@@ -8,6 +8,7 @@ class Channel {
this.rx_rf_lvl = 0;
this.rf_antenna = 0;
this.tx_type = 0;
+ this.rx_graph_bars = 0;
}
}
diff --git a/plugins/shure/main.js b/plugins/shure/main.js
index 24ead4b..05897b6 100644
--- a/plugins/shure/main.js
+++ b/plugins/shure/main.js
@@ -21,6 +21,10 @@ exports.ready = function ready(_device) {
const device = _device;
device.data.channelCount = 0;
device.data.channels = [{}, new Channel(), new Channel(), new Channel(), new Channel()];
+
+ device.send('< GET 0 ALL >');
+ device.send('< SET 0 METER_RATE 00100 >');
+ device.send('< SAMPLE 0 AUDIO_LVL>');
};
exports.data = function data(_device, message) {
@@ -31,6 +35,8 @@ exports.data = function data(_device, message) {
return;
}
+ // console.log(msgStr);
+
msgStr = msgStr.slice(2).slice(0, -1);
const msgs = msgStr.split('><');
@@ -84,23 +90,23 @@ exports.data = function data(_device, message) {
exports.update = function update(device, doc, updateType, data) {
for (let i = 1; i < data.channels.length; i++) {
const channel = data.channels[i];
-
- const $rf = doc.getElementById(`ch-${i}-rf`);
- if ($rf) {
- $rf.style.height = 90 - (channel.rx_rf_lvl + 90) * 2;
- }
-
const $audio = doc.getElementById(`ch-${i}-audio`);
+ const $audioText = doc.getElementById(`ch-${i}-audio-text`);
if ($audio) {
$audio.style.height = 90 - channel.audio_lvl * 2;
}
+ if ($audioText) {
+ $audioText.textContent = channel.audio_lvl;
+ }
const $rfA = doc.getElementById(`ch-${i}-a`);
const $rfB = doc.getElementById(`ch-${i}-b`);
+ let rfClass = '';
if ($rfA) {
if (channel.rf_antenna.charAt(0) === 'A') {
$rfA.style.color = '#53c3c3';
+ rfClass = 'color-1';
} else {
$rfA.style.color = '#333';
}
@@ -108,10 +114,32 @@ exports.update = function update(device, doc, updateType, data) {
if ($rfB) {
if (channel.rf_antenna.charAt(1) === 'B') {
$rfB.style.color = '#53c3c3';
+ rfClass = 'color-2';
} else {
$rfB.style.color = '#333';
}
}
+
+ const $rf = doc.getElementById(`ch-${i}-rf`);
+ const $rfGraph = doc.getElementById(`ch-${i}-graph`);
+ const $rfText = doc.getElementById(`ch-${i}-rf-text`);
+ const rfHeight = 90 - (channel.rx_rf_lvl + 90) * 2;
+ if ($rf) {
+ $rf.style.height = rfHeight;
+ }
+ if ($rfGraph) {
+ if ($rfGraph.childElementCount > 115) {
+ $rfGraph.removeChild($rfGraph.firstElementChild);
+ }
+ $rfGraph.insertAdjacentHTML(
+ 'beforeend',
+ `
`
+ );
+ channel.rx_graph_bars++;
+ }
+ if ($rfText) {
+ $rfText.textContent = channel.rx_rf_lvl;
+ }
}
};
diff --git a/plugins/shure/styles.css b/plugins/shure/styles.css
index c7a46b0..914d590 100644
--- a/plugins/shure/styles.css
+++ b/plugins/shure/styles.css
@@ -72,7 +72,7 @@ table td {
border-radius: 2px;
}
.batt-knob.green {
- background-color: greenyellow;
+ background-color: #adff2f;
}
.batt-bar {
height: 26px;
@@ -99,3 +99,25 @@ small {
small small {
color: #444;
}
+
+.rf-graph {
+ height: 80px;
+ vertical-align: bottom;
+ text-align: left;
+}
+.rf-graph-bar {
+ padding: 0px;
+ margin: 0px;
+ width: 1px;
+ height: 1px;
+ background: #383943;
+ display: inline-block;
+}
+.color-1 {
+ background: #292662;
+ border-top: #554ed4 1px solid;
+}
+.color-2 {
+ background: #283636;
+ border-top: #50c3c3 1px solid;
+}
diff --git a/plugins/shure/template.ejs b/plugins/shure/template.ejs
index d989f75..20b8672 100644
--- a/plugins/shure/template.ejs
+++ b/plugins/shure/template.ejs
@@ -24,7 +24,7 @@
id="ch-<%= i %>-rf"
style="height: <%= 90- ((ch.rx_rf_lvl + 90) * 2) %>">
- <%= ch.rx_rf_lvl %>dBm
+ <%= ch.rx_rf_lvl %> dBm
@@ -33,9 +33,9 @@
+ style="height: <%= 90- (ch.rx_rf_lvl * 2) %>">
- <%= ch.audio_lvl %>dBFS
+ <%= ch.audio_lvl %> dBFS
@@ -43,7 +43,12 @@
- <%= ch.audio_gain %>dB
+ <%= ch.audio_gain %>dB
+
+
+
+
+
diff --git a/plugins/watchout/icon.png b/plugins/watchout/icon.png
index 2fe6e59..4d13a45 100644
Binary files a/plugins/watchout/icon.png and b/plugins/watchout/icon.png differ
diff --git a/plugins/watchout/icon.psd b/plugins/watchout/icon.psd
deleted file mode 100644
index d29950f..0000000
Binary files a/plugins/watchout/icon.psd and /dev/null differ
diff --git a/plugins/x32/icon.png b/plugins/x32/icon.png
index 5eb6814..5a12129 100644
Binary files a/plugins/x32/icon.png and b/plugins/x32/icon.png differ
diff --git a/plugins/x32/icon.psd b/plugins/x32/icon.psd
deleted file mode 100644
index d1f2cc3..0000000
Binary files a/plugins/x32/icon.psd and /dev/null differ
diff --git a/plugins/x32/main.js b/plugins/x32/main.js
index c0b6a51..6d28b87 100644
--- a/plugins/x32/main.js
+++ b/plugins/x32/main.js
@@ -11,15 +11,15 @@ exports.config = {
devicePort: 10023,
listenPort: 0,
validateResponse(msg, info) {
- return msg.toString().includes('/xinfo') === 0;
+ return msg.toString().includes('/xinfo');
},
},
};
-exports.ready = function ready(device) {
- const d = device;
- d.data.X32 = new Console();
- d.send('/xinfo');
+exports.ready = function ready(_device) {
+ const device = _device;
+ device.data = new Console();
+ device.send('/xinfo');
device.send('/batchsubscribe', [
{ type: 's', value: '/ch/meters' },
@@ -44,25 +44,25 @@ function parseAddress(msg) {
return addr;
}
-exports.data = function data(device, oscData) {
- this.deviceInfoUpdate(device, 'status', 'ok');
+exports.data = function data(_device, oscData) {
+ this.deviceInfoUpdate(_device, 'status', 'ok');
- const d = device;
+ const device = _device;
if (oscData.address === '/xinfo') {
- d.data.X32.info.name = oscData.args[1];
- d.data.X32.info.ip = oscData.args[0];
- d.data.X32.info.firmware = oscData.args[3];
- d.data.X32.info.model = oscData.args[2];
+ device.data.info.name = oscData.args[1];
+ device.data.info.ip = oscData.args[0];
+ device.data.info.firmware = oscData.args[3];
+ device.data.info.model = oscData.args[2];
- this.deviceInfoUpdate(device, 'defaultName', d.data.X32.info.name);
+ this.deviceInfoUpdate(_device, 'defaultName', device.data.info.name);
- d.send('/main/st/config/name');
+ device.send('/main/st/config/name');
for (let i = 0; i <= 32; i++) {
- d.send(`/ch/${i.toString().padStart(2, '0')}/config/name`);
+ device.send(`/ch/${i.toString().padStart(2, '0')}/config/name`);
}
- d.draw();
+ device.draw();
} else if (oscData.address.includes('/ch/meters')) {
const buf = Buffer.from(oscData.args[0]);
@@ -70,12 +70,12 @@ exports.data = function data(device, oscData) {
for (let i = 0; i < 70; i++) {
if (i >= 0 && i < 32) {
// These are channel meters
- d.data.X32.inputs.channels[i].meter = Console.getBehringerDB(buf.readFloatLE(offset));
+ device.data.inputs.channels[i].meter = Console.getBehringerDB(buf.readFloatLE(offset));
}
offset += 4;
}
- d.draw();
+ device.draw();
} else if (oscData.address.includes('/main/meters')) {
const buf = Buffer.from(oscData.args[0]);
let offset = 4; // skip first 4 bytes they are the length bytes
@@ -83,10 +83,10 @@ exports.data = function data(device, oscData) {
for (let i = 0; i < 49; i++) {
if (i === 22) {
// STEREO LEFT METER
- d.data.X32.main.stereo.meter[0] = Console.getBehringerDB(buf.readFloatLE(offset));
+ device.data.main.stereo.meter[0] = Console.getBehringerDB(buf.readFloatLE(offset));
} else if (i === 23) {
// STEREO RIGHT METER
- d.data.X32.main.stereo.meter[1] = Console.getBehringerDB(buf.readFloatLE(offset));
+ device.data.main.stereo.meter[1] = Console.getBehringerDB(buf.readFloatLE(offset));
}
offset += 4;
}
@@ -95,56 +95,53 @@ exports.data = function data(device, oscData) {
if (addr[0] === 'ch') {
const channel = Number(addr[1]);
- d.data.X32.inputs.channels[channel - 1].fader = oscData.args[0];
- d.data.X32.inputs.channels[channel - 1].faderDB = Console.getBehringerDB(oscData.args[0]);
+ device.data.inputs.channels[channel - 1].fader = oscData.args[0];
+ device.data.inputs.channels[channel - 1].faderDB = Console.getBehringerDB(oscData.args[0]);
} else if (addr[0] === 'main') {
- d.data.X32.main.stereo.fader = oscData.args[0];
- d.data.X32.main.stereo.faderDB = Console.getBehringerDB(oscData.args[0]);
+ device.data.main.stereo.fader = oscData.args[0];
+ device.data.main.stereo.faderDB = Console.getBehringerDB(oscData.args[0]);
}
- d.draw();
+ device.draw();
} else if (oscData.address.includes('/mix/on')) {
const addr = parseAddress(oscData.address);
if (addr[0] === 'ch') {
const channel = Number(addr[1]);
- d.data.X32.inputs.channels[channel - 1].mute = oscData.args[0];
- d.send(`/ch/${addr[1]}/mix/fader`);
+ device.data.inputs.channels[channel - 1].mute = oscData.args[0];
+ device.send(`/ch/${addr[1]}/mix/fader`);
} else if (addr[0] === 'main') {
- d.data.X32.main.stereo.mute = oscData.args[0];
- d.send(`/main/${addr[1]}/mix/fader`);
+ device.data.main.stereo.mute = oscData.args[0];
+ device.send(`/main/${addr[1]}/mix/fader`);
}
- d.draw();
+ device.draw();
} else if (oscData.address.includes('/config/name')) {
const addr = parseAddress(oscData.address);
if (addr[0] === 'main') {
if (addr[1] === 'st') {
- d.data.X32.main.stereo.name = oscData.args[0];
- if (d.data.X32.main.stereo.name === '') {
- d.data.X32.main.stereo.name = 'LR';
+ device.data.main.stereo.name = oscData.args[0];
+ if (device.data.main.stereo.name === '') {
+ device.data.main.stereo.name = 'LR';
}
- d.send(`/main/${addr[1]}/config/color`);
+ device.send(`/main/${addr[1]}/config/color`);
}
} else if (addr[0] === 'ch') {
const channel = Number(addr[1]);
- d.data.X32.inputs.channels[channel - 1].name = oscData.args[0];
- d.send(`/ch/${addr[1]}/config/color`);
+ device.data.inputs.channels[channel - 1].name = oscData.args[0];
+ device.send(`/ch/${addr[1]}/config/color`);
}
- d.draw();
+ device.draw();
} else if (oscData.address.includes('/config/color')) {
const addr = parseAddress(oscData.address);
if (addr[0] === 'main') {
- d.data.X32.main.stereo.color = oscData.args[0];
- d.send(`/main/${addr[1]}/mix/on`);
+ device.data.main.stereo.color = oscData.args[0];
+ device.send(`/main/${addr[1]}/mix/on`);
} else if (addr[0] === 'ch') {
const channel = Number(addr[1]);
- d.data.X32.inputs.channels[channel - 1].color = oscData.args[0];
- d.send(`/ch/${addr[1]}/mix/on`);
+ device.data.inputs.channels[channel - 1].color = oscData.args[0];
+ device.send(`/ch/${addr[1]}/mix/on`);
}
- d.draw();
- } else {
- // console.log(oscData);
+ device.draw();
}
- // console.log(msg)
};
exports.heartbeat = function heartbeat(device) {
diff --git a/plugins/x32/styles.css b/plugins/x32/styles.css
index 8282031..a163959 100644
--- a/plugins/x32/styles.css
+++ b/plugins/x32/styles.css
@@ -30,7 +30,6 @@ tr td:first-child {
padding: 1px 6px;
border-radius: 10px;
color: black;
- font-family: PlexMono !important;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
@@ -136,12 +135,7 @@ input[type='range']::-webkit-slider-runnable-track {
.meter {
height: 3px;
- background: linear-gradient(
- 90deg,
- rgba(19, 126, 30, 1) 0%,
- rgba(255, 238, 30, 1) 85%,
- rgba(255, 0, 0, 1) 100%
- );
+ background: linear-gradient(90deg, rgba(19, 126, 30, 1) 0%, rgba(255, 238, 30, 1) 85%, rgba(255, 0, 0, 1) 100%);
}
/* need to find a way to match the color of this with the table row */
diff --git a/plugins/x32/template.ejs b/plugins/x32/template.ejs
index cd6baf8..e4e6a6c 100644
--- a/plugins/x32/template.ejs
+++ b/plugins/x32/template.ejs
@@ -1,6 +1,6 @@
<%= listName %>
- <%= data.model %>
+ <%= data.info.model %>
@@ -13,15 +13,15 @@
LR
- <%- data.X32.main.stereo.name%>
- M
- <%= formatAsDB(data.X32.main.stereo.faderDB) %>
+ <%- data.main.stereo.name%>
+ M
+ <%= formatAsDB(data.main.stereo.faderDB) %>
- <% let style = `style=width:${Math.abs(data.X32.main.stereo.meter[0] - 10)}%`; %>
+ <% let style = `style=width:${Math.abs(data.main.stereo.meter[0] - 10)}%`; %>
- <% style = `style=width:${Math.abs(data.X32.main.stereo.meter[1] - 10)}%`; %>
+ <% style = `style=width:${Math.abs(data.main.stereo.meter[1] - 10)}%`; %>
@@ -29,22 +29,22 @@
type="range"
min="0"
max="100"
- value="<%= data.X32.main.stereo.fader*100 %>"
+ value="<%= data.main.stereo.fader*100 %>"
disabled />
- <% for(var i=0; i<32; i++){ %> <% if(data.X32.inputs.channels[i].name == "end"){break;} %>
+ <% for(var i=0; i<32; i++){ %> <% if(data.inputs.channels[i].name == "end"){break;} %>
<%= i+1 %>
-
- M
- <%= formatAsDB(data.X32.inputs.channels[i].faderDB) %>
+ M
+ <%= formatAsDB(data.inputs.channels[i].faderDB) %>
- <% let style = `style=width:${Math.abs(data.X32.inputs.channels[i].meter - 10)}%`; %>
+ <% let style = `style=width:${Math.abs(data.inputs.channels[i].meter - 10)}%`; %>
@@ -52,7 +52,7 @@
type="range"
min="0"
max="100"
- value="<%= data.X32.inputs.channels[i].fader*100 %>"
+ value="<%= data.inputs.channels[i].fader*100 %>"
disabled />
diff --git a/plugins/xair/icon.png b/plugins/xair/icon.png
index d68a095..98e33b0 100644
Binary files a/plugins/xair/icon.png and b/plugins/xair/icon.png differ
diff --git a/plugins/xair/icon.psd b/plugins/xair/icon.psd
deleted file mode 100644
index fd2554f..0000000
Binary files a/plugins/xair/icon.psd and /dev/null differ
diff --git a/preload.js b/preload.js
index ef0119b..cb7f165 100644
--- a/preload.js
+++ b/preload.js
@@ -96,6 +96,8 @@ window.init = function init() {
const deviceID = e.srcElement.id;
if (e.srcElement.id !== 'device-list') {
VIEW.switchDevice(deviceID);
+ } else {
+ VIEW.switchDevice(undefined);
}
};
@@ -130,22 +132,6 @@ window.init = function init() {
}
}
};
-
- document.getElementById('device-list-col').onclick = function deviceListClick(e) {
- try {
- document.querySelector('#device-list .active-device').classList.remove('active-device');
- ipcRenderer.send('disableDeviceDropdown', '');
- } catch (err) {
- // console.log(err)
- }
- try {
- document.getElementsByClassName('active-device-outline')[0].classList.remove('active-device-outline');
- } catch (err) {
- // console.log(err)
- }
-
- VIEW.switchDevice();
- };
};
ipcRenderer.on('setActiveDevicePinned', (event, message) => {
diff --git a/src/assets/css/index.css b/src/assets/css/index.css
index 44cd0d2..c3b675a 100644
--- a/src/assets/css/index.css
+++ b/src/assets/css/index.css
@@ -78,7 +78,10 @@ a {
#device-list {
box-sizing: border-box;
width: 100%;
+ height: calc(100% - 387px);
padding: 0px 10px;
+ overflow-x: hidden;
+ overflow-y: scroll;
}
#device-list div {
pointer-events: none;
@@ -183,6 +186,15 @@ a {
#device-settings #device-settings-rx-port {
width: 70px;
}
+#network-indicator-dot {
+ position: absolute;
+ left: 250px;
+ bottom: 8px;
+ background: #00ff00;
+ width: 8px;
+ height: 8px;
+ border-radius: 4px;
+}
/* SECOND COL */
#all-devices {
@@ -191,11 +203,20 @@ a {
background-color: rgba(0, 0, 0, 0.3);
}
.device-pin {
+ position: absolute;
+ right: 45px;
+ top: 4px;
+ height: 20px;
+ padding: inherit;
+}
+.device-traffic-signal {
position: absolute;
right: 15px;
top: 4px;
height: 20px;
padding: inherit;
+ opacity: 0.3;
+ transition: opacity 0.1s ease-in-out;
}
.device-wrapper {
box-sizing: border-box;
@@ -350,3 +371,20 @@ select.button:focus {
body :not(input):not(select):not(textarea) {
user-select: none;
}
+
+::-webkit-scrollbar {
+ /* background-color: black; */
+ width: 12px;
+}
+::-webkit-scrollbar-track,
+::-webkit-scrollbar-corner {
+ background-color: rgba(0, 0, 0, 0.1);
+}
+::-webkit-scrollbar-thumb {
+ background-color: #6b6b6b;
+ border-radius: 16px;
+ border: 3px solid #2b2b2b;
+}
+::-webkit-scrollbar-button {
+ display: none;
+}
diff --git a/src/assets/img/icon.icns b/src/assets/img/icon.icns
index 77a4100..be0df3c 100644
Binary files a/src/assets/img/icon.icns and b/src/assets/img/icon.icns differ
diff --git a/src/assets/img/icon.ico b/src/assets/img/icon.ico
index 89251af..7a5afff 100644
Binary files a/src/assets/img/icon.ico and b/src/assets/img/icon.ico differ
diff --git a/src/assets/img/icon.png b/src/assets/img/icon.png
index 50dfd9b..2907f3f 100644
Binary files a/src/assets/img/icon.png and b/src/assets/img/icon.png differ
diff --git a/src/assets/img/outline_link_white_18dp.png b/src/assets/img/outline_link_white_18dp.png
new file mode 100644
index 0000000..ba63727
Binary files /dev/null and b/src/assets/img/outline_link_white_18dp.png differ
diff --git a/src/device.js b/src/device.js
index f29d483..c73fe7f 100644
--- a/src/device.js
+++ b/src/device.js
@@ -2,7 +2,7 @@ const { v4: uuid } = require('uuid');
const osc = require('osc');
const net = require('net');
const udp = require('dgram');
-
+const { Atem } = require('atem-connection');
const PLUGINS = require('./plugins.js');
const VIEW = require('./view.js');
const SAVESLOTS = require('./saveSlots.js');
@@ -49,13 +49,16 @@ function registerDevice(newDevice, discoveryMethod) {
localPort: newLocalPort,
addresses: newDevice.addresses,
data: {},
+ templates: {},
fields: newDevice.fields || {},
pinIndex: false,
lastDrawn: 0,
lastHeartbeat: 0,
lastMessage: 0,
+ sendQueue: [],
heartbeatInterval: PLUGINS.all[newDevice.type].heartbeatInterval,
heartbeatTimeout: PLUGINS.all[newDevice.type].heartbeatTimeout,
+ trafficSignal: VIEW.trafficSignal,
draw() {
VIEW.draw(this);
},
@@ -138,10 +141,16 @@ function initDeviceConnection(id) {
} catch (err) {
console.error(err);
}
+ device.trafficSignal(device);
device.lastMessage = Date.now();
});
device.send = (address, args) => {
- device.connection.send({ address, args });
+ const addr = address;
+ const arg = args;
+ device.sendQueue.push({ address: addr, args: arg });
+ };
+ device.sendNow = (data) => {
+ device.connection.send(data);
};
} else if (plugins[type].config.connectionType === 'TCPsocket') {
device.connection = new net.Socket();
@@ -166,10 +175,14 @@ function initDeviceConnection(id) {
// log("SOCK IN", message);
plugins[type].data(device, message);
device.lastMessage = Date.now();
+ device.trafficSignal(device);
infoUpdate(device, 'status', 'ok');
});
device.send = (data) => {
// log("SOCK OUT", data);
+ device.sendQueue.push(data);
+ };
+ device.sendNow = (data) => {
device.connection.write(data);
};
} else if (plugins[type].config.connectionType === 'UDPsocket') {
@@ -181,12 +194,16 @@ function initDeviceConnection(id) {
device.connection.on('message', (msg, info) => {
plugins[type].data(device, msg);
device.lastMessage = Date.now();
+ device.trafficSignal(device);
infoUpdate(device, 'status', 'ok');
});
});
device.send = (data) => {
- device.connection.send(Buffer.from(data), device.remotePort, device.addresses[0], (err) => {
+ device.sendQueue.push(data);
+ };
+ device.sendNow = (data) => {
+ device.connection.send(Buffer.from(data), device.port, device.addresses[0], (err) => {
// console.log(err);
});
};
@@ -199,11 +216,33 @@ function initDeviceConnection(id) {
device.connection.on('message', (msg, info) => {
plugins[type].data(device, msg);
device.lastMessage = Date.now();
+ device.trafficSignal(device);
infoUpdate(device, 'status', 'ok');
});
});
device.send = (data) => {};
+ } else if (plugins[type].config.connectionType === 'atem') {
+ device.connection = new Atem({
+ // this gets around the no workers nodejs error
+ disableMultithreaded: true,
+ });
+ device.connection.connect(device.addresses[0]);
+
+ device.connection.on('connected', () => {
+ infoUpdate(device, 'status', 'ok');
+ device.trafficSignal(device);
+ plugins[type].ready(device);
+ });
+
+ device.connection.on('stateChanged', (state, pathToChange) => {
+ device.lastMessage = Date.now();
+ plugins[type].data(device, {
+ pathToChange,
+ state,
+ });
+ infoUpdate(device, 'status', 'ok');
+ });
}
return true;
@@ -217,8 +256,14 @@ module.exports.deleteActive = function deleteActive() {
);
if (choice) {
- if (device.plugin.connectionType === 'TCPsocket') {
+ if (device.plugin.config.connectionType === 'TCPsocket') {
device.connection.destroy();
+ } else if (device.plugin.config.connectionType === 'UDPsocket') {
+ device.connection.close();
+ } else if (device.plugin.config.connectionType === 'multicast') {
+ device.connection.close();
+ } else if (device.plugin.config.connectionType.startsWith('osc')) {
+ device.connection.close();
}
VIEW.removeDeviceFromList(device);
delete devices[device.id];
@@ -315,9 +360,27 @@ function heartbeat() {
}
d.lastHeartbeat = Date.now();
}
+
+ if (d.sendQueue.length > 0 && d.sendNow) {
+ d.sendNow(d.sendQueue[0]);
+ d.sendQueue.shift();
+ }
});
}
-setInterval(heartbeat, 100);
+setInterval(heartbeat, 50);
+
+function networkTick() {
+ Object.keys(devices).forEach((deviceID) => {
+ const d = devices[deviceID];
+
+ if (d.sendQueue.length > 0 && d.sendNow) {
+ d.sendNow(d.sendQueue[0]);
+ d.sendQueue.shift();
+ d.trafficSignal(d);
+ }
+ });
+}
+setInterval(networkTick, 10);
function isDeviceAlreadyAdded(newDevice) {
let deviceAlreadyAdded = false;
diff --git a/src/search.js b/src/search.js
index 6890131..27bfcbc 100644
--- a/src/search.js
+++ b/src/search.js
@@ -5,6 +5,7 @@ const net = require('net');
const os = require('os');
const ip = require('ip');
+const { Netmask } = require('netmask');
const DEVICE = require('./device.js');
const PLUGINS = require('./plugins.js');
@@ -91,6 +92,8 @@ function searchAll() {
searchUDP(pluginType, plugin.config);
} else if (searchType === 'multicast') {
searchMulticast(pluginType, plugin.config);
+ } else if (searchType === 'UDPScan') {
+ searchUDPScan(pluginType, plugin.config);
}
} catch (err) {
console.error(`Unable to search for plugin ${pluginType}`);
@@ -167,6 +170,36 @@ function TCPtest(ipAddr, pluginType, pluginConfig) {
});
}
+function searchUDPScan(pluginType, pluginConfig) {
+ for (let i = 0; i < Object.keys(validInterfaces).length; i++) {
+ const interfaceID = Object.keys(validInterfaces)[i];
+ const interfaceObj = validInterfaces[interfaceID];
+ interfaceObj.forEach((netInterface) => {
+ const udpSocket = dgram.createSocket('udp4');
+ udpSocket.bind(pluginConfig.searchOptions.listenPort, netInterface.address);
+
+ udpSocket.on('message', (msg, info) => {
+ if (pluginConfig.searchOptions.validateResponse(msg, info, DEVICE.all)) {
+ udpSocket.close();
+ DEVICE.registerDevice(
+ {
+ type: pluginType,
+ defaultName: pluginConfig.defaultName,
+ port: pluginConfig.defaultPort,
+ addresses: [info.address],
+ },
+ 'fromSearch'
+ );
+ }
+ });
+ const interfaceBlock = new Netmask(netInterface.cidr);
+ interfaceBlock.forEach((address, long, index) => {
+ udpSocket.send(pluginConfig.searchOptions.searchBuffer, pluginConfig.searchOptions.devicePort, address);
+ });
+ });
+ }
+}
+
function searchUDP(pluginType, pluginConfig) {
for (let i = 0; i < Object.keys(validInterfaces).length; i++) {
const interfaceID = Object.keys(validInterfaces)[i];
diff --git a/src/view.js b/src/view.js
index 937ca01..1c144b1 100644
--- a/src/view.js
+++ b/src/view.js
@@ -21,23 +21,26 @@ function drawDeviceFrame(id) {
const d = DEVICE.all[id];
- let str = '';
- str += ` `;
+ const str = `
+
+
+
- // scrollbar styles are inline to prevent the styles flickering in
- str += '';
- str += " ";
- str += '';
-
- str += generateBodyHTML(d);
-
- str += '';
+
+
+
+
+
+ ${generateBodyHTML(d)}
+
+
+ `;
$deviceDrawArea.setAttribute('class', `${d.type} draw-area`);
$deviceDrawArea.contentWindow.document.open();
@@ -57,29 +60,34 @@ function drawDeviceFrame(id) {
}
function generateBodyHTML(d) {
- let str = '';
-
if (d.status === 'ok') {
try {
- str += PLUGINS.all[d.type].template({
+ return PLUGINS.all[d.type].template({
+ templates: d.templates,
data: d.data,
listName: d.displayName || d.defaultName,
});
} catch (err) {
console.log(err);
- str += 'Plugin Template Error ';
+ return 'Plugin Template Error ';
}
} else {
- str += `${d.displayName || d.defaultName} `;
- str += "";
- str += `
${d.type} is not responding to requests for data. `;
- str += `IP ${d.addresses[0]} `;
- str += `Port ${d.remotePort} `;
- str += ' ';
- str += `${PLUGINS.all[d.type].info()}
`;
- }
+ return `
+
+ ${d.displayName || d.defaultName}
+
- return str;
+
+
${d.type} is not responding to requests for data.
+ IP ${d.addresses[0]}
+ Port ${d.port}
+
+
+
+ ${PLUGINS.all[d.type].info()}
+
+ `;
+ }
}
module.exports.draw = function draw(device) {
@@ -114,8 +122,10 @@ module.exports.addDeviceToList = function addDeviceToList(device) {
html += "
clear
";
}
- html += `
`;
- html += `
${d.displayName || d.defaultName}
`;
+ html += `
+
+
${d.displayName || d.defaultName}
+ `;
const elem = document.getElementById(d.id);
if (elem == null) {
@@ -152,6 +162,10 @@ function switchDevice(id) {
if (id === undefined) {
document.getElementById('refresh-device-button').disabled = true;
document.getElementById('device-settings-table').style.display = 'none';
+ const $activeDevice = document.querySelector('.active-device');
+ if ($activeDevice) {
+ $activeDevice.classList.remove('active-device');
+ }
return;
}
@@ -161,7 +175,10 @@ function switchDevice(id) {
const $deviceWrapper = document.getElementById(`device-${i}`);
if (!$deviceWrapper) {
- const html = `
`;
+ let html = `
`;
+ html += `
`;
+ html += `
`;
+ html += `
`;
document.getElementById('all-devices').insertAdjacentHTML('afterbegin', html);
}
@@ -213,8 +230,8 @@ function updateFields() {
const fields = activeDevice.plugin.config.fields;
fields.forEach((field) => {
+ // generic input setup
const $elem = document.createElement('input');
- $elem.type = 'text';
$elem.value = activeDevice.fields[field.key];
$elem.name = field.key;
$elem.onchange = function onchange(e) {
@@ -223,7 +240,9 @@ function updateFields() {
saveAll();
};
+ // type specific setup
if (field.type === 'textinput') {
+ $elem.type = 'text';
const rowHTML = `
${field.label}: `;
document.getElementById('device-settings-fields').insertAdjacentHTML('beforeend', rowHTML);
document.getElementById(field.key).appendChild($elem);
@@ -310,6 +329,16 @@ module.exports.selectNextDevice = function selectNextDevice() {
switchDevice(keys[prevIndex]);
};
+module.exports.trafficSignal = function trafficSignal(device) {
+ const $signal = document.querySelector(`#device-${device.id} .device-traffic-signal`);
+ if ($signal) {
+ $signal.style.opacity = 1;
+ setTimeout(() => {
+ $signal.style.opacity = 0.3;
+ }, 50);
+ }
+};
+
function populatePluginLists() {
let typeSelect = '';
let addSelect = '
+ ';