@signageos/front-applet 8.6.0 → 8.8.0
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 +7 -7
- package/dist/bundle.js.map +1 -1
- package/docs/fpath/index.md +0 -270
- package/docs/sos/browser.md +0 -14
- package/docs/sos/command.md +0 -18
- package/docs/sos/deviceInfo.md +0 -17
- package/docs/sos/display.md +0 -8
- package/docs/sos/fileSystem.md +0 -488
- package/docs/sos/hardware/index.md +2 -49
- package/docs/sos/input.md +0 -12
- package/docs/sos/native/mdc.md +1 -35
- package/docs/sos/native/nmc.md +127 -0
- package/docs/sos/offline/cache.md +0 -6
- package/docs/sos/offline/index.md +0 -27
- package/docs/sos/proofOfPlay.md +0 -10
- package/docs/sos/stream.md +11 -781
- package/docs/sos/sync.md +0 -23
- package/docs/sos/video.md +0 -86
- package/docs/sos_management/app.md +32 -29
- package/docs/sos_management/index.md +2 -10
- package/docs/sos_management/network.md +73 -19
- package/docs/sos_management/os.md +0 -11
- package/docs/sos_management/package.md +20 -0
- package/docs/sos_management/power.md +50 -30
- package/docs/sos_management/screen.md +0 -7
- package/docs/sos_management/time.md +0 -3
- package/docs/sos_management/wifi.md +0 -101
- package/es6/FrontApplet/Management/App/App.d.ts +34 -24
- package/es6/FrontApplet/Management/App/App.js.map +1 -1
- package/es6/FrontApplet/Management/IManagement.d.ts +1 -1
- package/es6/FrontApplet/Management/Network/INetwork.d.ts +2 -0
- package/es6/FrontApplet/Management/Network/INetwork.js.map +1 -1
- package/es6/FrontApplet/Management/Network/Network.d.ts +35 -0
- package/es6/FrontApplet/Management/Network/Network.js +68 -0
- package/es6/FrontApplet/Management/Network/Network.js.map +1 -1
- package/es6/FrontApplet/Management/Network/wakeOnLan.d.ts +18 -0
- package/es6/FrontApplet/Management/Network/wakeOnLan.js +43 -0
- package/es6/FrontApplet/Management/Network/wakeOnLan.js.map +1 -0
- package/es6/FrontApplet/Management/Package/Package.d.ts +9 -0
- package/es6/FrontApplet/Management/Package/Package.js +15 -0
- package/es6/FrontApplet/Management/Package/Package.js.map +1 -1
- package/es6/FrontApplet/Management/Power/IPower.d.ts +32 -10
- package/es6/FrontApplet/Management/Power/IPower.js +3 -0
- package/es6/FrontApplet/Management/Power/IPower.js.map +1 -1
- package/es6/FrontApplet/Management/Power/Power.d.ts +12 -8
- package/es6/FrontApplet/Management/Power/Power.js +23 -32
- package/es6/FrontApplet/Management/Power/Power.js.map +1 -1
- package/es6/FrontApplet/Management/Power/PowerHelper.d.ts +8 -3
- package/es6/FrontApplet/Management/Power/PowerHelper.js +32 -0
- package/es6/FrontApplet/Management/Power/PowerHelper.js.map +1 -1
- package/es6/FrontApplet/Management/helpers/ProprietaryTimerHelper.d.ts +2 -1
- package/es6/FrontApplet/Management/helpers/TimerHelper.d.ts +3 -1
- package/es6/FrontApplet/Management/helpers/TimerHelper.js +2 -0
- package/es6/FrontApplet/Management/helpers/TimerHelper.js.map +1 -1
- package/es6/FrontApplet/NativeCommands/NMC/CommandsNmc.d.ts +4 -0
- package/es6/FrontApplet/NativeCommands/NMC/CommandsNmc.js +66 -0
- package/es6/FrontApplet/NativeCommands/NMC/CommandsNmc.js.map +1 -0
- package/es6/FrontApplet/NativeCommands/NMC/INativeNmcCommands.d.ts +21 -0
- package/es6/FrontApplet/NativeCommands/NMC/INativeNmcCommands.js +3 -0
- package/es6/FrontApplet/NativeCommands/NMC/INativeNmcCommands.js.map +1 -0
- package/es6/FrontApplet/NativeCommands/NMC/Nmc.d.ts +50 -0
- package/es6/FrontApplet/NativeCommands/NMC/Nmc.js +77 -0
- package/es6/FrontApplet/NativeCommands/NMC/Nmc.js.map +1 -0
- package/es6/FrontApplet/NativeCommands/NativeCommands.d.ts +2 -0
- package/es6/FrontApplet/NativeCommands/NativeCommands.js +3 -0
- package/es6/FrontApplet/NativeCommands/NativeCommands.js.map +1 -1
- package/es6/FrontApplet/Video/IOptions.d.ts +5 -0
- package/es6/Monitoring/Management/Network/handleManagementNetworkRequests.js +14 -0
- package/es6/Monitoring/Management/Network/handleManagementNetworkRequests.js.map +1 -1
- package/es6/Monitoring/Management/Network/managementNetworkCommands.d.ts +23 -1
- package/es6/Monitoring/Management/Network/managementNetworkCommands.js +5 -1
- package/es6/Monitoring/Management/Network/managementNetworkCommands.js.map +1 -1
- package/es6/Monitoring/Management/Power/powerCommands.d.ts +3 -3
- package/package.json +1 -1
|
@@ -74,9 +74,11 @@ interface IProprietaryTimer {
|
|
|
74
74
|
type: ProprietaryTimerType;
|
|
75
75
|
timeOn: string | null;
|
|
76
76
|
timeOff: string | null;
|
|
77
|
-
weekdays:
|
|
77
|
+
weekdays: ShortWeekdayType[];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
type ShortWeekdayType = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
81
|
+
|
|
80
82
|
```
|
|
81
83
|
|
|
82
84
|
#### Return value
|
|
@@ -100,25 +102,30 @@ const timers = await sos.management.power.getProprietaryTimers();
|
|
|
100
102
|
Returns all scheduled reboot rules on the device set by the `setScheduledReboot()` method.
|
|
101
103
|
|
|
102
104
|
```ts expandable
|
|
103
|
-
getScheduledReboots(): Promise<
|
|
105
|
+
getScheduledReboots(): Promise<IScheduledRebootAction<IScheduledRebootRule>[]>;
|
|
104
106
|
// show-more
|
|
105
|
-
|
|
106
|
-
* Interface representing the scheduled reboot action.
|
|
107
|
-
*/
|
|
108
|
-
interface IScheduledRebootActions {
|
|
109
|
-
/** Random generated ID for the scheduled reboot action */
|
|
107
|
+
interface IScheduledRebootAction<TRule extends IScheduledRebootRuleRaw | IScheduledRebootRule> {
|
|
110
108
|
id: string;
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
rule: TRule;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface IScheduledRebootRuleRaw {
|
|
113
|
+
weekdays: WeekdayNumberType[];
|
|
114
|
+
time: string;
|
|
113
115
|
}
|
|
114
116
|
|
|
117
|
+
type WeekdayNumberType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
118
|
+
|
|
115
119
|
interface IScheduledRebootRule {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/** Time in HH:mm:ss format */
|
|
120
|
+
weekdays: WeekdayType[];
|
|
121
|
+
shortWeekdays: ShortWeekdayType[];
|
|
119
122
|
time: string;
|
|
120
123
|
}
|
|
121
124
|
|
|
125
|
+
type WeekdayType = 'SUNDAY' | 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY';
|
|
126
|
+
|
|
127
|
+
type ShortWeekdayType = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
128
|
+
|
|
122
129
|
```
|
|
123
130
|
|
|
124
131
|
#### Return value
|
|
@@ -144,10 +151,12 @@ interface ITimer {
|
|
|
144
151
|
type: keyof typeof TimerType;
|
|
145
152
|
timeOn: string | null;
|
|
146
153
|
timeOff: string | null;
|
|
147
|
-
weekdays:
|
|
154
|
+
weekdays: ShortWeekdayType[];
|
|
148
155
|
volume: number;
|
|
149
156
|
}
|
|
150
157
|
|
|
158
|
+
type ShortWeekdayType = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
159
|
+
|
|
151
160
|
```
|
|
152
161
|
|
|
153
162
|
#### Return value
|
|
@@ -202,18 +211,23 @@ The `setProprietaryTimer()` method creates or updates a
|
|
|
202
211
|
[proprietary timer](https://docs.signageos.io/hc/en-us/articles/4416384202642-Timers#h_01HCD14GEDP96AZV58NRSN2HNQ).
|
|
203
212
|
|
|
204
213
|
```ts expandable
|
|
205
|
-
setProprietaryTimer(type: ProprietaryTimerType, timeOn: string | null, timeOff: string | null, weekdays:
|
|
214
|
+
setProprietaryTimer(type: ProprietaryTimerType, timeOn: string | null, timeOff: string | null, weekdays: (ShortWeekdayType | AnyString)[], keepAppletRunning?: boolean): Promise<void>;
|
|
215
|
+
// show-more
|
|
216
|
+
type ShortWeekdayType = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
217
|
+
|
|
218
|
+
type AnyString = string & {};
|
|
219
|
+
|
|
206
220
|
```
|
|
207
221
|
|
|
208
222
|
#### Params
|
|
209
223
|
|
|
210
|
-
| Name | Type
|
|
211
|
-
|
|
212
|
-
| `type` | ``TIMER_${number}``
|
|
213
|
-
| `timeOn` | `string \| null`
|
|
214
|
-
| `timeOff` | `string \| null`
|
|
215
|
-
| `weekdays` | `
|
|
216
|
-
| `keepAppletRunning` | `boolean`
|
|
224
|
+
| Name | Type | Required | Description |
|
|
225
|
+
|---------------------|-------------------------------------|------------------|-----------------------------------------------------------------------------------------|
|
|
226
|
+
| `type` | ``TIMER_${number}`` | <div>Yes</div> | The type of the timer (`TIMER_1`, ..., `TIMER_7`). |
|
|
227
|
+
| `timeOn` | `string \| null` | <div>Yes</div> | The time when the device should turn on. |
|
|
228
|
+
| `timeOff` | `string \| null` | <div>Yes</div> | The time when the device should turn off. |
|
|
229
|
+
| `weekdays` | `(AnyString \| ShortWeekdayType)[]` | <div>Yes</div> | The days of the week when the timer should be active (`mon`, ..., `sun`). |
|
|
230
|
+
| `keepAppletRunning` | `boolean` | <div>No</div> | If `true`, the applet will be kept running when the timer is active on certain devices. |
|
|
217
231
|
|
|
218
232
|
#### Return value
|
|
219
233
|
|
|
@@ -250,19 +264,20 @@ It is possible to set multiple rules, which can be later obtained by the `getSch
|
|
|
250
264
|
:::
|
|
251
265
|
|
|
252
266
|
```ts expandable
|
|
253
|
-
setScheduledReboot(weekdays:
|
|
267
|
+
setScheduledReboot(weekdays: (ShortWeekdayType | AnyString)[], time: string): Promise<void>;
|
|
254
268
|
// show-more
|
|
255
|
-
|
|
256
|
-
|
|
269
|
+
type ShortWeekdayType = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
270
|
+
|
|
271
|
+
type AnyString = string & {};
|
|
257
272
|
|
|
258
273
|
```
|
|
259
274
|
|
|
260
275
|
#### Params
|
|
261
276
|
|
|
262
|
-
| Name | Type
|
|
263
|
-
|
|
264
|
-
| `weekdays` | `
|
|
265
|
-
| `time` | `string`
|
|
277
|
+
| Name | Type | Required | Description |
|
|
278
|
+
|------------|-------------------------------------|------------------|-----------------------------------------------------------------------|
|
|
279
|
+
| `weekdays` | `(AnyString \| ShortWeekdayType)[]` | <div>Yes</div> | `WeekdayType[]` Array of weekdays when the reboot should be executed. |
|
|
280
|
+
| `time` | `string` | <div>Yes</div> | Time when the reboot should be executed. Format is `HH:mm:ss`. |
|
|
266
281
|
|
|
267
282
|
#### Return value
|
|
268
283
|
|
|
@@ -294,7 +309,12 @@ await sos.management.power.setScheduledReboot(["MONDAY", "FRIDAY"], "19:30:00");
|
|
|
294
309
|
The `setTimer()` method creates or updates a native timer.
|
|
295
310
|
|
|
296
311
|
```ts expandable
|
|
297
|
-
setTimer(type: keyof typeof TimerType, timeOn: string | null, timeOff: string | null, weekdays:
|
|
312
|
+
setTimer(type: keyof typeof TimerType, timeOn: string | null, timeOff: string | null, weekdays: (ShortWeekdayType | AnyString)[], volume: number): Promise<void>;
|
|
313
|
+
// show-more
|
|
314
|
+
type ShortWeekdayType = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
315
|
+
|
|
316
|
+
type AnyString = string & {};
|
|
317
|
+
|
|
298
318
|
```
|
|
299
319
|
|
|
300
320
|
#### Params
|
|
@@ -304,7 +324,7 @@ setTimer(type: keyof typeof TimerType, timeOn: string | null, timeOff: string |
|
|
|
304
324
|
| `type` | `"TIMER_1" \| "TIMER_2" \| "TIMER_3" \| "TIMER_4" \| "TIMER_5" \| "TIMER_6" \| "TIMER_7"` | <div>Yes</div> | The type of the timer (`TIMER_1`, ..., `TIMER_7`). |
|
|
305
325
|
| `timeOn` | `string \| null` | <div>Yes</div> | The time when the device should turn on. |
|
|
306
326
|
| `timeOff` | `string \| null` | <div>Yes</div> | The time when the device should turn off. |
|
|
307
|
-
| `weekdays` | `
|
|
327
|
+
| `weekdays` | `ShortWeekdayType` | <div>Yes</div> | The days of the week when the timer should be active (`mon`, ..., `sun`). |
|
|
308
328
|
| `volume` | `number` | <div>Yes</div> | The volume level set when the device is turned on. |
|
|
309
329
|
|
|
310
330
|
#### Return value
|
|
@@ -295,17 +295,12 @@ signageOS provides a standalone server that implements all of those methods. It
|
|
|
295
295
|
takeAndUploadScreenshot(uploadBaseUrl: string, options?: TakeAndUploadScreenshotOptions): Promise<TakeAndUploadScreenshotResult>;
|
|
296
296
|
// show-more
|
|
297
297
|
interface TakeAndUploadScreenshotResult {
|
|
298
|
-
/** URL of the uploaded screenshot. */
|
|
299
298
|
screenshotUrl: string;
|
|
300
|
-
/** aHash of the screenshot, if computed. */
|
|
301
299
|
aHash?: string;
|
|
302
300
|
}
|
|
303
301
|
|
|
304
|
-
/** Options for taking and uploading a screenshot. */
|
|
305
302
|
interface TakeAndUploadScreenshotOptions {
|
|
306
|
-
/** Whether to compute the hash of the screenshot. Default is false. */
|
|
307
303
|
computeHash?: boolean;
|
|
308
|
-
/** Additional headers to include in the upload request. */
|
|
309
304
|
headers?: Record<string, string>;
|
|
310
305
|
}
|
|
311
306
|
|
|
@@ -374,9 +369,7 @@ This method was deprecated. Use `takeAndUploadScreenshot(uploadBaseUrl: string,
|
|
|
374
369
|
takeAndUploadScreenshot(uploadBaseUrl: string, computeHash?: boolean): Promise<TakeAndUploadScreenshotResult>;
|
|
375
370
|
// show-more
|
|
376
371
|
interface TakeAndUploadScreenshotResult {
|
|
377
|
-
/** URL of the uploaded screenshot. */
|
|
378
372
|
screenshotUrl: string;
|
|
379
|
-
/** aHash of the screenshot, if computed. */
|
|
380
373
|
aHash?: string;
|
|
381
374
|
}
|
|
382
375
|
|
|
@@ -66,9 +66,6 @@ The `setManual()` method sets the system time and the system timezone and disabl
|
|
|
66
66
|
```ts expandable
|
|
67
67
|
setManual(dateTime: DateTime, timezone: string): Promise<void>;
|
|
68
68
|
// show-more
|
|
69
|
-
/**
|
|
70
|
-
* All values are raw, none are zero-indexed.
|
|
71
|
-
*/
|
|
72
69
|
interface DateTime {
|
|
73
70
|
year: number;
|
|
74
71
|
month: number;
|
|
@@ -50,67 +50,43 @@ Make sure that you have a backup script or a checking mechanism in place, which
|
|
|
50
50
|
```ts expandable
|
|
51
51
|
connect(ssid: string, password?: string, options?: IWifiConnectOptions): Promise<void>;
|
|
52
52
|
// show-more
|
|
53
|
-
/**
|
|
54
|
-
* Options for connecting to a Wi-Fi network.
|
|
55
|
-
*/
|
|
56
53
|
interface IWifiConnectOptions<T extends IEAPConfig = IEAPConfig> {
|
|
57
|
-
/** The type of security/encryption used by the network. */
|
|
58
54
|
securityType?: WifiEncryptionType;
|
|
59
|
-
/** Whether the network is hidden. */
|
|
60
55
|
hidden?: boolean;
|
|
61
|
-
/** Authentication details for networks that require EAP. */
|
|
62
56
|
eap?: T;
|
|
63
57
|
}
|
|
64
58
|
|
|
65
59
|
type IEAPConfig = IEAP_PEAP | IEAP_TTLS | IEAP_TLS;
|
|
66
60
|
|
|
67
61
|
interface IEAP_PEAP extends IEAPBase {
|
|
68
|
-
/** The type of EAP authentication to use. */
|
|
69
62
|
method: 'PEAP';
|
|
70
|
-
/** Anonymous/outer identity used for initial authentication before the encrypted tunnel is established. */
|
|
71
63
|
anonymousIdentity?: string;
|
|
72
|
-
/** Secondary authentication method.*/
|
|
73
64
|
phase2Auth?: EAPPhase2Auth;
|
|
74
|
-
/** Whether to use a CA certificate for authentication. */
|
|
75
65
|
useCACert: boolean;
|
|
76
|
-
/** CA certificate in PEM format */
|
|
77
66
|
caCertificate?: string;
|
|
78
67
|
}
|
|
79
68
|
|
|
80
69
|
type EAPPhase2Auth = 'PAP' | 'MSCHAP' | 'MSCHAPV2' | 'GTC' | 'CHAP';
|
|
81
70
|
|
|
82
71
|
interface IEAPBase {
|
|
83
|
-
/** Username or identity for authentication. */
|
|
84
72
|
identity: string;
|
|
85
|
-
/** Password or passphrase for authentication. */
|
|
86
73
|
identityPassword?: string;
|
|
87
|
-
/** Optional domain for server certificate validation. */
|
|
88
74
|
domain?: string;
|
|
89
75
|
}
|
|
90
76
|
|
|
91
77
|
interface IEAP_TTLS extends IEAPBase {
|
|
92
|
-
/** The type of EAP authentication to use. */
|
|
93
78
|
method: 'TTLS';
|
|
94
|
-
/** Anonymous/outer identity used for initial authentication before the encrypted tunnel is established. */
|
|
95
79
|
anonymousIdentity?: string;
|
|
96
|
-
/** Secondary authentication method. */
|
|
97
80
|
phase2Auth?: EAPPhase2Auth;
|
|
98
|
-
/** Whether to use a CA certificate for authentication. */
|
|
99
81
|
useCACert: boolean;
|
|
100
|
-
/** CA certificate in PEM format */
|
|
101
82
|
caCertificate?: string;
|
|
102
83
|
}
|
|
103
84
|
|
|
104
85
|
interface IEAP_TLS extends IEAPBase {
|
|
105
|
-
/** The type of EAP authentication to use. */
|
|
106
86
|
method: 'TLS';
|
|
107
|
-
/** CA certificate in PEM format, if required. */
|
|
108
87
|
caCertificate: string;
|
|
109
|
-
/** Client certificate in PEM format, if required. */
|
|
110
88
|
clientCertificate: string;
|
|
111
|
-
/** Private key in PEM format, if required. */
|
|
112
89
|
privateKey: string;
|
|
113
|
-
/** Password for the private key, if it's encrypted. */
|
|
114
90
|
privateKeyPassword?: string;
|
|
115
91
|
}
|
|
116
92
|
|
|
@@ -406,29 +382,11 @@ The `on()` method sets up a listener, which is called whenever the specified eve
|
|
|
406
382
|
on(event: WifiEvent, listener: () => void): void;
|
|
407
383
|
// show-more
|
|
408
384
|
enum WifiEvent {
|
|
409
|
-
/**
|
|
410
|
-
* Wi-Fi was set to CLIENT state.
|
|
411
|
-
*/
|
|
412
385
|
CLIENT_ENABLED = "client_enabled",
|
|
413
|
-
/**
|
|
414
|
-
* Wi-Fi is in CLIENT state and have connected to a network.
|
|
415
|
-
*/
|
|
416
386
|
CLIENT_CONNECTED = "client_connected",
|
|
417
|
-
/**
|
|
418
|
-
* Wi-Fi is in CLIENT state and failed to connect to a network.
|
|
419
|
-
*/
|
|
420
387
|
CLIENT_CONNECT_REJECTED = "client_connect_rejected",
|
|
421
|
-
/**
|
|
422
|
-
* Wi-Fi is in CLIENT state and disconnected from a network.
|
|
423
|
-
*/
|
|
424
388
|
CLIENT_DISCONNECTED = "client_disconnected",
|
|
425
|
-
/**
|
|
426
|
-
* Wi-Fi was set to AP state.
|
|
427
|
-
*/
|
|
428
389
|
AP_ENABLED = "ap_enabled",
|
|
429
|
-
/**
|
|
430
|
-
* Wi-Fi was set to DISABLED state.
|
|
431
|
-
*/
|
|
432
390
|
DISABLED = "disabled"
|
|
433
391
|
}
|
|
434
392
|
|
|
@@ -463,29 +421,11 @@ The `on()` method sets up a **one-time** listener, which is called whenever the
|
|
|
463
421
|
once(event: WifiEvent, listener: () => void): void;
|
|
464
422
|
// show-more
|
|
465
423
|
enum WifiEvent {
|
|
466
|
-
/**
|
|
467
|
-
* Wi-Fi was set to CLIENT state.
|
|
468
|
-
*/
|
|
469
424
|
CLIENT_ENABLED = "client_enabled",
|
|
470
|
-
/**
|
|
471
|
-
* Wi-Fi is in CLIENT state and have connected to a network.
|
|
472
|
-
*/
|
|
473
425
|
CLIENT_CONNECTED = "client_connected",
|
|
474
|
-
/**
|
|
475
|
-
* Wi-Fi is in CLIENT state and failed to connect to a network.
|
|
476
|
-
*/
|
|
477
426
|
CLIENT_CONNECT_REJECTED = "client_connect_rejected",
|
|
478
|
-
/**
|
|
479
|
-
* Wi-Fi is in CLIENT state and disconnected from a network.
|
|
480
|
-
*/
|
|
481
427
|
CLIENT_DISCONNECTED = "client_disconnected",
|
|
482
|
-
/**
|
|
483
|
-
* Wi-Fi was set to AP state.
|
|
484
|
-
*/
|
|
485
428
|
AP_ENABLED = "ap_enabled",
|
|
486
|
-
/**
|
|
487
|
-
* Wi-Fi was set to DISABLED state.
|
|
488
|
-
*/
|
|
489
429
|
DISABLED = "disabled"
|
|
490
430
|
}
|
|
491
431
|
|
|
@@ -520,29 +460,11 @@ The `removeAllListeners()` method removes all listeners for a specified event or
|
|
|
520
460
|
removeAllListeners(event?: WifiEvent): void;
|
|
521
461
|
// show-more
|
|
522
462
|
enum WifiEvent {
|
|
523
|
-
/**
|
|
524
|
-
* Wi-Fi was set to CLIENT state.
|
|
525
|
-
*/
|
|
526
463
|
CLIENT_ENABLED = "client_enabled",
|
|
527
|
-
/**
|
|
528
|
-
* Wi-Fi is in CLIENT state and have connected to a network.
|
|
529
|
-
*/
|
|
530
464
|
CLIENT_CONNECTED = "client_connected",
|
|
531
|
-
/**
|
|
532
|
-
* Wi-Fi is in CLIENT state and failed to connect to a network.
|
|
533
|
-
*/
|
|
534
465
|
CLIENT_CONNECT_REJECTED = "client_connect_rejected",
|
|
535
|
-
/**
|
|
536
|
-
* Wi-Fi is in CLIENT state and disconnected from a network.
|
|
537
|
-
*/
|
|
538
466
|
CLIENT_DISCONNECTED = "client_disconnected",
|
|
539
|
-
/**
|
|
540
|
-
* Wi-Fi was set to AP state.
|
|
541
|
-
*/
|
|
542
467
|
AP_ENABLED = "ap_enabled",
|
|
543
|
-
/**
|
|
544
|
-
* Wi-Fi was set to DISABLED state.
|
|
545
|
-
*/
|
|
546
468
|
DISABLED = "disabled"
|
|
547
469
|
}
|
|
548
470
|
|
|
@@ -568,29 +490,11 @@ The `removeListener()` method removes a listener previously set up by `on()` or
|
|
|
568
490
|
removeListener(event: WifiEvent, listener: () => void): void;
|
|
569
491
|
// show-more
|
|
570
492
|
enum WifiEvent {
|
|
571
|
-
/**
|
|
572
|
-
* Wi-Fi was set to CLIENT state.
|
|
573
|
-
*/
|
|
574
493
|
CLIENT_ENABLED = "client_enabled",
|
|
575
|
-
/**
|
|
576
|
-
* Wi-Fi is in CLIENT state and have connected to a network.
|
|
577
|
-
*/
|
|
578
494
|
CLIENT_CONNECTED = "client_connected",
|
|
579
|
-
/**
|
|
580
|
-
* Wi-Fi is in CLIENT state and failed to connect to a network.
|
|
581
|
-
*/
|
|
582
495
|
CLIENT_CONNECT_REJECTED = "client_connect_rejected",
|
|
583
|
-
/**
|
|
584
|
-
* Wi-Fi is in CLIENT state and disconnected from a network.
|
|
585
|
-
*/
|
|
586
496
|
CLIENT_DISCONNECTED = "client_disconnected",
|
|
587
|
-
/**
|
|
588
|
-
* Wi-Fi was set to AP state.
|
|
589
|
-
*/
|
|
590
497
|
AP_ENABLED = "ap_enabled",
|
|
591
|
-
/**
|
|
592
|
-
* Wi-Fi was set to DISABLED state.
|
|
593
|
-
*/
|
|
594
498
|
DISABLED = "disabled"
|
|
595
499
|
}
|
|
596
500
|
|
|
@@ -616,13 +520,8 @@ The `scanDevices()` method initializes a new network scan and available networks
|
|
|
616
520
|
```ts expandable
|
|
617
521
|
scanDevices(): Promise<IScannedDevice[]>;
|
|
618
522
|
// show-more
|
|
619
|
-
/**
|
|
620
|
-
* Interface representing a scanned Wi-Fi device.
|
|
621
|
-
*/
|
|
622
523
|
interface IScannedDevice {
|
|
623
|
-
/** SSID of the Wi-Fi network */
|
|
624
524
|
ssid: string;
|
|
625
|
-
/** If Wi-Fi SSID is encrypted */
|
|
626
525
|
encrypted: boolean;
|
|
627
526
|
}
|
|
628
527
|
|
|
@@ -73,24 +73,36 @@ export default class App implements IApp {
|
|
|
73
73
|
*/
|
|
74
74
|
upgrade(baseUrl: string, version: string): Promise<void>;
|
|
75
75
|
/**
|
|
76
|
-
* The `upgrade(appUri)` method upgrades the signageOS application with the provided `appUri`. Open users can upgrade the app passing
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* - ChromeOS: Not supported
|
|
88
|
-
*
|
|
89
|
-
* :::tip
|
|
90
|
-
* Check our latest versions in our [changelogs](https://docs.signageos.io/hc/en-us/sections/4409161443730-Core-Apps).
|
|
76
|
+
* The `upgrade(appUri)` method upgrades the signageOS application with the provided `appUri`. Open users can upgrade the app passing
|
|
77
|
+
* a URL where the application files are hosted.
|
|
78
|
+
*
|
|
79
|
+
* :::warning Strict URL and folder structure requirements
|
|
80
|
+
* The `appUri` **must** follow the exact folder structure produced by the signageOS Device-app Builder.
|
|
81
|
+
* The upgrade will fail silently (device reverts to the previous version) if the URL does not match the expected format.
|
|
82
|
+
*
|
|
83
|
+
* Key rules:
|
|
84
|
+
* 1. **The folder structure on your server must match the ZIP package from signageOS exactly.** Do not rename files or reorganize folders.
|
|
85
|
+
* 2. **HTTP redirects (e.g., 302) are not supported.** Files must be directly accessible at the expected URLs.
|
|
86
|
+
* 3. **The URL must not end with a trailing slash (`/`).** A trailing slash causes the upgrade to fail.
|
|
91
87
|
* :::
|
|
92
88
|
*
|
|
93
|
-
*
|
|
89
|
+
* The expected URL format differs per platform:
|
|
90
|
+
*
|
|
91
|
+
* | Platform | URL format |
|
|
92
|
+
* |----------|-----------|
|
|
93
|
+
* | **Tizen** | Point to the **folder** containing `sssp_config.xml` and `*.wgt` — not to a specific file. E.g. `https://cdn.example.com/app/tizen/2.10.1/landscape` |
|
|
94
|
+
* | **SSSP** | Point to the **folder** containing `sssp_config.xml` and `*.wgt`. E.g. `https://cdn.example.com/app/sssp/2.10.1/landscape_full-hd` |
|
|
95
|
+
* | **webOS 1, 2** | Point to the **ZIP file** directly. E.g. `https://cdn.example.com/app/webos/2.10.1/ApplicationName.zip` |
|
|
96
|
+
* | **webOS 3+** | Point to the **IPK file** directly. E.g. `https://cdn.example.com/app/webos/2.10.1/ApplicationName.ipk` |
|
|
97
|
+
* | **BrightSign** | Point to the **zip file** directly. E.g. `https://cdn.example.com/app/brightsign/2.10.1/display-brightsign.zip` |
|
|
98
|
+
* | **Android** | Point to the **APK file** directly. E.g. `https://cdn.example.com/app/android/2.10.1/io.signageos.android.apk` |
|
|
99
|
+
* | **Windows** | Point to the **zip file** directly. E.g. `https://cdn.example.com/app/windows/2.10.1/windows_2.10.1.zip` |
|
|
100
|
+
* | **ChromeOS** | Not supported |
|
|
101
|
+
*
|
|
102
|
+
* For the full folder structure reference and deployment guide, see
|
|
103
|
+
* [Build & Deploy Your Applet Via Core App with built-in Applet](https://docs.signageos.io/devspace/general-topics/deployment/build-deploy-your-applet-via-core-app-with-built-in-applet).
|
|
104
|
+
*
|
|
105
|
+
* @param appUri URL where the application files are hosted. Must follow the platform-specific format described above.
|
|
94
106
|
* @returns {Promise<void>} A promise that resolves when the upgrade starts.
|
|
95
107
|
* @throws {Error} If the upgrade fails.
|
|
96
108
|
* @since 4.0.0
|
|
@@ -98,14 +110,12 @@ export default class App implements IApp {
|
|
|
98
110
|
* @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/app-upgrade | How to upgrade application via applets}
|
|
99
111
|
*
|
|
100
112
|
* @example
|
|
101
|
-
* // Upgrade
|
|
102
|
-
* await sos.management.app.upgrade('
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* console.error('Failed to start application upgrade:', error);
|
|
108
|
-
* });
|
|
113
|
+
* // Upgrade Tizen device — point to the FOLDER, not a specific file. No trailing slash.
|
|
114
|
+
* await sos.management.app.upgrade('https://cdn.your-cms.com/app/tizen/2.10.1/landscape');
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* // Upgrade BrightSign device — point to the zip file directly
|
|
118
|
+
* await sos.management.app.upgrade('https://cdn.your-cms.com/app/brightsign/2.10.1/display-brightsign.zip');
|
|
109
119
|
*/
|
|
110
120
|
upgrade(appUri: string): Promise<void>;
|
|
111
121
|
private getMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/App/App.ts"],"names":[],"mappings":";;AACA,4DAAiE;AAGjE;;;;;;;;;;;GAWG;AACH,MAAqB,GAAG;IAGd;IACA;IAHT,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,GAAb,aA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IAC3B,CAAC;IA+ED,gBAAgB;IACT,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,IAAa;QAC/C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAA,qCAAqB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1E,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;YACpC,OAAO;YACP,OAAO;YACP,SAAS;SACT,CAAC,CAAC;IACJ,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;IACxC,CAAC;CACD;AA3ID,sBA2IC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import INetworkInfo from './Network/INetworkInfo';
|
|
2
2
|
import IBatteryStatus from './IBatteryStatus';
|
|
3
3
|
import { AnyString } from '../../utils/types';
|
|
4
|
-
export type ManagementCapability = 'MODEL' | 'SERIAL_NUMBER' | 'BRAND' | 'OS_VERSION' | 'BATTERY_STATUS' | 'STORAGE_UNITS' | 'TEMPERATURE' | 'SCREENSHOT_UPLOAD' | 'NETWORK_INFO' | 'WIFI' | 'WIFI_SCAN' | 'WIFI_AP' | 'WIFI_STRENGTH' | 'TIMERS_PROPRIETARY' | 'BRIGHTNESS_SCHEDULING' | 'TIMERS_NATIVE' | 'SET_BRIGHTNESS' | 'GET_BRIGHTNESS' | 'SCREEN_RESIZE' | 'SET_TIME' | 'SET_TIMEZONE' | 'GET_TIMEZONE' | 'NTP_TIME' | 'APP_UPGRADE' | 'FIRMWARE_UPGRADE' | 'PACKAGE_INSTALL' | 'SET_VOLUME' | 'GET_VOLUME' | 'SET_REMOTE_CONTROL_ENABLED' | 'SET_DEBUG' | 'SYSTEM_REBOOT' | 'APP_RESTART' | 'DISPLAY_POWER' | 'SERVLET' | 'HARDWARE_LED_SET_COLOR' | 'PROXIMITY_SENSOR' | 'FACTORY_RESET' | 'ORIENTATION_LANDSCAPE' | 'ORIENTATION_PORTRAIT' | 'ORIENTATION_LANDSCAPE_FLIPPED' | 'ORIENTATION_PORTRAIT_FLIPPED' | 'ORIENTATION_AUTO' | 'SCHEDULE_POWER_ACTION' | 'EXTENDED_MANAGEMENT' | 'SYSTEM_CPU' | 'SYSTEM_MEMORY' | 'PROXY' | 'AUTO_RECOVERY' | 'PEER_RECOVERY' | 'FILE_SYSTEM_WIPEOUT' | 'REMOTE_DESKTOP' | 'HOTEL_MODE' | 'VPN' | 'CUSTOM_SCRIPTS' | 'NATIVE_COMMANDS_MDC' | 'DEVICE_OWNER' | 'ACCESSIBILITY_SERVICE' | 'DISPLAY_MANAGER' | 'SECRETS' | 'HARDWARE_ACCELERATION' | 'WIFI_COUNTRY' | 'STOP_PACKAGE' | AnyString;
|
|
4
|
+
export type ManagementCapability = 'MODEL' | 'SERIAL_NUMBER' | 'BRAND' | 'OS_VERSION' | 'BATTERY_STATUS' | 'STORAGE_UNITS' | 'TEMPERATURE' | 'SCREENSHOT_UPLOAD' | 'NETWORK_INFO' | 'WIFI' | 'WIFI_SCAN' | 'WIFI_AP' | 'WIFI_STRENGTH' | 'TIMERS_PROPRIETARY' | 'BRIGHTNESS_SCHEDULING' | 'TIMERS_NATIVE' | 'SET_BRIGHTNESS' | 'GET_BRIGHTNESS' | 'SCREEN_RESIZE' | 'SET_TIME' | 'SET_TIMEZONE' | 'GET_TIMEZONE' | 'NTP_TIME' | 'APP_UPGRADE' | 'FIRMWARE_UPGRADE' | 'PACKAGE_INSTALL' | 'SET_VOLUME' | 'GET_VOLUME' | 'SET_REMOTE_CONTROL_ENABLED' | 'SET_DEBUG' | 'SYSTEM_REBOOT' | 'APP_RESTART' | 'DISPLAY_POWER' | 'SERVLET' | 'HARDWARE_LED_SET_COLOR' | 'PROXIMITY_SENSOR' | 'FACTORY_RESET' | 'ORIENTATION_LANDSCAPE' | 'ORIENTATION_PORTRAIT' | 'ORIENTATION_LANDSCAPE_FLIPPED' | 'ORIENTATION_PORTRAIT_FLIPPED' | 'ORIENTATION_AUTO' | 'SCHEDULE_POWER_ACTION' | 'EXTENDED_MANAGEMENT' | 'SYSTEM_CPU' | 'SYSTEM_MEMORY' | 'PROXY' | 'AUTO_RECOVERY' | 'PEER_RECOVERY' | 'FILE_SYSTEM_WIPEOUT' | 'REMOTE_DESKTOP' | 'HOTEL_MODE' | 'VPN' | 'CUSTOM_SCRIPTS' | 'NATIVE_COMMANDS_MDC' | 'DEVICE_OWNER' | 'ACCESSIBILITY_SERVICE' | 'DISPLAY_MANAGER' | 'SECRETS' | 'HARDWARE_ACCELERATION' | 'WIFI_COUNTRY' | 'STOP_PACKAGE' | 'SEND_UDP' | 'WAKE_ON_LAN' | 'CLEAR_PACKAGE_DATA' | AnyString;
|
|
5
5
|
export default interface IManagement {
|
|
6
6
|
supports(capability: ManagementCapability): Promise<boolean>;
|
|
7
7
|
getModel(): Promise<string>;
|
|
@@ -22,6 +22,8 @@ export default interface INetwork {
|
|
|
22
22
|
setDHCP(interfaceName: string): Promise<void>;
|
|
23
23
|
disableInterface(interfaceName: string): Promise<void>;
|
|
24
24
|
importCertificate(details: CertificateEapDetails): Promise<void>;
|
|
25
|
+
sendUdp(ip: string, port: number, data: number[]): Promise<void>;
|
|
26
|
+
sendWakeOnLan(macAddress: string): Promise<void>;
|
|
25
27
|
}
|
|
26
28
|
export declare const VCertificateEapDetails: {
|
|
27
29
|
type: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INetwork.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Network/INetwork.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"INetwork.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Network/INetwork.ts"],"names":[],"mappings":";;;AA8Ba,QAAA,sBAAsB,GAAG;IACrC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;IACzC,aAAa,EAAE,SAAS;IACxB,iBAAiB,EAAE,SAAS;IAC5B,SAAS,EAAE,SAAS;IACpB,yBAAyB,EAAE,SAAS;CACpC,CAAC"}
|
|
@@ -136,5 +136,40 @@ export default class Network implements INetwork {
|
|
|
136
136
|
* await sos.management.network.importCertificate(certDetailsEapTtls);
|
|
137
137
|
*/
|
|
138
138
|
importCertificate(details: CertificateEapDetails): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* The `sendUdp()` method sends a raw UDP datagram to the specified IP address and port.
|
|
141
|
+
* This is a low-level network primitive that can be used for protocols like Wake-on-LAN.
|
|
142
|
+
*
|
|
143
|
+
* @param ip The destination IP address. Use `'255.255.255.255'` for broadcast.
|
|
144
|
+
* @param port The destination UDP port number (1-65535).
|
|
145
|
+
* @param data The payload as a byte array. Each element must be an integer between 0 and 255. Maximum 1500 elements (Ethernet MTU).
|
|
146
|
+
* @returns {Promise<void>} A promise that resolves when the UDP packet has been sent.
|
|
147
|
+
* @throws {Error} If the parameters are invalid.
|
|
148
|
+
* @throws {Error} If the device does not support sending UDP packets.
|
|
149
|
+
* @since 9.0.0
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* // Send a Wake-on-LAN magic packet
|
|
153
|
+
* await sos.management.network.sendUdp('255.255.255.255', 9, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, ...]);
|
|
154
|
+
*/
|
|
155
|
+
sendUdp(ip: string, port: number, data: number[]): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* The `sendWakeOnLan()` method sends a Wake-on-LAN magic packet to wake a device with the given MAC address.
|
|
158
|
+
* The target device must have Wake-on-LAN enabled and be on the same local network.
|
|
159
|
+
*
|
|
160
|
+
* Internally, this generates a 102-byte magic packet (6×0xFF + 16× MAC address) and sends it
|
|
161
|
+
* as a UDP broadcast to `255.255.255.255` on port 9 via `sendUdp()`.
|
|
162
|
+
*
|
|
163
|
+
* @param macAddress The MAC address of the target device. Accepted formats: `AA:BB:CC:DD:EE:FF`, `AA-BB-CC-DD-EE-FF`, `AABBCCDDEEFF`.
|
|
164
|
+
* @returns {Promise<void>} A promise that resolves when the magic packet has been sent.
|
|
165
|
+
* @throws {Error} If the MAC address format is invalid.
|
|
166
|
+
* @throws {Error} If the device does not support sending UDP packets.
|
|
167
|
+
* @since 9.0.0
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* // Wake a device by its MAC address
|
|
171
|
+
* await sos.management.network.sendWakeOnLan('AA:BB:CC:DD:EE:FF');
|
|
172
|
+
*/
|
|
173
|
+
sendWakeOnLan(macAddress: string): Promise<void>;
|
|
139
174
|
private getMessage;
|
|
140
175
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const INetworkInfo_1 = require("./INetworkInfo");
|
|
7
7
|
const Validate_1 = __importDefault(require("../../Validate/Validate"));
|
|
8
8
|
const INetwork_1 = require("./INetwork");
|
|
9
|
+
const wakeOnLan_1 = require("./wakeOnLan");
|
|
9
10
|
/**
|
|
10
11
|
* 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).
|
|
11
12
|
*
|
|
@@ -168,6 +169,73 @@ class Network {
|
|
|
168
169
|
details,
|
|
169
170
|
});
|
|
170
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* The `sendUdp()` method sends a raw UDP datagram to the specified IP address and port.
|
|
174
|
+
* This is a low-level network primitive that can be used for protocols like Wake-on-LAN.
|
|
175
|
+
*
|
|
176
|
+
* @param ip The destination IP address. Use `'255.255.255.255'` for broadcast.
|
|
177
|
+
* @param port The destination UDP port number (1-65535).
|
|
178
|
+
* @param data The payload as a byte array. Each element must be an integer between 0 and 255. Maximum 1500 elements (Ethernet MTU).
|
|
179
|
+
* @returns {Promise<void>} A promise that resolves when the UDP packet has been sent.
|
|
180
|
+
* @throws {Error} If the parameters are invalid.
|
|
181
|
+
* @throws {Error} If the device does not support sending UDP packets.
|
|
182
|
+
* @since 9.0.0
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* // Send a Wake-on-LAN magic packet
|
|
186
|
+
* await sos.management.network.sendUdp('255.255.255.255', 9, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, ...]);
|
|
187
|
+
*/
|
|
188
|
+
async sendUdp(ip, port, data) {
|
|
189
|
+
(0, Validate_1.default)({ ip })
|
|
190
|
+
.required()
|
|
191
|
+
.string()
|
|
192
|
+
.lengthMin(1)
|
|
193
|
+
.own((subject) => {
|
|
194
|
+
const IP_REGEX = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
195
|
+
return IP_REGEX.test(subject.subject) || 'must be a valid IPv4 address';
|
|
196
|
+
});
|
|
197
|
+
(0, Validate_1.default)({ port }).required().number().min(1).max(65535);
|
|
198
|
+
(0, Validate_1.default)({ data })
|
|
199
|
+
.required()
|
|
200
|
+
.array('number')
|
|
201
|
+
.lengthMax(1500)
|
|
202
|
+
.own((subject) => {
|
|
203
|
+
for (const byte of subject.subject) {
|
|
204
|
+
if (byte < 0 || byte > 255 || !Number.isInteger(byte)) {
|
|
205
|
+
return 'each element must be an integer between 0 and 255';
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return true;
|
|
209
|
+
});
|
|
210
|
+
await this.postMessage({
|
|
211
|
+
type: this.getMessage('send_udp'),
|
|
212
|
+
ip,
|
|
213
|
+
port,
|
|
214
|
+
data,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The `sendWakeOnLan()` method sends a Wake-on-LAN magic packet to wake a device with the given MAC address.
|
|
219
|
+
* The target device must have Wake-on-LAN enabled and be on the same local network.
|
|
220
|
+
*
|
|
221
|
+
* Internally, this generates a 102-byte magic packet (6×0xFF + 16× MAC address) and sends it
|
|
222
|
+
* as a UDP broadcast to `255.255.255.255` on port 9 via `sendUdp()`.
|
|
223
|
+
*
|
|
224
|
+
* @param macAddress The MAC address of the target device. Accepted formats: `AA:BB:CC:DD:EE:FF`, `AA-BB-CC-DD-EE-FF`, `AABBCCDDEEFF`.
|
|
225
|
+
* @returns {Promise<void>} A promise that resolves when the magic packet has been sent.
|
|
226
|
+
* @throws {Error} If the MAC address format is invalid.
|
|
227
|
+
* @throws {Error} If the device does not support sending UDP packets.
|
|
228
|
+
* @since 9.0.0
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* // Wake a device by its MAC address
|
|
232
|
+
* await sos.management.network.sendWakeOnLan('AA:BB:CC:DD:EE:FF');
|
|
233
|
+
*/
|
|
234
|
+
async sendWakeOnLan(macAddress) {
|
|
235
|
+
(0, Validate_1.default)({ macAddress }).required().string().lengthMin(1);
|
|
236
|
+
const magicPacket = (0, wakeOnLan_1.createMagicPacket)(macAddress);
|
|
237
|
+
await this.sendUdp('255.255.255.255', 9, magicPacket);
|
|
238
|
+
}
|
|
171
239
|
getMessage(name) {
|
|
172
240
|
return this.messagePrefix + '.' + name;
|
|
173
241
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Network.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Network/Network.ts"],"names":[],"mappings":";;;;;AACA,iDAQwB;AACxB,uEAA+C;AAC/C,yCAAqF;
|
|
1
|
+
{"version":3,"file":"Network.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Network/Network.ts"],"names":[],"mappings":";;;;;AACA,iDAQwB;AACxB,uEAA+C;AAC/C,yCAAqF;AACrF,2CAAgD;AAEhD;;;;;;;;;;;GAWG;AACH,MAAqB,OAAO;IAGlB;IACA;IAHT,gBAAgB;IAChB,YACS,aAAqB,EACrB,WAA8B;QAD9B,kBAAa,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