code for proxy (for testing)
This commit is contained in:
parent
1a3af2f782
commit
34d0579018
12 changed files with 6619 additions and 933 deletions
21
dmx-web.js
21
dmx-web.js
|
@ -4,6 +4,7 @@ const http = require('http');
|
||||||
const body = require('body-parser');
|
const body = require('body-parser');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const socketio = require('socket.io');
|
const socketio = require('socket.io');
|
||||||
|
const socketioClient = require('socket.io-client');
|
||||||
const program = require('commander');
|
const program = require('commander');
|
||||||
const DMX = require('dmx');
|
const DMX = require('dmx');
|
||||||
const A = DMX.Animation;
|
const A = DMX.Animation;
|
||||||
|
@ -106,7 +107,27 @@ function DMXWeb() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const socket = socketioClient("https://light.glitches.me");
|
||||||
|
socket.on("register", () => {
|
||||||
|
socket.emit('init', {'devices': dmx.devices, 'setup': config});
|
||||||
|
})
|
||||||
|
|
||||||
|
socket.on('request_refresh', () => {
|
||||||
|
for (const universe in config.universes) {
|
||||||
|
socket.emit('update', universe, dmx.universeToObject(universe));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('update', (universe, update) => {
|
||||||
|
dmx.update(universe, update);
|
||||||
|
});
|
||||||
|
|
||||||
|
dmx.on('update', (universe, update) => {
|
||||||
|
socket.emit('update', universe, update);
|
||||||
|
});
|
||||||
|
|
||||||
io.sockets.on('connection', socket => {
|
io.sockets.on('connection', socket => {
|
||||||
|
console.log("new client")
|
||||||
socket.emit('init', {'devices': dmx.devices, 'setup': config});
|
socket.emit('init', {'devices': dmx.devices, 'setup': config});
|
||||||
|
|
||||||
socket.on('request_refresh', () => {
|
socket.on('request_refresh', () => {
|
||||||
|
|
121
dmx-web.json
Normal file
121
dmx-web.json
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
{
|
||||||
|
"_title": "DMX Dashboard",
|
||||||
|
"_comment1": "To have a different page title change _title to title.",
|
||||||
|
"server": {
|
||||||
|
"listen_port": 8080,
|
||||||
|
"listen_host": "::",
|
||||||
|
|
||||||
|
"_uid": "www-data",
|
||||||
|
"_gid": "www-data",
|
||||||
|
"_comment1": "To drop privileges change the '_uid' and '_gid' keys to 'uid' and 'gid'.",
|
||||||
|
"_comment2": "On macOS uid and gid must be set in the launchd script."
|
||||||
|
},
|
||||||
|
"presets": [
|
||||||
|
{
|
||||||
|
"label": "White",
|
||||||
|
"values": {
|
||||||
|
"office": { "1": 16, "2": 255, "3": 0, "4": 255, "5": 255, "6": 255, "16": 16, "17": 255, "18": 0, "19": 255, "20": 255, "21": 255 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Natural",
|
||||||
|
"values": {
|
||||||
|
"office": { "1": 16, "2": 255, "3": 0, "4":255, "5": 190, "6": 140, "16": 16, "17": 255, "18": 0, "19": 255, "20": 190, "21":140 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Worklight",
|
||||||
|
"values": {
|
||||||
|
"office": { "1": 16, "2": 130, "3": 0, "4": 255, "5": 165, "6": 0, "16": 1, "17": 255, "18": 0, "19": 255, "20": 190, "21": 140, "22": 0, "23": 0, "24": 0, "25": 255, "26": 190, "27": 140 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Chill",
|
||||||
|
"values": {
|
||||||
|
"office": { "1": 16, "2": 255, "3": 0, "4": 255, "5": 39, "6": 0, "16": 1, "17": 255, "18": 0, "19": 255, "20": 255, "21": 0, "22": 0, "23": 0, "24": 0, "25": 128, "26": 0, "27": 255, "32": 255, "33": 60 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Cinema",
|
||||||
|
"values": {
|
||||||
|
"office": { "1": 16, "2": 30, "3":0, "4": 255, "5": 39, "6": 0, "16": 0, "32": 255, "33": 0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"universes": {
|
||||||
|
"office": {
|
||||||
|
"output": {
|
||||||
|
"driver": "enttec-usb-dmx-pro",
|
||||||
|
"device": "/dev/ttyUSB0"
|
||||||
|
},
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"type": "generic-rgb",
|
||||||
|
"address": 4,
|
||||||
|
"name": "rgb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "generic-rgb",
|
||||||
|
"address": 8,
|
||||||
|
"name": "rgb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "generic-rgb",
|
||||||
|
"address": 12,
|
||||||
|
"name": "rgb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "generic-rgb",
|
||||||
|
"address": 16,
|
||||||
|
"name": "rgb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "generic-rgb",
|
||||||
|
"address": 20,
|
||||||
|
"name": "rgb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "generic-rgb",
|
||||||
|
"address": 24,
|
||||||
|
"name": "rgb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "generic-rgb",
|
||||||
|
"address": 28,
|
||||||
|
"name": "rgb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "generic-rgb",
|
||||||
|
"address": 32,
|
||||||
|
"name": "rgb"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_animPresets": [{
|
||||||
|
"_comment1": "Change _animPresets to animPresets for a new tab with all preset animations",
|
||||||
|
"_comment2": "Check documentation for how to make animations",
|
||||||
|
"label": "test",
|
||||||
|
"anim": {
|
||||||
|
"office": [{
|
||||||
|
"to": {
|
||||||
|
"10": 0,
|
||||||
|
"20": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"to": {
|
||||||
|
"10": 255
|
||||||
|
},
|
||||||
|
"duration": 2000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"to": {
|
||||||
|
"20": 255
|
||||||
|
},
|
||||||
|
"duration": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
5543
package-lock.json
generated
Normal file
5543
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -19,10 +19,11 @@
|
||||||
"light control"
|
"light control"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dmx": "^0.2.0",
|
|
||||||
"commander": "^2.12.2",
|
"commander": "^2.12.2",
|
||||||
|
"dmx": "^0.2.0",
|
||||||
"express": "^4.16.2",
|
"express": "^4.16.2",
|
||||||
"socket.io": "^2.0.4"
|
"socket.io": "^2.0.4",
|
||||||
|
"socket.io-client": "^4.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
|
|
Loading…
Reference in a new issue