@signageos/front-applet 5.0.0-beta.8 → 5.0.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +71 -1
  2. package/dist/bundle.js +2 -2
  3. package/dist/bundle.js.map +1 -1
  4. package/docs/js-api/js-api-introduction.md +37 -22
  5. package/docs/js-api/js-applet-basics.md +4 -0
  6. package/docs/js-api/js-browser.md +12 -6
  7. package/docs/js-api/js-command.md +33 -12
  8. package/docs/js-api/js-display.md +48 -0
  9. package/docs/js-api/js-file-system.md +106 -7
  10. package/docs/js-api/js-hardware-serial.md +2 -2
  11. package/docs/js-api/js-input.md +27 -2
  12. package/docs/js-api/js-offline-cache-media-files.md +19 -7
  13. package/docs/js-api/js-video-stream.md +3 -3
  14. package/docs/management-api/10-js-management-application.md +18 -1
  15. package/docs/management-api/11-js-management-network.md +122 -3
  16. package/docs/management-api/13-js-management-wifi.md +4 -0
  17. package/docs/management-api/2-js-management-firmware.md +4 -0
  18. package/docs/management-api/5-js-management-screen.md +8 -4
  19. package/docs/management-api/6-js-management-time.md +17 -1
  20. package/es6/FrontApplet/Browser/Browser.d.ts +16 -6
  21. package/es6/FrontApplet/Browser/Browser.js +39 -12
  22. package/es6/FrontApplet/Browser/Browser.js.map +1 -1
  23. package/es6/FrontApplet/Browser/IOpenLinkOptions.d.ts +8 -0
  24. package/es6/FrontApplet/Browser/IOpenLinkOptions.js +4 -0
  25. package/es6/FrontApplet/Browser/IOpenLinkOptions.js.map +1 -1
  26. package/es6/FrontApplet/Browser/events.d.ts +15 -0
  27. package/es6/FrontApplet/Browser/events.js +14 -0
  28. package/es6/FrontApplet/Browser/events.js.map +1 -0
  29. package/es6/FrontApplet/Browser/messages.d.ts +5 -0
  30. package/es6/FrontApplet/Browser/messages.js +3 -0
  31. package/es6/FrontApplet/Browser/messages.js.map +1 -0
  32. package/es6/FrontApplet/Debug/Debug.d.ts +22 -0
  33. package/es6/FrontApplet/Debug/Debug.js +35 -0
  34. package/es6/FrontApplet/Debug/Debug.js.map +1 -0
  35. package/es6/FrontApplet/Exchange/Exchange.d.ts +7 -0
  36. package/es6/FrontApplet/Exchange/Exchange.js +28 -0
  37. package/es6/FrontApplet/Exchange/Exchange.js.map +1 -0
  38. package/es6/FrontApplet/FileSystem/FileSystem.d.ts +1 -0
  39. package/es6/FrontApplet/FileSystem/FileSystem.js +10 -0
  40. package/es6/FrontApplet/FileSystem/FileSystem.js.map +1 -1
  41. package/es6/FrontApplet/FrontApplet.d.ts +4 -2
  42. package/es6/FrontApplet/FrontApplet.js +20 -7
  43. package/es6/FrontApplet/FrontApplet.js.map +1 -1
  44. package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.d.ts +30 -0
  45. package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js +92 -0
  46. package/es6/FrontApplet/Hardware/BarcodeScanner/BarcodeScanner.js.map +1 -0
  47. package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.d.ts +5 -0
  48. package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.js +3 -0
  49. package/es6/FrontApplet/Hardware/BarcodeScanner/IBarcodeScannerDataMessage.js.map +1 -0
  50. package/es6/FrontApplet/Hardware/Hardware.d.ts +4 -1
  51. package/es6/FrontApplet/Hardware/Hardware.js +3 -0
  52. package/es6/FrontApplet/Hardware/Hardware.js.map +1 -1
  53. package/es6/FrontApplet/Management/INetworkInfo.d.ts +26 -2
  54. package/es6/FrontApplet/Management/INetworkInfo.js +7 -1
  55. package/es6/FrontApplet/Management/INetworkInfo.js.map +1 -1
  56. package/es6/FrontApplet/Management/Network.d.ts +18 -2
  57. package/es6/FrontApplet/Management/Network.js +51 -9
  58. package/es6/FrontApplet/Management/Network.js.map +1 -1
  59. package/es6/FrontApplet/Management/Time.d.ts +18 -0
  60. package/es6/FrontApplet/Management/Time.js +16 -4
  61. package/es6/FrontApplet/Management/Time.js.map +1 -1
  62. package/es6/FrontApplet/Management/Wifi.d.ts +13 -1
  63. package/es6/FrontApplet/Management/Wifi.js +12 -1
  64. package/es6/FrontApplet/Management/Wifi.js.map +1 -1
  65. package/es6/FrontApplet/Management/helpers/SecurityHelper.js +1 -1
  66. package/es6/FrontApplet/Validate/Validate.js +1 -1
  67. package/es6/FrontApplet/Validate/Validate.js.map +1 -1
  68. package/es6/Monitoring/Montoring.js +1 -1
  69. package/es6/Monitoring/Montoring.js.map +1 -1
  70. package/package.json +6 -33
  71. package/docs/js-api/js-timing.md +0 -54
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: Input
2
+ title: IR Remote Control Input
3
3
  author: Miroslav Behina
