All known classes have types exported and imported into dependent modules. This has already caught a class of bugs. Removing references to any will catch another.

This commit is contained in:
Matt McWilliams 2024-05-23 18:49:18 -04:00
parent 7f8a9d4289
commit cb63194fc6
80 changed files with 1543 additions and 354 deletions

View File

@ -1 +1,24 @@
export {};
export declare class Alert {
private ipc;
private log;
private id;
private cb;
private ui;
constructor(ui: any);
/**
*
**/
private init;
/**
*
**/
private listen;
/**
*
**/
private listener;
/**
*
**/
start(cmd: string): Promise<number>;
}

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Alert = void 0;
const log_1 = require("log");
/* class representing alert functionality */
class Alert {
@ -52,6 +53,7 @@ class Alert {
}.bind(this));
}
}
exports.Alert = Alert;
module.exports = function (ui) {
return new Alert(ui);
};

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/alert/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,6BAA0B;AAG1B,4CAA4C;AAE5C,MAAM,KAAK;IAOV,YAAc,EAAQ;QAJd,OAAE,GAAY,OAAO,CAAA;QACrB,OAAE,GAAc,IAAI,CAAA;QAI3B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,IAAI,EAAE,CAAA;IACZ,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,GAAG,GAAG,MAAM,IAAA,SAAG,EAAC,EAAE,KAAK,EAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAA;QACtC,IAAI,CAAC,MAAM,EAAE,CAAA;IACd,CAAC;IAED;;QAEI;IACI,MAAM;QACb,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/C,CAAC;IA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AC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;QACrG,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QAC9B,OAAO,IAAI,OAAO,CAAC,UAAU,OAAkB,EAAE,MAAiB;YACjE,IAAI,CAAC,EAAE,GAAG;gBACT,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;gBACjC,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC,CAAA;QACF,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACf,CAAC;CACD;AAxDD,sBAwDC;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,EAAQ;IAClC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAA"}

View File

