@signageos/front-applet 8.1.3 → 8.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js.map +1 -1
- package/docs/sos/browser.md +17 -17
- package/docs/sos/command.md +6 -6
- package/docs/sos/debug.md +7 -3
- package/docs/sos/deviceInfo.md +6 -2
- package/docs/sos/display.md +3 -3
- package/docs/sos/fileSystem.md +67 -67
- package/docs/sos/hardware/barcodeScanner.md +58 -15
- package/docs/sos/hardware/index.md +72 -15
- package/docs/sos/hardware/led.md +32 -3
- package/docs/sos/index.md +3 -3
- package/docs/sos/input.md +7 -7
- package/docs/sos/monitors.md +8 -0
- package/docs/sos/native/mdc.md +9 -9
- package/docs/sos/offline/cache.md +368 -28
- package/docs/sos/offline/index.md +127 -24
- package/docs/sos/osd.md +8 -1
- package/docs/sos/proofOfPlay.md +28 -0
- package/docs/sos/stream.md +78 -78
- package/docs/sos/sync.md +228 -21
- package/docs/sos/video.md +73 -73
- package/docs/sos_management/app.md +11 -11
- package/docs/sos_management/audio.md +3 -3
- package/docs/sos_management/firmware.md +11 -11
- package/docs/sos_management/index.md +9 -9
- package/docs/sos_management/network.md +10 -10
- package/docs/sos_management/package.md +6 -6
- package/docs/sos_management/power.md +27 -27
- package/docs/sos_management/screen.md +17 -17
- package/docs/sos_management/security.md +3 -3
- package/docs/sos_management/time.md +8 -8
- package/docs/sos_management/wifi.md +12 -12
- package/es6/FrontApplet/Debug/Debug.d.ts +1 -1
- package/es6/FrontApplet/Debug/Debug.js +1 -1
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.d.ts +6 -2
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.js +6 -2
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.js.map +1 -1
- package/es6/FrontApplet/Display/Display.d.ts +1 -1
- package/es6/FrontApplet/Display/Display.js +1 -1
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.d.ts +36 -8
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js +34 -2
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js.map +1 -1
- package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScanner.d.ts +5 -0
- package/es6/FrontApplet/Hardware/Hardware.d.ts +34 -5
- package/es6/FrontApplet/Hardware/Hardware.js +33 -5
- package/es6/FrontApplet/Hardware/Hardware.js.map +1 -1
- package/es6/FrontApplet/Hardware/ISerialPort.d.ts +17 -1
- package/es6/FrontApplet/Hardware/ISerialPortDataMessage.d.ts +3 -0
- package/es6/FrontApplet/Hardware/ISerialPortOptions.d.ts +6 -0
- package/es6/FrontApplet/Hardware/ISerialPortOptions.js +3 -0
- package/es6/FrontApplet/Hardware/ISerialPortOptions.js.map +1 -1
- package/es6/FrontApplet/Hardware/Led/Led.d.ts +19 -3
- package/es6/FrontApplet/Hardware/Led/Led.js +19 -3
- package/es6/FrontApplet/Hardware/Led/Led.js.map +1 -1
- package/es6/FrontApplet/Monitors/Monitors.d.ts +5 -0
- package/es6/FrontApplet/Monitors/Monitors.js +5 -0
- package/es6/FrontApplet/Monitors/Monitors.js.map +1 -1
- package/es6/FrontApplet/NativeCommands/MDC/INativeMdcCommands.d.ts +1 -0
- package/es6/FrontApplet/OSD/OSD.d.ts +5 -1
- package/es6/FrontApplet/OSD/OSD.js +5 -1
- package/es6/FrontApplet/OSD/OSD.js.map +1 -1
- package/es6/FrontApplet/Offline/Cache/Cache.d.ts +205 -28
- package/es6/FrontApplet/Offline/Cache/Cache.js +205 -28
- package/es6/FrontApplet/Offline/Cache/Cache.js.map +1 -1
- package/es6/FrontApplet/Offline/IAddFont.js.map +1 -1
- package/es6/FrontApplet/Offline/IFileType.js.map +1 -1
- package/es6/FrontApplet/Offline/ISaveFile.d.ts +3 -0
- package/es6/FrontApplet/Offline/ISaveFile.js.map +1 -1
- package/es6/FrontApplet/Offline/Offline.d.ts +58 -15
- package/es6/FrontApplet/Offline/Offline.js +56 -13
- package/es6/FrontApplet/Offline/Offline.js.map +1 -1
- package/es6/FrontApplet/ProofOfPlay/IRecordItemOptions.d.ts +3 -0
- package/es6/FrontApplet/ProofOfPlay/ProofOfPlay.d.ts +15 -1
- package/es6/FrontApplet/ProofOfPlay/ProofOfPlay.js +15 -1
- package/es6/FrontApplet/ProofOfPlay/ProofOfPlay.js.map +1 -1
- package/es6/FrontApplet/Sync/Sync.d.ts +101 -18
- package/es6/FrontApplet/Sync/Sync.js +84 -10
- package/es6/FrontApplet/Sync/Sync.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DEFAULT_SCANNER_ID = void 0;
|
|
4
4
|
const events_1 = require("events");
|
|
5
5
|
exports.DEFAULT_SCANNER_ID = 0;
|
|
6
|
+
/**
|
|
7
|
+
* The `sos.hardware.barcodeScanner` API provides methods for working with barcode scanners.
|
|
8
|
+
* It allows starting and stopping the scanner, as well as listening for scanned data and errors.
|
|
9
|
+
*
|
|
10
|
+
* :::note
|
|
11
|
+
* This API is experimental and may change in the future.
|
|
12
|
+
* :::
|
|
13
|
+
*/
|
|
6
14
|
class BarcodeScanner {
|
|
7
15
|
messagePrefix;
|
|
8
16
|
postMessage;
|
|
@@ -15,7 +23,11 @@ class BarcodeScanner {
|
|
|
15
23
|
this.eventEmitter = new events_1.EventEmitter();
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
|
-
*
|
|
26
|
+
* The `getVersion()` method returns the version of the barcode scanner.
|
|
27
|
+
*
|
|
28
|
+
* @returns {Promise<string>} Returns a promise that resolves to the version of the barcode scanner.
|
|
29
|
+
* @throws {Error} If the version cannot be retrieved.
|
|
30
|
+
* @since 3.0.0
|
|
19
31
|
*/
|
|
20
32
|
async getVersion() {
|
|
21
33
|
const { version } = await this.postMessage({
|
|
@@ -24,7 +36,27 @@ class BarcodeScanner {
|
|
|
24
36
|
return version;
|
|
25
37
|
}
|
|
26
38
|
/**
|
|
27
|
-
*
|
|
39
|
+
* The `start()` starts the barcode scanner and starts listening for scanned data.
|
|
40
|
+
* @param userOptions User options to configure the scanner.
|
|
41
|
+
* @param userOptions.timeout The maximum time to wait for a scan before timing out.
|
|
42
|
+
* @param userOptions.cancelPrevious If set to `true`, it will cancel any previous scanner instance with the same `scannerId`.
|
|
43
|
+
* @returns Returns a promise that resolves to an object with methods to stop the scanner and listen for scanned data and errors.
|
|
44
|
+
* @throws {Error} If the scanner cannot be started.
|
|
45
|
+
* @throws {Error} If the scanner is already running and `cancelPrevious` option is not set to `true`.
|
|
46
|
+
* @throws {Error} If any other error occurs while starting the scanner.
|
|
47
|
+
* @since 3.0.0
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Start the barcode scanner with default options
|
|
51
|
+
* const scanner = await sos.hardware.barcodeScanner.start();
|
|
52
|
+
* // Listen for scanned data
|
|
53
|
+
* scanner.onData((data) => {
|
|
54
|
+
* console.log(`Scanned data: ${data}`);
|
|
55
|
+
* });
|
|
56
|
+
* // Listen for errors
|
|
57
|
+
* scanner.onError((error) => {
|
|
58
|
+
* console.error(`Scanner error: ${error.message}`);
|
|
59
|
+
* });
|
|
28
60
|
*/
|
|
29
61
|
async start(userOptions) {
|
|
30
62
|
const defaultOptions = { scannerId: exports.DEFAULT_SCANNER_ID, timeout: 10000, cancelPrevious: false };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarcodeScanner.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAKzB,QAAA,kBAAkB,GAAG,CAAC,CAAC;AAEpC,MAAqB,cAAc;IAOzB;IACA;IAPF,MAAM,CAAC,cAAc,GAAsB,iBAAiB,CAAC;IAE5D,YAAY,CAAe;IAEnC,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB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c,GAAG,CAAC,SAAS,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;gBACtE,MAAM;YACP,QAAQ;QACT,CAAC;IACF,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5E,CAAC;;AA/FF,iCAgGC"}
|
|
@@ -4,6 +4,11 @@ export interface IBarcodeScannerOptions {
|
|
|
4
4
|
cancelPrevious?: boolean;
|
|
5
5
|
scannerId?: number;
|
|
6
6
|
}
|
|
7
|
+
export interface IBarcodeScannerResponse {
|
|
8
|
+
stop: () => Promise<void>;
|
|
9
|
+
onData: (listener: (data: string) => void) => void;
|
|
10
|
+
onError: (listener: (error: Error) => void) => void;
|
|
11
|
+
}
|
|
7
12
|
export default interface IBarcodeScanner {
|
|
8
13
|
getVersion(): Promise<string>;
|
|
9
14
|
start(userOptions?: Omit<IBarcodeScannerOptions, 'scannerId'>): Promise<{
|
|
@@ -7,7 +7,23 @@ import IBarcodeScannerDataMessage from './BarcodeScanner/IBarcodeScannerDataMess
|
|
|
7
7
|
import IHardware from './IHardware';
|
|
8
8
|
import ISerialPort from './ISerialPort';
|
|
9
9
|
/**
|
|
10
|
-
* The `sos.hardware` API groups together methods for working with hardware. It allows opening
|
|
10
|
+
* The `sos.hardware` API groups together methods for working with hardware. It allows opening serial ports, using bar scanner or controlling LEDs.
|
|
11
|
+
*
|
|
12
|
+
* :::warning
|
|
13
|
+
* - Before using this API, ensure that the display [supports](/sdk/sos/display#supports) serial via `sos.display.supports("SERIAL")`.
|
|
14
|
+
* - Samsung Kiosk serial connection only works over serial ports, not over USB ports.
|
|
15
|
+
* :::
|
|
16
|
+
*
|
|
17
|
+
* ### List of supported serial ports
|
|
18
|
+
* Bellow is example list of serial ports that can be used with `sos.hardware.openSerialPort()` method.
|
|
19
|
+
*
|
|
20
|
+
* | Device type | Default value | Other available values |
|
|
21
|
+
* |:----|:-----|:------|
|
|
22
|
+
* | RaspberryPi / Linux | `/dev/ttyS0` | `/dev/ttyS1`, `/dev/ttyUSB0`, `/dev/ttyUSB1` |
|
|
23
|
+
* | Windows | `COM3` | `COM1`, `COM2`, `COM4` etc. Usually it's always `COM3` |
|
|
24
|
+
* | Samsung Kiosk | `PORT1` | `PORT2`, `PORT3`, `PORT4` |
|
|
25
|
+
* | Android | `/dev/ttyusb0` | `/dev/ttyusb1`, `/dev/ttyusb2` |
|
|
26
|
+
* | BrightSign | `0` | `0` (Serial Jack as `/dev/ttyS0`), `1` (GPIO port as `/dev/ttyS1`), `USB:A/0` (USB-to-serial as `/dev/ttyUSB0`) |
|
|
11
27
|
*/
|
|
12
28
|
export default class Hardware implements IHardware {
|
|
13
29
|
private messagePrefix;
|
|
@@ -15,19 +31,32 @@ export default class Hardware implements IHardware {
|
|
|
15
31
|
static MESSAGE_PREFIX: string;
|
|
16
32
|
readonly led: Led;
|
|
17
33
|
barcodeScanner: BarcodeScanner;
|
|
18
|
-
private eventEmitter;
|
|
34
|
+
private readonly eventEmitter;
|
|
19
35
|
/** @internal */
|
|
20
36
|
constructor(messagePrefix: string, postMessage: IPostMessage<any>);
|
|
21
37
|
/**
|
|
22
|
-
* The `openSerialPort()` method opens a serial port for reading/writing. After the port is opened the method returns ISerialPort interface.
|
|
23
|
-
*
|
|
38
|
+
* The `openSerialPort()` method opens a serial port for reading/writing. After the port is opened the method returns {@link ISerialPort} interface.
|
|
39
|
+
*
|
|
40
|
+
* @param options.device Specifies the address of the external device, check the table above for ports.
|
|
24
41
|
* @param options.baudRate Specifies the data transmission speed in bits per second.
|
|
25
42
|
* @param options.parity Specifies the form of error checking, whether (or what) extra bits are added to a byte.
|
|
26
43
|
* @param options.databits Specifies the number of bits in a byte.
|
|
27
44
|
* @param options.stopbits Specifies the number of bits used to signal the end of a communication packet.
|
|
28
45
|
* @param options.rtscts Enables or disables RTS/CTS handshaking over the serial port. Currently supported by selected models of BrightSign.
|
|
46
|
+
* @returns Returns a promise that resolves to an instance of {@link ISerialPort} interface, which can be used to read/write data from/to the serial port.
|
|
47
|
+
* @throws {Error} If the serial port cannot be opened.
|
|
48
|
+
* @throws {Error} If the device address is not supported by the platform.
|
|
49
|
+
* @throws {Error} If the device fails to process the data.
|
|
50
|
+
* @throws {Error} If any other error occurs while opening the serial port.
|
|
51
|
+
* @since 4.4.0
|
|
29
52
|
*
|
|
30
|
-
* @
|
|
53
|
+
* @example
|
|
54
|
+
* // Open serial port on BrightSign with default settings
|
|
55
|
+
* const serialPort = await sos.hardware.openSerialPort({
|
|
56
|
+
* device: '0',
|
|
57
|
+
* baudRate: 9600,
|
|
58
|
+
* });
|
|
59
|
+
* serialPort.write('68656c6c6f'); // Write "hello" in hexadecimal
|
|
31
60
|
*/
|
|
32
61
|
openSerialPort(options: ISerialPortOptions): Promise<ISerialPort>;
|
|
33
62
|
/** @internal */
|
|
@@ -7,9 +7,24 @@ const events_1 = require("events");
|
|
|
7
7
|
const Led_1 = __importDefault(require("./Led/Led"));
|
|
8
8
|
const SerialPort_1 = __importDefault(require("./SerialPort"));
|
|
9
9
|
const BarcodeScanner_1 = __importDefault(require("./BarcodeScanner/BarcodeScanner"));
|
|
10
|
-
// TODO: add warnings from the old docs
|
|
11
10
|
/**
|
|
12
|
-
* The `sos.hardware` API groups together methods for working with hardware. It allows opening
|
|
11
|
+
* The `sos.hardware` API groups together methods for working with hardware. It allows opening serial ports, using bar scanner or controlling LEDs.
|
|
12
|
+
*
|
|
13
|
+
* :::warning
|
|
14
|
+
* - Before using this API, ensure that the display [supports](/sdk/sos/display#supports) serial via `sos.display.supports("SERIAL")`.
|
|
15
|
+
* - Samsung Kiosk serial connection only works over serial ports, not over USB ports.
|
|
16
|
+
* :::
|
|
17
|
+
*
|
|
18
|
+
* ### List of supported serial ports
|
|
19
|
+
* Bellow is example list of serial ports that can be used with `sos.hardware.openSerialPort()` method.
|
|
20
|
+
*
|
|
21
|
+
* | Device type | Default value | Other available values |
|
|
22
|
+
* |:----|:-----|:------|
|
|
23
|
+
* | RaspberryPi / Linux | `/dev/ttyS0` | `/dev/ttyS1`, `/dev/ttyUSB0`, `/dev/ttyUSB1` |
|
|
24
|
+
* | Windows | `COM3` | `COM1`, `COM2`, `COM4` etc. Usually it's always `COM3` |
|
|
25
|
+
* | Samsung Kiosk | `PORT1` | `PORT2`, `PORT3`, `PORT4` |
|
|
26
|
+
* | Android | `/dev/ttyusb0` | `/dev/ttyusb1`, `/dev/ttyusb2` |
|
|
27
|
+
* | BrightSign | `0` | `0` (Serial Jack as `/dev/ttyS0`), `1` (GPIO port as `/dev/ttyS1`), `USB:A/0` (USB-to-serial as `/dev/ttyUSB0`) |
|
|
13
28
|
*/
|
|
14
29
|
class Hardware {
|
|
15
30
|
messagePrefix;
|
|
@@ -27,15 +42,28 @@ class Hardware {
|
|
|
27
42
|
this.barcodeScanner = new BarcodeScanner_1.default(this.getMessagePrefix(), this.postMessage);
|
|
28
43
|
}
|
|
29
44
|
/**
|
|
30
|
-
* The `openSerialPort()` method opens a serial port for reading/writing. After the port is opened the method returns ISerialPort interface.
|
|
31
|
-
*
|
|
45
|
+
* The `openSerialPort()` method opens a serial port for reading/writing. After the port is opened the method returns {@link ISerialPort} interface.
|
|
46
|
+
*
|
|
47
|
+
* @param options.device Specifies the address of the external device, check the table above for ports.
|
|
32
48
|
* @param options.baudRate Specifies the data transmission speed in bits per second.
|
|
33
49
|
* @param options.parity Specifies the form of error checking, whether (or what) extra bits are added to a byte.
|
|
34
50
|
* @param options.databits Specifies the number of bits in a byte.
|
|
35
51
|
* @param options.stopbits Specifies the number of bits used to signal the end of a communication packet.
|
|
36
52
|
* @param options.rtscts Enables or disables RTS/CTS handshaking over the serial port. Currently supported by selected models of BrightSign.
|
|
53
|
+
* @returns Returns a promise that resolves to an instance of {@link ISerialPort} interface, which can be used to read/write data from/to the serial port.
|
|
54
|
+
* @throws {Error} If the serial port cannot be opened.
|
|
55
|
+
* @throws {Error} If the device address is not supported by the platform.
|
|
56
|
+
* @throws {Error} If the device fails to process the data.
|
|
57
|
+
* @throws {Error} If any other error occurs while opening the serial port.
|
|
58
|
+
* @since 4.4.0
|
|
37
59
|
*
|
|
38
|
-
* @
|
|
60
|
+
* @example
|
|
61
|
+
* // Open serial port on BrightSign with default settings
|
|
62
|
+
* const serialPort = await sos.hardware.openSerialPort({
|
|
63
|
+
* device: '0',
|
|
64
|
+
* baudRate: 9600,
|
|
65
|
+
* });
|
|
66
|
+
* serialPort.write('68656c6c6f'); // Write "hello" in hexadecimal
|
|
39
67
|
*/
|
|
40
68
|
async openSerialPort(options) {
|
|
41
69
|
const { refid } = await this.postMessage({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hardware.js","sourceRoot":"","sources":["../../../src/FrontApplet/Hardware/Hardware.ts"],"names":[],"mappings":";;;;;AAAA,mCAAsC;AAEtC,oDAA4B;AAC5B,8DAAsC;AAGtC,qFAA6D;AAK7D
|
|
1
|
+
{"version":3,"file":"Hardware.js","sourceRoot":"","sources":["../../../src/FrontApplet/Hardware/Hardware.ts"],"names":[],"mappings":";;;;;AAAA,mCAAsC;AAEtC,oDAA4B;AAC5B,8DAAsC;AAGtC,qFAA6D;AAK7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAqB,QAAQ;IAUnB;IACA;IAVF,MAAM,CAAC,cAAc,GAAW,UAAU,CAAC;IAElC,GAAG,CAAM;IAClB,cAAc,CAAiB;IAErB,YAAY,CAAe;IAE5C,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;QAEtC,IAAI,CAAC,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAC;QACvC,IAAI,CAAC,GAAG,GAAG,IAAI,aAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9D,IAAI,CAAC,cAAc,GAAG,IAAI,wBAAc,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACI,KAAK,CAAC,cAAc,CAAC,OAA2B;QACtD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YACxC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;YACzC,OAAO;SACP,CAAC,CAAC;QACH,OAAO,IAAI,oBAAU,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5F,CAAC;IAED,gBAAgB;IACT,iBAAiB,CAAC,IAAyD;QACjF,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;gBACvC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACpE,MAAM;YACP;gBACC,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAkC,CAAC,CAAC;QAC5E,CAAC;IACF,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,gBAAgB,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC;IAC7C,CAAC;IAEO,gBAAgB;QACvB,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC;IAC3D,CAAC;;AAnEF,2BAoEC"}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returned by sos.hardware.openSerialPort() method.
|
|
3
|
+
* This interface provides methods to read/write data from/to the serial port.
|
|
4
|
+
*/
|
|
1
5
|
export default interface ISerialPort {
|
|
2
6
|
/**
|
|
3
7
|
* The `onData()` method sets up a listener, which is called whenever new data are received. The listener will stop after the serial port
|
|
4
8
|
* is closed.
|
|
9
|
+
*
|
|
10
|
+
* @param listener A function that will be called with the received data as a Uint8Array.
|
|
11
|
+
* @returns {void} Returns when the listener is set up.
|
|
5
12
|
*/
|
|
6
13
|
onData(listener: (data: Uint8Array) => void): void;
|
|
7
14
|
/**
|
|
8
|
-
* The `write()` method writes data to the serial port. The data can be a string of hexadecimal digits, array of numbers or Uint8Array
|
|
15
|
+
* The `write()` method writes data to the serial port. The data can be a string of hexadecimal digits, array of numbers or Uint8Array.
|
|
16
|
+
*
|
|
17
|
+
* @param data The data to write to the serial port.
|
|
18
|
+
* @returns {Promise<void>} Returns a promise that resolves when the data is successfully written to the serial port.
|
|
19
|
+
* @throws {Error} If the data cannot be written to the serial port.
|
|
20
|
+
* @throws {Error} If the serial port is not open.
|
|
21
|
+
* @throws {Error} If any other error occurs while writing to the serial port.
|
|
9
22
|
*
|
|
10
23
|
* @example
|
|
11
24
|
* // serial port instance previously created via sos.hardware.openSerialPort()
|
|
@@ -16,6 +29,9 @@ export default interface ISerialPort {
|
|
|
16
29
|
write(data: string | number[] | Uint8Array): Promise<void>;
|
|
17
30
|
/**
|
|
18
31
|
* The `close()` method closes the serial port.
|
|
32
|
+
*
|
|
33
|
+
* @returns {Promise<void>} Returns a promise that resolves when the serial port is successfully closed.
|
|
34
|
+
* @throws {Error} If the serial port cannot be closed.
|
|
19
35
|
*/
|
|
20
36
|
close(): Promise<void>;
|
|
21
37
|
}
|
|
@@ -5,6 +5,12 @@ export declare enum Parity {
|
|
|
5
5
|
ODD = "odd",
|
|
6
6
|
SPACE = "space"
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Options for opening a serial port used by the `sos.hardware.openSerialPort()` method.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* All properties are optional except `baudRate`.
|
|
13
|
+
*/
|
|
8
14
|
interface ISerialPortOptions {
|
|
9
15
|
device?: string;
|
|
10
16
|
baudRate: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ISerialPortOptions.js","sourceRoot":"","sources":["../../../src/FrontApplet/Hardware/ISerialPortOptions.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAMX;AAND,WAAY,MAAM;IACjB,uBAAa,CAAA;IACb,uBAAa,CAAA;IACb,uBAAa,CAAA;IACb,qBAAW,CAAA;IACX,yBAAe,CAAA;AAChB,CAAC,EANW,MAAM,sBAAN,MAAM,QAMjB"}
|
|
1
|
+
{"version":3,"file":"ISerialPortOptions.js","sourceRoot":"","sources":["../../../src/FrontApplet/Hardware/ISerialPortOptions.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,MAMX;AAND,WAAY,MAAM;IACjB,uBAAa,CAAA;IACb,uBAAa,CAAA;IACb,uBAAa,CAAA;IACb,qBAAW,CAAA;IACX,yBAAe,CAAA;AAChB,CAAC,EANW,MAAM,sBAAN,MAAM,QAMjB"}
|
|
@@ -2,8 +2,11 @@ import IPostMessage from '../../IPostMessage';
|
|
|
2
2
|
import ISetColorMessage from './ISetColorMessage';
|
|
3
3
|
import ILed from './ILed';
|
|
4
4
|
/**
|
|
5
|
-
* The `sos.hardware.led` API groups together methods for controlling LEDs of the device.
|
|
6
|
-
*
|
|
5
|
+
* The `sos.hardware.led` API groups together methods for controlling LEDs of the device.
|
|
6
|
+
*
|
|
7
|
+
* :::warning
|
|
8
|
+
* This is currently only supported by Phillips devices.
|
|
9
|
+
* :::
|
|
7
10
|
*/
|
|
8
11
|
export default class Led implements ILed {
|
|
9
12
|
private messagePrefix;
|
|
@@ -12,7 +15,20 @@ export default class Led implements ILed {
|
|
|
12
15
|
/** @internal */
|
|
13
16
|
constructor(messagePrefix: string, postMessage: IPostMessage<ISetColorMessage>);
|
|
14
17
|
/**
|
|
15
|
-
* The `setColor()` methods sets the LED color
|
|
18
|
+
* The `setColor()` methods sets the LED color.
|
|
19
|
+
*
|
|
20
|
+
* @param color The color to set the LED to, in hexadecimal format (e.g. `#FF0000` for red). If `null`, it will turn off the LED.
|
|
21
|
+
* @returns {Promise<void>} Returns a promise that resolves when the color is successfully set.
|
|
22
|
+
* @throws {Error} If the color is not a valid hexadecimal string or is not a string at all.
|
|
23
|
+
* @throws {Error} If the LED cannot be controlled by the device.
|
|
24
|
+
* @throws {Error} If any other error occurs while setting the color.
|
|
25
|
+
* @since 4.4.0
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Set the LED color to red
|
|
29
|
+
* await sos.hardware.led.setColor('#FF0000');
|
|
30
|
+
* // Turn off the LED
|
|
31
|
+
* await sos.hardware.led.setColor(null);
|
|
16
32
|
*/
|
|
17
33
|
setColor(color: string | null): Promise<void>;
|
|
18
34
|
private checkColorValidity;
|
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const ErrorCodes_1 = __importDefault(require("../../Error/ErrorCodes"));
|
|
7
7
|
const Validate_1 = __importDefault(require("../../Validate/Validate"));
|
|
8
8
|
/**
|
|
9
|
-
* The `sos.hardware.led` API groups together methods for controlling LEDs of the device.
|
|
10
|
-
*
|
|
9
|
+
* The `sos.hardware.led` API groups together methods for controlling LEDs of the device.
|
|
10
|
+
*
|
|
11
|
+
* :::warning
|
|
12
|
+
* This is currently only supported by Phillips devices.
|
|
13
|
+
* :::
|
|
11
14
|
*/
|
|
12
15
|
class Led {
|
|
13
16
|
messagePrefix;
|
|
@@ -19,7 +22,20 @@ class Led {
|
|
|
19
22
|
this.postMessage = postMessage;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
|
-
* The `setColor()` methods sets the LED color
|
|
25
|
+
* The `setColor()` methods sets the LED color.
|
|
26
|
+
*
|
|
27
|
+
* @param color The color to set the LED to, in hexadecimal format (e.g. `#FF0000` for red). If `null`, it will turn off the LED.
|
|
28
|
+
* @returns {Promise<void>} Returns a promise that resolves when the color is successfully set.
|
|
29
|
+
* @throws {Error} If the color is not a valid hexadecimal string or is not a string at all.
|
|
30
|
+
* @throws {Error} If the LED cannot be controlled by the device.
|
|
31
|
+
* @throws {Error} If any other error occurs while setting the color.
|
|
32
|
+
* @since 4.4.0
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Set the LED color to red
|
|
36
|
+
* await sos.hardware.led.setColor('#FF0000');
|
|
37
|
+
* // Turn off the LED
|
|
38
|
+
* await sos.hardware.led.setColor(null);
|
|
23
39
|
*/
|
|
24
40
|
async setColor(color) {
|
|
25
41
|
this.checkColorValidity(color);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Led.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Hardware/Led/Led.ts"],"names":[],"mappings":";;;;;AAEA,wEAAgD;AAChD,uEAA+C;AAG/C
|
|
1
|
+
{"version":3,"file":"Led.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Hardware/Led/Led.ts"],"names":[],"mappings":";;;;;AAEA,wEAAgD;AAChD,uEAA+C;AAG/C;;;;;;GAMG;AACH,MAAqB,GAAG;IAKd;IACA;IALF,MAAM,CAAC,cAAc,GAAW,KAAK,CAAC;IAE7C,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA2C;QAD3C,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAgC;IACjD,CAAC;IAEJ;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,QAAQ,CAAC,KAAoB;QACzC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YAClC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI;SACzC,CAAC,CAAC;IACJ,CAAC;IAEO,kBAAkB,CAAC,KAAoB;QAC9C,IAAA,kBAAQ,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,oBAAU,CAAC,gCAAgC,CAAC,CAAC;QAC1F,IAAA,kBAAQ,EAAC,EAAE,KAAK,EAAE,CAAC;aACjB,SAAS,EAAE;aACX,WAAW,CAAC,qBAAqB,EAAE,oBAAU,CAAC,+BAA+B,CAAC,CAAC;IAClF,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC;IACnE,CAAC;;AA1CF,sBA2CC"}
|
|
@@ -2,6 +2,10 @@ import IPostMessage from '../IPostMessage';
|
|
|
2
2
|
import IMonitor, { IConnectedMonitor } from './IMonitor';
|
|
3
3
|
/**
|
|
4
4
|
* The `sos.monitors` API groups together methods for providing information about monitors connected to the device.
|
|
5
|
+
*
|
|
6
|
+
* :::note
|
|
7
|
+
* This API is available only on Linux devices.
|
|
8
|
+
* :::
|
|
5
9
|
*/
|
|
6
10
|
declare class Monitors implements IMonitor {
|
|
7
11
|
private messagePrefix;
|
|
@@ -12,6 +16,7 @@ declare class Monitors implements IMonitor {
|
|
|
12
16
|
/**
|
|
13
17
|
* The `getList()` method returns a list of monitors currently connected to the device.
|
|
14
18
|
*
|
|
19
|
+
* @returns {Promise<IConnectedMonitor[]>} A promise that resolves to an array of connected monitors.
|
|
15
20
|
* @since 4.0.0
|
|
16
21
|
*/
|
|
17
22
|
getList(): Promise<IConnectedMonitor[]>;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
4
|
* The `sos.monitors` API groups together methods for providing information about monitors connected to the device.
|
|
5
|
+
*
|
|
6
|
+
* :::note
|
|
7
|
+
* This API is available only on Linux devices.
|
|
8
|
+
* :::
|
|
5
9
|
*/
|
|
6
10
|
class Monitors {
|
|
7
11
|
messagePrefix;
|
|
@@ -15,6 +19,7 @@ class Monitors {
|
|
|
15
19
|
/**
|
|
16
20
|
* The `getList()` method returns a list of monitors currently connected to the device.
|
|
17
21
|
*
|
|
22
|
+
* @returns {Promise<IConnectedMonitor[]>} A promise that resolves to an array of connected monitors.
|
|
18
23
|
* @since 4.0.0
|
|
19
24
|
*/
|
|
20
25
|
async getList() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Monitors.js","sourceRoot":"","sources":["../../../src/FrontApplet/Monitors/Monitors.ts"],"names":[],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"Monitors.js","sourceRoot":"","sources":["../../../src/FrontApplet/Monitors/Monitors.ts"],"names":[],"mappings":";;AAGA;;;;;;GAMG;AACH,MAAM,QAAQ;IAKJ;IACA;IALF,MAAM,CAAC,cAAc,GAAW,UAAU,CAAC;IAElD,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IACpC,CAAC;IAEJ;;;;;OAKG;IACI,KAAK,CAAC,OAAO;QACnB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YAC3C,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;SACjC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,QAAQ,CAAC,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC;IACxE,CAAC;;AAGF,kBAAe,QAAQ,CAAC"}
|
|
@@ -2,4 +2,5 @@ import { IMDCResponse, IpAddressType } from './Mdc';
|
|
|
2
2
|
import { CodesMDC } from './CodesMDC';
|
|
3
3
|
export default interface INativeMdcCommands {
|
|
4
4
|
sendOne(ipAddress: IpAddressType, command: CodesMDC, data?: number[] | []): Promise<IMDCResponse>;
|
|
5
|
+
sendOneRaw(ipAddress: IpAddressType, data: number[] | []): Promise<IMDCResponse>;
|
|
5
6
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import IPostMessage from '../IPostMessage';
|
|
2
2
|
import IOSD from './IOSD';
|
|
3
3
|
/**
|
|
4
|
-
* The `sos.osd` API groups together methods for working with the OSD (On Screen Display).
|
|
4
|
+
* The `sos.osd` API groups together methods for working with the signageOS OSD (On Screen Display).
|
|
5
|
+
*
|
|
6
|
+
* More information about the OSD can be found in the [OSD Introduction](https://docs.signageos.io/hc/en-us/articles/4405231839890-OSD-menu-by-signageOS)
|
|
5
7
|
*/
|
|
6
8
|
export default class OSD implements IOSD {
|
|
7
9
|
private messagePrefix;
|
|
@@ -11,7 +13,9 @@ export default class OSD implements IOSD {
|
|
|
11
13
|
constructor(messagePrefix: string, postMessage: IPostMessage<any>);
|
|
12
14
|
/**
|
|
13
15
|
* The `showOSD()` method opens the OSD without typing the pin.
|
|
16
|
+
* Note: The OSD will be opened after 6 seconds.
|
|
14
17
|
*
|
|
18
|
+
* @returns {Promise<void>} A promise that resolves when the OSD is shown.
|
|
15
19
|
* @since 5.5.0
|
|
16
20
|
*/
|
|
17
21
|
showOSD(): Promise<void>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
|
-
* The `sos.osd` API groups together methods for working with the OSD (On Screen Display).
|
|
4
|
+
* The `sos.osd` API groups together methods for working with the signageOS OSD (On Screen Display).
|
|
5
|
+
*
|
|
6
|
+
* More information about the OSD can be found in the [OSD Introduction](https://docs.signageos.io/hc/en-us/articles/4405231839890-OSD-menu-by-signageOS)
|
|
5
7
|
*/
|
|
6
8
|
class OSD {
|
|
7
9
|
messagePrefix;
|
|
@@ -14,7 +16,9 @@ class OSD {
|
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* The `showOSD()` method opens the OSD without typing the pin.
|
|
19
|
+
* Note: The OSD will be opened after 6 seconds.
|
|
17
20
|
*
|
|
21
|
+
* @returns {Promise<void>} A promise that resolves when the OSD is shown.
|
|
18
22
|
* @since 5.5.0
|
|
19
23
|
*/
|
|
20
24
|
async showOSD() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OSD.js","sourceRoot":"","sources":["../../../src/FrontApplet/OSD/OSD.ts"],"names":[],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"OSD.js","sourceRoot":"","sources":["../../../src/FrontApplet/OSD/OSD.ts"],"names":[],"mappings":";;AAGA;;;;GAIG;AACH,MAAqB,GAAG;IAKd;IACA;IALF,MAAM,CAAC,cAAc,GAAW,KAAK,CAAC;IAE7C,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IACpC,CAAC;IAEJ;;;;;;OAMG;IACI,KAAK,CAAC,OAAO;QACnB,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;SACjC,CAAC,CAAC;IACJ,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC;IACnE,CAAC;;AAxBF,sBAyBC"}
|