4
4
  date: 22.11.2018
5
5
  type: js-api
@@ -11,11 +11,13 @@ tags:
11
11
  description: "[Content JS API] For the specific logic of an application (games for example), binding the remote control inputs can be helpful."
12
12
  ---
13
13
 
14
- # Input
14
+ # IR Remote Control Input
15
15
  For the specific logic of an application (games for example), binding the remote control inputs can be helpful.
16
16
  Only a subset of all remote control keys is supported on the specific device. Only numerical digits are guaranteed to be supported.
17
17
  This feature must be tested by users on real devices.
18
18
 
19
+ ## Event onKeyUp()
20
+
19
21
  ### Parameters
20
22
 
21
23
  ::: table-responsive
@@ -24,6 +26,13 @@ This feature must be tested by users on real devices.
24
26
  | event (in listener) | Object | <div class="red">Yes</div> | Plain JS object containing keyCode as number and keyName as string and type of event (always keyup string) | 1.3.0 |
25
27
  :::
26
28
 
29
+ ### Javascript syntax
30
+ ```javascript
31
+ await sos.input.onKeyUp((keyUpEvent) => {
32
+ console.log(`Pressed: ${keyUpEvent.keyCode} (${keyUpEvent.keyName})`);
33
+ });
34
+ ```
35
+
27
36
  ## Map of keyCodes:
28
37
  | Name | Key code | Name | Key Code |
29
38
  | ---- | :----: | ----- | :----: |
@@ -57,3 +66,19 @@ interface IKeyUpEventListener {
57
66
  }
58
67
  onKeyUp(listener: IKeyUpEventListener): void;
59
68
  ```
69
+
70
+ <div class="row d-flex align-content-stretch force-padding-20">
71
+ <div class="col-12 d-flex">
72
+ <a class="wide-box wide-box--white d-flex align-content-stretch widebox-kb-color" target="_blank" href="https://github.com/signageos/applet-examples/tree/master/examples/content-js-api/remote-control">
73
+ <div>
74
+ <div class="wide-box__image d-flex align-items-center">
75
+ <i class="fab fa-github svg-black"></i>
76
+ </div>
77
+ <div>
78
+ <h3 class="wide-box__title wide-box__title__small pl-85">IR Input handling</h3>
79
+ <div class="wide-box__description">Working example on our Github</div>
80
+ </div>
81
+ </div>
82
+ </a>
83
+ </div>
84
+ </div>
@@ -66,10 +66,14 @@ Method `saveFile()` is used to save files from remote a destination into the dev
66
66
  `headers` has to be a JSON object. If you are passing the value, make sure you use `JSON.parse()`.
67
67
  :::
68
68
 
69
+ ::: alert alert--warning
70
+ `uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
71
+ :::
72
+
69
73
  ### Javascript example
70
74
  ```javascript
71
75
  // Example saving files into internal memory, unique id could be salted md5 hash, uri directs to our CDN
72
- await sos.offline.cache.saveFile('9d66725ba2105f1833731ade5b7f334e', 'https://cdn.my-cms.com/files/video.mp4', { "Authorization": "Basic Zm9vOmJhcg==" })
76
+ await sos.offline.cache.saveFile('9d66725ba2105f1833731ade5b7f334e.mp4', 'https://cdn.my-cms.com/files/video.mp4', { "Authorization": "Basic Zm9vOmJhcg==" })
73
77
  .then(() => { console.log('Saved'); })
74
78
  .catch((error) => { console.error(error); });
75
79
  ```
@@ -87,15 +91,19 @@ Method `loadFile()` is used for individual file retrieval from internal memory.
87
91
  | --------- | ------------ | :---------: | --------------- |
88
92
  | `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
93
 
94
+ ::: alert alert--warning
95
+ `uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
96
+ :::
97
+
90
98
  ### Javascript Example
91
99
  ```javascript
92
- await sos.offline.cache.loadFile('9d66725ba2105f1833731ade5b7f334e')
100
+ await sos.offline.cache.loadFile('9d66725ba2105f1833731ade5b7f334e.mp4')
93
101
  .then((file) => { console.log('Loaded', file); })
94
102
  .catch((error) => { console.error(error); });
95
103
 
96
104
  // Logs into console
97
105
  {
98
- filePath: '/real/device/path/to/file/9d66725ba2105f1833731ade5b7f334e',
106
+ filePath: '/real/device/path/to/file/9d66725ba2105f1833731ade5b7f334e.mp4',
99
107
  }
100
108
  ```
101
109
 
@@ -124,15 +132,19 @@ To get file from internal memory & save it when not yet exists we prepared `load
124
132
  | `uri` | string | <div class="red">Yes</div> | URL address where to get the file |
125
133
  | `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. |
126
134
 
