diff --git a/index.html b/index.html
index 7000668..296d0c2 100644
--- a/index.html
+++ b/index.html
@@ -49,17 +49,33 @@
| Addr: |
-
+
|
- | Port: |
+ Port: |
-
+
|
Pin: |
|
+
+ | Local: |
+
+
+ |
+ |
+ |
+
diff --git a/plugins/artnet/main.js b/plugins/artnet/main.js
index e4a3993..da8039b 100644
--- a/plugins/artnet/main.js
+++ b/plugins/artnet/main.js
@@ -1,8 +1,8 @@
exports.config = {
defaultName: 'Art-Net',
connectionType: 'UDPsocket',
- defaultPort: 6454,
- mayChangePort: false,
+ remotePort: 6454,
+ mayChangePorts: false,
heartbeatInterval: 5000,
heartbeatTimeout: 15000,
searchOptions: {
diff --git a/plugins/digico/main.js b/plugins/digico/main.js
index b1899bd..ea6864c 100644
--- a/plugins/digico/main.js
+++ b/plugins/digico/main.js
@@ -5,8 +5,9 @@ const path = require('path');
exports.config = {
defaultName: 'DiGiCo',
connectionType: 'osc-udp',
- defaultPort: 8000,
- mayChangePort: true,
+ remotePort: 8000,
+ localPort: 8001,
+ mayChangePorts: true,
heartbeatInterval: 2000,
heartbeatTimeout: 11000,
searchOptions: {
@@ -65,7 +66,7 @@ exports.data = function data(_device, oscData) {
// });
} else if (properties[0] === 'Console' && properties[1] === 'Input_Channels') {
for (let i = 1; i <= device.data.Console.Input_Channels; i++) {
- device.send(`/Input_Channels/${i}/Channel_Input/name`);
+ device.send(`/Input_Channels/${i}/Channel_Input/name`); // yup, no ? at the end of this one
device.send(`/Input_Channels/${i}/mute/?`);
device.send(`/Input_Channels/${i}/solo/?`);
device.send(`/Input_Channels/${i}/fader/?`);
diff --git a/plugins/eos/main.js b/plugins/eos/main.js
index 2025e06..bde2873 100644
--- a/plugins/eos/main.js
+++ b/plugins/eos/main.js
@@ -6,8 +6,8 @@ const Cue = require('./cue');
exports.config = {
defaultName: 'ETC Eos',
connectionType: 'osc',
- defaultPort: 3032,
- mayChangePort: true,
+ remotePort: 3032,
+ mayChangePorts: true,
heartbeatInterval: 5000,
heartbeatTimeout: 6000,
searchOptions: {
diff --git a/plugins/pjlink/main.js b/plugins/pjlink/main.js
index e1e227b..d701049 100644
--- a/plugins/pjlink/main.js
+++ b/plugins/pjlink/main.js
@@ -3,8 +3,8 @@ const md5 = require('md5');
exports.config = {
defaultName: 'PJLink Projector',
connectionType: 'TCPsocket',
- defaultPort: 4352,
- mayChangePort: false,
+ remotePort: 4352,
+ mayChangePorts: false,
heartbeatInterval: 5000,
heartbeatTimeout: 15000,
searchOptions: {
diff --git a/plugins/qlab/main.js b/plugins/qlab/main.js
index a7c67d8..e161243 100644
--- a/plugins/qlab/main.js
+++ b/plugins/qlab/main.js
@@ -5,8 +5,9 @@ const path = require('path');
exports.config = {
defaultName: 'QLab',
connectionType: 'osc',
- defaultPort: 53000,
- mayChangePort: true,
+ remotePort: 53000,
+ localPort: 53001,
+ mayChangePorts: true,
heartbeatInterval: 100,
heartbeatTimeout: 5000,
searchOptions: {
diff --git a/plugins/sacn/main.js b/plugins/sacn/main.js
index ed2835d..7f3c176 100644
--- a/plugins/sacn/main.js
+++ b/plugins/sacn/main.js
@@ -3,8 +3,8 @@ const _ = require('lodash');
exports.config = {
defaultName: 'sACN',
connectionType: 'multicast',
- defaultPort: 5568,
- mayChangePort: false,
+ remotePort: 5568,
+ mayChangePorts: false,
heartbeatInterval: 5000,
heartbeatTimeout: 15000,
searchOptions: {
diff --git a/plugins/shure/main.js b/plugins/shure/main.js
index f4dd32c..24ead4b 100644
--- a/plugins/shure/main.js
+++ b/plugins/shure/main.js
@@ -3,8 +3,8 @@ const Channel = require('./channel');
exports.config = {
defaultName: 'Shure Wireless',
connectionType: 'TCPsocket',
- defaultPort: 2202,
- mayChangePort: false,
+ remotePort: 2202,
+ mayChangePorts: false,
heartbeatInterval: 5000,
heartbeatTimeout: 10000,
searchOptions: {
diff --git a/plugins/watchout/main.js b/plugins/watchout/main.js
index 340aa9f..d6abc35 100644
--- a/plugins/watchout/main.js
+++ b/plugins/watchout/main.js
@@ -1,8 +1,8 @@
exports.config = {
defaultName: 'Dataton Watchout',
connectionType: 'TCPsocket',
- defaultPort: 3040,
- mayChangePort: false,
+ remotePort: 3040,
+ mayChangePorts: false,
heartbeatInterval: 250,
heartbeatTimeout: 5000,
searchOptions: {
diff --git a/plugins/x32/main.js b/plugins/x32/main.js
index 3f12f97..c0b6a51 100644
--- a/plugins/x32/main.js
+++ b/plugins/x32/main.js
@@ -1,8 +1,8 @@
exports.config = {
defaultName: 'X32 Mixer',
connectionType: 'osc-udp',
- defaultPort: 10023,
- mayChangePort: false,
+ remotePort: 10023,
+ mayChangePorts: false,
heartbeatInterval: 9000,
heartbeatTimeout: 11000,
searchOptions: {
diff --git a/plugins/xair/main.js b/plugins/xair/main.js
index ffc70f3..482360b 100644
--- a/plugins/xair/main.js
+++ b/plugins/xair/main.js
@@ -1,8 +1,8 @@
exports.config = {
defaultName: 'X Air Mixer',
connectionType: 'UDPsocket',
- defaultPort: 10024,
- mayChangePort: false,
+ remotePort: 10024,
+ mayChangePorts: false,
heartbeatInterval: 9000,
heartbeatTimeout: 15000,
searchOptions: {
diff --git a/preload.js b/preload.js
index ce7ef2f..ef0119b 100644
--- a/preload.js
+++ b/preload.js
@@ -59,6 +59,11 @@ window.init = function init() {
DEVICE.changeActivePort(e.target.value);
};
+ document.getElementById('device-settings-rx-port').onchange = function portChange(e) {
+ e.stopPropagation();
+ DEVICE.changeActiveRxPort(e.target.value);
+ };
+
document.getElementById('device-settings-pin').onchange = function pinChange(e) {
e.stopPropagation();
if (e.target.checked) {
@@ -99,7 +104,7 @@ window.init = function init() {
{
type: e.target.value,
defaultName: 'New Device',
- port: undefined,
+ remotePort: PLUGINS.all[e.target.value].config.remotePort || '',
addresses: [],
},
'fromAddButton'
diff --git a/src/assets/css/index.css b/src/assets/css/index.css
index 9ab1a51..44cd0d2 100644
--- a/src/assets/css/index.css
+++ b/src/assets/css/index.css
@@ -179,7 +179,8 @@ a {
#device-settings #device-settings-plugin-dropdown {
width: 170px;
}
-#device-settings #device-settings-port {
+#device-settings #device-settings-port,
+#device-settings #device-settings-rx-port {
width: 70px;
}
diff --git a/src/device.js b/src/device.js
index 91923bd..f29d483 100644
--- a/src/device.js
+++ b/src/device.js
@@ -27,6 +27,16 @@ function registerDevice(newDevice, discoveryMethod) {
return false;
}
+ // set the local port for the new device
+ let newLocalPort = newDevice.localPort;
+ if (!newLocalPort) {
+ if (PLUGINS.all[newDevice.type].config.localPort) {
+ newLocalPort = PLUGINS.all[newDevice.type].config.localPort;
+ } else {
+ newLocalPort = newDevice.remotePort;
+ }
+ }
+
const id = newDevice.id || uuid();
devices[id] = {
id,
@@ -35,7 +45,8 @@ function registerDevice(newDevice, discoveryMethod) {
type: newDevice.type,
displayName: newDevice.displayName,
defaultName: newDevice.defaultName,
- port: newDevice.port,
+ remotePort: newDevice.remotePort,
+ localPort: newLocalPort,
addresses: newDevice.addresses,
data: {},
fields: newDevice.fields || {},
@@ -79,11 +90,11 @@ function initDeviceConnection(id) {
infoUpdate(device, 'status', 'new');
- if (device.port === undefined) {
- device.port = device.plugin.config.defaultPort;
+ if (device.remotePort === undefined) {
+ device.remotePort = device.plugin.config.defaultPort;
}
- if (device.port === undefined || device.addresses.length === 0) {
+ if (device.remotePort === undefined || device.addresses.length === 0) {
return true;
}
try {
@@ -100,14 +111,14 @@ function initDeviceConnection(id) {
if (plugins[type].config.connectionType.includes('udp')) {
device.connection = new osc.UDPPort({
localAddress: '0.0.0.0',
- localPort: 8001, // added this line
+ localPort: device.localPort,
remoteAddress: device.addresses[0],
- remotePort: device.port,
+ remotePort: device.remotePort,
});
} else {
device.connection = new osc.TCPSocketPort({
address: device.addresses[0],
- port: device.port,
+ port: device.remotePort,
});
}
device.connection.open();
@@ -136,7 +147,7 @@ function initDeviceConnection(id) {
device.connection = new net.Socket();
device.connection.connect(
{
- port: device.port,
+ port: device.remotePort,
host: device.addresses[0],
},
() => {}
@@ -164,7 +175,7 @@ function initDeviceConnection(id) {
} else if (plugins[type].config.connectionType === 'UDPsocket') {
device.connection = udp.createSocket('udp4');
- device.connection.bind({ port: plugins[type].config.defaultPort }, () => {
+ device.connection.bind({ port: plugins[type].config.remotePort }, () => {
plugins[type].ready(device);
device.connection.on('message', (msg, info) => {
@@ -175,14 +186,14 @@ function initDeviceConnection(id) {
});
device.send = (data) => {
- device.connection.send(Buffer.from(data), device.port, device.addresses[0], (err) => {
+ device.connection.send(Buffer.from(data), device.remotePort, device.addresses[0], (err) => {
// console.log(err);
});
};
} else if (plugins[type].config.connectionType === 'multicast') {
device.connection = udp.createSocket('udp4');
- device.connection.bind(device.port, () => {
+ device.connection.bind(device.remotePort, () => {
plugins[type].ready(device);
device.connection.on('message', (msg, info) => {
@@ -243,7 +254,7 @@ module.exports.changeActiveIP = function changeActiveIP(newIP) {
module.exports.changeActivePort = function changeActivePort(newPort) {
const device = VIEW.getActiveDevice();
- device.port = newPort;
+ device.remotePort = newPort;
initDeviceConnection(device.id);
VIEW.draw(device);
diff --git a/src/saveSlots.js b/src/saveSlots.js
index 2ef2273..ac30072 100644
--- a/src/saveSlots.js
+++ b/src/saveSlots.js
@@ -62,7 +62,8 @@ module.exports.loadDevices = function loadDevices() {
type: savedDevices[i].type,
displayName: savedDevices[i].displayName,
defaultName: savedDevices[i].defaultName,
- port: savedDevices[i].port,
+ remotePort: savedDevices[i].remotePort,
+ localPort: savedDevices[i].localPort,
addresses: savedDevices[i].addresses,
id: savedDevices[i].id,
fields: savedDevices[i].fields,
@@ -110,7 +111,8 @@ module.exports.saveAll = function saveAll() {
type: device.type,
displayName: device.displayName,
defaultName: device.defaultName,
- port: device.port,
+ remotePort: device.remotePort,
+ localPort: device.localPort,
id: device.id,
fields: device.fields,
};
diff --git a/src/search.js b/src/search.js
index 012c2a2..6890131 100644
--- a/src/search.js
+++ b/src/search.js
@@ -127,7 +127,7 @@ function searchBonjour(pluginType, pluginConfig) {
{
type: pluginType,
defaultName: e.name,
- port: e.port,
+ remotePort: e.port,
addresses: validAddresses,
},
'fromSearch'
@@ -154,7 +154,7 @@ function TCPtest(ipAddr, pluginType, pluginConfig) {
{
type: pluginType,
defaultName: pluginConfig.defaultName,
- port: pluginConfig.defaultPort,
+ remotePort: pluginConfig.remotePort,
addresses: [ipAddr],
},
'fromSearch'
@@ -182,7 +182,7 @@ function searchUDP(pluginType, pluginConfig) {
{
type: pluginType,
defaultName: pluginConfig.defaultName,
- port: pluginConfig.defaultPort,
+ remotePort: pluginConfig.remotePort,
addresses: [info.address],
},
'fromSearch'
@@ -214,7 +214,7 @@ function searchMulticast(pluginType, pluginConfig) {
{
type: pluginType,
defaultName: pluginConfig.defaultName,
- port: pluginConfig.defaultPort,
+ remotePort: pluginConfig.remotePort,
addresses: [info.address],
},
'fromSearch'
diff --git a/src/view.js b/src/view.js
index 100395b..404abf6 100644
--- a/src/view.js
+++ b/src/view.js
@@ -74,7 +74,7 @@ function generateBodyHTML(d) {
str += "";
str += `
${d.type} is not responding to requests for data.
`;
str += `IP ${d.addresses[0]}
`;
- str += `Port ${d.port}
`;
+ str += `Port ${d.remotePort}
`;
str += '
';
str += `${PLUGINS.all[d.type].info()}
`;
}
@@ -173,13 +173,24 @@ function switchDevice(id) {
document.getElementById('device-settings-plugin-dropdown').value = activeDevice.type;
document.getElementById('device-settings-name').value = activeDevice.displayName || activeDevice.defaultName || '';
document.getElementById('device-settings-ip').value = activeDevice.addresses[0] || '';
- document.getElementById('device-settings-port').value = activeDevice.port || '';
+ document.getElementById('device-settings-port').value = activeDevice.remotePort || '';
document.getElementById('device-settings-pin').checked = activeDevice.pinIndex;
- if (activeDevice.plugin.config.mayChangePort) {
+ if (activeDevice.plugin.config.mayChangePorts) {
document.getElementById('device-settings-port').disabled = false;
+ document.getElementById('device-settings-rx-port').disabled = false;
} else {
document.getElementById('device-settings-port').disabled = true;
+ document.getElementById('device-settings-rx-port').disabled = true;
+ }
+
+ if (activeDevice.plugin.config.localPort) {
+ // document.getElementById('device-settings-port-label').textContent = 'Remote\nPort:';
+ document.getElementById('device-settings-rx-port-row').style.display = 'table-row';
+ document.getElementById('device-settings-rx-port').value = activeDevice.localPort || '';
+ } else {
+ document.getElementById('device-settings-port-label').textContent = 'Port:';
+ document.getElementById('device-settings-rx-port-row').style.display = 'none';
}
updateFields();