@robotical/webapp-types 3.7.8 → 3.7.10
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 +24 -1
- package/dist-types/src/application/ApplicationManager/ApplicationManager.js +222 -0
- package/dist-types/src/application/RAFTs/Marty/CalibrationManager.d.ts +11 -0
- package/dist-types/src/application/RAFTs/Marty/CalibrationManager.js +153 -0
- package/dist-types/src/application/RAFTs/Marty/Marty.d.ts +6 -0
- package/dist-types/src/application/RAFTs/Marty/Marty.js +9 -0
- package/dist-types/src/application/RAFTs/Marty/MartyAddonsManager.d.ts +13 -0
- package/dist-types/src/application/RAFTs/Marty/MartyAddonsManager.js +253 -0
- package/dist-types/src/application/RAFTs/Marty/MartyWifiManager.d.ts +19 -0
- package/dist-types/src/application/RAFTs/Marty/MartyWifiManager.js +277 -0
- package/dist-types/src/application/RAFTs/RAFT.d.ts +1 -0
- package/dist-types/src/application/RAFTs/RAFT.js +46 -2
- package/dist-types/src/components/modals/LEDLightsOrQRVerificationModal/index.js +1 -1
- package/dist-types/src/store/SelectedRaftContext.d.ts +2 -0
- package/dist-types/src/store/SelectedRaftContext.js +10 -1
- package/dist-types/src/types/communication-between-apps/wrapper-communication.d.ts +3 -1
- package/dist-types/src/types/communication-between-apps/wrapper-communication.js +2 -0
- package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.d.ts +2 -1
- package/dist-types/src/utils/helpers/wifi-configuration-subtitle-gen.js +25 -28
- package/dist-types/src/wrapper-app/WrapperAppManager.d.ts +16 -0
- package/dist-types/src/wrapper-app/WrapperAppManager.js +47 -0
- package/dist-types/src/wrapper-app/communicators/WebAppCommunicator.js +36 -13
- package/dist-types/src/wrapper-app/utils/ColourSensorManualCalibratorMarty.d.ts +19 -0
- package/dist-types/src/wrapper-app/utils/ColourSensorManualCalibratorMarty.js +461 -0
- package/package.json +1 -1
|
@@ -26,15 +26,18 @@ export var NewRobotIdE;
|
|
|
26
26
|
NewRobotIdE["NEW"] = "=+__new__+=";
|
|
27
27
|
})(NewRobotIdE || (NewRobotIdE = {}));
|
|
28
28
|
var ConnectedRaftContext = createContext({
|
|
29
|
+
nameUpdatedState: 0,
|
|
29
30
|
connectedRafts: [],
|
|
30
31
|
addConnectedRaft: function (connectedRaft) { },
|
|
31
32
|
removeConnectedRaft: function (connectedRaftId) { },
|
|
32
33
|
setSelectedRaft: function (connectedRaftId) { },
|
|
34
|
+
nameUpdated: function () { },
|
|
33
35
|
});
|
|
34
36
|
// Provider component
|
|
35
37
|
export var ConnectedRaftContentProvider = function (_a) {
|
|
36
38
|
var children = _a.children;
|
|
37
39
|
var _b = useState([{ id: NewRobotIdE.NEW, isSelected: true, name: "Connect to new robot", type: RaftTypeE.undefined }]), connectedRafts = _b[0], setConnectedRafts = _b[1];
|
|
40
|
+
var _c = useState(0), nameUpdatedState = _c[0], setNameUpdatedState = _c[1];
|
|
38
41
|
useEffect(function () {
|
|
39
42
|
if (window.applicationManager) {
|
|
40
43
|
window.applicationManager.connectedRaftContextMethods = {
|
|
@@ -47,12 +50,18 @@ export var ConnectedRaftContentProvider = function (_a) {
|
|
|
47
50
|
setSelectedRaft: function (connectedRaftId) {
|
|
48
51
|
setSelectedRaft(connectedRaftId);
|
|
49
52
|
},
|
|
53
|
+
nameUpdated: function () {
|
|
54
|
+
nameUpdated();
|
|
55
|
+
},
|
|
50
56
|
};
|
|
51
57
|
}
|
|
52
58
|
}, []);
|
|
53
59
|
useEffect(function () {
|
|
54
60
|
window.applicationManager.connectedRaftsContext = connectedRafts;
|
|
55
61
|
}, [connectedRafts]);
|
|
62
|
+
var nameUpdated = function () {
|
|
63
|
+
setNameUpdatedState(function (prev) { return prev + 1; });
|
|
64
|
+
};
|
|
56
65
|
var addConnectedRaft = function (connectedRaft) {
|
|
57
66
|
// if the new raft is already in the list, do not add it again, just select it
|
|
58
67
|
var existingRaft = connectedRafts.find(function (connectedRaft_) { return connectedRaft_.id === connectedRaft.id; });
|
|
@@ -79,6 +88,6 @@ export var ConnectedRaftContentProvider = function (_a) {
|
|
|
79
88
|
setConnectedRafts(function (prev) { return prev.map(function (connectedRaft) { return (__assign(__assign({}, connectedRaft), { isSelected: false })); }); });
|
|
80
89
|
setConnectedRafts(function (prev) { return prev.map(function (connectedRaft) { return (__assign(__assign({}, connectedRaft), { isSelected: connectedRaft.id === connectedRaftId })); }); });
|
|
81
90
|
};
|
|
82
|
-
return (_jsx(ConnectedRaftContext.Provider, __assign({ value: { connectedRafts: connectedRafts, addConnectedRaft: addConnectedRaft, removeConnectedRaft: removeConnectedRaft, setSelectedRaft: setSelectedRaft } }, { children: children })));
|
|
91
|
+
return (_jsx(ConnectedRaftContext.Provider, __assign({ value: { connectedRafts: connectedRafts, addConnectedRaft: addConnectedRaft, removeConnectedRaft: removeConnectedRaft, setSelectedRaft: setSelectedRaft, nameUpdated: nameUpdated, nameUpdatedState: nameUpdatedState } }, { children: children })));
|
|
83
92
|
};
|
|
84
93
|
export var useConnectedRafts = function () { return useContext(ConnectedRaftContext); };
|
|
@@ -28,7 +28,9 @@ export declare enum AppSentMessage {
|
|
|
28
28
|
DELETE_FILE_FROM_DEVICE_LOCAL_STORAGE = "DELETE_FILE_FROM_DEVICE_LOCAL_STORAGE",
|
|
29
29
|
LIST_FILES_FROM_DEVICE_LOCAL_STORAGE = "LIST_FILES_FROM_DEVICE_LOCAL_STORAGE",
|
|
30
30
|
LOG = "LOG",
|
|
31
|
-
INJECT_JS = "INJECT_JS"
|
|
31
|
+
INJECT_JS = "INJECT_JS",
|
|
32
|
+
MARTY_GET_COMMS_STATS = "MARTY_GET_COMMS_STATS",
|
|
33
|
+
MARTY_CALIBRATE_COLOUR_SENSOR = "MARTY_CALIBRATE_COLOUR_SENSOR"
|
|
32
34
|
}
|
|
33
35
|
export declare enum WrapperSentMessage {
|
|
34
36
|
RAFT_PUBLISHED_EVENT = "RAFT_PUBLISHED_EVENT",
|
|
@@ -20,6 +20,8 @@ export var AppSentMessage;
|
|
|
20
20
|
AppSentMessage["LIST_FILES_FROM_DEVICE_LOCAL_STORAGE"] = "LIST_FILES_FROM_DEVICE_LOCAL_STORAGE";
|
|
21
21
|
AppSentMessage["LOG"] = "LOG";
|
|
22
22
|
AppSentMessage["INJECT_JS"] = "INJECT_JS";
|
|
23
|
+
AppSentMessage["MARTY_GET_COMMS_STATS"] = "MARTY_GET_COMMS_STATS";
|
|
24
|
+
AppSentMessage["MARTY_CALIBRATE_COLOUR_SENSOR"] = "MARTY_CALIBRATE_COLOUR_SENSOR";
|
|
23
25
|
})(AppSentMessage || (AppSentMessage = {}));
|
|
24
26
|
export var WrapperSentMessage;
|
|
25
27
|
(function (WrapperSentMessage) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import RAFT from "../../application/RAFTs/RAFT";
|
|
2
|
+
import { RaftWifiConnStatus } from "@robotical/raftjs";
|
|
2
3
|
export declare const FW_VERSION_RSSI_WIFI = "1.2.0";
|
|
3
|
-
export default function wifiConfigSub(raft: RAFT
|
|
4
|
+
export default function wifiConfigSub(raft: RAFT | undefined, cachedStatus: RaftWifiConnStatus | undefined): string | undefined;
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
import isVersionGreater from "./compare-version";
|
|
2
|
+
import { RaftWifiConnState } from "@robotical/raftjs";
|
|
2
3
|
export var FW_VERSION_RSSI_WIFI = "1.2.0"; // greater versions than this (1.1.17) have the wifi rssi logic
|
|
3
|
-
export default function wifiConfigSub(raft) {
|
|
4
|
+
export default function wifiConfigSub(raft, cachedStatus) {
|
|
5
|
+
if (!raft) {
|
|
6
|
+
return "No raft connected";
|
|
7
|
+
}
|
|
4
8
|
if (!isVersionGreater(raft.getRaftVersion(), FW_VERSION_RSSI_WIFI)) {
|
|
5
9
|
return "Currently, wifi configuration only works in the phone application.";
|
|
6
10
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// if (!isConnected && !isPaused) {
|
|
28
|
-
// subtitle = "Not Connected";
|
|
29
|
-
// }
|
|
30
|
-
// if (conInfo) {
|
|
31
|
-
// subtitle += " | " + conInfo;
|
|
32
|
-
// }
|
|
33
|
-
// return subtitle;
|
|
11
|
+
var isPaused = cachedStatus === null || cachedStatus === void 0 ? void 0 : cachedStatus.isPaused;
|
|
12
|
+
var conInfo = (cachedStatus === null || cachedStatus === void 0 ? void 0 : cachedStatus.connState) === RaftWifiConnState.WIFI_CONN_CONNECTED ||
|
|
13
|
+
(cachedStatus === null || cachedStatus === void 0 ? void 0 : cachedStatus.ssid)
|
|
14
|
+
? cachedStatus.ipAddress + (isPaused ? "" : " on " + cachedStatus.ssid)
|
|
15
|
+
: null;
|
|
16
|
+
var isConnected = (cachedStatus === null || cachedStatus === void 0 ? void 0 : cachedStatus.connState) === RaftWifiConnState.WIFI_CONN_CONNECTED && (cachedStatus === null || cachedStatus === void 0 ? void 0 : cachedStatus.ipAddress);
|
|
17
|
+
var subtitle;
|
|
18
|
+
if (isConnected) {
|
|
19
|
+
subtitle = "Connected";
|
|
20
|
+
}
|
|
21
|
+
if (isConnected && isPaused) {
|
|
22
|
+
subtitle = "Connected (Paused for BLE)";
|
|
23
|
+
}
|
|
24
|
+
if (!isConnected) {
|
|
25
|
+
subtitle = "Not Connected";
|
|
26
|
+
}
|
|
27
|
+
if (conInfo) {
|
|
28
|
+
subtitle += " | " + conInfo;
|
|
29
|
+
}
|
|
30
|
+
return subtitle;
|
|
34
31
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { RaftInfoEvents } from "../types/events/raft-info";
|
|
2
2
|
import { ConnectionAttemptResults, RaftConnectionMethod } from "../types/raft";
|
|
3
|
+
import Connector from "./connectors/Connector";
|
|
3
4
|
import { RaftConnEvent, RaftPublishEvent, RaftUpdateEvent } from "@robotical/raftjs";
|
|
4
5
|
import { RICLedLcdColours } from "@robotical/roboticaljs";
|
|
5
6
|
export declare class WrapperAppManager {
|
|
6
7
|
private connectors;
|
|
7
8
|
private _observers;
|
|
8
9
|
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Get connector
|
|
12
|
+
*/
|
|
13
|
+
getConnector(raftId: string): Connector | undefined;
|
|
9
14
|
/**
|
|
10
15
|
* Connect to a RAFT
|
|
11
16
|
*
|
|
@@ -15,10 +20,21 @@ export declare class WrapperAppManager {
|
|
|
15
20
|
*
|
|
16
21
|
*/
|
|
17
22
|
connect(method: RaftConnectionMethod, uuids: string[]): Promise<ConnectionAttemptResults>;
|
|
23
|
+
/**
|
|
24
|
+
* Get Marty Comms stats
|
|
25
|
+
*/
|
|
26
|
+
getCommsStatsMarty(raftId: string): {
|
|
27
|
+
msgRxRate: number;
|
|
28
|
+
msgRoundtripWorstMs: number;
|
|
29
|
+
msgRoundtripLastMs: number;
|
|
30
|
+
msgRoundtripBestMs: number;
|
|
31
|
+
msgRetries: number;
|
|
32
|
+
} | undefined;
|
|
18
33
|
/**
|
|
19
34
|
* Re-triggers the connect event which was missed due to the connection logic
|
|
20
35
|
*/
|
|
21
36
|
getMissedConnEvent(raftId: any): void;
|
|
37
|
+
calibrateColourSensorMarty(raftId: string): Promise<boolean>;
|
|
22
38
|
/**
|
|
23
39
|
* Get the RAFT Name
|
|
24
40
|
*/
|
|
@@ -38,6 +38,7 @@ import { WrapperSentMessage } from "../types/communication-between-apps/wrapper-
|
|
|
38
38
|
import Logger from "../services/logger/Logger";
|
|
39
39
|
import { RaftConnEvent } from "@robotical/raftjs";
|
|
40
40
|
import ConnectorFactory from "./connectors/ConnectorFactory";
|
|
41
|
+
import ColourSensorManualCalibratorMarty from "./utils/ColourSensorManualCalibratorMarty";
|
|
41
42
|
var SHOW_LOGS = true;
|
|
42
43
|
var TAG = "WrapperAppManager";
|
|
43
44
|
var WrapperAppManager = /** @class */ (function () {
|
|
@@ -47,6 +48,12 @@ var WrapperAppManager = /** @class */ (function () {
|
|
|
47
48
|
// Observers
|
|
48
49
|
this._observers = {};
|
|
49
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Get connector
|
|
53
|
+
*/
|
|
54
|
+
WrapperAppManager.prototype.getConnector = function (raftId) {
|
|
55
|
+
return this.connectors[raftId];
|
|
56
|
+
};
|
|
50
57
|
/**
|
|
51
58
|
* Connect to a RAFT
|
|
52
59
|
*
|
|
@@ -83,6 +90,23 @@ var WrapperAppManager = /** @class */ (function () {
|
|
|
83
90
|
});
|
|
84
91
|
});
|
|
85
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* Get Marty Comms stats
|
|
95
|
+
*/
|
|
96
|
+
WrapperAppManager.prototype.getCommsStatsMarty = function (raftId) {
|
|
97
|
+
if (this.connectors[raftId]) {
|
|
98
|
+
var raftConnector = this.connectors[raftId].connManager.getConnector();
|
|
99
|
+
var commsStats = raftConnector.getCommsStats();
|
|
100
|
+
return {
|
|
101
|
+
msgRxRate: commsStats.getMsgRxRate(),
|
|
102
|
+
msgRoundtripWorstMs: commsStats.getRTWorstMs(),
|
|
103
|
+
msgRoundtripLastMs: commsStats.getRTLastMs(),
|
|
104
|
+
msgRoundtripBestMs: commsStats.getRTBestMs(),
|
|
105
|
+
msgRetries: commsStats.getRetries()
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
};
|
|
86
110
|
/**
|
|
87
111
|
* Re-triggers the connect event which was missed due to the connection logic
|
|
88
112
|
*/
|
|
@@ -92,6 +116,29 @@ var WrapperAppManager = /** @class */ (function () {
|
|
|
92
116
|
this.connectors[raftId].publish("conn", RaftConnEvent.CONN_CONNECTED, "connect", {});
|
|
93
117
|
}
|
|
94
118
|
};
|
|
119
|
+
//=====================//
|
|
120
|
+
/* CALIBRATE MARTY */
|
|
121
|
+
//=====================//
|
|
122
|
+
WrapperAppManager.prototype.calibrateColourSensorMarty = function (raftId) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
+
var raftConnector, didCalibrate;
|
|
125
|
+
return __generator(this, function (_a) {
|
|
126
|
+
switch (_a.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
if (!this.connectors[raftId]) return [3 /*break*/, 2];
|
|
129
|
+
raftConnector = this.connectors[raftId].connManager.getConnector();
|
|
130
|
+
return [4 /*yield*/, ColourSensorManualCalibratorMarty.calibrate(raftConnector)];
|
|
131
|
+
case 1:
|
|
132
|
+
didCalibrate = _a.sent();
|
|
133
|
+
return [2 /*return*/, didCalibrate];
|
|
134
|
+
case 2: return [2 /*return*/, false];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
//=====================//
|
|
140
|
+
/* END CALIBRATE MARTY */
|
|
141
|
+
//=====================//
|
|
95
142
|
/**
|
|
96
143
|
* Get the RAFT Name
|
|
97
144
|
*/
|
|
@@ -115,7 +115,7 @@ var WebAppCommunicator = /** @class */ (function () {
|
|
|
115
115
|
}());
|
|
116
116
|
export default WebAppCommunicator;
|
|
117
117
|
var receivedMessageHandler = function (receivedMessage, data, messagePromiseId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
-
var _a, connectionResults, error_1, ricName, error_2, verifyResults, error_3, stopVerifyResults, error_4, disconnectResults, error_5, restResults, error_6, missedConnEventResults, streamAudioResults;
|
|
118
|
+
var _a, connectionResults, error_1, ricName, error_2, verifyResults, error_3, stopVerifyResults, error_4, disconnectResults, error_5, restResults, error_6, missedConnEventResults, streamAudioResults, commsStats, calibrateColourSensorResults, error_7;
|
|
119
119
|
return __generator(this, function (_b) {
|
|
120
120
|
switch (_b.label) {
|
|
121
121
|
case 0:
|
|
@@ -130,8 +130,10 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
130
130
|
case AppSentMessage.RAFT_SEND_REST: return [3 /*break*/, 22];
|
|
131
131
|
case AppSentMessage.GET_MISSED_CONN_EVENT: return [3 /*break*/, 26];
|
|
132
132
|
case AppSentMessage.RAFT_STREAM_AUDIO: return [3 /*break*/, 27];
|
|
133
|
+
case AppSentMessage.MARTY_GET_COMMS_STATS: return [3 /*break*/, 28];
|
|
134
|
+
case AppSentMessage.MARTY_CALIBRATE_COLOUR_SENSOR: return [3 /*break*/, 29];
|
|
133
135
|
}
|
|
134
|
-
return [3 /*break*/,
|
|
136
|
+
return [3 /*break*/, 33];
|
|
135
137
|
case 1:
|
|
136
138
|
try {
|
|
137
139
|
console.log("3");
|
|
@@ -143,7 +145,7 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
143
145
|
catch (error) {
|
|
144
146
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error.message, messagePromiseId: messagePromiseId });
|
|
145
147
|
}
|
|
146
|
-
return [3 /*break*/,
|
|
148
|
+
return [3 /*break*/, 34];
|
|
147
149
|
case 2:
|
|
148
150
|
_b.trys.push([2, 4, , 5]);
|
|
149
151
|
return [4 /*yield*/, wrapperAppManager.connect(data.method, data.uuids)];
|
|
@@ -155,7 +157,7 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
155
157
|
error_1 = _b.sent();
|
|
156
158
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error_1.message, messagePromiseId: messagePromiseId });
|
|
157
159
|
return [3 /*break*/, 5];
|
|
158
|
-
case 5: return [3 /*break*/,
|
|
160
|
+
case 5: return [3 /*break*/, 34];
|
|
159
161
|
case 6:
|
|
160
162
|
_b.trys.push([6, 8, , 9]);
|
|
161
163
|
return [4 /*yield*/, wrapperAppManager.getRaftName(data.raftId)];
|
|
@@ -167,7 +169,7 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
167
169
|
error_2 = _b.sent();
|
|
168
170
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error_2.message, messagePromiseId: messagePromiseId });
|
|
169
171
|
return [3 /*break*/, 9];
|
|
170
|
-
case 9: return [3 /*break*/,
|
|
172
|
+
case 9: return [3 /*break*/, 34];
|
|
171
173
|
case 10:
|
|
172
174
|
_b.trys.push([10, 12, , 13]);
|
|
173
175
|
return [4 /*yield*/, wrapperAppManager.verifyRaft(data.ledLcdColours, data.raftId)];
|
|
@@ -179,7 +181,7 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
179
181
|
error_3 = _b.sent();
|
|
180
182
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error_3.message, messagePromiseId: messagePromiseId });
|
|
181
183
|
return [3 /*break*/, 13];
|
|
182
|
-
case 13: return [3 /*break*/,
|
|
184
|
+
case 13: return [3 /*break*/, 34];
|
|
183
185
|
case 14:
|
|
184
186
|
_b.trys.push([14, 16, , 17]);
|
|
185
187
|
return [4 /*yield*/, wrapperAppManager.stopVerifyingRaft(data.isCorrectRIC, data.raftId)];
|
|
@@ -191,7 +193,7 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
191
193
|
error_4 = _b.sent();
|
|
192
194
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error_4.message, messagePromiseId: messagePromiseId });
|
|
193
195
|
return [3 /*break*/, 17];
|
|
194
|
-
case 17: return [3 /*break*/,
|
|
196
|
+
case 17: return [3 /*break*/, 34];
|
|
195
197
|
case 18:
|
|
196
198
|
_b.trys.push([18, 20, , 21]);
|
|
197
199
|
return [4 /*yield*/, wrapperAppManager.disconnect(data.raftId)];
|
|
@@ -203,7 +205,7 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
203
205
|
error_5 = _b.sent();
|
|
204
206
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error_5.message, messagePromiseId: messagePromiseId });
|
|
205
207
|
return [3 /*break*/, 21];
|
|
206
|
-
case 21: return [3 /*break*/,
|
|
208
|
+
case 21: return [3 /*break*/, 34];
|
|
207
209
|
case 22:
|
|
208
210
|
_b.trys.push([22, 24, , 25]);
|
|
209
211
|
return [4 /*yield*/, wrapperAppManager.sendRestMessage(data.msg, data.params, data.raftId)];
|
|
@@ -215,7 +217,7 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
215
217
|
error_6 = _b.sent();
|
|
216
218
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error_6.message, messagePromiseId: messagePromiseId });
|
|
217
219
|
return [3 /*break*/, 25];
|
|
218
|
-
case 25: return [3 /*break*/,
|
|
220
|
+
case 25: return [3 /*break*/, 34];
|
|
219
221
|
case 26:
|
|
220
222
|
try {
|
|
221
223
|
missedConnEventResults = wrapperAppManager.getMissedConnEvent(data.raftId);
|
|
@@ -224,7 +226,7 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
224
226
|
catch (error) {
|
|
225
227
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error.message, messagePromiseId: messagePromiseId });
|
|
226
228
|
}
|
|
227
|
-
return [3 /*break*/,
|
|
229
|
+
return [3 /*break*/, 34];
|
|
228
230
|
case 27:
|
|
229
231
|
try {
|
|
230
232
|
streamAudioResults = wrapperAppManager.streamAudio(data.raftId, data.streamContents, data.clearExisting, data.duration);
|
|
@@ -233,11 +235,32 @@ var receivedMessageHandler = function (receivedMessage, data, messagePromiseId)
|
|
|
233
235
|
catch (error) {
|
|
234
236
|
window.wrapperCommunicator.onMessageResponse({ success: false, error: error.message, messagePromiseId: messagePromiseId });
|
|
235
237
|
}
|
|
236
|
-
return [3 /*break*/,
|
|
238
|
+
return [3 /*break*/, 34];
|
|
237
239
|
case 28:
|
|
240
|
+
try {
|
|
241
|
+
commsStats = wrapperAppManager.getCommsStatsMarty(data.raftId);
|
|
242
|
+
window.wrapperCommunicator.onMessageResponse({ success: true, error: "", results: commsStats, messagePromiseId: messagePromiseId });
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
window.wrapperCommunicator.onMessageResponse({ success: false, error: error.message, messagePromiseId: messagePromiseId });
|
|
246
|
+
}
|
|
247
|
+
return [3 /*break*/, 34];
|
|
248
|
+
case 29:
|
|
249
|
+
_b.trys.push([29, 31, , 32]);
|
|
250
|
+
return [4 /*yield*/, wrapperAppManager.calibrateColourSensorMarty(data.raftId)];
|
|
251
|
+
case 30:
|
|
252
|
+
calibrateColourSensorResults = _b.sent();
|
|
253
|
+
window.wrapperCommunicator.onMessageResponse({ success: true, error: "", results: calibrateColourSensorResults, messagePromiseId: messagePromiseId });
|
|
254
|
+
return [3 /*break*/, 32];
|
|
255
|
+
case 31:
|
|
256
|
+
error_7 = _b.sent();
|
|
257
|
+
window.wrapperCommunicator.onMessageResponse({ success: false, error: error_7.message, messagePromiseId: messagePromiseId });
|
|
258
|
+
return [3 /*break*/, 32];
|
|
259
|
+
case 32: return [3 /*break*/, 34];
|
|
260
|
+
case 33:
|
|
238
261
|
Logger.warn(SHOW_LOGS, TAG, "Unhandled message: ".concat(receivedMessage));
|
|
239
|
-
_b.label =
|
|
240
|
-
case
|
|
262
|
+
_b.label = 34;
|
|
263
|
+
case 34: return [2 /*return*/];
|
|
241
264
|
}
|
|
242
265
|
});
|
|
243
266
|
}); };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RaftConnector } from "@robotical/raftjs";
|
|
2
|
+
export default class ColourSensorManualCalibratorMarty {
|
|
3
|
+
private static _raftConnector;
|
|
4
|
+
private static _isCalibrating;
|
|
5
|
+
private static _calibrationValues;
|
|
6
|
+
private static _colourSensorReadings;
|
|
7
|
+
static calibrate(raftConnector: RaftConnector, retryTimes?: number): Promise<boolean>;
|
|
8
|
+
private static prepareForCalibration;
|
|
9
|
+
private static performCalibrationSequence;
|
|
10
|
+
private static handleCalibrationOutcome;
|
|
11
|
+
private static handleMaxAttempts;
|
|
12
|
+
private static almostEqual;
|
|
13
|
+
private static compareCalibrationValues;
|
|
14
|
+
private static turnOnServosIfRequired;
|
|
15
|
+
private static getColourSensorNames;
|
|
16
|
+
private static getCalibration;
|
|
17
|
+
private static getColourSensorReading;
|
|
18
|
+
private static calibrateCS;
|
|
19
|
+
}
|