@signageos/front-applet 8.2.0 → 8.2.2
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 +5 -5
- package/dist/bundle.js.map +1 -1
- package/docs/index.md +9 -9
- package/docs/sos/browser.md +11 -3
- package/docs/sos/deviceInfo.md +1 -1
- package/docs/sos/display.md +13 -20
- package/docs/sos/fileSystem.md +31 -6
- package/docs/sos/hardware/barcodeScanner.md +9 -0
- package/docs/sos/hardware/index.md +9 -0
- package/docs/sos/native/mdc.md +8 -3
- package/docs/sos/osd.md +9 -0
- package/docs/sos/video.md +9 -0
- package/docs/sos_management/app.md +97 -18
- package/docs/sos_management/audio.md +43 -2
- package/docs/sos_management/autoRecovery.md +101 -0
- package/docs/sos_management/debug.md +84 -1
- package/docs/sos_management/firmware.md +64 -1
- package/docs/sos_management/index.md +217 -19
- package/docs/sos_management/network.md +84 -29
- package/docs/sos_management/os.md +59 -4
- package/docs/sos_management/package.md +25 -3
- package/docs/sos_management/power.md +142 -18
- package/docs/sos_management/proxy.md +54 -3
- package/docs/sos_management/remoteControl.md +55 -4
- package/docs/sos_management/screen.md +140 -29
- package/docs/sos_management/security.md +48 -5
- package/docs/sos_management/time.md +76 -9
- package/docs/sos_management/wifi.md +207 -45
- package/es6/FrontApplet/Browser/Browser.d.ts +11 -3
- package/es6/FrontApplet/Browser/Browser.js +11 -3
- package/es6/FrontApplet/Browser/Browser.js.map +1 -1
- package/es6/FrontApplet/Command/Command.js +1 -0
- package/es6/FrontApplet/Command/Command.js.map +1 -1
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.d.ts +1 -1
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.js +15 -5
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.js.map +1 -1
- package/es6/FrontApplet/DeviceInfo/IDeviceInfo.d.ts +1 -1
- package/es6/FrontApplet/Display/Display.d.ts +14 -19
- package/es6/FrontApplet/Display/Display.js +14 -19
- package/es6/FrontApplet/Display/Display.js.map +1 -1
- package/es6/FrontApplet/FileSystem/FileSystem.d.ts +27 -5
- package/es6/FrontApplet/FileSystem/FileSystem.js +27 -5
- package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.d.ts +9 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js +9 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js.map +1 -1
- package/es6/FrontApplet/Hardware/Hardware.d.ts +9 -0
- package/es6/FrontApplet/Hardware/Hardware.js +9 -0
- package/es6/FrontApplet/Hardware/Hardware.js.map +1 -1
- package/es6/FrontApplet/Management/App/App.d.ts +53 -17
- package/es6/FrontApplet/Management/App/App.js +23 -12
- package/es6/FrontApplet/Management/App/App.js.map +1 -1
- package/es6/FrontApplet/Management/App/IApp.d.ts +3 -0
- package/es6/FrontApplet/Management/Audio/Audio.d.ts +24 -3
- package/es6/FrontApplet/Management/Audio/Audio.js +24 -3
- package/es6/FrontApplet/Management/Audio/Audio.js.map +1 -1
- package/es6/FrontApplet/Management/AutoRecovery/AutoRecovery.d.ts +49 -3
- package/es6/FrontApplet/Management/AutoRecovery/AutoRecovery.js +49 -3
- package/es6/FrontApplet/Management/AutoRecovery/AutoRecovery.js.map +1 -1
- package/es6/FrontApplet/Management/Debug/Debug.d.ts +44 -2
- package/es6/FrontApplet/Management/Debug/Debug.js +43 -1
- package/es6/FrontApplet/Management/Debug/Debug.js.map +1 -1
- package/es6/FrontApplet/Management/Firmware/Firmware.d.ts +41 -4
- package/es6/FrontApplet/Management/Firmware/Firmware.js +33 -0
- package/es6/FrontApplet/Management/Firmware/Firmware.js.map +1 -1
- package/es6/FrontApplet/Management/Management.d.ts +119 -21
- package/es6/FrontApplet/Management/Management.js +119 -22
- package/es6/FrontApplet/Management/Management.js.map +1 -1
- package/es6/FrontApplet/Management/Network/Network.d.ts +44 -25
- package/es6/FrontApplet/Management/Network/Network.js +28 -14
- package/es6/FrontApplet/Management/Network/Network.js.map +1 -1
- package/es6/FrontApplet/Management/OS/IOS.d.ts +3 -0
- package/es6/FrontApplet/Management/OS/OS.d.ts +32 -4
- package/es6/FrontApplet/Management/OS/OS.js +32 -4
- package/es6/FrontApplet/Management/OS/OS.js.map +1 -1
- package/es6/FrontApplet/Management/Package/Package.d.ts +18 -3
- package/es6/FrontApplet/Management/Package/Package.js +18 -4
- package/es6/FrontApplet/Management/Package/Package.js.map +1 -1
- package/es6/FrontApplet/Management/Power/IPower.d.ts +3 -0
- package/es6/FrontApplet/Management/Power/IPower.js.map +1 -1
- package/es6/FrontApplet/Management/Power/Power.d.ts +67 -20
- package/es6/FrontApplet/Management/Power/Power.js +70 -24
- package/es6/FrontApplet/Management/Power/Power.js.map +1 -1
- package/es6/FrontApplet/Management/Proxy/Proxy.d.ts +28 -3
- package/es6/FrontApplet/Management/Proxy/Proxy.js +28 -3
- package/es6/FrontApplet/Management/Proxy/Proxy.js.map +1 -1
- package/es6/FrontApplet/Management/RemoteControl/RemoteControl.d.ts +23 -5
- package/es6/FrontApplet/Management/RemoteControl/RemoteControl.js +23 -5
- package/es6/FrontApplet/Management/RemoteControl/RemoteControl.js.map +1 -1
- package/es6/FrontApplet/Management/Screen/Screen.d.ts +77 -32
- package/es6/FrontApplet/Management/Screen/Screen.js +65 -26
- package/es6/FrontApplet/Management/Screen/Screen.js.map +1 -1
- package/es6/FrontApplet/Management/Security/Security.d.ts +25 -7
- package/es6/FrontApplet/Management/Security/Security.js +25 -7
- package/es6/FrontApplet/Management/Security/Security.js.map +1 -1
- package/es6/FrontApplet/Management/Time/Time.d.ts +47 -11
- package/es6/FrontApplet/Management/Time/Time.js +29 -7
- package/es6/FrontApplet/Management/Time/Time.js.map +1 -1
- package/es6/FrontApplet/Management/Wifi/IWifi.d.ts +3 -0
- package/es6/FrontApplet/Management/Wifi/IWifi.js.map +1 -1
- package/es6/FrontApplet/Management/Wifi/Wifi.d.ts +137 -42
- package/es6/FrontApplet/Management/Wifi/Wifi.js +137 -42
- package/es6/FrontApplet/Management/Wifi/Wifi.js.map +1 -1
- package/es6/FrontApplet/NativeCommands/MDC/Mdc.d.ts +8 -3
- package/es6/FrontApplet/NativeCommands/MDC/Mdc.js +8 -3
- package/es6/FrontApplet/NativeCommands/MDC/Mdc.js.map +1 -1
- package/es6/FrontApplet/OSD/OSD.d.ts +9 -0
- package/es6/FrontApplet/OSD/OSD.js +9 -0
- package/es6/FrontApplet/OSD/OSD.js.map +1 -1
- package/es6/FrontApplet/Video/Video.d.ts +9 -0
- package/es6/FrontApplet/Video/Video.js +9 -0
- package/es6/FrontApplet/Video/Video.js.map +1 -1
- package/es6/Monitoring/DeviceInfo/deviceInfoCommands.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,13 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const INetworkInfo_1 = require("./INetworkInfo");
|
|
7
7
|
const Validate_1 = __importDefault(require("../../Validate/Validate"));
|
|
8
8
|
/**
|
|
9
|
-
* The `sos.management.network` API groups together methods
|
|
9
|
+
* The `sos.management.network` API groups together networking methods. For Wi-Fi setup, use the [Wi-Fi API](https://developers.signageos.io/sdk/sos_management/wifi).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* <details>
|
|
12
|
+
* <summary>Network Management Capabilities</summary>
|
|
13
|
+
* | Capability | Description |
|
|
14
|
+
* |:------------|:-------------|
|
|
15
|
+
* | `NETWORK_INFO` | If device supports returning network information |
|
|
12
16
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* :::
|
|
17
|
+
* If you want to check if the device supports this capability, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
18
|
+
* </details>
|
|
16
19
|
*/
|
|
17
20
|
class Network {
|
|
18
21
|
messagePrefix;
|
|
@@ -30,11 +33,19 @@ class Network {
|
|
|
30
33
|
return networkInfo;
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
33
|
-
* The `listInterface()` method returns list of all network interfaces, and their information like MAC address, IP address, etc.
|
|
34
|
-
* connection strength is described as percentage in range from 0 to 100, linearly converted from dBm -90 to -30 respectively based on
|
|
35
|
-
* platform.
|
|
36
|
+
* The `listInterface()` method returns a list of all network interfaces, and their information like MAC address, IP address, etc.
|
|
37
|
+
* Wi-Fi connection strength is described as a percentage in the range from 0 to 100, linearly converted from dBm -90 to -30, respectively, based on the platform.
|
|
36
38
|
*
|
|
39
|
+
* @returns {Promise<INetworkInterface[]>} Resolves to an array of network interfaces with their information.
|
|
37
40
|
* @since 4.9.0
|
|
41
|
+
*
|
|
42
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/network | Applet Example with Network Interfaces}
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const interfaces = await sos.management.network.listInterfaces();
|
|
46
|
+
* interfaces.forEach((iface) => {
|
|
47
|
+
* console.log(`Interface: ${iface.name}, IP: ${iface.ipAddress}, MAC: ${iface.macAddress}`);
|
|
48
|
+
* });
|
|
38
49
|
*/
|
|
39
50
|
async listInterfaces() {
|
|
40
51
|
const { interfaces } = await this.postMessage({
|
|
@@ -83,17 +94,20 @@ class Network {
|
|
|
83
94
|
}
|
|
84
95
|
}
|
|
85
96
|
/**
|
|
86
|
-
* The `disableInterface()`
|
|
97
|
+
* The `disableInterface()` turns off a selected network interface.
|
|
87
98
|
*
|
|
88
99
|
* :::warning
|
|
89
|
-
*
|
|
90
|
-
* Don't use this method to disable Wi-Fi. Use [Wi-Fi API](./wifi) to enable/disable Wi-Fi.
|
|
91
|
-
*
|
|
100
|
+
* Don't use this method to disable Wi-Fi. Use [Wi-Fi API](https://developers.signageos.io/sdk/sos_management/wifi) to turn Wi-Fi on/off.
|
|
92
101
|
* :::
|
|
93
102
|
*
|
|
94
|
-
* @param interfaceName The interface name which can be retrieved from the list of interfaces returned by listInterfaces()
|
|
95
|
-
*
|
|
103
|
+
* @param interfaceName The interface name which can be retrieved from the list of interfaces returned by `listInterfaces()`
|
|
104
|
+
* @return {Promise<void>} A promise that resolves when the network interface is disabled.
|
|
105
|
+
* @throws {Error} If the interface name is invalid.
|
|
106
|
+
* @throws {Error} If the device does not support network management.
|
|
96
107
|
* @since 4.13.0
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* await sos.management.network.disableInterface('eth0');
|
|
97
111
|
*/
|
|
98
112
|
async disableInterface(interfaceName) {
|
|
99
113
|
(0, Validate_1.default)({ interfaceName }).required().string();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Network.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Network/Network.ts"],"names":[],"mappings":";;;;;AACA,iDAQwB;AACxB,uEAA+C;AAG/C
|
|
1
|
+
{"version":3,"file":"Network.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Network/Network.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,6 +3,17 @@ import IOSInfo from './IOSInfo';
|
|
|
3
3
|
import IOS, { SystemMemoryInfo } from './IOS';
|
|
4
4
|
/**
|
|
5
5
|
* The `sos.management.os` API groups together methods for retrieving information about the system.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* <details>
|
|
9
|
+
* <summary>OS Management Capabilities</summary>
|
|
10
|
+
* | Capability | Description |
|
|
11
|
+
* |:------------|:-------------|
|
|
12
|
+
* | `SYSTEM_CPU` | If device supports collecting CPU usage information |
|
|
13
|
+
* | `SYSTEM_MEMORY` | If device supports collecting memory usage information |
|
|
14
|
+
*
|
|
15
|
+
* If you want to check if the device supports those capabilities, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
16
|
+
* </details>
|
|
6
17
|
*/
|
|
7
18
|
export default class OS implements IOS {
|
|
8
19
|
private messagePrefix;
|
|
@@ -10,22 +21,39 @@ export default class OS implements IOS {
|
|
|
10
21
|
/** @internal */
|
|
11
22
|
constructor(messagePrefix: string, postMessage: IPostMessage<any>);
|
|
12
23
|
/**
|
|
13
|
-
* The `getInfo()` method returns info about the system of the device, such as what current version of it is installed on
|
|
14
|
-
* version of current operating system. It's usually 1 or 2 digits including or excluding dot notation.
|
|
24
|
+
* The `getInfo()` method returns info about the system of the device, such as what current version of it is installed on the device. Major
|
|
25
|
+
* version of the current operating system. It's usually 1 or 2 digits, including or excluding dot notation.
|
|
15
26
|
*
|
|
27
|
+
* @returns {Promise<IOSInfo>} Resolves to an object containing information about the operating system.
|
|
16
28
|
* @since 5.0.0
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const osInfo = await sos.management.os.getInfo();
|
|
32
|
+
* console.log(`Current OS version is: ${osInfo.version}`);
|
|
17
33
|
*/
|
|
18
34
|
getInfo(): Promise<IOSInfo>;
|
|
19
35
|
/**
|
|
20
|
-
* The `getCpuUsage()` method returns current CPU usage (ranging 0
|
|
36
|
+
* The `getCpuUsage()` method returns the current total CPU usage (ranging from 0 to 100%).
|
|
21
37
|
*
|
|
38
|
+
* @throws {Error} If the CPU usage is not supported.
|
|
39
|
+
* @returns {Promise<number>} Resolves to the current CPU usage percentage.
|
|
22
40
|
* @since 5.4.0
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const cpuUsage = await sos.management.os.getCpuUsage();
|
|
44
|
+
* console.log(`Current CPU usage is: ${cpuUsage}%`);
|
|
23
45
|
*/
|
|
24
46
|
getCpuUsage(): Promise<number>;
|
|
25
47
|
/**
|
|
26
|
-
* The `getMemoryUsage()` method returns total memory amount in bytes, currently used memory and remaining free memory.
|
|
48
|
+
* The `getMemoryUsage()` method returns the total memory amount in bytes, the currently used memory, and the remaining free memory.
|
|
27
49
|
*
|
|
50
|
+
* @throws {Error} If the memory usage is not supported.
|
|
51
|
+
* @returns {Promise<SystemMemoryInfo>} Resolves to an object containing total, used, and free memory in bytes.
|
|
28
52
|
* @since 5.4.0
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const memoryUsage = await sos.management.os.getMemoryUsage();
|
|
56
|
+
* console.log(`Memory usage: ${((memoryUsage.used / memoryUsage.total) * 100).toFixed(2)}%`);
|
|
29
57
|
*/
|
|
30
58
|
getMemoryUsage(): Promise<SystemMemoryInfo>;
|
|
31
59
|
private getMessage;
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
4
|
* The `sos.management.os` API groups together methods for retrieving information about the system.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* <details>
|
|
8
|
+
* <summary>OS Management Capabilities</summary>
|
|
9
|
+
* | Capability | Description |
|
|
10
|
+
* |:------------|:-------------|
|
|
11
|
+
* | `SYSTEM_CPU` | If device supports collecting CPU usage information |
|
|
12
|
+
* | `SYSTEM_MEMORY` | If device supports collecting memory usage information |
|
|
13
|
+
*
|
|
14
|
+
* If you want to check if the device supports those capabilities, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
15
|
+
* </details>
|
|
5
16
|
*/
|
|
6
17
|
class OS {
|
|
7
18
|
messagePrefix;
|
|
@@ -12,10 +23,15 @@ class OS {
|
|
|
12
23
|
this.postMessage = postMessage;
|
|
13
24
|
}
|
|
14
25
|
/**
|
|
15
|
-
* The `getInfo()` method returns info about the system of the device, such as what current version of it is installed on
|
|
16
|
-
* version of current operating system. It's usually 1 or 2 digits including or excluding dot notation.
|
|
26
|
+
* The `getInfo()` method returns info about the system of the device, such as what current version of it is installed on the device. Major
|
|
27
|
+
* version of the current operating system. It's usually 1 or 2 digits, including or excluding dot notation.
|
|
17
28
|
*
|
|
29
|
+
* @returns {Promise<IOSInfo>} Resolves to an object containing information about the operating system.
|
|
18
30
|
* @since 5.0.0
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const osInfo = await sos.management.os.getInfo();
|
|
34
|
+
* console.log(`Current OS version is: ${osInfo.version}`);
|
|
19
35
|
*/
|
|
20
36
|
async getInfo() {
|
|
21
37
|
const { osInfo } = await this.postMessage({
|
|
@@ -24,9 +40,15 @@ class OS {
|
|
|
24
40
|
return osInfo;
|
|
25
41
|
}
|
|
26
42
|
/**
|
|
27
|
-
* The `getCpuUsage()` method returns current CPU usage (ranging 0
|
|
43
|
+
* The `getCpuUsage()` method returns the current total CPU usage (ranging from 0 to 100%).
|
|
28
44
|
*
|
|
45
|
+
* @throws {Error} If the CPU usage is not supported.
|
|
46
|
+
* @returns {Promise<number>} Resolves to the current CPU usage percentage.
|
|
29
47
|
* @since 5.4.0
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const cpuUsage = await sos.management.os.getCpuUsage();
|
|
51
|
+
* console.log(`Current CPU usage is: ${cpuUsage}%`);
|
|
30
52
|
*/
|
|
31
53
|
async getCpuUsage() {
|
|
32
54
|
const { cpuUsage } = await this.postMessage({
|
|
@@ -35,9 +57,15 @@ class OS {
|
|
|
35
57
|
return cpuUsage;
|
|
36
58
|
}
|
|
37
59
|
/**
|
|
38
|
-
* The `getMemoryUsage()` method returns total memory amount in bytes, currently used memory and remaining free memory.
|
|
60
|
+
* The `getMemoryUsage()` method returns the total memory amount in bytes, the currently used memory, and the remaining free memory.
|
|
39
61
|
*
|
|
62
|
+
* @throws {Error} If the memory usage is not supported.
|
|
63
|
+
* @returns {Promise<SystemMemoryInfo>} Resolves to an object containing total, used, and free memory in bytes.
|
|
40
64
|
* @since 5.4.0
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* const memoryUsage = await sos.management.os.getMemoryUsage();
|
|
68
|
+
* console.log(`Memory usage: ${((memoryUsage.used / memoryUsage.total) * 100).toFixed(2)}%`);
|
|
41
69
|
*/
|
|
42
70
|
async getMemoryUsage() {
|
|
43
71
|
const { memoryUsage } = await this.postMessage({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OS.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/OS/OS.ts"],"names":[],"mappings":";;AAIA
|
|
1
|
+
{"version":3,"file":"OS.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/OS/OS.ts"],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;GAaG;AACH,MAAqB,EAAE;IAGb;IACA;IAHT,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IACpC,CAAC;IAEJ;;;;;;;;;;OAUG;IACI,KAAK,CAAC,OAAO;QACnB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YACzC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;SACpC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,WAAW;QACvB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YAC3C,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;SACtC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,cAAc;QAC1B,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YAC9C,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;SACzC,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC;IACpB,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;IACxC,CAAC;CACD;AAnED,qBAmEC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import IPostMessage from '../../IPostMessage';
|
|
2
2
|
import IPackage from './IPackage';
|
|
3
3
|
/**
|
|
4
|
-
* The `sos.management.package` API groups together methods for installing
|
|
4
|
+
* The `sos.management.package` API groups together methods for installing custom Android packages.
|
|
5
|
+
*
|
|
6
|
+
* <details>
|
|
7
|
+
* <summary>Package Management Capabilities</summary>
|
|
8
|
+
* | Capability | Description |
|
|
9
|
+
* |:------------|:-------------|
|
|
10
|
+
* | `PACKAGE_INSTALL` | If device supports installing packages |
|
|
11
|
+
* | `STOP_PACKAGE` | If device supports stopping packages |
|
|
12
|
+
*
|
|
13
|
+
* If you want to check if the device supports those capabilities, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
14
|
+
* </details>
|
|
5
15
|
*/
|
|
6
16
|
export default class Package implements IPackage {
|
|
7
17
|
private messagePrefix;
|
|
@@ -9,12 +19,17 @@ export default class Package implements IPackage {
|
|
|
9
19
|
/** @internal */
|
|
10
20
|
constructor(messagePrefix: string, postMessage: IPostMessage<any>);
|
|
11
21
|
/**
|
|
12
|
-
* The `install()` method installs a
|
|
22
|
+
* The `install()` method installs a particular package from the specified URL.
|
|
13
23
|
*
|
|
14
24
|
* @param baseUrl URL where the package is available
|
|
15
|
-
* @param packageName Name of the
|
|
25
|
+
* @param packageName Name of the Android package
|
|
16
26
|
* @param version Package version
|
|
17
27
|
* @param build If relevant for your device
|
|
28
|
+
* @returns {Promise<void>} A promise that resolves when the package is successfully installed.
|
|
29
|
+
* @throws {Error} If `baseUrl` is not a valid URL
|
|
30
|
+
* @throws {Error} If `packageName` is not a string
|
|
31
|
+
* @throws {Error} If `version` is not a string
|
|
32
|
+
* @throws {Error} If `build` is not a string or null
|
|
18
33
|
*/
|
|
19
34
|
install(baseUrl: string, packageName: string, version: string, build: string | null): Promise<void>;
|
|
20
35
|
/**
|
|
@@ -5,7 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Validate_1 = __importDefault(require("../../Validate/Validate"));
|
|
7
7
|
/**
|
|
8
|
-
* The `sos.management.package` API groups together methods for installing
|
|
8
|
+
* The `sos.management.package` API groups together methods for installing custom Android packages.
|
|
9
|
+
*
|
|
10
|
+
* <details>
|
|
11
|
+
* <summary>Package Management Capabilities</summary>
|
|
12
|
+
* | Capability | Description |
|
|
13
|
+
* |:------------|:-------------|
|
|
14
|
+
* | `PACKAGE_INSTALL` | If device supports installing packages |
|
|
15
|
+
* | `STOP_PACKAGE` | If device supports stopping packages |
|
|
16
|
+
*
|
|
17
|
+
* If you want to check if the device supports those capabilities, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
18
|
+
* </details>
|
|
9
19
|
*/
|
|
10
20
|
class Package {
|
|
11
21
|
messagePrefix;
|
|
@@ -15,14 +25,18 @@ class Package {
|
|
|
15
25
|
this.messagePrefix = messagePrefix;
|
|
16
26
|
this.postMessage = postMessage;
|
|
17
27
|
}
|
|
18
|
-
// TODO: build param
|
|
19
28
|
/**
|
|
20
|
-
* The `install()` method installs a
|
|
29
|
+
* The `install()` method installs a particular package from the specified URL.
|
|
21
30
|
*
|
|
22
31
|
* @param baseUrl URL where the package is available
|
|
23
|
-
* @param packageName Name of the
|
|
32
|
+
* @param packageName Name of the Android package
|
|
24
33
|
* @param version Package version
|
|
25
34
|
* @param build If relevant for your device
|
|
35
|
+
* @returns {Promise<void>} A promise that resolves when the package is successfully installed.
|
|
36
|
+
* @throws {Error} If `baseUrl` is not a valid URL
|
|
37
|
+
* @throws {Error} If `packageName` is not a string
|
|
38
|
+
* @throws {Error} If `version` is not a string
|
|
39
|
+
* @throws {Error} If `build` is not a string or null
|
|
26
40
|
*/
|
|
27
41
|
async install(baseUrl, packageName, version, build) {
|
|
28
42
|
(0, Validate_1.default)({ baseUrl }).required().uri();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Package.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Package/Package.ts"],"names":[],"mappings":";;;;;AACA,uEAA+C;AAG/C
|
|
1
|
+
{"version":3,"file":"Package.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Package/Package.ts"],"names":[],"mappings":";;;;;AACA,uEAA+C;AAG/C;;;;;;;;;;;;GAYG;AACH,MAAqB,OAAO;IAGlB;IACA;IAHT,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IACpC,CAAC;IAEJ;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,OAAO,CAAC,OAAe,EAAE,WAAmB,EAAE,OAAe,EAAE,KAAoB;QAC/F,IAAA,kBAAQ,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC;QACvC,IAAA,kBAAQ,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;QAC9C,IAAA,kBAAQ,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;QAC1C,IAAA,kBAAQ,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;QACpD,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC;YACxC,OAAO;YACP,WAAW;YACX,OAAO;YACP,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,IAAI,CAAC,WAAmB;QACpC,IAAA,kBAAQ,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;QAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YAC1C,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC;YACrC,WAAW;SACX,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IAChB,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;IACxC,CAAC;CACD;AAvDD,0BAuDC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ITimer, TimerType } from '../helpers/TimerHelper';
|
|
2
2
|
import { IProprietaryTimer, ProprietaryTimerType } from '../helpers/ProprietaryTimerHelper';
|
|
3
|
+
/**
|
|
4
|
+
* Interface representing the scheduled reboot action.
|
|
5
|
+
*/
|
|
3
6
|
export interface IScheduledRebootActions {
|
|
4
7
|
id: string;
|
|
5
8
|
rule: IScheduledRebootRule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPower.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Power/IPower.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"IPower.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Power/IPower.ts"],"names":[],"mappings":";;;AAuBA;;;GAGG;AACH,IAAY,eAQX;AARD,WAAY,eAAe;IAC1B,yDAAU,CAAA;IACV,yDAAU,CAAA;IACV,2DAAW,CAAA;IACX,+DAAa,CAAA;IACb,6DAAY,CAAA;IACZ,yDAAU,CAAA;IACV,6DAAY,CAAA;AACb,CAAC,EARW,eAAe,+BAAf,eAAe,QAQ1B;AAED,IAAY,YAQX;AARD,WAAY,YAAY;IACvB,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;AACtB,CAAC,EARW,YAAY,4BAAZ,YAAY,QAQvB"}
|
|
@@ -5,6 +5,19 @@ import IPower, { IScheduledRebootActions, WeekdayType } from './IPower';
|
|
|
5
5
|
/**
|
|
6
6
|
* The `sos.management.power` API groups together methods related to the power state of the device. Such as rebooting, shutting down,
|
|
7
7
|
* setting timers.
|
|
8
|
+
*
|
|
9
|
+
* <details>
|
|
10
|
+
* <summary>Power Management Capabilities</summary>
|
|
11
|
+
* | Capability | Description |
|
|
12
|
+
* |:------------|:-------------|
|
|
13
|
+
* | `SYSTEM_REBOOT` | If device supports system reboot power action |
|
|
14
|
+
* | `APP_RESTART` | If device supports app restart power action |
|
|
15
|
+
* | `TIMERS_PROPRIETARY` | If device supports proprietary timers |
|
|
16
|
+
* | `TIMERS_NATIVE` | If device supports native timers |
|
|
17
|
+
* | `SCHEDULE_POWER_ACTION` | If device supports scheduled power actions |
|
|
18
|
+
*
|
|
19
|
+
* If you want to check if the device supports those capabilities, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
20
|
+
* </details>
|
|
8
21
|
*/
|
|
9
22
|
export default class Power implements IPower {
|
|
10
23
|
private messagePrefix;
|
|
@@ -14,8 +27,11 @@ export default class Power implements IPower {
|
|
|
14
27
|
/**
|
|
15
28
|
* The `systemReboot()` method initializes a system reboot.
|
|
16
29
|
*
|
|
30
|
+
* @returns {Promise<void>} Resolves when the system reboot is initiated.
|
|
17
31
|
* @since 3.0.0
|
|
18
32
|
*
|
|
33
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/system-reboot | Applet Example for System Reboot}
|
|
34
|
+
*
|
|
19
35
|
* @example
|
|
20
36
|
* await sos.management.power.systemReboot();
|
|
21
37
|
*/
|
|
@@ -23,6 +39,7 @@ export default class Power implements IPower {
|
|
|
23
39
|
/**
|
|
24
40
|
* The `appRestart()` method initializes a restart of the signageOS app.
|
|
25
41
|
*
|
|
42
|
+
* @returns {Promise<void>} Resolves when the app restart is initiated.
|
|
26
43
|
* @since 3.0.0
|
|
27
44
|
*
|
|
28
45
|
* @example
|
|
@@ -32,32 +49,43 @@ export default class Power implements IPower {
|
|
|
32
49
|
/**
|
|
33
50
|
* The `getTimers()` method returns a list of currently set native timers.
|
|
34
51
|
*
|
|
52
|
+
* @returns {Promise<ITimer[]>} Resolves with an array of timers.
|
|
35
53
|
* @since 4.0.0
|
|
36
54
|
*
|
|
37
55
|
* @example
|
|
38
|
-
*
|
|
56
|
+
* await sos.management.power.getTimers();
|
|
39
57
|
*/
|
|
40
58
|
getTimers(): Promise<ITimer[]>;
|
|
41
59
|
/**
|
|
42
|
-
* The `
|
|
60
|
+
* The `setTimer()` method creates or updates a native timer.
|
|
43
61
|
*
|
|
44
62
|
* @param type The type of the timer (`TIMER_1`, ..., `TIMER_7`).
|
|
45
63
|
* @param timeOn The time when the device should turn on.
|
|
46
64
|
* @param timeOff The time when the device should turn off.
|
|
47
65
|
* @param weekdays The days of the week when the timer should be active (`mon`, ..., `sun`).
|
|
48
66
|
* @param volume The volume level set when the device is turned on.
|
|
49
|
-
*
|
|
67
|
+
* @return {Promise<void>} Resolves when the timer is set.
|
|
68
|
+
* @throws {Error} If the timer type is invalid.
|
|
69
|
+
* @throws {Error} If the time format is incorrect.
|
|
70
|
+
* @throws {Error} If the weekdays array contains an invalid weekday.
|
|
71
|
+
* @throws {Error} If the `volume` parameter is not a number between 0 and 100.
|
|
72
|
+
* @throws {Error} If the `timeOn` or `timeOff` parameters do not match the expected time format (`HH:mm:ss`).
|
|
73
|
+
* @throws {Error} If the `weekdays` parameter is not an array of strings.
|
|
74
|
+
* @throws {Error} If the `type` parameter is not a valid timer type (e.g., `TIMER_1`, `TIMER_2`, ..., `TIMER_7`).
|
|
50
75
|
* @since 3.0.0
|
|
51
76
|
*
|
|
77
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/timer | Applet Example for Native Timers}
|
|
78
|
+
*
|
|
52
79
|
* @example
|
|
53
|
-
* await sos.management.power.setTimer("TIMER_1", "08:00", "22:00", ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], 30);
|
|
80
|
+
* await sos.management.power.setTimer("TIMER_1", "08:00:00", "22:00:00", ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], 30);
|
|
54
81
|
*/
|
|
55
82
|
setTimer(type: keyof typeof TimerType, timeOn: string | null, timeOff: string | null, weekdays: string[], volume: number): Promise<void>;
|
|
56
83
|
/**
|
|
57
84
|
* The `unsetTimer()` method removes the specified native timer.
|
|
58
85
|
*
|
|
59
86
|
* @param type The type of the timer (`TIMER_1`, ..., `TIMER_7`).
|
|
60
|
-
*
|
|
87
|
+
* @returns {Promise<void>} Resolves when the timer is removed.
|
|
88
|
+
* @throws {Error} If the timer type is invalid.
|
|
61
89
|
* @since 4.0.0
|
|
62
90
|
*
|
|
63
91
|
* @example
|
|
@@ -68,6 +96,8 @@ export default class Power implements IPower {
|
|
|
68
96
|
* The `getProprietaryTimers()` method returns a list of currently set
|
|
69
97
|
* [proprietary timers](https://docs.signageos.io/hc/en-us/articles/4416384202642-Timers#h_01HCD14GEDP96AZV58NRSN2HNQ).
|
|
70
98
|
*
|
|
99
|
+
* @returns {Promise<IProprietaryTimer[]>} Resolves with an array of proprietary timers.
|
|
100
|
+
* @throws {Error} If the timers cannot be retrieved.
|
|
71
101
|
* @since 5.10.0
|
|
72
102
|
*
|
|
73
103
|
* @example
|
|
@@ -83,11 +113,19 @@ export default class Power implements IPower {
|
|
|
83
113
|
* @param timeOff The time when the device should turn off.
|
|
84
114
|
* @param weekdays The days of the week when the timer should be active (`mon`, ..., `sun`).
|
|
85
115
|
* @param keepAppletRunning If `true`, the applet will be kept running when the timer is active on certain devices.
|
|
86
|
-
*
|
|
116
|
+
* @return {Promise<void>} Resolves when the proprietary timer is set.
|
|
117
|
+
* @throws {Error} If the timer type is invalid or if the time format is incorrect.
|
|
118
|
+
* @throws {Error} If the weekdays array contains an invalid weekday.
|
|
119
|
+
* @throws {Error} If the `keepAppletRunning` parameter is not a boolean.
|
|
120
|
+
* @throws {Error} If the `timeOn` or `timeOff` parameters do not match the expected time format (`HH:mm:ss`).
|
|
121
|
+
* @throws {Error} If the `weekdays` parameter is not an array of strings.
|
|
122
|
+
* @throws {Error} If the `weekdays` array contains an invalid weekday.
|
|
123
|
+
* @throws {Error} If the `timeOn` or `timeOff` parameters do not match the expected time format (`HH:mm:ss`).
|
|
124
|
+
* @throws {Error} If the `type` parameter is not a valid timer type (e.g., `TIMER_1`, `TIMER_2`, ..., `TIMER_7`).
|
|
87
125
|
* @since 5.10.0
|
|
88
126
|
*
|
|
89
127
|
* @example
|
|
90
|
-
* await sos.management.power.setProprietaryTimer("
|
|
128
|
+
* await sos.management.power.setProprietaryTimer("TIMER_2", "08:00:00", "22:00:00", ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], false);
|
|
91
129
|
*/
|
|
92
130
|
setProprietaryTimer(type: ProprietaryTimerType, timeOn: string | null, timeOff: string | null, weekdays: string[], keepAppletRunning?: boolean): Promise<void>;
|
|
93
131
|
/**
|
|
@@ -95,7 +133,8 @@ export default class Power implements IPower {
|
|
|
95
133
|
* [proprietary timer](https://docs.signageos.io/hc/en-us/articles/4416384202642-Timers#h_01HCD14GEDP96AZV58NRSN2HNQ).
|
|
96
134
|
*
|
|
97
135
|
* @param type The type of the timer (`TIMER_1`, ..., `TIMER_7`).
|
|
98
|
-
*
|
|
136
|
+
* @returns {Promise<void>} Resolves when the proprietary timer is removed.
|
|
137
|
+
* @throws {Error} If the timer type is invalid.
|
|
99
138
|
* @since 5.10.0
|
|
100
139
|
*
|
|
101
140
|
* @example
|
|
@@ -105,6 +144,7 @@ export default class Power implements IPower {
|
|
|
105
144
|
/**
|
|
106
145
|
* Removes all scheduled reboot rules from the device.
|
|
107
146
|
*
|
|
147
|
+
* @returns {Promise<void>} Resolves when all scheduled reboots are cleared.
|
|
108
148
|
* @since 8.1.0
|
|
109
149
|
*
|
|
110
150
|
* @example
|
|
@@ -112,8 +152,9 @@ export default class Power implements IPower {
|
|
|
112
152
|
*/
|
|
113
153
|
clearScheduledReboots(): Promise<void>;
|
|
114
154
|
/**
|
|
115
|
-
* Returns all scheduled reboot rules on the device.
|
|
155
|
+
* Returns all scheduled reboot rules on the device set by the `setScheduledReboot()` method.
|
|
116
156
|
*
|
|
157
|
+
* @returns {Promise<IScheduledRebootActions[]>} Resolves with an array of scheduled reboot actions.
|
|
117
158
|
* @since 8.1.0
|
|
118
159
|
*
|
|
119
160
|
* @example
|
|
@@ -121,31 +162,37 @@ export default class Power implements IPower {
|
|
|
121
162
|
*/
|
|
122
163
|
getScheduledReboots(): Promise<IScheduledRebootActions[]>;
|
|
123
164
|
/**
|
|
124
|
-
* Removes scheduled reboot rule from the device.
|
|
125
|
-
* @param id {string}
|
|
126
|
-
*
|
|
165
|
+
* Removes scheduled reboot rule from the device (if it exists).
|
|
166
|
+
* @param id {string} ID of the rule to be removed.
|
|
167
|
+
* @throws {Error} If the `id` is not a string or is empty.
|
|
168
|
+
* @returns {Promise<void>} Resolves when the scheduled reboot is removed.
|
|
127
169
|
* @since 8.1.0
|
|
128
170
|
*
|
|
129
171
|
* @example
|
|
130
172
|
* // Get scheduled reboots
|
|
131
173
|
* const scheduledReboots = await sos.management.power.getScheduledReboots();
|
|
132
174
|
*
|
|
133
|
-
* // Remove scheduled reboot
|
|
175
|
+
* // Remove scheduled reboot on the first position
|
|
134
176
|
* await sos.management.power.removeScheduledReboot(scheduledReboots[0].id);
|
|
135
177
|
*/
|
|
136
178
|
removeScheduledReboot(id: string): Promise<void>;
|
|
137
179
|
/**
|
|
138
|
-
* Schedule automatic reboot on the device. Calling this function will create one rule.
|
|
139
|
-
* It is possible to set multiple rules, which can be later obtained by `getScheduledReboots` function.
|
|
180
|
+
* Schedule an automatic reboot on the device. Calling this function will create one rule.
|
|
181
|
+
* It is possible to set multiple rules, which can be later obtained by the `getScheduledReboots` function.
|
|
140
182
|
*
|
|
141
183
|
* :::note
|
|
142
|
-
* - Setting new scheduled reboot on device might take up to 10 minutes to show in Box.
|
|
143
|
-
* - Every new scheduled reboot rule gets unique identifier generated by device,
|
|
184
|
+
* - Setting a new scheduled reboot on the device might take up to 10 minutes to show in the Box.
|
|
185
|
+
* - Every new scheduled reboot rule gets a unique identifier generated by the device, which might be later returned by `getScheduledReboots()`.
|
|
144
186
|
* :::
|
|
145
187
|
*
|
|
146
|
-
* @param weekdays {@link WeekdayType[]}
|
|
147
|
-
* @param time {string}
|
|
148
|
-
*
|
|
188
|
+
* @param weekdays {@link WeekdayType[]} Array of weekdays when the reboot should be executed.
|
|
189
|
+
* @param time {string} Time when the reboot should be executed. Format is `HH:mm:ss`.
|
|
190
|
+
* @throws {Error} If the `weekdays` parameter is not an array of strings.
|
|
191
|
+
* @throws {Error} If the `time` parameter does not match the expected time format (`HH:mm:ss`).
|
|
192
|
+
* @throws {Error} If the `weekdays` array contains an invalid weekday.
|
|
193
|
+
* @throws {Error} If the `time` parameter is not a string or does not match the expected format (`HH:mm:ss`).
|
|
194
|
+
* @throws {Error} If the `weekdays` array is empty or contains invalid values.
|
|
195
|
+
* @returns {Promise<void>} Resolves when the scheduled reboot is set.
|
|
149
196
|
* @since 8.1.0
|
|
150
197
|
*
|
|
151
198
|
* @example
|