@signageos/front-applet 5.0.0-rc.1 → 5.1.1
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 +42 -11
- package/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -1
- package/docs/js-api/js-api-introduction.md +57 -47
- package/docs/js-api/js-applet-basics.md +6 -1
- package/docs/js-api/js-applet-resources.md +2 -2
- package/docs/js-api/js-browser.md +1 -2
- package/docs/js-api/js-file-system.md +89 -7
- package/docs/js-api/js-input.md +1 -1
- package/docs/js-api/js-loading-fonts.md +1 -1
- package/docs/js-api/js-monitoring-commands.md +1 -1
- package/docs/js-api/js-offline-cache-media-files.md +3 -3
- package/docs/js-api/js-offline-cache-simple-data.md +2 -2
- package/docs/js-api/js-sensors.md +1 -1
- package/docs/js-api/js-sync-playback.md +1 -1
- package/docs/js-api/js-video-inputs-internal-ports.md +1 -1
- package/docs/js-api/js-video-stream.md +2 -2
- package/docs/js-api/js-video.md +1 -1
- package/docs/management-api/10-js-management-application.md +2 -2
- package/docs/management-api/11-js-management-network.md +36 -1
- package/docs/management-api/13-js-management-wifi.md +4 -0
- package/docs/management-api/2-js-management-firmware.md +17 -3
- package/docs/management-api/5-js-management-screen.md +2 -2
- package/docs/management-api/6-js-management-time.md +18 -2
- package/docs/management-api/9-js-management-debug.md +2 -2
- package/es6/FrontApplet/Exchange/Exchange.d.ts +1 -1
- 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.js +13 -6
- package/es6/FrontApplet/FrontApplet.js.map +1 -1
- package/es6/FrontApplet/Management/INetworkInfo.d.ts +1 -0
- package/es6/FrontApplet/Management/INetworkInfo.js.map +1 -1
- package/es6/FrontApplet/Management/Network.d.ts +1 -0
- package/es6/FrontApplet/Management/Network.js +9 -0
- 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/Monitoring/Montoring.js +1 -1
- package/es6/Monitoring/Montoring.js.map +1 -1
- package/package.json +4 -31
- package/docs/js-api/js-timing.md +0 -54
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: JS SDK Home
|
|
3
3
|
author: Josef Kral
|
|
4
4
|
date: 4.2.2018
|
|
5
5
|
type: rest-api
|
|
@@ -9,65 +9,75 @@ tags:
|
|
|
9
9
|
- api
|
|
10
10
|
description: "[Content JS API] General introduction to signageOS JS API"
|
|
11
11
|
---
|
|
12
|
-
# Applet
|
|
12
|
+
# Javascript SDK for Applet development
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
You can use the same functions across all devices with the same result. Applet JS API is available automatically within your Applet out-of-the-box.
|
|
16
|
-
|
|
17
|
-
Applet JS API supports content-playback features and device management features.
|
|
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**
|
|
14
|
+
Javascript SDK gives you access to device's native features and functionalities. You can use the same functions across all devices with the same result.
|
|
24
15
|
|
|
25
16
|
::: alert alert--tip
|
|
26
|
-
All APIs are standardized and available across all [supported devices](/
|
|
17
|
+
All APIs are standardized and available across all [supported devices](https://docs.signageos.io/hc/en-us/sections/4405700629266-Supported-Devices).
|
|
27
18
|
:::
|
|
28
19
|
|
|
29
|
-
## Content-
|
|
30
|
-
|
|
20
|
+
## Content-related JS APIs
|
|
21
|
+
|
|
22
|
+
Content-related APIs help you with content part of your application /Applet/.
|
|
23
|
+
|
|
24
|
+
Universal APIs for File system, access to accelerated video playback, sensor management and more provide you with robust tool set for creating extensive experiences.
|
|
31
25
|
|
|
32
26
|
::: table-responsive
|
|
33
27
|
| Domain | Description |
|
|
34
28
|
| ------ | ----------- |
|
|
35
|
-
| **[Basic information](/api/js/content/js-applet-basics)** | General information required to use the signageOS JS API |
|
|
36
|
-
| [Applet Resources](/api/js/content/js-applet-resources) | Pre-load necessary files required by your HTML5 player/Applet |
|
|
37
|
-
| [Display](/api/js/content/js-display) | Query features supported by the display |
|
|
38
|
-
| [Browser](/api/js/content/js-browser) | Opening managed web-browser on Android devices inc. whitelisting, blacklisting and other features |
|
|
39
|
-
| [Command](/api/js/content/js-command) | Sending business or technical logs through signageOS in secured offline-ready way |
|
|
40
|
-
| [File system](/api/js/content/js-file-system) | Full-featured file system API including ZIP and folder management |
|
|
41
|
-
| [
|
|
42
|
-
| [
|
|
43
|
-
| [Inputs](/api/js/content/js-input) | Controller inputs like IR remote unified under one API |
|
|
44
|
-
| [
|
|
45
|
-
| [
|
|
46
|
-
| [
|
|
47
|
-
| [
|
|
48
|
-
| [Video
|
|
49
|
-
| [Video
|
|
50
|
-
| [
|
|
51
|
-
| [Monitors](/api/js/content/js-monitors) | Information about monitors |
|
|
29
|
+
| **[Basic information](/api/js/content/latest/js-applet-basics)** | General information required to use the signageOS JS API |
|
|
30
|
+
| [Applet Resources](/api/js/content/latest/js-applet-resources) | Pre-load necessary files required by your HTML5 player/Applet |
|
|
31
|
+
| [Display](/api/js/content/latest/js-display) | Query features supported by the display |
|
|
32
|
+
| [Browser](/api/js/content/latest/js-browser) | Opening managed web-browser on Android devices inc. whitelisting, blacklisting and other features |
|
|
33
|
+
| [Command](/api/js/content/latest/js-command) | Sending business or technical logs through signageOS in secured offline-ready way |
|
|
34
|
+
| [File system](/api/js/content/latest/js-file-system) | Full-featured file system API including ZIP and folder management |
|
|
35
|
+
| [Fonts](/api/js/content/latest/js-loading-fonts) | Make it easy to load additional fonts into SoC devices |
|
|
36
|
+
| [Hardware](/api/js/content/latest/js-hardware) | Hardware-specific APIs like LED lights on Philips 10BDL |
|
|
37
|
+
| [Inputs](/api/js/content/latest/js-input) | Controller inputs like IR remote unified under one API |
|
|
38
|
+
| [Monitors](/api/js/content/latest/js-monitors) | Information about monitors |
|
|
39
|
+
| [Sensors](/api/js/content/latest/js-sensors) | Using sensors and IoT devices in your application |
|
|
40
|
+
| [Serial](/api/js/content/latest/js-hardware-serial) | Control external devices via serial |
|
|
41
|
+
| [Synchronized playback](/api/js/content/latest/js-sync-playback) | API for creating synced playback and videowalls |
|
|
42
|
+
| [Video Inputs aka PiP](/api/js/content/latest/js-video-inputs-internal-ports) | Show HDMI/DP/VGA as a part of your content via PiP feature |
|
|
43
|
+
| [Video Playback](/api/js/content/latest/js-video) | Playing accelerated gapless videos via native video player |
|
|
44
|
+
| [Video Streams](/api/js/content/latest/js-video-stream) | Playing video streams (RTSP, HLS, UDP) via native video player |
|
|
52
45
|
:::
|
|
53
46
|
|
|
54
|
-
## Device
|
|
55
|
-
|
|
47
|
+
## Device control JS APIs
|
|
48
|
+
|
|
49
|
+
Device control features exposed via Javascript APIs.
|
|
50
|
+
|
|
51
|
+
::: alert alert--tip
|
|
52
|
+
For **Device Management** we strongly recommend using REST APIs. [See the REST API documentation here](https://api.docs.signageos.io).
|
|
53
|
+
:::
|
|
56
54
|
|
|
57
55
|
::: table-responsive
|
|
58
56
|
| Domain | Description |
|
|
59
57
|
| ------ | ----------- |
|
|
60
|
-
| [Management](/api/js/management/1-js-management) | Information about the device and power action like Reboot, Restart,.. |
|
|
61
|
-
| [Firmware](/api/js/management/2-js-management-firmware) | Get FW version and upgrade FW from remote location |
|
|
62
|
-
| [Remote Control](/api/js/management/3-js-management-remote-control) | Manage IR Remote control functionality |
|
|
63
|
-
| [Display](/api/js/management/4-js-management-power) | Manage display power - timers, restart and reboot |
|
|
64
|
-
| [Screen](/api/js/management/5-js-management-screen) | Manage brightness, orientation and resolution, display on/off |
|
|
65
|
-
| [Time](/api/js/management/6-js-management-time) | Set time, timezone and get current settings |
|
|
66
|
-
| [Volume](/api/js/management/7-js-management-volume) | Control system volume level |
|
|
67
|
-
| [Package](/api/js/management/8-js-management-package) | Install and manage packages |
|
|
68
|
-
| [Debug](/api/js/management/9-js-management-debug) | Enable/disable debug mode |
|
|
69
|
-
| [Application](/api/js/management/10-js-management-application) | Get application version and upgrade application from remote location |
|
|
70
|
-
| [Network](/api/js/management/11-js-management-network) | Manage network settings |
|
|
71
|
-
| [Security](/api/js/management/12-js-management-security) | Control system security (PIN code) |
|
|
72
|
-
| [Wi-Fi](/api/js/management/13-js-management-wifi) | Manage Wi-Fi |
|
|
58
|
+
| [Management](/api/js/management/latest/1-js-management) | Information about the device and power action like Reboot, Restart,.. |
|
|
59
|
+
| [Firmware](/api/js/management/latest/2-js-management-firmware) | Get FW version and upgrade FW from remote location |
|
|
60
|
+
| [Remote Control](/api/js/management/latest/3-js-management-remote-control) | Manage IR Remote control functionality |
|
|
61
|
+
| [Display](/api/js/management/latest/4-js-management-power) | Manage display power - timers, restart and reboot |
|
|
62
|
+
| [Screen](/api/js/management/latest/5-js-management-screen) | Manage brightness, orientation and resolution, display on/off |
|
|
63
|
+
| [Time](/api/js/management/latest/6-js-management-time) | Set time, timezone and get current settings |
|
|
64
|
+
| [Volume](/api/js/management/latest/7-js-management-volume) | Control system volume level |
|
|
65
|
+
| [Package](/api/js/management/latest/8-js-management-package) | Install and manage packages |
|
|
66
|
+
| [Debug](/api/js/management/latest/9-js-management-debug) | Enable/disable debug mode |
|
|
67
|
+
| [Application](/api/js/management/latest/10-js-management-application) | Get application version and upgrade application from remote location |
|
|
68
|
+
| [Network](/api/js/management/latest/11-js-management-network) | Manage network settings |
|
|
69
|
+
| [Security](/api/js/management/latest/12-js-management-security) | Control system security (PIN code) |
|
|
70
|
+
| [Wi-Fi](/api/js/management/latest/13-js-management-wifi) | Manage Wi-Fi |
|
|
73
71
|
:::
|
|
72
|
+
|
|
73
|
+
# Node.JS SDK
|
|
74
|
+
|
|
75
|
+
Library which allows you to fully manage signageOS applets, devices, management & monitoring using Node.JS and REST API.
|
|
76
|
+
|
|
77
|
+
See full [documentation on GitHub](https://github.com/signageos/sdk)
|
|
78
|
+
|
|
79
|
+
# REST API
|
|
80
|
+
|
|
81
|
+
Large collection of REST API endpoints for device management and monitoring.
|
|
82
|
+
|
|
83
|
+
See full [documentation on Postman](https://api.docs.signageos.io)
|
|
@@ -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
|
|
@@ -188,7 +192,8 @@ console.log(sos.config.imgUrl);
|
|
|
188
192
|
```
|
|
189
193
|
<div class="row d-flex align-content-stretch force-padding-20">
|
|
190
194
|
<div class="col-12 d-flex">
|
|
191
|
-
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank"
|
|
195
|
+
<a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank"
|
|
196
|
+
href="https://docs.signageos.io/hc/en-us/articles/4405238989458">
|
|
192
197
|
<div>
|
|
193
198
|
<div class="wide-box__image d-flex align-items-center">
|
|
194
199
|
<i class="fas fa-hand-point-right svg-black"></i>
|
|
@@ -42,7 +42,7 @@ Every method above, accept single object or array of objects depending by type.
|
|
|
42
42
|
|
|
43
43
|
::: alert alert--info
|
|
44
44
|
* The file URL must point to a file. If your URI leads to a 303 redirect (e.g. from http to http**s**), the API will not work.
|
|
45
|
-
* There are some limitations for [Emulator](
|
|
45
|
+
* There are some limitations for [Emulator](https://docs.signageos.io/hc/en-us/articles/4405238997138).
|
|
46
46
|
:::
|
|
47
47
|
|
|
48
48
|
## addFile()
|
|
@@ -128,7 +128,7 @@ sos.offline.addFilesSync(files).then(() => {
|
|
|
128
128
|
```
|
|
129
129
|
|
|
130
130
|
## Usage with Typescript
|
|
131
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
131
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
132
132
|
|
|
133
133
|
```typescript
|
|
134
134
|
interface ISaveFile {
|
|
@@ -21,7 +21,6 @@ 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 |
|
|
26
25
|
| `close()` | Open page in integrated browser | 4.4.0 |
|
|
27
26
|
:::
|
|
@@ -94,7 +93,7 @@ sos.browser.open('https://www.signageos.io', {
|
|
|
94
93
|
</div>
|
|
95
94
|
|
|
96
95
|
### Browser themes usage with Typescript
|
|
97
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
96
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
98
97
|
|
|
99
98
|
::: alert alert--info
|
|
100
99
|
Browser themes are only available on Android devices.
|
|
@@ -69,10 +69,12 @@ File System directory structure is **PERSISTENT** and is **NOT** automatically d
|
|
|
69
69
|
| `isDirectory()` | Returns true if existing path is directory | 2.1.0 |
|
|
70
70
|
| `copyFile()` | Copy file or directory to a new location | 3.3.0 |
|
|
71
71
|
| `writeFile()` | Write string to a file | 3.2.0 |
|
|
72
|
+
| `appendFile()` | Write string to a file | 4.13.0 |
|
|
72
73
|
| `readFile()` | Read a text file | 3.3.0 |
|
|
73
74
|
:::
|
|
74
75
|
|
|
75
76
|
## listStorageUnits()
|
|
77
|
+
|
|
76
78
|
Return list of storage units /internal, external/ from the device. Capacity values are in bytes.
|
|
77
79
|
|
|
78
80
|
::: alert alert--info
|
|
@@ -85,6 +87,7 @@ This is a mandatory method that is required for all the other File System APIs.
|
|
|
85
87
|
|
|
86
88
|
|
|
87
89
|
### Javascript Example
|
|
90
|
+
|
|
88
91
|
```javascript
|
|
89
92
|
// Storage units are equivalent to disk volumes (C:, D: etc on Windows; /mnt/disc1, /mnt/disc2 on Unix)
|
|
90
93
|
const storageUnits = await sos.fileSystem.listStorageUnits();
|
|
@@ -94,6 +97,7 @@ const internalStorageUnit = storageUnits.find((storageUnit) => !storageUnit.remo
|
|
|
94
97
|
|
|
95
98
|
console.log(storageUnits);
|
|
96
99
|
```
|
|
100
|
+
|
|
97
101
|
### Returns
|
|
98
102
|
|
|
99
103
|
```json
|
|
@@ -115,14 +119,15 @@ console.log(storageUnits);
|
|
|
115
119
|
]
|
|
116
120
|
```
|
|
117
121
|
|
|
118
|
-
|
|
119
122
|
## listFiles()
|
|
123
|
+
|
|
120
124
|
List files and folders located in the internal/external storage.
|
|
121
125
|
* SUCCESS: Return list of files of existing directory
|
|
122
126
|
* FAIL: When listing not existing directory
|
|
123
127
|
* FAIL: When listing existing file (not a directory)
|
|
124
128
|
|
|
125
129
|
### Javascript Example
|
|
130
|
+
|
|
126
131
|
```javascript
|
|
127
132
|
// Storage units are equivalent to disk volumes (C:, D: etc on Windows; /mnt/disc1, /mnt/disc2 on Unix)
|
|
128
133
|
const storageUnits = await sos.fileSystem.listStorageUnits();
|
|
@@ -203,16 +208,19 @@ console.log(testDirDirectoryFilePaths);
|
|
|
203
208
|
```
|
|
204
209
|
|
|
205
210
|
## getFile()
|
|
211
|
+
|
|
206
212
|
Return a file from an internal storage
|
|
207
213
|
* OK: Returns local uri of existing file
|
|
208
214
|
* OK: Returns NULL of not existing file
|
|
209
215
|
|
|
210
216
|
### Parameters
|
|
217
|
+
|
|
211
218
|
| Param | Type | Required | Description |
|
|
212
219
|
| -------------- | ------ | :-------: | ----- |
|
|
213
220
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
214
221
|
|
|
215
222
|
### Javascript Example
|
|
223
|
+
|
|
216
224
|
```javascript
|
|
217
225
|
// always pass storageUnit to tell the JS API where to look
|
|
218
226
|
// get properties of file (at least localUri) or null when not exist
|
|
@@ -243,6 +251,7 @@ Return statement is a dynamic object! It has to be always generated and retrieve
|
|
|
243
251
|
```
|
|
244
252
|
|
|
245
253
|
## exists()
|
|
254
|
+
|
|
246
255
|
* OK: Returns true of existing directory or file
|
|
247
256
|
* OK: Returns false of not existing directory nor file
|
|
248
257
|
|
|
@@ -253,6 +262,7 @@ Return statement is a dynamic object! It has to be always generated and retrieve
|
|
|
253
262
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
254
263
|
|
|
255
264
|
### Javascript Example
|
|
265
|
+
|
|
256
266
|
```javascript
|
|
257
267
|
// always pass storageUnit to tell the JS API where to look
|
|
258
268
|
// check if there is such a file
|
|
@@ -262,9 +272,11 @@ console.log(fileExists);
|
|
|
262
272
|
```
|
|
263
273
|
|
|
264
274
|
### Returns
|
|
275
|
+
|
|
265
276
|
Boolean value
|
|
266
277
|
|
|
267
278
|
## downloadFile()
|
|
279
|
+
|
|
268
280
|
Download file to path within existing directory or **overrides existing file** in a path when successfully downloaded
|
|
269
281
|
|
|
270
282
|
* OK: Download file to path within existing directory
|
|
@@ -285,6 +297,7 @@ Download file to path within existing directory or **overrides existing file** i
|
|
|
285
297
|
:::
|
|
286
298
|
|
|
287
299
|
### Javascript Example
|
|
300
|
+
|
|
288
301
|
```javascript
|
|
289
302
|
// You can download file to specific existing directory
|
|
290
303
|
await sos.fileSystem.downloadFile(
|
|
@@ -294,7 +307,39 @@ await sos.fileSystem.downloadFile(
|
|
|
294
307
|
);
|
|
295
308
|
```
|
|
296
309
|
|
|
310
|
+
#### Encoding
|
|
311
|
+
|
|
312
|
+
All downloads respect a standard of `Encoding` with optional compression of files. See [Mozilla standard Accept Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) and [Content Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding).
|
|
313
|
+
|
|
314
|
+
Download file method is always sending optional following headers:
|
|
315
|
+
```
|
|
316
|
+
Accept-Encoding: gzip
|
|
317
|
+
Accept-Encoding: compress
|
|
318
|
+
Accept-Encoding: deflate
|
|
319
|
+
Accept-Encoding: br
|
|
320
|
+
Accept-Encoding: identity
|
|
321
|
+
Accept-Encoding: *
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
If the server understands the `Encoding` standard, it compresses files using `gzip` algorithm before the files are sent to the client. If so, the response will contain the following headers:
|
|
325
|
+
```
|
|
326
|
+
Content-Encoding: gzip
|
|
327
|
+
Content-Encoding: compress
|
|
328
|
+
Content-Encoding: deflate
|
|
329
|
+
Content-Encoding: br
|
|
330
|
+
```
|
|
331
|
+
So the data communication is compressed under the hood. The client will automatically decompress data before it's saved to a specified location path. So from JS API point of view, there is no requirement to decompress data by itself.
|
|
332
|
+
|
|
333
|
+
The standard is supported on all following platforms:
|
|
334
|
+
|
|
335
|
+
- WebOS 3+
|
|
336
|
+
- Tizen 2.4+
|
|
337
|
+
- Brightsign
|
|
338
|
+
- Raspberry Pi
|
|
339
|
+
- Windows
|
|
340
|
+
|
|
297
341
|
## deleteFile()
|
|
342
|
+
|
|
298
343
|
Delete a file or directory from the path.
|
|
299
344
|
|
|
300
345
|
* OK: (not recursive) Deletes an existing file or existing empty directory
|
|
@@ -310,6 +355,7 @@ Delete a file or directory from the path.
|
|
|
310
355
|
| `recursive`| boolean | <div class="yellow">No</div> | `TRUE` for recursive delete of all content from a directory |
|
|
311
356
|
|
|
312
357
|
### Javascript Example
|
|
358
|
+
|
|
313
359
|
```javascript
|
|
314
360
|
// Delete directory and all files inside
|
|
315
361
|
//// First check, if there is such a directory
|
|
@@ -327,7 +373,9 @@ if (await sos.fileSystem.exists({ storageUnit: internalStorageUnit, filePath: 't
|
|
|
327
373
|
```
|
|
328
374
|
|
|
329
375
|
## moveFile()
|
|
376
|
+
|
|
330
377
|
Move file OR directory to destination path or Move directory to destination path.
|
|
378
|
+
|
|
331
379
|
* OK: Move file to destination path
|
|
332
380
|
* OK: Move directory to destination path
|
|
333
381
|
* FAIL: When destination path exists (is file or directory)
|
|
@@ -341,6 +389,7 @@ Move file OR directory to destination path or Move directory to destination path
|
|
|
341
389
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
342
390
|
|
|
343
391
|
### Javascript Example
|
|
392
|
+
|
|
344
393
|
```javascript
|
|
345
394
|
// Move file to a different directory
|
|
346
395
|
//// First check, if there is such a file and directory
|
|
@@ -356,13 +405,14 @@ if (await sos.fileSystem.exists({ storageUnit: internalStorageUnit, filePath: 't
|
|
|
356
405
|
```
|
|
357
406
|
|
|
358
407
|
## getFileChecksum()
|
|
408
|
+
|
|
359
409
|
Returns checksum of existing file in a path.
|
|
360
410
|
* OK: Returns checksum of existing file in path
|
|
361
411
|
* FAIL: When file path doesn't exist
|
|
362
412
|
* FAIL: When file path is directory
|
|
363
413
|
|
|
364
414
|
::: alert alert--info
|
|
365
|
-
Does not work on Samsung Tizen display - [read more here](
|
|
415
|
+
Does not work on Samsung Tizen display - [read more here](https://docs.signageos.io/hc/en-us/articles/4416327809810)
|
|
366
416
|
:::
|
|
367
417
|
|
|
368
418
|
### Parameters
|
|
@@ -373,17 +423,20 @@ Does not work on Samsung Tizen display - [read more here](knowledge-base/md5-tiz
|
|
|
373
423
|
| `hashFunction` | string | <div class="red">Yes</div> | Available function is `md5` |
|
|
374
424
|
|
|
375
425
|
### Javascript Example
|
|
426
|
+
|
|
376
427
|
```javascript
|
|
377
428
|
const md5Checksum = await sos.fileSystem.getFileChecksum({ storageUnit: internalStorageUnit, filePath: 'test-dir/log.1.txt.backup' }, 'md5');
|
|
378
429
|
console.log(md5Checksum);
|
|
379
430
|
```
|
|
380
431
|
|
|
381
432
|
### Returns
|
|
433
|
+
|
|
382
434
|
```json
|
|
383
435
|
"b3c6930b9306b8e35a978d342cf5a01e" // string
|
|
384
436
|
```
|
|
385
437
|
|
|
386
438
|
## extractFile()
|
|
439
|
+
|
|
387
440
|
Extract ZIPed all files (recursively) to destination path and override existing files or merge existing directories.
|
|
388
441
|
|
|
389
442
|
* OK: Extract ZIPed all files (recursively) to destination path
|
|
@@ -405,6 +458,7 @@ The directory/folder you are extracting your ZIP file into has to be created BEF
|
|
|
405
458
|
| `archiveMethod` | string | <div class="red">Yes</div> | Available method is `zip` |
|
|
406
459
|
|
|
407
460
|
### Javascript Example
|
|
461
|
+
|
|
408
462
|
```javascript
|
|
409
463
|
// Create directory 'test-dir' in a root directory
|
|
410
464
|
await sos.fileSystem.createDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
@@ -418,6 +472,7 @@ await sos.fileSystem.extractFile(
|
|
|
418
472
|
```
|
|
419
473
|
|
|
420
474
|
## createDirectory()
|
|
475
|
+
|
|
421
476
|
Creates a directory in a path.
|
|
422
477
|
|
|
423
478
|
* OK: Creates directory in path
|
|
@@ -436,6 +491,7 @@ Creates a directory in a path.
|
|
|
436
491
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
437
492
|
|
|
438
493
|
### Javascript Example
|
|
494
|
+
|
|
439
495
|
```javascript
|
|
440
496
|
// Create directory 'test-dir' in a root directory
|
|
441
497
|
await sos.fileSystem.createDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
@@ -458,6 +514,7 @@ await Promise.all(myDirs.map(async (dirname) => {
|
|
|
458
514
|
```
|
|
459
515
|
|
|
460
516
|
## isDirectory()
|
|
517
|
+
|
|
461
518
|
Returns true if existing path is directory.
|
|
462
519
|
|
|
463
520
|
* OK: Returns true if existing path is directory
|
|
@@ -471,11 +528,13 @@ Returns true if existing path is directory.
|
|
|
471
528
|
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
472
529
|
|
|
473
530
|
### Javascript Example
|
|
531
|
+
|
|
474
532
|
```javascript
|
|
475
533
|
await sos.fileSystem.isDirectory({ storageUnit: internalStorageUnit, filePath: 'test-dir' });
|
|
476
534
|
```
|
|
477
535
|
|
|
478
536
|
## copyFile()
|
|
537
|
+
|
|
479
538
|
Copy file OR directory to a new location.
|
|
480
539
|
|
|
481
540
|
### Parameters
|
|
@@ -486,6 +545,7 @@ Copy file OR directory to a new location.
|
|
|
486
545
|
| `destinationFilePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
487
546
|
|
|
488
547
|
### Javascript Example
|
|
548
|
+
|
|
489
549
|
```javascript
|
|
490
550
|
await sos.fileSystem.copyFile(
|
|
491
551
|
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.1.txt' },
|
|
@@ -494,16 +554,13 @@ await sos.fileSystem.copyFile(
|
|
|
494
554
|
```
|
|
495
555
|
|
|
496
556
|
## writeFile()
|
|
557
|
+
|
|
497
558
|
Write into file directly:
|
|
559
|
+
|
|
498
560
|
- string support only
|
|
499
561
|
- override only
|
|
500
562
|
- no append
|
|
501
563
|
|
|
502
|
-
::: alert alert--warning
|
|
503
|
-
**LG webOS limitation**:
|
|
504
|
-
It's possible to handle only files up to **~10KB** on webOS devices. At the moment we are working on the solution regarding the file/s 'manipulation' on LG devices.
|
|
505
|
-
:::
|
|
506
|
-
|
|
507
564
|
### Parameters
|
|
508
565
|
|
|
509
566
|
| Param | Type | Required | Description |
|
|
@@ -513,6 +570,7 @@ It's possible to handle only files up to **~10KB** on webOS devices. At the mome
|
|
|
513
570
|
|
|
514
571
|
|
|
515
572
|
### Javascript Example
|
|
573
|
+
|
|
516
574
|
```javascript
|
|
517
575
|
await sos.fileSystem.writeFile(
|
|
518
576
|
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.txt' },
|
|
@@ -520,6 +578,30 @@ await sos.fileSystem.writeFile(
|
|
|
520
578
|
);
|
|
521
579
|
```
|
|
522
580
|
|
|
581
|
+
## appendFile()
|
|
582
|
+
|
|
583
|
+
Append content into file directly:
|
|
584
|
+
|
|
585
|
+
- string support only
|
|
586
|
+
- append only
|
|
587
|
+
|
|
588
|
+
### Parameters
|
|
589
|
+
|
|
590
|
+
| Param | Type | Required | Description |
|
|
591
|
+
| ------ | -------- | :------: | ---- |
|
|
592
|
+
| `filePath` | FilePath | <div class="red">Yes</div> | Object contains storageUnit object returned by `listStorageUnits()` and `filePath` if the file or directory |
|
|
593
|
+
| `content` | String | <div class="red">Yes</div> | Parsed content as string |
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
### Javascript Example
|
|
597
|
+
|
|
598
|
+
```javascript
|
|
599
|
+
await sos.fileSystem.appendFile(
|
|
600
|
+
{ storageUnit: internalStorageUnit, filePath: 'test-dir/log.txt' },
|
|
601
|
+
'My awesome log line\n',
|
|
602
|
+
);
|
|
603
|
+
```
|
|
604
|
+
|
|
523
605
|
## readFile()
|
|
524
606
|
Read a text file.
|
|
525
607
|
|
package/docs/js-api/js-input.md
CHANGED
|
@@ -53,7 +53,7 @@ await sos.input.onKeyUp((keyUpEvent) => {
|
|
|
53
53
|
| ARROW_DOWN | 14 | | |
|
|
54
54
|
|
|
55
55
|
## Usage with Typescript
|
|
56
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
56
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
57
57
|
|
|
58
58
|
```typescript
|
|
59
59
|
interface IKeyUpEvent {
|
|
@@ -102,7 +102,7 @@ await sos.offline.addFont({
|
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
104
|
## Usage with Typescript
|
|
105
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
105
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
108
|
addFont(
|
|
@@ -69,7 +69,7 @@ export interface ConsoleLogged {
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
To trigger some monitoring commands to be dispatched from a device. This REST API can be used to send monitoring [commands to the device](https://docs.signageos.io/api/device-monitoring-api/#Send_Device_Applet_Command_to_device). Following commands can be used:
|
|
72
|
+
To trigger some monitoring commands to be dispatched from a device. This REST API can be used to send monitoring [commands to the device](https://sdk.docs.signageos.io/api/device-monitoring-api/#Send_Device_Applet_Command_to_device). Following commands can be used:
|
|
73
73
|
|
|
74
74
|
### Typescript
|
|
75
75
|
```typescript
|
|
@@ -30,7 +30,7 @@ File API allows files (video files, media files etc.) to be stored for offline u
|
|
|
30
30
|
:::
|
|
31
31
|
|
|
32
32
|
::: alert alert--warning
|
|
33
|
-
Emulator has certain limitations while handling offline files. [Read more here](/
|
|
33
|
+
Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
34
34
|
:::
|
|
35
35
|
|
|
36
36
|
## listFiles()
|
|
@@ -121,7 +121,7 @@ To get file from internal memory & save it when not yet exists we prepared `load
|
|
|
121
121
|
|
|
122
122
|
::: alert alert--info
|
|
123
123
|
* The file URI has to return the file. If your URI leads to a 303 redirect (e.g. from http to http**s**), the API will not work.
|
|
124
|
-
* Emulator has certain limitations while handling offline files. [Read more here](
|
|
124
|
+
* Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
125
125
|
:::
|
|
126
126
|
|
|
127
127
|
### Parameters
|
|
@@ -294,7 +294,7 @@ await sos.offline.cache.decompressFile(zipUid, destinationDirectoryUid, 'zip')
|
|
|
294
294
|
|
|
295
295
|
* [Managing files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/file-system)
|
|
296
296
|
* [Sample applet from Box](https://github.com/signageos/applet-examples/blob/master/index.html)
|
|
297
|
-
* All other examples are available in Knowledge Base under [Applet Examples](/
|
|
297
|
+
* All other examples are available in Knowledge Base under [Applet Examples](https://github.com/signageos/applet-examples/)
|
|
298
298
|
|
|
299
299
|
## Errors
|
|
300
300
|
Although we are doing our best, following errors may occur when working with the offline cache.
|
|
@@ -28,7 +28,7 @@ We do not recommend using a different storage type then Offline Cache or full fe
|
|
|
28
28
|
:::
|
|
29
29
|
|
|
30
30
|
::: alert alert--warning
|
|
31
|
-
Emulator has certain limitations while handling offline files. [Read more here](/
|
|
31
|
+
Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
32
32
|
:::
|
|
33
33
|
|
|
34
34
|
## loadContent()
|
|
@@ -108,7 +108,7 @@ sos.offline.cache.saveContent('ApplicationSecret', '123SuperSecretHash')
|
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
## Usage with Typescript
|
|
111
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
111
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
112
112
|
|
|
113
113
|
```typescript
|
|
114
114
|
loadContent(uid: string): Promise<string>;
|
|
@@ -56,7 +56,7 @@ interface IRfidAntenna {
|
|
|
56
56
|
## Ready to use integrations
|
|
57
57
|
|
|
58
58
|
We already did the hard work for you and implemented some of the popular hardware. All you have to do is use it in your project.
|
|
59
|
-
For more information read [this article](/
|
|
59
|
+
For more information read [this article](https://docs.signageos.io/hc/en-us/articles/4405231196946-Supported-devices-for-Sensors-usage).
|
|
60
60
|
|
|
61
61
|
## Writing your own implementation
|
|
62
62
|
|
|
@@ -166,7 +166,7 @@ Since you never know which device is the master at the moment, you should always
|
|
|
166
166
|
:::
|
|
167
167
|
|
|
168
168
|
## Usage with Typescript
|
|
169
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
169
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
172
|
connect(syncServerUri?: string): Promise<void>;
|
|
@@ -103,7 +103,7 @@ API reacts to events related to changes in internal port status. Events are only
|
|
|
103
103
|
:::
|
|
104
104
|
|
|
105
105
|
## Usage with Typescript
|
|
106
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
106
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
107
107
|
```typescript
|
|
108
108
|
onDisconnected(listener: (event: {
|
|
109
109
|
type: 'disconnected';
|
|
@@ -27,7 +27,7 @@ Methods to play or stop video streams.
|
|
|
27
27
|
:::
|
|
28
28
|
|
|
29
29
|
::: alert alert--warning
|
|
30
|
-
Are you using **Samsung Tizen** to play streams? [Read more about limitation and Tizen-specific details](
|
|
30
|
+
Are you using **Samsung Tizen** to play streams? [Read more about limitation and Tizen-specific details](https://docs.signageos.io/hc/en-us/articles/4405387373458).
|
|
31
31
|
:::
|
|
32
32
|
|
|
33
33
|
## prepare()
|
|
@@ -185,7 +185,7 @@ Example event:
|
|
|
185
185
|
```
|
|
186
186
|
|
|
187
187
|
## Usage with Typescript
|
|
188
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
188
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
189
189
|
```typescript
|
|
190
190
|
interface StreamEvent {
|
|
191
191
|
type: 'connected' | 'disconnected' | 'error',
|
package/docs/js-api/js-video.md
CHANGED
|
@@ -222,7 +222,7 @@ await sos.video.onError((event) => { console.log(event); });
|
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
## Usage with Typescript
|
|
225
|
-
You can also use all these methods with [signageOS TypeScript](/
|
|
225
|
+
You can also use all these methods with [signageOS TypeScript](https://docs.signageos.io/hc/en-us/articles/4405069154962#signageos-typescript).
|
|
226
226
|
|
|
227
227
|
```typescript
|
|
228
228
|
play(
|