135
+ ::: alert alert--warning
136
+ `uid` should have the same file extension (e.g.: mp4, svg, jpg) as the original file.
137
+ :::
138
+
127
139
  ### Javascript Example
128
140
  ```javascript
129
- await sos.offline.cache.loadOrSaveFile('9d66725ba2105f1833731ade5b7f334e', 'https://cdn.my-cms.com/files/video.mp4', { "Authorization": "Basic Zm9vOmJhcg==" })
141
+ await sos.offline.cache.loadOrSaveFile('9d66725ba2105f1833731ade5b7f334e.mp4', 'https://cdn.my-cms.com/files/video.mp4', { "Authorization": "Basic Zm9vOmJhcg==" })
130
142
  .then((file) => { console.log('Loaded or Saved', file); })
131
143
  .catch((error) => { console.error(error); });
132
144
 
133
145
  // Logs into console
134
146
  {
135
- filePath: '/real/device/path/to/file/9d66725ba2105f1833731ade5b7f334e',
147
+ filePath: '/real/device/path/to/file/9d66725ba2105f1833731ade5b7f334e.mp4',
136
148
  }
137
149
  ```
138
150
 
@@ -187,7 +199,7 @@ Method `deleteFile()` is used for deleting previously saved file from internal m
187
199
 
188
200
  ### Javascript example
189
201
  ```javascript
190
- await sos.offline.cache.deleteFile('9d66725ba2105f1833731ade5b7f334e')
202
+ await sos.offline.cache.deleteFile('9d66725ba2105f1833731ade5b7f334e.mp4')
191
203
  .then(() => { console.log('Deleted'); })
192
204
  .catch((error) => { console.error(error); });
193
205
  ```
@@ -203,7 +215,7 @@ Method `getChecksumFile()` is used for getting the checksum of file from interna
203
215
 
204
216
  ### Javascript example
205
217
  ```javascript
206
- await sos.offline.cache.getChecksumFile('9d66725ba2105f1833731ade5b7f334e', 'md5')
218
+ await sos.offline.cache.getChecksumFile('9d66725ba2105f1833731ade5b7f334e.mp4', 'md5')
207
219
  .then((checksum) => { console.log('MD5 checksum is ' + checksum); })
208
220
  .catch((error) => { console.error(error); });
209
221
  ```
@@ -46,7 +46,7 @@ If you want to play a video stream in full screen mode, use x = y = 0 and width
46
46
  | `y` | Number | <div class="red">Yes</div> | Stream y-position on the screen |
47
47
  | `width` | Number | <div class="red">Yes</div> | Stream width on the screen |
48
48
  | `height` | Number | <div class="red">Yes</div> | Stream height on the screen |
49
- | `protocol` | String | <div class="yellow">No</div> | Protocol that the stream is using |
49
+ | `protocol` | String | <div class="red">Yes</div> | Protocol that the stream is using |
50
50
  |^^|^^|^^| Types: `HLS`, `RTP`, `HTTP`, `UDP`, `RTMP`, `RTSP`. |
51
51
  :::
52
52
 
@@ -87,7 +87,7 @@ If you want to play a video stream in full screen mode, use x = y = 0 and width
87
87
  | `y` | Number | <div class="red">Yes</div> | Stream y-position on the screen |
88
88
  | `width` | Number | <div class="red">Yes</div> | Stream width on the screen |
89
89
  | `height` | Number | <div class="red">Yes</div> | Stream height on the screen |
90
- | `protocol` | String | <div class="yellow">No</div> | Protocol that the stream is using |
90
+ | `protocol` | String | <div class="red">Yes</div> | Protocol that the stream is using |
91
91
  |^^|^^|^^| Types: `HLS`, `RTP`, `HTTP`, `UDP`, `RTMP`, `RTSP`. |
92
92
  :::
93
93
 
@@ -195,7 +195,7 @@ interface StreamEvent {
195
195
  y: number;
196
196
  width: number;
197
197
  height: number;
198
- protocol?: string;
198
+ protocol: string;
199
199
  }
200
200
  }
