senza-sdk 4.3.3 → 4.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +1 -1
- package/dist/implementation.bundle.js +1 -1
- package/package.json +4 -4
- package/src/implementation/api.js +0 -1
- package/src/implementation/deviceManager.js +0 -39
- package/src/implementation/lifecycle.js +32 -0
- package/src/interface/deviceManager.js +0 -28
- package/src/interface/lifecycle.js +12 -0
- package/src/interface/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "senza-sdk",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.5",
|
|
4
4
|
"main": "./src/api.js",
|
|
5
5
|
"description": "API for Senza application",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
},
|
|
55
55
|
"src/interface": {
|
|
56
56
|
"branches": 68.42,
|
|
57
|
-
"functions":
|
|
58
|
-
"lines":
|
|
59
|
-
"statements":
|
|
57
|
+
"functions": 39.63,
|
|
58
|
+
"lines": 64.94,
|
|
59
|
+
"statements": 65.32
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
},
|
|
@@ -132,7 +132,6 @@ export async function init(interfaceApiVersion, showSequenceFunc, initSequenceFu
|
|
|
132
132
|
await lifecycle._init(sessionInfoObj?.settings?.["ui-streamer"], triggerEvent);
|
|
133
133
|
await remotePlayer._init(sessionInfoObj?.settings?.["ui-streamer"], triggerEvent);
|
|
134
134
|
alarmManager._init();
|
|
135
|
-
deviceManager._init();
|
|
136
135
|
messageManager._init();
|
|
137
136
|
sdkLogger.log("All submodules initialized");
|
|
138
137
|
|
|
@@ -2,7 +2,6 @@ import { DeviceManager as DeviceManagerInterface } from "../interface/deviceMana
|
|
|
2
2
|
import { getFCID, sdkLogger, getRestResponse } from "./utils";
|
|
3
3
|
import { sessionInfo } from "./SessionInfo";
|
|
4
4
|
|
|
5
|
-
const wifiInfo = {};
|
|
6
5
|
let wifi_ap_data;
|
|
7
6
|
let wifi_status;
|
|
8
7
|
let wifi_status_last_update = 0;
|
|
@@ -39,40 +38,6 @@ class DeviceManager extends DeviceManagerInterface {
|
|
|
39
38
|
|
|
40
39
|
constructor() {
|
|
41
40
|
super();
|
|
42
|
-
wifiInfo.level = 0;
|
|
43
|
-
wifiInfo.quality = 0;
|
|
44
|
-
wifiInfo.ssid = "unknown";
|
|
45
|
-
wifiInfo.bssid = "unknown";
|
|
46
|
-
/**
|
|
47
|
-
* @type {boolean}
|
|
48
|
-
* @private
|
|
49
|
-
*/
|
|
50
|
-
this._isInitialized = false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @private
|
|
55
|
-
*/
|
|
56
|
-
_init() {
|
|
57
|
-
sdkLogger.log("Initializing DeviceManager");
|
|
58
|
-
if (!this._isInitialized) {
|
|
59
|
-
this._isInitialized = true;
|
|
60
|
-
this._addSenzaEventListeners();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @private Add event listeners for system events
|
|
66
|
-
*/
|
|
67
|
-
_addSenzaEventListeners() {
|
|
68
|
-
typeof document !== "undefined" && document.addEventListener("wifiSignalReport", (e) => {
|
|
69
|
-
wifiInfo.level = e.detail.level;
|
|
70
|
-
wifiInfo.quality = e.detail.quality;
|
|
71
|
-
wifiInfo.ssid = e.detail.ssid;
|
|
72
|
-
wifiInfo.bssid = e.detail.bssid;
|
|
73
|
-
this.dispatchEvent(new Event("wifiInfoUpdated"));
|
|
74
|
-
});
|
|
75
|
-
sdkLogger.log("[DeviceManager] Added event listeners for system events");
|
|
76
41
|
}
|
|
77
42
|
|
|
78
43
|
get deviceInfo() {
|
|
@@ -92,10 +57,6 @@ class DeviceManager extends DeviceManagerInterface {
|
|
|
92
57
|
return super.deviceInfo;
|
|
93
58
|
}
|
|
94
59
|
|
|
95
|
-
get wifiInfo() {
|
|
96
|
-
return wifiInfo;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
60
|
reboot() {
|
|
100
61
|
return new Promise((resolve, reject) => {
|
|
101
62
|
if (window.cefQuery) {
|
|
@@ -723,6 +723,38 @@ class Lifecycle extends LifecycleInterface {
|
|
|
723
723
|
return Promise.reject("exitApplication is not supported if NOT running e2e");
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
+
disconnect() {
|
|
727
|
+
if (window.cefQuery) {
|
|
728
|
+
return new Promise((resolve, reject) => {
|
|
729
|
+
const FCID = getFCID();
|
|
730
|
+
const logger = sdkLogger.withFields({ FCID });
|
|
731
|
+
const message = {
|
|
732
|
+
type: "disconnect",
|
|
733
|
+
reason: "appInitiated",
|
|
734
|
+
target: "client",
|
|
735
|
+
fcid: FCID
|
|
736
|
+
};
|
|
737
|
+
const request = { target: "TC", waitForResponse: false, message: JSON.stringify(message) };
|
|
738
|
+
|
|
739
|
+
logger.log("disconnect: sending disconnect message with reason 'appInitiated'");
|
|
740
|
+
window.cefQuery({
|
|
741
|
+
request: JSON.stringify(request),
|
|
742
|
+
persistent: false,
|
|
743
|
+
onSuccess: () => {
|
|
744
|
+
logger.log("disconnect request successfully sent");
|
|
745
|
+
resolve(true);
|
|
746
|
+
},
|
|
747
|
+
onFailure: (code, msg) => {
|
|
748
|
+
logger.error(`disconnect failed: ${code} ${msg}`);
|
|
749
|
+
reject(`disconnect failed: ${code} ${msg}`);
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
sdkLogger.warn("disconnect is not supported if NOT running e2e");
|
|
755
|
+
return Promise.reject("disconnect is not supported if NOT running e2e");
|
|
756
|
+
}
|
|
757
|
+
|
|
726
758
|
addEventListener(type, listener, options) {
|
|
727
759
|
if (type === "userdisconnected") {
|
|
728
760
|
// Use the event manager for userdisconnected events
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
import { sdkLogger, noop } from "./utils.js";
|
|
2
|
-
/**
|
|
3
|
-
* @event DeviceManager#wifiInfoUpdated
|
|
4
|
-
* @deprecated Instead, call deviceManager.getWifiInfo() periodically
|
|
5
|
-
* @example
|
|
6
|
-
* deviceManager.addEventListener("wifiInfoUpdated", () => {
|
|
7
|
-
* console.info("Wifi info has been updated to", deviceManager.wifiInfo);
|
|
8
|
-
* });
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const wifiInfo = {
|
|
13
|
-
level: 0,
|
|
14
|
-
quality: 0,
|
|
15
|
-
ssid: "unknown",
|
|
16
|
-
bssid: "unknown"
|
|
17
|
-
};
|
|
18
2
|
|
|
19
3
|
/**
|
|
20
4
|
* DeviceManager is a singleton class that manages the device
|
|
@@ -46,18 +30,6 @@ export class DeviceManager extends EventTarget {
|
|
|
46
30
|
|
|
47
31
|
}
|
|
48
32
|
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated use deviceManager.getWifiInfo() instead
|
|
51
|
-
* @property {object} WifiInfo
|
|
52
|
-
* @property {number} WifiInfo.level
|
|
53
|
-
* @property {number} WifiInfo.quality
|
|
54
|
-
* @property {string} WifiInfo.ssid
|
|
55
|
-
* @property {string} WifiInfo.bssid
|
|
56
|
-
*/
|
|
57
|
-
get wifiInfo() {
|
|
58
|
-
return wifiInfo;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
33
|
/**
|
|
62
34
|
* Reboot the device
|
|
63
35
|
* @return {Promise} Promise which is resolved when the reboot command has been successfully processed.
|
|
@@ -250,6 +250,18 @@ class Lifecycle extends EventTarget {
|
|
|
250
250
|
return noop("lifecycle.exitApplication");
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
/**
|
|
254
|
+
* Use this api to disconnect from the current session.
|
|
255
|
+
* This will send a disconnect message to the platform indicating the disconnection was initiated by the application.
|
|
256
|
+
* @return {Promise} Promise which is resolved when the disconnect command has been successfully sent.
|
|
257
|
+
* Failure to process the disconnect command will result in the promise being rejected.
|
|
258
|
+
* @alpha API has not yet been released
|
|
259
|
+
*/
|
|
260
|
+
// API is part of HSDEV-16695
|
|
261
|
+
disconnect() {
|
|
262
|
+
return noop("lifecycle.disconnect");
|
|
263
|
+
}
|
|
264
|
+
|
|
253
265
|
/**
|
|
254
266
|
* Add event listener for lifecycle events
|
|
255
267
|
* @param {string} type - The event type to listen for
|
package/src/interface/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "4.3.
|
|
1
|
+
export const version = "4.3.5";
|