Compare commits
No commits in common. "210dc85558e8c9426efcd75d4936a8011f1fdf0f" and "790ea3d551f0d95fdba592a0706b5dad60d67b54" have entirely different histories.
210dc85558
...
790ea3d551
|
@ -186,10 +186,7 @@
|
||||||
"capper_on": "A",
|
"capper_on": "A",
|
||||||
"capper_off": "B",
|
"capper_off": "B",
|
||||||
"takeup_forward": "D",
|
"takeup_forward": "D",
|
||||||
"takeup_backward": "F",
|
"takeup_backward": "E"
|
||||||
"error" : "E",
|
|
||||||
"camera_exposure" : "G",
|
|
||||||
"state" : "H"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'use strict';
|
"use strict";
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@ const path_1 = require("path");
|
||||||
const uuid_1 = require("uuid");
|
const uuid_1 = require("uuid");
|
||||||
const Log = require("log");
|
const Log = require("log");
|
||||||
class Server {
|
class Server {
|
||||||
constructor(uiInput) {
|
constructor() {
|
||||||
this.id = 'server';
|
this.id = 'server';
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
this.templates = [
|
this.templates = [
|
||||||
|
@ -29,7 +29,6 @@ class Server {
|
||||||
this.queue = {};
|
this.queue = {};
|
||||||
this.intervalPeriod = 10000; //10 sec
|
this.intervalPeriod = 10000; //10 sec
|
||||||
this.init();
|
this.init();
|
||||||
this.ui = uiInput;
|
|
||||||
}
|
}
|
||||||
async init() {
|
async init() {
|
||||||
this.log = await Log({ label: this.id });
|
this.log = await Log({ label: this.id });
|
||||||
|
@ -60,9 +59,8 @@ class Server {
|
||||||
this.log.error(err);
|
this.log.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.wss.on('connection', async function (ws, req) {
|
this.wss.on('connection', async function (ws) {
|
||||||
const address = req.socket.remoteAddress;
|
ws.on("message", function (data) {
|
||||||
ws.on('message', function (data) {
|
|
||||||
let obj = JSON.parse(data);
|
let obj = JSON.parse(data);
|
||||||
//this.log.info(data)
|
//this.log.info(data)
|
||||||
if (obj.id && this.queue[obj.id]) {
|
if (obj.id && this.queue[obj.id]) {
|
||||||
|
@ -75,11 +73,9 @@ class Server {
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
ws.on('close', function () {
|
ws.on('close', function () {
|
||||||
this.log.info('Client disconnected');
|
this.log.info('Client disconnected');
|
||||||
this.notify('Client disconnected', `No longer forwarding digital display to client ${address}`);
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
await this.cmd(ws, 'mcopy');
|
await this.cmd(ws, 'mcopy');
|
||||||
this.log.info('Client connected');
|
this.log.info('Client connected');
|
||||||
this.notify('Client connected', `Forwarding digital display to client: ${address}`);
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
this.log.info(`Websocket server started!`);
|
this.log.info(`Websocket server started!`);
|
||||||
this.log.info(`WSS [ ws://localhost:${this.wsPort} ]`);
|
this.log.info(`WSS [ ws://localhost:${this.wsPort} ]`);
|
||||||
|
@ -194,11 +190,8 @@ class Server {
|
||||||
//setTimeout() ?
|
//setTimeout() ?
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
notify(title, message) {
|
|
||||||
this.ui.send('gui', { notify: { title, message } });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
module.exports = function (ui) {
|
module.exports = function () {
|
||||||
return new Server(ui);
|
return new Server();
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=index.js.map
|
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,293 +1,267 @@
|
||||||
/* jslint esversion: 6*/
|
/* jslint esversion: 6*/
|
||||||
'use strict';
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
const gui = {};
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
//GUI
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
gui.init = function () {
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
gui.version();
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
let gui;
|
|
||||||
class GUI {
|
gui.fmtZero = function (val, len) {
|
||||||
constructor() {
|
'use strict';
|
||||||
this.id = 'gui';
|
const raw = val;
|
||||||
this.notifierWorking = true;
|
let str = val + '';
|
||||||
this.spinnerCfg = {
|
let output = '';
|
||||||
lines: 11,
|
if (raw < 0) {
|
||||||
length: 15,
|
output = '-' + Array(len - (str.length - 1)).join('0') + str.replace('-', '');
|
||||||
width: 7,
|
} else {
|
||||||
radius: 20,
|
if (str.length < len) {
|
||||||
corners: 1,
|
output = Array(len - str.length).join('0') + str;
|
||||||
rotate: 0,
|
} else if (str.length >= len) {
|
||||||
direction: 1,
|
str = parseInt(str) + '';
|
||||||
color: '#F2F2F1',
|
output = Array(len - str.length).join('0') + str;
|
||||||
speed: 1,
|
}
|
||||||
trail: 60,
|
}
|
||||||
shadow: true,
|
return output;
|
||||||
hwaccel: true,
|
};
|
||||||
className: 'spinner',
|
gui.counterFormat = function (t, normal, prevent) {
|
||||||
zIndex: 2e9,
|
'use strict';
|
||||||
top: '50%',
|
const raw = t.value;
|
||||||
left: '50%' // Left position relative to parent
|
t.value = gui.fmtZero(raw, 6);
|
||||||
};
|
if (typeof normal !== 'undefined' && parseInt(raw) !== normal) {
|
||||||
}
|
$(t).addClass('changed');
|
||||||
init() {
|
} else {
|
||||||
this.version();
|
$(t).removeClass('changed');
|
||||||
this.listen();
|
}
|
||||||
}
|
};
|
||||||
listen() {
|
gui.counterUpdate = function (which, raw) {
|
||||||
ipcRenderer.on(this.id, this.listener.bind(this));
|
'use strict';
|
||||||
}
|
const formattedVal = gui.fmtZero(raw, 6);
|
||||||
listener(event, arg) {
|
$(`.${which} .count`).val(formattedVal);
|
||||||
if (arg.notify) {
|
};
|
||||||
this.notify(arg.notify.title, arg.notify.message);
|
gui.notifierWorking = true;
|
||||||
}
|
gui.notify = function (title, message) {
|
||||||
}
|
'use strict';
|
||||||
fmtZero(val, len) {
|
if (!gui.notifierWorking) {
|
||||||
const raw = val;
|
return true;
|
||||||
let str = val + '';
|
}
|
||||||
let output = '';
|
return new Promise((resolve, reject) => {
|
||||||
if (raw < 0) {
|
try {
|
||||||
output = '-' + Array(len - (str.length - 1)).join('0') + str.replace('-', '');
|
notifier.notify({
|
||||||
}
|
title: title,
|
||||||
else {
|
message: message,
|
||||||
if (str.length < len) {
|
//icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons)
|
||||||
output = Array(len - str.length).join('0') + str;
|
sound: true, // Only Notification Center or Windows Toasters
|
||||||
}
|
wait: true // Wait with callback, until user action is taken against notification
|
||||||
else if (str.length >= len) {
|
}, function (err, response) {
|
||||||
str = parseInt(str) + '';
|
// Response is response from notification
|
||||||
output = Array(len - str.length).join('0') + str;
|
if (err) {
|
||||||
}
|
gui.notifierWorking = false;
|
||||||
}
|
log.error(`Error with notification`, err);
|
||||||
return output;
|
return reject(err);
|
||||||
}
|
}
|
||||||
counterFormat(t, normal = null) {
|
return resolve(true);
|
||||||
const raw = t.value;
|
});
|
||||||
t.value = gui.fmtZero(raw, 6);
|
} catch (err) {
|
||||||
if (typeof normal !== 'undefined' && parseInt(raw) !== normal) {
|
gui.notifierWorking = false;
|
||||||
$(t).addClass('changed');
|
//notify-send is not found
|
||||||
}
|
//determine an alternate for raspian
|
||||||
else {
|
//this feels like a hack
|
||||||
$(t).removeClass('changed');
|
}
|
||||||
}
|
});
|
||||||
}
|
};
|
||||||
counterUpdate(which, raw) {
|
gui.updateCam = async function (t) {
|
||||||
const formattedVal = this.fmtZero(raw, 6);
|
'use strict';
|
||||||
$(`.${which} .count`).val(formattedVal);
|
const val = t.value;
|
||||||
}
|
let change;
|
||||||
notify(title, message) {
|
|
||||||
const config = {
|
if (parseInt(val) === cam.pos) {
|
||||||
title,
|
return false;
|
||||||
message,
|
}
|
||||||
//icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons)
|
change = await gui.confirm(`Are you sure you want to set camera counter to ${val}?`);
|
||||||
sound: true,
|
|
||||||
wait: true // Wait with callback, until user action is taken against notification
|
if (change) {
|
||||||
};
|
cam.pos = parseInt(val);
|
||||||
if (!this.notifierWorking) {
|
gui.updateState();
|
||||||
return new Promise((resolve, reject) => { return resolve(true); });
|
} else {
|
||||||
}
|
t.value = cam.pos;
|
||||||
return new Promise((resolve, reject) => {
|
gui.counterFormat(t);
|
||||||
try {
|
}
|
||||||
notifier.notify(config, function (err, response) {
|
};
|
||||||
// Response is response from notification
|
gui.updateCam2 = async function (t) {
|
||||||
if (err) {
|
'use strict';
|
||||||
this.notifierWorking = false;
|
const val = t.value;
|
||||||
log.error(`Error with notification`, err);
|
let change;
|
||||||
return reject(err);
|
|
||||||
}
|
if (parseInt(val) === cam.pos) {
|
||||||
return resolve(true);
|
return false;
|
||||||
}.bind(this));
|
}
|
||||||
}
|
change = await gui.confirm(`Are you sure you want to set second camera counter to ${val}?`);
|
||||||
catch (err) {
|
|
||||||
this.notifierWorking = false;
|
if (change) {
|
||||||
//notify-send is not found
|
cam.second.pos = parseInt(val);
|
||||||
//determine an alternate for raspian
|
gui.updateState();
|
||||||
//this feels like a hack
|
} else {
|
||||||
}
|
t.value = cam.second.pos;
|
||||||
});
|
gui.counterFormat(t);
|
||||||
}
|
}
|
||||||
updateCam(t) {
|
};
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
gui.updateProj = async function (t) {
|
||||||
const val = t.value;
|
'use strict';
|
||||||
let change;
|
const val = t.value;
|
||||||
if (parseInt(val) === cam.pos) {
|
let change;
|
||||||
return false;
|
if (parseInt(val) === proj.pos) {
|
||||||
}
|
return false;
|
||||||
change = yield this.confirm(`Are you sure you want to set camera counter to ${val}?`);
|
}
|
||||||
if (change) {
|
change = await gui.confirm(`Are you sure you want to set projector counter to ${val}?`);
|
||||||
cam.pos = parseInt(val);
|
if (change) {
|
||||||
this.updateState();
|
proj.pos = parseInt(val);
|
||||||
}
|
gui.updateState();
|
||||||
else {
|
} else {
|
||||||
t.value = cam.pos;
|
t.value = proj.pos;
|
||||||
this.counterFormat(t);
|
gui.counterFormat(t);
|
||||||
}
|
}
|
||||||
});
|
proj.setValue(t.value);
|
||||||
}
|
};
|
||||||
updateCam2(t) {
|
gui.updateProj2 = async function (t) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
'use strict';
|
||||||
const val = t.value;
|
const val = t.value;
|
||||||
let change;
|
let change;
|
||||||
if (parseInt(val) === cam.pos) {
|
if (parseInt(val) === proj.second.pos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
change = yield this.confirm(`Are you sure you want to set second camera counter to ${val}?`);
|
change = await gui.confirm(`Are you sure you want to set second projector counter to ${val}?`);
|
||||||
if (change) {
|
if (change) {
|
||||||
cam.second.pos = parseInt(val);
|
proj.second.pos = parseInt(val);
|
||||||
this.updateState();
|
gui.updateState();
|
||||||
}
|
} else {
|
||||||
else {
|
t.value = proj.second.pos;
|
||||||
t.value = cam.second.pos;
|
gui.counterFormat(t);
|
||||||
this.counterFormat(t);
|
}
|
||||||
}
|
proj.setValue(t.value);
|
||||||
});
|
};
|
||||||
}
|
|
||||||
updateProj(t) {
|
gui.updateState = function () {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
'use strict';
|
||||||
const val = t.value;
|
const cpos = cam.pos;
|
||||||
let change;
|
const ppos = proj.pos;
|
||||||
if (parseInt(val) === proj.pos) {
|
|
||||||
return false;
|
const p2pos = proj.second.pos;
|
||||||
}
|
const c2pos = cam.second.pos;
|
||||||
change = yield this.confirm(`Are you sure you want to set projector counter to ${val}?`);
|
|
||||||
if (change) {
|
$('#seq_cam_count').val(cpos).change();
|
||||||
proj.pos = parseInt(val);
|
$('#seq_proj_count').val(ppos).change();
|
||||||
this.updateState();
|
|
||||||
}
|
$('#seq_cam_count_2').val(cpos).change();
|
||||||
else {
|
$('#seq_proj_count_2').val(ppos).change();
|
||||||
t.value = proj.pos;
|
|
||||||
this.counterFormat(t);
|
$('#seq_cam_2_count').val(c2pos).change();
|
||||||
}
|
$('#seq_proj_2_count').val(p2pos).change();
|
||||||
proj.setValue(t.value);
|
|
||||||
});
|
$('#seq_cam_2_count_2').val(c2pos).change();
|
||||||
}
|
$('#seq_proj_2_count_2').val(p2pos).change();
|
||||||
updateProj2(t) {
|
};
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
gui.spinnerCfg = {
|
||||||
const val = t.value;
|
lines: 11, // The number of lines to draw
|
||||||
let change;
|
length: 15, // The length of each line
|
||||||
if (parseInt(val) === proj.second.pos) {
|
width: 7, // The line thickness
|
||||||
return false;
|
radius: 20, // The radius of the inner circle
|
||||||
}
|
corners: 1, // Corner roundness (0..1)
|
||||||
change = yield this.confirm(`Are you sure you want to set second projector counter to ${val}?`);
|
rotate: 0, // The rotation offset
|
||||||
if (change) {
|
direction: 1, // 1: clockwise, -1: counterclockwise
|
||||||
proj.second.pos = parseInt(val);
|
color: '#F2F2F1', // #rgb or #rrggbb or array of colors
|
||||||
this.updateState();
|
speed: 1, // Rounds per second
|
||||||
}
|
trail: 60, // Afterglow percentage
|
||||||
else {
|
shadow: true, // Whether to render a shadow
|
||||||
t.value = proj.second.pos;
|
hwaccel: true, // Whether to use hardware acceleration
|
||||||
this.counterFormat(t);
|
className: 'spinner', // The CSS class to assign to the spinner
|
||||||
}
|
zIndex: 2e9, // The z-index (defaults to 2000000000)
|
||||||
proj.setValue(t.value);
|
top: '50%', // Top position relative to parent
|
||||||
});
|
left: '50%' // Left position relative to parent
|
||||||
}
|
};
|
||||||
updateState() {
|
gui.spinner = function (state, msg, progress, cancel) {
|
||||||
const cpos = cam.pos;
|
'use strict';
|
||||||
const ppos = proj.pos;
|
let target;
|
||||||
const p2pos = proj.second.pos;
|
let spinner;
|
||||||
const c2pos = cam.second.pos;
|
if (msg && msg !== '') {
|
||||||
$('#seq_cam_count').val(cpos).change();
|
gui.spinnerMsg(msg);
|
||||||
$('#seq_proj_count').val(ppos).change();
|
}
|
||||||
$('#seq_cam_count_2').val(cpos).change();
|
if (state && !$('#spinner').hasClass('created')) {
|
||||||
$('#seq_proj_count_2').val(ppos).change();
|
target = document.getElementById('spinner');
|
||||||
$('#seq_cam_2_count').val(c2pos).change();
|
spinner = new Spinner(gui.spinnerCfg).spin(target);
|
||||||
$('#seq_proj_2_count').val(p2pos).change();
|
$('#spinnerProgress').hide();
|
||||||
$('#seq_cam_2_count_2').val(c2pos).change();
|
$('#spinner').addClass('created');
|
||||||
$('#seq_proj_2_count_2').val(p2pos).change();
|
} else if (state) {
|
||||||
}
|
$('#spinner').show();
|
||||||
spinner(state, msg = null, progress = false, cancel = false) {
|
} else if (!state) {
|
||||||
let target;
|
$('#spinner').hide();
|
||||||
let spinner;
|
gui.spinnerMsg('');
|
||||||
if (msg && msg !== '') {
|
}
|
||||||
this.spinnerMsg(msg);
|
if (progress) {
|
||||||
}
|
$('#spinnerProgress').show();
|
||||||
if (state && !$('#spinner').hasClass('created')) {
|
} else {
|
||||||
target = document.getElementById('spinner');
|
$('#spinnerProgress').hide();
|
||||||
spinner = new Spinner(this.spinnerCfg).spin(target);
|
}
|
||||||
$('#spinnerProgress').hide();
|
if (cancel) {
|
||||||
$('#spinner').addClass('created');
|
$('#spinnerCancel').show();
|
||||||
}
|
} else {
|
||||||
else if (state) {
|
$('#spinnerCancel').hide();
|
||||||
$('#spinner').show();
|
}
|
||||||
}
|
};
|
||||||
else if (!state) {
|
gui.spinnerMsg = function (msg) {
|
||||||
$('#spinner').hide();
|
'use strict';
|
||||||
this.spinnerMsg('');
|
$('#spinnerMsg').text(msg);
|
||||||
}
|
};
|
||||||
if (progress) {
|
gui.overlay = function (state) {
|
||||||
$('#spinnerProgress').show();
|
'use strict';
|
||||||
}
|
if (state) {
|
||||||
else {
|
$('#overlay').show();
|
||||||
$('#spinnerProgress').hide();
|
} else {
|
||||||
}
|
$('#overlay').hide();
|
||||||
if (cancel) {
|
}
|
||||||
$('#spinnerCancel').show();
|
};
|
||||||
}
|
|
||||||
else {
|
gui.info = async function (title, message) {
|
||||||
$('#spinnerCancel').hide();
|
'use strict';
|
||||||
}
|
const config = {
|
||||||
}
|
type : 'info',
|
||||||
spinnerMsg(msg) {
|
buttons : ['Ok'],
|
||||||
$('#spinnerMsg').text(msg);
|
title: title,
|
||||||
}
|
message : message
|
||||||
overlay(state) {
|
};
|
||||||
if (state) {
|
return dialog.showMessageBox(config);
|
||||||
$('#overlay').show();
|
};
|
||||||
}
|
gui.confirm = async function (message, cancel = 'Cancel') {
|
||||||
else {
|
const config = {
|
||||||
$('#overlay').hide();
|
buttons : ['Yes', cancel],
|
||||||
}
|
message
|
||||||
}
|
}
|
||||||
info(title, message) {
|
const res = await dialog.showMessageBox(config);
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return res.response === 0;
|
||||||
const config = {
|
};
|
||||||
type: 'info',
|
gui.choice = async function (message, choices) {
|
||||||
buttons: ['Ok'],
|
const config = {
|
||||||
title: title,
|
buttons : choices,
|
||||||
message: message
|
defaultId : 0,
|
||||||
};
|
message
|
||||||
return dialog.showMessageBox(config);
|
}
|
||||||
});
|
const res = await dialog.showMessageBox(config);
|
||||||
}
|
return res.response;
|
||||||
confirm(message, cancel = 'Cancel') {
|
};
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
gui.warn = async function (title, message) {
|
||||||
const config = {
|
'use strict';
|
||||||
buttons: ['Yes', cancel],
|
const config = {
|
||||||
message
|
type : 'warning',
|
||||||
};
|
buttons : ['Ok'],
|
||||||
const res = yield dialog.showMessageBox(config);
|
title: title,
|
||||||
return res.response === 0;
|
message : message
|
||||||
});
|
};
|
||||||
}
|
return dialog.showMessageBox(config);
|
||||||
choice(message, choices) {
|
};
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
gui.error = function () {};
|
||||||
const config = {
|
|
||||||
buttons: choices,
|
gui.version = function () {
|
||||||
defaultId: 0,
|
$('#version').text(PACKAGE.version);
|
||||||
message
|
|
||||||
};
|
|
||||||
const res = yield dialog.showMessageBox(config);
|
|
||||||
return res.response;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
warn(title, message) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const config = {
|
|
||||||
type: 'warning',
|
|
||||||
buttons: ['Ok'],
|
|
||||||
title,
|
|
||||||
message
|
|
||||||
};
|
|
||||||
return dialog.showMessageBox(config);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
version() {
|
|
||||||
$('#version').text(PACKAGE.version);
|
|
||||||
}
|
|
||||||
error() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
gui = new GUI();
|
|
||||||
module.exports = gui;
|
module.exports = gui;
|
||||||
//# sourceMappingURL=index.js.map
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -117,7 +117,7 @@ var init = async function () {
|
||||||
log.error('Error enumerating connected devices', err)
|
log.error('Error enumerating connected devices', err)
|
||||||
}
|
}
|
||||||
|
|
||||||
server = require('server')(mainWindow.webContents)
|
server = require('server')()
|
||||||
light = require('light')(arduino, cfg, mainWindow.webContents)
|
light = require('light')(arduino, cfg, mainWindow.webContents)
|
||||||
filmout = require('filmout')(display, server, ffmpeg, ffprobe, mainWindow.webContents, light)
|
filmout = require('filmout')(display, server, ffmpeg, ffprobe, mainWindow.webContents, light)
|
||||||
cam = require('cam')(arduino, cfg, mainWindow.webContents, filmout)
|
cam = require('cam')(arduino, cfg, mainWindow.webContents, filmout)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
/// <reference path ="jquery.d.ts"/>
|
/// <reference path ="jquery.d.ts"/>
|
||||||
|
|
||||||
|
|
||||||
let devices : Devices;
|
let devices : Devices;
|
||||||
|
|
||||||
class Devices {
|
class Devices {
|
||||||
|
|
|
@ -1,306 +0,0 @@
|
||||||
/* jslint esversion: 6*/
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/// <reference path ="jquery.d.ts"/>
|
|
||||||
|
|
||||||
declare var cam : any;
|
|
||||||
declare var proj : any;
|
|
||||||
declare var notifier : any;
|
|
||||||
declare var PACKAGE : any;
|
|
||||||
declare var Spinner : any;
|
|
||||||
declare var dialog : any;
|
|
||||||
|
|
||||||
let gui : GUI;
|
|
||||||
|
|
||||||
class GUI {
|
|
||||||
private id : string = 'gui';
|
|
||||||
private notifierWorking : boolean = true;
|
|
||||||
private spinnerCfg : any= {
|
|
||||||
lines: 11, // The number of lines to draw
|
|
||||||
length: 15, // The length of each line
|
|
||||||
width: 7, // The line thickness
|
|
||||||
radius: 20, // The radius of the inner circle
|
|
||||||
corners: 1, // Corner roundness (0..1)
|
|
||||||
rotate: 0, // The rotation offset
|
|
||||||
direction: 1, // 1: clockwise, -1: counterclockwise
|
|
||||||
color: '#F2F2F1', // #rgb or #rrggbb or array of colors
|
|
||||||
speed: 1, // Rounds per second
|
|
||||||
trail: 60, // Afterglow percentage
|
|
||||||
shadow: true, // Whether to render a shadow
|
|
||||||
hwaccel: true, // Whether to use hardware acceleration
|
|
||||||
className: 'spinner', // The CSS class to assign to the spinner
|
|
||||||
zIndex: 2e9, // The z-index (defaults to 2000000000)
|
|
||||||
top: '50%', // Top position relative to parent
|
|
||||||
left: '50%' // Left position relative to parent
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor () {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public init () {
|
|
||||||
this.version();
|
|
||||||
this.listen();
|
|
||||||
}
|
|
||||||
|
|
||||||
private listen() {
|
|
||||||
ipcRenderer.on(this.id, this.listener.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
private listener (event : any, arg : any) {
|
|
||||||
if (arg.notify) {
|
|
||||||
this.notify(arg.notify.title, arg.notify.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public fmtZero (val : any, len : number) : string {
|
|
||||||
const raw : number = val;
|
|
||||||
let str : string = val + '';
|
|
||||||
let output : string = '';
|
|
||||||
if (raw < 0) {
|
|
||||||
output = '-' + Array(len - (str.length - 1)).join('0') + str.replace('-', '');
|
|
||||||
} else {
|
|
||||||
if (str.length < len) {
|
|
||||||
output = Array(len - str.length).join('0') + str;
|
|
||||||
} else if (str.length >= len) {
|
|
||||||
str = parseInt(str) + '';
|
|
||||||
output = Array(len - str.length).join('0') + str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
counterFormat (t : HTMLInputElement, normal : number = null) {
|
|
||||||
const raw : string = t.value;
|
|
||||||
t.value = gui.fmtZero(raw, 6);
|
|
||||||
if (typeof normal !== 'undefined' && parseInt(raw) !== normal) {
|
|
||||||
$(t).addClass('changed');
|
|
||||||
} else {
|
|
||||||
$(t).removeClass('changed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
counterUpdate (which : string, raw : number) {
|
|
||||||
const formattedVal : string = this.fmtZero(raw, 6);
|
|
||||||
$(`.${which} .count`).val(formattedVal);
|
|
||||||
}
|
|
||||||
|
|
||||||
public notify (title : string, message : string) : Promise<boolean> {
|
|
||||||
const config : any = {
|
|
||||||
title,
|
|
||||||
message,
|
|
||||||
//icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons)
|
|
||||||
sound: true, // Only Notification Center or Windows Toasters
|
|
||||||
wait: true // Wait with callback, until user action is taken against notification
|
|
||||||
};
|
|
||||||
if (!this.notifierWorking) {
|
|
||||||
return new Promise((resolve, reject) => { return resolve(true); })
|
|
||||||
}
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
notifier.notify(config,
|
|
||||||
function (err : Error, response : any) {
|
|
||||||
// Response is response from notification
|
|
||||||
if (err) {
|
|
||||||
this.notifierWorking = false;
|
|
||||||
log.error(`Error with notification`, err);
|
|
||||||
return reject(err);
|
|
||||||
}
|
|
||||||
return resolve(true);
|
|
||||||
}.bind(this));
|
|
||||||
} catch (err) {
|
|
||||||
this.notifierWorking = false;
|
|
||||||
//notify-send is not found
|
|
||||||
//determine an alternate for raspian
|
|
||||||
//this feels like a hack
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public async updateCam (t : HTMLInputElement) {
|
|
||||||
const val : string = t.value;
|
|
||||||
let change : boolean;
|
|
||||||
|
|
||||||
if (parseInt(val) === cam.pos) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
change = await this.confirm(`Are you sure you want to set camera counter to ${val}?`);
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
cam.pos = parseInt(val);
|
|
||||||
this.updateState();
|
|
||||||
} else {
|
|
||||||
t.value = cam.pos;
|
|
||||||
this.counterFormat(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async updateCam2 (t : HTMLInputElement) {
|
|
||||||
const val : string = t.value;
|
|
||||||
let change : boolean;
|
|
||||||
|
|
||||||
if (parseInt(val) === cam.pos) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
change = await this.confirm(`Are you sure you want to set second camera counter to ${val}?`);
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
cam.second.pos = parseInt(val);
|
|
||||||
this.updateState();
|
|
||||||
} else {
|
|
||||||
t.value = cam.second.pos;
|
|
||||||
this.counterFormat(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async updateProj (t : HTMLInputElement) {
|
|
||||||
const val : string = t.value;
|
|
||||||
let change : boolean;
|
|
||||||
if (parseInt(val) === proj.pos) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
change = await this.confirm(`Are you sure you want to set projector counter to ${val}?`);
|
|
||||||
if (change) {
|
|
||||||
proj.pos = parseInt(val);
|
|
||||||
this.updateState();
|
|
||||||
} else {
|
|
||||||
t.value = proj.pos;
|
|
||||||
this.counterFormat(t);
|
|
||||||
}
|
|
||||||
proj.setValue(t.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
async updateProj2 (t : HTMLInputElement) {
|
|
||||||
const val : string = t.value;
|
|
||||||
let change : boolean;
|
|
||||||
|
|
||||||
if (parseInt(val) === proj.second.pos) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
change = await this.confirm(`Are you sure you want to set second projector counter to ${val}?`);
|
|
||||||
|
|
||||||
if (change) {
|
|
||||||
proj.second.pos = parseInt(val);
|
|
||||||
this.updateState();
|
|
||||||
} else {
|
|
||||||
t.value = proj.second.pos;
|
|
||||||
this.counterFormat(t);
|
|
||||||
}
|
|
||||||
proj.setValue(t.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public updateState () {
|
|
||||||
const cpos : number = cam.pos;
|
|
||||||
const ppos : number = proj.pos;
|
|
||||||
|
|
||||||
const p2pos : number = proj.second.pos;
|
|
||||||
const c2pos : number = cam.second.pos;
|
|
||||||
|
|
||||||
$('#seq_cam_count').val(cpos).change();
|
|
||||||
$('#seq_proj_count').val(ppos).change();
|
|
||||||
|
|
||||||
$('#seq_cam_count_2').val(cpos).change();
|
|
||||||
$('#seq_proj_count_2').val(ppos).change();
|
|
||||||
|
|
||||||
$('#seq_cam_2_count').val(c2pos).change();
|
|
||||||
$('#seq_proj_2_count').val(p2pos).change();
|
|
||||||
|
|
||||||
$('#seq_cam_2_count_2').val(c2pos).change();
|
|
||||||
$('#seq_proj_2_count_2').val(p2pos).change();
|
|
||||||
}
|
|
||||||
|
|
||||||
public spinner (state : boolean, msg : string = null, progress : boolean = false, cancel : boolean = false) {
|
|
||||||
let target;
|
|
||||||
let spinner;
|
|
||||||
if (msg && msg !== '') {
|
|
||||||
this.spinnerMsg(msg);
|
|
||||||
}
|
|
||||||
if (state && !$('#spinner').hasClass('created')) {
|
|
||||||
target = document.getElementById('spinner');
|
|
||||||
spinner = new Spinner(this.spinnerCfg).spin(target);
|
|
||||||
$('#spinnerProgress').hide();
|
|
||||||
$('#spinner').addClass('created');
|
|
||||||
} else if (state) {
|
|
||||||
$('#spinner').show();
|
|
||||||
} else if (!state) {
|
|
||||||
$('#spinner').hide();
|
|
||||||
this.spinnerMsg('');
|
|
||||||
}
|
|
||||||
if (progress) {
|
|
||||||
$('#spinnerProgress').show();
|
|
||||||
} else {
|
|
||||||
$('#spinnerProgress').hide();
|
|
||||||
}
|
|
||||||
if (cancel) {
|
|
||||||
$('#spinnerCancel').show();
|
|
||||||
} else {
|
|
||||||
$('#spinnerCancel').hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private spinnerMsg (msg : string) {
|
|
||||||
$('#spinnerMsg').text(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public overlay (state : boolean) {
|
|
||||||
if (state) {
|
|
||||||
$('#overlay').show();
|
|
||||||
} else {
|
|
||||||
$('#overlay').hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async info (title : string, message : string) {
|
|
||||||
const config : any = {
|
|
||||||
type : 'info',
|
|
||||||
buttons : ['Ok'],
|
|
||||||
title: title,
|
|
||||||
message : message
|
|
||||||
};
|
|
||||||
return dialog.showMessageBox(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
async confirm (message : string, cancel : string = 'Cancel') {
|
|
||||||
const config : any = {
|
|
||||||
buttons : ['Yes', cancel],
|
|
||||||
message
|
|
||||||
}
|
|
||||||
const res = await dialog.showMessageBox(config);
|
|
||||||
return res.response === 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async choice (message : string, choices : string[]) {
|
|
||||||
const config : any = {
|
|
||||||
buttons : choices,
|
|
||||||
defaultId : 0,
|
|
||||||
message
|
|
||||||
}
|
|
||||||
const res = await dialog.showMessageBox(config);
|
|
||||||
return res.response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async warn (title : string, message : string) {
|
|
||||||
const config : any = {
|
|
||||||
type : 'warning',
|
|
||||||
buttons : ['Ok'],
|
|
||||||
title,
|
|
||||||
message
|
|
||||||
};
|
|
||||||
return dialog.showMessageBox(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
private version () {
|
|
||||||
$('#version').text(PACKAGE.version);
|
|
||||||
}
|
|
||||||
|
|
||||||
private error () {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gui = new GUI();
|
|
||||||
module.exports = gui;
|
|
|
@ -5,6 +5,7 @@
|
||||||
import Mscript from 'mscript';
|
import Mscript from 'mscript';
|
||||||
|
|
||||||
declare var nav : any;
|
declare var nav : any;
|
||||||
|
declare var gui : any;
|
||||||
declare var CodeMirror : any;
|
declare var CodeMirror : any;
|
||||||
declare var mscript : any;
|
declare var mscript : any;
|
||||||
declare var cmd : any;
|
declare var cmd : any;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
/// <reference path ="jquery.d.ts"/>
|
/// <reference path ="jquery.d.ts"/>
|
||||||
|
|
||||||
|
declare var gui : any;
|
||||||
declare var cfg : any;
|
declare var cfg : any;
|
||||||
declare var log : any;
|
declare var log : any;
|
||||||
declare var w2popup : any;
|
declare var w2popup : any;
|
||||||
|
|
|
@ -186,10 +186,7 @@
|
||||||
"capper_on": "A",
|
"capper_on": "A",
|
||||||
"capper_off": "B",
|
"capper_off": "B",
|
||||||
"takeup_forward": "D",
|
"takeup_forward": "D",
|
||||||
"takeup_backward": "F",
|
"takeup_backward": "E"
|
||||||
"error" : "E",
|
|
||||||
"camera_exposure" : "G",
|
|
||||||
"state" : "H"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,15 +62,4 @@ void McopySerial::log (String message) {
|
||||||
if (debugOn) {
|
if (debugOn) {
|
||||||
Serial.println(message);
|
Serial.println(message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
String McopySerial::getString () {
|
|
||||||
while (Serial.available() == 0) {
|
|
||||||
//Wait for value string
|
|
||||||
}
|
|
||||||
return Serial.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void McopySerial::print (String message) {
|
|
||||||
Serial.println(message);
|
|
||||||
}
|
}
|
|
@ -26,7 +26,6 @@ class McopySerial {
|
||||||
static const char CAMERA_CAPPER_IDENTIFIER = '8';
|
static const char CAMERA_CAPPER_IDENTIFIER = '8';
|
||||||
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
|
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
|
||||||
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
|
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
|
||||||
static const char CAMERA_EXPOSURE = 'G';
|
|
||||||
static const char CAMERA_FORWARD = 'e';
|
static const char CAMERA_FORWARD = 'e';
|
||||||
static const char CAMERA_IDENTIFIER = 'k';
|
static const char CAMERA_IDENTIFIER = 'k';
|
||||||
static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
|
static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
|
||||||
|
@ -44,7 +43,6 @@ class McopySerial {
|
||||||
static const char CAPPER_ON = 'A';
|
static const char CAPPER_ON = 'A';
|
||||||
static const char CONNECT = 'i';
|
static const char CONNECT = 'i';
|
||||||
static const char DEBUG = 'd';
|
static const char DEBUG = 'd';
|
||||||
static const char ERROR = 'E';
|
|
||||||
static const char LIGHT = 'l';
|
static const char LIGHT = 'l';
|
||||||
static const char LIGHT_IDENTIFIER = 'o';
|
static const char LIGHT_IDENTIFIER = 'o';
|
||||||
static const char MCOPY_IDENTIFIER = 'm';
|
static const char MCOPY_IDENTIFIER = 'm';
|
||||||
|
@ -61,8 +59,7 @@ class McopySerial {
|
||||||
static const char PROJECTOR_SECOND_IDENTIFIER = 't';
|
static const char PROJECTOR_SECOND_IDENTIFIER = 't';
|
||||||
static const char PROJECTORS = 'x';
|
static const char PROJECTORS = 'x';
|
||||||
static const char PROJECTORS_IDENTIFIER = 'd';
|
static const char PROJECTORS_IDENTIFIER = 'd';
|
||||||
static const char STATE = 'H';
|
static const char TAKEUP_BACKWARD = 'E';
|
||||||
static const char TAKEUP_BACKWARD = 'F';
|
|
||||||
static const char TAKEUP_FORWARD = 'D';
|
static const char TAKEUP_FORWARD = 'D';
|
||||||
/* END CMD FLAGS */
|
/* END CMD FLAGS */
|
||||||
|
|
||||||
|
@ -73,8 +70,6 @@ class McopySerial {
|
||||||
void setIdentity(char identity);
|
void setIdentity(char identity);
|
||||||
char loop();
|
char loop();
|
||||||
void confirm(char cmd);
|
void confirm(char cmd);
|
||||||
String getString();
|
|
||||||
void print(String message);
|
|
||||||
|
|
||||||
void debug (bool state);
|
void debug (bool state);
|
||||||
void log (String message);
|
void log (String message);
|
||||||
|
|
|
@ -62,15 +62,4 @@ void McopySerial::log (String message) {
|
||||||
if (debugOn) {
|
if (debugOn) {
|
||||||
Serial.println(message);
|
Serial.println(message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
String McopySerial::getString () {
|
|
||||||
while (Serial.available() == 0) {
|
|
||||||
//Wait for value string
|
|
||||||
}
|
|
||||||
return Serial.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void McopySerial::print (String message) {
|
|
||||||
Serial.println(message);
|
|
||||||
}
|
}
|
|
@ -26,7 +26,6 @@ class McopySerial {
|
||||||
static const char CAMERA_CAPPER_IDENTIFIER = '8';
|
static const char CAMERA_CAPPER_IDENTIFIER = '8';
|
||||||
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
|
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
|
||||||
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
|
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
|
||||||
static const char CAMERA_EXPOSURE = 'G';
|
|
||||||
static const char CAMERA_FORWARD = 'e';
|
static const char CAMERA_FORWARD = 'e';
|
||||||
static const char CAMERA_IDENTIFIER = 'k';
|
static const char CAMERA_IDENTIFIER = 'k';
|
||||||
static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
|
static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
|
||||||
|
@ -44,7 +43,6 @@ class McopySerial {
|
||||||
static const char CAPPER_ON = 'A';
|
static const char CAPPER_ON = 'A';
|
||||||
static const char CONNECT = 'i';
|
static const char CONNECT = 'i';
|
||||||
static const char DEBUG = 'd';
|
static const char DEBUG = 'd';
|
||||||
static const char ERROR = 'E';
|
|
||||||
static const char LIGHT = 'l';
|
static const char LIGHT = 'l';
|
||||||
static const char LIGHT_IDENTIFIER = 'o';
|
static const char LIGHT_IDENTIFIER = 'o';
|
||||||
static const char MCOPY_IDENTIFIER = 'm';
|
static const char MCOPY_IDENTIFIER = 'm';
|
||||||
|
@ -61,8 +59,7 @@ class McopySerial {
|
||||||
static const char PROJECTOR_SECOND_IDENTIFIER = 't';
|
static const char PROJECTOR_SECOND_IDENTIFIER = 't';
|
||||||
static const char PROJECTORS = 'x';
|
static const char PROJECTORS = 'x';
|
||||||
static const char PROJECTORS_IDENTIFIER = 'd';
|
static const char PROJECTORS_IDENTIFIER = 'd';
|
||||||
static const char STATE = 'H';
|
static const char TAKEUP_BACKWARD = 'E';
|
||||||
static const char TAKEUP_BACKWARD = 'F';
|
|
||||||
static const char TAKEUP_FORWARD = 'D';
|
static const char TAKEUP_FORWARD = 'D';
|
||||||
/* END CMD FLAGS */
|
/* END CMD FLAGS */
|
||||||
|
|
||||||
|
@ -73,8 +70,6 @@ class McopySerial {
|
||||||
void setIdentity(char identity);
|
void setIdentity(char identity);
|
||||||
char loop();
|
char loop();
|
||||||
void confirm(char cmd);
|
void confirm(char cmd);
|
||||||
String getString();
|
|
||||||
void print(String message);
|
|
||||||
|
|
||||||
void debug (bool state);
|
void debug (bool state);
|
||||||
void log (String message);
|
void log (String message);
|
||||||
|
|
|
@ -62,15 +62,4 @@ void McopySerial::log (String message) {
|
||||||
if (debugOn) {
|
if (debugOn) {
|
||||||
Serial.println(message);
|
Serial.println(message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
String McopySerial::getString () {
|
|
||||||
while (Serial.available() == 0) {
|
|
||||||
//Wait for value string
|
|
||||||
}
|
|
||||||
return Serial.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void McopySerial::print (String message) {
|
|
||||||
Serial.println(message);
|
|
||||||
}
|
}
|
|
@ -26,7 +26,6 @@ class McopySerial {
|
||||||
static const char CAMERA_CAPPER_IDENTIFIER = '8';
|
static const char CAMERA_CAPPER_IDENTIFIER = '8';
|
||||||
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
|
static const char CAMERA_CAPPER_PROJECTOR_IDENTIFIER = '9';
|
||||||
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
|
static const char CAMERA_CAPPER_PROJECTORS_IDENTIFIER = '0';
|
||||||
static const char CAMERA_EXPOSURE = 'G';
|
|
||||||
static const char CAMERA_FORWARD = 'e';
|
static const char CAMERA_FORWARD = 'e';
|
||||||
static const char CAMERA_IDENTIFIER = 'k';
|
static const char CAMERA_IDENTIFIER = 'k';
|
||||||
static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
|
static const char CAMERA_PROJECTORS_IDENTIFIER = '5';
|
||||||
|
@ -44,7 +43,6 @@ class McopySerial {
|
||||||
static const char CAPPER_ON = 'A';
|
static const char CAPPER_ON = 'A';
|
||||||
static const char CONNECT = 'i';
|
static const char CONNECT = 'i';
|
||||||
static const char DEBUG = 'd';
|
static const char DEBUG = 'd';
|
||||||
static const char ERROR = 'E';
|
|
||||||
static const char LIGHT = 'l';
|
static const char LIGHT = 'l';
|
||||||
static const char LIGHT_IDENTIFIER = 'o';
|
static const char LIGHT_IDENTIFIER = 'o';
|
||||||
static const char MCOPY_IDENTIFIER = 'm';
|
static const char MCOPY_IDENTIFIER = 'm';
|
||||||
|
@ -61,8 +59,7 @@ class McopySerial {
|
||||||
static const char PROJECTOR_SECOND_IDENTIFIER = 't';
|
static const char PROJECTOR_SECOND_IDENTIFIER = 't';
|
||||||
static const char PROJECTORS = 'x';
|
static const char PROJECTORS = 'x';
|
||||||
static const char PROJECTORS_IDENTIFIER = 'd';
|
static const char PROJECTORS_IDENTIFIER = 'd';
|
||||||
static const char STATE = 'H';
|
static const char TAKEUP_BACKWARD = 'E';
|
||||||
static const char TAKEUP_BACKWARD = 'F';
|
|
||||||
static const char TAKEUP_FORWARD = 'D';
|
static const char TAKEUP_FORWARD = 'D';
|
||||||
/* END CMD FLAGS */
|
/* END CMD FLAGS */
|
||||||
|
|
||||||
|
@ -73,8 +70,6 @@ class McopySerial {
|
||||||
void setIdentity(char identity);
|
void setIdentity(char identity);
|
||||||
char loop();
|
char loop();
|
||||||
void confirm(char cmd);
|
void confirm(char cmd);
|
||||||
String getString();
|
|
||||||
void print(String message);
|
|
||||||
|
|
||||||
void debug (bool state);
|
void debug (bool state);
|
||||||
void log (String message);
|
void log (String message);
|
||||||
|
|
|
@ -38,28 +38,20 @@
|
||||||
"typescript": "^4.1.5"
|
"typescript": "^4.1.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"alert": "file:app/lib/alert",
|
|
||||||
"arduino": "file:app/lib/arduino",
|
"arduino": "file:app/lib/arduino",
|
||||||
"cam": "file:app/lib/cam",
|
"cam": "file:app/lib/cam",
|
||||||
"capper" : "file:app/lib/capper",
|
|
||||||
"cmd": "file:app/lib/cmd",
|
"cmd": "file:app/lib/cmd",
|
||||||
"delay": "file:app/lib/delay",
|
"delay": "file:app/lib/delay",
|
||||||
"devices": "file:app/lib/devices",
|
"devices": "file:app/lib/devices",
|
||||||
"display": "file:app/lib/display",
|
"display": "file:app/lib/display",
|
||||||
"exec" : "file:app/lib/exec",
|
|
||||||
"exit" : "file:app/lib/exit",
|
|
||||||
"ffmpeg" : "file:app/lib/ffmpeg",
|
|
||||||
"ffprobe" : "file:app/lib/ffprobe",
|
|
||||||
"filmout": "file:app/lib/filmout",
|
"filmout": "file:app/lib/filmout",
|
||||||
"frame": "file:app/lib/frame",
|
"frame": "file:app/lib/frame",
|
||||||
"intval" : "file:app/lib/intval",
|
|
||||||
"light": "file:app/lib/light",
|
"light": "file:app/lib/light",
|
||||||
"log": "file:app/lib/log",
|
"log": "file:app/lib/log",
|
||||||
"mscript": "file:app/lib/mscript",
|
"mscript": "file:app/lib/mscript",
|
||||||
"processing": "file:app/lib/processing",
|
"processing": "file:app/lib/processing",
|
||||||
"proj": "file:app/lib/proj",
|
"proj": "file:app/lib/proj",
|
||||||
"sequencer": "file:app/lib/sequencer",
|
"sequencer": "file:app/lib/sequencer",
|
||||||
"server" : "file:app/lib/server",
|
|
||||||
"settings": "file:app/lib/settings",
|
"settings": "file:app/lib/settings",
|
||||||
"system": "file:app/lib/system"
|
"system": "file:app/lib/system"
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,10 +186,7 @@
|
||||||
"capper_on": "A",
|
"capper_on": "A",
|
||||||
"capper_off": "B",
|
"capper_off": "B",
|
||||||
"takeup_forward": "D",
|
"takeup_forward": "D",
|
||||||
"takeup_backward": "F",
|
"takeup_backward": "E"
|
||||||
"error" : "E",
|
|
||||||
"camera_exposure" : "G",
|
|
||||||
"state" : "H"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ PlugGuideRetraction = 1.25;
|
||||||
PinSpacing = 3.85;
|
PinSpacing = 3.85;
|
||||||
|
|
||||||
SocketD = PlugD + 0.4;
|
SocketD = PlugD + 0.4;
|
||||||
SocketGuideD = PlugGuideD + 0.4;
|
SocketGuideD = PlugGuideD + 0.2;
|
||||||
|
|
||||||
SocketOuterD = 19.5;
|
SocketOuterD = 21;
|
||||||
|
|
||||||
CollarD = 22;
|
CollarD = 22;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ module cpc_9pin_plug_back () {
|
||||||
|
|
||||||
module flange_guide_void (pos = [0, 0, 0], Z = 8) {
|
module flange_guide_void (pos = [0, 0, 0], Z = 8) {
|
||||||
OD = 24;
|
OD = 24;
|
||||||
ID = 18.5;
|
ID = 18;
|
||||||
translate(pos) {
|
translate(pos) {
|
||||||
intersection () {
|
intersection () {
|
||||||
difference () {
|
difference () {
|
||||||
|
@ -119,12 +119,12 @@ module cpc_9pin_socket () {
|
||||||
translate([0, 0, 3]) union () {
|
translate([0, 0, 3]) union () {
|
||||||
cylinder(r = R(SocketD), h = PlugH, center = true);
|
cylinder(r = R(SocketD), h = PlugH, center = true);
|
||||||
for (i = [0 : len(GuideAngles) - 1]) {
|
for (i = [0 : len(GuideAngles) - 1]) {
|
||||||
guide(SocketGuideD + 0.1, PlugH, GuideAngles[i], GuideWidths[i] + 0.4);
|
guide(SocketGuideD, PlugH, GuideAngles[i], GuideWidths[i] + 0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plug_pin_voids(PinH);
|
plug_pin_voids(PinH);
|
||||||
rotate([0,0, 37]) flange_guide_void([0, 0, (PlugH / 2) - (8 / 2) + 0.01], 8);
|
flange_guide_void([0, 0, (PlugH / 2) - (8 / 2) + 0.01], 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
'use strict'
|
|
||||||
|
|
||||||
import WebSocket, { WebSocketServer } from 'ws'
|
import WebSocket, { WebSocketServer } from 'ws'
|
||||||
import express, { Express, Request, Response, Application } from 'express'
|
import express, { Express, Request, Response, Application } from 'express'
|
||||||
import { readFile } from 'fs/promises'
|
import { readFile } from 'fs/promises'
|
||||||
|
@ -55,11 +53,9 @@ class Server {
|
||||||
private queue : ServerQueue = {}
|
private queue : ServerQueue = {}
|
||||||
private interval : ReturnType<typeof setInterval>
|
private interval : ReturnType<typeof setInterval>
|
||||||
private intervalPeriod : number = 10000 //10 sec
|
private intervalPeriod : number = 10000 //10 sec
|
||||||
private ui : any;
|
|
||||||
|
|
||||||
constructor (uiInput : any) {
|
constructor () {
|
||||||
this.init()
|
this.init()
|
||||||
this.ui = uiInput;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init () {
|
async init () {
|
||||||
|
@ -95,9 +91,8 @@ class Server {
|
||||||
this.log.error(err)
|
this.log.error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.wss.on('connection', async function (ws : WebSocket, req: any) {
|
this.wss.on('connection', async function (ws : WebSocket) {
|
||||||
const address : string = req.socket.remoteAddress;
|
ws.on("message", function (data : string ) {
|
||||||
ws.on('message', function (data : string ) {
|
|
||||||
let obj : any = JSON.parse(data)
|
let obj : any = JSON.parse(data)
|
||||||
//this.log.info(data)
|
//this.log.info(data)
|
||||||
if (obj.id && this.queue[obj.id]) {
|
if (obj.id && this.queue[obj.id]) {
|
||||||
|
@ -111,12 +106,10 @@ class Server {
|
||||||
|
|
||||||
ws.on('close', function () {
|
ws.on('close', function () {
|
||||||
this.log.info('Client disconnected')
|
this.log.info('Client disconnected')
|
||||||
this.notify('Client disconnected', `No longer forwarding digital display to client ${address}`)
|
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
|
|
||||||
await this.cmd(ws, 'mcopy')
|
await this.cmd(ws, 'mcopy')
|
||||||
this.log.info('Client connected')
|
this.log.info('Client connected')
|
||||||
this.notify('Client connected', `Forwarding digital display to client: ${address}`)
|
|
||||||
|
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
this.log.info(`Websocket server started!`)
|
this.log.info(`Websocket server started!`)
|
||||||
|
@ -207,8 +200,8 @@ class Server {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
public async displayImage (src : string) : Promise<boolean> {
|
public async displayImage (src : string) {
|
||||||
let key : string
|
let key
|
||||||
if (this.useServer()) {
|
if (this.useServer()) {
|
||||||
key = basename(src)
|
key = basename(src)
|
||||||
this.addProxy(key, src)
|
this.addProxy(key, src)
|
||||||
|
@ -244,12 +237,8 @@ class Server {
|
||||||
//setTimeout() ?
|
//setTimeout() ?
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
private notify (title : string, message : string) {
|
|
||||||
this.ui.send('gui', { notify : { title, message }});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function (ui : any) {
|
module.exports = function () {
|
||||||
return new Server(ui)
|
return new Server()
|
||||||
}
|
}
|
Loading…
Reference in New Issue