@robotical/webapp-types 3.17.51 → 3.17.52
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-types/src/application/ApplicationManager/ApplicationManager.d.ts +13 -10
- package/dist-types/src/application/ApplicationManager/ApplicationManager.js +147 -76
- package/dist-types/src/application/RAFTs/Cog/Cog.d.ts +1 -1
- package/dist-types/src/application/RAFTs/Cog/Cog.js +1 -1
- package/dist-types/src/application/RAFTs/Marty/CalibrationManager.d.ts +1 -1
- package/dist-types/src/application/RAFTs/Marty/CalibrationManager.js +1 -1
- package/dist-types/src/application/RAFTs/Marty/Marty.d.ts +1 -1
- package/dist-types/src/application/RAFTs/Marty/Marty.js +1 -1
- package/dist-types/src/application/RAFTs/Marty/MartyWifiManager.d.ts +1 -1
- package/dist-types/src/application/RAFTs/Marty/MartyWifiManager.js +1 -1
- package/dist-types/src/application/RAFTs/Marty/notifications-manager/ReportedWarningsState.js +1 -1
- package/dist-types/src/application/RAFTs/RAFT.d.ts +1 -1
- package/dist-types/src/application/RAFTs/RAFT.js +2 -2
- package/dist-types/src/application/RAFTs/RAFTInterface.d.ts +1 -1
- package/dist-types/src/application/RAFTs/RaftObserver.d.ts +1 -1
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +1 -1
- package/dist-types/src/components/modals/LEDLightsOrQRVerificationModal/index.js +1 -2
- package/dist-types/src/components/modals/VerificationModal/index.js +0 -8
- package/dist-types/src/components/modals/VerificationModalPhoneApp/index.js +17 -32
- package/dist-types/src/components/oneoffs/LEDs/index.js +1 -1
- package/dist-types/src/types/raft.d.ts +1 -1
- package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.d.ts +1 -1
- package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.js +1 -1
- package/dist-types/src/wrapper-app/WrapperAppManager.d.ts +16 -7
- package/dist-types/src/wrapper-app/WrapperAppManager.js +225 -55
- package/dist-types/src/wrapper-app/communicators/WebAppCommunicator.js +3 -6
- package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.d.ts +1 -1
- package/dist-types/src/wrapper-app/connectors/CogConnector/CogConnector.js +1 -1
- package/dist-types/src/wrapper-app/connectors/Connector.d.ts +14 -2
- package/dist-types/src/wrapper-app/connectors/Connector.js +25 -1
- package/dist-types/src/wrapper-app/connectors/ConnectorFactory.d.ts +1 -1
- package/dist-types/src/wrapper-app/connectors/ConnectorFactory.js +24 -3
- package/dist-types/src/wrapper-app/connectors/ConnectorInterface.d.ts +1 -1
- package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.d.ts +1 -1
- package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.js +1 -1
- package/dist-types/src/wrapper-app/utils/ColourSensorManualCalibratorMarty.d.ts +1 -1
- package/package.json +10 -1
|
@@ -4,13 +4,14 @@ import { ConnectionAttemptResults, RaftTypeE } from "../../types/raft";
|
|
|
4
4
|
import { RaftObserver } from "../../application/RAFTs/RaftObserver";
|
|
5
5
|
import ConnectorInterface from "./ConnectorInterface";
|
|
6
6
|
import { ConnManager, RICLedLcdColours } from "@robotical/roboticaljs";
|
|
7
|
-
import { RaftOKFail, RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@
|
|
7
|
+
import { RaftOKFail, RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@robdobsn/raftjs";
|
|
8
8
|
declare class Connector implements ConnectorInterface {
|
|
9
9
|
id: string;
|
|
10
10
|
type: RaftTypeE;
|
|
11
11
|
protected _observers: {
|
|
12
12
|
[key: string]: Array<RaftObserver>;
|
|
13
13
|
};
|
|
14
|
+
private _onDisconnected?;
|
|
14
15
|
connManager: ConnManager;
|
|
15
16
|
constructor(id: string, connManager: ConnManager);
|
|
16
17
|
/**
|
|
@@ -20,7 +21,7 @@ declare class Connector implements ConnectorInterface {
|
|
|
20
21
|
/**
|
|
21
22
|
* Get connected raft info
|
|
22
23
|
*/
|
|
23
|
-
getSystemInfo(): Promise<import("@
|
|
24
|
+
getSystemInfo(): Promise<import("@robdobsn/raftjs").RaftSystemInfo>;
|
|
24
25
|
/**
|
|
25
26
|
* Gets the RAFT name
|
|
26
27
|
*/
|
|
@@ -37,6 +38,17 @@ declare class Connector implements ConnectorInterface {
|
|
|
37
38
|
* Disconnect from a RAFT
|
|
38
39
|
*/
|
|
39
40
|
disconnect(): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Register the manager-owned cleanup callback for a terminal disconnect event.
|
|
43
|
+
*/
|
|
44
|
+
setOnDisconnected(onDisconnected: () => void): void;
|
|
45
|
+
/**
|
|
46
|
+
* Best-effort synchronous cleanup for page navigation/unload. Prefer the
|
|
47
|
+
* ConnManager boundary so its connection generation and Web BLE lease are
|
|
48
|
+
* finalized as well. The fallback keeps this app compatible with an older
|
|
49
|
+
* RoboticalJS package while the new ConnManager API is being released.
|
|
50
|
+
*/
|
|
51
|
+
disconnectForPageUnload(): void;
|
|
40
52
|
/**
|
|
41
53
|
* Stop verifying RAFT
|
|
42
54
|
* @param confirmCorrectRIC - indicates if the correct RAFT was selected (user input)
|
|
@@ -38,7 +38,7 @@ import { RaftInfoEvents } from "../../types/events/raft-info";
|
|
|
38
38
|
import { WrapperSentMessage } from "../../types/communication-between-apps/wrapper-communication";
|
|
39
39
|
import Logger from "../../services/logger/Logger";
|
|
40
40
|
import { RaftTypeE } from "../../types/raft";
|
|
41
|
-
import { RaftConnEvent, RaftUpdateEvent, RICRESTElemCode, } from "@
|
|
41
|
+
import { RaftConnEvent, RaftUpdateEvent, RICRESTElemCode, } from "@robdobsn/raftjs";
|
|
42
42
|
var SHOW_LOGS = true;
|
|
43
43
|
var TAG = "Connector";
|
|
44
44
|
var formatRestCommand = function (msg, params) {
|
|
@@ -64,6 +64,7 @@ var Connector = /** @class */ (function () {
|
|
|
64
64
|
// Set the listener function
|
|
65
65
|
// Subscribe to connManager events
|
|
66
66
|
this.connManager.setConnectionEventListener(function (eventType, eventEnum, eventName, eventData) {
|
|
67
|
+
var _a;
|
|
67
68
|
if (eventType === "pub") {
|
|
68
69
|
// if it's a pub event, we are publishing it from _pubEventHandler method (in child classes)
|
|
69
70
|
}
|
|
@@ -72,6 +73,9 @@ var Connector = /** @class */ (function () {
|
|
|
72
73
|
_this.publish(eventType, eventEnum, eventName, eventData);
|
|
73
74
|
}
|
|
74
75
|
_this.eventHandler(eventType, eventEnum, eventName, eventData);
|
|
76
|
+
if (eventType === "conn" && eventEnum === RaftConnEvent.CONN_DISCONNECTED) {
|
|
77
|
+
(_a = _this._onDisconnected) === null || _a === void 0 ? void 0 : _a.call(_this);
|
|
78
|
+
}
|
|
75
79
|
});
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
@@ -158,6 +162,26 @@ var Connector = /** @class */ (function () {
|
|
|
158
162
|
});
|
|
159
163
|
});
|
|
160
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Register the manager-owned cleanup callback for a terminal disconnect event.
|
|
167
|
+
*/
|
|
168
|
+
Connector.prototype.setOnDisconnected = function (onDisconnected) {
|
|
169
|
+
this._onDisconnected = onDisconnected;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Best-effort synchronous cleanup for page navigation/unload. Prefer the
|
|
173
|
+
* ConnManager boundary so its connection generation and Web BLE lease are
|
|
174
|
+
* finalized as well. The fallback keeps this app compatible with an older
|
|
175
|
+
* RoboticalJS package while the new ConnManager API is being released.
|
|
176
|
+
*/
|
|
177
|
+
Connector.prototype.disconnectForPageUnload = function () {
|
|
178
|
+
var connManagerWithPageUnload = this.connManager;
|
|
179
|
+
if (typeof connManagerWithPageUnload.disconnectForPageUnload === "function") {
|
|
180
|
+
connManagerWithPageUnload.disconnectForPageUnload();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
this.connManager.getConnector().disconnectForPageUnload();
|
|
184
|
+
};
|
|
161
185
|
/**
|
|
162
186
|
* Stop verifying RAFT
|
|
163
187
|
* @param confirmCorrectRIC - indicates if the correct RAFT was selected (user input)
|
|
@@ -10,6 +10,6 @@ export default class ConnectorFactory {
|
|
|
10
10
|
* @returns Promise<ConnectionAttemptResults>
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
|
-
static connectToRaftHelper(method: RaftConnectionMethod, uuids: string[]): Promise<Connector | null>;
|
|
13
|
+
static connectToRaftHelper(method: RaftConnectionMethod, uuids: string[], onConnManagerCreated?: (connManager: ConnManager) => void): Promise<Connector | null>;
|
|
14
14
|
static createConnector(raftType: string | undefined, connManager: ConnManager): Connector;
|
|
15
15
|
}
|
|
@@ -52,16 +52,21 @@ var ConnectorFactory = /** @class */ (function () {
|
|
|
52
52
|
* @returns Promise<ConnectionAttemptResults>
|
|
53
53
|
*
|
|
54
54
|
*/
|
|
55
|
-
ConnectorFactory.connectToRaftHelper = function (method, uuids) {
|
|
55
|
+
ConnectorFactory.connectToRaftHelper = function (method, uuids, onConnManagerCreated) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var connManager, wasConnected, systemInfo, raftType, connector;
|
|
57
|
+
var connManager, connectorWasCreated, wasConnected, systemInfo, raftType, connector, error_1;
|
|
58
58
|
return __generator(this, function (_a) {
|
|
59
59
|
switch (_a.label) {
|
|
60
60
|
case 0:
|
|
61
61
|
connManager = new ConnManager();
|
|
62
|
+
connectorWasCreated = false;
|
|
63
|
+
_a.label = 1;
|
|
64
|
+
case 1:
|
|
65
|
+
_a.trys.push([1, , 3, 8]);
|
|
66
|
+
onConnManagerCreated === null || onConnManagerCreated === void 0 ? void 0 : onConnManagerCreated(connManager);
|
|
62
67
|
Logger.info(SHOW_LOGS, TAG, "Connecting to RAFT with method: ".concat(method));
|
|
63
68
|
return [4 /*yield*/, connManager.connect(method, "", uuids)];
|
|
64
|
-
case
|
|
69
|
+
case 2:
|
|
65
70
|
wasConnected = _a.sent();
|
|
66
71
|
Logger.info(SHOW_LOGS, TAG, "Was connected to RAFT: ".concat(wasConnected));
|
|
67
72
|
if (!wasConnected) {
|
|
@@ -70,7 +75,23 @@ var ConnectorFactory = /** @class */ (function () {
|
|
|
70
75
|
systemInfo = connManager.getConnector().getRaftSystemUtils().getCachedSystemInfo();
|
|
71
76
|
raftType = systemInfo === null || systemInfo === void 0 ? void 0 : systemInfo.SystemName;
|
|
72
77
|
connector = this.createConnector(raftType, connManager);
|
|
78
|
+
connectorWasCreated = true;
|
|
73
79
|
return [2 /*return*/, connector];
|
|
80
|
+
case 3:
|
|
81
|
+
if (!!connectorWasCreated) return [3 /*break*/, 7];
|
|
82
|
+
_a.label = 4;
|
|
83
|
+
case 4:
|
|
84
|
+
_a.trys.push([4, 6, , 7]);
|
|
85
|
+
return [4 /*yield*/, connManager.disconnect()];
|
|
86
|
+
case 5:
|
|
87
|
+
_a.sent();
|
|
88
|
+
return [3 /*break*/, 7];
|
|
89
|
+
case 6:
|
|
90
|
+
error_1 = _a.sent();
|
|
91
|
+
Logger.warn(SHOW_LOGS, TAG, "Failed to clean up uncommitted RAFT connection: ".concat(error_1));
|
|
92
|
+
return [3 /*break*/, 7];
|
|
93
|
+
case 7: return [7 /*endfinally*/];
|
|
94
|
+
case 8: return [2 /*return*/];
|
|
74
95
|
}
|
|
75
96
|
});
|
|
76
97
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@
|
|
1
|
+
import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robdobsn/raftjs";
|
|
2
2
|
import { ConnectionAttemptResults, RaftTypeE } from "../../types/raft";
|
|
3
3
|
import { RaftInfoEvents } from "../../types/events/raft-info";
|
|
4
4
|
import { RICLedLcdColours } from "@robotical/roboticaljs";
|
|
@@ -2,7 +2,7 @@ import { RaftInfoEvents } from "../../../types/events/raft-info";
|
|
|
2
2
|
import { ConnectionAttemptResults, RaftTypeE } from "../../../types/raft";
|
|
3
3
|
import Connector from "../Connector";
|
|
4
4
|
import ConnectorInterface from "../ConnectorInterface";
|
|
5
|
-
import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@
|
|
5
|
+
import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@robdobsn/raftjs";
|
|
6
6
|
import { ConnManager } from "@robotical/roboticaljs";
|
|
7
7
|
declare class MartyConnector extends Connector implements ConnectorInterface {
|
|
8
8
|
type: RaftTypeE;
|
|
@@ -54,7 +54,7 @@ import { RaftInfoEvents } from "../../../types/events/raft-info";
|
|
|
54
54
|
import Logger from "../../../services/logger/Logger";
|
|
55
55
|
import { RaftTypeE } from "../../../types/raft";
|
|
56
56
|
import Connector from "../Connector";
|
|
57
|
-
import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, } from "@
|
|
57
|
+
import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, } from "@robdobsn/raftjs";
|
|
58
58
|
import { RICServoParamUpdater, RICSystemUtils, } from "@robotical/roboticaljs";
|
|
59
59
|
import { WrapperSentMessage } from "../../../types/communication-between-apps/wrapper-communication";
|
|
60
60
|
var SHOW_LOGS = true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RaftConnector } from "@
|
|
1
|
+
import { RaftConnector } from "@robdobsn/raftjs";
|
|
2
2
|
import { ColourSensorCalibrationStage } from "../../types/colour-sensor-calibration";
|
|
3
3
|
export default class ColourSensorManualCalibratorMarty {
|
|
4
4
|
private static _raftConnector;
|
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robotical/webapp-types",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.52",
|
|
4
4
|
"description": "Type definitions for the Application Manager",
|
|
5
5
|
"main": "dist/application-manager.d.ts",
|
|
6
6
|
"types": "dist/application-manager.d.ts",
|
|
7
7
|
"author": "Nikos Theodoropoulos",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/robotical/marty-web-app.git",
|
|
12
|
+
"directory": "types-package"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@robdobsn/raftjs": "^2.1.6",
|
|
16
|
+
"@robotical/roboticaljs": "^1.1.27"
|
|
17
|
+
},
|
|
9
18
|
"publishConfig": {
|
|
10
19
|
"registry": "https://registry.npmjs.org/",
|
|
11
20
|
"access": "public"
|