Removed several uses of any and added types to System module.

This commit is contained in:
Matt McWilliams 2024-05-23 19:54:42 -04:00
parent cb63194fc6
commit 91ad944c46
62 changed files with 263 additions and 1676 deletions

View File

@ -1,5 +1,5 @@
{
"version": "1.8.109",
"version": "1.8.110",
"ext_port": 1111,
"profiles": {
"mcopy": {

View File

@ -1,10 +1,11 @@
import type { WebContents } from 'electron';
export declare class Alert {
private ipc;
private log;
private id;
private cb;
private ui;
constructor(ui: any);
constructor(ui: WebContents);
/**
*
**/

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,MAAa,KAAK;IAOjB,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;IAED;;QAEI;IACI,KAAK,CAAC,QAAQ,CAAE,KAAW,EAAE,GAAS;QAC7C,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE;YACrB,IAAI;gBACH,MAAM,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,EA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,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,EAAgB;IAC1C,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAA"}

View File

@ -56,7 +56,7 @@ class Arduino {
async init() {
this.log = await (0, log_1.Log)({ label: 'arduino' });
this.keys = Object.keys(cfg.arduino.cmd);
this.values = this.keys.map(key => cfg.arduino.cmd[key]);
this.values = this.keys.map((key) => cfg.arduino.cmd[key]);
}
/**
* Enumerate all connected devices that might be Arduinos
@ -378,7 +378,7 @@ class Arduino {
confirmEnd(data) {
if (this.values.indexOf(data) !== -1 && typeof this.confirmExec === 'function') {
this.confirmExec(null, data);
this.confirmExec = {};
this.confirmExec = null;
this.unlock(this.alias['connect']);
}
else if (data[0] === cfg.arduino.cmd.state) {

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout';
import type { WebContents } from 'electron';
interface CameraState {
pos: number;
dir: boolean;
@ -20,7 +21,7 @@ export declare class Camera {
/**
*
**/
constructor(arduino: Arduino, cfg: any, ui: any, filmout: FilmOut, second?: boolean);
constructor(arduino: Arduino, cfg: any, ui: WebContents, filmout: FilmOut, second?: boolean);
/**
*
**/

View File

@ -333,7 +333,7 @@ class Camera {
}
message += ` ${ms}ms`;
this.log.info(message);
this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
await this.ui.send(this.id, { cmd: cmd, id: id, ms: ms });
return ms;
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
import type { FilmOut } from 'filmout';
import type { Arduino } from 'arduino';
import type { WebContents } from 'electron';
/** class representing capper functions **/
export declare class Capper {
private state;
@ -13,7 +14,7 @@ export declare class Capper {
/**
*
**/
constructor(arduino: Arduino, cfg: any, ui: any, filmout: FilmOut);
constructor(arduino: Arduino, cfg: any, ui: WebContents, filmout: FilmOut);
/**
*
**/

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capper/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAKb,6BAA0B;AAK1B,2CAA2C;AAE3C,MAAa,MAAM;IAWlB;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAQ,EAAE,OAAiB;QAb9D,UAAK,GAAS;YACrB,MAAM,EAAG,KAAK;SACd,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAMzB,OAAE,GAAY,QAAQ,CAAC;QAK9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,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,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,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 +1,10 @@
import type { Settings } from 'settings';
import type { Arduino } from 'arduino';
import type { BrowserWindow } from 'electron';
interface Device {
serial: string;
device: string;
}
/**
* class representing the device discovery features
*
@ -13,12 +18,11 @@ export declare class Devices {
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);
constructor(arduino: Arduino, settings: Settings, mainWindow: BrowserWindow);
/**
* Initialize the log for "devices". Establish an ipc connection to the UI.
* Start listening on that ipc connection.
@ -78,3 +82,4 @@ export declare class Devices {
**/
private ready;
}
export type { Device };

View File

@ -13,13 +13,12 @@ class Devices {
* Constructor assigns arduino, settings, UI browser window and cam objects
* locally to this class for reference.
**/
constructor(arduino, settings, mainWindow, cam) {
constructor(arduino, settings, mainWindow) {
this.connected = {};
this.arduino = arduino;
this.settings = settings;
this.mainWindow = mainWindow;
this.ui = this.mainWindow.webContents;
this.cam = cam;
this.init();
}
/**
@ -581,7 +580,7 @@ class Devices {
}
}
exports.Devices = Devices;
module.exports = function (arduino, settings, mainWindow, cam) {
return new Devices(arduino, settings, mainWindow, cam);
module.exports = function (arduino, settings, mainWindow) {
return new Devices(arduino, settings, mainWindow);
};
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,11 @@
import type { System } from 'system';
export declare class Display {
private platform;
private displays;
private display;
private tmpdir;
private wv;
constructor(sys: any);
constructor(sys: System);
open(): Promise<void>;
show(src: string): Promise<void>;
showPath(pathStr: string): Promise<unknown>;
@ -13,5 +14,5 @@ export declare class Display {
focus(): Promise<boolean>;
field(ratio: number): Promise<boolean>;
meter(): Promise<boolean>;
change(id: any): void;
change(id: string): void;
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1,17 @@
export declare const execRaw: any;
interface ExecOutput {
stdout: string;
stderr: string;
}
/**
* Promisified child_process.exec
*
* @param cmd
* @param arg
* @param opts See child_process.exec node docs
* @param {stream.Writable} opts.stdout If defined, child process stdout will be piped to it.
* @param {stream.Writable} opts.stderr If defined, child process stderr will be piped to it.
*
* @returns {Promise<{ stdout: string, stderr: stderr }>}
*/
export declare function exec(...args: string[]): Promise<ExecOutput>;
export type { ExecOutput };

View File

@ -1,7 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.execRaw = void 0;
exports.execRaw = require('child_process').exec;
exports.exec = void 0;
const child_process_1 = require("child_process");
/**
* Promisified child_process.exec
*
@ -30,7 +30,7 @@ async function exec(...args) {
opts = { maxBuffer: 1024 * 1024 };
}
return new Promise((resolve, reject) => {
const child = (0, exports.execRaw)(cmd, opts, (err, stdout, stderr) => err ? reject(err) : resolve({
const child = (0, child_process_1.exec)(cmd, opts, (err, stdout, stderr) => err ? reject(err) : resolve({
stdout,
stderr
}));
@ -42,5 +42,6 @@ async function exec(...args) {
}
});
}
module.exports.exec = exec;
exports.exec = exec;
module.exports = { exec };
//# sourceMappingURL=index.js.map

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,QAAQ,EAAE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AC,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,QAAQ,EAAE;QACjD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;KACd;SAAM,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;QACvC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;KACd;IACD,IAAI,IAAI,KAAK,IAAI,EAAE;QAClB,IAAI,GAAG,EAAE,SAAS,EAAG,IAAI,GAAG,IAAI,EAAE,CAAA;KAClC;IACE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAkB,EAAE,MAAiB,EAAE,EAAE;QAC5D,MAAM,KAAK,GAAG,IAAA,oBAAO,EAAC,GAAG,EAAE,IAAI,EACjC,CAAC,GAAW,EAAE,MAAe,EAAE,MAAc,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7E,MAAM;YACN,MAAM;SACN,CAAC,CAAC,CAAC;QACC,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAClC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAClC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AA7BD,oBA6BC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,CAAA"}

View File

@ -1,4 +1,5 @@
import type { FilmOutState } from 'filmout';
import type { System } from 'system';
interface StdErr {
frame: number;
fps: number;
@ -23,7 +24,7 @@ export declare class FFMPEG {
*
* @param {object} sys System object to be used to get temp directory
**/
constructor(sys: any);
constructor(sys: System);
/**
* Async method to call async functions from constructor
**/

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,8 @@
import type { System } from 'system';
export declare class FFPROBE {
private bin;
private log;
constructor(sys: any);
constructor(sys: System);
private init;
/**
* Parse the fps entry into a float representing the fps of a video

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;AAG1B,MAAa,OAAO;IAGnB,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;QAChC,MAAM,GAAG,GAAY,GAAG,IAA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File

@ -3,6 +3,7 @@ import type { Display } from 'display';
import type { Light } from 'light';
import type { FFMPEG } from 'ffmpeg';
import type { FFPROBE } from 'ffprobe';
import type { WebContents } from 'electron';
interface FilmOutState {
hash: string;
frame: number;
@ -46,7 +47,7 @@ export declare class FilmOut {
* @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);
constructor(display: Display, server: Server, ffmpeg: FFMPEG, ffprobe: FFPROBE, ui: WebContents, light: Light);
/**
* Async function for requiring log, ipcMain and bind events.
**/

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
import type { Arduino } from 'arduino';
import type { WebContents } from 'electron';
export declare class Light {
state: any;
private arduino;
@ -11,7 +12,7 @@ export declare class Light {
/**
*
**/
constructor(arduino: Arduino, cfg: any, ui: any);
constructor(arduino: Arduino, cfg: any, ui: WebContents);
/**
*
**/
@ -27,7 +28,7 @@ export declare class Light {
/**
*
**/
set(rgb: number[], id: string, on?: boolean): Promise<any>;
set(rgb: number[], id: string, on?: boolean): Promise<void>;
/**
*
**/

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/light/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,iCAA8B;AAC9B,6BAA0B;AAI1B,MAAa,KAAK;IAYjB;;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;I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,CAAC,CAAC,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;IAClG,CAAC;IAEM,KAAK,CAAC,IAAI;QAChB,OAAO,IAAI,OAAO,CAAE,KAAK,EAAE,OAAkB,EAAE,MAAiB,EAAE,EAAE;YACnE,MAAM,SAAS,GAAY,CAAC,IAAI,IAAI,EAAE,CAAA;YACtC,MAAM,GAAG,GAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;YACvC,MAAM,GAAG,GAAY,kBAAkB,GAAG,EAAE,CAAA;YAC5C,IAAI,GAAgB,CAAA;YACpB,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,6 +1,7 @@
/** class representing the Projector features **/
import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout';
import type { WebContents } from 'electron';
interface ProjectorState {
pos: number;
dir: boolean;
@ -17,7 +18,7 @@ export declare class Projector {
/**
*
**/
constructor(arduino: Arduino, cfg: any, ui: any, filmout: any, second?: boolean);
constructor(arduino: Arduino, cfg: any, ui: WebContents, filmout: any, second?: boolean);
/**
*
**/
@ -29,12 +30,12 @@ export declare class Projector {
/**
*
**/
set(dir: boolean, id: string): Promise<any>;
set(dir: boolean, id: string): Promise<number>;
/**
*
**/
move(id: string): Promise<any>;
both(id: string): Promise<any>;
move(id: string): Promise<number>;
both(id: string): Promise<number>;
/**
*
**/
@ -42,6 +43,6 @@ export declare class Projector {
/**
*
**/
end(cmd: string, id: string, ms: number): Promise<any>;
end(cmd: string, id: string, ms: number): Promise<number>;
}
export type { ProjectorState };

View File

@ -167,7 +167,8 @@ class Projector {
}
message += ` ${ms}ms`;
this.log.info(message, 'PROJECTOR');
return await this.ui.send(this.id, { cmd, id, ms });
await this.ui.send(this.id, { cmd, id, ms });
return ms;
}
}
exports.Projector = Projector;

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
import { Commands } from 'cmd';
import type { WebContents } from 'electron';
export declare class Sequencer {
private running;
private paused;
@ -23,7 +24,7 @@ export declare class Sequencer {
* @param {object} cmd Shared command class
* @param {object} ui Electron UI, browser window
**/
constructor(cfg: any, cmd: Commands, ui: any);
constructor(cfg: any, cmd: Commands, ui: WebContents);
/**
* Take configuration object and assign all commands as keys
* in the internal CMDS object.

View File

@ -42,8 +42,6 @@ class Sequencer {
for (let key of keys) {
this.CMDS[obj[key]] = key;
}
//
//
}
/**
* Initialize the class by requiring ipcMain from electron

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
import WebSocket from 'ws';
import express, { Request, Response } from 'express';
import type { WebContents } from 'electron';
interface ServerData {
[key: string]: string;
PORT?: string;
@ -34,7 +35,7 @@ export declare class Server {
private interval;
private intervalPeriod;
private ui;
constructor(uiInput: any);
constructor(ui: WebContents);
private init;
private load;
template(name: string, data: ServerData): string;

View File

@ -11,7 +11,7 @@ const path_1 = require("path");
const uuid_1 = require("uuid");
const log_1 = require("log");
class Server {
constructor(uiInput) {
constructor(ui) {
this.id = 'server';
this.isActive = false;
this.templates = [
@ -30,7 +30,7 @@ class Server {
this.queue = {};
this.intervalPeriod = 10000; //10 sec
this.init();
this.ui = uiInput;
this.ui = ui;
}
async init() {
this.log = await (0, log_1.Log)({ label: this.id });

File diff suppressed because one or more lines are too long

View File

@ -1 +1,22 @@
export {};
interface Dependencies {
ffmpeg?: string;
ffprobe?: string;
eog?: string;
}
interface Display {
name: string;
id: number;
width: number;
height: number;
x: number;
y: number;
scale: number;
primary: boolean;
}
interface System {
deps: Dependencies;
displays: Display[];
tmp: string;
platform: string;
}
export type { System, Display, Dependencies };

View File

@ -2,7 +2,6 @@
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = require("os");
const electron_1 = require("electron");
//private
const exec_1 = require("exec");
/**
* Evaluates system dependencies for digital
@ -58,6 +57,7 @@ async function dependencies(platform) {
}
function displayMap(obj) {
const sm = {
name: null,
id: obj.id,
width: obj.size.width,
height: obj.size.height,
@ -80,8 +80,8 @@ function displaySort(a, b) {
return 0;
}
async function displays() {
let displays = electron_1.screen.getAllDisplays();
displays = displays.map(displayMap);
const electronDisplays = electron_1.screen.getAllDisplays();
const displays = electronDisplays.map(displayMap);
displays.sort(displaySort);
return displays;
}
@ -93,7 +93,12 @@ async function displays() {
* @returns {object} Object containing system information
*/
async function system(ui) {
const obj = {};
const obj = {
deps: null,
displays: null,
platform: null,
tmp: null
};
let platform;
try {
obj.tmp = (0, os_1.tmpdir)();

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAOb,2BAAkC;AAClC,uCAAkC;AAClC,SAAS;AACT,+BAA4B;AAC5B;;;;;;;;IAQI;AAGJ,KAAK,UAAU,YAAY,CAAE,QAAiB;IAC7C,IAAI,GAAG,GAAS,EAAE,CAAC;IACnB,IAAI,MAAM,GAAS,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5C,IAAI,OAAO,GAAS,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9C,IAAI,QAAqB,CAAC;IAC1B,4BAA4B;IAC5B,IAAI,S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gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC9D,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3B,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,MAAM,CAAE,EAAQ;IAC9B,MAAM,GAAG,GAAY;QACpB,IAAI,EAAG,IAAI;QACX,QAAQ,EAAG,IAAI;QACf,QAAQ,EAAG,IAAI;QACf,GAAG,EAAG,IAAI;KACV,CAAC;IACF,IAAI,QAAiB,CAAC;IAEtB,IAAI;QACH,GAAG,CAAC,GAAG,GAAG,IAAA,WAAM,GAAE,CAAC;KACnB;IAAC,OAAO,GAAG,EAAE;QACb,GAAG,CAAC,GAAG,GAAG,MAAM,CAAA;KAChB;IAED,QAAQ,GAAG,IAAA,SAAI,GAAE,CAAC;IAElB,IAAI,QAAQ,KAAK,QAAQ,EAAE;QAC1B,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC;KACrB;SAAM,IAAI,QAAQ,KAAK,YAAY,EAAE;QACrC,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC;KACrB;SAAM;QACN,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC;KACrB;IAED,GAAG,CAAC,QAAQ,GAAG,MAAM,QAAQ,EAAE,CAAA;IAC/B,GAAG,CAAC,IAAI,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE5C,UAAU,CAAC,GAAG,EAAE;QACf,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACxB,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}

2
app/package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "mcopy-app",
"version": "1.8.109",
"version": "1.8.110",
"lockfileVersion": 2,
"requires": true,
"packages": {

View File

@ -1,6 +1,6 @@
{
"name": "mcopy-app",
"version": "1.8.109",
"version": "1.8.110",
"description": "GUI for the mcopy small gauge film optical printer platform",
"main": "main.js",
"scripts": {

View File

@ -1,5 +1,5 @@
{
"version": "1.8.109",
"version": "1.8.110",
"ext_port": 1111,
"profiles": {
"mcopy": {

1522
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "mcopy",
"version": "1.8.109",
"version": "1.8.110",
"description": "Small gauge film optical printer platform",
"main": "build.js",
"directories": {
@ -25,7 +25,6 @@
},
"homepage": "https://github.com/sixteenmillimeter/mcopy#readme",
"devDependencies": {
"@types/electron": "^1.6.10",
"@types/express": "^4.17.17",
"@types/fs-extra": "^9.0.7",
"@types/jimp": "^0.2.28",

View File

@ -1,5 +1,5 @@
{
"version": "1.8.109",
"version": "1.8.110",
"ext_port": 1111,
"profiles": {
"mcopy": {

View File

@ -3,6 +3,7 @@
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { WebContents } from 'electron';
/* class representing alert functionality */
@ -11,9 +12,9 @@ export class Alert {
private log : Logger
private id : string = 'alert'
private cb : Function = null
private ui : any
private ui : WebContents
constructor ( ui : any) {
constructor ( ui : WebContents) {
this.ui = ui
this.init()
}
@ -64,6 +65,6 @@ export class Alert {
}
}
module.exports = function (ui : any) {
module.exports = function (ui : WebContents) {
return new Alert(ui);
}

View File

@ -17,18 +17,19 @@
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Device } from 'devices';
const { SerialPort } = require('serialport')
const { ReadlineParser } = require('@serialport/parser-readline')
const exec = require('child_process').exec
const { SerialPort } = require('serialport');
const { ReadlineParser } = require('@serialport/parser-readline');
const exec = require('child_process').exec;
const parser : any = new ReadlineParser({ delimiter: '\r\n' })
const newlineRe : RegExp = new RegExp('\n', 'g')
const returnRe : RegExp = new RegExp('\r', 'g')
const parser : any = new ReadlineParser({ delimiter: '\r\n' });
const newlineRe : RegExp = new RegExp('\n', 'g');
const returnRe : RegExp = new RegExp('\r', 'g');
let eventEmitter : any
let cfg : any
let arduino : any
let eventEmitter : any;
let cfg : any;
let arduino : Arduino;
const KNOWN : string[] = [
'/dev/tty.usbmodem1a161',
@ -55,7 +56,7 @@ export class Arduino {
private queue : any = {};
private timer : number = 0;
private locks : any = {};
private confirmExec : any;
private confirmExec : Function;
private errorState : Function;
private keys : string[];
private values : string[];
@ -72,7 +73,7 @@ export class Arduino {
async init () {
this.log = await Log({ label : 'arduino' });
this.keys = Object.keys(cfg.arduino.cmd);
this.values = this.keys.map(key => cfg.arduino.cmd[key]);
this.values = this.keys.map((key : string) => cfg.arduino.cmd[key]);
}
/**
@ -394,7 +395,7 @@ export class Arduino {
private confirmEnd (data : string) {
if (this.values.indexOf(data) !== -1 && typeof this.confirmExec === 'function') {
this.confirmExec(null, data)
this.confirmExec = {}
this.confirmExec = null
this.unlock(this.alias['connect'])
} else if (data[0] === cfg.arduino.cmd.state) {
this.queue[cfg.arduino.cmd.state](data)
@ -414,7 +415,7 @@ export class Arduino {
return new Promise(async (resolve, reject) => {
const device : string = 'connect'
let writeSuccess : any
this.confirmExec = function (err : any, data : string) {
this.confirmExec = function (err : Error, data : string) {
if (data === cfg.arduino.cmd.connect) {
return resolve(true)
} else {
@ -445,7 +446,7 @@ export class Arduino {
const device : string = 'connect'
let writeSuccess : any
let type : string
this.confirmExec = function (err : any, data : string) {
this.confirmExec = function (err : Error, data : string) {
if (data === cfg.arduino.cmd.projector_identifier) {
type = 'projector'
} else if (data === cfg.arduino.cmd.camera_identifier) {

View File

@ -7,6 +7,7 @@ import { Log } from 'log';
import type { Logger } from 'winston';
import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout';
import type { WebContents } from 'electron';
interface CameraState{
pos : number,
@ -27,13 +28,13 @@ export class Camera {
private log : Logger;
private cfg : any;
private filmout : FilmOut;
private ui : any;
private ui : WebContents;
private ipc : any;
private id : string = 'camera';
/**
*
**/
constructor (arduino : Arduino, cfg : any, ui : any, filmout : FilmOut, second : boolean = false) {
constructor (arduino : Arduino, cfg : any, ui : WebContents, filmout : FilmOut, second : boolean = false) {
this.arduino = arduino;
this.cfg = cfg;
this.ui = ui;
@ -330,11 +331,11 @@ export class Camera {
}
message += ` ${ms}ms`
this.log.info(message);
this.ui.send(this.id, {cmd: cmd, id : id, ms: ms});
await this.ui.send(this.id, {cmd: cmd, id : id, ms: ms});
return ms;
}
}
module.exports = function (arduino : Arduino, cfg : any, ui : any, filmout : any, second : boolean) {
module.exports = function (arduino : Arduino, cfg : any, ui : WebContents, filmout : FilmOut, second : boolean) {
return new Camera(arduino, cfg, ui, filmout, second);
}

View File

@ -7,6 +7,7 @@ import { Log } from 'log';
import type { Logger } from 'winston';
import type { FilmOut } from 'filmout';
import type { Arduino } from 'arduino';
import type { WebContents } from 'electron';
/** class representing capper functions **/
@ -18,13 +19,13 @@ export class Capper {
private log : Logger;
private cfg : any;
private filmout : FilmOut;
private ui : any;
private ui : WebContents;
private ipc : any;
private id : string = 'capper';
/**
*
**/
constructor (arduino : Arduino, cfg : any, ui : any, filmout : FilmOut) {
constructor (arduino : Arduino, cfg : any, ui : WebContents, filmout : FilmOut) {
this.arduino = arduino;
this.cfg = cfg;
this.ui = ui;
@ -106,6 +107,6 @@ export class Capper {
}
}
module.exports = function (arduino : Arduino, cfg : any, ui : any, filmout: any) {
module.exports = function (arduino : Arduino, cfg : any, ui : WebContents, filmout: FilmOut) {
return new Capper(arduino, cfg, ui, filmout);
}

View File

@ -5,6 +5,12 @@ import { Log } from 'log';
import type { Logger } from 'winston';
import type { Settings } from 'settings';
import type { Arduino } from 'arduino';
import type { BrowserWindow, WebContents } from 'electron';
interface Device {
serial : string;
device : string;
}
/**
* class representing the device discovery features
@ -19,21 +25,18 @@ export class Devices {
private arduino : Arduino;
private log : Logger;
private ui : any;
private ui : WebContents;
private ipc : any;
private mainWindow : any;
private cam : any;
private mainWindow : any
/**
* 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) {
constructor (arduino : Arduino, settings : Settings, mainWindow : BrowserWindow) {
this.arduino = arduino;
this.settings = settings;
this.mainWindow = mainWindow;
this.ui = this.mainWindow.webContents
this.cam = cam;
this.init();
}
/**
@ -588,6 +591,8 @@ export class Devices {
}
module.exports = function (arduino : Arduino, settings : any, mainWindow : any, cam : any) {
return new Devices(arduino, settings, mainWindow, cam)
}
module.exports = function (arduino : Arduino, settings : any, mainWindow : BrowserWindow) {
return new Devices(arduino, settings, mainWindow)
}
export type { Device }

View File

@ -11,6 +11,7 @@ import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import { BrowserWindow } from 'electron';
import type { System, Display as SystemDisplay } from 'system';
class WebView {
private digitalWindow : any;
@ -159,12 +160,12 @@ class WebView {
export class Display {
private platform : string;
private displays : any[];
private displays : SystemDisplay[];
private display : any;
private tmpdir : string;
private wv : WebView;
constructor (sys : any) {
constructor (sys : System) {
this.platform = sys.platform;
this.displays = sys.displays;
this.tmpdir = pathJoin(sys.tmp, 'mcopy_digital');
@ -202,7 +203,7 @@ export class Display {
public async meter () {
return await this.wv.meter();
}
public change (id : any) {
public change (id : string) {
this.display = this.displays.find((display : any) => {
if (display.id == id) return true;
});

View File

@ -1,6 +1,11 @@
'use strict'
export const execRaw = require('child_process').exec
import { exec as execRaw } from 'child_process'
interface ExecOutput {
stdout : string,
stderr : string
}
/**
* Promisified child_process.exec
@ -13,7 +18,7 @@ export const execRaw = require('child_process').exec
*
* @returns {Promise<{ stdout: string, stderr: stderr }>}
*/
async function exec(...args : string[]) {
export async function exec(...args : string[]) : Promise<ExecOutput> {
let cmd : string = args[0]
let argz : string = null
let opts : any = null
@ -44,4 +49,5 @@ async function exec(...args : string[]) {
});
}
module.exports.exec = exec
module.exports = { exec }
export type { ExecOutput }

View File

@ -11,6 +11,8 @@ import type { Logger } from 'winston';
import Frame from 'frame';
import type { FilmOutState } from 'filmout';
import type { System } from 'system';
interface StdErr {
frame : number;
@ -63,7 +65,7 @@ export class FFMPEG {
*
* @param {object} sys System object to be used to get temp directory
**/
constructor (sys : any) {
constructor (sys : System) {
this.bin = sys.deps.ffmpeg;
this.TMPDIR = join(sys.tmp, 'mcopy_digital');
this.init();
@ -404,7 +406,7 @@ export class FFMPEG {
}
module.exports = (sys : any) => {
module.exports = (sys : System) => {
return new FFMPEG(sys);
}

View File

@ -7,11 +7,13 @@ import { extname } from 'path';
import { exec } from 'exec';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { System } from 'system';
export class FFPROBE {
private bin : string;
private log : Logger;
constructor (sys : any) {
constructor (sys : System) {
this.bin = sys.deps.ffprobe;
this.init();
}
@ -154,6 +156,6 @@ function map (obj : any) {
}
*/
module.exports = (sys : any) => {
module.exports = (sys : System) => {
return new FFPROBE(sys);
}

View File

@ -14,6 +14,7 @@ import type { Display } from 'display';
import type { Light } from 'light';
import type { FFMPEG } from 'ffmpeg';
import type { FFPROBE } from 'ffprobe';
import type { WebContents } from 'electron';
interface FilmOutState {
hash : string,
@ -59,7 +60,7 @@ export class FilmOut {
private ffprobe : FFPROBE;
private light : Light;
private ipc : any;
private ui : any;
private ui : WebContents;
private log : Logger;
public display : Display;
@ -74,7 +75,7 @@ export class FilmOut {
* @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) {
constructor (display : Display, server : Server, ffmpeg : FFMPEG, ffprobe : FFPROBE, ui : WebContents, light : Light) {
this.display = display;
this.server = server;
this.ffmpeg = ffmpeg;
@ -542,7 +543,7 @@ export class FilmOut {
}
}
module.exports = (display : any, server : any, ffmpeg : any, ffprobe : any, ui : any, light : any) => {
module.exports = (display : Display, server : Server, ffmpeg : FFMPEG, ffprobe : FFPROBE, ui : WebContents, light : Light) => {
return new FilmOut(display, server, ffmpeg, ffprobe, ui, light);
}

2
src/globals.d.ts vendored
View File

@ -1,7 +1,5 @@
declare module 'electron';
declare module 'fs-extra';
declare module 'uuid';
declare module 'exec';
declare module 'spawn';
declare module 'systeminformation';
declare module 'request';

View File

@ -4,13 +4,14 @@ import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Arduino } from 'arduino';
import type { WebContents } from 'electron';
export class Light {
public state : any = { color : [0, 0, 0] }
private arduino : Arduino;
private cfg : any;
private ui : any;
private ui : WebContents;
private log : Logger;
private ipc : any;
private enabled : boolean = true;
@ -20,7 +21,7 @@ export class Light {
/**
*
**/
constructor (arduino : Arduino, cfg : any, ui : any) {
constructor (arduino : Arduino, cfg : any, ui : WebContents) {
this.arduino = arduino;
this.cfg = cfg;
this.ui = ui;
@ -104,6 +105,6 @@ export class Light {
}
}
module.exports = function (arduino : Arduino, cfg : any, ui : any) {
module.exports = function (arduino : Arduino, cfg : any, ui : WebContents) {
return new Light(arduino, cfg, ui);
}

View File

@ -1,6 +1,7 @@
'use strict'
import { exec } from 'exec';
import type { ExecOutput } from 'exec';
export class Processing {
private _baseUrl : string
@ -13,7 +14,7 @@ export class Processing {
const timeStart : number = +new Date()
const url : string = `${this._baseUrl}`
const cmd : string = `curl --http0.9 ${url}`
let res : string
let res : ExecOutput
let ms : number
//console.log(url)
try {

View File

@ -4,6 +4,7 @@ import { Log } from 'log';
import type { Logger } from 'winston';
import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout';
import type { WebContents } from 'electron';
interface ProjectorState {
pos : number,
@ -18,7 +19,7 @@ export class Projector {
public arduino : Arduino = null;
private log : Logger;
private cfg : any;
private ui : any;
private ui : WebContents;
private ipc : any;
public filmout : FilmOut;
private id : string = 'projector';
@ -26,7 +27,7 @@ export class Projector {
/**
*
**/
constructor (arduino : Arduino, cfg : any, ui : any, filmout : any, second : boolean = false) {
constructor (arduino : Arduino, cfg : any, ui : WebContents, filmout : any, second : boolean = false) {
this.arduino = arduino;
this.cfg = cfg;
this.ui = ui;
@ -54,7 +55,7 @@ export class Projector {
/**
*
**/
public async set (dir : boolean, id : string) {
public async set (dir : boolean, id : string) : Promise<number> {
let cmd : string;
let ms : number;
if (dir) {
@ -78,7 +79,7 @@ export class Projector {
/**
*
**/
public async move (id : string) {
public async move (id : string) : Promise<number> {
const cmd : string = this.cfg.arduino.cmd[this.id];
let ms : number;
if (this.filmout.state.enabled) {
@ -98,7 +99,7 @@ export class Projector {
return await this.end(cmd, id, ms)
}
public async both (id : string) {
public async both (id : string) : Promise<number> {
const cmd : string = this.cfg.arduino.cmd[this.id + 's'];
let ms : number;
try {
@ -113,7 +114,7 @@ export class Projector {
/**
*
**/
private async listener (event : any, arg : any){
private async listener (event : any, arg : any) {
if (typeof arg.dir !== 'undefined') {
try {
await this.set(arg.dir, arg.id)
@ -136,7 +137,7 @@ export class Projector {
/**
*
**/
async end (cmd : string, id : string, ms : number) {
async end (cmd : string, id : string, ms : number) : Promise<number> {
let message : string = ''
if (cmd === this.cfg.arduino.cmd.projector_forward) {
message = 'Projector set to FORWARD'
@ -167,11 +168,12 @@ export class Projector {
}
message += ` ${ms}ms`
this.log.info(message, 'PROJECTOR')
return await this.ui.send(this.id, { cmd, id, ms })
await this.ui.send(this.id, { cmd, id, ms })
return ms
}
}
module.exports = function (arduino : Arduino, cfg : any, ui : any, filmout : any, second : boolean) {
module.exports = function (arduino : Arduino, cfg : any, ui : WebContents, filmout : FilmOut, second : boolean) {
return new Projector(arduino, cfg, ui, filmout, second)
}

View File

@ -6,7 +6,7 @@ import type { Logger } from 'winston';
import { powerSaveBlocker } from 'electron'
import { delay } from 'delay';
import { Commands } from 'cmd';
import type { WebContents } from 'electron';
/** @module lib/sequencer **/
@ -26,7 +26,7 @@ export class Sequencer {
private cmd : Commands;
private CMDS : any = {};
private ipc : any;
private ui : any;
private ui : WebContents;
private log : Logger;
private id : string = 'sequence';
private alerted : boolean = false;
@ -41,7 +41,7 @@ export class Sequencer {
* @param {object} ui Electron UI, browser window
**/
constructor (cfg : any, cmd : Commands, ui : any) {
constructor (cfg : any, cmd : Commands, ui : WebContents) {
this.cfg = cfg;
this.cmd = cmd;
this.ui = ui;
@ -60,8 +60,6 @@ export class Sequencer {
for (let key of keys) {
this.CMDS[obj[key]] = key;
}
//
//
}
/**
@ -274,6 +272,6 @@ export class Sequencer {
}
}
module.exports = function (cfg : any, cmd : any, ui : any) {
module.exports = function (cfg : any, cmd : Commands, ui : WebContents) {
return new Sequencer(cfg, cmd, ui);
}

View File

@ -8,6 +8,7 @@ import { v4 as uuidv4 } from 'uuid'
import { Log } from 'log';
import type { Logger } from 'winston';
import { delay } from 'delay'
import type { WebContents } from 'electron';
interface ServerData {
[key: string]: string;
@ -56,11 +57,11 @@ export class Server {
private queue : ServerQueue = {}
private interval : ReturnType<typeof setInterval>
private intervalPeriod : number = 10000 //10 sec
private ui : any;
private ui : WebContents
constructor (uiInput : any) {
constructor (ui : WebContents) {
this.init()
this.ui = uiInput;
this.ui = ui
}
private async init () {
@ -229,7 +230,7 @@ export class Server {
public async cmd (ws : WebSocket, action : string, options : any = {}) {
const id : string = uuidv4()
let obj = {
let obj : any = {
id, action
}
let str : string
@ -251,7 +252,7 @@ export class Server {
}
}
module.exports = function (ui : any) {
module.exports = function (ui : WebContents) {
return new Server(ui)
}

View File

@ -1,14 +1,35 @@
'use strict';
interface ExecOutput {
stdout : string;
stderr : string;
}
import { tmpdir, type } from 'os';
import { screen } from 'electron';
//private
import type { Display as ElectronDisplay, WebContents } from 'electron';
import { exec } from 'exec';
import type { ExecOutput } from 'exec';
interface Dependencies {
ffmpeg? : string,
ffprobe? : string,
eog? : string
}
interface Display {
name : string,
id : number,
width : number,
height : number,
x : number,
y : number,
scale : number,
primary : boolean
}
interface System {
deps : Dependencies,
displays : Display[],
tmp : string,
platform : string
}
/**
* Evaluates system dependencies for digital
* projector features by executing `which` on binary.
@ -18,11 +39,9 @@ import { exec } from 'exec';
*
* @returns {object} Object containing path to dependency from `which`, if they exist
**/
async function dependencies (platform : string ) {
let obj : any = {};
let ffmpeg : any = require('ffmpeg-static');
async function dependencies (platform : string ) : Promise<Dependencies> {
let obj : Dependencies = {};
let ffmpeg : string = require('ffmpeg-static');
let ffprobe : any = require('ffprobe-static');
let ffoutput : ExecOutput;
//let imoutput : ExecOutput;
@ -66,8 +85,9 @@ async function dependencies (platform : string ) {
return obj;
}
function displayMap (obj : any) {
const sm : any = {
function displayMap (obj : ElectronDisplay) : Display{
const sm : Display = {
name : null,
id : obj.id,
width : obj.size.width,
height : obj.size.height,
@ -81,7 +101,7 @@ function displayMap (obj : any) {
return sm;
}
function displaySort (a : any, b : any){
function displaySort (a : any, b : any) : number{
if (a.primary) {
return -1
} else if (b.primary) {
@ -90,9 +110,9 @@ function displaySort (a : any, b : any){
return 0
}
async function displays () {
let displays : any[] = screen.getAllDisplays();
displays = displays.map(displayMap);
async function displays () : Promise<Display[]> {
const electronDisplays : ElectronDisplay[] = screen.getAllDisplays();
const displays : Display[] = electronDisplays.map(displayMap);
displays.sort(displaySort);
return displays;
}
@ -104,8 +124,13 @@ async function displays () {
*
* @returns {object} Object containing system information
*/
async function system (ui : any) {
const obj : any = {};
async function system (ui : any) : Promise<System> {
const obj : System = {
deps : null,
displays : null,
platform : null,
tmp : null
};
let platform : string;
try {
@ -134,4 +159,6 @@ async function system (ui : any) {
return obj;
}
module.exports = system;
module.exports = system;
export type { System, Display, Dependencies };