@ -1 +1,173 @@
export {};
/**
* Class representing the arduino communication features
**/
export declare class Arduino {
private log;
private path;
private known;
private serial;
private baud;
private queue;
private timer;
private locks;
private confirmExec;
private errorState;
private keys;
private values;
alias: any;
stateStr: any;
hasState: any;
constructor(errorState: Function);
init(): Promise<void>;
/**
* Enumerate all connected devices that might be Arduinos
*
* @async
* @returns {Promise} Resolves after enumerating
**/
enumerate(): Promise<string[]>;
/**
* Send a command to an Arduino using async/await
*
* @param {string} device The Arduino device identifier
* @param {string} cmd Single character command to send
*
* @async
* @returns {Promise} Resolves after sending
**/
private sendAsync;
/**
* Sends a command to the specified Arduino and waits for a response.
* Handles the communication lock to prevent sending multiple commands simultaneously.
* Emits an 'arduino_send' event after successfully sending the command.
*
* @async
* @param {string} device - The Arduino device identifier.
* @param {string} cmd - The command to be sent to the Arduino.
* @returns {Promise<boolean|string>} Returns 'false' if the communication is locked, otherwise returns the response from the device.
* @throws {Error} Throws an error if the sendAsync method encounters an error.
**/
send(device: string, cmd: string): Promise<any>;
/**
* Sends a string to the specified Arduino.
* Handles different types of devices, including fake devices for testing purposes.
* Waits for a specified delay before sending the string.
*
* @async
* @param {string} device - The Arduino device identifier.
* @param {string} str - The string to be sent to the Arduino.
* @returns {Promise<boolean|string>} Returns 'true' if the string is sent successfully, otherwise returns an error message.
* @throws {Error} Throws an error if the writeAsync method encounters an error.
**/
sendString(device: string, str: string): Promise<any>;
/**
*
**/
private stateAsync;
/**
*
**/
state(device: string, confirm?: boolean): Promise<string>;
/**
* Send a string to an Arduino using async/await
*
* @param {string} device Arduino identifier
* @param {string} str String to send
*
* @returns {Promise} Resolves after sending
**/
private writeAsync;
/**
* Handles the end of communication with the Arduino.
* Calculates the time taken for the communication, executes the callback,
* and emits an 'arduino_end' event. Handles errors and stray data received.
*
* @param {string} serial - The serial address of the Arduino device.
* @param {string} data - The data received from the Arduino.
* @returns {any} The time taken for the communication in milliseconds.
**/
private end;
private error;
/**
* Associates an alias with an Arduinos serial address.
* Used to map multi-purpose devices onto the same serial connection.
*
* @param {string} device - The serial number of the target Arduino.
* @param {string} serial - The alias to be associated with the target device.
**/
aliasSerial(device: string, serial: string): void;
/**
* Connects to an Arduino using its serial number.
* Sets up the SerialPort instance and path for the device, and handles data communication.
* Handles opening the connection and emitting 'arduino_end' or 'confirmEnd' events upon receiving data.
*
* @async
* @param {string} device - The device identifier (common name).
* @param {string} serial - The serial address of the target Arduino (e.g., COM port on Windows).
* @param {function} confirm - A callback function to be executed upon receiving confirmation data.
* @returns {Promise<string>} Resolves with the device path if the connection is successful.
* @throws {Error} Rejects with an error message if the connection fails.
**/
connect(device: string, serial: string, confirm: any): Promise<any>;
/**
* Handles the confirmation data received from an Arduino.
* Executes the confirmation callback function if the received data is present in the list of expected values.
*
* @param {string} data - The data received from the Arduino.
**/
private confirmEnd;
/**
* Verifies the connection to an Arduino by sending a connect command.
* The confirmation callback checks if the received data matches the expected connect command.
*
* @async
* @returns {Promise<boolean>} Resolves with 'true' if the connection is verified successfully.
* @throws {Error} Rejects with an error message if the connection verification fails.
**/
verify(): Promise<unknown>;
/**
* Distinguishes the type of Arduino connected.
* Sends a command to the device to identify its type and resolves the promise with the received type.
*
* @async
* @returns {Promise<string>} Resolves with the type of the connected Arduino-based device.
* @throws {Error} Rejects with an error message if the distinguish operation fails.
**/
distinguish(): Promise<string>;
/**
* Closes the connection to an Arduino.
*
* @async
* @returns {Promise<boolean>} Resolves with 'true' if the connection is closed successfully.
* @throws {Error} Throws an error if the closeArduino method encounters an error.
**/
close(): Promise<boolean>;
/**
* Establishes a fake connection to an Arduino for testing purposes.
* Creates a fake SerialPort instance with custom write and string methods.
*
* @async
* @param {string} serial - The device identifier of the fake Arduino.
* @returns {Promise<boolean>} Resolves with 'true' if the fake connection is established successfully.
**/
fakeConnect(device: string): Promise<boolean>;
/**
* Connect to an Arduino using async/await
*
* @param {string} device Arduino identifier
*
* @returns {Promise} Resolves after opening
**/
private openArduino;
/**
* Close a connection to an Arduino using async/await
*
* @param {string} device Arduino identifier
*
* @returns {Promise} Resolves after closing
**/
private closeArduino;
private lock;
private unlock;
private isLocked;
}

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Arduino = void 0;
/**
* 2023-07-16 Clarification
*
@ -41,14 +42,14 @@ class Arduino {
constructor(errorState) {
this.path = {};
this.known = KNOWN;
this.alias = {};
this.serial = {};
this.hasState = {};
this.baud = 57600;
this.queue = {};
this.timer = 0;
this.locks = {};
this.alias = {};
this.stateStr = {};
this.hasState = {};
this.errorState = errorState;
this.init();
}
@ -593,6 +594,7 @@ class Arduino {
return typeof this.locks[serial] !== 'undefined' && this.locks[serial] === true;
}
}
exports.Arduino = Arduino;
if (typeof module !== 'undefined' && module.parent) {
module.exports = function (c, ee, errorState) {
eventEmitter = ee;

File diff suppressed because one or more lines are too long

View File

@ -1 +1,66 @@
import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout';
interface CameraState {
pos: number;
dir: boolean;
capper: boolean;
}
/** class representing camera functions **/
export declare class Camera {
state: CameraState;
arduino: Arduino;
private intval;
private processing;
private log;
private cfg;
private filmout;
private ui;
private ipc;
private id;
/**
*
**/
constructor(arduino: Arduino, cfg: any, ui: any, filmout: FilmOut, second?: boolean);
/**
*
**/
private init;
/**
*
**/
private listen;
/**
*
**/
set(dir: boolean, id: string): Promise<number>;
/**
*
**/
cap(state: boolean, id: string): Promise<number>;
/**
*
**/
move(id: string): Promise<number>;
both(id: string): Promise<number>;
/**
*
**/
exposure(exposure: number, id: string): Promise<number>;
/**
*
**/
private connectIntval;
/**
*
**/
private connectProcessing;
/**
*
**/
private listener;
/**
*
**/
private end;
}
export {};

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Camera = void 0;
const intval_1 = require("intval");
const processing_1 = require("processing");
const delay_1 = require("delay");
@ -13,7 +14,7 @@ class Camera {
this.state = {
pos: 0,
dir: true,
capepr: false
capper: false
};
this.arduino = null;
this.intval = null;
@ -106,7 +107,7 @@ class Camera {
/**
*
**/
async move(frame, id) {
async move(id) {
const cmd = this.cfg.arduino.cmd[this.id];
let ms;
if (this.filmout.state.enabled) {
@ -125,7 +126,7 @@ class Camera {
ms = await this.intval.move();
}
catch (err) {
this.log.error(err);
this.log.error(`Error moving intval ${this.id}: ${id}`, err);
}
}
else {
@ -143,14 +144,14 @@ class Camera {
//this.log.info('Camera move time', { ms });
return this.end(cmd, id, ms);
}
async both(frame, id) {
async both(id) {
const cmd = this.cfg.arduino.cmd[id];
let ms;
try {
ms = await this.arduino.send(this.id, cmd);
}
catch (err) {
this.log.error(`Error moving ${this.id}`, err);
this.log.error(`Error moving both ${this.id}: ${id}`, err);
}
//this.log.info('Cameras move time', { ms });
return await this.end(cmd, id, ms);
@ -167,7 +168,7 @@ class Camera {
let parts;
let confirmExposure;
if (this.intval) {
return this.intval.setExposure(this.id, exposure, (ms) => {
return this.intval.setExposure(exposure, (ms) => {
this.ui.send('timing', { c: 'c', ms: exposure });
return this.end(cmd, id, ms);
});
@ -258,9 +259,9 @@ class Camera {
this.log.error(err);
}
}
else if (typeof arg.frame !== 'undefined') {
else if (typeof arg.move !== 'undefined') {
try {
await this.move(arg.frame, arg.id);
await this.move(arg.id);
}
catch (err) {
this.log.error(err);
@ -336,6 +337,7 @@ class Camera {
return ms;
}
}
exports.Camera = Camera;
module.exports = function (arduino, cfg, ui, filmout, second) {
return new Camera(arduino, cfg, ui, filmout, second);
};

File diff suppressed because one or more lines are too long

View File

@ -1 +1,37 @@
export {};
import type { FilmOut } from 'filmout';
import type { Arduino } from 'arduino';
/** class representing capper functions **/
export declare class Capper {
private state;
private arduino;
private log;
private cfg;
private filmout;
private ui;
private ipc;
private id;
/**
*
**/
constructor(arduino: Arduino, cfg: any, ui: any, filmout: FilmOut);
/**
*
**/
private init;
/**
*
**/
private listen;
/**
*
**/
capper(state: boolean, id: string): Promise<number>;
/**
*
**/
private listener;
/**
*
**/
private end;
}

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Capper = void 0;
const log_1 = require("log");
/** class representing capper functions **/
class Capper {
@ -81,8 +82,10 @@ class Capper {
message += ` ${ms}ms`;
this.log.info(message);
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
return ms;
}
}
exports.Capper = Capper;
module.exports = function (arduino, cfg, ui, filmout) {
return new Capper(arduino, cfg, ui, filmout);
};

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capper/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAKb,6BAA0B;AAI1B,2CAA2C;AAE3C,MAAM,MAAM;IAWX;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAa;QAb1D,UAAK,GAAS;YACrB,MAAM,EAAG,KAAK;SACd,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAMzB,OAAE,GAAY,QAAQ,CAAC;QAK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,OAAO,GAAG,mBAAmB,CAAC;SAC9B;QAED,OAAO,IAAI,IAAI,EAAE,IAAI,CAAC;QAEtB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC,CAAC;QACnD,OAAO,EAAE,CAAC;IACX,CAAC;CACD;AA9FD,wBA8FC;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAY;IAC9E,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC,CAAA"}

175
app/lib/cmd/index.d.ts vendored
View File

@ -1 +1,174 @@
export {};
import type { Projector } from 'proj';
import type { Camera } from 'cam';
import type { Light } from 'light';
import type { Capper } from 'capper';
import type { Alert } from 'alert';
export declare class Commands {
proj: Projector;
cam: Camera;
light: Light;
cam2: Camera;
proj2: Projector;
capper: Capper;
alertObj: Alert;
private cfg;
private ipc;
/**
* @constructor
* Assign all connected devices and mock devices as private classes.
*
* @param {object} cfg Configuration object
* @param {object} proj Projector 1
* @param {object} cam Camera 1
* @param {object} light Light source
* @param {object} alert Alert object
* @param {object} cam2 (optional) Camera 2
* @param {object} proj2 (optional) Projector 2
* @param {object} capper Capper object
*
**/
constructor(cfg: any, proj: Projector, cam: any, light: Light, alert: Alert, cam2?: any, proj2?: Projector, capper?: any);
/**
* Move the projector one frame forward
*
* @returns {integer} Length of action in ms
**/
projector_forward(): Promise<number>;
/**
* Move the projector one frame backward
*
* @returns {integer} Length of action in ms
**/
projector_backward(): Promise<number>;
/**
* Move the camera one frame forward
*
* @param {object} cmd Full cmd object
*
* @returns {integer} Length of action in ms
**/
camera_forward(): Promise<number>;
/**
* Move the camera one frame forward with light off
*
* @returns {integer} Length of action in ms
**/
black_forward(): Promise<number>;
/**
* Move the camera one frame backward
*
* @param {object} cmd Full cmd object
*
* @returns {integer} Length of action in ms
**/
camera_backward(): Promise<number>;
/**
* Move the camera one frame forward, light set to black or off
*
* @returns {integer} Length of action in ms
**/
black_backward(): Promise<number>;
/**
* Move the second camera one frame forward
*
* @param {object} cmd Full cmd object
*
* @returns {integer} Length of action in ms
**/
camera_second_forward(): Promise<number>;
/**
* Move the second camera one frame backward
*
* @param {object} cmd Full cmd object
*
* @returns {integer} Length of action in ms
**/
camera_second_backward(): Promise<number>;
/**
* Move the both cameras one frame forward
*
* @param {object} cmd Full cmd object
*
* @returns {integer} Length of action in ms
**/
cameras_forward(): Promise<number>;
/**
* Move the both cameras one frame backward
*
* @param {object} cmd Full cmd object
*
* @returns {integer} Length of action in ms
**/
cameras_backward(): Promise<number>;
/**
* Move first camera one frame forward and rewind secondary camera one frame backward
*
* @param {object} cmd Full cmd object
*
* @returns {integer} Length of action in ms
**/
camera_forward_camera_second_backward(): Promise<number>;
/**
* Rewind first camera one frame backward and move secondary camera one frame forward
*
* @param {object} cmd Full cmd object
*
* @returns {integer} Length of action in ms
**/
camera_backward_camera_second_forward(): Promise<number>;
/**
* Move the secondary projector forward one frame
*
* @returns {integer} Length of action in ms
**/
projector_second_forward(): Promise<number>;
/**
* Rewind the secondary projector backward one frame
*
* @returns {integer} Length of action in ms
**/
projector_second_backward(): Promise<number>;
/**
* Move the both projectors forward one frame
*
* @returns {integer} Length of action in ms
**/
projectors_forward(): Promise<number>;
/**
* Rewind both projectors backwards one frame
*
* @returns {integer} Length of action in ms
**/
projectors_backward(): Promise<number>;
/**
* Move the primary projector forward one frame and rewind the secondary projector
* one frame backwards.
*
* @returns {integer} Length of action in ms
**/
projector_forward_projector_second_backward(): Promise<number>;
/**
* Rewind the primary projector backwards one frame and move the secondary
* projector forward one frame.
*
* @returns {integer} Length of action in ms
**/
projector_backward_projector_second_forward(): Promise<number>;
/**
* Throws an alert to pause a sequence
*
* @returns {integer} Length of action in ms
**/
alert(cmd: any): Promise<number>;
/**
* Pauses a sequence for a length of time
*
* @returns {integer} Length of action in ms
**/
pause(cmd: any): Promise<number>;
/**
* Sets the camera exposure (if supported).
*
**/
camera_exposure(cmd: any): Promise<number>;
}

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Commands = void 0;
const uuid_1 = require("uuid");
const delay_1 = require("delay");
class Commands {
@ -37,14 +38,15 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async projector_forward() {
const id = (0, uuid_1.v4)();
let ms;
try {
if (!this.proj.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj.set(true);
await this.proj.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms = await this.proj.move();
ms = await this.proj.move(id);
}
catch (err) {
throw err;
@ -57,14 +59,15 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async projector_backward() {
const id = (0, uuid_1.v4)();
let ms;
try {
if (this.proj.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj.set(false);
await this.proj.set(false, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms = await this.proj.move();
ms = await this.proj.move(id);
}
catch (err) {
throw err;
@ -86,12 +89,12 @@ class Commands {
try {
if (!this.cam.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam.set(true);
await this.cam.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms = await this.cam.move();
ms = await this.cam.move(id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
}
@ -112,7 +115,7 @@ class Commands {
try {
if (!this.cam.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam.set(true);
await this.cam.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.capper) {
@ -121,7 +124,7 @@ class Commands {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(off, id); //make sure set to off
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms += await this.cam.move();
ms += await this.cam.move(id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
if (this.capper) {
@ -148,12 +151,12 @@ class Commands {
try {
if (this.cam.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam.set(false);
await this.cam.set(false, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms = await this.cam.move();
ms = await this.cam.move(id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
}
@ -174,7 +177,7 @@ class Commands {
try {
if (this.cam.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam.set(false);
await this.cam.set(false, id);
}
if (this.capper) {
ms += await this.capper.capper(true, id);
@ -182,7 +185,7 @@ class Commands {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(off, id); //make sure set to off
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms += await this.cam.move();
ms += await this.cam.move(id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
if (this.capper) {
@ -209,12 +212,12 @@ class Commands {
try {
if (!this.cam2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam2.set(true);
await this.cam2.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms = await this.cam2.move();
ms = await this.cam2.move(id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
}
@ -238,12 +241,12 @@ class Commands {
try {
if (this.cam2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam2.set(false);
await this.cam2.set(false, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms = await this.cam2.move();
ms = await this.cam2.move(id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
}
@ -268,20 +271,20 @@ class Commands {
try {
if (!this.cam.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam.set(true);
await this.cam.set(true, id);
}
if (!this.cam2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam2.set(true);
await this.cam2.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
ms = await this.cam.both();
ms = await this.cam.both(id);
}
else {
both = await Promise.all([this.cam.move(), this.cam2.move()]);
both = await Promise.all([this.cam.move(id), this.cam2.move(id)]);
ms = Math.max(...both);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
@ -308,20 +311,20 @@ class Commands {
try {
if (this.cam.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam.set(false);
await this.cam.set(false, id);
}
if (this.cam2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam2.set(false);
await this.cam2.set(false, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
ms = await this.cam.both();
ms = await this.cam.both(id);
}
else {
both = await Promise.all([this.cam.move(), this.cam2.move()]);
both = await Promise.all([this.cam.move(id), this.cam2.move(id)]);
ms = Math.max(...both);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
@ -348,20 +351,20 @@ class Commands {
try {
if (!this.cam.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam.set(true);
await this.cam.set(true, id);
}
if (this.cam2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam2.set(false);
await this.cam2.set(false, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
ms = await this.cam.both();
ms = await this.cam.both(id);
}
else {
both = await Promise.all([this.cam.move(), this.cam2.move()]);
both = await Promise.all([this.cam.move(id), this.cam2.move(id)]);
ms = Math.max(...both);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
@ -388,20 +391,20 @@ class Commands {
try {
if (this.cam.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam.set(false);
await this.cam.set(false, id);
}
if (!this.cam2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.cam2.set(true);
await this.cam2.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
ms = await this.cam.both();
ms = await this.cam.both(id);
}
else {
both = await Promise.all([this.cam.move(), this.cam2.move()]);
both = await Promise.all([this.cam.move(id), this.cam2.move(id)]);
ms = Math.max(...both);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
@ -418,14 +421,15 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async projector_second_forward() {
const id = (0, uuid_1.v4)();
let ms;
try {
if (!this.proj2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj2.set(true);
await this.proj2.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms = await this.proj2.move();
ms = await this.proj2.move(id);
}
catch (err) {
throw err;
@ -438,14 +442,15 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async projector_second_backward() {
const id = (0, uuid_1.v4)();
let ms;
try {
if (this.proj2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj2.set(false);
await this.proj2.set(false, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
ms = await this.proj2.move();
ms = await this.proj2.move(id);
}
catch (err) {
throw err;
@ -458,23 +463,24 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async projectors_forward() {
const id = (0, uuid_1.v4)();
let both;
let ms;
try {
if (!this.proj.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj.set(true);
await this.proj.set(true, id);
}
if (!this.proj2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj2.set(true);
await this.proj2.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
ms = await this.proj.both();
ms = await this.proj.both(id);
}
else {
both = await Promise.all([this.proj.move(), this.proj2.move()]);
both = await Promise.all([this.proj.move(id), this.proj2.move(id)]);
ms = Math.max(...both);
}
}
@ -489,23 +495,24 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async projectors_backward() {
const id = (0, uuid_1.v4)();
let both;
let ms;
try {
if (this.proj.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj.set(false);
await this.proj.set(false, id);
}
if (this.proj2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj2.set(false);
await this.proj2.set(false, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
ms = await this.proj.both();
ms = await this.proj.both(id);
}
else {
both = await Promise.all([this.proj.move(), this.proj2.move()]);
both = await Promise.all([this.proj.move(id), this.proj2.move(id)]);
ms = Math.max(...both);
}
}
@ -521,23 +528,24 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async projector_forward_projector_second_backward() {
const id = (0, uuid_1.v4)();
let both;
let ms;
try {
if (!this.proj.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj.set(true);
await this.proj.set(true, id);
}
if (this.proj2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj2.set(false);
await this.proj2.set(false, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
ms = await this.proj.both();
ms = await this.proj.both(id);
}
else {
both = await Promise.all([this.proj.move(), this.proj2.move()]);
both = await Promise.all([this.proj.move(id), this.proj2.move(id)]);
ms = Math.max(...both);
}
}
@ -553,23 +561,24 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async projector_backward_projector_second_forward() {
const id = (0, uuid_1.v4)();
let both;
let ms;
try {
if (this.proj.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj.set(false);
await this.proj.set(false, id);
}
if (!this.proj2.state.dir) {
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
await this.proj2.set(true);
await this.proj2.set(true, id);
}
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
ms = await this.proj.both();
ms = await this.proj.both(id);
}
else {
both = await Promise.all([this.proj.move(), this.proj2.move()]);
both = await Promise.all([this.proj.move(id), this.proj2.move(id)]);
ms = Math.max(...both);
}
}
@ -584,6 +593,7 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async alert(cmd) {
const id = (0, uuid_1.v4)();
let ms;
try {
ms = await this.alertObj.start(cmd.light); //change this meta
@ -599,6 +609,7 @@ class Commands {
* @returns {integer} Length of action in ms
**/
async pause(cmd) {
const id = (0, uuid_1.v4)();
let ms;
try {
ms = await (0, delay_1.delay)(cmd.light * 1000); //delay is in seconds
@ -608,10 +619,15 @@ class Commands {
}
return ms;
}
/**
* Sets the camera exposure (if supported).
*
**/
async camera_exposure(cmd) {
const id = (0, uuid_1.v4)();
let ms;
try {
ms = await this.cam.exposure(cmd.light);
ms = await this.cam.exposure(cmd.light, id);
}
catch (err) {
throw err;
@ -619,6 +635,7 @@ class Commands {
return ms;
}
}
exports.Commands = Commands;
module.exports = function (cfg, proj, cam, light, alert, cam2, proj2, capper) {
return new Commands(cfg, proj, cam, light, alert, cam2, proj2, capper);
};

File diff suppressed because one or more lines are too long

View File

@ -5,4 +5,4 @@
*
* @returns {Promise} Promise to resolve after timeout
**/
export declare function delay(ms: number): Promise<unknown>;
export declare function delay(ms: number): Promise<number>;

View File

@ -10,7 +10,7 @@ exports.delay = void 0;
**/
function delay(ms) {
return new Promise((resolve) => {
return setTimeout(resolve, ms);
return setTimeout(() => { resolve(ms); }, ms);
});
}
exports.delay = delay;

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delay/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb;;;;;;IAMI;AAEJ,SAAgB,KAAK,CAAE,EAAW;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAa,EAAE,EAAE;QACpC,OAAO,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACJ,CAAC;AAJD,sBAIC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delay/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb;;;;;;IAMI;AAEJ,SAAgB,KAAK,CAAE,EAAW;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAa,EAAE,EAAE;QACpC,OAAO,UAAU,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACJ,CAAC;AAJD,sBAIC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC"}

View File

@ -1 +1,80 @@
export {};
import type { Settings } from 'settings';
import type { Arduino } from 'arduino';
/**
* class representing the device discovery features
*
*
**/
export declare class Devices {
settings: Settings;
connected: any;
private arduino;
private log;
private ui;
private ipc;
private mainWindow;
private cam;
/**
* Constructor assigns arduino, settings, UI browser window and cam objects
* locally to this class for reference.
**/
constructor(arduino: Arduino, settings: Settings, mainWindow: any, cam: any);
/**
* Initialize the log for "devices". Establish an ipc connection to the UI.
* Start listening on that ipc connection.
**/
private init;
/**
* Listen to the "profile" channel for messages from the UI.
**/
private listen;
/**
* The "profile" channel callback. If a profile is changed, set it in the
* local settings object.
**/
private listener;
/**
*
**/
enumerate(): Promise<boolean>;
/**
*
**/
private favor;
/**
*
**/
private distinguish;
/**
*
**/
private fakeProjector;
/**
*
**/
private fakeCamera;
/**
*
**/
private fakeLight;
/**
*
**/
private fakeCapper;
/**
*
**/
private connectDevice;
/**
*
**/
private all;
/**
*
**/
private remember;
/**
*
**/
private ready;
}

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Devices = void 0;
const delay_1 = require("delay");
const log_1 = require("log");
/**
@ -579,6 +580,7 @@ class Devices {
return true;
}
}
exports.Devices = Devices;
module.exports = function (arduino, settings, mainWindow, cam) {
return new Devices(arduino, settings, mainWindow, cam);
};

File diff suppressed because one or more lines are too long

View File

@ -1 +1,17 @@
export {};
export declare class Display {
private platform;
private displays;
private display;
private tmpdir;
private wv;
constructor(sys: any);
open(): Promise<void>;
show(src: string): Promise<void>;
showPath(pathStr: string): Promise<unknown>;
hide(): void;
close(): Promise<boolean>;
focus(): Promise<boolean>;
field(ratio: number): Promise<boolean>;
meter(): Promise<boolean>;
change(id: any): void;
}

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Display = void 0;
/**
* @module display
* Provides features for displaying a full screen display of images for the digital module.
@ -8,7 +9,7 @@ const path_1 = require("path");
const url_1 = require("url");
const delay_1 = require("delay");
const log_1 = require("log");
const { BrowserWindow } = require('electron');
const electron_1 = require("electron");
class WebView {
constructor(platform, display) {
this.opened = false;
@ -37,7 +38,7 @@ class WebView {
prefs.x = display.x + 50;
prefs.y = display.y + 50;
}
this.digitalWindow = new BrowserWindow(prefs);
this.digitalWindow = new electron_1.BrowserWindow(prefs);
require('@electron/remote/main').enable(this.digitalWindow.webContents);
this.digitalWindow.loadURL(pageUrl);
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
@ -192,6 +193,7 @@ class Display {
});
}
}
exports.Display = Display;
module.exports = function (sys) {
return new Display(sys);
};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exec/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;AAEC,QAAA,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAA;AAEpD;;;;;;;;;;GAUG;AACH,KAAK,UAAU,IAAI,CAAC,GAAG,IAAe;IACrC,IAAI,GAAG,GAAY,IAAI,CAAC,CAAC,CAAC,CAAA;IAC1B,IAAI,IAAI,GAAY,IAAI,CAAA;IACxB,IAAI,IAAI,GAAS,IAAI,CAAA;IAErB,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QAC1D,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;KACd;IACD,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,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
module.exports.exit = exit;
module.exports = { exit };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exit/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;IAMI;AAEJ,SAAS,IAAI,CAAE,GAAY,EAAE,OAAgB,CAAC;IAC7C,IAAI,IAAI,KAAK,CAAC,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,EAAE,CAAC;KACf;SAAM;QACN,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACnB;AACF,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exit/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;IAMI;AAEJ,SAAS,IAAI,CAAE,GAAY,EAAE,OAAgB,CAAC;IAC7C,IAAI,IAAI,KAAK,CAAC,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,EAAE,CAAC;KACf;SAAM;QACN,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACnB;AACF,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,CAAC"}

View File

@ -1 +1,84 @@
export {};
import type { FilmOutState } from 'filmout';
interface StdErr {
frame: number;
fps: number;
time: string;
speed: number;
size: string;
remaining?: number;
progress?: number;
estimated?: number;
}
/** @class FFMPEG **/
export declare class FFMPEG {
private bin;
private log;
private id;
private TMPDIR;
private child;
onProgress: Function;
/**
* @constructor
* Creates an ffmpeg class
*
* @param {object} sys System object to be used to get temp directory
**/
constructor(sys: any);
/**
* Async method to call async functions from constructor
**/
init(): Promise<void>;
/**
* Add padding to a number to 5 places. Return a string.
*
* @param {integer} i Integer to pad
*
* @returns {string} Padded string
**/
private padded_frame;
/**
* Parse the stderr output of ffmpeg
*
* @param {string} line Stderr line
**/
private parseStderr;
/**
* Render a single frame from a video or image to a png.
*
* @param {object} state State object containing file data
* @param {object} light Object containing color information for frame
*
* @returns {string} Path of frame
**/
frame(state: FilmOutState, light: any): Promise<string>;
/**
* Render all frames in a video to the temp directory.
* Not in use.
*
* @param {string} video Path to video
* @param {object} obj Not sure
*
* @returns {?}
**/
frames(state: FilmOutState): Promise<unknown>;
cancel(): void;
/**
* Clears a specific frame from the tmp directory
*
* @param {integer} frame Integer of frame to clear
*
* @returns {boolean} True if successful, false if not
**/
clear(state: any): Promise<boolean>;
/**
* Deletes all frames in temp directory.
*
**/
clearAll(): Promise<void>;
/**
* Checks if mcopy temp directory exists. If it doesn't,
* creates it.
**/
private checkDir;
}
export type { StdErr };

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.FFMPEG = void 0;
/** @module ffmpeg **/
const path_1 = require("path");
const fs_extra_1 = require("fs-extra");
@ -350,6 +351,7 @@ class FFMPEG {
}
}
}
exports.FFMPEG = FFMPEG;
module.exports = (sys) => {
return new FFMPEG(sys);
};

File diff suppressed because one or more lines are too long

View File

@ -1 +1,28 @@
export {};
export declare class FFPROBE {
private bin;
private log;
constructor(sys: any);
private init;
/**
* Parse the fps entry into a float representing the fps of a video
**/
private parseFps;
/**
* Get info on a video in json format. Use for filmout.
*
* @param {string} video Path to video
*
* @returns {object} Video info in an object
**/
info(video: string): Promise<any>;
/**
* Count the number of frames in the video using one of two methods.
* The first uses -select_streams and is very fast. The second uses
* -count_frames and is VERY slow.
*
* @param {string} video Path to video
*
* @returns {integer} Number of frames in video
**/
frames(video: string): Promise<any>;
}

View File

@ -1,12 +1,11 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.FFPROBE = void 0;
/** @module FFPROBE **/
const fs_extra_1 = require("fs-extra");
const path_1 = require("path");
const exec_1 = require("exec");
const log_1 = require("log");
//const spawn = require('spawn');
//const exit = require('exit');
class FFPROBE {
constructor(sys) {
this.bin = sys.deps.ffprobe;
@ -140,6 +139,7 @@ class FFPROBE {
return frames;
}
}
exports.FFPROBE = FFPROBE;
/*
function map (obj : any) {
console.dir(obj);

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffprobe/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,uBAAuB;AAEvB,uCAAkC;AAClC,+BAA+B;AAC/B,+BAA4B;AAC5B,6BAA0B;AAE1B,iCAAiC;AACjC,+BAA+B;AAE/B,MAAM,OAAO;IAGZ,YAAa,GAAS;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAEO,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,GAAG,GAAG,MAAM,IAAA,SAAG,EAAC,EAAE,KAAK,EAAG,SAAS,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;QAEI;IACI,QAAQ,CAAE,MAAe;QAChC,IAAI,GAAG,GAAY,IAAI,CAAC;QACxB,IAAI,KAAgB,CAAC;QACrB,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;YAC/B,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC1B,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAClD;aAAM;YACN,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;SACzB;QACD,OAAO,GAAG,CAAA;IACX,CAAC;IACD;;;;;;QAMI;IACG,KAAK,CAAC,IAAI,CAAE,KAAc;QA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B,CAAC,CAAA"}

View File

@ -1 +1,171 @@
export {};
import type { Server } from 'server';
import type { Display } from 'display';
import type { Light } from 'light';
import type { FFMPEG } from 'ffmpeg';
import type { FFPROBE } from 'ffprobe';
interface FilmOutState {
hash: string;
frame: number;
frames: number;
fps: number;
seconds: number;
still: boolean;
path: string;
fileName: string;
directory: boolean;
info: any;
dir: boolean;
enabled: boolean;
files: string[];
}
/**
* @module FilmOut
**/
export declare class FilmOut {
private id;
private videoExtensions;
private stillExtensions;
private sequenceExtensions;
private gifExtension;
state: FilmOutState;
private ffmpeg;
private ffprobe;
private light;
private ipc;
private ui;
private log;
display: Display;
server: Server;
/**
* @constructor
* Builds FilmOut class with display, ffmpeg, ffprobe, ui and light as internal properties.
*
* @param {object} display Display object for showing frames
* @param {object} ffmpeg FFMPEG wrapper
* @param {object} ffprobe FFPROBE wrapper for file info
* @param {object} ui Electron ui object
* @param {object} light Light device object
**/
constructor(display: Display, server: Server, ffmpeg: FFMPEG, ffprobe: FFPROBE, ui: any, light: Light);
/**
* Async function for requiring log, ipcMain and bind events.
**/
private init;
/**
*
**/
private listen;
/**
* Create a hash of a string.
*
* @param {string} data Data to produce hash of
*/
private hash;
/**
* Sets filmout direction.
*
* @param {boolean} dir Direction of filmout
**/
set(dir: boolean): void;
/**
* Moves filmout a frame at a time.
*
* @returns {number} Time since start
**/
move(): Promise<number>;
/**
* Begin the process of exporting single frames from the video for display.
**/
start(): Promise<void>;
/**
* Ends the filmout process and closes the display.
**/
end(): Promise<void>;
/**
* Use a video file as a film out source on "projector"
*
* @param {object} evt Original connect event
* @param {object} arg Arguments from ipc message
*
* @returns {boolean} Success state
**/
onConnect(evt: any, arg: any): Promise<boolean>;
/**
* Pre-export all frames from video for display.
*
* @param {object} evt IPC event
* @param {object} arg IPC args
*
* @returns {any} UI send call
*/
onPreExport(evt: Event, arg: any): Promise<any>;
/**
* Return true if gif is animated, false if it is a still
*
* @param {string} pathStr Path to gif to check
*
* @returns {boolean} Whether or not gif is animated
**/
isGifAnimated(pathStr: string): Promise<boolean>;
/**
* Return information on a still image using the Jimp module
*
* @param {string} pathStr Path to gif to check
*
* @returns {object} Info about still from sharp
**/
stillInfo(pathStr: string): Promise<any>;
/**
* Return information on the first still image found in a
* directory using the Jimp module.
*
* @param {array} images List of image paths
*
* @returns {object} Info about first image
**/
dirInfo(images: string[]): Promise<any>;
/**
* Returns a list of images within a directory, filtered
* for supported types and sorted.
*
* @param {string} pathStr Path to directory
*
* @returns {array} Array of image paths
**/
dirList(pathStr: string): Promise<string[]>;
/**
* Preview a frame from the selected video.
*
* @param {object} evt Original event
* @param {object} arg Arguments from message
**/
previewFrame(evt: any, arg: any): Promise<void>;
/**
* Open a single frame in a display window to preview filmout.
*
* @param {object} evt Original event
* @param {object} arg Arguments from message
**/
preview(evt: any, arg: any): Promise<void>;
/**
*
**/
focus(evt: any, arg: any): Promise<void>;
/**
*
**/
field(evt: any, arg: any): Promise<void>;
/**
*
**/
meter(evt: any, arg: any): Promise<void>;
/**
*
**/
close(evt: any, arg: any): Promise<void>;
/**
*
**/
onDisplay(evt: any, arg: any): void;
}
export type { FilmOutState };

View File

@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilmOut = void 0;
const animated_gif_detector_1 = __importDefault(require("animated-gif-detector"));
const path_1 = require("path");
const fs_extra_1 = require("fs-extra");
@ -31,8 +32,11 @@ class FilmOut {
this.sequenceExtensions = ['.png', '.jpg', '.jpeg'];
this.gifExtension = '.gif';
this.state = {
hash: null,
frame: 0,
frames: 0,
fps: 24,
seconds: 0,
still: false,
path: null,
fileName: null,
@ -498,6 +502,7 @@ class FilmOut {
this.log.info(`Changing the display to ${arg.display}`);
}
}
exports.FilmOut = FilmOut;
module.exports = (display, server, ffmpeg, ffprobe, ui, light) => {
return new FilmOut(display, server, ffmpeg, ffprobe, ui, light);
};

File diff suppressed because one or more lines are too long

View File

@ -12,4 +12,4 @@ export default class Frame {
static solidColor(width: number, height: number, color: RGBA): Promise<unknown>;
static blend(inPath: any, color: RGBA, imagePath: string): Promise<string>;
}
export {};
export type { RGBA };

View File

@ -1,9 +1,8 @@
export declare class Intval {
private _baseUrl;
private req;
constructor(url: string);
move(): Promise<unknown>;
setDir(dir: boolean): Promise<unknown>;
setExposure(exposure: number, cb: Function): Promise<unknown>;
move(): Promise<number>;
setDir(dir: boolean): Promise<number>;
setExposure(exposure: number, cb: Function): Promise<number>;
connect(cb: Function): void;
}

View File

@ -1,17 +1,40 @@
'use strict';
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Intval = void 0;
const request = __importStar(require("request"));
class Intval {
constructor(url) {
this._baseUrl = `http://${url}`;
this.req = require('request');
}
async move() {
return new Promise((resolve, reject) => {
const timeStart = +new Date();
const url = `${this._baseUrl}/frame`;
//console.log(url)
return this.req(url, (err, res, body) => {
return request(url, (err, res, body) => {
let ms = (+new Date()) - timeStart;
if (err) {
return reject(err);
@ -25,7 +48,7 @@ class Intval {
const timeStart = +new Date();
const url = `${this._baseUrl}/dir?dir=${dir}`;
//console.log(url)
return this.req(url, (err, res, body) => {
return request(url, (err, res, body) => {
let ms = (+new Date()) - timeStart;
if (err) {
return reject(err);
@ -38,7 +61,7 @@ class Intval {
return new Promise((resolve, reject) => {
const timeStart = +new Date();
const url = `${this._baseUrl}/exposure?exposure=${exposure}`;
return this.req(url, (err, res, body) => {
return request(url, (err, res, body) => {
let ms = (+new Date()) - timeStart;
if (err) {
return reject(err);
@ -55,7 +78,7 @@ class Intval {
uri: url,
timeout: 5000
};
this.req(opts, (err, res, body) => {
request(opts, (err, res, body) => {
let ms = (+new Date()) - timeStart;
if (err) {
return cb(err, ms);
@ -65,5 +88,5 @@ class Intval {
}
}
exports.Intval = Intval;
module.exports.Intval = Intval;
module.exports = { Intval };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/intval/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;AAEZ,MAAa,MAAM;IAGlB,YAAa,GAAY;QACxB,IAAI,CAAC,QAAQ,GAAG,UAAU,GAAG,EAAE,CAAA;QAC/B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;IACM,KAAK,CAAC,IAAI;QAChB,OAAO,IAAI,OAAO,CAAE,CAAC,OAAa,EAAE,MAAY,EAAE,EAAE;YACnD,MAAM,SAAS,GAAY,CAAC,IAAI,IAAI,EAAE,CAAA;YACtC,MAAM,GAAG,GAAY,GAAG,IAAI,CAAC,QAAQ,QAAQ,CAAA;YAC7C,kBAAkB;YAClB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAW,EAAE,GAAS,EAAE,IAAa,EAAE,EAAE;gBAC9D,IAAI,EAAE,GAAY,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,SAAS,CAAA;gBAC3C,IAAI,GAAG,EAAE;oBACR,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;iBAClB;gBACD,OAAO,OAAO,C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AAI,IAAI,EAAE,CAAC,GAAG,SAAS,CAAA;gBAC3C,IAAI,GAAG,EAAE;oBACR,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;iBAClB;gBACD,OAAO,OAAO,CAAC,EAAE,CAAC,CAAA;YACnB,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;IACH,CAAC;IACM,OAAO,CAAE,EAAa;QAC5B,MAAM,SAAS,GAAY,CAAC,IAAI,IAAI,EAAE,CAAA;QACtC,MAAM,GAAG,GAAY,GAAG,IAAI,CAAC,QAAQ,SAAS,CAAA;QAC9C,MAAM,IAAI,GAAS;YAClB,MAAM,EAAG,KAAK;YACd,GAAG,EAAG,GAAG;YACT,OAAO,EAAE,IAAI;SACb,CAAA;QAED,OAAO,CAAC,IAAI,EAAE,CAAC,GAAW,EAAE,GAAS,EAAE,IAAa,EAAE,EAAE;YACvD,IAAI,EAAE,GAAY,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,SAAS,CAAA;YAC3C,IAAI,GAAG,EAAE;gBACR,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;aAClB;YACD,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAA;QACnB,CAAC,CAAC,CAAA;IACH,CAAC;CACD;AAhED,wBAgEC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,CAAA"}

View File

@ -1 +1,35 @@
export {};
import type { Arduino } from 'arduino';
export declare class Light {
state: any;
private arduino;
private cfg;
private ui;
private log;
private ipc;
private enabled;
private id;
/**
*
**/
constructor(arduino: Arduino, cfg: any, ui: any);
/**
*
**/
private init;
/**
*
**/
private listen;
/**
*
**/
private listener;
/**
*
**/
set(rgb: number[], id: string, on?: boolean): Promise<any>;
/**
*
**/
private end;
}

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Light = void 0;
const delay_1 = require("delay");
const log_1 = require("log");
class Light {
@ -91,6 +92,7 @@ class Light {
return res;
}
}
exports.Light = Light;
module.exports = function (arduino, cfg, ui) {
return new Light(arduino, cfg, ui);
};

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/light/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,iCAA8B;AAC9B,6BAA0B;AAG1B,MAAM,KAAK;IAYV;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ;QAd5C,UAAK,GAAS,EAAE,KAAK,EAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;QAOlC,YAAO,GAAa,IAAI,CAAC;QAEzB,OAAE,GAAY,OAAO,CAAC;QAM7B,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,IAAA,SAAG,EAAC,EAAE,KAAK,EAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAED;;QAEI;IACI,MAAM;QACb,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,QAAQ,CAAE,KAAW,EAAE,GAAS;QAC7C,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,WAAW,EAAE;YACnC,IAAI;gBACH,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAA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CAAC,GAAG,CAAC,CAAC;YACnB,MAAM,GAAG,CAAA;SACT;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;CACD;AAjGD,sBAiGC;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,OAAiB,EAAE,GAAS,EAAE,EAAQ;IAChE,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC,CAAA"}

View File

@ -246,4 +246,4 @@ export default class Mscript {
**/
contains(arr: string[], arr2: string[]): boolean;
}
export {};
export type { RGB };

View File

@ -1 +1,6 @@
export {};
export declare class Processing {
private _baseUrl;
constructor(url: string);
move(): Promise<number>;
setDir(dir: boolean): Promise<number>;
}

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Processing = void 0;
const exec_1 = require("exec");
class Processing {
constructor(url) {
@ -29,5 +30,6 @@ class Processing {
});
}
}
module.exports.Processing = Processing;
exports.Processing = Processing;
module.exports = { Processing };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/processing/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,+BAA4B;AAE5B,MAAM,UAAU;IAEf,YAAa,GAAY;QACxB,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;IAClG,CAAC;IAEM,KAAK,CAAC,IAAI;QAChB,OAAO,IAAI,OAAO,CAAE,KAAK,EAAE,OAAa,EAAE,MAAY,EAAE,EAAE;YACzD,MAAM,SAAS,GAAY,CAAC,IAAI,IAAI,EAAE,CAAA;YACtC,MAAM,GAAG,GAAY,GAAG,IAAI,CAAC,QAAQ,E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Q,EAAE,CAAA;YACvC,MAAM,GAAG,GAAY,kBAAkB,GAAG,EAAE,CAAA;YAC5C,IAAI,GAAY,CAAA;YAChB,IAAI,EAAW,CAAA;YACf,kBAAkB;YAClB,IAAI;gBACH,GAAG,GAAG,MAAM,IAAA,WAAI,EAAC,GAAG,CAAC,CAAA;aACrB;YAAC,OAAO,GAAG,EAAE;gBACb,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;aAClB;YACD,EAAE,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,SAAS,CAAA;YAC9B,OAAO,OAAO,CAAC,EAAE,CAAC,CAAA;QACnB,CAAC,CAAC,CAAA;IACH,CAAC;IACM,KAAK,CAAC,MAAM,CAAE,GAAa;QACjC,OAAO,IAAI,OAAO,CAAE,CAAC,OAAkB,EAAE,MAAiB,EAAE,EAAE;YAC7D,OAAO,OAAO,CAAC,CAAC,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;IACH,CAAC;CACD;AA5BD,gCA4BC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,UAAU,EAAE,CAAA"}

View File

@ -1,2 +1,47 @@
/** class representing the Projector features **/
export {};
import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout';
interface ProjectorState {
pos: number;
dir: boolean;
}
export declare class Projector {
state: ProjectorState;
arduino: Arduino;
private log;
private cfg;
private ui;
private ipc;
filmout: FilmOut;
private id;
/**
*
**/
constructor(arduino: Arduino, cfg: any, ui: any, filmout: any, second?: boolean);
/**
*
**/
private init;
/**
*
**/
private listen;
/**
*
**/
set(dir: boolean, id: string): Promise<any>;
/**
*
**/
move(id: string): Promise<any>;
both(id: string): Promise<any>;
/**
*
**/
private listener;
/**
*
**/
end(cmd: string, id: string, ms: number): Promise<any>;
}
export type { ProjectorState };

View File

@ -1,6 +1,7 @@
"use strict";
/** class representing the Projector features **/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Projector = void 0;
const log_1 = require("log");
class Projector {
/**
@ -56,16 +57,15 @@ class Projector {
ms = await this.arduino.send(this.id, cmd);
}
catch (err) {
this.log.error(`Error setting ${this.id} direction`, err);
this.log.error(`Error setting ${this.id} direction: ${id}`, err);
}
}
console.dir(ms);
return await this.end(cmd, id, ms);
}
/**
*
**/
async move(frame, id) {
async move(id) {
const cmd = this.cfg.arduino.cmd[this.id];
let ms;
if (this.filmout.state.enabled) {
@ -81,20 +81,20 @@ class Projector {
ms = await this.arduino.send(this.id, cmd);
}
catch (err) {
this.log.error(`Error moving ${this.id}`, err);
this.log.error(`Error moving ${this.id}: ${id}`, err);
}
}
//this.log.info('Projector move time', { ms });
return await this.end(cmd, id, ms);
}
async both(frame, id) {
async both(id) {
const cmd = this.cfg.arduino.cmd[this.id + 's'];
let ms;
try {
ms = await this.arduino.send(this.id, cmd);
}
catch (err) {
this.log.error(`Error moving ${this.id}`, err);
this.log.error(`Error moving ${this.id}: ${id}`, err);
}
//this.log.info('Projectors move time', { ms });
return await this.end(cmd, id, ms);
@ -111,12 +111,12 @@ class Projector {
this.log.error(err);
}
}
else if (typeof arg.frame !== 'undefined') {
else if (typeof arg.move !== 'undefined') {
try {
await this.move(arg.frame, arg.id);
await this.move(arg.id);
}
catch (err) {
this.log.error(err);
this.log.error(`Error moving ${this.id}: ${arg.id}`, err);
}
}
else if (typeof arg.val !== 'undefined') {
@ -170,6 +170,7 @@ class Projector {
return await this.ui.send(this.id, { cmd, id, ms });
}
}
exports.Projector = Projector;
module.exports = function (arduino, cfg, ui, filmout, second) {
return new Projector(arduino, cfg, ui, filmout, second);
};

File diff suppressed because one or more lines are too long

View File

@ -1 +1,100 @@
export {};
import { Commands } from 'cmd';
export declare class Sequencer {
private running;
private paused;
private grid;
private gridLoops;
private arr;
private loops;
private cfg;
private cmd;
private CMDS;
private ipc;
private ui;
private log;
private id;
private alerted;
private psbId;
/**
* @constructor
* Create a new sequencer and assign command and UI as private sub-classes
*
* @param {object} cfg Configuration object
* @param {object} cmd Shared command class
* @param {object} ui Electron UI, browser window
**/
constructor(cfg: any, cmd: Commands, ui: any);
/**
* Take configuration object and assign all commands as keys
* in the internal CMDS object.
*
* @param {object} obj Configuration object
**/
private cmds;
/**
* Initialize the class by requiring ipcMain from electron
* and creating logger.
*
**/
private init;
/**
* Bind ipc listener to channel 'sequencer' or current id of
* class.
**/
private listen;
/**
* Listener callback function. Called whenever ipc
* message is sent to channel 'sequencer'.
*
* @param {object} event IPC message event
* @param {object} arg Arguments provided in message
**/
private listener;
/**
* Sets the value of the loops in the grid sequence
* to value sent by UI in ipc message.
*
* @param {integer} count Number of loops to set grid sequence to
**/
setLoops(count: number): void;
/**
* Sets multiple steps at once
*
* @param {array} steps Array of steps to set or update
**/
setSteps(steps: any[]): void;
/**
* Resets multiple steps to default 'undefined' state
*
* @param {array} steps Array containing the x location of steps to unset
**/
unsetSteps(steps: number[]): void;
/**
* Starts a sequence with the existing grid sequence,
* or if one is provided in the arg object, starts
* that sequence.
*
* @param {object} arg Arguments from ipc message
**/
start(arg: any): Promise<void>;
/**
* Pauses sequence from UI.
**/
pause(): void;
/**
* Stops the sequence
**/
stop(): void;
/**
* Execute command @ step x. Wrapper with try catch.
*
* @param {integer} x Step to execute command at
**/
private step;
/**
* Locate step @ position x and execute the command.
*
* @param {integer} x Step to execute command at
**/
private cmdExec;
}

View File

@ -1,11 +1,9 @@
'use strict';
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Sequencer = void 0;
const log_1 = require("log");
const electron_1 = require("electron");
const delay_1 = __importDefault(require("delay"));
const delay_1 = require("delay");
/** @module lib/sequencer **/
let seq;
class Sequencer {
@ -164,7 +162,7 @@ class Sequencer {
}
//UI initiates pause, not planned
while (this.paused) {
await (0, delay_1.default)(42);
await (0, delay_1.delay)(42);
}
if (typeof this.arr[y] === 'undefined') {
continue;
@ -234,9 +232,11 @@ class Sequencer {
const cmdOriginal = this.arr[x].cmd;
const cmd = this.CMDS[cmdOriginal];
this.log.info(`CMD: '${cmdOriginal}' -> ${cmd}`);
//@ts-ignore
return await this.cmd[cmd](this.arr[x]);
}
}
exports.Sequencer = Sequencer;
module.exports = function (cfg, cmd, ui) {
return new Sequencer(cfg, cmd, ui);
};

File diff suppressed because one or more lines are too long

View File

@ -1 +1,58 @@
export {};
import WebSocket from 'ws';
import express, { Request, Response } from 'express';
interface ServerData {
[key: string]: string;
PORT?: string;
SCRIPT?: string;
}
interface ServerTemplate {
name: string;
path: string;
data?: string;
}
interface ServerProxy {
path: string;
}
interface ServerProxyList {
[key: string]: ServerProxy;
}
interface ServerQueue {
[key: string]: Function;
}
export declare class Server {
private id;
isActive: boolean;
private log;
private templates;
private http;
private httpd;
private wss;
private port;
private wsPort;
private proxy;
private queue;
private interval;
private intervalPeriod;
private ui;
constructor(uiInput: any);
private init;
private load;
template(name: string, data: ServerData): string;
startWss(): Promise<void>;
startHttp(): Promise<unknown>;
start(): Promise<void>;
stopHttp(): Promise<unknown>;
stop(): Promise<void>;
index(req: Request, res: Response, next: Function): express.Response<any, Record<string, any>>;
image(req: Request, res: Response, next: Function): Promise<unknown>;
addProxy(key: string, filePath: string): void;
cmdAll(action: string, options?: any): Promise<boolean>;
displayImage(src: string): Promise<boolean>;
useServer(): boolean;
/**
* WSS
**/
cmd(ws: WebSocket, action: string, options?: any): Promise<unknown>;
private notify;
}
export type { ServerData, ServerTemplate, ServerProxy, ServerProxyList, ServerQueue };

View File

@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Server = void 0;
const ws_1 = require("ws");
const express_1 = __importDefault(require("express"));
const promises_1 = require("fs/promises");
@ -198,6 +199,7 @@ class Server {
this.ui.send('gui', { notify: { title, message } });
}
}
exports.Server = Server;
module.exports = function (ui) {
return new Server(ui);
};

File diff suppressed because one or more lines are too long

View File

@ -44,7 +44,7 @@ cam.move = function (callback) {
return false;
}
obj = {
frame : true,
move : true,
id : uuid()
};
ipcRenderer.sendSync(cam.id, obj);

View File

@ -35,7 +35,7 @@ proj.move = function (callback) {
return false;
}
obj = {
frame : true,
move : true,
id : uuid()
};
ipcRenderer.sendSync(proj.id, obj);
@ -149,7 +149,7 @@ proj.second.move = function (callback) {
return false;
}
obj = {
frame : true,
move : true,
id : uuid()
};
ipcRenderer.sendSync(proj.second.id, obj);

View File

@ -1,12 +1,12 @@
'use strict';
import { delay } from 'delay'
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
/* class representing alert functionality */
class Alert {
export class Alert {
private ipc : any
private log : Logger
private id : string = 'alert'
@ -51,7 +51,7 @@ class Alert {
/**
*
**/
public async start (cmd : string) {
public async start (cmd : string) : Promise<number> {
const start = +new Date();
const msg : string = (cmd + '').replace('ALERT', '').replace('Alert', '').replace('alert', '').trim()
this.ui.send(this.id, { msg })

View File

@ -45,14 +45,12 @@ const KNOWN : string[] = [
* Class representing the arduino communication features
**/
class Arduino {
export class Arduino {
private log : Logger;
private path : any = {};
private known : string[] = KNOWN;
private alias : any = {};
private serial : any = {};
private hasState : any = {};
private baud : number = 57600;
private queue : any = {};
private timer : number = 0;
@ -62,7 +60,9 @@ class Arduino {
private keys : string[];
private values : string[];
public alias : any = {};
public stateStr : any = {};
public hasState : any = {};
constructor (errorState : Function) {
this.errorState = errorState;

View File

@ -5,28 +5,35 @@ import { Processing } from 'processing';
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout';
interface CameraState{
pos : number,
dir : boolean,
capper : boolean
}
/** class representing camera functions **/
class Camera {
private state : any = {
export class Camera {
public state : CameraState = {
pos : 0,
dir : true,
capepr: false
capper: false
};
private arduino : Arduino = null;
private intval : any = null;
private processing : any = null;
public arduino : Arduino = null;
private intval : Intval = null;
private processing : Processing = null;
private log : Logger;
private cfg : any;
private filmout : any;
private filmout : FilmOut;
private ui : any;
private ipc : any;
private id : string = 'camera';
/**
*
**/
constructor (arduino : Arduino, cfg : any, ui : any, filmout : any, second : boolean = false) {
constructor (arduino : Arduino, cfg : any, ui : any, filmout : FilmOut, second : boolean = false) {
this.arduino = arduino;
this.cfg = cfg;
this.ui = ui;
@ -114,7 +121,7 @@ class Camera {
/**
*
**/
public async move (frame : number, id : string) {
public async move (id : string) {
const cmd : string = this.cfg.arduino.cmd[this.id];
let ms : number;
if (this.filmout.state.enabled) {
@ -130,7 +137,7 @@ class Camera {
try {
ms = await this.intval.move();
} catch (err) {
this.log.error(err);
this.log.error(`Error moving intval ${this.id}: ${id}`, err);
}
} else {
try {
@ -147,13 +154,13 @@ class Camera {
return this.end(cmd, id, ms);
}
public async both (frame : any, id : string) {
public async both (id : string) {
const cmd : string = this.cfg.arduino.cmd[id];
let ms : number;
try {
ms = await this.arduino.send(this.id, cmd)
} catch (err) {
this.log.error(`Error moving ${this.id}`, err)
this.log.error(`Error moving both ${this.id}: ${id}`, err)
}
//this.log.info('Cameras move time', { ms });
return await this.end(cmd, id, ms)
@ -172,7 +179,7 @@ class Camera {
let confirmExposure : number;
if (this.intval) {
return this.intval.setExposure(this.id, exposure, (ms : number) => {
return this.intval.setExposure(exposure, (ms : number) => {
this.ui.send('timing', { c : 'c', ms : exposure });
return this.end(cmd, id, ms);
});
@ -263,9 +270,9 @@ class Camera {
} catch (err) {
this.log.error(err)
}
} else if (typeof arg.frame !== 'undefined') {
} else if (typeof arg.move !== 'undefined') {
try {
await this.move(arg.frame, arg.id)
await this.move(arg.id)
} catch (err) {
this.log.error(err)
}

View File

@ -5,25 +5,26 @@ import { Processing } from 'processing';
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { FilmOut } from 'filmout';
import type { Arduino } from 'arduino';
/** class representing capper functions **/
class Capper {
export class Capper {
private state : any = {
capper : false
};
private arduino : Arduino = null;
private log : Logger;
private cfg : any;
private filmout : any;
private filmout : FilmOut;
private ui : any;
private ipc : any;
private id : string = 'capper';
/**
*
**/
constructor (arduino : Arduino, cfg : any, ui : any, filmout : any) {
constructor (arduino : Arduino, cfg : any, ui : any, filmout : FilmOut) {
this.arduino = arduino;
this.cfg = cfg;
this.ui = ui;
@ -50,7 +51,7 @@ class Capper {
/**
*
**/
public async capper (state : boolean, id : string) {
public async capper (state : boolean, id : string) : Promise<number> {
let cmd : string;
let ms : number;
@ -77,9 +78,9 @@ class Capper {
private async listener (event : any, arg : any) {
if (typeof arg.state !== 'undefined') {
try {
await this.capper(arg.state, arg.id)
await this.capper(arg.state, arg.id);
} catch (err) {
this.log.error(err)
this.log.error(err);
}
}
event.returnValue = true
@ -88,8 +89,8 @@ class Capper {
/**
*
**/
private async end (cmd : string, id : string, ms : number) {
let message = '';
private async end (cmd : string, id : string, ms : number) : Promise<number> {
let message : string = '';
if (cmd === this.cfg.arduino.cmd.capper_on) {
message = 'Capper set to ON';
@ -97,10 +98,11 @@ class Capper {
message = 'Capper set to OFF';
}
message += ` ${ms}ms`
message += ` ${ms}ms`;
this.log.info(message);
this.ui.send(this.id, {cmd: cmd, id : id, ms: ms});
return ms;
}
}

View File

@ -2,18 +2,23 @@
import { v4 as uuid } from 'uuid';
import { delay } from 'delay';
import type { Projector } from 'proj';
import type { Camera } from 'cam';
import type { Light } from 'light';
import type { Capper } from 'capper';
import type { Alert } from 'alert';
class Commands {
private proj : any;
private cam : any;
private light : any;
export class Commands {
public proj : Projector;
public cam : Camera;
public light : Light;
private cam2 : any;
private proj2 : any;
public cam2 : Camera;
public proj2 : Projector;
private capper : any;
public capper : Capper;
private alertObj : any;
public alertObj : Alert;
private cfg : any;
private ipc : any;
@ -33,7 +38,7 @@ class Commands {
*
**/
constructor (cfg : any, proj : any, cam : any, light : any, alert : any, cam2 : any = null, proj2 : any = null, capper : any = null) {
constructor (cfg : any, proj : Projector, cam : any, light : Light, alert : Alert, cam2 : any = null, proj2 : Projector = null, capper : any = null) {
this.cfg = cfg;
this.proj = proj;
this.cam = cam;
@ -52,15 +57,16 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async projector_forward () {
public async projector_forward () : Promise<number> {
const id : string = uuid();
let ms : number;
try {
if (!this.proj.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj.set(true);
await this.proj.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
ms = await this.proj.move();
ms = await this.proj.move(id);
} catch (err) {
throw err;
}
@ -71,15 +77,16 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async projector_backward () {
public async projector_backward () : Promise<number> {
const id : string = uuid();
let ms : number;
try {
if (this.proj.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj.set(false);
await this.proj.set(false, id);
}
await delay(this.cfg.arduino.serialDelay);
ms = await this.proj.move();
ms = await this.proj.move(id);
} catch (err) {
throw err;
}
@ -92,7 +99,7 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async camera_forward () {
public async camera_forward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let rgb : number[] = [255, 255, 255];
@ -100,12 +107,12 @@ class Commands {
try {
if (!this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam.set(true);
await this.cam.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await delay(this.cfg.arduino.serialDelay);
ms = await this.cam.move();
ms = await this.cam.move(id);
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
} catch (err) {
@ -118,14 +125,14 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async black_forward () {
public async black_forward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let ms : number = 0;
try {
if (!this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam.set(true);
await this.cam.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
if (this.capper) {
@ -134,7 +141,7 @@ class Commands {
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); //make sure set to off
await delay(this.cfg.arduino.serialDelay);
ms += await this.cam.move();
ms += await this.cam.move(id);
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
if (this.capper) {
@ -152,7 +159,7 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async camera_backward () {
public async camera_backward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let rgb : number[] = [255, 255, 255];
@ -160,12 +167,12 @@ class Commands {
try {
if (this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam.set(false);
await this.cam.set(false, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await delay(this.cfg.arduino.serialDelay);
ms = await this.cam.move();
ms = await this.cam.move(id);
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
} catch (err) {
@ -178,14 +185,14 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async black_backward () {
public async black_backward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let ms : number = 0;
try {
if (this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam.set(false);
await this.cam.set(false, id);
}
if (this.capper) {
ms += await this.capper.capper(true, id);
@ -193,7 +200,7 @@ class Commands {
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id); //make sure set to off
await delay(this.cfg.arduino.serialDelay);
ms += await this.cam.move();
ms += await this.cam.move(id);
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
if (this.capper) {
@ -212,7 +219,7 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async camera_second_forward () {
public async camera_second_forward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let rgb : number[] = [255, 255, 255];
@ -220,12 +227,12 @@ class Commands {
try {
if (!this.cam2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam2.set(true);
await this.cam2.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await delay(this.cfg.arduino.serialDelay);
ms = await this.cam2.move();
ms = await this.cam2.move(id);
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
} catch (err) {
@ -241,7 +248,7 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async camera_second_backward () {
public async camera_second_backward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let rgb : number[] = [255, 255, 255];
@ -249,12 +256,12 @@ class Commands {
try {
if (this.cam2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam2.set(false);
await this.cam2.set(false, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await delay(this.cfg.arduino.serialDelay);
ms = await this.cam2.move();
ms = await this.cam2.move(id);
await delay(this.cfg.arduino.serialDelay);
await this.light.set(off, id);
} catch (err) {
@ -271,7 +278,7 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async cameras_forward () {
public async cameras_forward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let rgb : number[] = [255, 255, 255];
@ -280,20 +287,20 @@ class Commands {
try {
if (!this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam.set(true);
await this.cam.set(true, id);
}
if (!this.cam2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam2.set(true);
await this.cam2.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await delay(this.cfg.arduino.serialDelay);
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
ms = await this.cam.both();
ms = await this.cam.both(id);
} else {
both = await Promise.all( [this.cam.move(), this.cam2.move()] );
both = await Promise.all( [this.cam.move(id), this.cam2.move(id)] );
ms = Math.max(...both);
}
@ -311,7 +318,7 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async cameras_backward () {
public async cameras_backward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let rgb : number[] = [255, 255, 255];
@ -320,20 +327,20 @@ class Commands {
try {
if (this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam.set(false);
await this.cam.set(false, id);
}
if (this.cam2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam2.set(false);
await this.cam2.set(false, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await delay(this.cfg.arduino.serialDelay);
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
ms = await this.cam.both();
ms = await this.cam.both(id);
} else {
both = await Promise.all( [this.cam.move(), this.cam2.move()] );
both = await Promise.all( [this.cam.move(id), this.cam2.move(id)] );
ms = Math.max(...both);
}
@ -352,7 +359,7 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async camera_forward_camera_second_backward () {
public async camera_forward_camera_second_backward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let rgb : number[] = [255, 255, 255];
@ -361,20 +368,20 @@ class Commands {
try {
if (!this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam.set(true);
await this.cam.set(true, id);
}
if (this.cam2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam2.set(false);
await this.cam2.set(false, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await delay(this.cfg.arduino.serialDelay);
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
ms = await this.cam.both();
ms = await this.cam.both(id);
} else {
both = await Promise.all( [this.cam.move(), this.cam2.move()] );
both = await Promise.all( [this.cam.move(id), this.cam2.move(id)] );
ms = Math.max(...both);
}
@ -392,7 +399,7 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async camera_backward_camera_second_forward () {
public async camera_backward_camera_second_forward () : Promise<number> {
const id : string = uuid();
const off : number[] = [0, 0, 0];
let rgb : number[] = [255, 255, 255];
@ -401,20 +408,20 @@ class Commands {
try {
if (this.cam.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam.set(false);
await this.cam.set(false, id);
}
if (!this.cam2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.cam2.set(true);
await this.cam2.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
await this.light.set(rgb, id);
await delay(this.cfg.arduino.serialDelay);
if (this.cam && this.cam2 && this.cam.arduino.alias.camera === this.cam.arduino.alias.camera_second) {
ms = await this.cam.both();
ms = await this.cam.both(id);
} else {
both = await Promise.all( [this.cam.move(), this.cam2.move()] );
both = await Promise.all( [this.cam.move(id), this.cam2.move(id)] );
ms = Math.max(...both);
}
@ -431,15 +438,16 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async projector_second_forward () {
public async projector_second_forward () : Promise<number> {
const id : string = uuid();
let ms : number;
try {
if (!this.proj2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj2.set(true);
await this.proj2.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
ms = await this.proj2.move();
ms = await this.proj2.move(id);
} catch (err) {
throw err;
}
@ -450,15 +458,16 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async projector_second_backward () {
public async projector_second_backward () : Promise<number> {
const id : string = uuid();
let ms : number;
try {
if (this.proj2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj2.set(false);
await this.proj2.set(false, id);
}
await delay(this.cfg.arduino.serialDelay);
ms = await this.proj2.move();
ms = await this.proj2.move(id);
} catch (err) {
throw err;
}
@ -470,23 +479,24 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async projectors_forward () {
public async projectors_forward () : Promise<number> {
const id : string = uuid();
let both : number[];
let ms : number;
try {
if (!this.proj.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj.set(true);
await this.proj.set(true, id);
}
if (!this.proj2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj2.set(true);
await this.proj2.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
ms = await this.proj.both();
ms = await this.proj.both(id);
} else {
both = await Promise.all([ this.proj.move(), this.proj2.move() ]);
both = await Promise.all([ this.proj.move(id), this.proj2.move(id) ]);
ms = Math.max(...both);
}
} catch (err) {
@ -499,23 +509,24 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async projectors_backward () {
public async projectors_backward () : Promise<number> {
const id : string = uuid();
let both : number[];
let ms : number;
try {
if (this.proj.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj.set(false);
await this.proj.set(false, id);
}
if (this.proj2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj2.set(false);
await this.proj2.set(false, id);
}
await delay(this.cfg.arduino.serialDelay);
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
ms = await this.proj.both();
ms = await this.proj.both(id);
} else {
both = await Promise.all([ this.proj.move(), this.proj2.move() ]);
both = await Promise.all([ this.proj.move(id), this.proj2.move(id) ]);
ms = Math.max(...both);
}
} catch (err) {
@ -530,23 +541,24 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async projector_forward_projector_second_backward () {
public async projector_forward_projector_second_backward () : Promise<number> {
const id : string = uuid();
let both : number[];
let ms : number;
try {
if (!this.proj.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj.set(true);
await this.proj.set(true, id);
}
if (this.proj2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj2.set(false);
await this.proj2.set(false, id);
}
await delay(this.cfg.arduino.serialDelay);
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
ms = await this.proj.both();
ms = await this.proj.both(id);
} else {
both = await Promise.all([ this.proj.move(), this.proj2.move() ]);
both = await Promise.all([ this.proj.move(id), this.proj2.move(id) ]);
ms = Math.max(...both);
}
} catch (err) {
@ -560,23 +572,24 @@ class Commands {
*
* @returns {integer} Length of action in ms
**/
public async projector_backward_projector_second_forward () {
public async projector_backward_projector_second_forward () : Promise<number> {
const id : string = uuid();
let both : number[];
let ms : number;
try {
if (this.proj.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj.set(false);
await this.proj.set(false, id);
}
if (!this.proj2.state.dir) {
await delay(this.cfg.arduino.serialDelay);
await this.proj2.set(true);
await this.proj2.set(true, id);
}
await delay(this.cfg.arduino.serialDelay);
if (this.proj && this.proj2 && this.proj.arduino.alias.projector === this.proj.arduino.alias.projector_second) {
ms = await this.proj.both();
ms = await this.proj.both(id);
} else {
both = await Promise.all([ this.proj.move(), this.proj2.move() ]);
both = await Promise.all([ this.proj.move(id), this.proj2.move(id) ]);
ms = Math.max(...both);
}
} catch (err) {
@ -591,7 +604,8 @@ class Commands {
* @returns {integer} Length of action in ms
**/
public async alert (cmd : any) {
public async alert (cmd : any) : Promise<number> {
const id : string = uuid();
let ms : number;
try {
ms = await this.alertObj.start(cmd.light); //change this meta
@ -608,7 +622,8 @@ class Commands {
* @returns {integer} Length of action in ms
**/
public async pause (cmd : any) {
public async pause (cmd : any) : Promise<number>{
const id : string = uuid();
let ms : number;
try {
ms = await delay(cmd.light * 1000); //delay is in seconds
@ -618,10 +633,15 @@ class Commands {
return ms;
}
public async camera_exposure (cmd : any) {
/**
* Sets the camera exposure (if supported).
*
**/
public async camera_exposure (cmd : any) : Promise<number>{
const id : string = uuid();
let ms : number;
try {
ms = await this.cam.exposure(cmd.light);
ms = await this.cam.exposure(cmd.light, id);
} catch (err) {
throw err;
}

View File

@ -8,9 +8,9 @@
* @returns {Promise} Promise to resolve after timeout
**/
export function delay (ms : number) {
export function delay (ms : number) : Promise<number> {
return new Promise((resolve : any) => {
return setTimeout(resolve, ms);
return setTimeout(() => { resolve(ms) }, ms);
});
}

View File

@ -3,7 +3,8 @@
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Settings } from '../settings';
import type { Settings } from 'settings';
import type { Arduino } from 'arduino';
/**
* class representing the device discovery features
@ -11,7 +12,7 @@ import type { Settings } from '../settings';
*
**/
class Devices {
export class Devices {
public settings : Settings;
public connected : any = {}

View File

@ -10,15 +10,14 @@ import { format as urlFormat } from 'url';
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
const { BrowserWindow } = require('electron');
import { BrowserWindow } from 'electron';
class WebView {
private digitalWindow : any;
public opened : boolean = false;
public showing : boolean = false;
private platform : string;
public display : any;
public display : any; //needs type
private loadWait : any = {};
private ipc : any;
private log : Logger;
@ -158,7 +157,7 @@ class WebView {
}
}
class Display {
export class Display {
private platform : string;
private displays : any[];
private display : any;

View File

@ -29,7 +29,7 @@ async function exec(...args : string[]) {
if (opts === null) {
opts = { maxBuffer : 1024 * 1024 }
}
return new Promise((resolve, reject) => {
return new Promise((resolve : Function, reject : Function) => {
const child = execRaw(cmd, opts,
(err : Error, stdout : string, stderr: string) => err ? reject(err) : resolve({
stdout,

View File

@ -18,4 +18,4 @@ function exit (msg : string, code : number = 0) {
}
}
module.exports.exit = exit;
module.exports = { exit };

View File

@ -10,16 +10,7 @@ import { Log } from 'log';
import type { Logger } from 'winston';
import Frame from 'frame';
interface FilmoutState {
frame : number;
path : string;
hash : string;
info : any;
frames?: number;
directory?: boolean;
files?: string[];
}
import type { FilmOutState } from 'filmout';
interface StdErr {
frame : number;
@ -58,7 +49,7 @@ async function spawnAsync (bin : string, args : string[]) {
/** @class FFMPEG **/
class FFMPEG {
export class FFMPEG {
private bin : string;
private log : Logger;
private id : string = 'ffmpeg';
@ -140,7 +131,7 @@ class FFMPEG {
*
* @returns {string} Path of frame
**/
public async frame (state : FilmoutState, light : any) {
public async frame (state : FilmOutState, light : any) {
const frameNum : number = state.frame;
const video : string = state.directory ? state.files[frameNum] : state.path;
const w : number = state.info.width;
@ -220,7 +211,7 @@ class FFMPEG {
* @returns {?}
**/
public async frames (state : FilmoutState) {
public async frames (state : FilmOutState) {
const video : string = state.path;
const w : number = state.info.width;
const h : number = state.info.height;
@ -415,4 +406,6 @@ class FFMPEG {
module.exports = (sys : any) => {
return new FFMPEG(sys);
}
}
export type { StdErr };

View File

@ -7,10 +7,8 @@ import { extname } from 'path';
import { exec } from 'exec';
import { Log } from 'log';
import type { Logger } from 'winston';
//const spawn = require('spawn');
//const exit = require('exit');
class FFPROBE {
export class FFPROBE {
private bin : string;
private log : Logger;
constructor (sys : any) {

View File

@ -9,20 +9,43 @@ import Jimp from 'jimp';
import Frame from 'frame';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Server } from 'server';
import type { Display } from 'display';
import type { Light } from 'light';
import type { FFMPEG } from 'ffmpeg';
import type { FFPROBE } from 'ffprobe';
interface FilmOutState {
hash : string,
frame : number,
frames : number,
fps : number,
seconds : number,
still : boolean,
path : string,
fileName : string,
directory : boolean,
info : any,
dir : boolean,
enabled : boolean,
files : string[]
}
/**
* @module FilmOut
**/
class FilmOut {
export class FilmOut {
private id : string = 'filmout';
private videoExtensions : string[] = ['.mpg', '.mpeg', '.mov', '.mkv', '.avi', '.mp4'];
private stillExtensions : string[] = ['.tif', '.tiff', '.png', '.jpg', '.jpeg', '.bmp'];
private sequenceExtensions : string[] = ['.png', '.jpg', '.jpeg'];
private gifExtension : string = '.gif';
public state : any = {
public state : FilmOutState = {
hash : null,
frame : 0,
frames : 0,
fps : 24,
seconds : 0,
still : false,
path : null,
fileName : null,
@ -32,14 +55,15 @@ class FilmOut {
enabled : false,
files : []
};
private display : any;
private ffmpeg : any;
private ffprobe : any;
private light : any;
private ffmpeg : FFMPEG;
private ffprobe : FFPROBE;
private light : Light;
private ipc : any;
private ui : any;
private log : Logger;
private server : any;
public display : Display;
public server : Server;
/**
* @constructor
* Builds FilmOut class with display, ffmpeg, ffprobe, ui and light as internal properties.
@ -50,7 +74,7 @@ class FilmOut {
* @param {object} ui Electron ui object
* @param {object} light Light device object
**/
constructor (display : any, server : any, ffmpeg : any, ffprobe : any, ui : any, light : any) {
constructor (display : Display, server : Server, ffmpeg : FFMPEG, ffprobe : FFPROBE, ui : any, light : Light) {
this.display = display;
this.server = server;
this.ffmpeg = ffmpeg;
@ -92,7 +116,7 @@ class FilmOut {
*
* @param {string} data Data to produce hash of
*/
private hash (data : string) {
private hash (data : string) : string {
return createHash('sha1').update(data).digest('hex');
}
/**
@ -126,7 +150,7 @@ class FilmOut {
/**
* Begin the process of exporting single frames from the video for display.
**/
async start () {
public async start () {
let path;
try {
@ -147,7 +171,7 @@ class FilmOut {
/**
* Ends the filmout process and closes the display.
**/
private async end () {
public async end () {
await delay(20);
this.display.hide();
}
@ -521,3 +545,5 @@ class FilmOut {
module.exports = (display : any, server : any, ffmpeg : any, ffprobe : any, ui : any, light : any) => {
return new FilmOut(display, server, ffmpeg, ffprobe, ui, light);
}
export type { FilmOutState };

View File

@ -74,4 +74,6 @@ export default class Frame {
}
}
module.exports = Frame
module.exports = Frame
export type { RGBA }

23
src/globals.d.ts vendored
View File

@ -1,36 +1,13 @@
declare module 'delay';
declare module 'intval';
declare module 'processing';
declare module 'electron';
declare module 'fs-extra';
declare module 'uuid';
declare module 'exec';
declare module 'spawn';
declare module 'systeminformation';
declare module 'exit';
declare module 'request';
declare module 'animated-gif-detector';
declare module 'frame';
interface Device {
serial : string;
device : string;
}
interface Arduino {
hasState : any;
alias : any;
serial : any;
stateStr : any;
send (id : string, cmd : string) : number;
sendString (id : string, str : string) : any;
enumerate () : any;
connect (device : string, serial : string, state : boolean) : any;
verify () : any;
distinguish () : any;
fakeConnect ( id : string) : any;
stateAsync (device : string, confirm: boolean) : any;
state (serial: string, confirm: boolean) : number;
close () : any;
aliasSerial ( device : string, serial : string) : any;
}

View File

@ -1,18 +1,19 @@
'use strict'
import * as request from 'request'
export class Intval {
private _baseUrl : string
private req : any
constructor (url : string) {
this._baseUrl = `http://${url}`
this.req = require('request')
}
public async move () {
return new Promise ((resolve : any, reject : any) => {
public async move () : Promise<number> {
return new Promise ((resolve : Function, reject : Function) => {
const timeStart : number = +new Date()
const url : string = `${this._baseUrl}/frame`
//console.log(url)
return this.req(url, (err : Error, res : any, body : string) => {
return request(url, (err : Error, res : any, body : string) => {
let ms : number = (+new Date()) - timeStart
if (err) {
return reject(err)
@ -21,12 +22,12 @@ export class Intval {
})
})
}
public async setDir (dir : boolean) {
return new Promise ((resolve : any, reject : any) => {
public async setDir (dir : boolean) : Promise<number> {
return new Promise ((resolve : Function, reject : Function) => {
const timeStart : number = +new Date()
const url : string = `${this._baseUrl}/dir?dir=${dir}`
//console.log(url)
return this.req(url, (err : Error, res : any, body : string) => {
return request(url, (err : Error, res : any, body : string) => {
let ms : number = (+new Date()) - timeStart
if (err) {
return reject(err)
@ -35,11 +36,11 @@ export class Intval {
})
})
}
public async setExposure (exposure : number, cb : Function) {
return new Promise ((resolve : any, reject : any) => {
public async setExposure (exposure : number, cb : Function) : Promise<number> {
return new Promise ((resolve : Function, reject : Function) => {
const timeStart : number = +new Date()
const url : string = `${this._baseUrl}/exposure?exposure=${exposure}`
return this.req(url, (err : Error, res : any, body : string) => {
return request(url, (err : Error, res : any, body : string) => {
let ms : number = (+new Date()) - timeStart
if (err) {
return reject(err)
@ -57,7 +58,7 @@ export class Intval {
timeout: 5000
}
this.req(opts, (err : Error, res : any, body : string) => {
request(opts, (err : Error, res : any, body : string) => {
let ms : number = (+new Date()) - timeStart
if (err) {
return cb(err, ms)
@ -67,4 +68,4 @@ export class Intval {
}
}
module.exports.Intval = Intval
module.exports = { Intval }

View File

@ -3,8 +3,9 @@
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Arduino } from 'arduino';
class Light {
export class Light {
public state : any = { color : [0, 0, 0] }
private arduino : Arduino;

View File

@ -985,7 +985,7 @@ export default class Mscript {
}
module.exports = Mscript;
export type { RGB };
/*

View File

@ -2,14 +2,14 @@
import { exec } from 'exec';
class Processing {
export class Processing {
private _baseUrl : string
constructor (url : string) {
this._baseUrl = (url.indexOf('http') === -1 && url.indexOf('://') === -1) ? `http://${url}` : url
}
public async move () {
return new Promise (async (resolve : any, reject : any) => {
public async move () : Promise<number> {
return new Promise (async (resolve : Function, reject : Function) => {
const timeStart : number = +new Date()
const url : string = `${this._baseUrl}`
const cmd : string = `curl --http0.9 ${url}`
@ -25,11 +25,11 @@ class Processing {
return resolve(ms)
})
}
public async setDir (dir : boolean) {
return new Promise ((resolve : any, reject : any) => {
public async setDir (dir : boolean) : Promise<number> {
return new Promise ((resolve : Function, reject : Function) => {
return resolve(0)
})
}
}
module.exports.Processing = Processing
module.exports = { Processing }

View File

@ -2,18 +2,25 @@
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout';
class Projector {
private state : any = {
interface ProjectorState {
pos : number,
dir : boolean
}
export class Projector {
public state : ProjectorState = {
pos : 0,
dir : true
};
private arduino : Arduino = null;
public arduino : Arduino = null;
private log : Logger;
private cfg : any;
private ui : any;
private ipc : any;
private filmout : any;
public filmout : FilmOut;
private id : string = 'projector';
/**
@ -62,17 +69,16 @@ class Projector {
try {
ms = await this.arduino.send(this.id, cmd)
} catch (err) {
this.log.error(`Error setting ${this.id} direction`, err)
this.log.error(`Error setting ${this.id} direction: ${id}`, err)
}
}
console.dir(ms)
return await this.end(cmd, id, ms)
}
/**
*
**/
public async move (frame : any, id : string) {
public async move (id : string) {
const cmd : string = this.cfg.arduino.cmd[this.id];
let ms : number;
if (this.filmout.state.enabled) {
@ -85,20 +91,20 @@ class Projector {
try {
ms = await this.arduino.send(this.id, cmd)
} catch (err) {
this.log.error(`Error moving ${this.id}`, err)
this.log.error(`Error moving ${this.id}: ${id}`, err)
}
}
//this.log.info('Projector move time', { ms });
return await this.end(cmd, id, ms)
}
public async both (frame : any, id : string) {
public async both (id : string) {
const cmd : string = this.cfg.arduino.cmd[this.id + 's'];
let ms : number;
try {
ms = await this.arduino.send(this.id, cmd)
} catch (err) {
this.log.error(`Error moving ${this.id}`, err)
this.log.error(`Error moving ${this.id}: ${id}`, err)
}
//this.log.info('Projectors move time', { ms });
return await this.end(cmd, id, ms)
@ -114,11 +120,11 @@ class Projector {
} catch (err) {
this.log.error(err)
}
} else if (typeof arg.frame !== 'undefined') {
} else if (typeof arg.move !== 'undefined') {
try {
await this.move(arg.frame, arg.id)
await this.move(arg.id)
} catch (err) {
this.log.error(err)
this.log.error(`Error moving ${this.id}: ${arg.id}`, err)
}
} else if (typeof arg.val !== 'undefined') {
this.state.pos = arg.val;
@ -167,4 +173,6 @@ class Projector {
module.exports = function (arduino : Arduino, cfg : any, ui : any, filmout : any, second : boolean) {
return new Projector(arduino, cfg, ui, filmout, second)
}
}
export type { ProjectorState }

View File

@ -4,14 +4,15 @@ import { v4 as uuid } from 'uuid';
import { Log } from 'log';
import type { Logger } from 'winston';
import { powerSaveBlocker } from 'electron'
import delay from 'delay';
import { delay } from 'delay';
import { Commands } from 'cmd';
/** @module lib/sequencer **/
let seq : Sequencer;
class Sequencer {
export class Sequencer {
private running : boolean = false;
private paused : boolean = false;
@ -22,7 +23,7 @@ class Sequencer {
private loops : number = 1;
private cfg : any;
private cmd : any;
private cmd : Commands;
private CMDS : any = {};
private ipc : any;
private ui : any;
@ -40,7 +41,7 @@ class Sequencer {
* @param {object} ui Electron UI, browser window
**/
constructor (cfg : any, cmd : any, ui : any) {
constructor (cfg : any, cmd : Commands, ui : any) {
this.cfg = cfg;
this.cmd = cmd;
this.ui = ui;
@ -268,6 +269,7 @@ class Sequencer {
const cmdOriginal : string = this.arr[x].cmd;
const cmd : string = this.CMDS[cmdOriginal];
this.log.info(`CMD: '${cmdOriginal}' -> ${cmd}`);
//@ts-ignore
return await this.cmd[cmd](this.arr[x]);
}
}

View File

@ -33,7 +33,7 @@ interface ServerQueue {
[key: string]: Function;
}
class Server {
export class Server {
private id : string = 'server'
public isActive : boolean = false
private log : Logger
@ -63,13 +63,13 @@ class Server {
this.ui = uiInput;
}
async init () {
private async init () {
this.log = await Log({ label : this.id });
await this.load()
await this.start()
}
async load () {
private async load () {
this.http = express()
for (let tmpl of this.templates) {
tmpl.data = await readFile(tmpl.path, 'utf8')
@ -253,4 +253,6 @@ class Server {
module.exports = function (ui : any) {
return new Server(ui)
}
}
export type { ServerData, ServerTemplate, ServerProxy, ServerProxyList, ServerQueue };