diff --git a/plugins/atem/main.js b/plugins/atem/main.js index 2ba1047..3efb369 100644 --- a/plugins/atem/main.js +++ b/plugins/atem/main.js @@ -21,8 +21,17 @@ exports.ready = function ready(_device) { console.log('atem ready'); }; +exports.update = function update(device, _document, updateType, data) { + const document = _document; + + if (updateType === 'tbar' && document.getElementById('tbar-pos')) { + document.getElementById('tbar-pos').value = data; + } +}; + exports.data = function data(_device, msg) { const device = _device; + this.deviceInfoUpdate(device, 'status', 'ok'); switch (msg.event) { case 'sourceConfiguration': if (device.data.source === undefined) { @@ -38,6 +47,7 @@ exports.data = function data(_device, msg) { } device.data.source[msg.sourceID] = { + ...device.data.source[msg.sourceID], ...msg.sourceConfiguration, }; break; @@ -57,9 +67,7 @@ exports.data = function data(_device, msg) { break; case 'rawCommand': - if (msg.cmd.name === '_ver') { - console.log(msg); - } else if (msg.cmd.name === '_pin') { + if (msg.cmd.name === '_pin') { if (msg.cmd.data !== undefined) { infoUpdate(device, 'defaultName', msg.cmd.data.toString().trim()); } @@ -74,7 +82,9 @@ exports.data = function data(_device, msg) { DVEs: msg.cmd.data[6], superSources: msg.cmd.data[7], }; - console.log(device); + } else if (msg.cmd.name === 'TrPs') { + const tbarPos = msg.cmd.data.readUint16BE(4); + device.update('tbar', tbarPos); } break; default: diff --git a/plugins/atem/styles.css b/plugins/atem/styles.css index e4bd169..0292585 100644 --- a/plugins/atem/styles.css +++ b/plugins/atem/styles.css @@ -37,3 +37,9 @@ h3 { justify-content: center; height: 100%; } + +.tbar-progress { + width: 100%; + height: 40px; + accent-color: limegreen; +} diff --git a/plugins/atem/template.ejs b/plugins/atem/template.ejs index fb0cb0e..faa3100 100644 --- a/plugins/atem/template.ejs +++ b/plugins/atem/template.ejs @@ -6,7 +6,7 @@

Program

<% Object.entries(data.source).forEach(([sourceID, state])=>{ %> - <% if (state.tally.program) { %> + <% if (state.tally && state.tally.program) { %>
<%= state.abbreviation %> @@ -21,13 +21,13 @@ <% } %> <% }) %>
-
- -
+
+ +

Preview

<% Object.entries(data.source).forEach(([sourceID, state])=>{ %> - <% if (state.tally.preview) { %> + <% if (state.tally && state.tally.preview) { %>
<%= state.abbreviation %>
@@ -41,5 +41,9 @@
<% } %> <% }) %> -
-
+
+
+ +
+ +
diff --git a/src/device.js b/src/device.js index bde84c8..924878a 100644 --- a/src/device.js +++ b/src/device.js @@ -230,6 +230,10 @@ function initDeviceConnection(id) { }; plugins[type].data(device, msg); }); + + device.connection.on('connectionLost', () => { + console.log('connection lost'); + }); } return true;