@signageos/front-applet 8.2.1 → 8.2.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 +20 -6
- package/dist/bundle.js.map +1 -1
- package/docs/index.md +9 -9
- package/docs/sos/browser.md +11 -3
- 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 +13 -4
- package/es6/FrontApplet/Browser/Browser.js.map +1 -1
- package/es6/FrontApplet/Command/Command.js +8 -10
- package/es6/FrontApplet/Command/Command.js.map +1 -1
- package/es6/FrontApplet/Connect/Connect.js +2 -2
- package/es6/FrontApplet/Connect/Connect.js.map +1 -1
- package/es6/FrontApplet/Debug/debugDecorator.d.ts +1 -1
- package/es6/FrontApplet/Debug/debugDecorator.js.map +1 -1
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.js +1 -1
- package/es6/FrontApplet/DeviceInfo/DeviceInfo.js.map +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/FileSystem/StorageUnitsChangedMessage.d.ts +1 -2
- package/es6/FrontApplet/Font/fontFaceGenerator.js +1 -1
- package/es6/FrontApplet/Font/fontFaceGenerator.js.map +1 -1
- package/es6/FrontApplet/FrontApplet.js +3 -3
- package/es6/FrontApplet/FrontApplet.js.map +1 -1
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.d.ts +10 -1
- 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/Iframe/Iframe.js +1 -1
- package/es6/FrontApplet/Iframe/Iframe.js.map +1 -1
- package/es6/FrontApplet/Input/Input.js +2 -1
- package/es6/FrontApplet/Input/Input.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 +71 -25
- 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 +139 -43
- 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/Offline/Cache/Cache.js +2 -2
- package/es6/FrontApplet/Offline/Cache/Cache.js.map +1 -1
- package/es6/FrontApplet/Offline/Flags/AppendFlagController.d.ts +1 -1
- package/es6/FrontApplet/Offline/Flags/AppendFlagController.js.map +1 -1
- package/es6/FrontApplet/Offline/Offline.js +2 -2
- package/es6/FrontApplet/Offline/Offline.js.map +1 -1
- package/es6/FrontApplet/Sync/Sync.js +6 -3
- package/es6/FrontApplet/Sync/Sync.js.map +1 -1
- package/es6/FrontApplet/Touch/Touch.js +2 -1
- package/es6/FrontApplet/Touch/Touch.js.map +1 -1
- package/es6/FrontApplet/Validate/Validate.d.ts +1 -1
- package/es6/FrontApplet/Validate/Validate.js +9 -9
- package/es6/FrontApplet/Validate/Validate.js.map +1 -1
- package/es6/FrontApplet/Validate/ValidateObjectInterface.js +10 -10
- package/es6/FrontApplet/Validate/ValidateObjectInterface.js.map +1 -1
- package/es6/FrontApplet/Video/Video.d.ts +9 -0
- package/es6/FrontApplet/Video/Video.js +11 -1
- package/es6/FrontApplet/Video/Video.js.map +1 -1
- package/es6/Monitoring/FileSystem/fileSystemCommands.d.ts +2 -2
- package/es6/Monitoring/Management/Screen/handleScreenRequests.js +2 -1
- package/es6/Monitoring/Management/Screen/handleScreenRequests.js.map +1 -1
- package/es6/bundle.js +5 -5
- package/es6/bundle.js.map +1 -1
- package/package.json +16 -21
|
@@ -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
|
|
@@ -7,10 +7,22 @@ const TimerHelper_1 = require("../helpers/TimerHelper");
|
|
|
7
7
|
const Validate_1 = __importDefault(require("../../Validate/Validate"));
|
|
8
8
|
const IPower_1 = require("./IPower");
|
|
9
9
|
const PowerHelper_1 = require("./PowerHelper");
|
|
10
|
-
// TODO: maybe a better description
|
|
11
10
|
/**
|
|
12
11
|
* The `sos.management.power` API groups together methods related to the power state of the device. Such as rebooting, shutting down,
|
|
13
12
|
* setting timers.
|
|
13
|
+
*
|
|
14
|
+
* <details>
|
|
15
|
+
* <summary>Power Management Capabilities</summary>
|
|
16
|
+
* | Capability | Description |
|
|
17
|
+
* |:------------|:-------------|
|
|
18
|
+
* | `SYSTEM_REBOOT` | If device supports system reboot power action |
|
|
19
|
+
* | `APP_RESTART` | If device supports app restart power action |
|
|
20
|
+
* | `TIMERS_PROPRIETARY` | If device supports proprietary timers |
|
|
21
|
+
* | `TIMERS_NATIVE` | If device supports native timers |
|
|
22
|
+
* | `SCHEDULE_POWER_ACTION` | If device supports scheduled power actions |
|
|
23
|
+
*
|
|
24
|
+
* If you want to check if the device supports those capabilities, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
25
|
+
* </details>
|
|
14
26
|
*/
|
|
15
27
|
class Power {
|
|
16
28
|
messagePrefix;
|
|
@@ -23,8 +35,11 @@ class Power {
|
|
|
23
35
|
/**
|
|
24
36
|
* The `systemReboot()` method initializes a system reboot.
|
|
25
37
|
*
|
|
38
|
+
* @returns {Promise<void>} Resolves when the system reboot is initiated.
|
|
26
39
|
* @since 3.0.0
|
|
27
40
|
*
|
|
41
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/system-reboot | Applet Example for System Reboot}
|
|
42
|
+
*
|
|
28
43
|
* @example
|
|
29
44
|
* await sos.management.power.systemReboot();
|
|
30
45
|
*/
|
|
@@ -36,6 +51,7 @@ class Power {
|
|
|
36
51
|
/**
|
|
37
52
|
* The `appRestart()` method initializes a restart of the signageOS app.
|
|
38
53
|
*
|
|
54
|
+
* @returns {Promise<void>} Resolves when the app restart is initiated.
|
|
39
55
|
* @since 3.0.0
|
|
40
56
|
*
|
|
41
57
|
* @example
|
|
@@ -49,10 +65,11 @@ class Power {
|
|
|
49
65
|
/**
|
|
50
66
|
* The `getTimers()` method returns a list of currently set native timers.
|
|
51
67
|
*
|
|
68
|
+
* @returns {Promise<ITimer[]>} Resolves with an array of timers.
|
|
52
69
|
* @since 4.0.0
|
|
53
70
|
*
|
|
54
71
|
* @example
|
|
55
|
-
*
|
|
72
|
+
* await sos.management.power.getTimers();
|
|
56
73
|
*/
|
|
57
74
|
async getTimers() {
|
|
58
75
|
const { timers } = await this.postMessage({
|
|
@@ -61,18 +78,27 @@ class Power {
|
|
|
61
78
|
return timers;
|
|
62
79
|
}
|
|
63
80
|
/**
|
|
64
|
-
* The `
|
|
81
|
+
* The `setTimer()` method creates or updates a native timer.
|
|
65
82
|
*
|
|
66
83
|
* @param type The type of the timer (`TIMER_1`, ..., `TIMER_7`).
|
|
67
84
|
* @param timeOn The time when the device should turn on.
|
|
68
85
|
* @param timeOff The time when the device should turn off.
|
|
69
86
|
* @param weekdays The days of the week when the timer should be active (`mon`, ..., `sun`).
|
|
70
87
|
* @param volume The volume level set when the device is turned on.
|
|
71
|
-
*
|
|
88
|
+
* @return {Promise<void>} Resolves when the timer is set.
|
|
89
|
+
* @throws {Error} If the timer type is invalid.
|
|
90
|
+
* @throws {Error} If the time format is incorrect.
|
|
91
|
+
* @throws {Error} If the weekdays array contains an invalid weekday.
|
|
92
|
+
* @throws {Error} If the `volume` parameter is not a number between 0 and 100.
|
|
93
|
+
* @throws {Error} If the `timeOn` or `timeOff` parameters do not match the expected time format (`HH:mm:ss`).
|
|
94
|
+
* @throws {Error} If the `weekdays` parameter is not an array of strings.
|
|
95
|
+
* @throws {Error} If the `type` parameter is not a valid timer type (e.g., `TIMER_1`, `TIMER_2`, ..., `TIMER_7`).
|
|
72
96
|
* @since 3.0.0
|
|
73
97
|
*
|
|
98
|
+
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/timer | Applet Example for Native Timers}
|
|
99
|
+
*
|
|
74
100
|
* @example
|
|
75
|
-
* await sos.management.power.setTimer("TIMER_1", "08:00", "22:00", ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], 30);
|
|
101
|
+
* await sos.management.power.setTimer("TIMER_1", "08:00:00", "22:00:00", ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], 30);
|
|
76
102
|
*/
|
|
77
103
|
async setTimer(type, timeOn, timeOff, weekdays, volume) {
|
|
78
104
|
if (typeof TimerHelper_1.TimerType[type] === 'undefined') {
|
|
@@ -110,7 +136,8 @@ class Power {
|
|
|
110
136
|
* The `unsetTimer()` method removes the specified native timer.
|
|
111
137
|
*
|
|
112
138
|
* @param type The type of the timer (`TIMER_1`, ..., `TIMER_7`).
|
|
113
|
-
*
|
|
139
|
+
* @returns {Promise<void>} Resolves when the timer is removed.
|
|
140
|
+
* @throws {Error} If the timer type is invalid.
|
|
114
141
|
* @since 4.0.0
|
|
115
142
|
*
|
|
116
143
|
* @example
|
|
@@ -126,6 +153,8 @@ class Power {
|
|
|
126
153
|
* The `getProprietaryTimers()` method returns a list of currently set
|
|
127
154
|
* [proprietary timers](https://docs.signageos.io/hc/en-us/articles/4416384202642-Timers#h_01HCD14GEDP96AZV58NRSN2HNQ).
|
|
128
155
|
*
|
|
156
|
+
* @returns {Promise<IProprietaryTimer[]>} Resolves with an array of proprietary timers.
|
|
157
|
+
* @throws {Error} If the timers cannot be retrieved.
|
|
129
158
|
* @since 5.10.0
|
|
130
159
|
*
|
|
131
160
|
* @example
|
|
@@ -146,11 +175,19 @@ class Power {
|
|
|
146
175
|
* @param timeOff The time when the device should turn off.
|
|
147
176
|
* @param weekdays The days of the week when the timer should be active (`mon`, ..., `sun`).
|
|
148
177
|
* @param keepAppletRunning If `true`, the applet will be kept running when the timer is active on certain devices.
|
|
149
|
-
*
|
|
178
|
+
* @return {Promise<void>} Resolves when the proprietary timer is set.
|
|
179
|
+
* @throws {Error} If the timer type is invalid or if the time format is incorrect.
|
|
180
|
+
* @throws {Error} If the weekdays array contains an invalid weekday.
|
|
181
|
+
* @throws {Error} If the `keepAppletRunning` parameter is not a boolean.
|
|
182
|
+
* @throws {Error} If the `timeOn` or `timeOff` parameters do not match the expected time format (`HH:mm:ss`).
|
|
183
|
+
* @throws {Error} If the `weekdays` parameter is not an array of strings.
|
|
184
|
+
* @throws {Error} If the `weekdays` array contains an invalid weekday.
|
|
185
|
+
* @throws {Error} If the `timeOn` or `timeOff` parameters do not match the expected time format (`HH:mm:ss`).
|
|
186
|
+
* @throws {Error} If the `type` parameter is not a valid timer type (e.g., `TIMER_1`, `TIMER_2`, ..., `TIMER_7`).
|
|
150
187
|
* @since 5.10.0
|
|
151
188
|
*
|
|
152
189
|
* @example
|
|
153
|
-
* await sos.management.power.setProprietaryTimer("
|
|
190
|
+
* await sos.management.power.setProprietaryTimer("TIMER_2", "08:00:00", "22:00:00", ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], false);
|
|
154
191
|
*/
|
|
155
192
|
async setProprietaryTimer(type, timeOn, timeOff, weekdays, keepAppletRunning = false) {
|
|
156
193
|
(0, Validate_1.default)({ type })
|
|
@@ -190,7 +227,8 @@ class Power {
|
|
|
190
227
|
* [proprietary timer](https://docs.signageos.io/hc/en-us/articles/4416384202642-Timers#h_01HCD14GEDP96AZV58NRSN2HNQ).
|
|
191
228
|
*
|
|
192
229
|
* @param type The type of the timer (`TIMER_1`, ..., `TIMER_7`).
|
|
193
|
-
*
|
|
230
|
+
* @returns {Promise<void>} Resolves when the proprietary timer is removed.
|
|
231
|
+
* @throws {Error} If the timer type is invalid.
|
|
194
232
|
* @since 5.10.0
|
|
195
233
|
*
|
|
196
234
|
* @example
|
|
@@ -203,8 +241,8 @@ class Power {
|
|
|
203
241
|
timerType: type,
|
|
204
242
|
});
|
|
205
243
|
}
|
|
206
|
-
catch
|
|
207
|
-
// Use failover method if delete fails
|
|
244
|
+
catch {
|
|
245
|
+
// Use the failover method if the delete fails, which is supported in older front-display versions
|
|
208
246
|
// It can be removed in some front-applet major version
|
|
209
247
|
await this.setProprietaryTimer(type, null, null, []);
|
|
210
248
|
}
|
|
@@ -212,6 +250,7 @@ class Power {
|
|
|
212
250
|
/**
|
|
213
251
|
* Removes all scheduled reboot rules from the device.
|
|
214
252
|
*
|
|
253
|
+
* @returns {Promise<void>} Resolves when all scheduled reboots are cleared.
|
|
215
254
|
* @since 8.1.0
|
|
216
255
|
*
|
|
217
256
|
* @example
|
|
@@ -223,8 +262,9 @@ class Power {
|
|
|
223
262
|
});
|
|
224
263
|
}
|
|
225
264
|
/**
|
|
226
|
-
* Returns all scheduled reboot rules on the device.
|
|
265
|
+
* Returns all scheduled reboot rules on the device set by the `setScheduledReboot()` method.
|
|
227
266
|
*
|
|
267
|
+
* @returns {Promise<IScheduledRebootActions[]>} Resolves with an array of scheduled reboot actions.
|
|
228
268
|
* @since 8.1.0
|
|
229
269
|
*
|
|
230
270
|
* @example
|
|
@@ -234,7 +274,7 @@ class Power {
|
|
|
234
274
|
const { actions } = await this.postMessage({
|
|
235
275
|
type: this.getMessage('get_scheduled_reboots'),
|
|
236
276
|
});
|
|
237
|
-
// We need to convert values of days back to string representation
|
|
277
|
+
// We need to convert the values of days back to a string representation
|
|
238
278
|
for (const action of actions) {
|
|
239
279
|
action.rule.weekdays = action.rule.weekdays.map((weekday) => {
|
|
240
280
|
return (0, PowerHelper_1.convertNumberToWeekday)(weekday); // Can be only number from device
|
|
@@ -243,16 +283,17 @@ class Power {
|
|
|
243
283
|
return actions;
|
|
244
284
|
}
|
|
245
285
|
/**
|
|
246
|
-
* Removes scheduled reboot rule from the device.
|
|
247
|
-
* @param id {string}
|
|
248
|
-
*
|
|
286
|
+
* Removes scheduled reboot rule from the device (if it exists).
|
|
287
|
+
* @param id {string} ID of the rule to be removed.
|
|
288
|
+
* @throws {Error} If the `id` is not a string or is empty.
|
|
289
|
+
* @returns {Promise<void>} Resolves when the scheduled reboot is removed.
|
|
249
290
|
* @since 8.1.0
|
|
250
291
|
*
|
|
251
292
|
* @example
|
|
252
293
|
* // Get scheduled reboots
|
|
253
294
|
* const scheduledReboots = await sos.management.power.getScheduledReboots();
|
|
254
295
|
*
|
|
255
|
-
* // Remove scheduled reboot
|
|
296
|
+
* // Remove scheduled reboot on the first position
|
|
256
297
|
* await sos.management.power.removeScheduledReboot(scheduledReboots[0].id);
|
|
257
298
|
*/
|
|
258
299
|
async removeScheduledReboot(id) {
|
|
@@ -263,17 +304,22 @@ class Power {
|
|
|
263
304
|
});
|
|
264
305
|
}
|
|
265
306
|
/**
|
|
266
|
-
* Schedule automatic reboot on the device. Calling this function will create one rule.
|
|
267
|
-
* It is possible to set multiple rules, which can be later obtained by `getScheduledReboots` function.
|
|
307
|
+
* Schedule an automatic reboot on the device. Calling this function will create one rule.
|
|
308
|
+
* It is possible to set multiple rules, which can be later obtained by the `getScheduledReboots` function.
|
|
268
309
|
*
|
|
269
310
|
* :::note
|
|
270
|
-
* - Setting new scheduled reboot on device might take up to 10 minutes to show in Box.
|
|
271
|
-
* - Every new scheduled reboot rule gets unique identifier generated by device,
|
|
311
|
+
* - Setting a new scheduled reboot on the device might take up to 10 minutes to show in the Box.
|
|
312
|
+
* - Every new scheduled reboot rule gets a unique identifier generated by the device, which might be later returned by `getScheduledReboots()`.
|
|
272
313
|
* :::
|
|
273
314
|
*
|
|
274
|
-
* @param weekdays {@link WeekdayType[]}
|
|
275
|
-
* @param time {string}
|
|
276
|
-
*
|
|
315
|
+
* @param weekdays {@link WeekdayType[]} Array of weekdays when the reboot should be executed.
|
|
316
|
+
* @param time {string} Time when the reboot should be executed. Format is `HH:mm:ss`.
|
|
317
|
+
* @throws {Error} If the `weekdays` parameter is not an array of strings.
|
|
318
|
+
* @throws {Error} If the `time` parameter does not match the expected time format (`HH:mm:ss`).
|
|
319
|
+
* @throws {Error} If the `weekdays` array contains an invalid weekday.
|
|
320
|
+
* @throws {Error} If the `time` parameter is not a string or does not match the expected format (`HH:mm:ss`).
|
|
321
|
+
* @throws {Error} If the `weekdays` array is empty or contains invalid values.
|
|
322
|
+
* @returns {Promise<void>} Resolves when the scheduled reboot is set.
|
|
277
323
|
* @since 8.1.0
|
|
278
324
|
*
|
|
279
325
|
* @example
|
|
@@ -291,7 +337,7 @@ class Power {
|
|
|
291
337
|
throw new Error('Invalid weekday');
|
|
292
338
|
}
|
|
293
339
|
}
|
|
294
|
-
// Days in week
|
|
340
|
+
// Days in week need to be converted to specific numbers to work properly
|
|
295
341
|
const weekdayAsNumbers = weekdays.map(PowerHelper_1.convertWeekdayToNumber);
|
|
296
342
|
(0, Validate_1.default)({ time })
|
|
297
343
|
.required()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Power.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Power/Power.ts"],"names":[],"mappings":";;;;;AACA,wDAAyE;AACzE,uEAA+C;AAE/C,qCAA4G;AAC5G,+CAA+E;AAE/E
|
|
1
|
+
{"version":3,"file":"Power.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Power/Power.ts"],"names":[],"mappings":";;;;;AACA,wDAAyE;AACzE,uEAA+C;AAE/C,qCAA4G;AAC5G,+CAA+E;AAE/E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAqB,KAAK;IAGhB;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,YAAY;QACxB,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;SACtC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,UAAU;QACtB,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;SACpC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,SAAS;QACrB,MAAM,EAAE,MAAM,EAAE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AAC,EAAE,IAAI,EAAE,CAAC;aAChB,QAAQ,EAAE;aACV,MAAM,EAAE;aACR,WAAW,CAAC,mBAAmB,CAAC;aAChC,SAAS,EAAE,CAAC;QAEd,MAAM,IAAI,GAAyB;YAClC,QAAQ,EAAE,gBAAgB;YAC1B,IAAI;SACJ,CAAC;QAEF,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC;YAC7C,IAAI;SACJ,CAAC,CAAC;IACJ,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;IACxC,CAAC;CACD;AAzWD,wBAyWC"}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import IPostMessage from '../../IPostMessage';
|
|
2
2
|
import IProxy from './IProxy';
|
|
3
|
+
/**
|
|
4
|
+
* The `sos.management.proxy` API groups together methods for managing the proxy settings on the device.
|
|
5
|
+
*
|
|
6
|
+
* <details>
|
|
7
|
+
* <summary>Proxy Management Capabilities</summary>
|
|
8
|
+
* | Capability | Description |
|
|
9
|
+
* |:------------|:-------------|
|
|
10
|
+
* | `PROXY` | If device supports Proxy setup connection |
|
|
11
|
+
*
|
|
12
|
+
* If you want to check if the device supports this capability, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
13
|
+
* </details>
|
|
14
|
+
*/
|
|
3
15
|
export default class Proxy implements IProxy {
|
|
4
16
|
private messagePrefix;
|
|
5
17
|
private postMessage;
|
|
@@ -8,24 +20,35 @@ export default class Proxy implements IProxy {
|
|
|
8
20
|
/**
|
|
9
21
|
* The `isEnabled()` method returns whether the proxy is enabled on the device.
|
|
10
22
|
*
|
|
23
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the proxy is enabled.
|
|
11
24
|
* @since 5.4.0
|
|
12
25
|
*
|
|
13
26
|
* @example
|
|
14
27
|
* const enabled = await sos.management.proxy.isEnabled();
|
|
28
|
+
* console.log(`Proxy is enabled: ${enabled}`);
|
|
15
29
|
*/
|
|
16
30
|
isEnabled(): Promise<boolean>;
|
|
17
31
|
/**
|
|
18
|
-
* The `setManual()`
|
|
32
|
+
* The `setManual()` allows you to manually configure the proxy settings on the device.
|
|
19
33
|
*
|
|
34
|
+
* @param uri The URI of the proxy server
|
|
35
|
+
* @param port The port of the proxy server
|
|
36
|
+
* @param username The username for the proxy server
|
|
37
|
+
* @param password The password for the proxy server
|
|
38
|
+
* @return {Promise<void>} A promise that resolves when the proxy is set.
|
|
39
|
+
* @throws {Error} If the proxy settings are invalid.
|
|
40
|
+
* @throws {Error} If the device does not support proxy management.
|
|
20
41
|
* @since 5.4.0
|
|
21
42
|
*
|
|
22
43
|
* @example
|
|
23
|
-
*
|
|
44
|
+
* await sos.management.proxy.setManual('178.62.193.192', 1080, 'username', 'password');
|
|
24
45
|
*/
|
|
25
46
|
setManual(uri: string, port: number, username?: string, password?: string): Promise<void>;
|
|
26
47
|
/**
|
|
27
48
|
* The `disable()` method disables the proxy on the device.
|
|
28
49
|
*
|
|
50
|
+
* @returns {Promise<void>} A promise that resolves when the proxy is disabled.
|
|
51
|
+
* @throws {Error} If the device does not support proxy management.
|
|
29
52
|
* @since 5.4.0
|
|
30
53
|
*
|
|
31
54
|
* @example
|
|
@@ -33,8 +56,10 @@ export default class Proxy implements IProxy {
|
|
|
33
56
|
*/
|
|
34
57
|
disable(): Promise<void>;
|
|
35
58
|
/**
|
|
36
|
-
* The `getConnectedTo()`
|
|
59
|
+
* The `getConnectedTo()` method returns the current connected proxy server URI on the device.
|
|
37
60
|
*
|
|
61
|
+
* @returns {Promise<string>} A promise that resolves to the URI of the connected proxy server.
|
|
62
|
+
* @throws {Error} If the device does not support proxy management.
|
|
38
63
|
* @since 5.4.0
|
|
39
64
|
*
|
|
40
65
|
* @example
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* The `sos.management.proxy` API groups together methods for managing the proxy settings on the device.
|
|
5
|
+
*
|
|
6
|
+
* <details>
|
|
7
|
+
* <summary>Proxy Management Capabilities</summary>
|
|
8
|
+
* | Capability | Description |
|
|
9
|
+
* |:------------|:-------------|
|
|
10
|
+
* | `PROXY` | If device supports Proxy setup connection |
|
|
11
|
+
*
|
|
12
|
+
* If you want to check if the device supports this capability, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
|
|
13
|
+
* </details>
|
|
14
|
+
*/
|
|
3
15
|
class Proxy {
|
|
4
16
|
messagePrefix;
|
|
5
17
|
postMessage;
|
|
@@ -11,10 +23,12 @@ class Proxy {
|
|
|
11
23
|
/**
|
|
12
24
|
* The `isEnabled()` method returns whether the proxy is enabled on the device.
|
|
13
25
|
*
|
|
26
|
+
* @returns {Promise<boolean>} A promise that resolves to a boolean indicating if the proxy is enabled.
|
|
14
27
|
* @since 5.4.0
|
|
15
28
|
*
|
|
16
29
|
* @example
|
|
17
30
|
* const enabled = await sos.management.proxy.isEnabled();
|
|
31
|
+
* console.log(`Proxy is enabled: ${enabled}`);
|
|
18
32
|
*/
|
|
19
33
|
async isEnabled() {
|
|
20
34
|
const { isEnabled } = await this.postMessage({
|
|
@@ -23,12 +37,19 @@ class Proxy {
|
|
|
23
37
|
return isEnabled;
|
|
24
38
|
}
|
|
25
39
|
/**
|
|
26
|
-
* The `setManual()`
|
|
40
|
+
* The `setManual()` allows you to manually configure the proxy settings on the device.
|
|
27
41
|
*
|
|
42
|
+
* @param uri The URI of the proxy server
|
|
43
|
+
* @param port The port of the proxy server
|
|
44
|
+
* @param username The username for the proxy server
|
|
45
|
+
* @param password The password for the proxy server
|
|
46
|
+
* @return {Promise<void>} A promise that resolves when the proxy is set.
|
|
47
|
+
* @throws {Error} If the proxy settings are invalid.
|
|
48
|
+
* @throws {Error} If the device does not support proxy management.
|
|
28
49
|
* @since 5.4.0
|
|
29
50
|
*
|
|
30
51
|
* @example
|
|
31
|
-
*
|
|
52
|
+
* await sos.management.proxy.setManual('178.62.193.192', 1080, 'username', 'password');
|
|
32
53
|
*/
|
|
33
54
|
async setManual(uri, port, username, password) {
|
|
34
55
|
await this.postMessage({
|
|
@@ -42,6 +63,8 @@ class Proxy {
|
|
|
42
63
|
/**
|
|
43
64
|
* The `disable()` method disables the proxy on the device.
|
|
44
65
|
*
|
|
66
|
+
* @returns {Promise<void>} A promise that resolves when the proxy is disabled.
|
|
67
|
+
* @throws {Error} If the device does not support proxy management.
|
|
45
68
|
* @since 5.4.0
|
|
46
69
|
*
|
|
47
70
|
* @example
|
|
@@ -53,8 +76,10 @@ class Proxy {
|
|
|
53
76
|
});
|
|
54
77
|
}
|
|
55
78
|
/**
|
|
56
|
-
* The `getConnectedTo()`
|
|
79
|
+
* The `getConnectedTo()` method returns the current connected proxy server URI on the device.
|
|
57
80
|
*
|
|
81
|
+
* @returns {Promise<string>} A promise that resolves to the URI of the connected proxy server.
|
|
82
|
+
* @throws {Error} If the device does not support proxy management.
|
|
58
83
|
* @since 5.4.0
|
|
59
84
|
*
|
|
60
85
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Proxy.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Proxy/Proxy.ts"],"names":[],"mappings":";;AAGA,MAAqB,KAAK;IAGhB;IACA;IAHT,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAmB;IACpC,CAAC;IAEJ
|
|
1
|
+
{"version":3,"file":"Proxy.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Proxy/Proxy.ts"],"names":[],"mappings":";;AAGA;;;;;;;;;;;GAWG;AACH,MAAqB,KAAK;IAGhB;IACA;IAHT,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAQ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