@signageos/front-applet 6.1.1 → 6.2.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 +10 -0
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/docs/{js-api/js-applet-basics.md → applet-basics.md} +37 -98
- package/docs/index.md +97 -0
- package/docs/js-api/js-applet-resources.md +10 -28
- package/docs/js-api/js-browser.md +15 -30
- package/docs/js-api/js-command.md +33 -91
- package/docs/js-api/{js-api-debug.md → js-debug.md} +2 -3
- package/docs/js-api/js-device-info.md +4 -5
- package/docs/js-api/js-display.md +5 -7
- package/docs/js-api/js-file-system.md +13 -14
- package/docs/js-api/{js-loading-fonts.md → js-fonts.md} +21 -44
- package/docs/js-api/js-hardware.md +6 -9
- package/docs/js-api/js-iframes.md +3 -3
- package/docs/js-api/js-input.md +2 -3
- package/docs/js-api/js-offline-cache-media-files.md +26 -83
- package/docs/js-api/js-offline-cache-simple-data.md +11 -16
- package/docs/js-api/js-osd.md +0 -2
- package/docs/js-api/js-proof-of-play.md +4 -6
- package/docs/js-api/js-sensors.md +1 -1
- package/docs/js-api/{js-hardware-serial.md → js-serial.md} +12 -17
- package/docs/js-api/js-sync-playback.md +30 -70
- package/docs/js-api/js-video-inputs-internal-ports.md +15 -33
- package/docs/js-api/js-video-stream.md +49 -85
- package/docs/js-api/js-video.md +25 -75
- package/docs/management-api/{10-js-management-application.md → js-management-application.md} +16 -32
- package/docs/management-api/{7-js-management-volume.md → js-management-audio.md} +4 -6
- package/docs/management-api/{9-js-management-debug.md → js-management-debug.md} +5 -18
- package/docs/management-api/{2-js-management-firmware.md → js-management-firmware.md} +11 -25
- package/docs/management-api/{1-js-management.md → js-management-management.md} +8 -37
- package/docs/{js-api/js-monitoring-commands.md → management-api/js-management-monitoring-commands.md} +5 -6
- package/docs/{js-api/js-monitors.md → management-api/js-management-monitors.md} +9 -9
- package/docs/management-api/{11-js-management-network.md → js-management-network.md} +14 -40
- package/docs/management-api/{2-js-management-os.md → js-management-os.md} +2 -3
- package/docs/management-api/{8-js-management-package.md → js-management-package.md} +4 -6
- package/docs/management-api/{4-js-management-power.md → js-management-power.md} +10 -15
- package/docs/management-api/{14-js-management-proxy.md → js-management-proxy.md} +4 -6
- package/docs/management-api/{3-js-management-remote-control.md → js-management-remote-control.md} +5 -20
- package/docs/management-api/{5-js-management-screen.md → js-management-screen.md} +27 -81
- package/docs/management-api/{12-js-management-security.md → js-management-security.md} +6 -9
- package/docs/management-api/{6-js-management-time.md → js-management-time.md} +19 -26
- package/docs/management-api/{13-js-management-wifi.md → js-management-wifi.md} +31 -40
- package/es6/FrontApplet/Management/Management.d.ts +2 -0
- package/es6/FrontApplet/Management/Management.js +17 -0
- package/es6/FrontApplet/Management/Management.js.map +1 -1
- package/es6/FrontApplet/Management/Power.d.ts +1 -1
- package/es6/FrontApplet/Management/Power.js +3 -1
- package/es6/FrontApplet/Management/Power.js.map +1 -1
- package/package.json +1 -1
- package/docs/js-api/js-api-introduction.md +0 -91
|
@@ -16,9 +16,8 @@ File API allows files (video files, media files etc.) to be stored for offline u
|
|
|
16
16
|
|
|
17
17
|
## All methods
|
|
18
18
|
|
|
19
|
-
::: table-responsive
|
|
20
19
|
| Methods | Description | Supported since |
|
|
21
|
-
| ------ | -------- |
|
|
20
|
+
| ------ | -------- | :-------------: |
|
|
22
21
|
| `listFiles()` | Return list of files of existing directory | 2.0.0 |
|
|
23
22
|
| `saveFile()` | Download file to selected directory | 1.0.3 |
|
|
24
23
|
| `loadFile()` | Load file from cache | 1.0.3 |
|
|
@@ -26,10 +25,9 @@ File API allows files (video files, media files etc.) to be stored for offline u
|
|
|
26
25
|
| `deleteFile()` | Delete file from directory | 2.0.0 |
|
|
27
26
|
| `getChecksumFile()` | Get checksum of a file | 2.0.0 |
|
|
28
27
|
| `validateChecksumFile()` | Validate that file's checksum matches expected value | 2.0.0 |
|
|
29
|
-
| `decompressFile()` | Decompress a compressed file or archive | 2.1.0
|
|
30
|
-
:::
|
|
28
|
+
| `decompressFile()` | Decompress a compressed file or archive | 2.1.0 |
|
|
31
29
|
|
|
32
|
-
:::
|
|
30
|
+
:::warning
|
|
33
31
|
Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
34
32
|
:::
|
|
35
33
|
|
|
@@ -54,19 +52,18 @@ Method `saveFile()` is used to save files from remote a destination into the dev
|
|
|
54
52
|
|
|
55
53
|
### Parameters
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
|
|
58
56
|
| Param | Type | Required | Description |
|
|
59
57
|
| ---------------- | --------------------- | :------: |---------------------------------------------- |
|
|
60
58
|
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters, slash / is supported since Front-display version 6.0.0 |
|
|
61
59
|
| `uri` | string | <div class="red">Yes</div> | URL address to retrieve the file |
|
|
62
|
-
| `headers` | object | <div class="yellow">No</div> | Key, value pairs of HTTP headers to send along with the request. Used when the target file is protected by a password or if any other specific headers are needed to access it.
|
|
63
|
-
:::
|
|
60
|
+
| `headers` | object | <div class="yellow">No</div> | Key, value pairs of HTTP headers to send along with the request. Used when the target file is protected by a password or if any other specific headers are needed to access it.
|
|
64
61
|
|
|
65
|
-
:::
|
|
62
|
+
:::warning
|
|
66
63
|
`headers` has to be a JSON object. If you are passing the value, make sure you use `JSON.parse()`.
|
|
67
64
|
:::
|
|
68
65
|
|
|
69
|
-
:::
|
|
66
|
+
:::warning
|
|
70
67
|
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
71
68
|
:::
|
|
72
69
|
|
|
@@ -78,7 +75,7 @@ await sos.offline.cache.saveFile('9d66725ba2105f1833731ade5b7f334e.mp4', 'https:
|
|
|
78
75
|
.catch((error) => { console.error(error); });
|
|
79
76
|
```
|
|
80
77
|
|
|
81
|
-
:::
|
|
78
|
+
:::info
|
|
82
79
|
Local device file path differs from device to device. It can point to file:// or http://localhost etc.
|
|
83
80
|
:::
|
|
84
81
|
|
|
@@ -91,7 +88,7 @@ Method `loadFile()` is used for individual file retrieval from internal memory.
|
|
|
91
88
|
| --------- | ------------ | :---------: | --------------- |
|
|
92
89
|
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters |
|
|
93
90
|
|
|
94
|
-
:::
|
|
91
|
+
:::warning
|
|
95
92
|
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
96
93
|
:::
|
|
97
94
|
|
|
@@ -107,7 +104,7 @@ await sos.offline.cache.loadFile('9d66725ba2105f1833731ade5b7f334e.mp4')
|
|
|
107
104
|
}
|
|
108
105
|
```
|
|
109
106
|
|
|
110
|
-
:::
|
|
107
|
+
:::info
|
|
111
108
|
Local device file path differs from device to device. It can point to file:// or http://localhost etc.
|
|
112
109
|
:::
|
|
113
110
|
|
|
@@ -119,7 +116,7 @@ Local device file path differs from device to device. It can point to file:// or
|
|
|
119
116
|
Method `loadOrSaveFile()` is used for individual file retrieval & save in case when file is not saved in local storage yet.
|
|
120
117
|
To get file from internal memory & save it when not yet exists we prepared `loadOrSaveFile()` method:
|
|
121
118
|
|
|
122
|
-
:::
|
|
119
|
+
:::info
|
|
123
120
|
* 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
121
|
* Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
125
122
|
:::
|
|
@@ -132,7 +129,7 @@ To get file from internal memory & save it when not yet exists we prepared `load
|
|
|
132
129
|
| `uri` | string | <div class="red">Yes</div> | URL address where to get the file |
|
|
133
130
|
| `headers` | object | <div class="yellow">No</div> | Key, value pairs of HTTP headers to send along with the request. Used when the target file is protected by a password or if any other specific headers are needed to access it. |
|
|
134
131
|
|
|
135
|
-
:::
|
|
132
|
+
:::warning
|
|
136
133
|
`uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
|
|
137
134
|
:::
|
|
138
135
|
|
|
@@ -148,7 +145,7 @@ await sos.offline.cache.loadOrSaveFile('9d66725ba2105f1833731ade5b7f334e.mp4', '
|
|
|
148
145
|
}
|
|
149
146
|
```
|
|
150
147
|
|
|
151
|
-
:::
|
|
148
|
+
:::info
|
|
152
149
|
Local device file path differs from device to device. It can point to file:// or http://localhost etc.
|
|
153
150
|
:::
|
|
154
151
|
|
|
@@ -156,37 +153,10 @@ Local device file path differs from device to device. It can point to file:// or
|
|
|
156
153
|
* SUCCESS: File object
|
|
157
154
|
* FAIL: No file of such uid is available, it will download it to local storage & then return saved file.
|
|
158
155
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
164
|
-
<i class="fab fa-github svg-black"></i>
|
|
165
|
-
</div>
|
|
166
|
-
<div>
|
|
167
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of managing offline files</h3>
|
|
168
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
</a>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
<div class="row d-flex align-content-stretch force-padding-10">
|
|
176
|
-
<div class="col-12 d-flex">
|
|
177
|
-
<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/video-loop-offline">
|
|
178
|
-
<div>
|
|
179
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
180
|
-
<i class="fab fa-github svg-black"></i>
|
|
181
|
-
</div>
|
|
182
|
-
<div>
|
|
183
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of playing video in loop</h3>
|
|
184
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
</a>
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
156
|
+
:::note[GitHub Example]
|
|
157
|
+
- [Example of managing offline files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/offline-files)
|
|
158
|
+
- [Example of playing video in loop](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/video-loop-offline)
|
|
159
|
+
:::
|
|
190
160
|
|
|
191
161
|
## deleteFile()
|
|
192
162
|
Method `deleteFile()` is used for deleting previously saved file from internal memory.
|
|
@@ -220,21 +190,9 @@ await sos.offline.cache.getChecksumFile('9d66725ba2105f1833731ade5b7f334e.mp4',
|
|
|
220
190
|
.catch((error) => { console.error(error); });
|
|
221
191
|
```
|
|
222
192
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
<div>
|
|
227
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
228
|
-
<i class="fab fa-github svg-black"></i>
|
|
229
|
-
</div>
|
|
230
|
-
<div>
|
|
231
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of checking checksum of file</h3>
|
|
232
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
233
|
-
</div>
|
|
234
|
-
</div>
|
|
235
|
-
</a>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
193
|
+
:::note[GitHub Example]
|
|
194
|
+
[Example of checking checksum of file](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/md5-checksum)
|
|
195
|
+
:::
|
|
238
196
|
|
|
239
197
|
## validateChecksumFile()
|
|
240
198
|
Method `validateChecksumFile()` is used for validating the checksum of the previously saved file in from internal memory.
|
|
@@ -274,27 +232,12 @@ await sos.offline.cache.decompressFile(zipUid, destinationDirectoryUid, 'zip')
|
|
|
274
232
|
.catch((error) => { console.error(error); });
|
|
275
233
|
```
|
|
276
234
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
</div>
|
|
284
|
-
<div>
|
|
285
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Example of decompressing ZIP files</h3>
|
|
286
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
287
|
-
</div>
|
|
288
|
-
</div>
|
|
289
|
-
</a>
|
|
290
|
-
</div>
|
|
291
|
-
</div>
|
|
292
|
-
|
|
293
|
-
## More examples
|
|
294
|
-
|
|
295
|
-
* [Managing files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/file-system)
|
|
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](https://github.com/signageos/applet-examples/)
|
|
235
|
+
:::note[GitHub Example]
|
|
236
|
+
- [Example of decompressing ZIP files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/offline-zip-decompress
|
|
237
|
+
- [Managing files](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/file-system)
|
|
238
|
+
- [Sample applet from Box](https://github.com/signageos/applet-examples/blob/master/index.html)
|
|
239
|
+
- All other examples are available in Knowledge Base under [Applet Examples](https://github.com/signageos/applet-examples/)
|
|
240
|
+
:::
|
|
298
241
|
|
|
299
242
|
## Errors
|
|
300
243
|
Although we are doing our best, following errors may occur when working with the offline cache.
|
|
@@ -18,16 +18,15 @@ This API provides you with approach similar to the HTML5's Local Storage, but im
|
|
|
18
18
|
We do not recommend using a different storage type then Offline Cache or full featured [File System API](/api/js/content/js-file-system) that will provide you with more low-level methods.
|
|
19
19
|
|
|
20
20
|
## All methods
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
| Method | Description | Supported Since |
|
|
23
|
-
| ------ | -------- |
|
|
23
|
+
| ------ | -------- | :--------: |
|
|
24
24
|
| `loadContent()` | Loads content from internal storage | 1.0.3 |
|
|
25
25
|
| `saveContent()` | Saves content to internal storage | 1.0.3 |
|
|
26
26
|
| `listContents()` | List all content items saved previously to internal storage | 2.0.0 |
|
|
27
27
|
| `deleteContent()` | Delete content item previously saved to internal storage | 2.0.0 |
|
|
28
|
-
:::
|
|
29
28
|
|
|
30
|
-
:::
|
|
29
|
+
:::warning
|
|
31
30
|
Emulator has certain limitations while handling offline files. [Read more here](https://docs.signageos.io/hc/en-us/articles/4405238997138)
|
|
32
31
|
:::
|
|
33
32
|
|
|
@@ -35,11 +34,10 @@ Emulator has certain limitations while handling offline files. [Read more here](
|
|
|
35
34
|
Method `loadContent()` loads content from internal storage.
|
|
36
35
|
|
|
37
36
|
### Parameters
|
|
38
|
-
|
|
37
|
+
|
|
39
38
|
| Param | Type | Required | Description |
|
|
40
39
|
| -------------- | ------ | :-------: | ----------- |
|
|
41
|
-
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters |
|
|
42
|
-
:::
|
|
40
|
+
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters |
|
|
43
41
|
|
|
44
42
|
### Javascript example
|
|
45
43
|
```javascript
|
|
@@ -50,12 +48,11 @@ await sos.offline.cache.saveContent('ApplicationSecret', '123SuperSecretHash');
|
|
|
50
48
|
Method for saving content into internal storage.
|
|
51
49
|
|
|
52
50
|
### Parameters
|
|
53
|
-
|
|
51
|
+
|
|
54
52
|
| Param | Type | Required | Description |
|
|
55
53
|
| -------------- | ------ | :-------: | ----------- |
|
|
56
54
|
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters |
|
|
57
|
-
| `content` | string | <div class="red">Yes</div> | Only string variables enabled. For JSON values use `JSON.Stringify()`
|
|
58
|
-
:::
|
|
55
|
+
| `content` | string | <div class="red">Yes</div> | Only string variables enabled. For JSON values use `JSON.Stringify()`
|
|
59
56
|
|
|
60
57
|
### Javascript Example
|
|
61
58
|
```javascript
|
|
@@ -81,11 +78,10 @@ await sos.offline.cache.listContents();
|
|
|
81
78
|
Delete content item previously saved to internal storage.
|
|
82
79
|
|
|
83
80
|
### Parameters
|
|
84
|
-
|
|
81
|
+
|
|
85
82
|
| Param | Type | Required | Description |
|
|
86
83
|
| -------------- | ------ | :-------: | ----------- |
|
|
87
|
-
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters |
|
|
88
|
-
:::
|
|
84
|
+
| `uid` | string | <div class="red">Yes</div> | Unique file identifier is used for later file retrieval, must contain a-z,A-Z,0-9 and . characters |
|
|
89
85
|
|
|
90
86
|
### Javascript example
|
|
91
87
|
```javascript
|
|
@@ -121,7 +117,7 @@ deleteContent(uid: string): Promise<void>;
|
|
|
121
117
|
## Errors
|
|
122
118
|
Although we are doing our best, following errors may occur when working with the offline cache.
|
|
123
119
|
|
|
124
|
-
|
|
120
|
+
|
|
125
121
|
| Code | Type | Message |
|
|
126
122
|
| ---- | ---- | ------- |
|
|
127
123
|
| 41001 | AppletNativeCacheError | Already saving the file with UID: ```uid``` |
|
|
@@ -130,5 +126,4 @@ Although we are doing our best, following errors may occur when working with the
|
|
|
130
126
|
| 51001 | InternalNativeCacheError | Couldn\'t load the file before deleting it. |
|
|
131
127
|
| 51002 | InternalNativeCacheError | Couldn\'t save the file to the offline cache. |
|
|
132
128
|
| 51003 | InternalNativeCacheError | File wasn\'t deleted correctly. |
|
|
133
|
-
| 40901 | AppletOfflineCacheError | Uid contains invalid characters, allowed: $$ALLOWED_CHARS$$, got $$ACTUAL_UID$$
|
|
134
|
-
:::
|
|
129
|
+
| 40901 | AppletOfflineCacheError | Uid contains invalid characters, allowed: $$ALLOWED_CHARS$$, got $$ACTUAL_UID$$
|
package/docs/js-api/js-osd.md
CHANGED
|
@@ -18,11 +18,9 @@ OSD API allows you to open OSD for initial setup with applet.
|
|
|
18
18
|
|
|
19
19
|
## All methods
|
|
20
20
|
|
|
21
|
-
::: table-responsive
|
|
22
21
|
| Method | Description | Supported since |
|
|
23
22
|
| ------------------ | ---------------------- | :-------------: |
|
|
24
23
|
| `showOSD()` |Open OSD on the display | 5.5.0 |
|
|
25
|
-
:::
|
|
26
24
|
|
|
27
25
|
## showOSD()
|
|
28
26
|
|
|
@@ -11,12 +11,11 @@ tags:
|
|
|
11
11
|
description: "[Content JS API] You can use our Prooof of Play mechanism to log that some content was played on end device successfully or not. Our system includes important metadata about applet and device out-of-box to simplify solution of issues with content. You can use SignageOS to analyze, if, where, when and how long proposed content was playing in front of audience."
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
## All methods
|
|
15
|
+
|
|
16
16
|
| Methods | Description | Supported since |
|
|
17
17
|
| ----------- | ------------ | -----------|
|
|
18
18
|
| `recordItemPlayed()` | Log that content was played successfully | 5.5.1 |
|
|
19
|
-
:::
|
|
20
19
|
|
|
21
20
|
## recordItemPlayed()
|
|
22
21
|
|
|
@@ -24,11 +23,10 @@ Send provided information about played content along with additional metadata ab
|
|
|
24
23
|
|
|
25
24
|
### Parameters
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
|
|
28
27
|
| Param | Type | Required | Description |
|
|
29
28
|
| --------- | ------ | :------------------------: | -------------------------------------------------- |
|
|
30
|
-
| `options` | Object | <div class="red">Yes</div> | Object containing information about played content
|
|
31
|
-
:::
|
|
29
|
+
| `options` | Object | <div class="red">Yes</div> | Object containing information about played content
|
|
32
30
|
|
|
33
31
|
### Options
|
|
34
32
|
|
|
@@ -24,7 +24,7 @@ If every implementation implements the same set of interfaces, it's easy to swap
|
|
|
24
24
|
It also requires less code to be written to use various types of hardware.
|
|
25
25
|
If possible, you should always implement these interfaces.
|
|
26
26
|
|
|
27
|
-
:::
|
|
27
|
+
:::info
|
|
28
28
|
Right now, the list of interfaces is very short. We will be adding more types soon.
|
|
29
29
|
If there's any particular type of interfaces you'd like, kindly let us know.
|
|
30
30
|
:::
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Serial
|
|
2
|
+
title: Serial Port
|
|
3
3
|
author: Michal Artazov
|
|
4
4
|
date: 25.9.2020
|
|
5
5
|
type: js-api
|
|
@@ -19,7 +19,7 @@ This can be leveraged to integrate a wide variety of hardware into your digital
|
|
|
19
19
|
|
|
20
20
|
Such hardware could be, for example, printers, payment terminals or sensors.
|
|
21
21
|
|
|
22
|
-
:::
|
|
22
|
+
:::warning
|
|
23
23
|
* Before using this API, ensure that the display supports serial via `sos.display.supports("SERIAL")`.
|
|
24
24
|
* More info [**HERE**](/api/js/content/latest/js-display#supports).
|
|
25
25
|
* Samsung Kiosk serial connection only works over serial ports, not over USB ports
|
|
@@ -27,21 +27,19 @@ Such hardware could be, for example, printers, payment terminals or sensors.
|
|
|
27
27
|
|
|
28
28
|
## All methods
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
| Method | Description | Supported since |
|
|
32
32
|
| ------------------ | ---------------------- | :-------------: |
|
|
33
|
-
| `openSerialPort()` | Open a new serial port | 4.4.0
|
|
34
|
-
:::
|
|
33
|
+
| `openSerialPort()` | Open a new serial port | 4.4.0
|
|
35
34
|
|
|
36
35
|
## openSerialPort()
|
|
37
36
|
|
|
38
37
|
Creates a new instance of serial port. You can then use that instance to handle the communication.
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
|
|
41
40
|
| Param | Type | Required | Description |
|
|
42
41
|
| --------- | ------ | :------------------------: | -------------------------------------------------- |
|
|
43
|
-
| `options` | Object | <div class="red">Yes</div> | Object containing configuration of the serial port
|
|
44
|
-
:::
|
|
42
|
+
| `options` | Object | <div class="red">Yes</div> | Object containing configuration of the serial port
|
|
45
43
|
|
|
46
44
|
### Options
|
|
47
45
|
|
|
@@ -71,7 +69,7 @@ const serialPort = await sos.hardware.openSerialPort({
|
|
|
71
69
|
});
|
|
72
70
|
```
|
|
73
71
|
|
|
74
|
-
:::
|
|
72
|
+
:::info
|
|
75
73
|
Device address is different per platform (at least for now). Kindly find the respective device address:
|
|
76
74
|
|
|
77
75
|
| Device type | Default value | Other values for `device` |
|
|
@@ -80,21 +78,19 @@ Device address is different per platform (at least for now). Kindly find the res
|
|
|
80
78
|
| Windows | `COM3` | `COM3` (typically, but check your Win machine if this does not work) |
|
|
81
79
|
| Samsung Kiosk | `PORT1` |`PORT1`, `PORT2`, `PORT3` |
|
|
82
80
|
| Android | `/dev/ttyusb0` | `/dev/ttyusb0` |
|
|
83
|
-
| BrightSign | `0` | `0`, `1`, `USB:A/0`
|
|
84
|
-
:::
|
|
81
|
+
| BrightSign | `0` | `0`, `1`, `USB:A/0`
|
|
85
82
|
|
|
86
83
|
## Serial port methods
|
|
87
84
|
|
|
88
85
|
Once you create a serial port instance using `openSerialPort()` method listed above,
|
|
89
86
|
you can call following methods on it.
|
|
90
87
|
|
|
91
|
-
|
|
88
|
+
|
|
92
89
|
| Method | Description | Supported since |
|
|
93
90
|
| ---------- | ----------------------------------------------------------- | :-------------: |
|
|
94
91
|
| `onData()` | Call a listener callback anytime the opened serial port receiving data. | 4.4.0 |
|
|
95
92
|
| `write()` | Write data to the serial port | 4.4.0 |
|
|
96
|
-
| `close()` | Close serial port | 4.4.0
|
|
97
|
-
:::
|
|
93
|
+
| `close()` | Close serial port | 4.4.0
|
|
98
94
|
|
|
99
95
|
## onData()
|
|
100
96
|
|
|
@@ -148,12 +144,11 @@ await serialPort.close();
|
|
|
148
144
|
Following errors may occur when working with the serial ports. However they don't reflect on actual physical connectivity of the ports due to Samsung b2bapi does not register these events.
|
|
149
145
|
|
|
150
146
|
|
|
151
|
-
|
|
147
|
+
|
|
152
148
|
| Code | Type | Message |
|
|
153
149
|
| ----- | --------------------- | ----------------------------------------- |
|
|
154
150
|
| 50602 | InternalHardwareError | Failed to open serial port |
|
|
155
151
|
| 50603 | InternalHardwareError | Closing serial port that isn't open |
|
|
156
152
|
| 50603 | InternalHardwareError | Failed to close serial port |
|
|
157
153
|
| 50604 | InternalHardwareError | Writing to a serial port that isn't open |
|
|
158
|
-
| 50604 | InternalHardwareError | Failed to write to serial port
|
|
159
|
-
:::
|
|
154
|
+
| 50604 | InternalHardwareError | Failed to write to serial port
|
|
@@ -21,7 +21,6 @@ Sync API enables multiple devices to communicate and coordinate their behavior w
|
|
|
21
21
|
|
|
22
22
|
## All methods
|
|
23
23
|
|
|
24
|
-
::: table-responsive
|
|
25
24
|
| Methods/Events | Description | Supported since |
|
|
26
25
|
| ------------------ | ----------- | :---------------: |
|
|
27
26
|
| `connect()` | Connect to the sync server. | 1.0.32 |
|
|
@@ -35,63 +34,32 @@ Sync API enables multiple devices to communicate and coordinate their behavior w
|
|
|
35
34
|
| `onValue()` | Event called when device receives value broadcasted by another device in the network | 2.0.0 |
|
|
36
35
|
| `onStatus()` | Event called when device is connected and periodic every 30s from sync server - report connected devices | 2.1.0 |
|
|
37
36
|
| `onClosed()` | Event called when synchronizer is closed | 5.12.0 |
|
|
38
|
-
:::
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<div>
|
|
45
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
46
|
-
<i class="fab fa-github svg-black"></i>
|
|
47
|
-
</div>
|
|
48
|
-
<div>
|
|
49
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Synchronized video through applets</h3>
|
|
50
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</a>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<div class="row d-flex align-content-stretch force-padding-10">
|
|
58
|
-
<div class="col-12 d-flex">
|
|
59
|
-
<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/sync-mixed-content">
|
|
60
|
-
<div>
|
|
61
|
-
<div class="wide-box__image d-flex align-items-center">
|
|
62
|
-
<i class="fab fa-github svg-black"></i>
|
|
63
|
-
</div>
|
|
64
|
-
<div>
|
|
65
|
-
<h3 class="wide-box__title wide-box__title__small pl-85">Synchronization mixed content</h3>
|
|
66
|
-
<div class="wide-box__description">Working example on our Github</div>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
</a>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
38
|
+
:::note[GitHub Example]
|
|
39
|
+
- [Synchronized video through applets](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/sync-video)
|
|
40
|
+
- [Synchronization mixed content](https://github.com/signageos/applet-examples/blob/master/examples/content-js-api/sync-mixed-content)
|
|
41
|
+
:::
|
|
72
42
|
|
|
73
43
|
## connect()
|
|
74
44
|
Connect to the sync server. This initializes the connection and is mandatory to call, since synchronization is an optional feature and doesn’t get initialized by default to save resources and bandwidth. You can optionally specify a custom sync server URI in case you are running the sync server in a custom location.
|
|
75
45
|
|
|
76
46
|
### Parameters
|
|
77
|
-
|
|
47
|
+
|
|
78
48
|
| Param | Type | Required | Description |
|
|
79
49
|
| -------- | ------ | :--------------------------: | ----------------------------- |
|
|
80
50
|
| `engine` | String | <div class="yellow">No</div> | Synchronization engine to use |
|
|
81
|
-
| `uri` | String | <div class="yellow">No</div> | Address of sync server. Only relevant for `sync-server`. If omitted, the default server will be used.
|
|
82
|
-
:::
|
|
51
|
+
| `uri` | String | <div class="yellow">No</div> | Address of sync server. Only relevant for `sync-server`. If omitted, the default server will be used.
|
|
83
52
|
|
|
84
53
|
### Engine
|
|
85
54
|
|
|
86
|
-
|
|
55
|
+
|
|
87
56
|
| Engine | Description |
|
|
88
57
|
| ------------- | ---------------------------------------------------------------------------------------- |
|
|
89
58
|
| `sync-server` | (**Default**) Use external sync server. Device will connect to the server via websocket. |
|
|
90
59
|
| `p2p-local` | Synchronize directly with other devices in the local network via UDP and TCP. |
|
|
91
|
-
| `udp` | (**Deprecated - use p2p-local**) Synchronize directly with other devices in the local network via UDP.
|
|
92
|
-
:::
|
|
60
|
+
| `udp` | (**Deprecated - use p2p-local**) Synchronize directly with other devices in the local network via UDP.
|
|
93
61
|
|
|
94
|
-
:::
|
|
62
|
+
:::info
|
|
95
63
|
All devices, that should be synchronized together, must select the same engine.
|
|
96
64
|
Otherwise they won't be able to communicate with each other.
|
|
97
65
|
:::
|
|
@@ -147,19 +115,18 @@ await sos.sync.close().then(() => {
|
|
|
147
115
|
```
|
|
148
116
|
|
|
149
117
|
## init()
|
|
150
|
-
:::
|
|
118
|
+
:::warning
|
|
151
119
|
This method is deprecated and will be removed in the future. Use `joinGroup()` instead. These two methods function identically.
|
|
152
120
|
:::
|
|
153
121
|
|
|
154
122
|
Once the user is connected to the server, the initialization of the sync group is required. Before any communication takes place, all participating devices have to be connected and recognize one another. Recommended to call this method early.
|
|
155
123
|
|
|
156
124
|
### Parameters
|
|
157
|
-
|
|
125
|
+
|
|
158
126
|
| Param | Type | Required | Description |
|
|
159
127
|
| -------------- | ------- | :-----: | ---------------------------- |
|
|
160
128
|
| `groupName` | String | <div class="yellow">No</div> | By default, all devices will be synced together. To create Groups of devices, independent from each other, specify group name |
|
|
161
|
-
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName.
|
|
162
|
-
:::
|
|
129
|
+
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName.
|
|
163
130
|
|
|
164
131
|
### Javascript example
|
|
165
132
|
```javascript
|
|
@@ -170,12 +137,11 @@ await sos.sync.init('someRandomNameGroup', 'device1');
|
|
|
170
137
|
Once we're connected, we have to join a sync group. Before any communication takes place, all participating devices have to be connected and recognize one another. Recommended to call this method early.
|
|
171
138
|
|
|
172
139
|
### Parameters
|
|
173
|
-
|
|
140
|
+
|
|
174
141
|
| Param | Type | Required | Description |
|
|
175
142
|
| -------------- | ------- | :-----: | ---------------------------- |
|
|
176
143
|
| `groupName` | String | <div class="yellow">No</div> | By default, all devices will be synced together. To create Groups of devices, independent from each other, specify group name |
|
|
177
|
-
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName.
|
|
178
|
-
:::
|
|
144
|
+
| `deviceIdentification` | String | <div class="yellow">No</div> | Is identification of device connected to groupName.
|
|
179
145
|
|
|
180
146
|
### Javascript example
|
|
181
147
|
```javascript
|
|
@@ -193,13 +159,12 @@ This method returns a promise that resolves once all the devices meet and are re
|
|
|
193
159
|
Sometimes devices might go out of sync due to unpredictable conditions like loss of internet connection. To ensure re-sync of an out of sync device, you can pass some data as the first argument. This can be any data that informs the whole group about what content is about to play next. Once all devices are ready, data from the master device is passed to everyone and the rest of the data is ignored. Therefore, when implementing your applet you should rely on the result data and not the data that is passed to the wait method as an argument.
|
|
194
160
|
|
|
195
161
|
### Parameters
|
|
196
|
-
|
|
162
|
+
|
|
197
163
|
| Param | Type | Required | Description |
|
|
198
164
|
| -------------- | ------- | :-----: | ------- |
|
|
199
165
|
| `data` | Any | <div class="yellow">No</div> | Information about what content is about to play so all the devices display the same content. |
|
|
200
166
|
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name as the second argument has to be passed. |
|
|
201
|
-
| `timeout` | Number | <div class="yellow">No</div> | Wait timeout on other devices
|
|
202
|
-
:::
|
|
167
|
+
| `timeout` | Number | <div class="yellow">No</div> | Wait timeout on other devices
|
|
203
168
|
|
|
204
169
|
### Returns
|
|
205
170
|
Promise that resolves to data picked from the first argument of the master device
|
|
@@ -213,11 +178,10 @@ In order to gracefully cleanup any pending activity, use this method.
|
|
|
213
178
|
Any pending wait will be canceled and the promise will be rejected with an error.
|
|
214
179
|
|
|
215
180
|
### Parameters
|
|
216
|
-
|
|
181
|
+
|
|
217
182
|
| Param | Type | Required | Description |
|
|
218
183
|
| ----------- | ------- | :--------------------------: | ------------ |
|
|
219
|
-
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name as the second argument has to be passed.
|
|
220
|
-
:::
|
|
184
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name as the second argument has to be passed.
|
|
221
185
|
|
|
222
186
|
### Javascript example
|
|
223
187
|
```javascript
|
|
@@ -234,29 +198,27 @@ await sos.sync.cancelWait('someRandomNameGroup');
|
|
|
234
198
|
Another way to synchronize devices is to broadcast some values within the group so, in turn, all devices can react to it. Unlike option wait, this is more useful in use cases when the synchronization is based around the content itself, rather than timing.
|
|
235
199
|
|
|
236
200
|
### All Methods
|
|
237
|
-
|
|
201
|
+
|
|
238
202
|
| Method | Type | Description | Supported since |
|
|
239
203
|
| ------ | ------ | -------- | ------------- |
|
|
240
204
|
| `setValue()` | method | Used for broadcast values for all master devices | 2.0.0 |
|
|
241
205
|
| `onValue()` | event | Event called when device receive any value | 2.0.0 |
|
|
242
|
-
| `onStatus()` | event | Event called when device is connected and periodic every 30s from sync server - report connected devices | 2.1.0
|
|
243
|
-
:::
|
|
206
|
+
| `onStatus()` | event | Event called when device is connected and periodic every 30s from sync server - report connected devices | 2.1.0
|
|
244
207
|
|
|
245
208
|
## setValue()
|
|
246
|
-
:::
|
|
209
|
+
:::warning
|
|
247
210
|
This method is deprecated and will be removed in the future. Use `broadcastValue()` instead. These two methods function identically.
|
|
248
211
|
:::
|
|
249
212
|
|
|
250
213
|
This method can be called by any device to broadcast a value to the whole group.
|
|
251
214
|
|
|
252
215
|
### Parameters
|
|
253
|
-
|
|
216
|
+
|
|
254
217
|
| Param |Type | Required | Description |
|
|
255
218
|
| -------------- | --------- | :------: | ------------------- |
|
|
256
219
|
| `key` | String | <div class="red">Yes</div> | Values are recognized based their key so different types of values can be broadcasted independently within the group |
|
|
257
220
|
| `value` | Any | <div class="red">Yes</div> | The value to be broadcasted |
|
|
258
|
-
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument
|
|
259
|
-
:::
|
|
221
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument
|
|
260
222
|
|
|
261
223
|
### Javascript example
|
|
262
224
|
```javascript
|
|
@@ -267,13 +229,12 @@ await sos.sync.setValue('some-key', 'some-value', 'some-group');
|
|
|
267
229
|
This method can be called by any device to broadcast a value to the whole group.
|
|
268
230
|
|
|
269
231
|
### Parameters
|
|
270
|
-
|
|
232
|
+
|
|
271
233
|
| Param |Type | Required | Description |
|
|
272
234
|
| -------------- | --------- | :------: | ------------------- |
|
|
273
235
|
| `key` | String | <div class="red">Yes</div> | Values are recognized based their key so different types of values can be broadcasted independently within the group |
|
|
274
236
|
| `value` | Any | <div class="red">Yes</div> | The value to be broadcasted |
|
|
275
|
-
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument
|
|
276
|
-
:::
|
|
237
|
+
| `groupName` | String | <div class="yellow">No</div> | If `joinGroup` is called with custom group name, the same group name has to be passed as the third argument
|
|
277
238
|
|
|
278
239
|
### Javascript example
|
|
279
240
|
```javascript
|
|
@@ -294,7 +255,7 @@ await sos.sync.onValue((key, value, groupName) => {
|
|
|
294
255
|
});
|
|
295
256
|
```
|
|
296
257
|
|
|
297
|
-
<br
|
|
258
|
+
<br/>
|
|
298
259
|
|
|
299
260
|
## Event onStatus()
|
|
300
261
|
Is used for receiving information about connected device to sync server. Emitted every 30s, or when device connect or disconnect from server.
|
|
@@ -307,9 +268,9 @@ await sos.sync.onStatus((connectedPeers) => {
|
|
|
307
268
|
});
|
|
308
269
|
```
|
|
309
270
|
|
|
310
|
-
<br
|
|
271
|
+
<br/>
|
|
311
272
|
|
|
312
|
-
:::
|
|
273
|
+
:::info
|
|
313
274
|
Since you never know which device is the master at the moment, you should always rely only on the values received by the listener, not the values that the particular device itself is broadcasting.
|
|
314
275
|
:::
|
|
315
276
|
|
|
@@ -371,12 +332,11 @@ onClosed(listener: (
|
|
|
371
332
|
## Errors
|
|
372
333
|
Although we are doing our best, following errors may occur when working with the synchronizer.
|
|
373
334
|
|
|
374
|
-
|
|
335
|
+
|
|
375
336
|
| Code | Type | Message |
|
|
376
337
|
| ---- | ---- | ------- |
|
|
377
338
|
| 51101 | InternalSynchronizerError | Synchronizer couldn't connect to the server. |
|
|
378
339
|
| 51102 | InternalSynchronizerError | The connection wasn't closed correctly. |
|
|
379
340
|
| 51103 | InternalSynchronizerError | The group initialization failed. |
|
|
380
341
|
| 51104 | InternalSynchronizerError | Wait failed for unexpected reason. |
|
|
381
|
-
| 51105 | InternalSynchronizerError | Synchronizer couldn't set the value.
|
|
382
|
-
:::
|
|
342
|
+
| 51105 | InternalSynchronizerError | Synchronizer couldn't set the value.
|