@robotical/webapp-types 3.7.33 → 3.7.35
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.js +33 -29
- package/dist-types/src/application/RAFTs/Cog/PublishedDataAnalyser.js +2 -2
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.d.ts +36 -26
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +63 -0
- package/dist-types/src/components/modals/LEDLightsOrQRVerificationModal/index.js +4 -0
- package/package.json +1 -1
|
@@ -397,55 +397,51 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
397
397
|
uuids = [ConnManager.COGUUID, ConnManager.RICUUID];
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
if (!isPhoneApp()) return [3 /*break*/,
|
|
400
|
+
if (!isPhoneApp()) return [3 /*break*/, 9];
|
|
401
401
|
_a.label = 2;
|
|
402
402
|
case 2:
|
|
403
|
-
_a.trys.push([2,
|
|
404
|
-
if (!isQRVerification) return [3 /*break*/,
|
|
403
|
+
_a.trys.push([2, 7, , 8]);
|
|
404
|
+
if (!isQRVerification) return [3 /*break*/, 4];
|
|
405
405
|
secondaryModalState.setModal(createElement(ConnectingLoadingSpinnerModal, {}), "Connecting...", false);
|
|
406
406
|
this.ricSelectedCb = null;
|
|
407
407
|
return [4 /*yield*/, window.applicationManager.startDiscoveryWithoutVerification(uuids, afterRaftConnectedCb)];
|
|
408
408
|
case 3:
|
|
409
409
|
_a.sent();
|
|
410
|
-
return [
|
|
411
|
-
case 4:
|
|
412
|
-
_a.sent(); // make sure the device has shown up in the connection area
|
|
413
|
-
secondaryModalState.closeModal();
|
|
414
|
-
return [3 /*break*/, 7];
|
|
415
|
-
case 5: return [4 /*yield*/, window.applicationManager.startDiscovery(function (newRaft) {
|
|
410
|
+
return [3 /*break*/, 6];
|
|
411
|
+
case 4: return [4 /*yield*/, window.applicationManager.startDiscovery(function (newRaft) {
|
|
416
412
|
_this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
|
|
417
413
|
afterRaftConnectedCb(newRaft);
|
|
418
414
|
}, uuids)];
|
|
419
|
-
case
|
|
415
|
+
case 5:
|
|
420
416
|
_a.sent();
|
|
421
|
-
_a.label =
|
|
422
|
-
case
|
|
423
|
-
case
|
|
417
|
+
_a.label = 6;
|
|
418
|
+
case 6: return [3 /*break*/, 8];
|
|
419
|
+
case 7:
|
|
424
420
|
e_1 = _a.sent();
|
|
425
421
|
Logger.error(SHOW_LOGS, TAG, "Failed to start discovery: ".concat(e_1));
|
|
426
|
-
return [3 /*break*/,
|
|
427
|
-
case
|
|
428
|
-
case
|
|
422
|
+
return [3 /*break*/, 8];
|
|
423
|
+
case 8: return [3 /*break*/, 14];
|
|
424
|
+
case 9:
|
|
429
425
|
secondaryModalState.setModal(createElement(ConnectingLoadingSpinnerModal, {}), "Connecting...", false);
|
|
430
|
-
_a.label =
|
|
431
|
-
case
|
|
432
|
-
_a.trys.push([
|
|
426
|
+
_a.label = 10;
|
|
427
|
+
case 10:
|
|
428
|
+
_a.trys.push([10, 12, , 13]);
|
|
433
429
|
return [4 /*yield*/, window.applicationManager.connectToRIC(RaftConnectionMethod.WEB_BLE, uuids, isQRVerification)];
|
|
434
|
-
case
|
|
430
|
+
case 11:
|
|
435
431
|
newRaft = _a.sent();
|
|
436
432
|
if (newRaft) {
|
|
437
433
|
this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
|
|
438
434
|
afterRaftConnectedCb(newRaft);
|
|
439
435
|
}
|
|
440
|
-
return [3 /*break*/,
|
|
441
|
-
case
|
|
436
|
+
return [3 /*break*/, 13];
|
|
437
|
+
case 12:
|
|
442
438
|
e_2 = _a.sent();
|
|
443
439
|
Logger.error(SHOW_LOGS, TAG, "Failed to connect to new robot: ".concat(e_2));
|
|
444
|
-
return [3 /*break*/,
|
|
445
|
-
case
|
|
440
|
+
return [3 /*break*/, 13];
|
|
441
|
+
case 13:
|
|
446
442
|
secondaryModalState.closeModal();
|
|
447
|
-
_a.label =
|
|
448
|
-
case
|
|
443
|
+
_a.label = 14;
|
|
444
|
+
case 14: return [2 /*return*/];
|
|
449
445
|
}
|
|
450
446
|
});
|
|
451
447
|
});
|
|
@@ -660,12 +656,21 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
660
656
|
*/
|
|
661
657
|
ApplicationManager.prototype.startDiscoveryWithoutVerification = function (uuids, afterRaftConnectedCb) {
|
|
662
658
|
return __awaiter(this, void 0, void 0, function () {
|
|
663
|
-
var foundRICs, wasDiscoveryStarted;
|
|
659
|
+
var foundRICs, notFoundTimeout, wasDiscoveryStarted;
|
|
664
660
|
var _this = this;
|
|
665
661
|
return __generator(this, function (_a) {
|
|
666
662
|
switch (_a.label) {
|
|
667
663
|
case 0:
|
|
668
664
|
foundRICs = [];
|
|
665
|
+
notFoundTimeout = setTimeout(function () {
|
|
666
|
+
if (foundRICs.length === 0) {
|
|
667
|
+
_this.toaster.error("Make sure the robot is powered on and in range!");
|
|
668
|
+
}
|
|
669
|
+
window.applicationManager.stopDiscovery();
|
|
670
|
+
secondaryModalState.closeModal();
|
|
671
|
+
raftFoundSubscriptionHelper().unsubscribe();
|
|
672
|
+
clearTimeout(notFoundTimeout);
|
|
673
|
+
}, 7000);
|
|
669
674
|
raftFoundSubscriptionHelper().subscribe(function (_a) {
|
|
670
675
|
var discoveredDevice = _a.discoveredDevice;
|
|
671
676
|
return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -683,6 +688,7 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
683
688
|
case 1:
|
|
684
689
|
newRaft = _b.sent();
|
|
685
690
|
if (!newRaft) return [3 /*break*/, 3];
|
|
691
|
+
secondaryModalState.closeModal();
|
|
686
692
|
this.connectedRaftContextMethods.addConnectedRaft({ id: newRaft.id, type: newRaft.type, name: newRaft.getFriendlyName() || "", isSelected: true });
|
|
687
693
|
afterRaftConnectedCb(newRaft);
|
|
688
694
|
oldColours = newRaft._ledLcdColours;
|
|
@@ -708,7 +714,6 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
708
714
|
if (!wasDiscoveryStarted) {
|
|
709
715
|
return [2 /*return*/, raftFoundSubscriptionHelper().unsubscribe()];
|
|
710
716
|
}
|
|
711
|
-
raftFoundSubscriptionHelper().unsubscribe();
|
|
712
717
|
return [2 /*return*/];
|
|
713
718
|
}
|
|
714
719
|
});
|
|
@@ -726,7 +731,6 @@ var ApplicationManager = /** @class */ (function () {
|
|
|
726
731
|
case 0: return [4 /*yield*/, window.wrapperCommunicator.sendMessageAndWait(AppSentMessage.RAFT_STOP_DISCOVERY)];
|
|
727
732
|
case 1:
|
|
728
733
|
wasDiscoveryStopped = _a.sent();
|
|
729
|
-
Logger.phoneAppLog(SHOW_LOGS, TAG, "Was discovery stopped: " + wasDiscoveryStopped);
|
|
730
734
|
return [2 /*return*/];
|
|
731
735
|
}
|
|
732
736
|
});
|
|
@@ -49,7 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
import {
|
|
52
|
+
import { createRaftPubSubscriptionHelper } from "../raft-subscription-helpers";
|
|
53
53
|
import { isVersionGreater_errorCatching } from "../../../utils/helpers/compare-version";
|
|
54
54
|
import EventEmitter from "events";
|
|
55
55
|
import Logger from "../../../services/logger/Logger";
|
|
@@ -117,7 +117,7 @@ var PublishedDataAnalyser = /** @class */ (function (_super) {
|
|
|
117
117
|
}
|
|
118
118
|
PublishedDataAnalyser.prototype.subscribeToPublishedData = function () {
|
|
119
119
|
var _this = this;
|
|
120
|
-
this.pubSub =
|
|
120
|
+
this.pubSub = createRaftPubSubscriptionHelper(this.cog);
|
|
121
121
|
this.pubSub.subscribe(function (data) {
|
|
122
122
|
_this.analyse(data.stateInfo);
|
|
123
123
|
});
|
|
@@ -1,63 +1,73 @@
|
|
|
1
1
|
import RAFT from "./RAFT";
|
|
2
|
-
/**
|
|
3
|
-
* Connection Verifying Subscription Helper
|
|
4
|
-
*/
|
|
5
2
|
export declare const raftConnectingSubscriptionHelper: (raft: RAFT) => {
|
|
6
3
|
subscribe: (callback: any) => void;
|
|
7
4
|
unsubscribe: () => void;
|
|
8
5
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export declare const createRaftConnectingHelper: (raft: RAFT) => {
|
|
7
|
+
subscribe: (callback: any) => void;
|
|
8
|
+
unsubscribe: () => void;
|
|
9
|
+
};
|
|
12
10
|
export declare const raftConnectedSubscriptionHelper: (raft: RAFT) => {
|
|
13
11
|
subscribe: (callback: any) => void;
|
|
14
12
|
unsubscribe: () => void;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export declare const createRaftConnectedHelper: (raft: RAFT) => {
|
|
15
|
+
subscribe: (callback: any) => void;
|
|
16
|
+
unsubscribe: () => void;
|
|
17
|
+
};
|
|
19
18
|
export declare const raftDisconnectedSubscriptionHelper: (raft: RAFT) => {
|
|
20
19
|
subscribe: (callback: any) => void;
|
|
21
20
|
unsubscribe: () => void;
|
|
22
21
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
export declare const createRaftDisconnectedHelper: (raft: RAFT) => {
|
|
23
|
+
subscribe: (callback: any) => void;
|
|
24
|
+
unsubscribe: () => void;
|
|
25
|
+
};
|
|
26
26
|
export declare const raftVerifiedSubscriptionHelper: (raft: RAFT) => {
|
|
27
27
|
subscribe: (callback: any) => void;
|
|
28
28
|
unsubscribe: () => void;
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
export declare const createRaftVerifiedHelper: (raft: RAFT) => {
|
|
31
|
+
subscribe: (callback: any) => void;
|
|
32
|
+
unsubscribe: () => void;
|
|
33
|
+
};
|
|
34
34
|
export declare const raftFoundSubscriptionHelper: () => {
|
|
35
35
|
subscribe: (callback: any) => void;
|
|
36
36
|
unsubscribe: () => void;
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
export declare const createRaftFoundHelper: () => {
|
|
39
|
+
subscribe: (callback: any) => void;
|
|
40
|
+
unsubscribe: () => void;
|
|
41
|
+
};
|
|
41
42
|
export declare const raftDiscoveryFinishedSubscriptionHelper: () => {
|
|
42
43
|
subscribe: (callback: any) => void;
|
|
43
44
|
unsubscribe: () => void;
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
export declare const createRaftDiscoveryFinishedHelper: () => {
|
|
47
|
+
subscribe: (callback: any) => void;
|
|
48
|
+
unsubscribe: () => void;
|
|
49
|
+
};
|
|
48
50
|
export declare const raftDiscoveryStartedSubscriptionHelper: () => {
|
|
49
51
|
subscribe: (callback: any) => void;
|
|
50
52
|
unsubscribe: () => void;
|
|
51
53
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
export declare const createRaftDiscoveryStartedHelper: () => {
|
|
55
|
+
subscribe: (callback: any) => void;
|
|
56
|
+
unsubscribe: () => void;
|
|
57
|
+
};
|
|
56
58
|
export declare const raftRejectedSubscriptionHelper: (raft: RAFT) => {
|
|
57
59
|
subscribe: (callback: any) => void;
|
|
58
60
|
unsubscribe: () => void;
|
|
59
61
|
};
|
|
62
|
+
export declare const createRaftRejectedHelper: (raft: RAFT) => {
|
|
63
|
+
subscribe: (callback: any) => void;
|
|
64
|
+
unsubscribe: () => void;
|
|
65
|
+
};
|
|
60
66
|
export declare const raftPubSubscriptionHelper: (raft: RAFT) => {
|
|
61
67
|
subscribe: (callback: (eventData: any) => void) => void;
|
|
62
68
|
unsubscribe: () => void;
|
|
63
69
|
};
|
|
70
|
+
export declare const createRaftPubSubscriptionHelper: (raft: RAFT) => {
|
|
71
|
+
subscribe: (callback: (eventData: any) => void) => void;
|
|
72
|
+
unsubscribe: () => void;
|
|
73
|
+
};
|
|
@@ -2,7 +2,14 @@ import { RaftConnEvent } from "@robotical/raftjs";
|
|
|
2
2
|
/**
|
|
3
3
|
* Connection Verifying Subscription Helper
|
|
4
4
|
*/
|
|
5
|
+
var raftConnectingHelperInstance = null;
|
|
5
6
|
export var raftConnectingSubscriptionHelper = function (raft) {
|
|
7
|
+
if (!raftConnectingHelperInstance) {
|
|
8
|
+
raftConnectingHelperInstance = createRaftConnectingHelper(raft);
|
|
9
|
+
}
|
|
10
|
+
return raftConnectingHelperInstance;
|
|
11
|
+
};
|
|
12
|
+
export var createRaftConnectingHelper = function (raft) {
|
|
6
13
|
var observer = null;
|
|
7
14
|
return {
|
|
8
15
|
subscribe: function (callback) {
|
|
@@ -45,7 +52,14 @@ var raftConnectingSubscriptionObserver_ = function (callback) {
|
|
|
45
52
|
/**
|
|
46
53
|
* RAFT Connected Subscription Helper
|
|
47
54
|
*/
|
|
55
|
+
var raftConnectedHelperInstance = null;
|
|
48
56
|
export var raftConnectedSubscriptionHelper = function (raft) {
|
|
57
|
+
if (!raftConnectedHelperInstance) {
|
|
58
|
+
raftConnectedHelperInstance = createRaftConnectedHelper(raft);
|
|
59
|
+
}
|
|
60
|
+
return raftConnectedHelperInstance;
|
|
61
|
+
};
|
|
62
|
+
export var createRaftConnectedHelper = function (raft) {
|
|
49
63
|
var observer = null;
|
|
50
64
|
return {
|
|
51
65
|
subscribe: function (callback) {
|
|
@@ -90,7 +104,14 @@ var raftConnectedSubscriptionObserver_ = function (callback) {
|
|
|
90
104
|
/**
|
|
91
105
|
* RAFT Disconnected Subscription Helper
|
|
92
106
|
*/
|
|
107
|
+
var raftDisconnectedHelperInstance = null;
|
|
93
108
|
export var raftDisconnectedSubscriptionHelper = function (raft) {
|
|
109
|
+
if (!raftDisconnectedHelperInstance) {
|
|
110
|
+
raftDisconnectedHelperInstance = createRaftDisconnectedHelper(raft);
|
|
111
|
+
}
|
|
112
|
+
return raftDisconnectedHelperInstance;
|
|
113
|
+
};
|
|
114
|
+
export var createRaftDisconnectedHelper = function (raft) {
|
|
94
115
|
var observer = null;
|
|
95
116
|
return {
|
|
96
117
|
subscribe: function (callback) {
|
|
@@ -135,7 +156,14 @@ var raftDisconnectedSubscriptionObserver_ = function (callback) {
|
|
|
135
156
|
/**
|
|
136
157
|
* RAFT Verified Subscription Helper
|
|
137
158
|
*/
|
|
159
|
+
var raftVerifiedHelperInstance = null;
|
|
138
160
|
export var raftVerifiedSubscriptionHelper = function (raft) {
|
|
161
|
+
if (!raftVerifiedHelperInstance) {
|
|
162
|
+
raftVerifiedHelperInstance = createRaftVerifiedHelper(raft);
|
|
163
|
+
}
|
|
164
|
+
return raftVerifiedHelperInstance;
|
|
165
|
+
};
|
|
166
|
+
export var createRaftVerifiedHelper = function (raft) {
|
|
139
167
|
var observer = null;
|
|
140
168
|
return {
|
|
141
169
|
subscribe: function (callback) {
|
|
@@ -179,7 +207,14 @@ var raftVerifiedSubscriptionObserver_ = function (callback) {
|
|
|
179
207
|
* Subscription Helper for raftFound event
|
|
180
208
|
* ApplicationManager
|
|
181
209
|
*/
|
|
210
|
+
var raftFoundHelperInstance = null;
|
|
182
211
|
export var raftFoundSubscriptionHelper = function () {
|
|
212
|
+
if (!raftFoundHelperInstance) {
|
|
213
|
+
raftFoundHelperInstance = createRaftFoundHelper();
|
|
214
|
+
}
|
|
215
|
+
return raftFoundHelperInstance;
|
|
216
|
+
};
|
|
217
|
+
export var createRaftFoundHelper = function () {
|
|
183
218
|
var observer = null;
|
|
184
219
|
return {
|
|
185
220
|
subscribe: function (callback) {
|
|
@@ -213,7 +248,14 @@ var raftFoundSubscriptionObserver_ = function (callback) {
|
|
|
213
248
|
/**
|
|
214
249
|
* Subscription Helper for raftDiscoveryFinished event
|
|
215
250
|
*/
|
|
251
|
+
var raftDiscoveryFinishedHelperInstance = null;
|
|
216
252
|
export var raftDiscoveryFinishedSubscriptionHelper = function () {
|
|
253
|
+
if (!raftDiscoveryFinishedHelperInstance) {
|
|
254
|
+
raftDiscoveryFinishedHelperInstance = createRaftDiscoveryFinishedHelper();
|
|
255
|
+
}
|
|
256
|
+
return raftDiscoveryFinishedHelperInstance;
|
|
257
|
+
};
|
|
258
|
+
export var createRaftDiscoveryFinishedHelper = function () {
|
|
217
259
|
var observer = null;
|
|
218
260
|
return {
|
|
219
261
|
subscribe: function (callback) {
|
|
@@ -247,7 +289,14 @@ var raftDiscoveryFinishedSubscriptionObserver_ = function (callback) {
|
|
|
247
289
|
/**
|
|
248
290
|
* Subscription Helper for raftDiscoveryStarted event
|
|
249
291
|
*/
|
|
292
|
+
var raftDiscoveryStartedHelperInstance = null;
|
|
250
293
|
export var raftDiscoveryStartedSubscriptionHelper = function () {
|
|
294
|
+
if (!raftDiscoveryStartedHelperInstance) {
|
|
295
|
+
raftDiscoveryStartedHelperInstance = createRaftDiscoveryStartedHelper();
|
|
296
|
+
}
|
|
297
|
+
return raftDiscoveryStartedHelperInstance;
|
|
298
|
+
};
|
|
299
|
+
export var createRaftDiscoveryStartedHelper = function () {
|
|
251
300
|
var observer = null;
|
|
252
301
|
return {
|
|
253
302
|
subscribe: function (callback) {
|
|
@@ -282,7 +331,14 @@ var raftDiscoveryStartedSubscriptionObserver_ = function (callback) {
|
|
|
282
331
|
* Subscription Helper for raftRejected event
|
|
283
332
|
* This event is triggered when the RAFT is rejected during the verification process
|
|
284
333
|
*/
|
|
334
|
+
var raftRejectedHelperInstance = null;
|
|
285
335
|
export var raftRejectedSubscriptionHelper = function (raft) {
|
|
336
|
+
if (!raftRejectedHelperInstance) {
|
|
337
|
+
raftRejectedHelperInstance = createRaftRejectedHelper(raft);
|
|
338
|
+
}
|
|
339
|
+
return raftRejectedHelperInstance;
|
|
340
|
+
};
|
|
341
|
+
export var createRaftRejectedHelper = function (raft) {
|
|
286
342
|
var observer = null;
|
|
287
343
|
return {
|
|
288
344
|
subscribe: function (callback) {
|
|
@@ -322,7 +378,14 @@ var raftRejectedSubscriptionObserver_ = function (callback) {
|
|
|
322
378
|
},
|
|
323
379
|
};
|
|
324
380
|
};
|
|
381
|
+
var raftPubSubscriptionHelperInstance = null;
|
|
325
382
|
export var raftPubSubscriptionHelper = function (raft) {
|
|
383
|
+
if (!raftPubSubscriptionHelperInstance) {
|
|
384
|
+
raftPubSubscriptionHelperInstance = createRaftPubSubscriptionHelper(raft);
|
|
385
|
+
}
|
|
386
|
+
return raftPubSubscriptionHelperInstance;
|
|
387
|
+
};
|
|
388
|
+
export var createRaftPubSubscriptionHelper = function (raft) {
|
|
326
389
|
var observer = null;
|
|
327
390
|
return {
|
|
328
391
|
subscribe: function (callback) {
|
|
@@ -101,6 +101,10 @@ export default function LEDLightsOrQRVerificationModal() {
|
|
|
101
101
|
if (serialNoFromQR) {
|
|
102
102
|
modalState.closeModalWithoutAnimation([ConnManager.generateServiceFilterUUID(serialNoFromQR)]);
|
|
103
103
|
}
|
|
104
|
+
else {
|
|
105
|
+
// // testing
|
|
106
|
+
// modalState.closeModalWithoutAnimation([ConnManager.generateServiceFilterUUID('00000000000000000000000000000079')]);
|
|
107
|
+
}
|
|
104
108
|
return [2 /*return*/];
|
|
105
109
|
});
|
|
106
110
|
}); };
|