Re-enabled tests. Re-enabled docs build (jsdocs are very out of date). Removed several any types and created types for Config

This commit is contained in:
Matt McWilliams 2024-05-23 23:36:51 -04:00
parent 5597aea828
commit b21b899303
79 changed files with 1170 additions and 415 deletions

4
.gitignore vendored
View File

@ -9,4 +9,6 @@ dist
*debug_custom.json *debug_custom.json
*debug.cfg *debug.cfg
notes/mphd notes/mphd
./lib

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.112", "version": "1.8.113",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

0
app/lib/alert/Readme.md Normal file
View File

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/alert/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,uCAAmC;AAEnC,6BAA0B;AAI1B,4CAA4C;AAE5C,MAAa,KAAK;IAOjB,YAAc,EAAgB;QANtB,QAAG,GAAoB,kBAAO,CAAA;QAE9B,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,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,I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AAC,CAAA;QAC9B,OAAO,IAAI,OAAO,CAAC,UAAU,OAAkB,EAAE,MAAiB;YACjE,IAAI,CAAC,EAAE,GAAG;gBACT,MAAM,EAAE,GAAY,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;gBAC1C,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC,CAAA;QACF,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACf,CAAC;CACD;AAvDD,sBAuDC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAA"}

View File

@ -1,3 +1,25 @@
## Classes
<dl>
<dt><a href="#Arduino">Arduino</a></dt>
<dd><p>Class representing the arduino communication features</p>
</dd>
</dl>
## Constants
<dl>
<dt><a href="#delay_1">delay_1</a></dt>
<dd><p>2023-07-16 Clarification</p>
<p>Previous versions of this script intermingled and even
swapped the usage of the terms &#39;serial&#39; and &#39;device&#39;.
From here on out, the terms will be used as such:</p>
<p>serial - a hardware address of a serial port
device - common name of a type of mcopy device (eg. camera,
projector, light) that is aliased to a serial port</p>
</dd>
</dl>
<a name="Arduino"></a> <a name="Arduino"></a>
## Arduino ## Arduino
@ -8,7 +30,19 @@ Class representing the arduino communication features
* [Arduino](#Arduino) * [Arduino](#Arduino)
* [.enumerate()](#Arduino+enumerate) ⇒ <code>Promise</code> * [.enumerate()](#Arduino+enumerate) ⇒ <code>Promise</code>
* [.sendAsync(device, cmd)](#Arduino+sendAsync) ⇒ <code>Promise</code> * [.sendAsync(device, cmd)](#Arduino+sendAsync) ⇒ <code>Promise</code>
* [.send(device, cmd)](#Arduino+send) ⇒ <code>Promise.&lt;(boolean\|string)&gt;</code>
* [.sendString(device, str)](#Arduino+sendString) ⇒ <code>Promise.&lt;(boolean\|string)&gt;</code>
* [.stateAsync()](#Arduino+stateAsync)
* [.state()](#Arduino+state)
* [.writeAsync(device, str)](#Arduino+writeAsync) ⇒ <code>Promise</code> * [.writeAsync(device, str)](#Arduino+writeAsync) ⇒ <code>Promise</code>
* [.end(serial, data)](#Arduino+end) ⇒ <code>any</code>
* [.aliasSerial(device, serial)](#Arduino+aliasSerial)
* [.connect(device, serial, confirm)](#Arduino+connect) ⇒ <code>Promise.&lt;string&gt;</code>
* [.confirmEnd(data)](#Arduino+confirmEnd)
* [.verify()](#Arduino+verify) ⇒ <code>Promise.&lt;boolean&gt;</code>
* [.distinguish()](#Arduino+distinguish) ⇒ <code>Promise.&lt;string&gt;</code>
* [.close()](#Arduino+close) ⇒ <code>Promise.&lt;boolean&gt;</code>
* [.fakeConnect(serial)](#Arduino+fakeConnect) ⇒ <code>Promise.&lt;boolean&gt;</code>
* [.openArduino(device)](#Arduino+openArduino) ⇒ <code>Promise</code> * [.openArduino(device)](#Arduino+openArduino) ⇒ <code>Promise</code>
* [.closeArduino(device)](#Arduino+closeArduino) ⇒ <code>Promise</code> * [.closeArduino(device)](#Arduino+closeArduino) ⇒ <code>Promise</code>
@ -29,9 +63,55 @@ Send a command to an Arduino using async/await
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| device | <code>string</code> | Arduino identifier | | device | <code>string</code> | The Arduino device identifier |
| cmd | <code>string</code> | Single character command to send | | cmd | <code>string</code> | Single character command to send |
<a name="Arduino+send"></a>
### arduino.send(device, cmd) ⇒ <code>Promise.&lt;(boolean\|string)&gt;</code>
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.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
**Returns**: <code>Promise.&lt;(boolean\|string)&gt;</code> - Returns 'false' if the communication is locked, otherwise returns the response from the device.
**Throws**:
- <code>Error</code> Throws an error if the sendAsync method encounters an error.
| Param | Type | Description |
| --- | --- | --- |
| device | <code>string</code> | The Arduino device identifier. |
| cmd | <code>string</code> | The command to be sent to the Arduino. |
<a name="Arduino+sendString"></a>
### arduino.sendString(device, str) ⇒ <code>Promise.&lt;(boolean\|string)&gt;</code>
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.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
**Returns**: <code>Promise.&lt;(boolean\|string)&gt;</code> - Returns 'true' if the string is sent successfully, otherwise returns an error message.
**Throws**:
- <code>Error</code> Throws an error if the writeAsync method encounters an error.
| Param | Type | Description |
| --- | --- | --- |
| device | <code>string</code> | The Arduino device identifier. |
| str | <code>string</code> | The string to be sent to the Arduino. |
<a name="Arduino+stateAsync"></a>
### arduino.stateAsync()
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
<a name="Arduino+state"></a>
### arduino.state()
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
<a name="Arduino+writeAsync"></a> <a name="Arduino+writeAsync"></a>
### arduino.writeAsync(device, str) ⇒ <code>Promise</code> ### arduino.writeAsync(device, str) ⇒ <code>Promise</code>
@ -45,6 +125,114 @@ Send a string to an Arduino using async/await
| device | <code>string</code> | Arduino identifier | | device | <code>string</code> | Arduino identifier |
| str | <code>string</code> | String to send | | str | <code>string</code> | String to send |
<a name="Arduino+end"></a>
### arduino.end(serial, data) ⇒ <code>any</code>
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.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
**Returns**: <code>any</code> - The time taken for the communication in milliseconds.
| Param | Type | Description |
| --- | --- | --- |
| serial | <code>string</code> | The serial address of the Arduino device. |
| data | <code>string</code> | The data received from the Arduino. |
<a name="Arduino+aliasSerial"></a>
### arduino.aliasSerial(device, serial)
Associates an alias with an Arduinos serial address.
Used to map multi-purpose devices onto the same serial connection.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
| Param | Type | Description |
| --- | --- | --- |
| device | <code>string</code> | The serial number of the target Arduino. |
| serial | <code>string</code> | The alias to be associated with the target device. |
<a name="Arduino+connect"></a>
### arduino.connect(device, serial, confirm) ⇒ <code>Promise.&lt;string&gt;</code>
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.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
**Returns**: <code>Promise.&lt;string&gt;</code> - Resolves with the device path if the connection is successful.
**Throws**:
- <code>Error</code> Rejects with an error message if the connection fails.
| Param | Type | Description |
| --- | --- | --- |
| device | <code>string</code> | The device identifier (common name). |
| serial | <code>string</code> | The serial address of the target Arduino (e.g., COM port on Windows). |
| confirm | <code>function</code> | A callback function to be executed upon receiving confirmation data. |
<a name="Arduino+confirmEnd"></a>
### arduino.confirmEnd(data)
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.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
| Param | Type | Description |
| --- | --- | --- |
| data | <code>string</code> | The data received from the Arduino. |
<a name="Arduino+verify"></a>
### arduino.verify() ⇒ <code>Promise.&lt;boolean&gt;</code>
Verifies the connection to an Arduino by sending a connect command.
The confirmation callback checks if the received data matches the expected connect command.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
**Returns**: <code>Promise.&lt;boolean&gt;</code> - Resolves with 'true' if the connection is verified successfully.
**Throws**:
- <code>Error</code> Rejects with an error message if the connection verification fails.
<a name="Arduino+distinguish"></a>
### arduino.distinguish() ⇒ <code>Promise.&lt;string&gt;</code>
Distinguishes the type of Arduino connected.
Sends a command to the device to identify its type and resolves the promise with the received type.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
**Returns**: <code>Promise.&lt;string&gt;</code> - Resolves with the type of the connected Arduino-based device.
**Throws**:
- <code>Error</code> Rejects with an error message if the distinguish operation fails.
<a name="Arduino+close"></a>
### arduino.close() ⇒ <code>Promise.&lt;boolean&gt;</code>
Closes the connection to an Arduino.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
**Returns**: <code>Promise.&lt;boolean&gt;</code> - Resolves with 'true' if the connection is closed successfully.
**Throws**:
- <code>Error</code> Throws an error if the closeArduino method encounters an error.
<a name="Arduino+fakeConnect"></a>
### arduino.fakeConnect(serial) ⇒ <code>Promise.&lt;boolean&gt;</code>
Establishes a fake connection to an Arduino for testing purposes.
Creates a fake SerialPort instance with custom write and string methods.
**Kind**: instance method of [<code>Arduino</code>](#Arduino)
**Returns**: <code>Promise.&lt;boolean&gt;</code> - Resolves with 'true' if the fake connection is established successfully.
| Param | Type | Description |
| --- | --- | --- |
| serial | <code>string</code> | The device identifier of the fake Arduino. |
<a name="Arduino+openArduino"></a> <a name="Arduino+openArduino"></a>
### arduino.openArduino(device) ⇒ <code>Promise</code> ### arduino.openArduino(device) ⇒ <code>Promise</code>
@ -69,3 +257,17 @@ Close a connection to an Arduino using async/await
| --- | --- | --- | | --- | --- | --- |
| device | <code>string</code> | Arduino identifier | | device | <code>string</code> | Arduino identifier |
<a name="delay_1"></a>
## delay\_1
2023-07-16 Clarification
Previous versions of this script intermingled and even
swapped the usage of the terms 'serial' and 'device'.
From here on out, the terms will be used as such:
serial - a hardware address of a serial port
device - common name of a type of mcopy device (eg. camera,
projector, light) that is aliased to a serial port
**Kind**: global constant

View File

@ -1,5 +1,6 @@
/// <reference types="node" /> /// <reference types="node" />
import type { EventEmitter } from 'events'; import type { EventEmitter } from 'events';
import type { Config } from 'cfg';
/** /**
* Class representing the arduino communication features * Class representing the arduino communication features
**/ **/
@ -21,7 +22,7 @@ export declare class Arduino {
alias: any; alias: any;
stateStr: any; stateStr: any;
hasState: any; hasState: any;
constructor(cfg: any, ee: EventEmitter, errorState: Function); constructor(cfg: Config, ee: EventEmitter, errorState: Function);
init(): Promise<void>; init(): Promise<void>;
/** /**
* Enumerate all connected devices that might be Arduinos * Enumerate all connected devices that might be Arduinos
@ -51,7 +52,7 @@ export declare class Arduino {
* @returns {Promise<boolean|string>} Returns 'false' if the communication is locked, otherwise returns the response from the device. * @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. * @throws {Error} Throws an error if the sendAsync method encounters an error.
**/ **/
send(device: string, cmd: string): Promise<any>; send(device: string, cmd: string): Promise<number>;
/** /**
* Sends a string to the specified Arduino. * Sends a string to the specified Arduino.
* Handles different types of devices, including fake devices for testing purposes. * Handles different types of devices, including fake devices for testing purposes.
@ -63,7 +64,7 @@ export declare class Arduino {
* @returns {Promise<boolean|string>} Returns 'true' if the string is sent successfully, otherwise returns an error message. * @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. * @throws {Error} Throws an error if the writeAsync method encounters an error.
**/ **/
sendString(device: string, str: string): Promise<any>; sendString(device: string, str: string): Promise<number>;
/** /**
* *
**/ **/

View File

@ -13,12 +13,10 @@ exports.Arduino = void 0;
* projector, light) that is aliased to a serial port * projector, light) that is aliased to a serial port
* *
**/ **/
//import Log = require('log');
const delay_1 = require("delay"); const delay_1 = require("delay");
const log_1 = require("log"); const log_1 = require("log");
const { SerialPort } = require('serialport'); const { SerialPort } = require('serialport');
const { ReadlineParser } = require('@serialport/parser-readline'); const { ReadlineParser } = require('@serialport/parser-readline');
const exec = require('child_process').exec;
const parser = new ReadlineParser({ delimiter: '\r\n' }); const parser = new ReadlineParser({ delimiter: '\r\n' });
const newlineRe = new RegExp('\n', 'g'); const newlineRe = new RegExp('\n', 'g');
const returnRe = new RegExp('\r', 'g'); const returnRe = new RegExp('\r', 'g');
@ -37,7 +35,6 @@ const KNOWN = [
**/ **/
class Arduino { class Arduino {
constructor(cfg, ee, errorState) { constructor(cfg, ee, errorState) {
this.cfg = {};
this.path = {}; this.path = {};
this.known = KNOWN; this.known = KNOWN;
this.serial = {}; this.serial = {};
@ -139,8 +136,8 @@ class Arduino {
let ms; let ms;
this.log.info(`send ${cmd} -> ${device}`); this.log.info(`send ${cmd} -> ${device}`);
if (this.isLocked(serial)) { if (this.isLocked(serial)) {
this.log.warn(`send Serial ${serial} is locked`); this.log.error(`send Serial ${serial} is locked`);
return null; return 0;
} }
this.timer = new Date().getTime(); this.timer = new Date().getTime();
this.lock(serial); this.lock(serial);
@ -150,7 +147,7 @@ class Arduino {
} }
catch (e) { catch (e) {
this.log.error(`Failed to send to ${device} @ ${serial}`, e); this.log.error(`Failed to send to ${device} @ ${serial}`, e);
return null; return 0;
} }
this.unlock(serial); this.unlock(serial);
await this.eventEmitter.emit('arduino_send', cmd); await this.eventEmitter.emit('arduino_send', cmd);
@ -168,7 +165,7 @@ class Arduino {
* @throws {Error} Throws an error if the writeAsync method encounters an error. * @throws {Error} Throws an error if the writeAsync method encounters an error.
**/ **/
async sendString(device, str) { async sendString(device, str) {
let writeSuccess; let ms;
await (0, delay_1.delay)(this.cfg.arduino.serialDelay); await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (typeof this.serial[this.alias[device]].fake !== 'undefined' if (typeof this.serial[this.alias[device]].fake !== 'undefined'
&& this.serial[this.alias[device]].fake) { && this.serial[this.alias[device]].fake) {
@ -177,14 +174,14 @@ class Arduino {
else { else {
this.log.info(`sendString ${str} -> ${device}`); this.log.info(`sendString ${str} -> ${device}`);
try { try {
writeSuccess = await this.writeAsync(device, str); ms = await this.writeAsync(device, str);
} }
catch (e) { catch (e) {
this.log.error(`Error sending string to ${device}`, e); this.log.error(`Error sending string to ${device}`, e);
return null; return 0;
} }
this.unlock(this.alias[device]); this.unlock(this.alias[device]);
return writeSuccess; return ms;
} }
} }
/** /**

File diff suppressed because one or more lines are too long

View File

@ -9,9 +9,11 @@ class representing camera functions
* [.init()](#Camera+init) * [.init()](#Camera+init)
* [.listen()](#Camera+listen) * [.listen()](#Camera+listen)
* [.set()](#Camera+set) * [.set()](#Camera+set)
* [.cap()](#Camera+cap)
* [.move()](#Camera+move) * [.move()](#Camera+move)
* [.exposure()](#Camera+exposure) * [.exposure()](#Camera+exposure)
* [.connectIntval()](#Camera+connectIntval) * [.connectIntval()](#Camera+connectIntval)
* [.connectProcessing()](#Camera+connectProcessing)
* [.listener()](#Camera+listener) * [.listener()](#Camera+listener)
* [.end()](#Camera+end) * [.end()](#Camera+end)
@ -27,6 +29,10 @@ class representing camera functions
### camera.set() ### camera.set()
**Kind**: instance method of [<code>Camera</code>](#Camera) **Kind**: instance method of [<code>Camera</code>](#Camera)
<a name="Camera+cap"></a>
### camera.cap()
**Kind**: instance method of [<code>Camera</code>](#Camera)
<a name="Camera+move"></a> <a name="Camera+move"></a>
### camera.move() ### camera.move()
@ -39,6 +45,10 @@ class representing camera functions
### camera.connectIntval() ### camera.connectIntval()
**Kind**: instance method of [<code>Camera</code>](#Camera) **Kind**: instance method of [<code>Camera</code>](#Camera)
<a name="Camera+connectProcessing"></a>
### camera.connectProcessing()
**Kind**: instance method of [<code>Camera</code>](#Camera)
<a name="Camera+listener"></a> <a name="Camera+listener"></a>
### camera.listener() ### camera.listener()

View File

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

File diff suppressed because one or more lines are too long

34
app/lib/capper/Readme.md Normal file
View File

@ -0,0 +1,34 @@
<a name="Capper"></a>
## Capper
class representing capper functions
**Kind**: global class
* [Capper](#Capper)
* [.init()](#Capper+init)
* [.listen()](#Capper+listen)
* [.capper()](#Capper+capper)
* [.listener()](#Capper+listener)
* [.end()](#Capper+end)
<a name="Capper+init"></a>
### capper.init()
**Kind**: instance method of [<code>Capper</code>](#Capper)
<a name="Capper+listen"></a>
### capper.listen()
**Kind**: instance method of [<code>Capper</code>](#Capper)
<a name="Capper+capper"></a>
### capper.capper()
**Kind**: instance method of [<code>Capper</code>](#Capper)
<a name="Capper+listener"></a>
### capper.listener()
**Kind**: instance method of [<code>Capper</code>](#Capper)
<a name="Capper+end"></a>
### capper.end()
**Kind**: instance method of [<code>Capper</code>](#Capper)

View File

@ -1,6 +1,9 @@
import type { FilmOut } from 'filmout'; import type { FilmOut } from 'filmout';
import type { Arduino } from 'arduino'; import type { Arduino } from 'arduino';
import type { WebContents } from 'electron'; import type { WebContents } from 'electron';
interface CapperState {
capper: boolean;
}
/** class representing capper functions **/ /** class representing capper functions **/
export declare class Capper { export declare class Capper {
private state; private state;
@ -36,3 +39,4 @@ export declare class Capper {
**/ **/
private end; private end;
} }
export type { CapperState };

View File

@ -82,7 +82,7 @@ class Capper {
} }
message += ` ${ms}ms`; message += ` ${ms}ms`;
this.log.info(message); 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; return ms;
} }
} }

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capper/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,uCAAmC;AAInC,6BAA0B;AAM1B,2CAA2C;AAE3C,MAAa,MAAM;IAWlB;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAgB,EAAE,OAAiB;QAbtE,UAAK,GAAS;YACrB,MAAM,EAAG,KAAK;SACd,CAAC;QACM,YAAO,GAAa,IAAI,CAAC;QAKzB,QAAG,GAAoB,kBAAO,CAAC;QAC/B,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,C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G,EAAE,MAAM,EAAE,CAAA"}

0
app/lib/cfg/Readme.md Normal file
View File

30
app/lib/cfg/index.d.ts vendored Normal file
View File

@ -0,0 +1,30 @@
interface ConfigCommands {
[key: string]: string;
}
interface ConfigDeviceProfile {
time: number;
delay: number;
momentary: number;
}
interface ConfigBlackProfile {
before: number;
after: number;
}
interface ConfigProfile {
label: string;
cam: ConfigDeviceProfile;
proj?: ConfigDeviceProfile;
black?: ConfigBlackProfile;
light: boolean;
}
interface ConfigProfiles {
[key: string]: ConfigProfile;
}
interface Config {
version: string;
ext_port: number;
profiles: ConfigProfiles;
cmd: ConfigCommands;
arduino: any;
}
export type { Config };

3
app/lib/cfg/index.js Normal file
View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=index.js.map

1
app/lib/cfg/index.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cfg/index.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,19 @@
<a name="Assign all connected devices and mock devices as private classes."></a>
## Assign all connected devices and mock devices as private classes.
**Kind**: global class
<a name="new_Assign all connected devices and mock devices as private classes._new"></a>
### new Assign all connected devices and mock devices as private classes.(cfg, proj, cam, light, alert, cam2, proj2, capper)
| Param | Type | Description |
| --- | --- | --- |
| cfg | <code>object</code> | Configuration object |
| proj | <code>object</code> | Projector 1 |
| cam | <code>object</code> | Camera 1 |
| light | <code>object</code> | Light source |
| alert | <code>object</code> | Alert object |
| cam2 | <code>object</code> | (optional) Camera 2 |
| proj2 | <code>object</code> | (optional) Projector 2 |
| capper | <code>object</code> | Capper object |

View File

@ -3,6 +3,7 @@ import type { Camera } from 'cam';
import type { Light } from 'light'; import type { Light } from 'light';
import type { Capper } from 'capper'; import type { Capper } from 'capper';
import type { Alert } from 'alert'; import type { Alert } from 'alert';
import type { Config } from 'cfg';
export declare class Commands { export declare class Commands {
proj: Projector; proj: Projector;
cam: Camera; cam: Camera;
@ -27,7 +28,7 @@ export declare class Commands {
* @param {object} capper Capper object * @param {object} capper Capper object
* *
**/ **/
constructor(cfg: any, proj: Projector, cam: any, light: Light, alert: Alert, cam2?: any, proj2?: Projector, capper?: any); constructor(cfg: Config, proj: Projector, cam: Camera, light: Light, alert: Alert, cam2?: Camera, proj2?: Projector, capper?: Capper);
/** /**
* Move the projector one frame forward * Move the projector one frame forward
* *

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,7 @@ class representing the device discovery features
**Kind**: global class **Kind**: global class
* [Devices](#Devices) * [Devices](#Devices)
* [new Devices()](#new_Devices_new)
* [.init()](#Devices+init) * [.init()](#Devices+init)
* [.listen()](#Devices+listen) * [.listen()](#Devices+listen)
* [.listener()](#Devices+listener) * [.listener()](#Devices+listener)
@ -15,22 +16,37 @@ class representing the device discovery features
* [.fakeProjector()](#Devices+fakeProjector) * [.fakeProjector()](#Devices+fakeProjector)
* [.fakeCamera()](#Devices+fakeCamera) * [.fakeCamera()](#Devices+fakeCamera)
* [.fakeLight()](#Devices+fakeLight) * [.fakeLight()](#Devices+fakeLight)
* [.fakeCapper()](#Devices+fakeCapper)
* [.connectDevice()](#Devices+connectDevice) * [.connectDevice()](#Devices+connectDevice)
* [.all()](#Devices+all) * [.all()](#Devices+all)
* [.remember()](#Devices+remember) * [.remember()](#Devices+remember)
* [.ready()](#Devices+ready) * [.ready()](#Devices+ready)
<a name="new_Devices_new"></a>
### new Devices()
Constructor assigns arduino, settings, UI browser window and cam objects
locally to this class for reference.
<a name="Devices+init"></a> <a name="Devices+init"></a>
### devices.init() ### devices.init()
Initialize the log for "devices". Establish an ipc connection to the UI.
Start listening on that ipc connection.
**Kind**: instance method of [<code>Devices</code>](#Devices) **Kind**: instance method of [<code>Devices</code>](#Devices)
<a name="Devices+listen"></a> <a name="Devices+listen"></a>
### devices.listen() ### devices.listen()
Listen to the "profile" channel for messages from the UI.
**Kind**: instance method of [<code>Devices</code>](#Devices) **Kind**: instance method of [<code>Devices</code>](#Devices)
<a name="Devices+listener"></a> <a name="Devices+listener"></a>
### devices.listener() ### devices.listener()
The "profile" channel callback. If a profile is changed, set it in the
local settings object.
**Kind**: instance method of [<code>Devices</code>](#Devices) **Kind**: instance method of [<code>Devices</code>](#Devices)
<a name="Devices+enumerate"></a> <a name="Devices+enumerate"></a>
@ -56,6 +72,10 @@ class representing the device discovery features
### devices.fakeLight() ### devices.fakeLight()
**Kind**: instance method of [<code>Devices</code>](#Devices) **Kind**: instance method of [<code>Devices</code>](#Devices)
<a name="Devices+fakeCapper"></a>
### devices.fakeCapper()
**Kind**: instance method of [<code>Devices</code>](#Devices)
<a name="Devices+connectDevice"></a> <a name="Devices+connectDevice"></a>
### devices.connectDevice() ### devices.connectDevice()

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
<a name="display
Provides features for displaying a full screen display of images for the digital module.module_"></a>
## display
Provides features for displaying a full screen display of images for the digital module.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,124 @@
<a name="module_ffmpeg"></a>
## ffmpeg
* [ffmpeg](#module_ffmpeg)
* [~FFMPEG](#module_ffmpeg..FFMPEG)
* [.init()](#module_ffmpeg..FFMPEG+init)
* [.padded_frame(i)](#module_ffmpeg..FFMPEG+padded_frame) ⇒ <code>string</code>
* [.parseStderr(line)](#module_ffmpeg..FFMPEG+parseStderr)
* [.frame(state, light)](#module_ffmpeg..FFMPEG+frame) ⇒ <code>string</code>
* [.frames(video, obj)](#module_ffmpeg..FFMPEG+frames) ⇒ <code>?</code>
* [.clear(frame)](#module_ffmpeg..FFMPEG+clear) ⇒ <code>boolean</code>
* [.clearAll()](#module_ffmpeg..FFMPEG+clearAll)
* [.checkDir()](#module_ffmpeg..FFMPEG+checkDir)
* [~Creates an ffmpeg class](#module_ffmpeg..Creates an ffmpeg class)
* [new Creates an ffmpeg class(sys)](#new_module_ffmpeg..Creates an ffmpeg class_new)
<a name="module_ffmpeg..FFMPEG"></a>
### ffmpeg~FFMPEG
**Kind**: inner class of [<code>ffmpeg</code>](#module_ffmpeg)
* [~FFMPEG](#module_ffmpeg..FFMPEG)
* [.init()](#module_ffmpeg..FFMPEG+init)
* [.padded_frame(i)](#module_ffmpeg..FFMPEG+padded_frame) ⇒ <code>string</code>
* [.parseStderr(line)](#module_ffmpeg..FFMPEG+parseStderr)
* [.frame(state, light)](#module_ffmpeg..FFMPEG+frame) ⇒ <code>string</code>
* [.frames(video, obj)](#module_ffmpeg..FFMPEG+frames) ⇒ <code>?</code>
* [.clear(frame)](#module_ffmpeg..FFMPEG+clear) ⇒ <code>boolean</code>
* [.clearAll()](#module_ffmpeg..FFMPEG+clearAll)
* [.checkDir()](#module_ffmpeg..FFMPEG+checkDir)
<a name="module_ffmpeg..FFMPEG+init"></a>
#### ffmpeG.init()
Async method to call async functions from constructor
**Kind**: instance method of [<code>FFMPEG</code>](#module_ffmpeg..FFMPEG)
<a name="module_ffmpeg..FFMPEG+padded_frame"></a>
#### ffmpeG.padded\_frame(i) ⇒ <code>string</code>
Add padding to a number to 5 places. Return a string.
**Kind**: instance method of [<code>FFMPEG</code>](#module_ffmpeg..FFMPEG)
**Returns**: <code>string</code> - Padded string
| Param | Type | Description |
| --- | --- | --- |
| i | <code>integer</code> | Integer to pad |
<a name="module_ffmpeg..FFMPEG+parseStderr"></a>
#### ffmpeG.parseStderr(line)
Parse the stderr output of ffmpeg
**Kind**: instance method of [<code>FFMPEG</code>](#module_ffmpeg..FFMPEG)
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Stderr line |
<a name="module_ffmpeg..FFMPEG+frame"></a>
#### ffmpeG.frame(state, light) ⇒ <code>string</code>
Render a single frame from a video or image to a png.
**Kind**: instance method of [<code>FFMPEG</code>](#module_ffmpeg..FFMPEG)
**Returns**: <code>string</code> - Path of frame
| Param | Type | Description |
| --- | --- | --- |
| state | <code>object</code> | State object containing file data |
| light | <code>object</code> | Object containing color information for frame |
<a name="module_ffmpeg..FFMPEG+frames"></a>
#### ffmpeG.frames(video, obj) ⇒ <code>?</code>
Render all frames in a video to the temp directory.
Not in use.
**Kind**: instance method of [<code>FFMPEG</code>](#module_ffmpeg..FFMPEG)
| Param | Type | Description |
| --- | --- | --- |
| video | <code>string</code> | Path to video |
| obj | <code>object</code> | Not sure |
<a name="module_ffmpeg..FFMPEG+clear"></a>
#### ffmpeG.clear(frame) ⇒ <code>boolean</code>
Clears a specific frame from the tmp directory
**Kind**: instance method of [<code>FFMPEG</code>](#module_ffmpeg..FFMPEG)
**Returns**: <code>boolean</code> - True if successful, false if not
| Param | Type | Description |
| --- | --- | --- |
| frame | <code>integer</code> | Integer of frame to clear |
<a name="module_ffmpeg..FFMPEG+clearAll"></a>
#### ffmpeG.clearAll()
Deletes all frames in temp directory.
**Kind**: instance method of [<code>FFMPEG</code>](#module_ffmpeg..FFMPEG)
<a name="module_ffmpeg..FFMPEG+checkDir"></a>
#### ffmpeG.checkDir()
Checks if mcopy temp directory exists. If it doesn't,
creates it.
**Kind**: instance method of [<code>FFMPEG</code>](#module_ffmpeg..FFMPEG)
<a name="module_ffmpeg..Creates an ffmpeg class"></a>
### ffmpeg~Creates an ffmpeg class
**Kind**: inner class of [<code>ffmpeg</code>](#module_ffmpeg)
<a name="new_module_ffmpeg..Creates an ffmpeg class_new"></a>
#### new Creates an ffmpeg class(sys)
| Param | Type | Description |
| --- | --- | --- |
| sys | <code>object</code> | System object to be used to get temp directory |

View File

@ -1,5 +1,6 @@
import type { FilmOutState } from 'filmout'; import type { FilmOutState } from 'filmout';
import type { System } from 'system'; import type { System } from 'system';
import type { LightState } from 'light';
interface StdErr { interface StdErr {
frame: number; frame: number;
fps: number; fps: number;
@ -51,7 +52,7 @@ export declare class FFMPEG {
* *
* @returns {string} Path of frame * @returns {string} Path of frame
**/ **/
frame(state: FilmOutState, light: any): Promise<string>; frame(state: FilmOutState, light: LightState): Promise<string>;
/** /**
* Render all frames in a video to the temp directory. * Render all frames in a video to the temp directory.
* Not in use. * Not in use.

View File

@ -7,30 +7,6 @@ const fs_extra_1 = require("fs-extra");
const exec_1 = require("exec"); const exec_1 = require("exec");
const child_process_1 = require("child_process"); const child_process_1 = require("child_process");
const log_1 = require("log"); const log_1 = require("log");
async function spawnAsync(bin, args) {
return new Promise((resolve, reject) => {
const child = (0, child_process_1.spawn)(bin, args);
let stdout = '';
let stderr = '';
child.on('exit', (code) => {
if (code === 0) {
return resolve({ stdout, stderr });
}
else {
console.error(`Process exited with code: ${code}`);
console.error(stderr);
return reject(stderr);
}
});
child.stdout.on('data', (data) => {
stdout += data;
});
child.stderr.on('data', (data) => {
stderr += data;
});
return child;
});
}
/** @class FFMPEG **/ /** @class FFMPEG **/
class FFMPEG { class FFMPEG {
/** /**
@ -75,21 +51,30 @@ class FFMPEG {
**/ **/
parseStderr(line) { parseStderr(line) {
//frame= 6416 fps= 30 q=31.0 size= 10251kB time=00:03:34.32 bitrate= 391.8kbits/s speed= 1x //frame= 6416 fps= 30 q=31.0 size= 10251kB time=00:03:34.32 bitrate= 391.8kbits/s speed= 1x
let obj = {}; const obj = {
frame: 0,
fps: 0,
time: '',
speed: 0,
size: ''
};
let frameStr;
let fpsStr;
let speedStr;
if (line.substring(0, 'frame='.length) === 'frame=') { if (line.substring(0, 'frame='.length) === 'frame=') {
try { try {
obj.frame = line.split('frame=')[1].split('fps=')[0]; frameStr = line.split('frame=')[1].split('fps=')[0];
obj.frame = parseInt(obj.frame); obj.frame = parseInt(frameStr);
obj.fps = line.split('fps=')[1].split('q=')[0]; fpsStr = line.split('fps=')[1].split('q=')[0];
obj.fps = parseFloat(obj.fps); obj.fps = parseFloat(fpsStr);
obj.time = line.split('time=')[1].split('bitrate=')[0]; obj.time = line.split('time=')[1].split('bitrate=')[0];
obj.speed = line.split('speed=')[1].trim().replace('x', ''); speedStr = line.split('speed=')[1].trim().replace('x', '');
obj.speed = parseFloat(obj.speed); obj.speed = parseFloat(speedStr);
obj.size = line.split('size=')[1].split('time=')[0].trim(); obj.size = line.split('size=')[1].split('time=')[0].trim();
} }
catch (err) { catch (err) {
console.error(err); this.log.error('Error parsing stderr line', err);
console.log(line); this.log.info(line);
process.exit(); process.exit();
} }
} }
@ -113,7 +98,7 @@ class FFMPEG {
const padded = this.padded_frame(frameNum); const padded = this.padded_frame(frameNum);
let ext = 'png'; let ext = 'png';
let rgb = light.color; let rgb = light.color;
let rgba = {}; let rgba;
let tmpoutput; let tmpoutput;
let cmd; let cmd;
let output; let output;
@ -153,7 +138,7 @@ class FFMPEG {
this.log.info(`"${output.stdout.trim()}"`); this.log.info(`"${output.stdout.trim()}"`);
if (rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255) { if (rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255) {
rgb = rgb.map((e) => { rgb = rgb.map((e) => {
return parseInt(e); return typeof e === 'string' ? parseInt(e) : e;
}); });
rgba = { r: rgb[0], g: rgb[1], b: rgb[2], a: 255 }; rgba = { r: rgb[0], g: rgb[1], b: rgb[2], a: 255 };
try { try {
@ -218,19 +203,19 @@ class FFMPEG {
let stderr = ''; let stderr = '';
this.log.info(`${this.bin} ${args.join(' ')}`); this.log.info(`${this.bin} ${args.join(' ')}`);
this.child = (0, child_process_1.spawn)(this.bin, args); this.child = (0, child_process_1.spawn)(this.bin, args);
this.child.on('exit', (code) => { this.child.on('exit', function (code) {
//console.log('GOT TO EXIT'); //console.log('GOT TO EXIT');
if (code === 0) { if (code === 0) {
console.log(stderr); this.log.info(stderr);
console.log(stdout); this.log.info(stdout);
return resolve(true); return resolve(true);
} }
else { else {
console.error(`Process exited with code: ${code}`); this.log.error(`Process exited with code: ${code}`);
console.error(stderr); this.log.error(stderr);
return reject(stderr + stdout); return reject(stderr + stdout);
} }
}); }.bind(this));
this.child.stdout.on('data', (data) => { this.child.stdout.on('data', (data) => {
const line = data.toString(); const line = data.toString();
stdout += line; stdout += line;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
<a name="module_FFPROBE"></a>
## FFPROBE

View File

@ -1,44 +1,3 @@
<a name="Digital"></a> <a name="module_FilmOut"></a>
## Digital ## FilmOut
**Kind**: global class
* [Digital](#Digital)
* [.init()](#Digital+init)
* [.listen()](#Digital+listen)
* [.set()](#Digital+set)
* [.move()](#Digital+move)
* [.start()](#Digital+start)
* [.end()](#Digital+end)
* [.connectDigital()](#Digital+connectDigital)
<a name="Digital+init"></a>
### digital.init()
**Kind**: instance method of [<code>Digital</code>](#Digital)
<a name="Digital+listen"></a>
### digital.listen()
**Kind**: instance method of [<code>Digital</code>](#Digital)
<a name="Digital+set"></a>
### digital.set()
**Kind**: instance method of [<code>Digital</code>](#Digital)
<a name="Digital+move"></a>
### digital.move()
**Kind**: instance method of [<code>Digital</code>](#Digital)
<a name="Digital+start"></a>
### digital.start()
**Kind**: instance method of [<code>Digital</code>](#Digital)
<a name="Digital+end"></a>
### digital.end()
**Kind**: instance method of [<code>Digital</code>](#Digital)
<a name="Digital+connectDigital"></a>
### digital.connectDigital()
Use a file as the "digital" source on "projector"
**Kind**: instance method of [<code>Digital</code>](#Digital)

View File

@ -3,7 +3,7 @@ import type { Display } from 'display';
import type { Light } from 'light'; import type { Light } from 'light';
import type { FFMPEG } from 'ffmpeg'; import type { FFMPEG } from 'ffmpeg';
import type { FFPROBE } from 'ffprobe'; import type { FFPROBE } from 'ffprobe';
import type { WebContents } from 'electron'; import type { WebContents, IpcMainEvent } from 'electron';
interface FilmOutState { interface FilmOutState {
hash: string; hash: string;
frame: number; frame: number;
@ -90,7 +90,7 @@ export declare class FilmOut {
* *
* @returns {boolean} Success state * @returns {boolean} Success state
**/ **/
onConnect(evt: any, arg: any): Promise<boolean>; onConnect(evt: IpcMainEvent, arg: any): Promise<boolean>;
/** /**
* Pre-export all frames from video for display. * Pre-export all frames from video for display.
* *
@ -99,7 +99,7 @@ export declare class FilmOut {
* *
* @returns {any} UI send call * @returns {any} UI send call
*/ */
onPreExport(evt: Event, arg: any): Promise<any>; onPreExport(evt: IpcMainEvent, arg: any): Promise<any>;
/** /**
* Return true if gif is animated, false if it is a still * Return true if gif is animated, false if it is a still
* *
@ -140,33 +140,33 @@ export declare class FilmOut {
* @param {object} evt Original event * @param {object} evt Original event
* @param {object} arg Arguments from message * @param {object} arg Arguments from message
**/ **/
previewFrame(evt: any, arg: any): Promise<void>; previewFrame(evt: IpcMainEvent, arg: any): Promise<void>;
/** /**
* Open a single frame in a display window to preview filmout. * Open a single frame in a display window to preview filmout.
* *
* @param {object} evt Original event * @param {object} evt Original event
* @param {object} arg Arguments from message * @param {object} arg Arguments from message
**/ **/
preview(evt: any, arg: any): Promise<void>; preview(evt: IpcMainEvent, arg: any): Promise<void>;
/** /**
* *
**/ **/
focus(evt: any, arg: any): Promise<void>; focus(evt: IpcMainEvent, arg: any): Promise<void>;
/** /**
* *
**/ **/
field(evt: any, arg: any): Promise<void>; field(evt: IpcMainEvent, arg: any): Promise<void>;
/** /**
* *
**/ **/
meter(evt: any, arg: any): Promise<void>; meter(evt: IpcMainEvent, arg: any): Promise<void>;
/** /**
* *
**/ **/
close(evt: any, arg: any): Promise<void>; close(evt: IpcMainEvent, arg: any): Promise<void>;
/** /**
* *
**/ **/
onDisplay(evt: any, arg: any): void; onDisplay(evt: IpcMainEvent, arg: any): void;
} }
export type { FilmOutState }; export type { FilmOutState };

View File

@ -10,7 +10,7 @@ const path_1 = require("path");
const fs_extra_1 = require("fs-extra"); const fs_extra_1 = require("fs-extra");
const delay_1 = require("delay"); const delay_1 = require("delay");
const crypto_1 = require("crypto"); const crypto_1 = require("crypto");
const frame_1 = __importDefault(require("frame")); const frame_1 = require("frame");
const log_1 = require("log"); const log_1 = require("log");
/** /**
* @module FilmOut * @module FilmOut
@ -329,7 +329,7 @@ class FilmOut {
async stillInfo(pathStr) { async stillInfo(pathStr) {
let info; let info;
try { try {
info = await frame_1.default.info(pathStr); info = await frame_1.Frame.info(pathStr);
} }
catch (err) { catch (err) {
this.log.error(err, 'FILMOUT', true, true); this.log.error(err, 'FILMOUT', true, true);

File diff suppressed because one or more lines are too long

0
app/lib/frame/Readme.md Normal file
View File

View File

@ -4,7 +4,7 @@ interface RGBA {
b: number; b: number;
a: number; a: number;
} }
export default class Frame { export declare class Frame {
static info(imagePath: string): Promise<{ static info(imagePath: string): Promise<{
width: any; width: any;
height: any; height: any;

View File

@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.Frame = void 0;
const jimp_1 = __importDefault(require("jimp")); const jimp_1 = __importDefault(require("jimp"));
class Frame { class Frame {
static async info(imagePath) { static async info(imagePath) {
@ -65,6 +66,6 @@ class Frame {
return imagePath; return imagePath;
} }
} }
exports.default = Frame; exports.Frame = Frame;
module.exports = Frame; module.exports = { Frame };
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/frame/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAEb,gDAAwB;AASxB,MAAqB,KAAK;IACzB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAE,SAAkB;QACpC,IAAI,KAAW,CAAC;QAChB,IAAI;YACH,KAAK,GAAG,MAAM,cAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACnC;QAAC,OAAO,GAAG,EAAE;YACb,MAAM,GAAG,CAAC;SACV;QACD,OAAO;YACN,KAAK,EAAG,KAAK,CAAC,MAAM,CAAC,KAAK;YAC1B,MAAM,EAAG,KAAK,CAAC,MAAM,CAAC,MAAM;SAC5B,CAAC;IACH,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,UAAU,CAAE,KAAc,EAAE,MAAe,EAAE,KAAY;QACrE,YAAY;QACZ,MAAM,QAAQ,GAAY,cAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK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AAC,KAAK,CAAC,KAAK,CAAE,MAAY,EAAE,KAAY,EAAE,SAAkB;QACjE,oKAAoK;QACpK,MAAM,OAAO,GAAS;YACrB,IAAI,EAAE,cAAI,CAAC,YAAY;YACvB,aAAa,EAAE,GAAG;YAClB,WAAW,EAAE,GAAG;SAChB,CAAC;QACF,IAAI,KAAc,CAAC;QACnB,IAAI,MAAe,CAAC;QACpB,IAAI,MAAY,CAAC;QACjB,IAAI,GAAS,CAAC;QAEd,IAAI;YACH,GAAG,GAAG,MAAM,cAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC9B;QAAC,OAAO,GAAG,EAAE;YACb,MAAM,GAAG,CAAC;SACV;QAED,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QACzB,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;QAE3B,IAAI;YACH,MAAM,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;SACtD;QAAC,OAAO,GAAG,EAAE;YACb,MAAM,GAAG,CAAC;SACV;QAED,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;QAErC,IAAI;YACH,MAAM,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SACnC;QAAC,OAAO,GAAG,EAAE;YACb,MAAM,GAAG,CAAC;SACV;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AA/DD,sBA+DC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAA"}

View File

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

View File

@ -49,7 +49,6 @@ class Light {
else if (typeof arg.disable !== 'undefined') { else if (typeof arg.disable !== 'undefined') {
this.enabled = false; this.enabled = false;
} }
return true;
} }
/** /**
* *
@ -66,28 +65,27 @@ class Light {
} }
await (0, delay_1.delay)(1); await (0, delay_1.delay)(1);
try { try {
this.arduino.sendString(this.id, str); ms += await this.arduino.sendString(this.id, str);
} }
catch (err) { catch (err) {
this.log.error('Error sending light string', err); this.log.error('Error sending light string', err);
} }
await (0, delay_1.delay)(1); await (0, delay_1.delay)(1);
await ms; ms += 2;
return await this.end(rgb, id, ms); await this.end(rgb, id, ms);
return ms;
} }
/** /**
* *
**/ **/
async end(rgb, id, ms) { async end(rgb, id, ms) {
let res; let res;
//console.trace()
this.log.info(`Light set to ${rgb.join(',')}`, 'LIGHT', true, true); this.log.info(`Light set to ${rgb.join(',')}`, 'LIGHT', true, true);
try { try {
//console.dir({ rgb, id, ms })
res = await this.ui.send(this.id, { rgb, id, ms }); res = await this.ui.send(this.id, { rgb, id, ms });
} }
catch (err) { catch (err) {
console.error(err); this.log.error(`Error ending light`, err);
throw err; throw err;
} }
return res; return res;

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/light/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,uCAAmC;AACnC,iCAA8B;AAC9B,6BAA0B;AAK1B,MAAa,KAAK;IAYjB;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAgB;QAdpD,UAAK,GAAS,EAAE,KAAK,EAAG,CAAC,CAAC,EAAE,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OAAO,GAAG,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;SAClD;QACD,MAAM,IAAA,aAAK,EAAC,CAAC,CAAC,CAAC;QACf,EAAE,IAAI,CAAC,CAAC;QACR,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5B,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,GAAG,CAAE,GAAc,EAAE,EAAW,EAAE,EAAW;QAC1D,IAAI,GAAG,CAAC;QACR,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI;YACH,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;SACnD;QAAC,OAAO,GAAG,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;YAC1C,MAAM,GAAG,CAAA;SACT;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;CACD;AA9FD,sBA8FC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC"}

View File

@ -1,3 +1,16 @@
## Functions
<dl>
<dt><a href="#logFile">logFile()</a><code>string</code></dt>
<dd><p>Determine the location of the log file based on the operating system
and return as an absolute string from os.homedir()</p>
</dd>
<dt><a href="#Log">Log(arg)</a><code>object</code></dt>
<dd><p>Create and return the logger transport based on settings determined in
arguments object</p>
</dd>
</dl>
<a name="logFile"></a> <a name="logFile"></a>
## logFile() ⇒ <code>string</code> ## logFile() ⇒ <code>string</code>
@ -6,3 +19,16 @@ and return as an absolute string from os.homedir()
**Kind**: global function **Kind**: global function
**Returns**: <code>string</code> - Path to log file **Returns**: <code>string</code> - Path to log file
<a name="Log"></a>
## Log(arg) ⇒ <code>object</code>
Create and return the logger transport based on settings determined in
arguments object
**Kind**: global function
**Returns**: <code>object</code> - Logger transport
| Param | Type | Description |
| --- | --- | --- |
| arg | <code>object</code> | Arguments from process |

View File

@ -1,186 +1,424 @@
<a name="module_lib/mscript"></a> ## Classes
## lib/mscript <dl>
<dt><a href="#Create new Mscript interpreter">Create new Mscript interpreter</a></dt>
<dd></dd>
<dt><a href="#Mscript">Mscript</a></dt>
<dd><p>class Mscript</p>
</dd>
</dl>
* [lib/mscript](#module_lib/mscript) ## Functions
* [~Mscript](#module_lib/mscript..Mscript)
* [.clear()](#module_lib/mscript..Mscript+clear)
* [.interpret()](#module_lib/mscript..Mscript+interpret)
* [.basic_cmd()](#module_lib/mscript..Mscript+basic_cmd)
* [.new_loop()](#module_lib/mscript..Mscript+new_loop)
* [.end_loop()](#module_lib/mscript..Mscript+end_loop)
* [.move_cam()](#module_lib/mscript..Mscript+move_cam)
* [.move_proj()](#module_lib/mscript..Mscript+move_proj)
* [.set_state()](#module_lib/mscript..Mscript+set_state)
* [.last_loop()](#module_lib/mscript..Mscript+last_loop)
* [.parent_loop()](#module_lib/mscript..Mscript+parent_loop)
* [.loop_count()](#module_lib/mscript..Mscript+loop_count)
* [.fade()](#module_lib/mscript..Mscript+fade)
* [.fade_count()](#module_lib/mscript..Mscript+fade_count)
* [.fade_start()](#module_lib/mscript..Mscript+fade_start)
* [.fade_end()](#module_lib/mscript..Mscript+fade_end)
* [.update()](#module_lib/mscript..Mscript+update)
* [.str_to_arr()](#module_lib/mscript..Mscript+str_to_arr)
* [.light_to_arr()](#module_lib/mscript..Mscript+light_to_arr)
* [.light_state()](#module_lib/mscript..Mscript+light_state)
* [.fail()](#module_lib/mscript..Mscript+fail)
* [~startsWith()](#module_lib/mscript..startsWith)
<a name="module_lib/mscript..Mscript"></a> <dl>
<dt><a href="#startsWith">startsWith(str, target, position)</a><code>boolean</code></dt>
<dd><p>startswith function from lodash, do not want the entire lib for this</p>
</dd>
</dl>
### lib/mscript~Mscript <a name="Create new Mscript interpreter"></a>
## Create new Mscript interpreter
**Kind**: global class
<a name="Mscript"></a>
## Mscript
class Mscript class Mscript
**Kind**: inner class of [<code>lib/mscript</code>](#module_lib/mscript) **Kind**: global class
* [~Mscript](#module_lib/mscript..Mscript) * [Mscript](#Mscript)
* [.clear()](#module_lib/mscript..Mscript+clear) * [.clear()](#Mscript+clear)
* [.interpret()](#module_lib/mscript..Mscript+interpret) * [.interpret(text, callback)](#Mscript+interpret) ⇒ <code>object</code>
* [.basic_cmd()](#module_lib/mscript..Mscript+basic_cmd) * [.variable(line)](#Mscript+variable)
* [.new_loop()](#module_lib/mscript..Mscript+new_loop) * [.variable_replace(line)](#Mscript+variable_replace) ⇒ <code>string</code>
* [.end_loop()](#module_lib/mscript..Mscript+end_loop) * [.basic_cmd(line, short)](#Mscript+basic_cmd)
* [.move_cam()](#module_lib/mscript..Mscript+move_cam) * [.new_loop(line, fade)](#Mscript+new_loop)
* [.move_proj()](#module_lib/mscript..Mscript+move_proj) * [.end_loop(line)](#Mscript+end_loop)
* [.set_state()](#module_lib/mscript..Mscript+set_state) * [.move_cam(line)](#Mscript+move_cam)
* [.last_loop()](#module_lib/mscript..Mscript+last_loop) * [.move_cam2(line)](#Mscript+move_cam2)
* [.parent_loop()](#module_lib/mscript..Mscript+parent_loop) * [.move_proj(line)](#Mscript+move_proj)
* [.loop_count()](#module_lib/mscript..Mscript+loop_count) * [.move_proj2(line)](#Mscript+move_proj2)
* [.fade()](#module_lib/mscript..Mscript+fade) * [.set_state(line)](#Mscript+set_state)
* [.fade_count()](#module_lib/mscript..Mscript+fade_count) * [.last_loop()](#Mscript+last_loop) ⇒ <code>object</code>
* [.fade_start()](#module_lib/mscript..Mscript+fade_start) * [.parent_loop()](#Mscript+parent_loop) ⇒ <code>object</code>
* [.fade_end()](#module_lib/mscript..Mscript+fade_end) * [.loop_count()](#Mscript+loop_count) ⇒ <code>integer</code>
* [.update()](#module_lib/mscript..Mscript+update) * [.fade(line)](#Mscript+fade)
* [.str_to_arr()](#module_lib/mscript..Mscript+str_to_arr) * [.fade_count(str)](#Mscript+fade_count)
* [.light_to_arr()](#module_lib/mscript..Mscript+light_to_arr) * [.fade_start(str)](#Mscript+fade_start) ⇒ <code>array</code>
* [.light_state()](#module_lib/mscript..Mscript+light_state) * [.fade_end(str)](#Mscript+fade_end) ⇒ <code>array</code>
* [.fail()](#module_lib/mscript..Mscript+fail) * [.fade_rgb(start, end, len, x)](#Mscript+fade_rgb) ⇒ <code>array</code>
* [.rgb(str)](#Mscript+rgb)
* [.rgb_str(arr)](#Mscript+rgb_str) ⇒ <code>string</code>
* [.update(cmd)](#Mscript+update)
* [.str_to_arr(str, cmd)](#Mscript+str_to_arr) ⇒ <code>array</code>
* [.light_to_arr(str, cmd)](#Mscript+light_to_arr) ⇒ <code>array</code>
* [.light_state(Color)](#Mscript+light_state)
* [.delay(line)](#Mscript+delay)
* [.alert(line)](#Mscript+alert)
* [.pause(line)](#Mscript+pause)
* [.fail(msg)](#Mscript+fail)
* [.contains(arr, arr2)](#Mscript+contains) ⇒ <code>boolean</code>
<a name="module_lib/mscript..Mscript+clear"></a> <a name="Mscript+clear"></a>
#### mscript.clear() ### mscript.clear()
Clear the state of the script Clear the state of the script
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+interpret"></a> <a name="Mscript+interpret"></a>
#### mscript.interpret() ### mscript.interpret(text, callback)<code>object</code>
Main function, accepts multi-line string, parses into lines Main function, accepts multi-line string, parses into lines
and interprets the instructions from the text. Returns an array and interprets the instructions from the text. Returns an array
of steps to be fed into the mcopy. of steps to be fed into the mcopy sequence.
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+basic_cmd"></a> **Returns**: <code>object</code> - if callback is not provided
#### mscript.basic\_cmd() | Param | Type | Default | Description |
Apply a basic two character command | --- | --- | --- | --- |
| text | <code>string</code> | | Mscript text to interpret |
| callback | <code>function</code> | <code></code> | Function to call when string is interpreted |
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) <a name="Mscript+variable"></a>
<a name="module_lib/mscript..Mscript+new_loop"></a>
#### mscript.new\_loop() ### mscript.variable(line)
Interprets variables for complex sequence behavior.
TODO: Fully implement, add test coverage
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line containing a variable assignment |
<a name="Mscript+variable_replace"></a>
### mscript.variable\_replace(line) ⇒ <code>string</code>
Replace variable with value at time of interpretation
TODO: Implement this please
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
**Returns**: <code>string</code> - New string to be interpreted
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line containing variable to be replaced with value |
<a name="Mscript+basic_cmd"></a>
### mscript.basic\_cmd(line, short)
Interpret a basic two character command
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line of script to interpret |
| short | <code>string</code> | The short command to use |
<a name="Mscript+new_loop"></a>
### mscript.new\_loop(line, fade)
Start a new loop Start a new loop
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+end_loop"></a>
#### mscript.end\_loop() | Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line to evaluate as either loop or fade |
| fade | <code>boolean</code> | Flag as true if fade |
<a name="Mscript+end_loop"></a>
### mscript.end\_loop(line)
Close the most recent loop Close the most recent loop
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+move_cam"></a>
#### mscript.move\_cam() | Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line to interpret |
<a name="Mscript+move_cam"></a>
### mscript.move\_cam(line)
Move camera to explicitly-defined frame Move camera to explicitly-defined frame
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+move_proj"></a>
#### mscript.move\_proj() | Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line to interpret with camera move statement |
<a name="Mscript+move_cam2"></a>
### mscript.move\_cam2(line)
Move secondary camera to explicitly-defined frame
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line to interpret with camera move statement |
<a name="Mscript+move_proj"></a>
### mscript.move\_proj(line)
Move projector to explicitly-defined frame Move projector to explicitly-defined frame
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+set_state"></a>
#### mscript.set\_state() | Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line containing `move` statement to interpret |
<a name="Mscript+move_proj2"></a>
### mscript.move\_proj2(line)
Move projector to explicitly-defined frame
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line containing `move` statement to interpret |
<a name="Mscript+set_state"></a>
### mscript.set\_state(line)
Set the state of either the cam or projector Set the state of either the cam or projector
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+last_loop"></a>
#### mscript.last\_loop() | Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | String containing set statement |
<a name="Mscript+last_loop"></a>
### mscript.last\_loop() ⇒ <code>object</code>
Return the last loop Return the last loop
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+parent_loop"></a> <a name="Mscript+parent_loop"></a>
#### mscript.parent\_loop() ### mscript.parent\_loop()<code>object</code>
Return the second-last loop Return the second-last loop
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+loop_count"></a> **Returns**: <code>object</code> - Loop array
<a name="Mscript+loop_count"></a>
#### mscript.loop\_count() ### mscript.loop\_count()<code>integer</code>
Extract the loop count integer from a LOOP cmd Extract the loop count integer from a LOOP cmd
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+fade"></a> **Returns**: <code>integer</code> - Loop count in string parsed into integer
<a name="Mscript+fade"></a>
#### mscript.fade() ### mscript.fade(line)
Execute a fade of frame length, from color to another color Execute a fade of frame length, from color to another color
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+fade_count"></a>
#### mscript.fade\_count() | Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | Line containing a fade initiator |
<a name="Mscript+fade_count"></a>
### mscript.fade\_count(str)
Extract the fade length integer from a FADE cmd Extract the fade length integer from a FADE cmd
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+fade_start"></a>
#### mscript.fade\_start() | Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | Line containing the length of fade in frames |
<a name="Mscript+fade_start"></a>
### mscript.fade\_start(str) ⇒ <code>array</code>
Extract the start color from a string Extract the start color from a string
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+fade_end"></a> **Returns**: <code>array</code> - Array containing RGB color values
#### mscript.fade\_end() | Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | Line containing the start color value in a fade initiator |
<a name="Mscript+fade_end"></a>
### mscript.fade\_end(str) ⇒ <code>array</code>
Extract the end color from a string Extract the end color from a string
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+update"></a> **Returns**: <code>array</code> - Array containing RGB color values
#### mscript.update() | Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | Line containing the end color value in a fade initiator |
<a name="Mscript+fade_rgb"></a>
### mscript.fade\_rgb(start, end, len, x) ⇒ <code>array</code>
Determine the state of a fade at a particular frame in the sequence, x
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
**Returns**: <code>array</code> - Array containing RGB color values
| Param | Type | Description |
| --- | --- | --- |
| start | <code>array</code> | Color the fade starts at |
| end | <code>array</code> | Color the fade finishes at |
| len | <code>integer</code> | Total length of the fade in frames |
| x | <code>integer</code> | Position of the fade to get color value of |
<a name="Mscript+rgb"></a>
### mscript.rgb(str)
Parse string into array of RGB color values. 0-255 octet.
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String containing only color values as `#,#,#` |
<a name="Mscript+rgb_str"></a>
### mscript.rgb\_str(arr) ⇒ <code>string</code>
Cast RGB color values as string
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
**Returns**: <code>string</code> - String of RGB values
| Param | Type | Description |
| --- | --- | --- |
| arr | <code>array</code> | Array to join into string |
<a name="Mscript+update"></a>
### mscript.update(cmd)
Increase the state of a specific object, such as the camera/projector, Increase the state of a specific object, such as the camera/projector,
by the value defined in val by the value defined in val.
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+str_to_arr"></a>
#### mscript.str\_to\_arr() | Param | Type | Description |
Split string on command, extract any integers from string | --- | --- | --- |
| cmd | <code>string</code> | String representing command to interpret and update state |
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) <a name="Mscript+str_to_arr"></a>
<a name="module_lib/mscript..Mscript+light_to_arr"></a>
#### mscript.light\_to\_arr() ### mscript.str\_to\_arr(str, cmd) ⇒ <code>array</code>
Split string on command, turn into array of commands
as long as count variable. Default 1.
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
**Returns**: <code>array</code> - Array containing commands
| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String to split |
| cmd | <code>string</code> | String representing command to split at |
<a name="Mscript+light_to_arr"></a>
### mscript.light\_to\_arr(str, cmd) ⇒ <code>array</code>
Split a string on a command to extract data for light array Split a string on a command to extract data for light array
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+light_state"></a> **Returns**: <code>array</code> - An RGB array containing the color values
#### mscript.light\_state() | Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | String containing light command |
| cmd | <code>string</code> | String representing command |
<a name="Mscript+light_state"></a>
### mscript.light\_state(Color)
Split a string to extract an rgb color value Split a string to extract an rgb color value
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..Mscript+fail"></a>
#### mscript.fail() | Param | Type | Description |
| --- | --- | --- |
| Color | <code>string</code> | string assign to color property |
<a name="Mscript+delay"></a>
### mscript.delay(line)
Interpret a delay command
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | String containing delay command |
<a name="Mscript+alert"></a>
### mscript.alert(line)
Interpret an alert command
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | String containing alert message |
<a name="Mscript+pause"></a>
### mscript.pause(line)
Interpret an pause command
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
| Param | Type | Description |
| --- | --- | --- |
| line | <code>string</code> | String containing alert message |
<a name="Mscript+fail"></a>
### mscript.fail(msg)
Throw an error with specific message Throw an error with specific message
**Kind**: instance method of [<code>Mscript</code>](#module_lib/mscript..Mscript) **Kind**: instance method of [<code>Mscript</code>](#Mscript)
<a name="module_lib/mscript..startsWith"></a>
### lib/mscript~startsWith() | Param | Type | Description |
| --- | --- | --- |
| msg | <code>string</code> | Error message to print |
<a name="Mscript+contains"></a>
### mscript.contains(arr, arr2) ⇒ <code>boolean</code>
Determine if array contains matching elements of
another array
**Kind**: instance method of [<code>Mscript</code>](#Mscript)
**Returns**: <code>boolean</code> - Whether arr contains elements in arr2
| Param | Type | Description |
| --- | --- | --- |
| arr | <code>Array</code> | Original array to compare |
| arr2 | <code>Array</code> | Array to compare elements from |
<a name="startsWith"></a>
## startsWith(str, target, position) ⇒ <code>boolean</code>
startswith function from lodash, do not want the entire lib for this startswith function from lodash, do not want the entire lib for this
**Kind**: inner method of [<code>lib/mscript</code>](#module_lib/mscript) **Kind**: global function
**Returns**: <code>boolean</code> - True for match, false for no match
| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | Text to evaluate |
| target | <code>string</code> | Text to compare string against |
| position | <code>integer</code> | Position in the string to make comparison at |

View File

View File

@ -1,6 +1,7 @@
/** class representing the Projector features **/ /** class representing the Projector features **/
import type { Arduino } from 'arduino'; import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout'; import type { FilmOut } from 'filmout';
import type { Config } from 'cfg';
import type { WebContents } from 'electron'; import type { WebContents } from 'electron';
interface ProjectorState { interface ProjectorState {
pos: number; pos: number;
@ -18,7 +19,7 @@ export declare class Projector {
/** /**
* *
**/ **/
constructor(arduino: Arduino, cfg: any, ui: WebContents, filmout: any, second?: boolean); constructor(arduino: Arduino, cfg: Config, ui: WebContents, filmout: FilmOut, second?: boolean);
/** /**
* *
**/ **/

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/proj/index.ts"],"names":[],"mappings":";AAAA,iDAAiD;;;AAEjD,uCAAmC;AACnC,6BAA0B;AAW1B,MAAa,SAAS;IAarB;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAgB,EAAE,OAAa,EAAE,SAAmB,KAAK;QAf7F,UAAK,GAAoB;YAC/B,GAAG,EAAG,CAAC;YACP,GAAG,EAAG,IAAI;SACV,CAAC;QACK,YAAO,GAAa,IAAI,CAAC;QAIxB,QAAG,GAAoB,kBAAO,CAAC;QAE/B,OAAE,GAAY,WAAW,CAAC;QAMjC,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,MAAM;YAAE,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC;QACjC,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,CAAA;QACzC,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,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;IAED;;QAEI;IACG,KAAK,CAAC,GAAG,CAAE,GAAa,EAAE,EAAW;QAC3C,IAAI,GAAY,CAAC;QACjB,IAAI,EAAW,CAAC;QAChB,IAAI,GA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G,EAAE;gBACnB,OAAO,IAAI,UAAU,CAAA;aACrB;iBAAM;gBACN,OAAO,IAAI,SAAS,CAAA;aACpB;YACD,OAAO,IAAI,UAAU,CAAA;SACrB;aAAM,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;YACnD,OAAO,IAAI,oCAAoC,CAAA;SAC/C;QACD,OAAO,IAAI,IAAI,EAAE,IAAI,CAAA;QACrB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QACnC,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;QAC5C,OAAO,EAAE,CAAA;IACV,CAAC;CACD;AA/JD,8BA+JC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,SAAS,EAAE,CAAA"}

View File

@ -0,0 +1,22 @@
<a name="module_lib/sequencer"></a>
## lib/sequencer
* [lib/sequencer](#module_lib/sequencer)
* [~Create a new sequencer and assign command and UI as private sub-classes](#module_lib/sequencer..Create a new sequencer and assign command and UI as private sub-classes)
* [new Create a new sequencer and assign command and UI as private sub-classes(cfg, cmd, ui)](#new_module_lib/sequencer..Create a new sequencer and assign command and UI as private sub-classes_new)
<a name="module_lib/sequencer..Create a new sequencer and assign command and UI as private sub-classes"></a>
### lib/sequencer~Create a new sequencer and assign command and UI as private sub-classes
**Kind**: inner class of [<code>lib/sequencer</code>](#module_lib/sequencer)
<a name="new_module_lib/sequencer..Create a new sequencer and assign command and UI as private sub-classes_new"></a>
#### new Create a new sequencer and assign command and UI as private sub-classes(cfg, cmd, ui)
| Param | Type | Description |
| --- | --- | --- |
| cfg | <code>object</code> | Configuration object |
| cmd | <code>object</code> | Shared command class |
| ui | <code>object</code> | Electron UI, browser window |

View File

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

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,10 @@
## Functions ## Functions
<dl> <dl>
<dt><a href="#dependencies">dependencies(platform)</a></dt> <dt><a href="#dependencies">dependencies(platform)</a><code>object</code></dt>
<dd><p>Evaluates system dependencies for digital <dd><p>Evaluates system dependencies for digital
projector features by executing processes with projector features by executing <code>which</code> on binary.
--help flag. If they do not exist, log to console</p> If they do not exist, log to console</p>
</dd> </dd>
<dt><a href="#system">system()</a><code>object</code></dt> <dt><a href="#system">system()</a><code>object</code></dt>
<dd><p>Profile the current system and return an object with <dd><p>Profile the current system and return an object with
@ -15,12 +15,13 @@ projector feature.</p>
<a name="dependencies"></a> <a name="dependencies"></a>
## dependencies(platform) ## dependencies(platform)<code>object</code>
Evaluates system dependencies for digital Evaluates system dependencies for digital
projector features by executing processes with projector features by executing `which` on binary.
--help flag. If they do not exist, log to console If they do not exist, log to console
**Kind**: global function **Kind**: global function
**Returns**: <code>object</code> - Object containing path to dependency from `which`, if they exist
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |

View File

@ -46,12 +46,12 @@ let capper;
let alert; let alert;
let server; let server;
const cfg = require('./data/cfg.json'); const cfg = require('./data/cfg.json');
var createMenu = function () { function createMenu() {
const template = require('./data/menu.json'); const template = require('./data/menu.json');
menu = electron_1.Menu.buildFromTemplate(template); menu = electron_1.Menu.buildFromTemplate(template);
electron_1.Menu.setApplicationMenu(menu); electron_1.Menu.setApplicationMenu(menu);
}; }
var createWindow = function () { function createWindow() {
const windowOptions = { const windowOptions = {
width: 800, width: 800,
height: 600, height: 600,
@ -79,7 +79,7 @@ var createWindow = function () {
mainWindow = null; mainWindow = null;
}); });
require('@electron/remote/main').enable(mainWindow.webContents); require('@electron/remote/main').enable(mainWindow.webContents);
}; }
var errorState = function () { var errorState = function () {
if (seq && seq.isRunning()) { if (seq && seq.isRunning()) {
//pause sequence if running //pause sequence if running

View File

@ -1 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAAoF;AACpF,mCAAqC;AACrC,+BAA2B;AAC3B,uCAAmC;AACnC,mCAA+B;AAG/B,6BAAyB;AAEzB,qCAAiC;AACjC,6BAA4B;AAC5B,+BAAgC;AAChC,iCAA6B;AAC7B,mCAA+B;AAC/B,iCAA6B;AAC7B,qCAAiC;AACjC,qCAAiC;AACjC,mCAA+B;AAC/B,qCAAiC;AACjC,qCAAiC;AACjC,6BAA8B;AAC9B,yCAAqC;AACrC,mCAA+B;AAE/B,OAAO,CAAC,uBAAuB,CAAC,CAAC,UAAU,EAAE,CAAA;AAE7C,MAAM,EAAE,GAAkB,IAAI,qBAAY,EAAE,CAAA;AAE5C,SAAS;AACT,MAAM,KAAK,GAAS,EAAE,CAAA;AAEtB,IAAI,MAAe,CAAA;AACnB,IAAI,QAAmB,CAAA;AACvB,IAAI,GAAY,CAAA;AAChB,IAAI,UAA0B,CAAA;AAC9B,IAAI,OAAiB,CAAA;AACrB,IAAI,IAAI,CAAA;AACR,IAAI,OAAiB,CAAA;AACrB,IAAI,MAAe,CAAA;AACnB,IAAI,OAAiB,CAAA;AACrB,IAAI,GAAY,CAAA;AAChB,IAAI,IAAa,CAAA;AACjB,IAAI,IAAgB,CAAA;AACpB,IAAI,KAAiB,CAAA;AACrB,IAAI,KAAa,CAAA;AACjB,IAAI,OAAiB,CAAA;AACrB,IAAI,GAAa,CAAA;AACjB,IAAI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A;IAClE,cAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACZ,CAAC,CAAA"}

2
app/package-lock.json generated
View File

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

View File

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

View File

@ -14,5 +14,7 @@ npm run compile
# compile LESS and pack javascript # compile LESS and pack javascript
npm run gulp npm run gulp
npm run test
# start app with dev flag # start app with dev flag
./node_modules/.bin/electron main.js -d ./node_modules/.bin/electron main.js -d

View File

@ -1,7 +1,8 @@
const assert = require('assert') const assert = require('assert')
const settings = require('settings') const { Settings } = require('settings')
const settings = new Settings()
describe('settings module', async () => { describe('settings module', async () => {
it('should be an object', () =>{ it('should be an object', () =>{
assert.equal(typeof settings, 'object') assert.equal(typeof settings, 'object')

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.112", "version": "1.8.113",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

13
package-lock.json generated
View File

@ -1,18 +1,19 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.8.112", "version": "1.8.113",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "mcopy", "name": "mcopy",
"version": "1.8.112", "version": "1.8.113",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"alert": "file:app/lib/alert", "alert": "file:app/lib/alert",
"arduino": "file:app/lib/arduino", "arduino": "file:app/lib/arduino",
"cam": "file:app/lib/cam", "cam": "file:app/lib/cam",
"capper": "file:app/lib/capper", "capper": "file:app/lib/capper",
"cfg": "file:app/lib/cfg",
"cmd": "file:app/lib/cmd", "cmd": "file:app/lib/cmd",
"delay": "file:app/lib/delay", "delay": "file:app/lib/delay",
"devices": "file:app/lib/devices", "devices": "file:app/lib/devices",
@ -58,6 +59,7 @@
"license": "ISC" "license": "ISC"
}, },
"app/lib/capper": {}, "app/lib/capper": {},
"app/lib/cfg": {},
"app/lib/cmd": { "app/lib/cmd": {
"version": "1.0.0", "version": "1.0.0",
"license": "ISC" "license": "ISC"
@ -969,6 +971,10 @@
"node": ">= 10" "node": ">= 10"
} }
}, },
"node_modules/cfg": {
"resolved": "app/lib/cfg",
"link": true
},
"node_modules/cmd": { "node_modules/cmd": {
"resolved": "app/lib/cmd", "resolved": "app/lib/cmd",
"link": true "link": true
@ -3388,6 +3394,9 @@
"lodash": "^4.17.15" "lodash": "^4.17.15"
} }
}, },
"cfg": {
"version": "file:app/lib/cfg"
},
"cmd": { "cmd": {
"version": "file:app/lib/cmd" "version": "file:app/lib/cmd"
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.8.112", "version": "1.8.113",
"description": "Small gauge film optical printer platform", "description": "Small gauge film optical printer platform",
"main": "build.js", "main": "build.js",
"directories": { "directories": {
@ -42,6 +42,7 @@
"arduino": "file:app/lib/arduino", "arduino": "file:app/lib/arduino",
"cam": "file:app/lib/cam", "cam": "file:app/lib/cam",
"capper": "file:app/lib/capper", "capper": "file:app/lib/capper",
"cfg": "file:app/lib/cfg",
"cmd": "file:app/lib/cmd", "cmd": "file:app/lib/cmd",
"delay": "file:app/lib/delay", "delay": "file:app/lib/delay",
"devices": "file:app/lib/devices", "devices": "file:app/lib/devices",

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.112", "version": "1.8.113",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

View File

@ -4,6 +4,8 @@ mkdir -p lib
./node_modules/.bin/tsc -p tsconfig.json --extendedDiagnostics ./node_modules/.bin/tsc -p tsconfig.json --extendedDiagnostics
npm run docs
#electron-build fails when local modules are in parent directory #electron-build fails when local modules are in parent directory
#copy them into lib directory #copy them into lib directory
cp -r ./lib/* ./app/lib/ cp -r ./lib/* ./app/lib/

View File

@ -3,6 +3,9 @@
libs="./lib/*" libs="./lib/*"
for l in $libs for l in $libs
do do
if [ -f "${l}" ]; then
continue
fi
echo "Generating documentation for $l" echo "Generating documentation for $l"
./node_modules/.bin/jsdoc2md $l/index.js > $l/Readme.md ./node_modules/.bin/jsdoc2md $l/index.js > $l/Readme.md
done done

View File

@ -4,7 +4,7 @@ import { ipcMain } from 'electron';
import { delay } from 'delay'; import { delay } from 'delay';
import { Log } from 'log'; import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { WebContents } from 'electron'; import type { WebContents, IpcMainEvent } from 'electron';
/* class representing alert functionality */ /* class representing alert functionality */
@ -38,7 +38,7 @@ export class Alert {
/** /**
* *
**/ **/
private async listener (event : any, arg : any) { private async listener (event : IpcMainEvent, arg : any) {
if (this.cb !== null) { if (this.cb !== null) {
try { try {
await this.cb(arg.state, arg.id) await this.cb(arg.state, arg.id)
@ -53,12 +53,12 @@ export class Alert {
* *
**/ **/
public async start (cmd : string) : Promise<number> { public async start (cmd : string) : Promise<number> {
const start = +new Date(); const start : number = +new Date();
const msg : string = (cmd + '').replace('ALERT', '').replace('Alert', '').replace('alert', '').trim() const msg : string = (cmd + '').replace('ALERT', '').replace('Alert', '').replace('alert', '').trim()
this.ui.send(this.id, { msg }) this.ui.send(this.id, { msg })
return new Promise(function (resolve : Function, reject : Function) { return new Promise(function (resolve : Function, reject : Function) {
this.cb = function () { this.cb = function () {
const ms = (+new Date()) - start; const ms : number = (+new Date()) - start;
return resolve(ms); return resolve(ms);
} }
}.bind(this)); }.bind(this));

View File

@ -13,16 +13,15 @@
* *
**/ **/
//import Log = require('log');
import { delay } from 'delay'; import { delay } from 'delay';
import { Log } from 'log'; import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { Device } from 'devices'; import type { Device } from 'devices';
import type { EventEmitter } from 'events' import type { EventEmitter } from 'events'
import type { Config } from 'cfg';
const { SerialPort } = require('serialport'); const { SerialPort } = require('serialport');
const { ReadlineParser } = require('@serialport/parser-readline'); const { ReadlineParser } = require('@serialport/parser-readline');
const exec = require('child_process').exec;
const parser : any = new ReadlineParser({ delimiter: '\r\n' }); const parser : any = new ReadlineParser({ delimiter: '\r\n' });
const newlineRe : RegExp = new RegExp('\n', 'g'); const newlineRe : RegExp = new RegExp('\n', 'g');
@ -47,7 +46,7 @@ export class Arduino {
private log : Logger; private log : Logger;
private eventEmitter : EventEmitter; private eventEmitter : EventEmitter;
private cfg : any = {}; private cfg : Config;
private path : any = {}; private path : any = {};
private known : string[] = KNOWN; private known : string[] = KNOWN;
private serial : any = {}; private serial : any = {};
@ -64,7 +63,7 @@ export class Arduino {
public stateStr : any = {}; public stateStr : any = {};
public hasState : any = {}; public hasState : any = {};
constructor ( cfg : any, ee : EventEmitter, errorState : Function) { constructor ( cfg : Config, ee : EventEmitter, errorState : Function) {
this.cfg = cfg; this.cfg = cfg;
this.eventEmitter = ee; this.eventEmitter = ee;
this.errorState = errorState; this.errorState = errorState;
@ -149,13 +148,13 @@ export class Arduino {
* @returns {Promise<boolean|string>} Returns 'false' if the communication is locked, otherwise returns the response from the device. * @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. * @throws {Error} Throws an error if the sendAsync method encounters an error.
**/ **/
public async send (device : string, cmd : string) : Promise<any> { public async send (device : string, cmd : string) : Promise<number> {
const serial : any = this.alias[device] const serial : any = this.alias[device]
let ms : number let ms : number
this.log.info(`send ${cmd} -> ${device}`) this.log.info(`send ${cmd} -> ${device}`)
if (this.isLocked(serial)) { if (this.isLocked(serial)) {
this.log.warn(`send Serial ${serial} is locked`) this.log.error(`send Serial ${serial} is locked`)
return null return 0
} }
this.timer = new Date().getTime() this.timer = new Date().getTime()
this.lock(serial) this.lock(serial)
@ -164,7 +163,7 @@ export class Arduino {
ms = await this.sendAsync(device, cmd) ms = await this.sendAsync(device, cmd)
} catch (e) { } catch (e) {
this.log.error(`Failed to send to ${device} @ ${serial}`, e) this.log.error(`Failed to send to ${device} @ ${serial}`, e)
return null return 0
} }
this.unlock(serial) this.unlock(serial)
@ -183,8 +182,8 @@ export class Arduino {
* @returns {Promise<boolean|string>} Returns 'true' if the string is sent successfully, otherwise returns an error message. * @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. * @throws {Error} Throws an error if the writeAsync method encounters an error.
**/ **/
public async sendString (device : string, str : string) : Promise<any> { public async sendString (device : string, str : string) : Promise<number> {
let writeSuccess : any let ms : number
await delay(this.cfg.arduino.serialDelay) await delay(this.cfg.arduino.serialDelay)
if (typeof this.serial[this.alias[device]].fake !== 'undefined' if (typeof this.serial[this.alias[device]].fake !== 'undefined'
&& this.serial[this.alias[device]].fake) { && this.serial[this.alias[device]].fake) {
@ -192,13 +191,13 @@ export class Arduino {
} else { } else {
this.log.info(`sendString ${str} -> ${device}`) this.log.info(`sendString ${str} -> ${device}`)
try { try {
writeSuccess = await this.writeAsync(device, str) ms = await this.writeAsync(device, str)
} catch (e) { } catch (e) {
this.log.error(`Error sending string to ${device}`, e) this.log.error(`Error sending string to ${device}`, e)
return null return 0
} }
this.unlock(this.alias[device]) this.unlock(this.alias[device])
return writeSuccess return ms
} }
} }

View File

@ -8,7 +8,8 @@ import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { Arduino } from 'arduino'; import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout'; import type { FilmOut } from 'filmout';
import type { WebContents } from 'electron'; import type { Config } from 'cfg';
import type { WebContents, IpcMainEvent } from 'electron';
interface CameraState{ interface CameraState{
pos : number, pos : number,
@ -27,7 +28,7 @@ export class Camera {
private intval : Intval = null; private intval : Intval = null;
private processing : Processing = null; private processing : Processing = null;
private log : Logger; private log : Logger;
private cfg : any; private cfg : Config;
private filmout : FilmOut; private filmout : FilmOut;
private ui : WebContents; private ui : WebContents;
private ipc : typeof ipcMain = ipcMain; private ipc : typeof ipcMain = ipcMain;
@ -35,7 +36,7 @@ export class Camera {
/** /**
* *
**/ **/
constructor (arduino : Arduino, cfg : any, ui : WebContents, filmout : FilmOut, second : boolean = false) { constructor (arduino : Arduino, cfg : Config, ui : WebContents, filmout : FilmOut, second : boolean = false) {
this.arduino = arduino; this.arduino = arduino;
this.cfg = cfg; this.cfg = cfg;
this.ui = ui; this.ui = ui;
@ -226,12 +227,12 @@ export class Camera {
/** /**
* *
**/ **/
private async connectIntval (event : any, arg : any) { private async connectIntval (event : IpcMainEvent, arg : any) {
return new Promise((resolve, reject) => { return new Promise((resolve : Function, reject : Function) => {
if (arg.connect) { if (arg.connect) {
this.intval = new Intval(arg.url) this.intval = new Intval(arg.url)
this.processing = null this.processing = null
this.intval.connect((err : any, ms : number, state : boolean) => { this.intval.connect((err : Error, ms : number, state : boolean) => {
if (err) { if (err) {
this.ui.send('intval', { connected : false }) this.ui.send('intval', { connected : false })
this.log.info(`Cannot connect to ${arg.url}`, 'INTVAL') this.log.info(`Cannot connect to ${arg.url}`, 'INTVAL')
@ -252,7 +253,7 @@ export class Camera {
/** /**
* *
**/ **/
private async connectProcessing (event : any, arg : any) { private async connectProcessing (event : IpcMainEvent, arg : any) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.processing = new Processing(arg.url) this.processing = new Processing(arg.url)
this.intval = null this.intval = null
@ -264,7 +265,7 @@ export class Camera {
/** /**
* *
**/ **/
private async listener (event : any, arg : any) { private async listener (event : IpcMainEvent, arg : any) {
if (typeof arg.dir !== 'undefined') { if (typeof arg.dir !== 'undefined') {
try { try {
await this.set(arg.dir, arg.id) await this.set(arg.dir, arg.id)
@ -299,7 +300,7 @@ export class Camera {
* *
**/ **/
private async end (cmd : string, id : string, ms : number) { private async end (cmd : string, id : string, ms : number) {
let message = ''; let message : string = '';
if (cmd === this.cfg.arduino.cmd.camera_forward) { if (cmd === this.cfg.arduino.cmd.camera_forward) {
message = 'Camera set to FORWARD'; message = 'Camera set to FORWARD';
} else if (cmd === this.cfg.arduino.cmd.camera_backward) { } else if (cmd === this.cfg.arduino.cmd.camera_backward) {

View File

@ -8,17 +8,21 @@ import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { FilmOut } from 'filmout'; import type { FilmOut } from 'filmout';
import type { Arduino } from 'arduino'; import type { Arduino } from 'arduino';
import type { WebContents } from 'electron'; import type { Config } from 'cfg';
import type { WebContents, IpcMainEvent } from 'electron';
interface CapperState {
capper : boolean
}
/** class representing capper functions **/ /** class representing capper functions **/
export class Capper { export class Capper {
private state : any = { private state : CapperState = {
capper : false capper : false
}; };
private arduino : Arduino = null; private arduino : Arduino = null;
private log : Logger; private log : Logger;
private cfg : any; private cfg : Config;
private filmout : FilmOut; private filmout : FilmOut;
private ui : WebContents; private ui : WebContents;
private ipc : typeof ipcMain = ipcMain; private ipc : typeof ipcMain = ipcMain;
@ -76,7 +80,7 @@ export class Capper {
/** /**
* *
**/ **/
private async listener (event : any, arg : any) { private async listener (event : IpcMainEvent, arg : any) {
if (typeof arg.state !== 'undefined') { if (typeof arg.state !== 'undefined') {
try { try {
await this.capper(arg.state, arg.id); await this.capper(arg.state, arg.id);
@ -102,9 +106,10 @@ export class Capper {
message += ` ${ms}ms`; message += ` ${ms}ms`;
this.log.info(message); 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; return ms;
} }
} }
module.exports = { Capper } module.exports = { Capper }
export type { CapperState }

44
src/cfg/index.ts Normal file
View File

@ -0,0 +1,44 @@
interface ConfigCommands {
[key:string] : string
}
interface ConfigDeviceProfile {
time : number,
delay : number,
momentary : number
}
interface ConfigBlackProfile {
before : number,
after : number
}
interface ConfigProfile {
label : string,
cam : ConfigDeviceProfile,
proj? : ConfigDeviceProfile,
black? : ConfigBlackProfile,
light : boolean
}
interface ConfigProfiles {
[key:string] : ConfigProfile
}
interface ConfigArduino extends ConfigProfile {
baud : number,
board : string,
serialDelay : number,
sequenceDelay : number,
cmd : ConfigCommands
}
interface Config {
version : string,
ext_port : number,
profiles : ConfigProfiles,
cmd : ConfigCommands,
arduino : any
}
export type { Config }

View File

@ -8,6 +8,7 @@ import type { Camera } from 'cam';
import type { Light } from 'light'; import type { Light } from 'light';
import type { Capper } from 'capper'; import type { Capper } from 'capper';
import type { Alert } from 'alert'; import type { Alert } from 'alert';
import type { Config } from 'cfg';
export class Commands { export class Commands {
public proj : Projector; public proj : Projector;
@ -21,7 +22,7 @@ export class Commands {
public alertObj : Alert; public alertObj : Alert;
private cfg : any; private cfg : Config;
private ipc : typeof ipcMain = ipcMain; private ipc : typeof ipcMain = ipcMain;
/** /**
@ -39,7 +40,7 @@ export class Commands {
* *
**/ **/
constructor (cfg : any, proj : Projector, cam : any, light : Light, alert : Alert, cam2 : any = null, proj2 : Projector = null, capper : any = null) { constructor (cfg : Config, proj : Projector, cam : Camera, light : Light, alert : Alert, cam2 : Camera = null, proj2 : Projector = null, capper : Capper = null) {
this.cfg = cfg; this.cfg = cfg;
this.proj = proj; this.proj = proj;
this.cam = cam; this.cam = cam;

View File

@ -6,7 +6,7 @@ import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { Settings } from 'settings'; import type { Settings } from 'settings';
import type { Arduino } from 'arduino'; import type { Arduino } from 'arduino';
import type { BrowserWindow, WebContents } from 'electron'; import type { BrowserWindow, WebContents, IpcMainEvent } from 'electron';
interface Device { interface Device {
serial : string; serial : string;
@ -22,13 +22,13 @@ interface Device {
export class Devices { export class Devices {
public settings : Settings; public settings : Settings;
public connected : any = {} public connected : any = {};
private arduino : Arduino; private arduino : Arduino;
private log : Logger; private log : Logger;
private ui : WebContents; private ui : WebContents;
private ipc : typeof ipcMain = ipcMain; private ipc : typeof ipcMain = ipcMain;
private mainWindow : any private mainWindow : BrowserWindow;
/** /**
* Constructor assigns arduino, settings, UI browser window and cam objects * Constructor assigns arduino, settings, UI browser window and cam objects
* locally to this class for reference. * locally to this class for reference.
@ -58,7 +58,7 @@ export class Devices {
* The "profile" channel callback. If a profile is changed, set it in the * The "profile" channel callback. If a profile is changed, set it in the
* local settings object. * local settings object.
**/ **/
private async listener (event : any, arg : any){ private async listener (event : IpcMainEvent, arg : any){
if (typeof arg.profile !== 'undefined') { if (typeof arg.profile !== 'undefined') {
this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false); this.log.info(`Saving profile ${arg.profile}`, 'SETTINGS', false, false);
this.settings.update('profile', arg.profile); this.settings.update('profile', arg.profile);

View File

@ -160,7 +160,7 @@ class WebView {
export class Display { export class Display {
private platform : string; private platform : string;
private displays : SystemDisplay[]; private displays : SystemDisplay[];
private display : any; private display : SystemDisplay;
private tmpdir : string; private tmpdir : string;
private wv : WebView; private wv : WebView;
@ -168,7 +168,7 @@ export class Display {
this.platform = sys.platform; this.platform = sys.platform;
this.displays = sys.displays; this.displays = sys.displays;
this.tmpdir = pathJoin(sys.tmp, 'mcopy_digital'); this.tmpdir = pathJoin(sys.tmp, 'mcopy_digital');
this.display = this.displays.find((display : any) => { this.display = this.displays.find((display : SystemDisplay) => {
if (display.primary) return true; if (display.primary) return true;
}) })
} }

View File

@ -8,10 +8,14 @@ import { exec } from 'exec';
import { spawn } from 'child_process'; import { spawn } from 'child_process';
import { Log } from 'log'; import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { ChildProcessWithoutNullStreams } from 'child_process';
import Frame from 'frame'; import { Frame } from 'frame';
import type { FilmOutState } from 'filmout'; import type { FilmOutState } from 'filmout';
import type { System } from 'system'; import type { System } from 'system';
import type { RGBA } from 'frame';
import type { ExecOutput } from 'exec';
import type { LightState } from 'light';
interface StdErr { interface StdErr {
@ -25,30 +29,6 @@ interface StdErr {
estimated? : number; estimated? : number;
} }
async function spawnAsync (bin : string, args : string[]) {
return new Promise((resolve : Function, reject : Function) => {
const child = spawn(bin, args);
let stdout = '';
let stderr = '';
child.on('exit', (code : number) => {
if (code === 0) {
return resolve({ stdout, stderr });
} else {
console.error(`Process exited with code: ${code}`);
console.error(stderr);
return reject(stderr);
}
});
child.stdout.on('data', (data : string) => {
stdout += data;
});
child.stderr.on('data', (data : string) => {
stderr += data;
});
return child;
});
}
/** @class FFMPEG **/ /** @class FFMPEG **/
export class FFMPEG { export class FFMPEG {
@ -56,7 +36,7 @@ export class FFMPEG {
private log : Logger; private log : Logger;
private id : string = 'ffmpeg'; private id : string = 'ffmpeg';
private TMPDIR : string; private TMPDIR : string;
private child : any; private child : ChildProcessWithoutNullStreams;
public onProgress : Function = () => {}; public onProgress : Function = () => {};
/** /**
@ -101,21 +81,30 @@ export class FFMPEG {
**/ **/
private parseStderr (line : string) : StdErr { private parseStderr (line : string) : StdErr {
//frame= 6416 fps= 30 q=31.0 size= 10251kB time=00:03:34.32 bitrate= 391.8kbits/s speed= 1x //frame= 6416 fps= 30 q=31.0 size= 10251kB time=00:03:34.32 bitrate= 391.8kbits/s speed= 1x
let obj : any = {}; const obj : StdErr = {
frame : 0,
fps : 0,
time : '',
speed : 0,
size : ''
};
let frameStr : string;
let fpsStr : string;
let speedStr : string;
if (line.substring(0, 'frame='.length) === 'frame=') { if (line.substring(0, 'frame='.length) === 'frame=') {
try { try {
obj.frame = line.split('frame=')[1].split('fps=')[0]; frameStr = line.split('frame=')[1].split('fps=')[0];
obj.frame = parseInt(obj.frame); obj.frame = parseInt(frameStr);
obj.fps = line.split('fps=')[1].split('q=')[0]; fpsStr = line.split('fps=')[1].split('q=')[0];
obj.fps = parseFloat(obj.fps); obj.fps = parseFloat(fpsStr);
obj.time = line.split('time=')[1].split('bitrate=')[0]; obj.time = line.split('time=')[1].split('bitrate=')[0];
obj.speed = line.split('speed=')[1].trim().replace('x', ''); speedStr = line.split('speed=')[1].trim().replace('x', '');
obj.speed = parseFloat(obj.speed); obj.speed = parseFloat(speedStr);
obj.size = line.split('size=')[1].split('time=')[0].trim(); obj.size = line.split('size=')[1].split('time=')[0].trim();
} catch (err) { } catch (err) {
console.error(err); this.log.error('Error parsing stderr line', err);
console.log(line); this.log.info(line);
process.exit(); process.exit();
} }
} else { } else {
@ -133,18 +122,18 @@ export class FFMPEG {
* *
* @returns {string} Path of frame * @returns {string} Path of frame
**/ **/
public async frame (state : FilmOutState, light : any) { public async frame (state : FilmOutState, light : LightState) {
const frameNum : number = state.frame; const frameNum : number = state.frame;
const video : string = state.directory ? state.files[frameNum] : state.path; const video : string = state.directory ? state.files[frameNum] : state.path;
const w : number = state.info.width; const w : number = state.info.width;
const h : number = state.info.height; const h : number = state.info.height;
const padded : string = this.padded_frame(frameNum); const padded : string = this.padded_frame(frameNum);
let ext : string = 'png'; let ext : string = 'png';
let rgb : any[] = light.color; let rgb : number[] = light.color;
let rgba : any = {}; let rgba : RGBA;
let tmpoutput : string; let tmpoutput : string;
let cmd : string; let cmd : string;
let output : any; let output : ExecOutput;
let fileExists : boolean = false; let fileExists : boolean = false;
let scale : string = ''; let scale : string = '';
@ -187,8 +176,8 @@ export class FFMPEG {
if (output && output.stdout) this.log.info(`"${output.stdout.trim()}"`); if (output && output.stdout) this.log.info(`"${output.stdout.trim()}"`);
if ( rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255 ) { if ( rgb[0] !== 255 || rgb[1] !== 255 || rgb[2] !== 255 ) {
rgb = rgb.map((e : string) => { rgb = rgb.map((e : number | string) => {
return parseInt(e); return typeof e === 'string' ? parseInt(e) : e;
}); });
rgba = { r : rgb[0], g : rgb[1], b : rgb[2], a : 255 }; rgba = { r : rgb[0], g : rgb[1], b : rgb[2], a : 255 };
@ -221,7 +210,7 @@ export class FFMPEG {
let ext : string = 'png'; let ext : string = 'png';
let tmpoutput : string = join(tmppath, `${state.hash}-export-%08d.${ext}`); let tmpoutput : string = join(tmppath, `${state.hash}-export-%08d.${ext}`);
let args : string[]; let args : string[];
let output : any; let output : ExecOutput;
let estimated : number = -1; let estimated : number = -1;
//cmd = `${this.bin} -y -i "${video}" -vf "${scale}" -compression_algo raw -pix_fmt rgb24 -crf 0 "${tmpoutput}"`; //cmd = `${this.bin} -y -i "${video}" -vf "${scale}" -compression_algo raw -pix_fmt rgb24 -crf 0 "${tmpoutput}"`;
@ -259,24 +248,24 @@ export class FFMPEG {
//ffmpeg -i "${video}" -compression_algo raw -pix_fmt rgb24 "${tmpoutput}" //ffmpeg -i "${video}" -compression_algo raw -pix_fmt rgb24 "${tmpoutput}"
return new Promise((resolve : Function, reject : Function) => { return new Promise((resolve : Function, reject : Function) => {
let stdout = ''; let stdout : string = '';
let stderr = ''; let stderr : string = '';
this.log.info(`${this.bin} ${args.join(' ')}`); this.log.info(`${this.bin} ${args.join(' ')}`);
this.child = spawn(this.bin, args); this.child = spawn(this.bin, args);
this.child.on('exit', (code : number) => { this.child.on('exit', function (code : number) {
//console.log('GOT TO EXIT'); //console.log('GOT TO EXIT');
if (code === 0) { if (code === 0) {
console.log(stderr); this.log.info(stderr);
console.log(stdout); this.log.info(stdout);
return resolve(true); return resolve(true);
} else { } else {
console.error(`Process exited with code: ${code}`); this.log.error(`Process exited with code: ${code}`);
console.error(stderr); this.log.error(stderr);
return reject(stderr + stdout); return reject(stderr + stdout);
} }
}); }.bind(this));
this.child.stdout.on('data', (data : any) => { this.child.stdout.on('data', (data : any) => {
const line : string = data.toString(); const line : string = data.toString();

View File

@ -7,7 +7,7 @@ import { readFile, lstat, readdir } from 'fs-extra';
import { delay } from 'delay'; import { delay } from 'delay';
import { createHash } from 'crypto'; import { createHash } from 'crypto';
import Jimp from 'jimp'; import Jimp from 'jimp';
import Frame from 'frame'; import { Frame } from 'frame';
import { Log } from 'log'; import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { Server } from 'server'; import type { Server } from 'server';
@ -15,7 +15,7 @@ import type { Display } from 'display';
import type { Light } from 'light'; import type { Light } from 'light';
import type { FFMPEG } from 'ffmpeg'; import type { FFMPEG } from 'ffmpeg';
import type { FFPROBE } from 'ffprobe'; import type { FFPROBE } from 'ffprobe';
import type { WebContents } from 'electron'; import type { WebContents, IpcMainEvent } from 'electron';
interface FilmOutState { interface FilmOutState {
hash : string, hash : string,
@ -184,7 +184,7 @@ export class FilmOut {
* *
* @returns {boolean} Success state * @returns {boolean} Success state
**/ **/
async onConnect (evt : any, arg : any) : Promise<boolean> { async onConnect (evt : IpcMainEvent, arg : any) : Promise<boolean> {
let frames : number = 0; let frames : number = 0;
let isAnimated : boolean = false; let isAnimated : boolean = false;
let info : any; let info : any;
@ -317,7 +317,7 @@ export class FilmOut {
* *
* @returns {any} UI send call * @returns {any} UI send call
*/ */
async onPreExport (evt : Event, arg : any) : Promise<any> { async onPreExport (evt : IpcMainEvent, arg : any) : Promise<any> {
if (!this.state.path) { if (!this.state.path) {
return await this.ui.send('pre_export', { complete : false, err : 'No file to pre export.' }); return await this.ui.send('pre_export', { complete : false, err : 'No file to pre export.' });
} }
@ -426,7 +426,7 @@ export class FilmOut {
* @param {object} evt Original event * @param {object} evt Original event
* @param {object} arg Arguments from message * @param {object} arg Arguments from message
**/ **/
async previewFrame (evt : any, arg : any) { async previewFrame (evt : IpcMainEvent, arg : any) {
const state : any = JSON.parse(JSON.stringify(this.state)); const state : any = JSON.parse(JSON.stringify(this.state));
let path : string; let path : string;
@ -447,7 +447,7 @@ export class FilmOut {
* @param {object} evt Original event * @param {object} evt Original event
* @param {object} arg Arguments from message * @param {object} arg Arguments from message
**/ **/
async preview (evt : any, arg : any) { async preview (evt : IpcMainEvent, arg : any) {
const state : any = JSON.parse(JSON.stringify(this.state)); const state : any = JSON.parse(JSON.stringify(this.state));
let path : string; let path : string;
@ -475,7 +475,7 @@ export class FilmOut {
/** /**
* *
**/ **/
async focus (evt : any, arg : any) { async focus (evt : IpcMainEvent, arg : any) {
this.log.info(`Showing focus screen`); this.log.info(`Showing focus screen`);
try { try {
if (await this.server.cmdAll('focus')) { if (await this.server.cmdAll('focus')) {
@ -490,7 +490,7 @@ export class FilmOut {
/** /**
* *
**/ **/
async field (evt : any, arg : any) { async field (evt : IpcMainEvent, arg : any) {
const ratio : number = arg.ratio; const ratio : number = arg.ratio;
this.log.info(`Showing field guide screen`); this.log.info(`Showing field guide screen`);
try { try {
@ -507,7 +507,7 @@ export class FilmOut {
/** /**
* *
**/ **/
async meter (evt : any, arg : any) { async meter (evt : IpcMainEvent, arg : any) {
this.log.info(`Showing meter screen`); this.log.info(`Showing meter screen`);
try { try {
if (await this.server.cmdAll('meter')) { if (await this.server.cmdAll('meter')) {
@ -522,7 +522,7 @@ export class FilmOut {
/** /**
* *
**/ **/
async close (evt : any, arg : any) { async close (evt : IpcMainEvent, arg : any) {
try { try {
if (await this.server.cmdAll('blank')) { if (await this.server.cmdAll('blank')) {
return return
@ -537,7 +537,7 @@ export class FilmOut {
/** /**
* *
**/ **/
onDisplay (evt : any, arg : any) { onDisplay (evt : IpcMainEvent, arg : any) {
this.display.change(arg.display); this.display.change(arg.display);
this.log.info(`Changing the display to ${arg.display}`); this.log.info(`Changing the display to ${arg.display}`);
} }

View File

@ -9,7 +9,7 @@ interface RGBA {
a : number; a : number;
} }
export default class Frame { export class Frame {
static async info (imagePath : string) { static async info (imagePath : string) {
let image : any; let image : any;
try { try {
@ -74,6 +74,6 @@ export default class Frame {
} }
} }
module.exports = Frame module.exports = { Frame }
export type { RGBA } export type { RGBA }

5
src/globals.d.ts vendored
View File

@ -4,8 +4,3 @@ declare module 'spawn';
declare module 'systeminformation'; declare module 'systeminformation';
declare module 'request'; declare module 'request';
declare module 'animated-gif-detector'; declare module 'animated-gif-detector';
interface Device {
serial : string;
device : string;
}

View File

@ -5,13 +5,18 @@ import { delay } from 'delay';
import { Log } from 'log'; import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { Arduino } from 'arduino'; import type { Arduino } from 'arduino';
import type { WebContents } from 'electron'; import type { Config } from 'cfg';
import type { WebContents, IpcMainEvent } from 'electron';
interface LightState {
color : number[]
}
export class Light { export class Light {
public state : any = { color : [0, 0, 0] } public state : LightState = { color : [0, 0, 0] }
private arduino : Arduino; private arduino : Arduino;
private cfg : any; private cfg : Config;
private ui : WebContents; private ui : WebContents;
private log : Logger; private log : Logger;
private ipc : typeof ipcMain = ipcMain; private ipc : typeof ipcMain = ipcMain;
@ -22,7 +27,7 @@ export class Light {
/** /**
* *
**/ **/
constructor (arduino : Arduino, cfg : any, ui : WebContents) { constructor (arduino : Arduino, cfg : Config, ui : WebContents) {
this.arduino = arduino; this.arduino = arduino;
this.cfg = cfg; this.cfg = cfg;
this.ui = ui; this.ui = ui;
@ -47,7 +52,7 @@ export class Light {
/** /**
* *
**/ **/
private async listener (event : any, arg : any) { private async listener (event : IpcMainEvent, arg : any) {
if (typeof arg.rgb !== 'undefined') { if (typeof arg.rgb !== 'undefined') {
try { try {
await this.set(arg.rgb, arg.id, true); await this.set(arg.rgb, arg.id, true);
@ -60,7 +65,6 @@ export class Light {
} else if (typeof arg.disable !== 'undefined') { } else if (typeof arg.disable !== 'undefined') {
this.enabled = false; this.enabled = false;
} }
return true;
} }
/** /**
@ -68,7 +72,7 @@ export class Light {
**/ **/
public async set (rgb : number[], id : string, on : boolean = true) { public async set (rgb : number[], id : string, on : boolean = true) {
const str : string = rgb.join(','); const str : string = rgb.join(',');
let ms : any; let ms : number;
this.state.color = rgb; this.state.color = rgb;
try { try {
@ -78,13 +82,14 @@ export class Light {
} }
await delay(1); await delay(1);
try { try {
this.arduino.sendString(this.id, str); ms += await this.arduino.sendString(this.id, str);
} catch (err) { } catch (err) {
this.log.error('Error sending light string', err); this.log.error('Error sending light string', err);
} }
await delay(1); await delay(1);
await ms; ms += 2;
return await this.end(rgb, id, ms); await this.end(rgb, id, ms);
return ms;
} }
/** /**
@ -92,17 +97,17 @@ export class Light {
**/ **/
private async end (rgb : number[], id : string, ms : number) { private async end (rgb : number[], id : string, ms : number) {
let res; let res;
//console.trace()
this.log.info(`Light set to ${rgb.join(',')}`, 'LIGHT', true, true); this.log.info(`Light set to ${rgb.join(',')}`, 'LIGHT', true, true);
try { try {
//console.dir({ rgb, id, ms })
res = await this.ui.send(this.id, { rgb, id, ms }); res = await this.ui.send(this.id, { rgb, id, ms });
} catch (err) { } catch (err) {
console.error(err); this.log.error(`Error ending light`, err);
throw err throw err
} }
return res; return res;
} }
} }
module.exports = { Light }; module.exports = { Light };
export type { LightState };

View File

@ -21,6 +21,7 @@ import { Devices } from 'devices'
import { Commands } from 'cmd' import { Commands } from 'cmd'
import { Sequencer } from 'sequencer' import { Sequencer } from 'sequencer'
import { Server } from 'server' import { Server } from 'server'
import type { Config } from 'cfg';
require('@electron/remote/main').initialize() require('@electron/remote/main').initialize()
@ -34,7 +35,7 @@ let settings : Settings
let log : Logger let log : Logger
let mainWindow : BrowserWindow let mainWindow : BrowserWindow
let arduino : Arduino let arduino : Arduino
let menu let menu : Menu
let display : Display let display : Display
let ffmpeg : FFMPEG let ffmpeg : FFMPEG
let ffprobe : FFPROBE let ffprobe : FFPROBE
@ -51,15 +52,15 @@ let capper : Capper
let alert : Alert let alert : Alert
let server : Server let server : Server
const cfg : any = require('./data/cfg.json') const cfg : Config = require('./data/cfg.json')
var createMenu = function () { function createMenu () {
const template = require('./data/menu.json') const template = require('./data/menu.json')
menu = Menu.buildFromTemplate(template) menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu) Menu.setApplicationMenu(menu)
} }
var createWindow = function () { function createWindow () {
const windowOptions : BrowserWindowConstructorOptions = { const windowOptions : BrowserWindowConstructorOptions = {
width: 800, width: 800,
height: 600, height: 600,

View File

@ -5,7 +5,8 @@ import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import type { Arduino } from 'arduino'; import type { Arduino } from 'arduino';
import type { FilmOut } from 'filmout'; import type { FilmOut } from 'filmout';
import type { WebContents } from 'electron'; import type { Config } from 'cfg';
import type { WebContents, IpcMainEvent } from 'electron';
interface ProjectorState { interface ProjectorState {
pos : number, pos : number,
@ -19,7 +20,7 @@ export class Projector {
}; };
public arduino : Arduino = null; public arduino : Arduino = null;
private log : Logger; private log : Logger;
private cfg : any; private cfg : Config;
private ui : WebContents; private ui : WebContents;
private ipc : typeof ipcMain = ipcMain; private ipc : typeof ipcMain = ipcMain;
public filmout : FilmOut; public filmout : FilmOut;
@ -28,7 +29,7 @@ export class Projector {
/** /**
* *
**/ **/
constructor (arduino : Arduino, cfg : any, ui : WebContents, filmout : any, second : boolean = false) { constructor (arduino : Arduino, cfg : Config, ui : WebContents, filmout : FilmOut, second : boolean = false) {
this.arduino = arduino; this.arduino = arduino;
this.cfg = cfg; this.cfg = cfg;
this.ui = ui; this.ui = ui;
@ -114,7 +115,7 @@ export class Projector {
/** /**
* *
**/ **/
private async listener (event : any, arg : any) { private async listener (event : IpcMainEvent, arg : any) {
if (typeof arg.dir !== 'undefined') { if (typeof arg.dir !== 'undefined') {
try { try {
await this.set(arg.dir, arg.id) await this.set(arg.dir, arg.id)

View File

@ -6,7 +6,8 @@ import { Log } from 'log';
import type { Logger } from 'winston'; import type { Logger } from 'winston';
import { delay } from 'delay'; import { delay } from 'delay';
import { Commands } from 'cmd'; import { Commands } from 'cmd';
import type { WebContents } from 'electron'; import type { Config } from 'cfg';
import type { WebContents, IpcMainEvent } from 'electron';
/** @module lib/sequencer **/ /** @module lib/sequencer **/
@ -22,7 +23,7 @@ export class Sequencer {
private arr : any[] = []; //store sequence from gui private arr : any[] = []; //store sequence from gui
private loops : number = 1; private loops : number = 1;
private cfg : any; private cfg : Config;
private cmd : Commands; private cmd : Commands;
private CMDS : any = {}; private CMDS : any = {};
private ipc : typeof ipcMain = ipcMain; private ipc : typeof ipcMain = ipcMain;
@ -41,7 +42,7 @@ export class Sequencer {
* @param {object} ui Electron UI, browser window * @param {object} ui Electron UI, browser window
**/ **/
constructor (cfg : any, cmd : Commands, ui : WebContents) { constructor (cfg : Config, cmd : Commands, ui : WebContents) {
this.cfg = cfg; this.cfg = cfg;
this.cmd = cmd; this.cmd = cmd;
this.ui = ui; this.ui = ui;
@ -87,7 +88,7 @@ export class Sequencer {
* @param {object} event IPC message event * @param {object} event IPC message event
* @param {object} arg Arguments provided in message * @param {object} arg Arguments provided in message
**/ **/
private async listener (event : any, arg : any) { private async listener (event : IpcMainEvent, arg : any) {
if (arg && arg.start) { if (arg && arg.start) {
this.start(arg); this.start(arg);
} else if (arg && arg.stop) { } else if (arg && arg.stop) {
@ -249,7 +250,7 @@ export class Sequencer {
* *
* @param {integer} x Step to execute command at * @param {integer} x Step to execute command at
**/ **/
private async step ( x: number) { private async step (x: number) {
try { try {
await this.cmdExec(x) await this.cmdExec(x)
} catch (err) { } catch (err) {