201
201
  play(
@@ -20,6 +20,7 @@ Management API app lets you check application type and upgrade the application.
20
20
  | Method | Description | Supported since |
21
21
  | ------ | -------- | ------------- |
22
22
  | `getType()` | Information about the platform your application is running on (eg. Tizen) | |
23
+ | `getVersion()` | Information about current version of your application is running on the device (eg. 2.0.5) | |
23
24
  | `upgrade()` | Upgrade/Downgrade the Core App | |
24
25
  :::
25
26
 
@@ -30,8 +31,24 @@ Method `getType()` returns the display type of application on the device.
30
31
  await sos.management.app.getType(); // Returns ex. sssp, android
31
32
  ```
32
33
 
34
+ **Returns one of the following types:**
35
+ - `android`
36
+ - `brightsign`
37
+ - `default` (Emulator)
38
+ - `linux` (Raspberry Pi)
39
+ - `sssp`
40
+ - `tizen`
41
+ - `webos`
42
+ - `windows`
43
+
44
+ ::: alert alert--info
45
+ If you need to get specific Android brand or Raspberry Pi model, use the [Firmware API](api/js/management/latest/2-js-management-firmware) `getType()`.
46
+ :::
47
+
33
48
  ## getVersion()
34
- Method `getVersion()` returns the display version of application on the device.
49
+ Method `getVersion()` returns the version of Core App application on the device.
50
+
51
+ *This API is only available for Applets deployed via Timing from Box or REST API.*
35
52
 
36
53
  ```javascript
37
54
  await sos.management.app.getVersion(); // Returns ex. 2.0.0
@@ -19,14 +19,20 @@ Network management API allows you to manually set network interfaces or set back
19
19
  ::: table-responsive
20
20
  | Method | Description | Supported since |
21
21
  | ------ | -------- | :-------------: |
22
- | `getActiveInfo()` | Information about network interfaces, IP addesses and MAC addresses | 4.0 |
22
+ | `getActiveInfo()` | Information about network interfaces, IP addesses and MAC addresses (**DEPRECATED**) | 4.0 |
23
+ | `listInterfaces()` | Information about network interfaces | 4.9 |
23
24
  | `setManual()` | Allows you to set network settings manually | 4.0 |
24
25
  | `setDHCP()` | Allows you to set network settings automatically from DHCP | 4.0 |
26
+ | `disableInterface()` | Disables a network interface | 4.13 |
25
27
  :::
26
28
 
27
29
  ## getActiveInfo()
28
30
  Method `getActiveInfo()` will display information about connected network.
29
31
 
32
+ ::: alert alert--warning
33
+ This method is deprecated. Use `listInterfaces()` instead.
34
+ :::
35
+
30
36
  ### Javascript example
31
37
  ```javascript
32
38
  await sos.management.network.getActiveInfo();
@@ -64,10 +70,75 @@ await sos.management.network.getActiveInfo();
64
70
  </div>
65
71
  </div>
66
72
 
73
+ ## listInterfaces()
74
+ Returns list of all network interfaces, and their information like MAC address, IP address, etc.
75
+
76
+ ### Javascript example
77
+ ```javascript
78
+ const interfaces = await sos.management.network.listInterfaces();
79
+ ```
80
+
81
+ ### Example of response
82
+
83
+ ```json
84
+ [
85
+ {
86
+ "type": "ethernet",
87
+ "name": "eth0",
88
+ "macAddress": "b8:27:eb:25:8f:63",
89
+ "localAddress": "192.168.1.137",
90
+ "gateway": "192.168.1.1",
91
+ "netmask": "255.255.255.0",
92
+ "dns": [
93
+ "192.168.1.1",
94
+ "1.1.1.1"
95
+ ]
96
+ },
97
+ {
98
+ "type": "wifi",
99
+ "name": "wlan0",
100
+ "macAddress": "b8:27:eb:25:8f:63",
101
+ "disabled": true,
102
+ }
103
+ ]
104
+ ```
105
+
106
+ <div class="row d-flex align-content-stretch force-padding-20">
107
+ <div class="col-12 d-flex">
108
+ <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/network/">
109
+ <div>
110
+ <div class="wide-box__image d-flex align-items-center">
111
+ <i class="fab fa-github svg-black"></i>
112
+ </div>
113
+ <div>
114
+ <h3 class="wide-box__title wide-box__title__small pl-85">Getting network interfaces from device</h3>
115
+ <div class="wide-box__description">Working example on our Github</div>
116
+ </div>
117
+ </div>
118
+ </a>
119
+ </div>
120
+ </div>
121
+
67
122
  ## setManual()
68
- Method `setManual()` will set the current network.
123
+ Manually configures a network interface.
124
+ If the interface is disabled, it will be enabled.
125
+
126
+ ::: alert alert--warning
127
+ Wi-Fi interface can be configured with this method but it has to be first enabled via the [Wi-Fi API](/api/js/management/11-js-management-network).
128
+ :::
69
129
 
70
130
  ### Object properties
131
+
132
+ #### New way
133
+ | Name | Type | Required | Description |
134
+ | ---- | ---- | :------: | ------ |
135
+ | `interfaceName` | String | <div class="red">Yes</div> | Network interface name, can be retrieved from `listInterfaces()` |
136
+ | `options.localAddress` | String | <div class="red">Yes</div> | Network local address |
137
+ | `options.gateway` | String | <div class="red">Yes</div> | Network gateway |
138
+ | `options.netmask` | String | <div class="red">Yes</div> | Network netmask |
139
+ | `options.dns` | Array | <div class="red">Yes</div> | Array of additionally DNSs |
140
+
141
+ #### Old way (deprecated)
71
142
  | Name | Type | Required | Description |
72
143
  | ---- | ---- | :------: | ------ |
73
144
  | `interface` | String | <div class="red">Yes</div> | Network type interface, can be only `ethernet` or `wifi` |
@@ -78,6 +149,15 @@ Method `setManual()` will set the current network.
78
149
 
79
150
  ### Javascript example
80
151
  ```javascript
152
+ // new way
153
+ await sos.management.network.setManual('eth0', {
154
+ localAddress: '192.168.1.133',
155
+ gateway: '192.168.1.1',
156
+ netmask: '255.255.255.0',
157
+ dns: ['8.8.8.8', '192.168.1.1'],
158
+ });
159
+
160
+ // old way (deprecated)
81
161
  await sos.management.network.setManual({
82
162
  interface: 'ethernet',
83
163
  localAddress: '192.168.1.133',
@@ -88,14 +168,53 @@ await sos.management.network.setManual({
88
168
  ```
89
169
 
90
170
  ## setDHCP()
91
- Method `setDHCP()` will set the current network to retrieve IP address automatically from DHCP server.
171
+ Configures a network interface to use DHCP to get an IP address asigned from the network.
172
+ If the interface is disabled, it will be enabled.
173
+
174
+ ::: alert alert--warning
175
+ Wi-Fi interface can be configured with this method but it has to be first enabled via the [Wi-Fi API](/api/js/management/11-js-management-network).
176
+ :::
92
177
 
93
178
  ### Object properties
179
+
180
+ #### New way
181
+ | Name | Type | Required | Description |
182
+ | ---- | ---- | :------: | ------ |
183
+ | `interfaceName` | String | <div class="red">Yes</div> | Network interface name, can be retrieved from `listInterfaces()` |
184
+
185
+ #### Old way (deprecated)
94
186
  | Name | Type | Required | Description |
95
187
  | ---- | ---- | :------: | ------ |
96
188
  | `networkInterface` | String | <div class="red">Yes</div> | Network type interface, can be only `ethernet` or `wifi` |
97
189
 
98
190
  ### Javascript example
99
191
  ```javascript
192
+ // new way
193
+ await sos.management.network.setDHCP('eth0');
194
+
195
+ // old way (deprecated)
100
196
  await sos.management.network.setDHCP('ethernet');
101
197
  ```
198
+
199
+ ## disableInterface()
200
+ Disables a network interface
201
+
202
+ ::: table-responsive
203
+ | Param | Type | Required | Description |
204
+ | --------------- | ------ | :------------------------: | ---------------------------------------------------- |
205
+ | `interfaceName` | String | <div class="red">Yes</div> | Name of the network interface, that will be disabled |
206
+ :::
207
+
208
+ ### Javascript example
209
+ ```javascript
210
+ await sos.management.wifi.disableInterface("eth0");
211
+ ```
212
+
213
+ ::: alert alert--info
214
+ A disabled network interface can be re-enabled simply by calling either `setDHCP()` or `setManual()`.
215
+ :::
216
+
217
+ ::: alert alert--warning
218
+ Don't use this method to disable Wi-Fi.
219
+ Use [Wi-Fi API](/api/js/management/11-js-management-network) to enable/disable Wi-Fi.
220
+ :::
@@ -191,6 +191,7 @@ It is only allowed to call this method in the **CLIENT** state.
191
191
  | ------------------- | ------ | :---------: | ---------------------------------- |
192
192
  | `ssid` | String | <div class="red">Yes</div> | Name of the network you want to connect to. |
193
193
  | `password` | String | <div class="yellow">No</div> | Network's password. |
194
+ | `options` | Object | <div class="yellow">No</div> | Additional options. |
194
195
  :::
195
196
 
196
197
  ### Javascript example
@@ -200,6 +201,9 @@ await sos.management.wifi.connect('network1');
200
201
 
201
202
  // or network with password
202
203
  await sos.management.wifi.connect('network2', 'password123');
204
+
205
+ // connect to a hidden network
206
+ await sos.management.wifi.connect('network3', 'password123', { hidden: true });
203
207
  ```
204
208
 
205
209
  ## disconnect()
@@ -80,6 +80,10 @@ Returns a string identifier that, when combined with firmware version, can be us
80
80
  | ------------- | -------------------------------------- |
81
81
  | `rpi` | any Raspberry Pi 3 or Compute Module 3 |
82
82
  | `rpi4` | any Raspberry Pi 4 or Compute Module 4 |
83
+ | `benq-` | any Benq display |
84
+ | `philips-` | any Philips display |
85
+ | `sharp-` | any Sharp display |
86
+ | `elo-` | any Elo display |
83
87
  :::
84
88
 
85
89
  ### Javascript example
@@ -29,7 +29,7 @@ reboot any device once a day.
29
29
  | `setBrightness()` | Set screen brightness | 3.0.0 |
30
30
  | `getBrightness()` | Get current brightness value | 3.0.0 |
31
31
  | `powerOn()` | Turn `ON` the display (only the display) | 3.0.0 |
32
- | `powerOff()` | Turn `OFF` the display (only the display) | 3.0.0 |
32
+ | `powerOff()` | Turn `OFF` the display (only the display, except Android devices where it turns off the webview as well) | 3.0.0 |
33
33
  | `isPoweredOn()` | Check the display status | 3.0.0 |
34
34
  | `takeAndUploadScreenshot()` | Takes screenshot from the device and upload it to server | 3.0.0 |
35
35
  :::
@@ -41,7 +41,7 @@ Method `resize()` helps you manipulate with several aspects of your displays scr
41
41
  ::: table-responsive
42
42
  | Param |Type | Required | Description |
43
43
  | -------------- | -------------------| :----------: | -------------------- |
44
- | `baseUrl` | String | <div class="red">Yes</div> | For SSSP/Tizen devices where is necessary to switch portrait/landscape Core Apps |
44
+ | `baseUrl` | String | <div class="red">Yes</div> | SSSP & Tizen devices requires to install a orientation-specific Core App if you want to switch orientation to portrait or landscape. |
45
45
  |^^|^^|^^| `https://cdn.your-cms.com/tizen/1.0.4` |
46
46
  | `orientation` | Orientation | <div class="red">Yes</div> | Screen orientation |
47
47
  |^^|^^|^^| `PORTRAIT`, `LANDSCAPE`, `PORTRAIT_FLIPED`, `LANDSCAPE_FLIPPED`, `AUTO` |
@@ -53,17 +53,21 @@ Method `resize()` helps you manipulate with several aspects of your displays scr
53
53
  |^^|^^|^^| `LANDSCAPE`, `PORTRAIT` |
54
54
  :::
55
55
 
56
+ ::: alert alert--info
57
+ For Tizen, you have to provide `baseUrl` which points to your server where you uploaded previously built Core App for Tizen with your buiult-in Applet. [Read more how to upload your Core Apps here.](https://docs.signageos.io/knowledge-base/open-standalone-signageos-provisioning#tizen-specific-installation-url).
58
+ :::
59
+
56
60
  ### Javascript example
57
61
  ```javascript
58
62
  // for Tizen
59
63
  await sos.management.screen.resize(
60
64
  "https://cdn.your-cms.com/tizen/1.0.4",
61
65
  "PORTRAIT",
62
- "HD_READY",
66
+ "FULL_READY",
63
67
  "1.0.4"
64
68
  );
65
69
 
66
- //for other supported device
70
+ //for all other supported device
67
71
  await sos.management.screen.resize(
68
72
  "",
69
73
  "PORTRAIT",
@@ -117,17 +117,33 @@ Calling `setManual()` will disable NTP server settings.
117
117
  ::: table-responsive
118
118
  | Param |Type | Required | Description |
119
119
  | -------------- | ---------- | :---------: | ------------------- |
120
- | `currentDate` | Date | <div class="red">Yes</div> | Datetime to set |
120
+ | `currentDate` | Date \| object | <div class="red">Yes</div> | Datetime to set |
121
121
  | `timezone` | String | <div class="red">Yes</div> | Timezone to set. Accepted values are timezone names from [timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). |
122
122
  :::
123
123
 
124
124
  ### Javascript example
125
125
  ```javascript
126
+ const datetimeObj = {
127
+ year: 2021,
128
+ month: 12,
129
+ day: 15,
130
+ hour: 9,
131
+ minute: 30,
132
+ seconds: 0,
133
+ };
134
+ const timezone = "Europe/Amsterdam";
135
+ await sos.management.time.setManual(datetimeObj, timezone);
136
+
137
+ // Using Date is deprecated. Use the example above.
126
138
  const currentDate = new Date();
127
139
  const timezone = "Europe/Amsterdam";
128
140
  await sos.management.time.setManual(currentDate, timezone);
129
141
  ```
130
142
 
143
+ ::: alert alert--warning
144
+ Calling this method with currentDate as Date is deprecated.
145
+ You should call it with datetime object instead. See example code.
146
+ :::
131
147
 
132
148
  ::: alert alert--warning
133
149
  Setting time and timezone has side effects:
@@ -1,14 +1,24 @@
1
- import IPostMessage from '../IPostMessage';
2
1
  import { IDeprecatedOpenLinkOptions } from './IOpenLinkOptions';
3
2
  import IOpenLinkOptions from './IOpenLinkOptions';
3
+ import { CloseEvent } from './events';
4
+ import { IBrowserMessage } from './messages';
5
+ import Exchange from '../Exchange/Exchange';
4
6
  export default class Browser {
5
- private messagePrefix;
6
- private postMessage;
7
- static MESSAGE_PREFIX: string;
8
- constructor(messagePrefix: string, postMessage: IPostMessage<void>);
7
+ private readonly exchange;
8
+ private readonly events;
9
+ constructor(exchange: Exchange<void>);
9
10
  open(uri: string, options?: IOpenLinkOptions): Promise<void>;
10
11
  close(): Promise<void>;
12
+ /**
13
+ * Find out when the browser is closed.
14
+ * This can happen by an API call, by a user request or after a timeout.
15
+ *
16
+ * This doesn't fire between `open` calls or on subsequent `close` calls.
17
+ *
18
+ * @returns A callback which removes the listener.
19
+ */
20
+ onClose(listener: (event: CloseEvent) => void): () => void;
21
+ handleMessageData(data: IBrowserMessage): void;
11
22
  /** @deprecated use sos.browser.open() instead */
12
23
  openLink(uri: string, options?: IDeprecatedOpenLinkOptions): Promise<void>;
13
- private getMessage;
14
24
  }
@@ -11,38 +11,65 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const IOpenLinkOptions_1 = require("./IOpenLinkOptions");
13
13
  const Validate_1 = require("../Validate/Validate");
14
+ const events_1 = require("./events");
15
+ const events_2 = require("events");
14
16
  class Browser {
15
- constructor(messagePrefix, postMessage) {
16
- this.messagePrefix = messagePrefix;
17
- this.postMessage = postMessage;
17
+ constructor(exchange) {
18
+ this.exchange = exchange;
19
+ this.events = new events_2.EventEmitter();
18
20
  }
19
21
  open(uri, options = {}) {
22
+ var _a;
20
23
  return __awaiter(this, void 0, void 0, function* () {
21
24
  Validate_1.default({ uri }).required().uri();
22
25
  Validate_1.default({ options }).required().object(IOpenLinkOptions_1.VIOpenLinkOptions);
23
- yield this.postMessage(Object.assign({ type: this.getMessage('open'), uri }, options));
26
+ const headlessMode = (_a = options.headlessMode) !== null && _a !== void 0 ? _a : true;
27
+ yield this.exchange.postMessage(Object.assign(Object.assign({ uri }, options), { headlessMode, type: 'open' }));
24
28
  });
25
29
  }
26
30
  close() {
27
31
  return __awaiter(this, void 0, void 0, function* () {
28
- yield this.postMessage({
29
- type: this.getMessage('close'),
32
+ yield this.exchange.postMessage({
33
+ type: 'close',
30
34
  });
31
35
  });
32
36
  }
37
+ /**
38
+ * Find out when the browser is closed.
39
+ * This can happen by an API call, by a user request or after a timeout.
40
+ *
41
+ * This doesn't fire between `open` calls or on subsequent `close` calls.
42
+ *
43
+ * @returns A callback which removes the listener.
44
+ */
45
+ onClose(listener) {
46
+ Validate_1.default({ listener }).required().function();
47
+ this.events.addListener(events_1.EventType.CLOSE, listener);
48
+ return () => {
49
+ this.events.removeListener(events_1.EventType.CLOSE, listener);
50
+ };
51
+ }
52
+ handleMessageData(data) {
53
+ switch (data.type) {
54
+ case this.exchange.messageNameToType('closed'):
55
+ const event = {
56
+ type: events_1.EventType.CLOSE,
57
+ reason: data.reason,
58
+ };
59
+ this.events.emit(events_1.EventType.CLOSE, event);
60
+ break;
61
+ default:
62
+ }
63
+ }
33
64
  /** @deprecated use sos.browser.open() instead */
34
65
  openLink(uri, options = {}) {
35
66
  return __awaiter(this, void 0, void 0, function* () {
67
+ console.warn('sos.browser.openLink() is deprecated and will be removed in the future versions. Use sos.browser.open() instead.');
36
68
  Validate_1.default({ uri }).required().uri();
37
69
  Validate_1.default({ options }).required().object();
38
- console.warn('sos.browser.openLink() is deprecated and will be removed in the future versions. Use sos.browser.open() instead.');
39
- yield this.postMessage(Object.assign({ type: this.getMessage('open_link'), uri }, options));
70
+ yield this.exchange.postMessage(Object.assign(Object.assign({ uri }, options), { headlessMode: false, type: 'open_link' }));
40
71
  });
41
72
  }
42
- getMessage(name) {
43
- return this.messagePrefix + '.' + Browser.MESSAGE_PREFIX + '.' + name;
44
- }
45
73
  }
46
74
  exports.default = Browser;
47
- Browser.MESSAGE_PREFIX = 'browser';
48
75
  //# sourceMappingURL=Browser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Browser.js","sourceRoot":"","sources":["../../../src/FrontApplet/Browser/Browser.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,yDAAmF;AAEnF,mDAA4C;AAE5C,MAAqB,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AAQ,IAAI,CAAC,IAAI,EAAE;YAClB,KAAK,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC;gBAC7C,MAAM,KAAK,GAAe;oBACzB,IAAI,EAAE,kBAAS,CAAC,KAAK;oBACrB,MAAM,EAAE,IAAI,CAAC,MAAqB;iBAClC,CAAC;gBACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBACzC,MAAM;YACP,QAAQ;SACR;IACF,CAAC;IAED,iDAAiD;IACpC,QAAQ,CACpB,GAAW,EACX,UAAsC,EAAE;;YAExC,OAAO,CAAC,IAAI,CAAC,kHAAkH,CAAC,CAAC;YAEjI,kBAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC;YACnC,kBAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAE1C,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,+BAC9B,GAAG,IACA,OAAO,KACV,YAAY,EAAE,KAAK,EACnB,IAAI,EAAE,WAAW,IAChB,CAAC;QACJ,CAAC;KAAA;CACD;AA3ED,0BA2EC"}
@@ -93,6 +93,7 @@ interface IOpenLinkOptions {
93
93
  aclDomains?: string[];
94
94
  aclMode?: 'blacklist' | 'whitelist';
95
95
  readOnlyAddressBar?: boolean;
96
+ idleTimeout?: number;
96
97
  coordinates?: {
97
98
  x: number;
98
99
  y: number;
@@ -100,6 +101,9 @@ interface IOpenLinkOptions {
100
101
  height: number;
101
102
  };
102
103
  theme?: ITheme;
104
+ headlessMode?: boolean;
105
+ clearData?: boolean;
106
+ canUserClose?: boolean;
103
107
  }
104
108
  export default IOpenLinkOptions;
105
109
  export declare const VIOpenLinkOptions: {
@@ -110,6 +114,7 @@ export declare const VIOpenLinkOptions: {
110
114
  '?string': string[];
111
115
  };
112
116
  readOnlyAddressBar: string;
117
+ idleTimeout: string;
113
118
  coordinates: {
114
119
  '?object': {
115
120
  x: string;
@@ -171,4 +176,7 @@ export declare const VIOpenLinkOptions: {
171
176
  };
172
177
  };
173
178
  };
179
+ headlessMode: string;
180
+ clearData: string;
181
+ canUserClose: string;
174
182
  };
@@ -43,6 +43,7 @@ exports.VIOpenLinkOptions = {
43
43
  aclDomains: { '?array': 'string' },
44
44
  aclMode: { '?string': ['blacklist', 'whitelist'] },
45
45
  readOnlyAddressBar: '?boolean',
46
+ idleTimeout: '?number',
46
47
  coordinates: { '?object': {
47
48
  x: 'number',
48
49
  y: 'number',
@@ -51,5 +52,8 @@ exports.VIOpenLinkOptions = {
51
52
  }
52
53
  },
53
54
  theme: { '?object': exports.VITheme },
55
+ headlessMode: '?boolean',
56
+ clearData: '?boolean',
57
+ canUserClose: '?boolean',
54
58
  };
55
59
  //# sourceMappingURL=IOpenLinkOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IOpenLinkOptions.js","sourceRoot":"","sources":["../../../src/FrontApplet/Browser/IOpenLinkOptions.ts"],"names":[],"mappings":";;AAmCa,QAAA,OAAO,GAAG;IACtB,IAAI,EAAE,EAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAC;IACpC,KAAK,EAAE,EAAC,SAAS,EAAE;YACjB,UAAU,EAAE,SAAS;SACrB;KACD;IACD,MAAM,EAAE,EAAC,SAAS,EAAE;YAClB,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE,SAAS;SAClB;KACD;IACD,OAAO,EAAE,EAAC,SAAS,EAAE;YACnB,WAAW,EAAE,EAAC,SAAS,EAAE;oBACvB,MAAM,EAAE,EAAC,SAAS,EAAE;4BAClB,UAAU,EAAE,SAAS;4BACrB,IAAI,EAAE,SAAS;yBACf;qBACD;iBACD;aACD;YACD,WAAW,EAAE,EAAC,SAAS,EAAE;oBACvB,MAAM,EAAE,EAAC,SAAS,EAAE;4BAClB,UAAU,EAAE,SAAS;4BACrB,IAAI,EAAE,SAAS;4BACf,IAAI,EAAE,SAAS;yBACf;qBACD;oBACD,IAAI,EAAE,EAAC,SAAS,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAC;oBAC7D,IAAI,EAAE,SAAS;iBACf;aACD;YACD,QAAQ,EAAE,EAAC,SAAS,EAAE;oBACpB,KAAK,EAAE,SAAS;iBAChB;aACD;SACD;KACD;CACD,CAAC;AA0BW,QAAA,iBAAiB,GAAG;IAChC,UAAU,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC;IAChC,OAAO,EAAE,EAAC,SAAS,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAC;IAChD,kBAAkB,EAAE,UAAU;IAC9B,WAAW,EAAE,EAAC,SAAS,EAAE;YACvB,CAAC,EAAE,QAAQ;YACX,CAAC,EAAE,QAAQ;YACX,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,QAAQ;SAChB;KACD;IACD,KAAK,EAAE,EAAC,SAAS,EAAE,eAAO,EAAC;CAC3B,CAAC"}
1
+ {"version":3,"file":"IOpenLinkOptions.js","sourceRoot":"","sources":["../../../src/FrontApplet/Browser/IOpenLinkOptions.ts"],"names":[],"mappings":";;AAmCa,QAAA,OAAO,GAAG;IACtB,IAAI,EAAE,EAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAC;IACpC,KAAK,EAAE,EAAC,SAAS,EAAE;YACjB,UAAU,EAAE,SAAS;SACrB;KACD;IACD,MAAM,EAAE,EAAC,SAAS,EAAE;YAClB,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,SAAS;YACrB,OAAO,EAAE,SAAS;SAClB;KACD;IACD,OAAO,EAAE,EAAC,SAAS,EAAE;YACnB,WAAW,EAAE,EAAC,SAAS,EAAE;oBACvB,MAAM,EAAE,EAAC,SAAS,EAAE;4BAClB,UAAU,EAAE,SAAS;4BACrB,IAAI,EAA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