@signageos/front-applet 5.0.0-beta.7 → 5.0.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/CHANGELOG.md +78 -1
- package/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -1
- package/docs/js-api/js-api-introduction.md +16 -12
- package/docs/js-api/js-applet-basics.md +162 -1
- package/docs/js-api/js-browser.md +35 -7
- package/docs/js-api/js-command.md +61 -21
- package/docs/js-api/js-display.md +48 -0
- package/docs/js-api/js-file-system.md +106 -7
- package/docs/js-api/js-hardware-serial.md +2 -2
- package/docs/js-api/js-input.md +27 -2
- package/docs/js-api/js-offline-cache-media-files.md +19 -7
- package/docs/js-api/js-video-stream.md +66 -24
- package/docs/management-api/10-js-management-application.md +18 -1
- package/docs/management-api/11-js-management-network.md +122 -3
- package/docs/management-api/13-js-management-wifi.md +4 -0
- package/docs/management-api/2-js-management-firmware.md +21 -0
- package/docs/management-api/5-js-management-screen.md +8 -4
- package/docs/management-api/6-js-management-time.md +17 -1
- package/es6/FrontApplet/Browser/Browser.d.ts +16 -6
- package/es6/FrontApplet/Browser/Browser.js +39 -12
- package/es6/FrontApplet/Browser/Browser.js.map +1 -1
- package/es6/FrontApplet/Browser/IOpenLinkOptions.d.ts +8 -0
- package/es6/FrontApplet/Browser/IOpenLinkOptions.js +4 -0
- package/es6/FrontApplet/Browser/IOpenLinkOptions.js.map +1 -1
- package/es6/FrontApplet/Browser/events.d.ts +15 -0
- package/es6/FrontApplet/Browser/events.js +14 -0
- package/es6/FrontApplet/Browser/events.js.map +1 -0
- package/es6/FrontApplet/Browser/messages.d.ts +5 -0
- package/es6/FrontApplet/Browser/messages.js +3 -0
- package/es6/FrontApplet/Browser/messages.js.map +1 -0
- package/es6/FrontApplet/Debug/Debug.d.ts +22 -0
- package/es6/FrontApplet/Debug/Debug.js +35 -0
- package/es6/FrontApplet/Debug/Debug.js.map +1 -0
- package/es6/FrontApplet/Exchange/Exchange.d.ts +7 -0
- package/es6/FrontApplet/Exchange/Exchange.js +28 -0
- package/es6/FrontApplet/Exchange/Exchange.js.map +1 -0
- package/es6/FrontApplet/FileSystem/FileSystem.d.ts +1 -0
- package/es6/FrontApplet/FileSystem/FileSystem.js +10 -0
- package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
- package/es6/FrontApplet/FrontApplet.d.ts +4 -2
- package/es6/FrontApplet/FrontApplet.js +20 -7
- package/es6/FrontApplet/FrontApplet.js.map +1 -1
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.d.ts +30 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js +92 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js.map +1 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.d.ts +5 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.js +3 -0
- package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.js.map +1 -0
- package/es6/FrontApplet/Hardware/Hardware.d.ts +4 -1
- package/es6/FrontApplet/Hardware/Hardware.js +3 -0
- package/es6/FrontApplet/Hardware/Hardware.js.map +1 -1
- package/es6/FrontApplet/Management/Firmware.d.ts +2 -0
- package/es6/FrontApplet/Management/Firmware.js +8 -0
- package/es6/FrontApplet/Management/Firmware.js.map +1 -1
- package/es6/FrontApplet/Management/FirmwareType.d.ts +4 -0
- package/es6/FrontApplet/Management/FirmwareType.js +8 -0
- package/es6/FrontApplet/Management/FirmwareType.js.map +1 -0
- package/es6/FrontApplet/Management/INetworkInfo.d.ts +26 -2
- package/es6/FrontApplet/Management/INetworkInfo.js +7 -1
- package/es6/FrontApplet/Management/INetworkInfo.js.map +1 -1
- package/es6/FrontApplet/Management/Network.d.ts +18 -2
- package/es6/FrontApplet/Management/Network.js +51 -9
- package/es6/FrontApplet/Management/Network.js.map +1 -1
- package/es6/FrontApplet/Management/Time.d.ts +18 -0
- package/es6/FrontApplet/Management/Time.js +16 -4
- package/es6/FrontApplet/Management/Time.js.map +1 -1
- package/es6/FrontApplet/Management/Wifi.d.ts +13 -1
- package/es6/FrontApplet/Management/Wifi.js +12 -1
- package/es6/FrontApplet/Management/Wifi.js.map +1 -1
- package/es6/FrontApplet/Management/helpers/SecurityHelper.js +1 -1
- package/es6/FrontApplet/Stream/Stream.d.ts +1 -0
- package/es6/FrontApplet/Stream/Stream.js +7 -0
- package/es6/FrontApplet/Stream/Stream.js.map +1 -1
- package/es6/FrontApplet/Validate/Validate.js +1 -1
- package/es6/FrontApplet/Validate/Validate.js.map +1 -1
- package/es6/Monitoring/Montoring.js +1 -1
- package/es6/Monitoring/Montoring.js.map +1 -1
- package/package.json +6 -33
- package/docs/js-api/js-timing.md +0 -54
|
@@ -16,17 +16,12 @@ You can use the same functions across all devices with the same result. Applet J
|
|
|
16
16
|
|
|
17
17
|
Applet JS API supports content-playback features and device management features.
|
|
18
18
|
|
|
19
|
-
### About signageOS APIs
|
|
20
|
-
|
|
21
|
-
In signageOS there are 2 main groups of APIs:
|
|
22
|
-
- `Client-side` - JS API available for both **signageOS Open** and signageOS Platform plans
|
|
23
|
-
- `Server-side` - REST API available in **signageOS Platform plan only**
|
|
24
|
-
|
|
25
19
|
::: alert alert--tip
|
|
26
20
|
All APIs are standardized and available across all [supported devices](/category/supported-devices-guides).
|
|
27
21
|
:::
|
|
28
22
|
|
|
29
|
-
## Content-playback APIs
|
|
23
|
+
## Content-playback JS APIs
|
|
24
|
+
|
|
30
25
|
Content-playback API is an API for managing content on screen.
|
|
31
26
|
|
|
32
27
|
::: table-responsive
|
|
@@ -34,25 +29,30 @@ Content-playback API is an API for managing content on screen.
|
|
|
34
29
|
| ------ | ----------- |
|
|
35
30
|
| **[Basic information](/api/js/content/js-applet-basics)** | General information required to use the signageOS JS API |
|
|
36
31
|
| [Applet Resources](/api/js/content/js-applet-resources) | Pre-load necessary files required by your HTML5 player/Applet |
|
|
32
|
+
| [Display](/api/js/content/js-display) | Query features supported by the display |
|
|
37
33
|
| [Browser](/api/js/content/js-browser) | Opening managed web-browser on Android devices inc. whitelisting, blacklisting and other features |
|
|
38
34
|
| [Command](/api/js/content/js-command) | Sending business or technical logs through signageOS in secured offline-ready way |
|
|
39
35
|
| [File system](/api/js/content/js-file-system) | Full-featured file system API including ZIP and folder management |
|
|
36
|
+
| [Fonts](/api/js/content/js-loading-fonts) | Make it easy to load additional fonts into SoC devices |
|
|
40
37
|
| [Hardware](/api/js/content/js-hardware) | Hardware-specific APIs like LED lights on Philips 10BDL |
|
|
41
|
-
| [Serial](/api/js/content/js-hardware-serial) | Control external devices via serial |
|
|
42
38
|
| [Inputs](/api/js/content/js-input) | Controller inputs like IR remote unified under one API |
|
|
43
|
-
| [
|
|
39
|
+
| [Monitors](/api/js/content/js-monitors) | Information about monitors |
|
|
40
|
+
| [Sensors](/api/js/content/js-sensors) | Using sensors and IoT devices in your application |
|
|
41
|
+
| [Serial](/api/js/content/js-hardware-serial) | Control external devices via serial |
|
|
44
42
|
| [Synchronized playback](/api/js/content/js-sync-playback) | API for creating synced playback and videowalls |
|
|
45
|
-
| [Timings](/api/js/content/js-timing) | Managing Timing/Applet switching from JS |
|
|
46
43
|
| [Video Inputs aka PiP](/api/js/content/js-video-inputs-internal-ports) | Show HDMI/DP/VGA as a part of your content via PiP feature |
|
|
47
44
|
| [Video Playback](/api/js/content/js-video) | Playing accelerated gapless videos via native video player |
|
|
48
45
|
| [Video Streams](/api/js/content/js-video-stream) | Playing video streams (RTSP, HLS, UDP) via native video player |
|
|
49
|
-
| [Sensors](/api/js/content/js-sensors) | Using sensors and IoT devices in your application |
|
|
50
|
-
| [Monitors](/api/js/content/js-monitors) | Information about monitors |
|
|
51
46
|
:::
|
|
52
47
|
|
|
53
48
|
## Device management APIs
|
|
49
|
+
|
|
54
50
|
Device management API is for managing, updating firmware, and other settings on the device.
|
|
55
51
|
|
|
52
|
+
::: alert alert--tip
|
|
53
|
+
For **Device Management** we strongly recommend using REST APIs. [See the REST API documentation here](https://api.docs.signageos.io).
|
|
54
|
+
:::
|
|
55
|
+
|
|
56
56
|
::: table-responsive
|
|
57
57
|
| Domain | Description |
|
|
58
58
|
| ------ | ----------- |
|
|
@@ -63,6 +63,10 @@ Device management API is for managing, updating firmware, and other settings on
|
|
|
63
63
|
| [Screen](/api/js/management/5-js-management-screen) | Manage brightness, orientation and resolution, display on/off |
|
|
64
64
|
| [Time](/api/js/management/6-js-management-time) | Set time, timezone and get current settings |
|
|
65
65
|
| [Volume](/api/js/management/7-js-management-volume) | Control system volume level |
|
|
66
|
+
| [Package](/api/js/management/8-js-management-package) | Install and manage packages |
|
|
67
|
+
| [Debug](/api/js/management/9-js-management-debug) | Enable/disable debug mode |
|
|
68
|
+
| [Application](/api/js/management/10-js-management-application) | Get application version and upgrade application from remote location |
|
|
69
|
+
| [Network](/api/js/management/11-js-management-network) | Manage network settings |
|
|
66
70
|
| [Security](/api/js/management/12-js-management-security) | Control system security (PIN code) |
|
|
67
71
|
| [Wi-Fi](/api/js/management/13-js-management-wifi) | Manage Wi-Fi |
|
|
68
72
|
:::
|
|
@@ -16,12 +16,16 @@ description: "[Content JS API] This thread contains basic methods of every Apple
|
|
|
16
16
|
This thread contains basic methods of every Applet used to load necessary configuration or device identifications and how to create Applet.
|
|
17
17
|
|
|
18
18
|
## All methods and properties
|
|
19
|
+
|
|
19
20
|
::: table-responsive
|
|
20
21
|
| Methods/Property | Description | Supported since |
|
|
21
22
|
| ----------------- | ----------- | :---------------: |
|
|
22
23
|
| `onReady()` | This method will wait until sOS object library and all dependencies are ready to be used. | 1.0.0 |
|
|
23
24
|
| `restore()` | Clear all previously played videos, streams, clear display view. | 1.0.0 |
|
|
24
25
|
| `appletVersion` | Returns current Applet version | JS API `4.5.0`, Front-display `7.8.0`|
|
|
26
|
+
| `config` object | Returns object with key-values set via Timing or as a bundled config| JS API `1.5.0`, Front-display `6.8.0`|
|
|
27
|
+
| `config` object | Returns object with key-values set via Timing or as a bundled config| `1.0.0`|
|
|
28
|
+
| `capabilities` | Enum of device-specific capabilities and features | `1.0.0`|
|
|
25
29
|
:::
|
|
26
30
|
|
|
27
31
|
## Starting Applet
|
|
@@ -29,13 +33,33 @@ This thread contains basic methods of every Applet used to load necessary config
|
|
|
29
33
|
Your applet logic should be started **after sOS object is loaded and ready**. To start your applet you can use this example snippet.
|
|
30
34
|
|
|
31
35
|
### Javascript example:
|
|
32
|
-
```javascript
|
|
36
|
+
``` javascript
|
|
37
|
+
/*
|
|
38
|
+
CLI generated Applet
|
|
39
|
+
*/
|
|
40
|
+
sos.onReady().then(async function () {
|
|
41
|
+
startYourApplet(); // Example method to run
|
|
42
|
+
// Any other code
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
Deprecated single file Applet options
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
// option A
|
|
33
50
|
window.addEventListener('sos.loaded', () => {
|
|
34
51
|
sos.onReady().then(() => {
|
|
35
52
|
startYourApplet(); // Example method to run
|
|
36
53
|
// Any other code
|
|
37
54
|
});
|
|
38
55
|
});
|
|
56
|
+
|
|
57
|
+
// option B
|
|
58
|
+
async function startApplet() {
|
|
59
|
+
await sos.onReady();
|
|
60
|
+
// Any other code
|
|
61
|
+
}
|
|
62
|
+
window.addEventListener('sos.loaded', startApplet);
|
|
39
63
|
```
|
|
40
64
|
|
|
41
65
|
After sOS object is ready, there are global properties available, which can be used for Applet customization and device identification.
|
|
@@ -58,6 +82,17 @@ Every Applet must contain this method, otherwise it won't work.
|
|
|
58
82
|
|
|
59
83
|
### Javascript example:
|
|
60
84
|
```javascript
|
|
85
|
+
/*
|
|
86
|
+
CLI generated Applet
|
|
87
|
+
*/
|
|
88
|
+
sos.onReady().then(async function () {
|
|
89
|
+
console.log('sos is ready', sos); // Print sOS object into console
|
|
90
|
+
// Any other methods to prepare your content and applet
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
Deprecated single file Applet options
|
|
95
|
+
*/
|
|
61
96
|
window.addEventListener('sos.loaded',() => {
|
|
62
97
|
sos.onReady().then(() => {
|
|
63
98
|
console.log('sos is ready', sos); // Print sOS object into console
|
|
@@ -88,6 +123,18 @@ It stops all video playback and clears out the memory. The following function sh
|
|
|
88
123
|
|
|
89
124
|
### Javascript example:
|
|
90
125
|
```javascript
|
|
126
|
+
/*
|
|
127
|
+
CLI generated Applet
|
|
128
|
+
*/
|
|
129
|
+
sos.onReady().then(async function () {
|
|
130
|
+
console.log('sos is ready', sos);
|
|
131
|
+
// Any other methods to prepare, load and run content on screen
|
|
132
|
+
sos.restore();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
Deprecated single file Applet options
|
|
137
|
+
*/
|
|
91
138
|
window.addEventListener('sos.loaded', () => {
|
|
92
139
|
sos.onReady().then(() => {
|
|
93
140
|
console.log('sos is ready', sos);
|
|
@@ -117,7 +164,18 @@ window.addEventListener('sos.loaded', () => {
|
|
|
117
164
|
This property returns current active Applet version.
|
|
118
165
|
|
|
119
166
|
### Javascript example:
|
|
167
|
+
|
|
120
168
|
```javascript
|
|
169
|
+
/*
|
|
170
|
+
CLI generated Applet
|
|
171
|
+
*/
|
|
172
|
+
sos.onReady().then(async function () {
|
|
173
|
+
console.log('Your applet version is ' + sos.appletVersion));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/*
|
|
177
|
+
Deprecated single file Applet options
|
|
178
|
+
*/
|
|
121
179
|
window.addEventListener('sos.loaded',() => {
|
|
122
180
|
sos.onReady().then(() => console.log('Your applet version is ' + sos.appletVersion));
|
|
123
181
|
});
|
|
@@ -132,6 +190,109 @@ You can pass CUSTOM key-value variables to the Applet. To do that, add your valu
|
|
|
132
190
|
console.log(sos.config.mySecretID);
|
|
133
191
|
console.log(sos.config.imgUrl);
|
|
134
192
|
```
|
|
193
|
+
<div class="row d-flex align-content-stretch force-padding-20">
|
|
194
|
+
<div class="col-12 d-flex">
|
|
195
|
+
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank" href="/knowledge-base/applet-custom-config-on-device">
|
|
196
|
+
<div>
|
|
197
|
+
<div class="wide-box__image d-flex align-items-center">
|
|
198
|
+
<i class="fas fa-hand-point-right svg-black"></i>
|
|
199
|
+
</div>
|
|
200
|
+
<div>
|
|
201
|
+
<h3 class="wide-box__title wide-box__title__small pl-85">Custom variables in Applet</h3>
|
|
202
|
+
<div class="wide-box__description">How to pass custom variables and cofiguration to your Applet</div>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</a>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
135
208
|
|
|
136
209
|
## Applet JS API version
|
|
210
|
+
|
|
137
211
|
Each feature has “Supported since” that states for the Applet JS API version. The Applet JS API component is called Front-Applet and its version can be selected under the Applet editor.
|
|
212
|
+
|
|
213
|
+
## Capabilities
|
|
214
|
+
|
|
215
|
+
Even tough we do our best to support as many features as possible on every platform, it's not possible to use certain features on certain platforms.
|
|
216
|
+
That's why we also provide a capabilities API that allows you to check, if the particular device supports a feature before you try to use it.
|
|
217
|
+
It's recommended that you always include capability checks in your code to prevent unexpected behavior or errors in your application.
|
|
218
|
+
|
|
219
|
+
There are two kinds of capabilities - display and management.
|
|
220
|
+
|
|
221
|
+
### Display capabilities
|
|
222
|
+
|
|
223
|
+
Display capabilities refer to the capabilities of the display in terms of content, playback, peripherals, etc.
|
|
224
|
+
|
|
225
|
+
::: table-responsive
|
|
226
|
+
| Capability | Description |
|
|
227
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------- |
|
|
228
|
+
| `FILE_SYSTEM_EXTERNAL_STORAGE` | Device file system supports [external storage](/api/js/content/js-file-system) (i.e. flash drives) |
|
|
229
|
+
| `FILE_SYSTEM_FILE_CHECKSUM` | Device is can [calculate a file checksum](/api/js/content/js-file-system#getfilechecksum) |
|
|
230
|
+
| `VIDEO_4K` | Device is capable of [playing 4K video](/api/js/content/js-video) |
|
|
231
|
+
| `SERIAL` | Device supports communication with peripherals over [serial](/api/js/content/js-hardware-serial) |
|
|
232
|
+
:::
|
|
233
|
+
|
|
234
|
+
#### Javascript example:
|
|
235
|
+
|
|
236
|
+
```javascript
|
|
237
|
+
if (await sos.display.supports('VIDEO_4K')) {
|
|
238
|
+
// play 4K video
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
<div class="row d-flex align-content-stretch force-padding-20">
|
|
243
|
+
<div class="col-12 d-flex">
|
|
244
|
+
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank" href="https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/capabilities-content">
|
|
245
|
+
<div>
|
|
246
|
+
<div class="wide-box__image d-flex align-items-center">
|
|
247
|
+
<i class="fab fa-github svg-black"></i>
|
|
248
|
+
</div>
|
|
249
|
+
<div>
|
|
250
|
+
<h3 class="wide-box__title wide-box__title__small pl-85">Example of Content Capabilities</h3>
|
|
251
|
+
<div class="wide-box__description">Working example on our Github</div>
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
</a>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
### Management capabilities
|
|
260
|
+
|
|
261
|
+
Management capabilities refer to the capabilities of the display's internal state management.
|
|
262
|
+
|
|
263
|
+
::: table-responsive
|
|
264
|
+
| Capability | Description |
|
|
265
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------- |
|
|
266
|
+
| `BATTERY_STATUS` | Device can [report its battery status](/api/js/management/1-js-management#getbatterystatus). |
|
|
267
|
+
| `WIFI` | Device can [connect to a Wi-Fi](/api/js/management/13-js-management-wifi#connect). |
|
|
268
|
+
| `WIFI_SCAN` | Device can [scan surrounding Wi-Fi devices](/api/js/management/13-js-management-wifi#scandevices). |
|
|
269
|
+
| `WIFI_AP` | Device is capable of [becoming a Wi-Fi endpoint](/api/js/management/13-js-management-wifi#enableap) that other devices can connect to. |
|
|
270
|
+
| `SET_BRIGHTNESS` | Device can change its [screen brightness](/api/js/management/5-js-management-screen#setbrightness). |
|
|
271
|
+
| `SET_TIME` | Device can change its [time settings](/api/js/management/6-js-management-time). |
|
|
272
|
+
| `NTP_TIME` | Device can [synchronize its time with an NTP server](/api/js/management/6-js-management-time#setntp). |
|
|
273
|
+
| `PACKAGE_INSTALL` | It's possible to [install additional packages](/api/js/management/8-js-management-package) on the device, managed by signageOS application. |
|
|
274
|
+
| `SET_VOLUME` | Device can change its [audio volume](/api/js/management/7-js-management-volume). |
|
|
275
|
+
| `SET_REMOTE_CONTROL_ENABLED` | Device can [disable control via IR remote](/api/js/management/3-js-management-remote-control) to increase security. |
|
|
276
|
+
:::
|
|
277
|
+
|
|
278
|
+
```javascript
|
|
279
|
+
if (await sos.management.supports('WIFI')) {
|
|
280
|
+
// connect to wifi
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
<div class="row d-flex align-content-stretch force-padding-20">
|
|
285
|
+
<div class="col-12 d-flex">
|
|
286
|
+
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank" href="https://github.com/signageos/applet-examples/blob/master/examples/management-js-api/capabilities-management">
|
|
287
|
+
<div>
|
|
288
|
+
<div class="wide-box__image d-flex align-items-center">
|
|
289
|
+
<i class="fab fa-github svg-black"></i>
|
|
290
|
+
</div>
|
|
291
|
+
<div>
|
|
292
|
+
<h3 class="wide-box__title wide-box__title__small pl-85">Example of Management Capabilities</h3>
|
|
293
|
+
<div class="wide-box__description">Working example on our Github</div>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
</a>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
@@ -21,14 +21,20 @@ Default URL can be opened and even the whitelisting/blacklisting of certain doma
|
|
|
21
21
|
::: table-responsive
|
|
22
22
|
| Methods | Description | Supported since |
|
|
23
23
|
| ----------------- | ----------- | ----- | :---------------: |
|
|
24
|
-
| `openLink()` | **Deprecated:** Use `open()` instead. | 1.0.19 |
|
|
25
24
|
| `open()` | Open page in integrated browser | 4.0.0 |
|
|
25
|
+
| `close()` | Open page in integrated browser | 4.4.0 |
|
|
26
26
|
:::
|
|
27
27
|
|
|
28
28
|
## open()
|
|
29
29
|
|
|
30
30
|
::: alert alert--info
|
|
31
|
-
|
|
31
|
+
**This API is currently available on:**
|
|
32
|
+
- Android devices with Android 5+ (Philips, Benq, Sharp, generic Android device)
|
|
33
|
+
|
|
34
|
+
**With some limitation you can use this API also on**
|
|
35
|
+
- Samsung Tizen (SSSP 4 and above); where the website is just in fullscreen without an address bar or theme options (headless mode)
|
|
36
|
+
- LG webOS (webOS 3.0 and above); where the website is just in fullscreen without an address bar or theme options (headless mode)
|
|
37
|
+
- Raspberry Pi and NEC Compute Module; where the website is just in fullscreen without an address bar or theme options (headless mode)
|
|
32
38
|
:::
|
|
33
39
|
|
|
34
40
|
### Javascript
|
|
@@ -49,6 +55,9 @@ Method `open()` also supports properties for browser. You can set height, width
|
|
|
49
55
|
| `coordinates` | Object | Size of browser screen (only Raspberry Pi) |
|
|
50
56
|
| `idleTimeout` | Number | Timeout in milliseconds for loading page |
|
|
51
57
|
| `theme` | Object | Setting custom theme for Android |
|
|
58
|
+
| `headlessMode` | Boolean | Headless mode hides the entire address bar (default) |
|
|
59
|
+
| `canUserClose` | Boolean | Whether the user can manually close the browser. Default:<br>**Headless:** `false`<br>**With UI:** `true` |
|
|
60
|
+
| `clearData` | Boolean | Clear cache after the browser closes. Default:<br>**Headless:** `false`<br>**With UI:** `true` |
|
|
52
61
|
:::
|
|
53
62
|
|
|
54
63
|
|
|
@@ -57,13 +66,14 @@ sos.browser.open('https://www.signageos.io', {
|
|
|
57
66
|
aclDomains: ['google.com', 'yahoo.com'],
|
|
58
67
|
aclMode: 'blacklist', // or 'whitelist'
|
|
59
68
|
readOnlyAddressBar: true,
|
|
60
|
-
coordinates: { // Supported only on Raspberry Pi
|
|
69
|
+
coordinates: { // Supported only on Raspberry Pi and Android
|
|
61
70
|
x: 0,
|
|
62
71
|
y: 0,
|
|
63
72
|
height: 500,
|
|
64
73
|
width: 500,
|
|
65
74
|
},
|
|
66
75
|
// theme: { ... } // supported only on Android
|
|
76
|
+
headlessMode: false, // supported only on Android
|
|
67
77
|
```
|
|
68
78
|
|
|
69
79
|
<div class="row d-flex align-content-stretch force-padding-20">
|
|
@@ -82,9 +92,13 @@ sos.browser.open('https://www.signageos.io', {
|
|
|
82
92
|
</div>
|
|
83
93
|
</div>
|
|
84
94
|
|
|
85
|
-
|
|
95
|
+
### Browser themes usage with Typescript
|
|
86
96
|
You can also use all these methods with [signageOS TypeScript](/knowledge-base/dev-tools-cli-typescript).
|
|
87
97
|
|
|
98
|
+
::: alert alert--info
|
|
99
|
+
Browser themes are only available on Android devices.
|
|
100
|
+
:::
|
|
101
|
+
|
|
88
102
|
```typescript
|
|
89
103
|
type Color = string;
|
|
90
104
|
|
|
@@ -130,19 +144,33 @@ interface IOpenLinkOptions {
|
|
|
130
144
|
width: number;
|
|
131
145
|
height: number;
|
|
132
146
|
};
|
|
133
|
-
theme?: ITheme;
|
|
147
|
+
theme?: ITheme;
|
|
148
|
+
headlessMode?: boolean;
|
|
149
|
+
clearData?: boolean;
|
|
150
|
+
canUserClose?: boolean;
|
|
134
151
|
}
|
|
135
152
|
|
|
136
153
|
open(uri: string, options?: IOpenLinkOptions): void;
|
|
137
154
|
```
|
|
138
155
|
|
|
156
|
+
## close()
|
|
157
|
+
|
|
158
|
+
Closing the Browser instance. The whole page is closed. If you call `open()` again, the page will be loaded from the beginning.
|
|
159
|
+
|
|
160
|
+
### Javascript
|
|
161
|
+
Simple opening some page ex. our main company page.
|
|
162
|
+
```javascript
|
|
163
|
+
sos.browser.close(); // Close the browser
|
|
164
|
+
```
|
|
165
|
+
<br>
|
|
166
|
+
|
|
139
167
|
## Errors
|
|
140
168
|
Although we are doing our best, following errors may occur when opening a link.
|
|
141
169
|
|
|
142
170
|
::: table-responsive
|
|
143
171
|
| Code | Type | Message |
|
|
144
172
|
| ---- | ---- | ------- |
|
|
145
|
-
| 40301 | AppletBrowserUriError | Property argument uri must be a string |
|
|
146
|
-
| 50301 | InternalBrowserOpenLinkError | Unexpected error occurred when opening
|
|
173
|
+
| 40301 | AppletBrowserUriError | Property argument `uri` must be a string |
|
|
174
|
+
| 50301 | InternalBrowserOpenLinkError | Unexpected error occurred when opening `$$LINK$$` |
|
|
147
175
|
:::
|
|
148
176
|
|
|
@@ -13,35 +13,61 @@ description: "[Content JS API] In some cases, you might be interested in a compl
|
|
|
13
13
|
|
|
14
14
|
# Command
|
|
15
15
|
|
|
16
|
-
## Command dispatching
|
|
17
16
|
In some cases, you might be interested in a complete log of what the device was doing during its operation. All of your business or technical logs can be stored in our storage for later usage. You can identify which events happened or even trigger self-repairing logic.
|
|
18
17
|
|
|
19
|
-
All commands will be available in
|
|
20
|
-
* In Box as a debugging stream
|
|
21
|
-
* For pre-defined monitoring metric
|
|
22
|
-
* It can be just downloaded historically as CSV export
|
|
18
|
+
All commands will be available in [Applet Command REST API](https://api.docs.signageos.io/#8e7a8814-e612-1fad-0152-72f37591c7f2) and can be downloaded [historically as CSV export](https://api.docs.signageos.io/#5dceec58-ac4f-7a0c-f5ef-0854f9376e6d).
|
|
23
19
|
|
|
20
|
+
## All methods
|
|
24
21
|
::: table-responsive
|
|
25
22
|
| Methods | Description | Supported since |
|
|
26
|
-
| ----------------- | ----------- | ----- |
|
|
27
|
-
| `dispatch()` | Dispatch method for
|
|
23
|
+
| ----------------- | ----------- | ----- |
|
|
24
|
+
| `dispatch()` | Dispatch method for sending logs and data from device | 1.0.3 |
|
|
25
|
+
| `onCommand()` | Event listener for incoming commands from server | 1.0.3 |
|
|
26
|
+
|
|
27
|
+
:::
|
|
28
|
+
|
|
29
|
+
## dispatch()
|
|
30
|
+
|
|
31
|
+
Dispatch() is used for sending your custom logs or data from device to signageOS.
|
|
28
32
|
|
|
29
33
|
### Parameters
|
|
30
34
|
::: table-responsive
|
|
31
35
|
| Parameter | Type | Required | Description |
|
|
32
36
|
| -------------- | -------------| :----------------: | ------------- |
|
|
33
|
-
| `type` | String | <div class="red">Yes</div> | Event type
|
|
34
|
-
| `
|
|
35
|
-
| `fileType` | String | <div class="red">Yes</div> | Type of file |
|
|
37
|
+
| `type` | String | <div class="red">Yes</div> | Event type; can be any string **up to 100 characters**|
|
|
38
|
+
| custom `parameter` | String | No | Custom parameters and values that you need to be dispatched |
|
|
36
39
|
:::
|
|
37
40
|
|
|
38
41
|
### Javascript example
|
|
39
42
|
```javascript
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
Example of dispatching information about file download
|
|
46
|
+
*/
|
|
47
|
+
await sos.command.dispatch({
|
|
48
|
+
type: 'Files.StartLoading', // mandatory *type* with custom value
|
|
49
|
+
fileName: 'my-file', // custom parameter and value
|
|
50
|
+
fileType: 'txt' // custom parameter and value
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
Example of dispatching applet heartbeat
|
|
55
|
+
*/
|
|
40
56
|
await sos.command.dispatch({
|
|
41
|
-
type: '
|
|
42
|
-
fileName: 'my-file',
|
|
43
|
-
fileType: 'txt'
|
|
57
|
+
type: 'Heartbeat' // mandatory *type* with custom value
|
|
44
58
|
});
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
Example of dispatching applet new data
|
|
62
|
+
*/
|
|
63
|
+
const myCMSJSON = {playlist: "myPlaylist", items: [...]};
|
|
64
|
+
|
|
65
|
+
await sos.command.dispatch({
|
|
66
|
+
type: 'Content.update', // mandatory *type* with custom value
|
|
67
|
+
content: JSON.stringify(myCMSJSON) // custom parameter and value
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
|
|
45
71
|
```
|
|
46
72
|
|
|
47
73
|
<div class="row d-flex align-content-stretch force-padding-20">
|
|
@@ -80,27 +106,41 @@ dispatch(command: ICommand): void;
|
|
|
80
106
|
|
|
81
107
|
<div class="row d-flex align-content-stretch force-padding-20">
|
|
82
108
|
<div class="col-12 d-flex">
|
|
83
|
-
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" href="
|
|
109
|
+
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" href="https://api.docs.signageos.io/#8e7a8814-e612-1fad-0152-72f37591c7f2">
|
|
84
110
|
<div>
|
|
85
111
|
<div class="wide-box__image d-flex align-items-center">
|
|
86
112
|
<i class="fas fa-server svg-black"></i>
|
|
87
113
|
</div>
|
|
88
114
|
<div>
|
|
89
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Rest API:
|
|
90
|
-
<div class="wide-box__description">Receiving
|
|
115
|
+
<h3 class="wide-box__title wide-box__title__small pl-85">Rest API: Get Commands</h3>
|
|
116
|
+
<div class="wide-box__description">Receiving your data dispatched from devices</div>
|
|
91
117
|
</div>
|
|
92
118
|
</div>
|
|
93
119
|
</a>
|
|
94
120
|
</div>
|
|
95
121
|
</div>
|
|
96
122
|
|
|
97
|
-
|
|
123
|
+
<div class="row d-flex align-content-stretch force-padding-20">
|
|
124
|
+
<div class="col-12 d-flex">
|
|
125
|
+
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" href="https://api.docs.signageos.io/#5dceec58-ac4f-7a0c-f5ef-0854f9376e6d">
|
|
126
|
+
<div>
|
|
127
|
+
<div class="wide-box__image d-flex align-items-center">
|
|
128
|
+
<i class="fas fa-server svg-black"></i>
|
|
129
|
+
</div>
|
|
130
|
+
<div>
|
|
131
|
+
<h3 class="wide-box__title wide-box__title__small pl-85">Rest API: Monitoring/Device Reports</h3>
|
|
132
|
+
<div class="wide-box__description">Receiving historical data</div>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</a>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
## onCommand()
|
|
98
140
|
Used for sending custom messages to online connected devices.
|
|
99
|
-
This can be done through the REST API by [POST new applet command](https://docs.signageos.io
|
|
141
|
+
This can be done through the REST API by [POST new applet command](https://api.docs.signageos.io/#511e18f3-b61b-a049-6395-8541132adc44).
|
|
100
142
|
The command will be dispatched to the device & the applet can set up the logic by subscribing `onCommand` method.
|
|
101
143
|
|
|
102
|
-
Dispatched commands will are available in Device Monitoring REST API.
|
|
103
|
-
|
|
104
144
|
**Parameters:**
|
|
105
145
|
::: table-responsive
|
|
106
146
|
| Param | Type | Required | Description |
|
|
@@ -142,7 +182,7 @@ onCommand(listener: (command: ICommand) => void): void;
|
|
|
142
182
|
|
|
143
183
|
<div class="row d-flex align-content-stretch force-padding-20">
|
|
144
184
|
<div class="col-12 d-flex">
|
|
145
|
-
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" href="
|
|
185
|
+
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" href="https://api.docs.signageos.io/#511e18f3-b61b-a049-6395-8541132adc44">
|
|
146
186
|
<div>
|
|
147
187
|
<div class="wide-box__image d-flex align-items-center">
|
|
148
188
|
<i class="fas fa-server svg-black"></i>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Display
|
|
3
|
+
author: Michal Artazov
|
|
4
|
+
date: 12.4.2021
|
|
5
|
+
type: js-api
|
|
6
|
+
tags:
|
|
7
|
+
- applet
|
|
8
|
+
- applet_api
|
|
9
|
+
- api
|
|
10
|
+
- display
|
|
11
|
+
- js_api
|
|
12
|
+
description: "[Content JS API] Display API allows you to query the display to find out, which features it supports."
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Display
|
|
16
|
+
|
|
17
|
+
Display API allows you to query the display to find out, which features it supports.
|
|
18
|
+
That way your applet can handle cases, when a certain feature isn't supported by a particular display.
|
|
19
|
+
|
|
20
|
+
## All methods
|
|
21
|
+
|
|
22
|
+
::: table-responsive
|
|
23
|
+
| Method | Description | Supported since |
|
|
24
|
+
| ------------------ | ---------------------- | :-------------: |
|
|
25
|
+
| `supports()` | Query, whether a certain feature is supported by the display | 3.1.0 |
|
|
26
|
+
:::
|
|
27
|
+
|
|
28
|
+
## supports()
|
|
29
|
+
|
|
30
|
+
Query the display to find out, whether a certain feature is supported.
|
|
31
|
+
To let you know, when you should call this method, we will warn you throughout the content JS API documentation
|
|
32
|
+
with a warning message like this one:
|
|
33
|
+
|
|
34
|
+
::: alert alert--warning
|
|
35
|
+
* Before using this API, ensure that the display supports serial via `sos.display.supports("SERIAL")`.
|
|
36
|
+
* More info [**HERE**](/api/js/content/js-display#supports).
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
::: table-responsive
|
|
40
|
+
| Param | Type | Required | Description |
|
|
41
|
+
| ------------ | ------ | :------------------------: | --------------- |
|
|
42
|
+
| `capability` | string | <div class="red">Yes</div> | Capability name |
|
|
43
|
+
:::
|
|
44
|
+
|
|
45
|
+
### Javascript example
|
|
46
|
+
```javascript
|
|
47
|
+
const serialPort = await sos.display.supports("SERIAL");
|
|
48
|
+
```
|