@signageos/front-applet 8.1.2 → 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 +1 -1
- package/dist/bundle.js.map +1 -1
- package/docs/sos/browser.md +66 -14
- package/docs/sos/command.md +52 -6
- package/docs/sos/debug.md +21 -2
- package/docs/sos/deviceInfo.md +31 -0
- package/docs/sos/display.md +34 -3
- package/docs/sos/fileSystem.md +1135 -59
- 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 +42 -1
- package/docs/sos/monitors.md +8 -0
- package/docs/sos/native/mdc.md +69 -23
- package/docs/sos/offline/cache.md +376 -30
- 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/Browser/Browser.d.ts +25 -9
- package/es6/FrontApplet/Browser/Browser.js +25 -9
- package/es6/FrontApplet/Browser/Browser.js.map +1 -1
- package/es6/FrontApplet/Browser/IOpenLinkOptions.d.ts +7 -0
- package/es6/FrontApplet/Browser/IOpenLinkOptions.js.map +1 -1
- package/es6/FrontApplet/Browser/events.d.ts +6 -0
- package/es6/FrontApplet/Browser/events.js.map +1 -1
- package/es6/FrontApplet/Command/Command.d.ts +15 -6
- package/es6/FrontApplet/Command/Command.js +15 -6
- package/es6/FrontApplet/Command/Command.js.map +1 -1
- package/es6/FrontApplet/Command/ICommand.d.ts +7 -0
- package/es6/FrontApplet/Command/ICommandEvent.d.ts +6 -0
- package/es6/FrontApplet/Debug/Debug.d.ts +11 -3
- package/es6/FrontApplet/Debug/Debug.js +11 -3
- package/es6/FrontApplet/Debug/Debug.js.map +1 -1
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.d.ts +19 -0
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.js +20 -2
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.js.map +1 -1
- package/es6/FrontApplet/Display/Display.d.ts +22 -14
- package/es6/FrontApplet/Display/Display.js +22 -14
- package/es6/FrontApplet/Display/Display.js.map +1 -1
- package/es6/FrontApplet/Display/IDisplay.d.ts +4 -0
- package/es6/FrontApplet/FileSystem/FileSystem.d.ts +429 -41
- package/es6/FrontApplet/FileSystem/FileSystem.js +427 -39
- package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
- package/es6/FrontApplet/FileSystem/HashAlgorithm.d.ts +4 -1
- package/es6/FrontApplet/FileSystem/types.d.ts +46 -0
- package/es6/FrontApplet/FileSystem/types.js.map +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/Input/IKeyUpEvent.d.ts +9 -0
- package/es6/FrontApplet/Input/IKeyUpEvent.js +6 -0
- package/es6/FrontApplet/Input/IKeyUpEvent.js.map +1 -1
- package/es6/FrontApplet/Input/Input.d.ts +17 -1
- package/es6/FrontApplet/Input/Input.js +17 -1
- package/es6/FrontApplet/Input/Input.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/NativeCommands/MDC/Mdc.d.ts +32 -11
- package/es6/FrontApplet/NativeCommands/MDC/Mdc.js +14 -11
- package/es6/FrontApplet/NativeCommands/MDC/Mdc.js.map +1 -1
- 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
|
@@ -5,6 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const events_1 = require("events");
|
|
7
7
|
const Validate_1 = __importDefault(require("../Validate/Validate"));
|
|
8
|
+
/**
|
|
9
|
+
* The `sos.input` API groups together all input-related functionality, such as remote control key events. With this API, you can
|
|
10
|
+
* listen to key events from the remote control and handle them in your application.
|
|
11
|
+
*/
|
|
8
12
|
class Input {
|
|
9
13
|
window;
|
|
10
14
|
messagePrefix;
|
|
@@ -32,11 +36,19 @@ class Input {
|
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
|
-
* The `onKeyUp` method sets up a listeners, which is called on every
|
|
39
|
+
* The `onKeyUp` method sets up a listeners, which is called on every keystroke of the remote controller. For the specific logic of an
|
|
36
40
|
* application (games for example), binding the remote control inputs can be helpful. Only a subset of all remote control keys is
|
|
37
41
|
* supported on the specific device. Only numerical digits are guaranteed to be supported.
|
|
38
42
|
*
|
|
43
|
+
* :::note
|
|
39
44
|
* This feature must be tested by users on real devices.
|
|
45
|
+
* :::
|
|
46
|
+
*
|
|
47
|
+
* @param listener The listener function that will be called on every key up event.
|
|
48
|
+
* @returns {void} Resolves when the listener is successfully set up.
|
|
49
|
+
* @throws {Error} If listener is not valid function.
|
|
50
|
+
* @throws {Error} If listener is unregistered.
|
|
51
|
+
* @since 1.3.0
|
|
40
52
|
*/
|
|
41
53
|
onKeyUp(listener) {
|
|
42
54
|
this.checkAlive();
|
|
@@ -65,6 +77,10 @@ class Input {
|
|
|
65
77
|
}
|
|
66
78
|
/**
|
|
67
79
|
* The `removeEventListener()` method removes all event listeners for a specific event (only `keyup` is supported).
|
|
80
|
+
*
|
|
81
|
+
* @param event The name of the event to remove the listener for. Currently, only `keyup` is supported.
|
|
82
|
+
* @param listener The listener function to remove.
|
|
83
|
+
* @returns {void} Resolves when the listener is successfully removed.
|
|
68
84
|
*/
|
|
69
85
|
removeEventListener(event, listener) {
|
|
70
86
|
this.eventEmitter.removeListener(event, listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../src/FrontApplet/Input/Input.ts"],"names":[],"mappings":";;;;;AAAA,mCAAsC;AAGtC,oEAA4C;AAG5C,MAAqB,KAAK;IAUR;IACC;IAVX,MAAM,CAAU,cAAc,GAAW,OAAO,CAAC;IAEvC,YAAY,GAAiB,IAAI,qBAAY,EAAE,CAAC;IAChD,sBAAsB,GAAY,KAAK,CAAC;IAEjD,KAAK,GAAY,IAAI,CAAC;IAE9B,gBAAgB;IAChB,YACiB,MAAc,EACb,aAAqB;QADtB,WAAM,GAAN,MAAM,CAAQ;QACb,kBAAa,GAAb,aAAa,CAAQ;QAEtC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;YAC7D,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACnE,CAAC;IACF,CAAC;IAED,gBAAgB;IACT,OAAO;QACb,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;gBACjC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SAAS,CAAC;QAClB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,YAAY,EAAE,CAAC;gBAC/B,yEAAyE;gBACzE,8FAA8F;gBAC9F,yFAAyF;gBACzF,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;gBAClD,OAAO,KAAK,CAAC;YACd,CAAC;iBAAM,CAAC;gBACP,MAAM,CAAC,CAAC;YACT,CAAC;QACF,CAAC;IACF,CAAC;IAEO,qBAAqB,GAAG,CAAC,KAAoB,EAAE,EAAE;QACxD,IAAI,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9E,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,cAAc,EAAE,CAAC;gBACjC,0DAA0D;gBAC1D,oDAAoD;gBACpD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAClD,CAAC;iBAAM,CAAC;gBACP,MAAM,CAAC,CAAC;YACT,CAAC;QACF,CAAC;IACF,CAAC,CAAC;IAEM,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,KAAK,CAAC,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC;IACrE,CAAC;IAEO,UAAU;QACjB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC;;AAxIF,wBAyIC"}
|
|
@@ -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,25 +1,39 @@
|
|
|
1
1
|
import IPostMessage from '../../IPostMessage';
|
|
2
2
|
import { CodesMDC } from './CodesMDC';
|
|
3
3
|
import INativeMdcCommands from './INativeMdcCommands';
|
|
4
|
+
/**
|
|
5
|
+
* Type representing the IP address to which MDC commands can be sent.
|
|
6
|
+
* It can be either 'localhost' or a valid string representing an IP address.
|
|
7
|
+
*/
|
|
4
8
|
export type IpAddressType = 'localhost' | string;
|
|
9
|
+
/**
|
|
10
|
+
* Response object returned by Tizen Core App.
|
|
11
|
+
*/
|
|
5
12
|
export interface IMDCResponse {
|
|
13
|
+
/**
|
|
14
|
+
* The type of the response, either 'ACK' for acknowledgment or 'NACK' for negative acknowledgment.
|
|
15
|
+
*/
|
|
6
16
|
type: 'ACK' | 'NACK';
|
|
17
|
+
/**
|
|
18
|
+
* The command type that was executed, represented as a number.
|
|
19
|
+
* Should match the command number in {@link CodesMDC}.
|
|
20
|
+
*/
|
|
7
21
|
commandType: number;
|
|
22
|
+
/**
|
|
23
|
+
* The result of the command execution, represented as a number.
|
|
24
|
+
* This value can vary depending on the command executed.
|
|
25
|
+
*/
|
|
8
26
|
result: number;
|
|
9
27
|
}
|
|
10
28
|
/**
|
|
11
29
|
* The `sos.native.mdc` API groups together methods for controlling Tizen devices using MDC commands.
|
|
12
30
|
*
|
|
13
31
|
* :::warning
|
|
14
|
-
*
|
|
15
32
|
* This API is currently available on Tizen devices only.
|
|
16
|
-
*
|
|
17
33
|
* :::
|
|
18
34
|
*
|
|
19
35
|
* :::info
|
|
20
|
-
*
|
|
21
36
|
* You can ensure that the device supports MDC commands via `sos.management.supports("NATIVE_COMMANDS_MDC")`.
|
|
22
|
-
*
|
|
23
37
|
* :::
|
|
24
38
|
*/
|
|
25
39
|
export default class Mdc implements INativeMdcCommands {
|
|
@@ -32,18 +46,21 @@ export default class Mdc implements INativeMdcCommands {
|
|
|
32
46
|
* The `sendOne()` method sends an MDC command to another Tizen device on the same network or to the localhost.
|
|
33
47
|
*
|
|
34
48
|
* @param ipAddress The IP address of the device to send the command to.
|
|
35
|
-
* @param command The MDC command to send.
|
|
49
|
+
* @param command The MDC command to send {@link CodesMDC}.
|
|
36
50
|
* @param data The optional data to send with the command.
|
|
37
|
-
*
|
|
51
|
+
* @throws {Error} If the `ipAddress` is not a valid string or if the `command` is not a valid number.
|
|
52
|
+
* @throws {Error} If the `data` is not an array of numbers.
|
|
53
|
+
* @throws {Error} If any error occurs during the command execution.
|
|
54
|
+
* @returns {Promise<IMDCResponse>} MDC response object containing the result of the command execution.
|
|
38
55
|
* @since 6.5.1
|
|
39
56
|
*
|
|
40
57
|
* @example
|
|
41
|
-
* await sos.native.mdc.sendOne('localhost', CodesMDC.BRIGHTNESS_CONTROL);
|
|
42
|
-
* await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.VOLUME_CONTROL, [50]);
|
|
43
|
-
* await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.PICTURE_CONTROL, [0x54, 0x03]);
|
|
58
|
+
* await sos.native.mdc.sendOne('localhost', CodesMDC.BRIGHTNESS_CONTROL);
|
|
59
|
+
* await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.VOLUME_CONTROL, [50]);
|
|
60
|
+
* await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.PICTURE_CONTROL, [0x54, 0x03]);
|
|
44
61
|
*
|
|
45
62
|
* // You can also send custom number if we don't have predefined command in our enum
|
|
46
|
-
* await sos.native.mdc.sendOne('192.168.0.10', 0x01, []);
|
|
63
|
+
* await sos.native.mdc.sendOne('192.168.0.10', 0x01, []);
|
|
47
64
|
*/
|
|
48
65
|
sendOne(ipAddress: IpAddressType, command: CodesMDC, data?: number[]): Promise<IMDCResponse>;
|
|
49
66
|
/**
|
|
@@ -51,7 +68,11 @@ export default class Mdc implements INativeMdcCommands {
|
|
|
51
68
|
* but without explicitly specifying the command.
|
|
52
69
|
*
|
|
53
70
|
* @param ipAddress The IP address of the device to send the command to.
|
|
54
|
-
* @param data The data to send with the command.
|
|
71
|
+
* @param data The data as array of numbers to send with the command. It can be also empty array.
|
|
72
|
+
* @throws {Error} If the `ipAddress` is not a valid string or if the `command` is not a valid number.
|
|
73
|
+
* @throws {Error} If the `data` is not an array of numbers.
|
|
74
|
+
* @throws {Error} If any error occurs during the command execution.
|
|
75
|
+
* @returns {Promise<IMDCResponse>} MDC response object containing the result of the command execution.
|
|
55
76
|
*
|
|
56
77
|
* @since 6.5.1
|
|
57
78
|
*
|
|
@@ -8,15 +8,11 @@ const Validate_1 = __importDefault(require("../../Validate/Validate"));
|
|
|
8
8
|
* The `sos.native.mdc` API groups together methods for controlling Tizen devices using MDC commands.
|
|
9
9
|
*
|
|
10
10
|
* :::warning
|
|
11
|
-
*
|
|
12
11
|
* This API is currently available on Tizen devices only.
|
|
13
|
-
*
|
|
14
12
|
* :::
|
|
15
13
|
*
|
|
16
14
|
* :::info
|
|
17
|
-
*
|
|
18
15
|
* You can ensure that the device supports MDC commands via `sos.management.supports("NATIVE_COMMANDS_MDC")`.
|
|
19
|
-
*
|
|
20
16
|
* :::
|
|
21
17
|
*/
|
|
22
18
|
class Mdc {
|
|
@@ -32,18 +28,21 @@ class Mdc {
|
|
|
32
28
|
* The `sendOne()` method sends an MDC command to another Tizen device on the same network or to the localhost.
|
|
33
29
|
*
|
|
34
30
|
* @param ipAddress The IP address of the device to send the command to.
|
|
35
|
-
* @param command The MDC command to send.
|
|
31
|
+
* @param command The MDC command to send {@link CodesMDC}.
|
|
36
32
|
* @param data The optional data to send with the command.
|
|
37
|
-
*
|
|
33
|
+
* @throws {Error} If the `ipAddress` is not a valid string or if the `command` is not a valid number.
|
|
34
|
+
* @throws {Error} If the `data` is not an array of numbers.
|
|
35
|
+
* @throws {Error} If any error occurs during the command execution.
|
|
36
|
+
* @returns {Promise<IMDCResponse>} MDC response object containing the result of the command execution.
|
|
38
37
|
* @since 6.5.1
|
|
39
38
|
*
|
|
40
39
|
* @example
|
|
41
|
-
* await sos.native.mdc.sendOne('localhost', CodesMDC.BRIGHTNESS_CONTROL);
|
|
42
|
-
* await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.VOLUME_CONTROL, [50]);
|
|
43
|
-
* await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.PICTURE_CONTROL, [0x54, 0x03]);
|
|
40
|
+
* await sos.native.mdc.sendOne('localhost', CodesMDC.BRIGHTNESS_CONTROL);
|
|
41
|
+
* await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.VOLUME_CONTROL, [50]);
|
|
42
|
+
* await sos.native.mdc.sendOne('192.168.0.10', CodesMDC.PICTURE_CONTROL, [0x54, 0x03]);
|
|
44
43
|
*
|
|
45
44
|
* // You can also send custom number if we don't have predefined command in our enum
|
|
46
|
-
* await sos.native.mdc.sendOne('192.168.0.10', 0x01, []);
|
|
45
|
+
* await sos.native.mdc.sendOne('192.168.0.10', 0x01, []);
|
|
47
46
|
*/
|
|
48
47
|
async sendOne(ipAddress, command, data) {
|
|
49
48
|
(0, Validate_1.default)({ ipAddress }).required().string();
|
|
@@ -67,7 +66,11 @@ class Mdc {
|
|
|
67
66
|
* but without explicitly specifying the command.
|
|
68
67
|
*
|
|
69
68
|
* @param ipAddress The IP address of the device to send the command to.
|
|
70
|
-
* @param data The data to send with the command.
|
|
69
|
+
* @param data The data as array of numbers to send with the command. It can be also empty array.
|
|
70
|
+
* @throws {Error} If the `ipAddress` is not a valid string or if the `command` is not a valid number.
|
|
71
|
+
* @throws {Error} If the `data` is not an array of numbers.
|
|
72
|
+
* @throws {Error} If any error occurs during the command execution.
|
|
73
|
+
* @returns {Promise<IMDCResponse>} MDC response object containing the result of the command execution.
|
|
71
74
|
*
|
|
72
75
|
* @since 6.5.1
|
|
73
76
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mdc.js","sourceRoot":"","sources":["../../../../src/FrontApplet/NativeCommands/MDC/Mdc.ts"],"names":[],"mappings":";;;;;AACA,uEAA+C;
|
|
1
|
+
{"version":3,"file":"Mdc.js","sourceRoot":"","sources":["../../../../src/FrontApplet/NativeCommands/MDC/Mdc.ts"],"names":[],"mappings":";;;;;AACA,uEAA+C;AAgC/C;;;;;;;;;;GAUG;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;;;;;;;;;;;;;;;;;;;OAmBG;IACI,KAAK,CAAC,OAAO,CAAC,SAAwB,EAAE,OAAiB,EAAE,IAAe;QAChF,IAAA,kBAAQ,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MA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AG,CAAC,cAAc,CAAC;IACtD,CAAC;;AAzFF,sBA0FC"}
|
|
@@ -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"}
|
|
@@ -11,15 +11,14 @@ import IChecksumMessage from './IChecksumMessage';
|
|
|
11
11
|
import IOfflineCache from './IOfflineCache';
|
|
12
12
|
import { HashAlgorithm } from '../../FileSystem/HashAlgorithm';
|
|
13
13
|
/**
|
|
14
|
-
* The `sos.offline` API groups together methods used to download and save arbitrary files, which can be accessed even if the device is offline.
|
|
14
|
+
* The `sos.offline.cache` API groups together methods used to download and save arbitrary files, which can be accessed even if the device is offline.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* > Please refer to difference between `sos.offline.cache` and `sos.fileSystem` APIs in our [documentation](http://localhost:3000/sdk/sos/offline/).
|
|
17
17
|
*
|
|
18
|
+
* :::warning
|
|
18
19
|
* Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
19
|
-
*
|
|
20
20
|
* :::
|
|
21
21
|
*
|
|
22
|
-
* @tutorial https://developers.signageos.io/docs/applets/api-guides/offline-content#caching-audio-visual-content-or-arbitrary-data-sosofflinecache
|
|
23
22
|
*/
|
|
24
23
|
export default class Cache implements IOfflineCache {
|
|
25
24
|
private messagePrefix;
|
|
@@ -30,101 +29,279 @@ export default class Cache implements IOfflineCache {
|
|
|
30
29
|
/** @internal */
|
|
31
30
|
constructor(messagePrefix: string, postMessage: IPostMessage<ISavedFileMessage & ISavedContentMessage & ILoadedFileMessage & ILoadedContentMessage & IListedFilesMessage & IListedContentsMessage & IChecksumMessage & IValidatedChecksumMessage>);
|
|
32
31
|
/**
|
|
33
|
-
* The `listFiles()` method list all currently cached files.
|
|
32
|
+
* The `listFiles()` method list all currently cached files in internal storage, which was previously saved by `saveFile()` or `loadOrSaveFile()` methods.
|
|
34
33
|
*
|
|
34
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of unique identifiers (uids) of the saved files.
|
|
35
|
+
* @throws Error If any error occurs during listing files.
|
|
36
|
+
* @throws Error If the files cannot be listed.
|
|
35
37
|
* @since 2.0.0
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* await sos.offline.cache.saveFile('example-file.mp4', 'https://example.com/path/to/your/file.mp4');
|
|
41
|
+
* await sos.offline.cache.saveFile('another-file.jpg', 'https://example.com/path/to/your/image.jpg');
|
|
42
|
+
*
|
|
43
|
+
* // Later list the saved files
|
|
44
|
+
* const files = await sos.offline.cache.listFiles();
|
|
45
|
+
* console.log('Saved files:', files); // Output: Saved files: ['example-file.mp4', 'another-file.jpg']
|
|
36
46
|
*/
|
|
37
47
|
listFiles(): Promise<string[]>;
|
|
38
48
|
/**
|
|
39
49
|
* The `loadFile()` method loads cached file, which was previously saved by `saveFile()` or `loadOrSaveFile()` methods.
|
|
40
50
|
*
|
|
41
|
-
* @
|
|
42
|
-
*
|
|
51
|
+
* @param uid Unique identifier of the file to be loaded.
|
|
52
|
+
* @returns {Promise<IFile>} A promise that resolves to the loaded file.
|
|
53
|
+
* @throws Error If the uid is not a valid string.
|
|
54
|
+
* @throws Error If the uid does not exist
|
|
43
55
|
* @since 1.0.3
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Save a file
|
|
59
|
+
* await sos.offline.cache.saveFile('example-file.mp4', 'https://example.com/path/to/your/file.mp4');
|
|
60
|
+
* // Later load the file
|
|
61
|
+
* const file = await sos.offline.cache.loadFile('example-file.mp4');
|
|
62
|
+
* console.log('Loaded file:', file); // Output: Loaded file: { uid: 'example-file.mp4', uri: 'file://path/to/your/file.mp4' }
|
|
44
63
|
*/
|
|
45
64
|
loadFile(uid: string): Promise<IFile>;
|
|
46
65
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* :::warning
|
|
50
|
-
*
|
|
51
|
-
* `uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
66
|
+
* Method `saveFile()` is used to save files from remote a destination into the device internal memory.
|
|
52
67
|
*
|
|
68
|
+
* :::info
|
|
69
|
+
* - Local device file path differs from device to device. It can point to `file://` or `http://localhost` etc.
|
|
53
70
|
* :::
|
|
54
71
|
*
|
|
55
|
-
*
|
|
72
|
+
* :::warning
|
|
73
|
+
* - headers has to be a JSON object. If you are passing the value, make sure you use JSON.parse().
|
|
74
|
+
* - `uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
75
|
+
* :::
|
|
56
76
|
*
|
|
77
|
+
* @param uid Unique identifier of the file to be saved.
|
|
78
|
+
* @param uri URI of the file to be downloaded.
|
|
79
|
+
* @param headers Key, value pairs of HTTP headers to send along with the request. Used when the target file is protected by a password or if any other specific headers are needed to access it.
|
|
80
|
+
* @throws Error If the network request fails.
|
|
81
|
+
* @throws Error If the uid is not a valid string.
|
|
82
|
+
* @throws Error If the uri is not a valid URI.
|
|
83
|
+
* @throws Error File with the same uid is already cached.
|
|
84
|
+
* @throws Error If the headers are not a valid object with string values.
|
|
57
85
|
* @since 1.0.3
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* await sos.offline.cache.saveFile('example-file.mp4', 'https://example.com/path/to/your/file.mp4')
|
|
89
|
+
* .then(() => {
|
|
90
|
+
* console.log('File saved successfully');
|
|
91
|
+
* })
|
|
92
|
+
* .catch((error) => {
|
|
93
|
+
* console.error('Error saving file:', error);
|
|
94
|
+
* });
|
|
58
95
|
*/
|
|
59
96
|
saveFile(uid: string, uri: string, headers?: {
|
|
60
97
|
[key: string]: string;
|
|
61
98
|
}): Promise<void>;
|
|
62
99
|
/**
|
|
63
|
-
*
|
|
100
|
+
* Method `loadOrSaveFile()` is used for individual file retrieval & save in case when file is not saved in local storage yet. To get file from internal memory & save it when not yet exists we prepared `loadOrSaveFile()` method.
|
|
101
|
+
*
|
|
102
|
+
* :::info
|
|
103
|
+
* - The file URI has to return the file. If your URI leads to a 303 redirect (e.g. from http to https), the API will not work.
|
|
104
|
+
* - Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138).
|
|
105
|
+
* - Local device file path differs from device to device. It can point to `file://` or `http://localhost` etc.
|
|
106
|
+
* :::
|
|
107
|
+
*
|
|
108
|
+
* :::warning
|
|
109
|
+
* `uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file
|
|
110
|
+
* :::
|
|
64
111
|
*
|
|
112
|
+
* @param uid Unique identifier of the file to be loaded or saved.
|
|
113
|
+
* @param uri URI of the file to be downloaded if not cached.
|
|
114
|
+
* @param headers Key, value pairs of HTTP headers to send along with the request. Used when the target file is protected by a password or if any other specific headers are needed to access it.
|
|
115
|
+
* @returns {Promise<IFile>} A promise that resolves to the loaded or saved file.
|
|
116
|
+
* @throws Error If the uid is not a valid string.
|
|
117
|
+
* @throws Error If the uri is not a valid URI.
|
|
118
|
+
* @throws Error If the headers are not a valid object with string values.
|
|
119
|
+
* @throws Error If the file cannot be loaded or saved.
|
|
120
|
+
* @throws AppletOfflineCacheError If the headers are not valid.
|
|
65
121
|
* @since 1.0.9
|
|
122
|
+
* @example // {@link https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/offline-files | Example Applet with Offline Files}
|
|
123
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/video-loop-offline | Example Applet with Video Loop Offline}
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* await sos.offline.cache.loadOrSaveFile('example-file.mp4', 'https://example.com/path/to/your/file.mp4')
|
|
127
|
+
* .then((file) => {
|
|
128
|
+
* console.log('File loaded or saved:', file);
|
|
129
|
+
* })
|
|
130
|
+
* .catch((error) => {
|
|
131
|
+
* console.error('Error loading or saving file:', error);
|
|
132
|
+
* });
|
|
66
133
|
*/
|
|
67
134
|
loadOrSaveFile(uid: string, uri: string, headers?: {
|
|
68
135
|
[key: string]: string;
|
|
69
136
|
}): Promise<IFile>;
|
|
70
137
|
/**
|
|
71
|
-
* The `deleteFile()` method removes the file specified by `uid
|
|
138
|
+
* The `deleteFile()` method removes the file specified by `uid` from cache storage.
|
|
72
139
|
*
|
|
140
|
+
* @param uid Unique identifier of the file to be deleted.
|
|
141
|
+
* @returns {Promise<void>} A promise that resolves when the file is deleted.
|
|
142
|
+
* @throws Error If the uid is not a valid string.
|
|
143
|
+
* @throws Error If the uid is not found in the cache.
|
|
73
144
|
* @since 2.0.0
|
|
74
145
|
*
|
|
75
|
-
* @
|
|
146
|
+
* @example
|
|
147
|
+
* // Save a file
|
|
148
|
+
* await sos.offline.cache.saveFile('example-file.mp4', 'https://example.com/path/to/your/file.mp4');
|
|
149
|
+
* // Later delete the file
|
|
150
|
+
* await sos.offline.cache.deleteFile('example-file.mp4');
|
|
76
151
|
*/
|
|
77
152
|
deleteFile(uid: string): Promise<void>;
|
|
78
153
|
/**
|
|
79
154
|
* The `listContent()` method lists all values saved by `saveContent()` method.
|
|
80
155
|
*
|
|
156
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of saved content.
|
|
81
157
|
* @since 2.0.0
|
|
82
|
-
*
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* // Save some content and list all saved contents
|
|
161
|
+
* await sos.offline.cache.saveContent('ApplicationSecret', '123SuperSecretHash');
|
|
162
|
+
* await sos.offline.cache.saveContent('UserToken', 'abc123xyz');
|
|
163
|
+
*
|
|
164
|
+
* // Later list the saved contents
|
|
165
|
+
* const contents = await sos.offline.cache.listContents();
|
|
166
|
+
* console.log('Saved contents:', contents); // Output: Saved contents: ['ApplicationSecret', 'UserToken']
|
|
83
167
|
*/
|
|
84
168
|
listContents(): Promise<string[]>;
|
|
85
169
|
/**
|
|
86
170
|
* The `loadContent()` method gets the value specified by `uid`, which was previously saved by `saveContent()`.
|
|
87
171
|
*
|
|
172
|
+
* @param uid Unique identifier of the content to be loaded.
|
|
173
|
+
* @returns {Promise<string>} A promise that resolves to the loaded content.
|
|
174
|
+
* @throws Error If the uid does not exist.
|
|
175
|
+
* @throws Error If the uid is not a valid string.
|
|
176
|
+
* @throws Error If the content is not a valid string.
|
|
177
|
+
* @throws Error If any other error occurs during loading.
|
|
88
178
|
* @since 1.0.3
|
|
89
|
-
* @tutorial https://developers.signageos.io/docs/
|
|
179
|
+
* @tutorial https://developers.signageos.io/docs/sos-guides/key-value-storage
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* // Previously saved content with uid 'ApplicationSecret'
|
|
183
|
+
* await sos.offline.cache.saveContent('ApplicationSecret', '123SuperSecretHash');
|
|
184
|
+
*
|
|
185
|
+
* // Load the content
|
|
186
|
+
* const content = await sos.offline.cache.loadContent('ApplicationSecret');
|
|
187
|
+
* console.log('Loaded content:', content); // Output: Loaded content: 123SuperSecretHash
|
|
90
188
|
*/
|
|
91
189
|
loadContent(uid: string): Promise<string>;
|
|
92
190
|
/**
|
|
93
|
-
* The `saveContent()` method saves a string value to the cache
|
|
191
|
+
* The `saveContent()` method saves a string value to the cache with specified `uid`.
|
|
94
192
|
*
|
|
193
|
+
* Use when you need to save some data into local memory. This API provides you with approach similar to the HTML5's Local Storage, but implemented internally via native device API and completely device-agnostic.
|
|
194
|
+
*
|
|
195
|
+
* @param uid Unique identifier of the content to be saved.
|
|
196
|
+
* @param content The string content to be saved.
|
|
197
|
+
* @returns {Promise<void>} A promise that resolves when the content is saved.
|
|
198
|
+
* @throws Error If the uid is not a valid string.
|
|
199
|
+
* @throws Error If the content is not a valid string.
|
|
200
|
+
* @throws Error If the uid already exists.
|
|
201
|
+
* @throws Error If any other error occurs during saving.
|
|
95
202
|
* @since 1.0.3
|
|
96
|
-
* @tutorial https://developers.signageos.io/docs/
|
|
203
|
+
* @tutorial https://developers.signageos.io/docs/sos-guides/key-value-storage
|
|
204
|
+
*
|
|
205
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/offline-content | Example of Applet using saveContent()}
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* sos.offline.cache.saveContent('ApplicationSecret', '123SuperSecretHash')
|
|
209
|
+
* .then(() => {
|
|
210
|
+
* //Content was successfully saved, retrieve it.
|
|
211
|
+
* return sos.offline.cache.loadContent('ApplicationSecret');
|
|
212
|
+
* })
|
|
213
|
+
* .then((content) => {
|
|
214
|
+
* console.log('Loaded', content); // print 123SuperSecretHash
|
|
215
|
+
* })
|
|
97
216
|
*/
|
|
98
217
|
saveContent(uid: string, content: string): Promise<void>;
|
|
99
218
|
/**
|
|
100
|
-
* The `deleteContent() method removes the value specified by `uid` key.
|
|
219
|
+
* The `deleteContent()` method removes the value specified by `uid` key from the cache storage.
|
|
101
220
|
*
|
|
221
|
+
* @param uid Unique identifier of the content to be deleted.
|
|
222
|
+
* @returns {Promise<void>} A promise that resolves when the content is deleted.
|
|
223
|
+
* @throws Error If the uid does not exist.
|
|
224
|
+
* @throws Error If the uid is not a valid string.
|
|
225
|
+
* @throws Error If any other error occurs during deletion.
|
|
102
226
|
* @since 2.0.0
|
|
103
|
-
* @tutorial https://developers.signageos.io/docs/
|
|
227
|
+
* @tutorial https://developers.signageos.io/docs/sos-guides/key-value-storage
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* //Store
|
|
231
|
+
* sos.offline.cache.saveContent('ApplicationSecret', '123SuperSecretHash')
|
|
232
|
+
* .then(() => {
|
|
233
|
+
* //Content was successfully saved, retrieve it.
|
|
234
|
+
* return sos.offline.cache.loadContent('ApplicationSecret');
|
|
235
|
+
* })
|
|
236
|
+
* .then((content) => {
|
|
237
|
+
* console.log('Loaded', content); // print 123SuperSecretHash
|
|
238
|
+
*
|
|
239
|
+
* // Let's delete the content now
|
|
240
|
+
* return sos.offline.cache.deleteContent('ApplicationSecret')
|
|
241
|
+
* })
|
|
242
|
+
* .then(() => {
|
|
243
|
+
* console.log("Deleted");
|
|
244
|
+
* })
|
|
245
|
+
* .catch((error) => { console.error(error); });
|
|
104
246
|
*/
|
|
105
247
|
deleteContent(uid: string): Promise<void>;
|
|
106
248
|
/**
|
|
107
249
|
* The `validateChecksumFile()` method validates whether the file, specified by `uid`, has the correct checksum.
|
|
108
250
|
*
|
|
109
|
-
* @
|
|
110
|
-
*
|
|
251
|
+
* @param uid Unique file identifier of a previously downloaded file.
|
|
252
|
+
* @param hash The expected checksum of the file.
|
|
253
|
+
* @param hashType The hashing algorithm to use. Supported algorithms are 'md5' and `crc32`.
|
|
254
|
+
* @returns {Promise<boolean>} A promise that resolves to `true` if the checksum is valid, otherwise `false`.
|
|
255
|
+
* @throws Error If the uid does not exist or the hashing algorithm is not supported.
|
|
256
|
+
* @throws Error If the hash is not a valid string.
|
|
257
|
+
* @throws Error If the hashType is not a valid string.
|
|
111
258
|
* @since 2.0.0
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* // Validate the checksum of a file
|
|
262
|
+
* const expectedHash = 'd41d8cd98f00b204e9800998ecf8427e'; // Example MD5 hash
|
|
263
|
+
* // Previously saved file with uid 'example-file.mp4'
|
|
264
|
+
* const isValid = await sos.offline.cache.validateChecksumFile('example-file.mp4', expectedHash, 'md5');
|
|
112
265
|
*/
|
|
113
266
|
validateChecksumFile(uid: string, hash: string, hashType: HashAlgorithm): Promise<boolean>;
|
|
114
267
|
/**
|
|
115
268
|
* The `getChecksumFile()` computes a checksum of the file specified by `uid`.
|
|
116
269
|
*
|
|
117
|
-
* @
|
|
118
|
-
*
|
|
270
|
+
* @param uid Unique file identifier of a previously downloaded file.
|
|
271
|
+
* @param hashType The hashing algorithm to use. Supported algorithms are `md5` and `crc32`.
|
|
272
|
+
* @returns {Promise<string>} A promise that resolves to the computed checksum of the file.
|
|
273
|
+
* @throws Error If the uid does not exist.
|
|
274
|
+
* @throws Error If the hashing algorithm is not supported.
|
|
119
275
|
* @since 2.0.0
|
|
276
|
+
*
|
|
277
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/md5-checksum | Example Applet with MD5 Checksum}
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* const checksum = await sos.offline.cache.getChecksumFile('example-file.mp4', 'md5');
|
|
281
|
+
* console.log('MD5 Checksum:', checksum); // Output: MD5 Checksum: d41d8cd98f00b204e9800998ecf8427e
|
|
120
282
|
*/
|
|
121
283
|
getChecksumFile(uid: string, hashType: HashAlgorithm): Promise<string>;
|
|
122
284
|
/**
|
|
123
285
|
* The `decompressFile()` decompresses the file specified by `uid` into a new file specified by `destinationUid`.
|
|
124
286
|
*
|
|
125
|
-
* @
|
|
126
|
-
*
|
|
287
|
+
* @param uid Unique file identifier of a previously downloaded ZIP file.
|
|
288
|
+
* @param destinationUid Unique directory identifier (prefix of file) to extract ZIP file.
|
|
289
|
+
* @param method The decompression method to use. Currently, only 'zip' is supported.
|
|
290
|
+
* @returns {Promise<void>} A promise that resolves when the file is decompressed.
|
|
291
|
+
* @throws Error If the uid does not exist.
|
|
292
|
+
* @throws Error If the destinationUid is not a valid string.
|
|
293
|
+
* @throws Error If the method is not supported.
|
|
127
294
|
* @since 2.1.0
|
|
295
|
+
*
|
|
296
|
+
* @example // {@link https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/offline-zip-decompress | Example Applet with Offline ZIP Decompression}
|
|
297
|
+
* @example
|
|
298
|
+
* // Save the ZIP file
|
|
299
|
+
* await sos.offline.cache.saveFile('example-zip-file.zip', 'https://example.com/path/to/your/file.zip');
|
|
300
|
+
*
|
|
301
|
+
* // Decompress the ZIP file into a directory
|
|
302
|
+
* await sos.offline.cache.decompressFile('example-zip-file.zip', 'extracted-files/', 'zip');
|
|
303
|
+
* .then(() => { console.log('ZIP file extracted'); })
|
|
304
|
+
* .catch((error) => { console.error(error); });
|
|
128
305
|
*/
|
|
129
306
|
decompressFile(uid: string, destinationUid: string, method: 'zip'): Promise<void>;
|
|
130
307
|
private getCachedFile;
|