Use the import Log = require() method of including log lib. This is cleaner and easier to read when parsing dependencies.
This commit is contained in:
parent
478799965e
commit
fc3cc96cd8
|
@ -1,9 +1,10 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//import Log = require('log');
|
||||
const delay = require("delay");
|
||||
const SerialPort = require('serialport');
|
||||
const Readline = SerialPort.parsers.Readline;
|
||||
const exec = require('child_process').exec;
|
||||
const delay = require("delay");
|
||||
const parser = new Readline('');
|
||||
const newlineRe = new RegExp('\n', 'g');
|
||||
const returnRe = new RegExp('\r', 'g');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,25 +1,27 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Intval = require("intval");
|
||||
const Log = require("log");
|
||||
/** class representing camera functions **/
|
||||
class Camera {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(arduino, cfg, ui) {
|
||||
constructor(arduino, cfg, ui, dig) {
|
||||
this.state = { dir: true, digital: false };
|
||||
this.arduino = null;
|
||||
this.intval = null;
|
||||
this.arduino = arduino;
|
||||
this.cfg = cfg;
|
||||
this.ui = ui;
|
||||
this.dig = dig;
|
||||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'cam' });
|
||||
this.log = await Log({ label: 'cam' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
@ -67,9 +69,9 @@ class Camera {
|
|||
async move(frame, id) {
|
||||
const cmd = this.cfg.arduino.cmd.camera;
|
||||
let ms;
|
||||
//if (this.state.digital) {
|
||||
//await this.dig.start()
|
||||
//}
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.start();
|
||||
}
|
||||
if (this.intval) {
|
||||
try {
|
||||
ms = await this.intval.move();
|
||||
|
@ -86,9 +88,9 @@ class Camera {
|
|||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
//if (this.state.digital) {
|
||||
// await this.dig.end()
|
||||
//}
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.end();
|
||||
}
|
||||
this.log.info('Camera move time', { ms });
|
||||
return this.end(cmd, id, ms);
|
||||
}
|
||||
|
@ -175,9 +177,8 @@ class Camera {
|
|||
this.log.info(message, 'CAMERA', true, true);
|
||||
this.ui.send('cam', { cmd: cmd, id: id, ms: ms });
|
||||
}
|
||||
;
|
||||
}
|
||||
module.exports = function (arduino, cfg, ui) {
|
||||
return new Camera(arduino, cfg, ui);
|
||||
module.exports = function (arduino, cfg, ui, dig) {
|
||||
return new Camera(arduino, cfg, ui, dig);
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,56 +1,129 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const delay = require("delay");
|
||||
const dig = {};
|
||||
dig.state = {
|
||||
frame: 0,
|
||||
frames: 0,
|
||||
path: null,
|
||||
fileName: null,
|
||||
info: {},
|
||||
dir: true
|
||||
};
|
||||
dig.set = function (dir) {
|
||||
dig.state.dir = dir;
|
||||
};
|
||||
dig.move = async function () {
|
||||
let start = +new Date();
|
||||
let last = dig.state.dir + 0;
|
||||
if (dig.state.dir) {
|
||||
dig.state.frame++;
|
||||
const Log = require("log");
|
||||
class Digital {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(display, ffmpeg, ffprobe, ui, light) {
|
||||
this.state = {
|
||||
frame: 0,
|
||||
frames: 0,
|
||||
path: null,
|
||||
fileName: null,
|
||||
info: {},
|
||||
dir: true,
|
||||
enabled: false
|
||||
};
|
||||
this.display = display;
|
||||
this.ffmpeg = ffmpeg;
|
||||
this.ffprobe = ffprobe;
|
||||
this.ui = ui;
|
||||
this.light = light;
|
||||
this.init();
|
||||
}
|
||||
else {
|
||||
dig.state.frame--;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await Log({ label: 'digital' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
if (dig.state.frame < 1) {
|
||||
dig.state.frame = 1;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
listen() {
|
||||
this.ipc.on('digital', this.connectDigital.bind(this));
|
||||
}
|
||||
return (+new Date()) - start;
|
||||
};
|
||||
dig.start = async function (lightState) {
|
||||
try {
|
||||
await dig.ffmpeg.clearAll();
|
||||
/**
|
||||
*
|
||||
**/
|
||||
set(dir) {
|
||||
this.state.dir = dir;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async move() {
|
||||
let start = +new Date();
|
||||
if (this.state.dir) {
|
||||
this.state.frame++;
|
||||
}
|
||||
else {
|
||||
this.state.frame--;
|
||||
}
|
||||
if (this.state.frame < 1) {
|
||||
this.state.frame = 1;
|
||||
}
|
||||
return (+new Date()) - start;
|
||||
}
|
||||
try {
|
||||
await dig.ffmpeg.frame(dig.state, lightState);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async start() {
|
||||
try {
|
||||
await this.ffmpeg.clearAll();
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.ffmpeg.frame(this.state, this.light.state);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
this.display.start(this.state.frame);
|
||||
await delay(20);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async end() {
|
||||
await delay(20);
|
||||
this.display.end();
|
||||
}
|
||||
dig.display.start(dig.state.frame);
|
||||
await delay(20);
|
||||
};
|
||||
dig.end = async function () {
|
||||
await delay(20);
|
||||
dig.display.end();
|
||||
};
|
||||
module.exports = (display, ffmpeg, ffprobe) => {
|
||||
dig.display = display;
|
||||
dig.ffmpeg = ffmpeg;
|
||||
dig.ffprobe = ffprobe;
|
||||
return dig;
|
||||
/**
|
||||
* Use a file as the "digital" source on "projector"
|
||||
*
|
||||
**/
|
||||
async connectDigital(evt, arg) {
|
||||
let info;
|
||||
let frames = 0;
|
||||
try {
|
||||
info = await this.ffprobe.info(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
//this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.enabled = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
frames = await this.ffprobe.frames(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.enabled = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
this.state.frame = 0;
|
||||
this.state.path = arg.path;
|
||||
this.state.fileName = arg.fileName;
|
||||
this.state.frames = frames;
|
||||
this.state.info = info;
|
||||
this.log.info(`Opened ${this.state.fileName}`, 'DIGITAL', true, true);
|
||||
this.log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
||||
this.state.enabled = true;
|
||||
return await this.ui.send('digital', { valid: true, state: JSON.stringify(this.state) });
|
||||
}
|
||||
}
|
||||
module.exports = (display, ffmpeg, ffprobe, ui, light) => {
|
||||
return new Digital(display, ffmpeg, ffprobe, ui, light);
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/digital/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,GAAG,GAAS,EAAE,CAAC;AACrB,GAAG,CAAC,KAAK,GAAG;IACX,KAAK,EAAG,CAAC;IACT,MAAM,EAAG,CAAC;IACV,IAAI,EAAG,IAAI;IACX,QAAQ,EAAG,IAAI;IACf,IAAI,EAAG,EAAE;IACT,GAAG,EAAG,IAAI;CACV,CAAC;AAEF,GAAG,CAAC,GAAG,GAAI,UAAU,GAAa;IACjC,GAAG,CAAC,KAAK,CAAC,GAAG,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,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAEvB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACtE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QAC1B,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,EAAG,IAAI,EAAE,KAAK,EAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,OAAa,EAAE,MAAY,EAAE,OAAa,EAAE,EAAQ,EAAE,KAAW,EAAE,EAAE;IACtF,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC,CAAA"}
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const delay = require("delay");
|
||||
const Log = require("log");
|
||||
class Light {
|
||||
/**
|
||||
*
|
||||
|
@ -16,7 +17,7 @@ class Light {
|
|||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'light' });
|
||||
this.log = await Log({ label: 'light' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/light/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,KAAK;IASV;;QAEI;IACJ,YAAa,OAAiB,EAA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AAS,EAAE,EAAQ;IAChE,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC,CAAA"}
|
|
@ -1,4 +1,7 @@
|
|||
"use strict";
|
||||
/** class representing the Projector features **/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Log = require("log");
|
||||
class Projector {
|
||||
/**
|
||||
*
|
||||
|
@ -16,7 +19,7 @@ class Projector {
|
|||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'proj' });
|
||||
this.log = await Log({ label: 'proj' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
@ -25,7 +28,6 @@ class Projector {
|
|||
**/
|
||||
listen() {
|
||||
this.ipc.on('proj', this.listener.bind(this));
|
||||
this.ipc.on('digital', this.connectDigital.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -40,8 +42,8 @@ class Projector {
|
|||
cmd = this.cfg.arduino.cmd.proj_backward;
|
||||
}
|
||||
this.state.dir = dir;
|
||||
if (this.state.digital) {
|
||||
//this.dig.set(dir)
|
||||
if (this.dig.state.enabled) {
|
||||
this.dig.set(dir);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
|
@ -59,9 +61,9 @@ class Projector {
|
|||
async move(frame, id) {
|
||||
const cmd = this.cfg.arduino.cmd.projector;
|
||||
let ms;
|
||||
if (this.state.digital) {
|
||||
if (this.dig.state.enabled) {
|
||||
try {
|
||||
//ms = await this.dig.move()
|
||||
ms = await this.dig.move();
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
|
@ -127,41 +129,6 @@ class Projector {
|
|||
this.log.info(message, 'PROJECTOR');
|
||||
return await this.ui.send('proj', { cmd: cmd, id: id, ms: ms });
|
||||
}
|
||||
/**
|
||||
* Use a file as the "digital" source on "projector"
|
||||
*
|
||||
**/
|
||||
async connectDigital(evt, arg) {
|
||||
let info;
|
||||
let frames = 0;
|
||||
try {
|
||||
info = await this.dig.ffprobe.info(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.digital = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
frames = await this.dig.ffprobe.frames(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.digital = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
this.dig.state.frame = 0;
|
||||
this.dig.state.path = arg.path;
|
||||
this.dig.state.fileName = arg.fileName;
|
||||
this.dig.state.frames = frames;
|
||||
this.dig.state.info = info;
|
||||
this.log.info(`Opened ${this.dig.state.fileName}`, 'DIGITAL', true, true);
|
||||
this.log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
||||
this.state.digital = true;
|
||||
return await this.ui.send('digital', { valid: true, state: JSON.stringify(this.dig.state) });
|
||||
}
|
||||
}
|
||||
module.exports = function (arduino, cfg, ui, dig) {
|
||||
return new Projector(arduino, cfg, ui, dig);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,83 +1,107 @@
|
|||
'use strict'
|
||||
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const settings = {};
|
||||
|
||||
settings.file = path.join(os.homedir(), `/.mcopy/settings.json`);
|
||||
settings.state = {
|
||||
server : {
|
||||
port : 1111,
|
||||
enabled : true
|
||||
},
|
||||
devices : [],
|
||||
profile : 'mcopy',
|
||||
camera : {},
|
||||
projector : {},
|
||||
light : {}
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const fs = require("fs-extra");
|
||||
class Settings {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor() {
|
||||
this.file = path.join(os.homedir(), `/.mcopy/settings.json`);
|
||||
this.state = {
|
||||
server: {
|
||||
port: 1111,
|
||||
enabled: true
|
||||
},
|
||||
devices: [],
|
||||
profile: 'mcopy',
|
||||
camera: {},
|
||||
projector: {},
|
||||
light: {}
|
||||
};
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async checkDir() {
|
||||
const dir = path.join(os.homedir(), '.mcopy/');
|
||||
const exists = await fs.exists(dir);
|
||||
if (!exists) {
|
||||
try {
|
||||
await fs.mkdir(dir);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code === 'EEXIST')
|
||||
return true;
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async save() {
|
||||
const str = JSON.stringify(this.state, null, '\t');
|
||||
this.checkDir();
|
||||
try {
|
||||
await fs.writeFile(this.file, str, 'utf8');
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
update(key, val) {
|
||||
this.state[key] = val;
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
get(key) {
|
||||
return this.state[key];
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
all() {
|
||||
return this.state;
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async restore() {
|
||||
let exists;
|
||||
let str;
|
||||
this.checkDir();
|
||||
exists = await fs.exists(this.file);
|
||||
if (exists) {
|
||||
str = await fs.readFile(this.file, 'utf8');
|
||||
this.state = JSON.parse(str);
|
||||
}
|
||||
else {
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async reset() {
|
||||
const exists = await fs.exists(this.file);
|
||||
if (exists) {
|
||||
try {
|
||||
await fs.unlink(this.file);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
this.restore();
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
settings.checkDir = async function () {
|
||||
const dir = path.join(os.homedir(), '.mcopy/');
|
||||
const exists = await fs.exists(dir)
|
||||
if (!exists) {
|
||||
try {
|
||||
await fs.mkdir(dir);
|
||||
} catch (err) {
|
||||
if (err.code === 'EEXIST') return true
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
settings.save = async function () {
|
||||
const str = JSON.stringify(settings.state, null, '\t');
|
||||
settings.checkDir();
|
||||
try {
|
||||
await fs.writeFile(settings.file, str, 'utf8');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
settings.update = function (key, val) {
|
||||
settings.state[key] = val;
|
||||
}
|
||||
|
||||
settings.get = function (key) {
|
||||
return settings.state[key];
|
||||
}
|
||||
|
||||
settings.all = function () {
|
||||
return settings.state;
|
||||
}
|
||||
|
||||
settings.restore = async function () {
|
||||
let exists;
|
||||
let str;
|
||||
|
||||
settings.checkDir();
|
||||
exists = await fs.exists(settings.file);
|
||||
|
||||
if (exists) {
|
||||
str = await fs.readFile(settings.file, 'utf8');
|
||||
settings.state = JSON.parse(str);
|
||||
} else {
|
||||
settings.save();
|
||||
}
|
||||
}
|
||||
|
||||
settings.reset = async function () {
|
||||
const exists = await fs.exists(settings.file);
|
||||
if (exists) {
|
||||
try {
|
||||
await fs.unlink(settings.file);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
settings.restore();
|
||||
};
|
||||
|
||||
module.exports = settings;
|
||||
module.exports = new Settings();
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -1,9 +1,10 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//import Log = require('log');
|
||||
const delay = require("delay");
|
||||
const SerialPort = require('serialport');
|
||||
const Readline = SerialPort.parsers.Readline;
|
||||
const exec = require('child_process').exec;
|
||||
const delay = require("delay");
|
||||
const parser = new Readline('');
|
||||
const newlineRe = new RegExp('\n', 'g');
|
||||
const returnRe = new RegExp('\r', 'g');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,25 +1,27 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Intval = require("intval");
|
||||
const Log = require("log");
|
||||
/** class representing camera functions **/
|
||||
class Camera {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(arduino, cfg, ui) {
|
||||
constructor(arduino, cfg, ui, dig) {
|
||||
this.state = { dir: true, digital: false };
|
||||
this.arduino = null;
|
||||
this.intval = null;
|
||||
this.arduino = arduino;
|
||||
this.cfg = cfg;
|
||||
this.ui = ui;
|
||||
this.dig = dig;
|
||||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'cam' });
|
||||
this.log = await Log({ label: 'cam' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
@ -67,9 +69,9 @@ class Camera {
|
|||
async move(frame, id) {
|
||||
const cmd = this.cfg.arduino.cmd.camera;
|
||||
let ms;
|
||||
//if (this.state.digital) {
|
||||
//await this.dig.start()
|
||||
//}
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.start();
|
||||
}
|
||||
if (this.intval) {
|
||||
try {
|
||||
ms = await this.intval.move();
|
||||
|
@ -86,9 +88,9 @@ class Camera {
|
|||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
//if (this.state.digital) {
|
||||
// await this.dig.end()
|
||||
//}
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.end();
|
||||
}
|
||||
this.log.info('Camera move time', { ms });
|
||||
return this.end(cmd, id, ms);
|
||||
}
|
||||
|
@ -175,9 +177,8 @@ class Camera {
|
|||
this.log.info(message, 'CAMERA', true, true);
|
||||
this.ui.send('cam', { cmd: cmd, id: id, ms: ms });
|
||||
}
|
||||
;
|
||||
}
|
||||
module.exports = function (arduino, cfg, ui) {
|
||||
return new Camera(arduino, cfg, ui);
|
||||
module.exports = function (arduino, cfg, ui, dig) {
|
||||
return new Camera(arduino, cfg, ui, dig);
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,56 +1,129 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const delay = require("delay");
|
||||
const dig = {};
|
||||
dig.state = {
|
||||
frame: 0,
|
||||
frames: 0,
|
||||
path: null,
|
||||
fileName: null,
|
||||
info: {},
|
||||
dir: true
|
||||
};
|
||||
dig.set = function (dir) {
|
||||
dig.state.dir = dir;
|
||||
};
|
||||
dig.move = async function () {
|
||||
let start = +new Date();
|
||||
let last = dig.state.dir + 0;
|
||||
if (dig.state.dir) {
|
||||
dig.state.frame++;
|
||||
const Log = require("log");
|
||||
class Digital {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(display, ffmpeg, ffprobe, ui, light) {
|
||||
this.state = {
|
||||
frame: 0,
|
||||
frames: 0,
|
||||
path: null,
|
||||
fileName: null,
|
||||
info: {},
|
||||
dir: true,
|
||||
enabled: false
|
||||
};
|
||||
this.display = display;
|
||||
this.ffmpeg = ffmpeg;
|
||||
this.ffprobe = ffprobe;
|
||||
this.ui = ui;
|
||||
this.light = light;
|
||||
this.init();
|
||||
}
|
||||
else {
|
||||
dig.state.frame--;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await Log({ label: 'digital' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
if (dig.state.frame < 1) {
|
||||
dig.state.frame = 1;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
listen() {
|
||||
this.ipc.on('digital', this.connectDigital.bind(this));
|
||||
}
|
||||
return (+new Date()) - start;
|
||||
};
|
||||
dig.start = async function (lightState) {
|
||||
try {
|
||||
await dig.ffmpeg.clearAll();
|
||||
/**
|
||||
*
|
||||
**/
|
||||
set(dir) {
|
||||
this.state.dir = dir;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async move() {
|
||||
let start = +new Date();
|
||||
if (this.state.dir) {
|
||||
this.state.frame++;
|
||||
}
|
||||
else {
|
||||
this.state.frame--;
|
||||
}
|
||||
if (this.state.frame < 1) {
|
||||
this.state.frame = 1;
|
||||
}
|
||||
return (+new Date()) - start;
|
||||
}
|
||||
try {
|
||||
await dig.ffmpeg.frame(dig.state, lightState);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async start() {
|
||||
try {
|
||||
await this.ffmpeg.clearAll();
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.ffmpeg.frame(this.state, this.light.state);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
this.display.start(this.state.frame);
|
||||
await delay(20);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async end() {
|
||||
await delay(20);
|
||||
this.display.end();
|
||||
}
|
||||
dig.display.start(dig.state.frame);
|
||||
await delay(20);
|
||||
};
|
||||
dig.end = async function () {
|
||||
await delay(20);
|
||||
dig.display.end();
|
||||
};
|
||||
module.exports = (display, ffmpeg, ffprobe) => {
|
||||
dig.display = display;
|
||||
dig.ffmpeg = ffmpeg;
|
||||
dig.ffprobe = ffprobe;
|
||||
return dig;
|
||||
/**
|
||||
* Use a file as the "digital" source on "projector"
|
||||
*
|
||||
**/
|
||||
async connectDigital(evt, arg) {
|
||||
let info;
|
||||
let frames = 0;
|
||||
try {
|
||||
info = await this.ffprobe.info(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
//this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.enabled = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
frames = await this.ffprobe.frames(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.enabled = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
this.state.frame = 0;
|
||||
this.state.path = arg.path;
|
||||
this.state.fileName = arg.fileName;
|
||||
this.state.frames = frames;
|
||||
this.state.info = info;
|
||||
this.log.info(`Opened ${this.state.fileName}`, 'DIGITAL', true, true);
|
||||
this.log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
||||
this.state.enabled = true;
|
||||
return await this.ui.send('digital', { valid: true, state: JSON.stringify(this.state) });
|
||||
}
|
||||
}
|
||||
module.exports = (display, ffmpeg, ffprobe, ui, light) => {
|
||||
return new Digital(display, ffmpeg, ffprobe, ui, light);
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/digital/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,GAAG,GAAS,EAAE,CAAC;AACrB,GAAG,CAAC,KAAK,GAAG;IACX,KAAK,EAAG,CAAC;IACT,MAAM,EAAG,CAAC;IACV,IAAI,EAAG,IAAI;IACX,QAAQ,EAAG,IAAI;IACf,IAAI,EAAG,EAAE;IACT,GAAG,EAAG,IAAI;CACV,CAAC;AAEF,GAAG,CAAC,GAAG,GAAI,UAAU,GAAa;IACjC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;AACrB,CAAC,CAAA;AAED,GAAG,CAAC,IAAI,GAAG,KAAK;IACf,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,EAAE,CAAA;IACvB,IAAI,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;IAC7B,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;QAClB,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;KACjB;SAAM;QACN,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;KACjB;IACD,IA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,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,EAAG,IAAI,EAAE,KAAK,EAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,OAAa,EAAE,MAAY,EAAE,OAAa,EAAE,EAAQ,EAAE,KAAW,EAAE,EAAE;IACtF,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC,CAAA"}
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const delay = require("delay");
|
||||
const Log = require("log");
|
||||
class Light {
|
||||
/**
|
||||
*
|
||||
|
@ -16,7 +17,7 @@ class Light {
|
|||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'light' });
|
||||
this.log = await Log({ label: 'light' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/light/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,KAAK;IASV;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ;QAX5C,UAAK,GAAS,EAAE,KAAK,EAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;QAYzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,GAAG,GAAG,MAAM,OAAO,CAA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AM,EAAE,CACR,CAAC;SACF;aAAM;YACN,MAAM,GAAG,OAAO;YACf,cAAc;YACd,QAAQ,EAAE,EACV,MAAM,EAAE,CACR,CAAC;SACF;QACD,SAAS,GAAG,YAAY,CAAC;YACxB,UAAU,EAAE;gBACX,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBACxB,MAAM;iBACN,CAAC;gBACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;oBACrB,QAAQ,EAAE,MAAM,OAAO,EAAE;oBACzB,MAAM,EAAG,OAAO,CACf,KAAK,CAAC,EAAE,KAAK,EAAG,GAAG,CAAC,KAAK,EAAE,CAAC;oBAC5B,cAAc;oBACd,IAAI,EAAE,CACN;iBACD,CAAC;aACF;SACD,CAAC,CAAA;KACF;IACD,OAAO,SAAS,CAAA;AACjB,CAAC,CAAA"}
|
|
@ -1,4 +1,7 @@
|
|||
"use strict";
|
||||
/** class representing the Projector features **/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Log = require("log");
|
||||
class Projector {
|
||||
/**
|
||||
*
|
||||
|
@ -16,7 +19,7 @@ class Projector {
|
|||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'proj' });
|
||||
this.log = await Log({ label: 'proj' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
@ -25,7 +28,6 @@ class Projector {
|
|||
**/
|
||||
listen() {
|
||||
this.ipc.on('proj', this.listener.bind(this));
|
||||
this.ipc.on('digital', this.connectDigital.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -40,8 +42,8 @@ class Projector {
|
|||
cmd = this.cfg.arduino.cmd.proj_backward;
|
||||
}
|
||||
this.state.dir = dir;
|
||||
if (this.state.digital) {
|
||||
//this.dig.set(dir)
|
||||
if (this.dig.state.enabled) {
|
||||
this.dig.set(dir);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
|
@ -59,9 +61,9 @@ class Projector {
|
|||
async move(frame, id) {
|
||||
const cmd = this.cfg.arduino.cmd.projector;
|
||||
let ms;
|
||||
if (this.state.digital) {
|
||||
if (this.dig.state.enabled) {
|
||||
try {
|
||||
//ms = await this.dig.move()
|
||||
ms = await this.dig.move();
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
|
@ -127,41 +129,6 @@ class Projector {
|
|||
this.log.info(message, 'PROJECTOR');
|
||||
return await this.ui.send('proj', { cmd: cmd, id: id, ms: ms });
|
||||
}
|
||||
/**
|
||||
* Use a file as the "digital" source on "projector"
|
||||
*
|
||||
**/
|
||||
async connectDigital(evt, arg) {
|
||||
let info;
|
||||
let frames = 0;
|
||||
try {
|
||||
info = await this.dig.ffprobe.info(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.digital = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
frames = await this.dig.ffprobe.frames(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.digital = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
this.dig.state.frame = 0;
|
||||
this.dig.state.path = arg.path;
|
||||
this.dig.state.fileName = arg.fileName;
|
||||
this.dig.state.frames = frames;
|
||||
this.dig.state.info = info;
|
||||
this.log.info(`Opened ${this.dig.state.fileName}`, 'DIGITAL', true, true);
|
||||
this.log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
||||
this.state.digital = true;
|
||||
return await this.ui.send('digital', { valid: true, state: JSON.stringify(this.dig.state) });
|
||||
}
|
||||
}
|
||||
module.exports = function (arduino, cfg, ui, dig) {
|
||||
return new Projector(arduino, cfg, ui, dig);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,10 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//import Log = require('log');
|
||||
const delay = require("delay");
|
||||
const SerialPort = require('serialport');
|
||||
const Readline = SerialPort.parsers.Readline;
|
||||
const exec = require('child_process').exec;
|
||||
const delay = require("delay");
|
||||
const parser = new Readline('');
|
||||
const newlineRe = new RegExp('\n', 'g');
|
||||
const returnRe = new RegExp('\r', 'g');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,25 +1,27 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Intval = require("intval");
|
||||
const Log = require("log");
|
||||
/** class representing camera functions **/
|
||||
class Camera {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(arduino, cfg, ui) {
|
||||
constructor(arduino, cfg, ui, dig) {
|
||||
this.state = { dir: true, digital: false };
|
||||
this.arduino = null;
|
||||
this.intval = null;
|
||||
this.arduino = arduino;
|
||||
this.cfg = cfg;
|
||||
this.ui = ui;
|
||||
this.dig = dig;
|
||||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'cam' });
|
||||
this.log = await Log({ label: 'cam' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
@ -67,9 +69,9 @@ class Camera {
|
|||
async move(frame, id) {
|
||||
const cmd = this.cfg.arduino.cmd.camera;
|
||||
let ms;
|
||||
//if (this.state.digital) {
|
||||
//await this.dig.start()
|
||||
//}
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.start();
|
||||
}
|
||||
if (this.intval) {
|
||||
try {
|
||||
ms = await this.intval.move();
|
||||
|
@ -86,9 +88,9 @@ class Camera {
|
|||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
//if (this.state.digital) {
|
||||
// await this.dig.end()
|
||||
//}
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.end();
|
||||
}
|
||||
this.log.info('Camera move time', { ms });
|
||||
return this.end(cmd, id, ms);
|
||||
}
|
||||
|
@ -175,9 +177,8 @@ class Camera {
|
|||
this.log.info(message, 'CAMERA', true, true);
|
||||
this.ui.send('cam', { cmd: cmd, id: id, ms: ms });
|
||||
}
|
||||
;
|
||||
}
|
||||
module.exports = function (arduino, cfg, ui) {
|
||||
return new Camera(arduino, cfg, ui);
|
||||
module.exports = function (arduino, cfg, ui, dig) {
|
||||
return new Camera(arduino, cfg, ui, dig);
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,56 +1,129 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const delay = require("delay");
|
||||
const dig = {};
|
||||
dig.state = {
|
||||
frame: 0,
|
||||
frames: 0,
|
||||
path: null,
|
||||
fileName: null,
|
||||
info: {},
|
||||
dir: true
|
||||
};
|
||||
dig.set = function (dir) {
|
||||
dig.state.dir = dir;
|
||||
};
|
||||
dig.move = async function () {
|
||||
let start = +new Date();
|
||||
let last = dig.state.dir + 0;
|
||||
if (dig.state.dir) {
|
||||
dig.state.frame++;
|
||||
const Log = require("log");
|
||||
class Digital {
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor(display, ffmpeg, ffprobe, ui, light) {
|
||||
this.state = {
|
||||
frame: 0,
|
||||
frames: 0,
|
||||
path: null,
|
||||
fileName: null,
|
||||
info: {},
|
||||
dir: true,
|
||||
enabled: false
|
||||
};
|
||||
this.display = display;
|
||||
this.ffmpeg = ffmpeg;
|
||||
this.ffprobe = ffprobe;
|
||||
this.ui = ui;
|
||||
this.light = light;
|
||||
this.init();
|
||||
}
|
||||
else {
|
||||
dig.state.frame--;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await Log({ label: 'digital' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
if (dig.state.frame < 1) {
|
||||
dig.state.frame = 1;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
listen() {
|
||||
this.ipc.on('digital', this.connectDigital.bind(this));
|
||||
}
|
||||
return (+new Date()) - start;
|
||||
};
|
||||
dig.start = async function (lightState) {
|
||||
try {
|
||||
await dig.ffmpeg.clearAll();
|
||||
/**
|
||||
*
|
||||
**/
|
||||
set(dir) {
|
||||
this.state.dir = dir;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async move() {
|
||||
let start = +new Date();
|
||||
if (this.state.dir) {
|
||||
this.state.frame++;
|
||||
}
|
||||
else {
|
||||
this.state.frame--;
|
||||
}
|
||||
if (this.state.frame < 1) {
|
||||
this.state.frame = 1;
|
||||
}
|
||||
return (+new Date()) - start;
|
||||
}
|
||||
try {
|
||||
await dig.ffmpeg.frame(dig.state, lightState);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async start() {
|
||||
try {
|
||||
await this.ffmpeg.clearAll();
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
try {
|
||||
await this.ffmpeg.frame(this.state, this.light.state);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
this.display.start(this.state.frame);
|
||||
await delay(20);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async end() {
|
||||
await delay(20);
|
||||
this.display.end();
|
||||
}
|
||||
dig.display.start(dig.state.frame);
|
||||
await delay(20);
|
||||
};
|
||||
dig.end = async function () {
|
||||
await delay(20);
|
||||
dig.display.end();
|
||||
};
|
||||
module.exports = (display, ffmpeg, ffprobe) => {
|
||||
dig.display = display;
|
||||
dig.ffmpeg = ffmpeg;
|
||||
dig.ffprobe = ffprobe;
|
||||
return dig;
|
||||
/**
|
||||
* Use a file as the "digital" source on "projector"
|
||||
*
|
||||
**/
|
||||
async connectDigital(evt, arg) {
|
||||
let info;
|
||||
let frames = 0;
|
||||
try {
|
||||
info = await this.ffprobe.info(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
//this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.enabled = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
frames = await this.ffprobe.frames(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.enabled = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
this.state.frame = 0;
|
||||
this.state.path = arg.path;
|
||||
this.state.fileName = arg.fileName;
|
||||
this.state.frames = frames;
|
||||
this.state.info = info;
|
||||
this.log.info(`Opened ${this.state.fileName}`, 'DIGITAL', true, true);
|
||||
this.log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
||||
this.state.enabled = true;
|
||||
return await this.ui.send('digital', { valid: true, state: JSON.stringify(this.state) });
|
||||
}
|
||||
}
|
||||
module.exports = (display, ffmpeg, ffprobe, ui, light) => {
|
||||
return new Digital(display, ffmpeg, ffprobe, ui, light);
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/digital/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,GAAG,GAAS,EAAE,CAAC;AACrB,GAAG,CAAC,KAAK,GAAG;IACX,KAAK,EAAG,CAAC;IACT,MAAM,EAAG,CAAC;IACV,IAAI,EAAG,IAAI;IACX,QAAQ,EAAG,IAAI;IACf,IAAI,EAAG,EAAE;IACT,GAAG,EAAG,IAAI;CACV,CAAC;AAEF,GAAG,CAAC,GAAG,GAAI,UAAU,GAAa;IACjC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;AACrB,CAAC,CAAA;AAED,GAAG,CAAC,IAAI,GAAG,KAAK;IACf,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,EAAE,CAAA;IACvB,IAAI,IAAI,GAAG,GAAG,CAAC,KAA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C,CAAC;QACtE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QAC1B,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,EAAG,IAAI,EAAE,KAAK,EAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;CACD;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,OAAa,EAAE,MAAY,EAAE,OAAa,EAAE,EAAQ,EAAE,KAAW,EAAE,EAAE;IACtF,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC,CAAA"}
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const delay = require("delay");
|
||||
const Log = require("log");
|
||||
class Light {
|
||||
/**
|
||||
*
|
||||
|
@ -16,7 +17,7 @@ class Light {
|
|||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'light' });
|
||||
this.log = await Log({ label: 'light' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/light/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,+BAAgC;AAEhC,MAAM,KAAK;IASV;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ;QAX5C,UAAK,GAAS,EAAE,KAAK,EAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;QAYzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,I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AAC;SACtB,CAAA;KACD;SAAM;QACN,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE;YACrB,MAAM,GAAG,OAAO,CACf,KAAK,CAAC,EAAE,KAAK,EAAG,GAAG,CAAC,KAAK,EAAE,CAAC;YAC5B,cAAc;YACd,QAAQ,EAAE,EACV,MAAM,EAAE,CACR,CAAC;SACF;aAAM;YACN,MAAM,GAAG,OAAO;YACf,cAAc;YACd,QAAQ,EAAE,EACV,MAAM,EAAE,CACR,CAAC;SACF;QACD,SAAS,GAAG,YAAY,CAAC;YACxB,UAAU,EAAE;gBACX,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBACxB,MAAM;iBACN,CAAC;gBACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;oBACrB,QAAQ,EAAE,MAAM,OAAO,EAAE;oBACzB,MAAM,EAAG,OAAO,CACf,KAAK,CAAC,EAAE,KAAK,EAAG,GAAG,CAAC,KAAK,EAAE,CAAC;oBAC5B,cAAc;oBACd,IAAI,EAAE,CACN;iBACD,CAAC;aACF;SACD,CAAC,CAAA;KACF;IACD,OAAO,SAAS,CAAA;AACjB,CAAC,CAAA"}
|
|
@ -1,4 +1,7 @@
|
|||
"use strict";
|
||||
/** class representing the Projector features **/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Log = require("log");
|
||||
class Projector {
|
||||
/**
|
||||
*
|
||||
|
@ -16,7 +19,7 @@ class Projector {
|
|||
*
|
||||
**/
|
||||
async init() {
|
||||
this.log = await require('log')({ label: 'proj' });
|
||||
this.log = await Log({ label: 'proj' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
@ -25,7 +28,6 @@ class Projector {
|
|||
**/
|
||||
listen() {
|
||||
this.ipc.on('proj', this.listener.bind(this));
|
||||
this.ipc.on('digital', this.connectDigital.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -40,8 +42,8 @@ class Projector {
|
|||
cmd = this.cfg.arduino.cmd.proj_backward;
|
||||
}
|
||||
this.state.dir = dir;
|
||||
if (this.state.digital) {
|
||||
//this.dig.set(dir)
|
||||
if (this.dig.state.enabled) {
|
||||
this.dig.set(dir);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
|
@ -59,9 +61,9 @@ class Projector {
|
|||
async move(frame, id) {
|
||||
const cmd = this.cfg.arduino.cmd.projector;
|
||||
let ms;
|
||||
if (this.state.digital) {
|
||||
if (this.dig.state.enabled) {
|
||||
try {
|
||||
//ms = await this.dig.move()
|
||||
ms = await this.dig.move();
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err);
|
||||
|
@ -127,41 +129,6 @@ class Projector {
|
|||
this.log.info(message, 'PROJECTOR');
|
||||
return await this.ui.send('proj', { cmd: cmd, id: id, ms: ms });
|
||||
}
|
||||
/**
|
||||
* Use a file as the "digital" source on "projector"
|
||||
*
|
||||
**/
|
||||
async connectDigital(evt, arg) {
|
||||
let info;
|
||||
let frames = 0;
|
||||
try {
|
||||
info = await this.dig.ffprobe.info(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.digital = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
frames = await this.dig.ffprobe.frames(arg.path);
|
||||
}
|
||||
catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.digital = false;
|
||||
await this.ui.send('digital', { valid: false });
|
||||
return false;
|
||||
}
|
||||
this.dig.state.frame = 0;
|
||||
this.dig.state.path = arg.path;
|
||||
this.dig.state.fileName = arg.fileName;
|
||||
this.dig.state.frames = frames;
|
||||
this.dig.state.info = info;
|
||||
this.log.info(`Opened ${this.dig.state.fileName}`, 'DIGITAL', true, true);
|
||||
this.log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
||||
this.state.digital = true;
|
||||
return await this.ui.send('digital', { valid: true, state: JSON.stringify(this.dig.state) });
|
||||
}
|
||||
}
|
||||
module.exports = function (arduino, cfg, ui, dig) {
|
||||
return new Projector(arduino, cfg, ui, dig);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
//import Log = require('log');
|
||||
import delay = require('delay');
|
||||
|
||||
const SerialPort = require('serialport')
|
||||
const Readline = SerialPort.parsers.Readline
|
||||
const exec = require('child_process').exec
|
||||
|
||||
import delay = require('delay');
|
||||
|
||||
const parser : any = new Readline('')
|
||||
const newlineRe : RegExp = new RegExp('\n', 'g')
|
||||
const returnRe : RegExp = new RegExp('\r', 'g')
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
import Intval = require('intval');
|
||||
import Log = require('log');
|
||||
import delay = require('delay');
|
||||
|
||||
/** class representing camera functions **/
|
||||
|
||||
|
@ -10,15 +12,17 @@ class Camera {
|
|||
private intval : any = null;
|
||||
private log : any;
|
||||
private cfg : any;
|
||||
private dig : any;
|
||||
private ui : any;
|
||||
private ipc : any;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor (arduino : Arduino, cfg : any, ui : any) {
|
||||
constructor (arduino : Arduino, cfg : any, ui : any, dig : any) {
|
||||
this.arduino = arduino;
|
||||
this.cfg = cfg;
|
||||
this.ui = ui;
|
||||
this.dig = dig;
|
||||
this.init();
|
||||
}
|
||||
|
||||
|
@ -26,7 +30,7 @@ class Camera {
|
|||
*
|
||||
**/
|
||||
private async init () {
|
||||
this.log = await require('log')({ label : 'cam' });
|
||||
this.log = await Log({ label : 'cam' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
@ -75,9 +79,9 @@ class Camera {
|
|||
public async move (frame : number, id : string) {
|
||||
const cmd : string = this.cfg.arduino.cmd.camera;
|
||||
let ms : number;
|
||||
//if (this.state.digital) {
|
||||
//await this.dig.start()
|
||||
//}
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.start()
|
||||
}
|
||||
if (this.intval) {
|
||||
try {
|
||||
ms = await this.intval.move();
|
||||
|
@ -91,9 +95,9 @@ class Camera {
|
|||
this.log.error(err);
|
||||
}
|
||||
}
|
||||
//if (this.state.digital) {
|
||||
// await this.dig.end()
|
||||
//}
|
||||
if (this.dig.state.enabled) {
|
||||
await this.dig.end()
|
||||
}
|
||||
this.log.info('Camera move time', { ms });
|
||||
return this.end(cmd, id, ms);
|
||||
}
|
||||
|
@ -175,9 +179,9 @@ class Camera {
|
|||
}
|
||||
this.log.info(message, 'CAMERA', true, true)
|
||||
this.ui.send('cam', {cmd: cmd, id : id, ms: ms})
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (arduino : Arduino, cfg : any, ui : any) {
|
||||
return new Camera(arduino, cfg, ui);
|
||||
module.exports = function (arduino : Arduino, cfg : any, ui : any, dig : any) {
|
||||
return new Camera(arduino, cfg, ui, dig);
|
||||
}
|
|
@ -1,60 +1,137 @@
|
|||
'use strict';
|
||||
|
||||
import delay = require('delay');
|
||||
import Log = require('log');
|
||||
|
||||
const dig : any = {};
|
||||
dig.state = {
|
||||
frame : 0,
|
||||
frames : 0,
|
||||
path : null,
|
||||
fileName : null,
|
||||
info : {},
|
||||
dir : true
|
||||
};
|
||||
class Digital {
|
||||
public state : any = {
|
||||
frame : 0,
|
||||
frames : 0,
|
||||
path : null,
|
||||
fileName : null,
|
||||
info : {},
|
||||
dir : true,
|
||||
enabled : false
|
||||
};
|
||||
private display : any;
|
||||
private ffmpeg : any;
|
||||
private ffprobe : any;
|
||||
private light : any;
|
||||
private ipc : any;
|
||||
private ui : any;
|
||||
private log : any;
|
||||
/**
|
||||
*
|
||||
**/
|
||||
constructor (display : any, ffmpeg : any, ffprobe : any, ui : any, light : any) {
|
||||
this.display = display;
|
||||
this.ffmpeg = ffmpeg;
|
||||
this.ffprobe = ffprobe;
|
||||
this.ui = ui;
|
||||
this.light = light;
|
||||
this.init();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private async init () {
|
||||
this.log = await Log({ label : 'digital'});
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private listen () {
|
||||
this.ipc.on('digital', this.connectDigital.bind(this));
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
public set (dir : boolean) {
|
||||
this.state.dir = dir;
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
public async move () {
|
||||
let start : number = +new Date();
|
||||
if (this.state.dir) {
|
||||
this.state.frame++;
|
||||
} else {
|
||||
this.state.frame--;
|
||||
}
|
||||
if (this.state.frame < 1) {
|
||||
this.state.frame = 1;
|
||||
}
|
||||
return (+new Date()) - start;
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
async start () {
|
||||
try {
|
||||
await this.ffmpeg.clearAll();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
|
||||
try {
|
||||
await this.ffmpeg.frame(this.state, this.light.state);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
|
||||
dig.set = function (dir : boolean) {
|
||||
dig.state.dir = dir;
|
||||
this.display.start(this.state.frame);
|
||||
await delay(20);
|
||||
}
|
||||
/**
|
||||
*
|
||||
**/
|
||||
private async end () {
|
||||
await delay(20);
|
||||
this.display.end();
|
||||
}
|
||||
/**
|
||||
* Use a file as the "digital" source on "projector"
|
||||
*
|
||||
**/
|
||||
async connectDigital (evt : any, arg : any) {
|
||||
let info;
|
||||
let frames = 0;
|
||||
|
||||
try {
|
||||
info = await this.ffprobe.info(arg.path);
|
||||
} catch (err) {
|
||||
//this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.enabled = false;
|
||||
await this.ui.send('digital', { valid : false });
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
frames = await this.ffprobe.frames(arg.path);
|
||||
} catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.enabled = false;
|
||||
await this.ui.send('digital', { valid : false });
|
||||
return false;
|
||||
}
|
||||
|
||||
this.state.frame = 0;
|
||||
this.state.path = arg.path;
|
||||
this.state.fileName = arg.fileName;
|
||||
this.state.frames = frames;
|
||||
this.state.info = info;
|
||||
|
||||
this.log.info(`Opened ${this.state.fileName}`, 'DIGITAL', true, true);
|
||||
this.log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
||||
this.state.enabled = true;
|
||||
return await this.ui.send('digital', { valid : true, state : JSON.stringify(this.state) });
|
||||
}
|
||||
}
|
||||
|
||||
dig.move = async function () {
|
||||
let start = +new Date()
|
||||
let last = dig.state.dir + 0;
|
||||
if (dig.state.dir) {
|
||||
dig.state.frame++
|
||||
} else {
|
||||
dig.state.frame--
|
||||
}
|
||||
if (dig.state.frame < 1) {
|
||||
dig.state.frame = 1
|
||||
}
|
||||
return (+new Date()) - start
|
||||
}
|
||||
|
||||
dig.start = async function (lightState: number[]) {
|
||||
try {
|
||||
await dig.ffmpeg.clearAll()
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
try {
|
||||
await dig.ffmpeg.frame(dig.state, lightState)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
dig.display.start(dig.state.frame)
|
||||
await delay(20)
|
||||
}
|
||||
|
||||
dig.end = async function () {
|
||||
await delay(20)
|
||||
dig.display.end()
|
||||
}
|
||||
|
||||
module.exports = (display : any, ffmpeg : any, ffprobe : any) => {
|
||||
dig.display = display;
|
||||
dig.ffmpeg = ffmpeg;
|
||||
dig.ffprobe = ffprobe;
|
||||
return dig;
|
||||
module.exports = (display : any, ffmpeg : any, ffprobe : any, ui : any, light : any) => {
|
||||
return new Digital(display, ffmpeg, ffprobe, ui, light);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
import delay = require('delay');
|
||||
import Log = require('log');
|
||||
|
||||
class Light {
|
||||
public state : any = { color : [0, 0, 0] }
|
||||
|
@ -25,7 +26,7 @@ class Light {
|
|||
*
|
||||
**/
|
||||
private async init () {
|
||||
this.log = await require('log')({ label : 'light' });
|
||||
this.log = await Log({ label : 'light' });
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** class representing the Projector features **/
|
||||
|
||||
import Log = require('log');
|
||||
|
||||
class Projector {
|
||||
private state : any = { dir : true, digital : false };
|
||||
private arduino : Arduino = null;
|
||||
|
@ -25,7 +27,7 @@ class Projector {
|
|||
*
|
||||
**/
|
||||
async init () {
|
||||
this.log = await require('log')({ label : 'proj' })
|
||||
this.log = await Log({ label : 'proj' })
|
||||
this.ipc = require('electron').ipcMain;
|
||||
this.listen();
|
||||
}
|
||||
|
@ -35,7 +37,6 @@ class Projector {
|
|||
**/
|
||||
private listen () {
|
||||
this.ipc.on('proj', this.listener.bind(this));
|
||||
this.ipc.on('digital', this.connectDigital.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,8 +51,8 @@ class Projector {
|
|||
cmd = this.cfg.arduino.cmd.proj_backward
|
||||
}
|
||||
this.state.dir = dir
|
||||
if (this.state.digital) {
|
||||
//this.dig.set(dir)
|
||||
if (this.dig.state.enabled) {
|
||||
this.dig.set(dir)
|
||||
} else {
|
||||
try {
|
||||
ms = await this.arduino.send('projector', cmd)
|
||||
|
@ -68,9 +69,9 @@ class Projector {
|
|||
async move (frame : any, id : string) {
|
||||
const cmd : string = this.cfg.arduino.cmd.projector;
|
||||
let ms : number;
|
||||
if (this.state.digital) {
|
||||
if (this.dig.state.enabled) {
|
||||
try {
|
||||
//ms = await this.dig.move()
|
||||
ms = await this.dig.move()
|
||||
} catch (err) {
|
||||
this.log.error(err)
|
||||
}
|
||||
|
@ -128,43 +129,6 @@ class Projector {
|
|||
this.log.info(message, 'PROJECTOR')
|
||||
return await this.ui.send('proj', {cmd: cmd, id : id, ms: ms})
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a file as the "digital" source on "projector"
|
||||
*
|
||||
**/
|
||||
async connectDigital (evt : any, arg : any) {
|
||||
let info;
|
||||
let frames = 0;
|
||||
|
||||
try {
|
||||
info = await this.dig.ffprobe.info(arg.path);
|
||||
} catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.digital = false;
|
||||
await this.ui.send('digital', { valid : false });
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
frames = await this.dig.ffprobe.frames(arg.path);
|
||||
} catch (err) {
|
||||
this.log.error(err, 'DIGITAL', true, true);
|
||||
this.state.digital = false;
|
||||
await this.ui.send('digital', { valid : false });
|
||||
return false;
|
||||
}
|
||||
|
||||
this.dig.state.frame = 0;
|
||||
this.dig.state.path = arg.path;
|
||||
this.dig.state.fileName = arg.fileName;
|
||||
this.dig.state.frames = frames;
|
||||
this.dig.state.info = info;
|
||||
|
||||
this.log.info(`Opened ${this.dig.state.fileName}`, 'DIGITAL', true, true);
|
||||
this.log.info(`Frames : ${frames}`, 'DIGITAL', true, true);
|
||||
this.state.digital = true;
|
||||
return await this.ui.send('digital', { valid : true, state : JSON.stringify(this.dig.state) });
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (arduino : Arduino, cfg : any, ui : any, dig : any) {
|
||||
|
|
Loading…
Reference in New Issue