@signageos/front-applet 8.0.3 → 8.1.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 +5 -5
- package/dist/bundle.js.map +1 -1
- package/docs/sos/fileSystem.md +15 -0
- package/docs/sos_management/power.md +105 -0
- package/docs/sos_management/screen.md +35 -2
- package/docs/sos_management/wifi.md +82 -18
- package/es6/FrontApplet/DeviceInfo/IDeviceInfo.d.ts +1 -0
- package/es6/FrontApplet/FileSystem/FileSystem.d.ts +9 -0
- package/es6/FrontApplet/FileSystem/FileSystem.js +13 -0
- package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
- package/es6/FrontApplet/FileSystem/IFileSystem.d.ts +1 -0
- package/es6/FrontApplet/Management/Power/IPower.d.ts +35 -0
- package/es6/FrontApplet/Management/Power/IPower.js +25 -0
- package/es6/FrontApplet/Management/Power/IPower.js.map +1 -1
- package/es6/FrontApplet/Management/Power/Power.d.ts +56 -2
- package/es6/FrontApplet/Management/Power/Power.js +100 -0
- package/es6/FrontApplet/Management/Power/Power.js.map +1 -1
- package/es6/FrontApplet/Management/Power/PowerHelper.d.ts +3 -0
- package/es6/FrontApplet/Management/Power/PowerHelper.js +12 -0
- package/es6/FrontApplet/Management/Power/PowerHelper.js.map +1 -0
- package/es6/FrontApplet/Management/Screen/IScreen.d.ts +5 -0
- package/es6/FrontApplet/Management/Screen/Screen.d.ts +18 -2
- package/es6/FrontApplet/Management/Screen/Screen.js +32 -23
- package/es6/FrontApplet/Management/Screen/Screen.js.map +1 -1
- package/es6/FrontApplet/Management/Wifi/IWifi.d.ts +3 -0
- package/es6/FrontApplet/Management/Wifi/IWifi.js +1 -0
- package/es6/FrontApplet/Management/Wifi/IWifi.js.map +1 -1
- package/es6/FrontApplet/Management/Wifi/Wifi.d.ts +56 -19
- package/es6/FrontApplet/Management/Wifi/Wifi.js +59 -20
- package/es6/FrontApplet/Management/Wifi/Wifi.js.map +1 -1
- package/es6/Monitoring/DeviceInfo/deviceInfoCommands.d.ts +29 -0
- package/es6/Monitoring/DeviceInfo/deviceInfoCommands.js +10 -0
- package/es6/Monitoring/DeviceInfo/deviceInfoCommands.js.map +1 -0
- package/es6/Monitoring/DeviceInfo/handleDeviceInfoRequests.d.ts +5 -0
- package/es6/Monitoring/DeviceInfo/handleDeviceInfoRequests.js +30 -0
- package/es6/Monitoring/DeviceInfo/handleDeviceInfoRequests.js.map +1 -0
- package/es6/Monitoring/FileSystem/fileSystemCommands.d.ts +21 -1
- package/es6/Monitoring/FileSystem/fileSystemCommands.js +5 -1
- package/es6/Monitoring/FileSystem/fileSystemCommands.js.map +1 -1
- package/es6/Monitoring/FileSystem/handleFileSystemRequests.js +14 -0
- package/es6/Monitoring/FileSystem/handleFileSystemRequests.js.map +1 -1
- package/es6/Monitoring/Management/Power/handlePowerRequests.js +27 -0
- package/es6/Monitoring/Management/Power/handlePowerRequests.js.map +1 -1
- package/es6/Monitoring/Management/Power/powerCommands.d.ts +41 -1
- package/es6/Monitoring/Management/Power/powerCommands.js +9 -1
- package/es6/Monitoring/Management/Power/powerCommands.js.map +1 -1
- package/es6/Monitoring/Management/Screen/handleScreenRequests.js +3 -1
- package/es6/Monitoring/Management/Screen/handleScreenRequests.js.map +1 -1
- package/es6/Monitoring/Management/Screen/screenCommands.d.ts +2 -0
- package/es6/Monitoring/Management/Screen/screenCommands.js.map +1 -1
- package/es6/Monitoring/Monitoring.js +2 -0
- package/es6/Monitoring/Monitoring.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const TimerHelper_1 = require("../helpers/TimerHelper");
|
|
7
7
|
const Validate_1 = __importDefault(require("../../Validate/Validate"));
|
|
8
|
+
const IPower_1 = require("./IPower");
|
|
9
|
+
const PowerHelper_1 = require("./PowerHelper");
|
|
8
10
|
// TODO: maybe a better description
|
|
9
11
|
/**
|
|
10
12
|
* The `sos.management.power` API groups together methods related to the power state of the device. Such as rebooting, shutting down,
|
|
@@ -207,6 +209,104 @@ class Power {
|
|
|
207
209
|
await this.setProprietaryTimer(type, null, null, []);
|
|
208
210
|
}
|
|
209
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Removes all scheduled reboot rules from the device.
|
|
214
|
+
*
|
|
215
|
+
* @since 8.1.0
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* await sos.management.power.clearScheduledReboots();
|
|
219
|
+
*/
|
|
220
|
+
async clearScheduledReboots() {
|
|
221
|
+
await this.postMessage({
|
|
222
|
+
type: this.getMessage('clear_scheduled_reboots'),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Returns all scheduled reboot rules on the device.
|
|
227
|
+
*
|
|
228
|
+
* @since 8.1.0
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* await sos.management.power.getScheduledReboots();
|
|
232
|
+
*/
|
|
233
|
+
async getScheduledReboots() {
|
|
234
|
+
const { actions } = await this.postMessage({
|
|
235
|
+
type: this.getMessage('get_scheduled_reboots'),
|
|
236
|
+
});
|
|
237
|
+
// We need to convert values of days back to string representation
|
|
238
|
+
for (const action of actions) {
|
|
239
|
+
action.rule.weekdays = action.rule.weekdays.map((weekday) => {
|
|
240
|
+
return (0, PowerHelper_1.convertNumberToWeekday)(weekday); // Can be only number from device
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return actions;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Removes scheduled reboot rule from the device.
|
|
247
|
+
* @param id {string} - ID of the rule to be removed.
|
|
248
|
+
*
|
|
249
|
+
* @since 8.1.0
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* // Get scheduled reboots
|
|
253
|
+
* const scheduledReboots = await sos.management.power.getScheduledReboots();
|
|
254
|
+
*
|
|
255
|
+
* // Remove scheduled reboot
|
|
256
|
+
* await sos.management.power.removeScheduledReboot(scheduledReboots[0].id);
|
|
257
|
+
*/
|
|
258
|
+
async removeScheduledReboot(id) {
|
|
259
|
+
(0, Validate_1.default)({ id }).required().string();
|
|
260
|
+
await this.postMessage({
|
|
261
|
+
type: this.getMessage('remove_scheduled_reboot'),
|
|
262
|
+
id,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
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.
|
|
268
|
+
*
|
|
269
|
+
* :::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, it might be later returned by `getScheduledReboots()`.
|
|
272
|
+
* :::
|
|
273
|
+
*
|
|
274
|
+
* @param weekdays {@link WeekdayType[]} - Array of weekdays when the reboot should be executed.
|
|
275
|
+
* @param time {string} - Time when the reboot should be executed. Format is `HH:mm:ss`.
|
|
276
|
+
*
|
|
277
|
+
* @since 8.1.0
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* // Schedule reboot every Monday at 3:00 AM
|
|
281
|
+
* await sos.management.power.setScheduledReboot(["MONDAY"], "03:00:00");
|
|
282
|
+
*
|
|
283
|
+
* // Schedule reboot every Monday and Friday at 7:30 PM / 19:30
|
|
284
|
+
* await sos.management.power.setScheduledReboot(["MONDAY", "FRIDAY"], "19:30:00");
|
|
285
|
+
*/
|
|
286
|
+
async setScheduledReboot(weekdays, time) {
|
|
287
|
+
(0, Validate_1.default)({ weekdays }).required().array('string');
|
|
288
|
+
// Validate if day is in weekday enum
|
|
289
|
+
for (const weekday of weekdays) {
|
|
290
|
+
if (typeof IPower_1.WeekdayNamed[weekday] === 'undefined') {
|
|
291
|
+
throw new Error('Invalid weekday');
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// Days in week needs to be converted to specific numbers to work properly
|
|
295
|
+
const weekdayAsNumbers = weekdays.map(PowerHelper_1.convertWeekdayToNumber);
|
|
296
|
+
(0, Validate_1.default)({ time })
|
|
297
|
+
.required()
|
|
298
|
+
.string()
|
|
299
|
+
.matchRegExp(/\d{2}:\d{2}:\d{2}/)
|
|
300
|
+
.timerTime();
|
|
301
|
+
const rule = {
|
|
302
|
+
weekdays: weekdayAsNumbers,
|
|
303
|
+
time,
|
|
304
|
+
};
|
|
305
|
+
await this.postMessage({
|
|
306
|
+
type: this.getMessage('set_scheduled_reboot'),
|
|
307
|
+
rule,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
210
310
|
getMessage(name) {
|
|
211
311
|
return this.messagePrefix + '.' + name;
|
|
212
312
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Power.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Power/Power.ts"],"names":[],"mappings":";;;;;AACA,wDAAyE;AACzE,uEAA+C;
|
|
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,mCAAmC;AACnC;;;GAGG;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;;;;;;;OAOG;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;;;;;;;OAOG;IACI,KAAK,CAAC,UAAU;QACtB,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,a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AM,gBAAgB,GAAG,QAAQ,CAAC,GAAG,CAAC,oCAAsB,CAAC,CAAC;QAE9D,IAAA,kBAAQ,EAAC,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;AAvUD,wBAuUC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertWeekdayToNumber = convertWeekdayToNumber;
|
|
4
|
+
exports.convertNumberToWeekday = convertNumberToWeekday;
|
|
5
|
+
const IPower_1 = require("./IPower");
|
|
6
|
+
function convertWeekdayToNumber(weekday) {
|
|
7
|
+
return IPower_1.WeekdayNumbered[weekday];
|
|
8
|
+
}
|
|
9
|
+
function convertNumberToWeekday(weekday) {
|
|
10
|
+
return IPower_1.WeekdayNumbered[weekday];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=PowerHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PowerHelper.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Power/PowerHelper.ts"],"names":[],"mappings":";;AAEA,wDAEC;AAED,wDAEC;AARD,qCAAwD;AAExD,SAAgB,sBAAsB,CAAC,OAAoB;IAC1D,OAAO,wBAAe,CAAC,OAAuC,CAAC,CAAC;AACjE,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAAe;IACrD,OAAO,wBAAe,CAAC,OAAO,CAAiC,CAAC;AACjE,CAAC"}
|
|
@@ -5,7 +5,12 @@ export default interface IScreen {
|
|
|
5
5
|
getOrientation(): Promise<IOrientation>;
|
|
6
6
|
setBrightness(timeFrom1: string, brightness1: number, timeFrom2: string, brightness2: number): Promise<void>;
|
|
7
7
|
getBrightness(): Promise<IBrightness>;
|
|
8
|
+
/** @deprecated use takeAndUploadScreenshot(uploadBaseUrl: string, computeHash?: boolean): Promise<{ screenshotUrl: string; aHash?: string }> */
|
|
8
9
|
takeAndUploadScreenshot(uploadBaseUrl: string): Promise<string>;
|
|
10
|
+
takeAndUploadScreenshot(uploadBaseUrl: string, computeHash?: boolean): Promise<{
|
|
11
|
+
screenshotUrl: string;
|
|
12
|
+
aHash?: string;
|
|
13
|
+
}>;
|
|
9
14
|
powerOn(): Promise<void>;
|
|
10
15
|
powerOff(): Promise<void>;
|
|
11
16
|
isPoweredOn(): Promise<boolean>;
|
|
@@ -97,6 +97,10 @@ export default class Screen implements IScreen {
|
|
|
97
97
|
* @since 3.0.0
|
|
98
98
|
*/
|
|
99
99
|
getBrightness(): Promise<IBrightness>;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use `takeAndUploadScreenshot(uploadBaseUrl: string, computeHash?: boolean): Promise<{ screenshotUrl: string; aHash?: string }>` instead.
|
|
102
|
+
*/
|
|
103
|
+
takeAndUploadScreenshot(uploadBaseUrl: string): Promise<string>;
|
|
100
104
|
/**
|
|
101
105
|
* The `takeAndUploadScreenshot()` method takes a screenshot and uploads it to a specified url. This can be either a signageOS upload url
|
|
102
106
|
* (`https://upload.signageos.io`) or a dedicated server url for uploading screenshots. Format in which the screenshot is uploaded may be
|
|
@@ -110,9 +114,21 @@ export default class Screen implements IScreen {
|
|
|
110
114
|
* signageOS provides standalone server which is implements all of those methods. It is provided to all of our partners through the
|
|
111
115
|
* [support ticketing system](https://box.signageos.io/support/).
|
|
112
116
|
*
|
|
117
|
+
* @param uploadBaseUrl URL to which the screenshot will be uploaded. It can be either a signageOS upload url or a custom server url.
|
|
118
|
+
* @param computeHash Whether to compute a hash of the screenshot and return it in the response.
|
|
119
|
+
*
|
|
113
120
|
* @since 3.0.0
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const { screenshotUrl, aHash } = await sos.management.screen.takeAndUploadScreenshot(
|
|
124
|
+
* 'https://your.upload.server/upload/file?prefix=screenshot/',
|
|
125
|
+
* true,
|
|
126
|
+
* );
|
|
114
127
|
*/
|
|
115
|
-
takeAndUploadScreenshot(uploadBaseUrl: string): Promise<
|
|
128
|
+
takeAndUploadScreenshot(uploadBaseUrl: string, computeHash?: boolean): Promise<{
|
|
129
|
+
screenshotUrl: string;
|
|
130
|
+
aHash?: string;
|
|
131
|
+
}>;
|
|
116
132
|
/**
|
|
117
133
|
* The `powerOn()` method turns the screen on.
|
|
118
134
|
*
|
|
@@ -121,7 +137,7 @@ export default class Screen implements IScreen {
|
|
|
121
137
|
*/
|
|
122
138
|
powerOn(): Promise<void>;
|
|
123
139
|
/**
|
|
124
|
-
* The `powerOff()` method turn the screen off.
|
|
140
|
+
* The `powerOff()` method turn the screen off. It will turn off the display backlight and the panel, and it will also disable applet.
|
|
125
141
|
*
|
|
126
142
|
* :::warning
|
|
127
143
|
*
|
|
@@ -157,28 +157,37 @@ class Screen {
|
|
|
157
157
|
});
|
|
158
158
|
return screenBrightness;
|
|
159
159
|
}
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
uploadBaseUrl
|
|
180
|
-
|
|
181
|
-
|
|
160
|
+
/** @internal */
|
|
161
|
+
async takeAndUploadScreenshot(...args) {
|
|
162
|
+
if (typeof args[0] === 'string' && typeof args[1] === 'undefined') {
|
|
163
|
+
const [uploadBaseUrl] = args;
|
|
164
|
+
(0, Validate_1.default)({ uploadBaseUrl }).required().uri();
|
|
165
|
+
const response = await this.postMessage({
|
|
166
|
+
type: this.getMessage('upload_screenshot'),
|
|
167
|
+
uploadBaseUrl,
|
|
168
|
+
});
|
|
169
|
+
if (typeof response === 'string') {
|
|
170
|
+
return response; // For backward compatibility, return string directly
|
|
171
|
+
}
|
|
172
|
+
else if (typeof response === 'object' && 'screenshotUrl' in response) {
|
|
173
|
+
const { screenshotUrl } = response;
|
|
174
|
+
return screenshotUrl;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
const [uploadBaseUrl, computeHash] = args;
|
|
179
|
+
(0, Validate_1.default)({ uploadBaseUrl }).required().uri();
|
|
180
|
+
(0, Validate_1.default)({ computeHash }).boolean();
|
|
181
|
+
const { screenshotUrl, aHash } = await this.postMessage({
|
|
182
|
+
type: this.getMessage('upload_screenshot'),
|
|
183
|
+
uploadBaseUrl,
|
|
184
|
+
computeHash,
|
|
185
|
+
});
|
|
186
|
+
return {
|
|
187
|
+
screenshotUrl,
|
|
188
|
+
aHash,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
182
191
|
}
|
|
183
192
|
/**
|
|
184
193
|
* The `powerOn()` method turns the screen on.
|
|
@@ -192,7 +201,7 @@ class Screen {
|
|
|
192
201
|
});
|
|
193
202
|
}
|
|
194
203
|
/**
|
|
195
|
-
* The `powerOff()` method turn the screen off.
|
|
204
|
+
* The `powerOff()` method turn the screen off. It will turn off the display backlight and the panel, and it will also disable applet.
|
|
196
205
|
*
|
|
197
206
|
* :::warning
|
|
198
207
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Screen/Screen.ts"],"names":[],"mappings":";;;;;AAGA,0DAAkE;AAClE,wD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AAC;gBACvD,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;gBAC1C,aAAa;gBACb,WAAW;aACX,CAAC,CAAC;YAEH,OAAO;gBACN,aAAa;gBACb,KAAK;aACL,CAAC;QACH,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,OAAO;QACnB,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;SACzC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,KAAK,CAAC,QAAQ;QACpB,MAAM,IAAI,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;SAC1C,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,WAAW;QACvB,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YACnD,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC;SAChD,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC;IACzB,CAAC;IAEO,UAAU,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,gBAAgB,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC;IAC7C,CAAC;IAEO,gBAAgB;QACvB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AAhQD,yBAgQC"}
|
|
@@ -21,9 +21,12 @@ export interface IScannedDevice {
|
|
|
21
21
|
ssid: string;
|
|
22
22
|
encrypted: boolean;
|
|
23
23
|
}
|
|
24
|
+
export type WifiEncryptionType = 'OPEN' | 'WEP' | 'WPA2' | 'WPA2_WPA_MIXED' | 'WPA3' | '802.1X_EAP';
|
|
24
25
|
export interface IWifiConnectOptions {
|
|
25
26
|
hidden?: boolean;
|
|
27
|
+
securityType?: WifiEncryptionType;
|
|
26
28
|
}
|
|
27
29
|
export declare const VIWifiConnectOptions: {
|
|
28
30
|
hidden: string;
|
|
31
|
+
securityType: string;
|
|
29
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IWifi.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Wifi/IWifi.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"IWifi.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Wifi/IWifi.ts"],"names":[],"mappings":";;;AAiCa,QAAA,oBAAoB,GAAG;IACnC,MAAM,EAAE,UAAU;IAClB,YAAY,EAAE,SAAS;CACvB,CAAC"}
|
|
@@ -3,11 +3,11 @@ import IWifiMessage, { WifiEvent } from './IWifiEvent';
|
|
|
3
3
|
import { IWifiDevice } from '../Network/INetworkInfo';
|
|
4
4
|
import IWifi, { IScannedDevice, IWifiConnectOptions } from './IWifi';
|
|
5
5
|
/**
|
|
6
|
-
* The `sos.management.wifi` API groups together methods for managing
|
|
6
|
+
* The `sos.management.wifi` API groups together methods for managing Wi-Fi.
|
|
7
7
|
*
|
|
8
8
|
* :::info
|
|
9
9
|
*
|
|
10
|
-
* Use `sos.management.supports('WIFI')` to check if the device supports managing
|
|
10
|
+
* Use `sos.management.supports('WIFI')` to check if the device supports managing Wi-Fi setup.
|
|
11
11
|
*
|
|
12
12
|
* :::
|
|
13
13
|
*
|
|
@@ -33,54 +33,93 @@ export default class Wifi implements IWifi {
|
|
|
33
33
|
/**
|
|
34
34
|
* The `isClientEnabled()` method checks whether the Wi-Fi is in `client` state.
|
|
35
35
|
*
|
|
36
|
-
* @throws If the Wi-Fi state is in the `ap` state.
|
|
36
|
+
* @throws Error If the Wi-Fi state is in the `ap` state.
|
|
37
|
+
* @returns {Boolean} if client mode is enabled.
|
|
37
38
|
*/
|
|
38
39
|
isClientEnabled(): Promise<boolean>;
|
|
39
40
|
/**
|
|
40
41
|
* The `enabledClient()` method switches the Wi-Fi state from `disabled` to `client` state.
|
|
41
42
|
*
|
|
42
|
-
* @throws If the Wi-Fi state is in the `ap` state.
|
|
43
|
+
* @throws Error If the Wi-Fi state is in the `ap` state.
|
|
43
44
|
*/
|
|
44
45
|
enableClient(): Promise<void>;
|
|
45
46
|
/**
|
|
46
|
-
* The `
|
|
47
|
+
* The `isAPEnabled()` method checks whether the Wi-Fi is in `ap` state.
|
|
48
|
+
*
|
|
49
|
+
* @returns {Boolean} if AP mode is enabled.
|
|
47
50
|
*/
|
|
48
51
|
isAPEnabled(): Promise<boolean>;
|
|
49
52
|
/**
|
|
50
|
-
* The `
|
|
53
|
+
* The `enableAP()` method switches the Wi-Fi state from `disabled` to `ap` state.
|
|
51
54
|
*
|
|
52
55
|
* :::info
|
|
53
|
-
*
|
|
54
56
|
* Use `sos.management.supports('WIFI_AP')` to check if the device is able to be in the `ap` mode.
|
|
55
|
-
*
|
|
56
57
|
* :::
|
|
57
58
|
*
|
|
58
59
|
* @param ssid Name of the network, max. allowed length is 32 characters.
|
|
59
60
|
* @param password Password of the device, must be between 8 and 32 characters.
|
|
60
61
|
*
|
|
61
|
-
* @throws If the Wi-Fi state is in the `client` state.
|
|
62
|
+
* @throws Error If the Wi-Fi state is in the `client` state.
|
|
62
63
|
*/
|
|
63
64
|
enableAP(ssid: string, password: string): Promise<void>;
|
|
64
65
|
/**
|
|
65
|
-
* The `disable()` method switches the Wi-Fi state to `disabled
|
|
66
|
+
* The `disable()` method switches the Wi-Fi state to `disabled` and disconnect from connected Wi-Fi.
|
|
67
|
+
*
|
|
68
|
+
* All previously configured networks will be forgotten.
|
|
66
69
|
*/
|
|
67
70
|
disable(): Promise<void>;
|
|
68
71
|
/**
|
|
69
72
|
* The `getConnectedTo()` method returns a network the device is currently connected to.
|
|
70
73
|
*
|
|
71
|
-
* @throws If the Wi-Fi state is not in the `client` state.
|
|
74
|
+
* @throws Error If the Wi-Fi state is not in the `client` state.
|
|
75
|
+
*
|
|
76
|
+
* @returns An object containing the SSID, whether the network is encrypted, and the signal strength.
|
|
77
|
+
* If the device is not connected to any network, it returns `null`.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* // To get the network the device is currently connected to
|
|
81
|
+
* const connectedTo = await sos.management.wifi.getConnectedTo();
|
|
82
|
+
* console.log(`Connected to SSID: ${connectedTo?.ssid}, Strength: ${connectedTo?.strength}`);
|
|
72
83
|
*/
|
|
73
84
|
getConnectedTo(): Promise<IWifiDevice | null>;
|
|
74
85
|
/**
|
|
75
86
|
* The `connect()` method connects the device to a specified network.
|
|
76
87
|
*
|
|
77
|
-
*
|
|
88
|
+
* :::warning
|
|
89
|
+
* Connecting to a OPEN Wi-Fi network for Tizen and WebOS is different.
|
|
90
|
+
* - For Tizen, make sure that the `password` is an empty string (`''`) and in options you have selected `OPEN` as encryption type.
|
|
91
|
+
* - For WebOS, you can pass `undefined` as the `password` parameter.
|
|
92
|
+
* :::
|
|
93
|
+
*
|
|
94
|
+
* :::info
|
|
95
|
+
* Security type of Wi-Fi is mandatory for Tizen.
|
|
96
|
+
* :::
|
|
97
|
+
*
|
|
98
|
+
* @param ssid Name of the network, max. allowed length is 32 characters.
|
|
99
|
+
* @param password Password of the device, must be between 8 and 32 characters.
|
|
100
|
+
* @param options Additional options for the connection, such as `hidden` or `securityType`.
|
|
101
|
+
*
|
|
102
|
+
* @throws Error If the Wi-Fi state is not in the `client` state.
|
|
103
|
+
* @returns A promise that resolves when the connection is established or if connection fails.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* // To connect on open Wi-Fi network ex. WebOS
|
|
107
|
+
* await sos.management.wifi.connect('MyOpenNetwork');
|
|
108
|
+
*
|
|
109
|
+
* // To connect on open Wi-Fi network with empty password (Tizen)
|
|
110
|
+
* await sos.management.wifi.connect('MyOpenNetwork', '', { securityType: 'OPEN' });
|
|
111
|
+
*
|
|
112
|
+
* // If the network is hidden
|
|
113
|
+
* await sos.management.wifi.connect('MyOpenNetwork', undefined, { hidden: true });
|
|
114
|
+
*
|
|
115
|
+
* // To connect on encrypted Wi-Fi network with WPA2 security
|
|
116
|
+
* await sos.management.wifi.connect('MyEncryptedNetwork', 'my-password', { securityType: 'WPA2' });
|
|
78
117
|
*/
|
|
79
118
|
connect(ssid: string, password?: string, options?: IWifiConnectOptions): Promise<void>;
|
|
80
119
|
/**
|
|
81
120
|
* The `disconnect()` method disconnects the device from Wi-Fi network.
|
|
82
121
|
*
|
|
83
|
-
* @throws If the Wi-Fi state is not in the `client` state.
|
|
122
|
+
* @throws Error If the Wi-Fi state is not in the `client` state.
|
|
84
123
|
*/
|
|
85
124
|
disconnect(): Promise<void>;
|
|
86
125
|
/**
|
|
@@ -88,7 +127,8 @@ export default class Wifi implements IWifi {
|
|
|
88
127
|
* have different regulations, when it comes to the Wi-Fi networks. Under normal circumstances, everything should work with default
|
|
89
128
|
* settings. However, if you experience any problems, you might want to try changing Wi-Fi country configuration to your country.
|
|
90
129
|
*
|
|
91
|
-
* @throws If the Wi-Fi state is not in the `client` state.
|
|
130
|
+
* @throws Error If the Wi-Fi state is not in the `client` state.
|
|
131
|
+
* @returns The 2-letter country code from the ISO 3166 standard, or `null` if not set.
|
|
92
132
|
*/
|
|
93
133
|
getCountry(): Promise<string | null>;
|
|
94
134
|
/**
|
|
@@ -97,20 +137,17 @@ export default class Wifi implements IWifi {
|
|
|
97
137
|
* settings. However, if you experience any problems, you might want to try changing Wi-Fi country configuration to your country.
|
|
98
138
|
*
|
|
99
139
|
* @param countryCode 2-letter country code from the ISO 3166 standard.
|
|
100
|
-
*
|
|
101
|
-
* @throws If the Wi-Fi state is not in the `client` state.
|
|
140
|
+
* @throws Error If the Wi-Fi state is not in the `client` state.
|
|
102
141
|
*/
|
|
103
142
|
setCountry(countryCode: string): Promise<void>;
|
|
104
143
|
/**
|
|
105
144
|
* The `scanDevices()` method initializes a new network scan and available networks.
|
|
106
145
|
*
|
|
107
146
|
* :::info
|
|
108
|
-
*
|
|
109
147
|
* Use `sos.management.supports('WIFI_SCAN')` to check if the device supports scanning for devices.
|
|
110
|
-
*
|
|
111
148
|
* :::
|
|
112
149
|
*
|
|
113
|
-
* @throws If the Wi-Fi state is not in the `client` state.
|
|
150
|
+
* @throws Error If the Wi-Fi state is not in the `client` state.
|
|
114
151
|
*/
|
|
115
152
|
scanDevices(): Promise<IScannedDevice[]>;
|
|
116
153
|
/**
|