@robotical/webapp-types 3.7.38 → 3.7.39
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/RAFTs/raft-subscription-helpers.d.ts +16 -0
- package/dist-types/src/application/RAFTs/raft-subscription-helpers.js +88 -0
- package/dist-types/src/wrapper-app/connectors/Connector.js +3 -1
- package/dist-types/src/wrapper-app/utils/ColourSensorManualCalibratorMarty.js +15 -6
- package/package.json +1 -1
|
@@ -7,6 +7,22 @@ export declare const createRaftConnectingHelper: (raft: RAFT) => {
|
|
|
7
7
|
subscribe: (callback: any) => void;
|
|
8
8
|
unsubscribe: () => void;
|
|
9
9
|
};
|
|
10
|
+
export declare const raftConnectionIssueDetectedSubscriptionHelper: (raft: RAFT) => {
|
|
11
|
+
subscribe: (callback: any) => void;
|
|
12
|
+
unsubscribe: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const createRaftConnectionIssueDetectedHelper: (raft: RAFT) => {
|
|
15
|
+
subscribe: (callback: any) => void;
|
|
16
|
+
unsubscribe: () => void;
|
|
17
|
+
};
|
|
18
|
+
export declare const raftConnectionIssueResolvedSubscriptionHelper: (raft: RAFT) => {
|
|
19
|
+
subscribe: (callback: any) => void;
|
|
20
|
+
unsubscribe: () => void;
|
|
21
|
+
};
|
|
22
|
+
export declare const createRaftConnectionIssueResolvedHelper: (raft: RAFT) => {
|
|
23
|
+
subscribe: (callback: any) => void;
|
|
24
|
+
unsubscribe: () => void;
|
|
25
|
+
};
|
|
10
26
|
export declare const raftConnectedSubscriptionHelper: (raft: RAFT) => {
|
|
11
27
|
subscribe: (callback: any) => void;
|
|
12
28
|
unsubscribe: () => void;
|
|
@@ -49,6 +49,94 @@ var raftConnectingSubscriptionObserver_ = function (callback) {
|
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* RAFT Connection issue detected Subscription Helper
|
|
54
|
+
*/
|
|
55
|
+
var raftConnectionIssueDetectedHelperInstance = null;
|
|
56
|
+
export var raftConnectionIssueDetectedSubscriptionHelper = function (raft) {
|
|
57
|
+
if (!raftConnectionIssueDetectedHelperInstance) {
|
|
58
|
+
raftConnectionIssueDetectedHelperInstance = createRaftConnectionIssueDetectedHelper(raft);
|
|
59
|
+
}
|
|
60
|
+
return raftConnectionIssueDetectedHelperInstance;
|
|
61
|
+
};
|
|
62
|
+
export var createRaftConnectionIssueDetectedHelper = function (raft) {
|
|
63
|
+
var observer = null;
|
|
64
|
+
return {
|
|
65
|
+
subscribe: function (callback) {
|
|
66
|
+
observer = raftConnectionIssueDetectedSubscriptionObserver_(callback);
|
|
67
|
+
raft.subscribe(observer, ["conn"]);
|
|
68
|
+
},
|
|
69
|
+
unsubscribe: function () {
|
|
70
|
+
if (observer) {
|
|
71
|
+
raft.unsubscribe(observer);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
var raftConnectionIssueDetectedSubscriptionObserver_ = function (callback) {
|
|
77
|
+
return {
|
|
78
|
+
notify: function (eventType, eventEnum, eventName, eventData) {
|
|
79
|
+
switch (eventType) {
|
|
80
|
+
case "conn":
|
|
81
|
+
switch (eventEnum) {
|
|
82
|
+
case RaftConnEvent.CONN_ISSUE_DETECTED:
|
|
83
|
+
console.log("Marty Connection Issue Detected!!!!!!!!!");
|
|
84
|
+
callback(eventData);
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
default:
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* RAFT Connection Issue Resolved Subscription Helper
|
|
98
|
+
*/
|
|
99
|
+
var raftConnectionIssueResolvedHelperInstance = null;
|
|
100
|
+
export var raftConnectionIssueResolvedSubscriptionHelper = function (raft) {
|
|
101
|
+
if (!raftConnectionIssueResolvedHelperInstance) {
|
|
102
|
+
raftConnectionIssueResolvedHelperInstance = createRaftConnectionIssueResolvedHelper(raft);
|
|
103
|
+
}
|
|
104
|
+
return raftConnectionIssueResolvedHelperInstance;
|
|
105
|
+
};
|
|
106
|
+
export var createRaftConnectionIssueResolvedHelper = function (raft) {
|
|
107
|
+
var observer = null;
|
|
108
|
+
return {
|
|
109
|
+
subscribe: function (callback) {
|
|
110
|
+
observer = raftConnectionIssueResolvedSubscriptionObserver_(callback);
|
|
111
|
+
raft.subscribe(observer, ["conn"]);
|
|
112
|
+
},
|
|
113
|
+
unsubscribe: function () {
|
|
114
|
+
if (observer) {
|
|
115
|
+
raft.unsubscribe(observer);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
var raftConnectionIssueResolvedSubscriptionObserver_ = function (callback) {
|
|
121
|
+
return {
|
|
122
|
+
notify: function (eventType, eventEnum, eventName, eventData) {
|
|
123
|
+
switch (eventType) {
|
|
124
|
+
case "conn":
|
|
125
|
+
switch (eventEnum) {
|
|
126
|
+
case RaftConnEvent.CONN_ISSUE_RESOLVED:
|
|
127
|
+
console.log("Marty Connection Issue Resolved!!!!!!!!!");
|
|
128
|
+
callback(eventData);
|
|
129
|
+
break;
|
|
130
|
+
default:
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
default:
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
};
|
|
52
140
|
/**
|
|
53
141
|
* RAFT Connected Subscription Helper
|
|
54
142
|
*/
|
|
@@ -269,7 +269,9 @@ var Connector = /** @class */ (function () {
|
|
|
269
269
|
return [3 /*break*/, 8];
|
|
270
270
|
case 6:
|
|
271
271
|
raftMsgHandler = this.connManager.getConnector().getRaftMsgHandler();
|
|
272
|
-
raftMsgHandler.reportMsgCallbacksSet("notifyCB", function (report) { return _this
|
|
272
|
+
raftMsgHandler.reportMsgCallbacksSet("notifyCB", function (report) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
273
|
+
return [2 /*return*/, this.publish("msg", RaftInfoEvents.RAFT_MSG, "RICMsg", report)];
|
|
274
|
+
}); }); });
|
|
273
275
|
return [3 /*break*/, 8];
|
|
274
276
|
case 7: return [3 /*break*/, 8];
|
|
275
277
|
case 8: return [2 /*return*/];
|
|
@@ -290,16 +290,20 @@ var ColourSensorManualCalibratorMarty = /** @class */ (function () {
|
|
|
290
290
|
return __awaiter(this, void 0, void 0, function () {
|
|
291
291
|
var REPORT_MSG_KEY, reports, _i, names_2, hwElemName, command, _a, reports_1, report, dataRead, clear, red, green, blue;
|
|
292
292
|
var _b;
|
|
293
|
+
var _this = this;
|
|
293
294
|
return __generator(this, function (_c) {
|
|
294
295
|
switch (_c.label) {
|
|
295
296
|
case 0:
|
|
296
297
|
Logger.info(SHOW_LOGS, TAG, "\n==== getCalibration ====");
|
|
297
298
|
REPORT_MSG_KEY = "GET_CALIBRATION";
|
|
298
299
|
reports = [];
|
|
299
|
-
this._raftConnector.getRaftMsgHandler().reportMsgCallbacksSet(REPORT_MSG_KEY, function (report) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
this._raftConnector.getRaftMsgHandler().reportMsgCallbacksSet(REPORT_MSG_KEY, function (report) { return __awaiter(_this, void 0, void 0, function () {
|
|
301
|
+
return __generator(this, function (_a) {
|
|
302
|
+
reports.push(report);
|
|
303
|
+
Logger.debug(SHOW_LOGS, TAG, "Report callback ".concat(JSON.stringify(report)));
|
|
304
|
+
return [2 /*return*/];
|
|
305
|
+
});
|
|
306
|
+
}); });
|
|
303
307
|
_i = 0, names_2 = names;
|
|
304
308
|
_c.label = 1;
|
|
305
309
|
case 1:
|
|
@@ -354,8 +358,13 @@ var ColourSensorManualCalibratorMarty = /** @class */ (function () {
|
|
|
354
358
|
reports = [];
|
|
355
359
|
this._raftConnector.getRaftMsgHandler()
|
|
356
360
|
.reportMsgCallbacksSet(REPORT_MSG_KEY, function (report) {
|
|
357
|
-
|
|
358
|
-
|
|
361
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
362
|
+
return __generator(this, function (_a) {
|
|
363
|
+
reports.push(report);
|
|
364
|
+
Logger.debug(SHOW_LOGS, TAG, "getHWElemCB Report callback ".concat(JSON.stringify(report)));
|
|
365
|
+
return [2 /*return*/];
|
|
366
|
+
});
|
|
367
|
+
});
|
|
359
368
|
});
|
|
360
369
|
_i = 0, names_3 = names;
|
|
361
370
|
_c.label = 1;
|