@robotical/webapp-types 3.24.4 → 3.25.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marty-web-app",
3
- "version": "3.24.4",
3
+ "version": "3.25.0",
4
4
  "private": true,
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -15,7 +15,7 @@
15
15
  "@robotical/codewheel": "^0.1.10",
16
16
  "@robotical/cog-shooter-game": "^0.1.27",
17
17
  "@robotical/jumping-game": "^0.1.29",
18
- "@robotical/martyblocks": "^4.0.76",
18
+ "@robotical/martyblocks": "^4.0.77",
19
19
  "@robotical/martyblocksjr": "^4.5.6",
20
20
  "@robotical/maze": "^0.1.22",
21
21
  "@robotical/rc-sequencer": "^1.1.15",
@@ -12,19 +12,27 @@ declare const colourDiagnosticsEnglish: {
12
12
  yellow: string;
13
13
  blue: string;
14
14
  red: string;
15
+ air: string;
15
16
  prompt: string;
17
+ airPrompt: string;
16
18
  result: string;
19
+ withoutAir: string;
17
20
  waiting: string;
18
21
  capture: string;
22
+ captureAir: string;
19
23
  capturing: string;
20
24
  uploading: string;
21
25
  saved: string;
22
26
  complete: string;
27
+ setupIncomplete: string;
28
+ wrapperUpdate: string;
29
+ extraCollected: string;
23
30
  retry: string;
24
31
  download: string;
25
32
  newSession: string;
26
33
  storageWarning: string;
27
34
  sensorDisconnected: string;
35
+ sensorInitialising: string;
28
36
  staleReading: string;
29
37
  invalidReading: string;
30
38
  backgrounded: string;
@@ -1,26 +1,33 @@
1
1
  var colourDiagnosticsEnglish = {
2
2
  title: "Colour sensor diagnostics",
3
- instructions: "Rest Marty's sensor flat on each card and keep the lighting steady. Hold still for the two-second snapshot.",
3
+ instructions: "Rest Marty's sensor flat on each card, then take a snapshot with Marty lifted in the air. Keep the lighting steady and hold still until the capture finishes. Sensor setup is read automatically before two seconds of readings are collected.",
4
4
  sessionId: "Session ID",
5
5
  copyId: "Copy ID",
6
6
  copied: "Copied",
7
7
  sensor: "Colour sensor",
8
8
  selectSensor: "Select a sensor",
9
9
  connect: "Connect and verify Marty with a colour sensor attached to begin.",
10
- green: "green", purple: "purple", yellow: "yellow", blue: "blue", red: "red",
10
+ green: "green", purple: "purple", yellow: "yellow", blue: "blue", red: "red", air: "in air",
11
11
  prompt: "Place the selected sensor on the {{colour}} card.",
12
+ airPrompt: "Lift Marty so both feet are at least 10 cm above any card or surface, with the sensors facing down and uncovered. Keep the lighting the same and hold still.",
12
13
  result: "Blocks interpretation: {{result}}",
14
+ withoutAir: "Colour match before the air flag is applied: {{result}}",
13
15
  waiting: "Select a sensor and wait for fresh readings.",
14
16
  capture: "Take {{colour}} snapshot",
17
+ captureAir: "Take air snapshot",
15
18
  capturing: "Capturing… Hold still",
16
19
  uploading: "Uploading…",
17
20
  saved: "{{saved}} snapshots uploaded · {{pending}} waiting to upload",
18
- complete: "All five cards captured. You can take more snapshots of any card.",
21
+ complete: "All five cards and the air check captured. You can take more snapshots of any step.",
22
+ setupIncomplete: "Some extra sensor details could not be read. The available readings are saved. Keep Marty connected and take another snapshot to retry collecting those details.",
23
+ wrapperUpdate: "Extra sensor details need an updated phone app. The normal colour readings are saved. You can also collect the full data using the updated browser app.",
24
+ extraCollected: "Sensor settings and {{count}} raw readings collected.",
19
25
  retry: "Retry uploads",
20
26
  download: "Download data",
21
27
  newSession: "New session",
22
28
  storageWarning: "This browser cannot keep a local backup. Download the data before closing this page.",
23
29
  sensorDisconnected: "The selected sensor disconnected. Reconnect Marty and select the sensor again.",
30
+ sensorInitialising: "Marty is still loading the sensor settings. Wait a few seconds and try again.",
24
31
  staleReading: "Waiting for fresh sensor data. Keep Marty connected and try again.",
25
32
  invalidReading: "The sensor reading is incomplete. Wait for fresh data and try again.",
26
33
  backgrounded: "Keep this window visible during the snapshot and try again.",
@@ -2,10 +2,18 @@ import { RaftInfoEvents } from "../../../types/events/raft-info";
2
2
  import { ConnectionAttemptResults, RaftConnectionMethod, RaftTypeE } from "../../../types/raft";
3
3
  import Connector from "../Connector";
4
4
  import ConnectorInterface from "../ConnectorInterface";
5
- import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent } from "@robdobsn/raftjs";
5
+ import { RaftConnEvent, RaftUpdateEvent, RaftPublishEvent, RaftOKFail } from "@robdobsn/raftjs";
6
6
  import { ConnManager } from "@robotical/roboticaljs";
7
+ import type { RestMessageOptions } from "../../../types/communication-between-apps/wrapper-communication";
7
8
  declare class MartyConnector extends Connector implements ConnectorInterface {
8
9
  type: RaftTypeE;
10
+ private colourDiagnosticsReady;
11
+ private colourDiagnosticsGeneration;
12
+ private resetColourDiagnosticsReadiness;
13
+ sendRestMessage(msg: string, params?: object, options?: RestMessageOptions): Promise<RaftOKFail & {
14
+ colourDiagnosticsProtocol?: number;
15
+ ready?: boolean;
16
+ }>;
9
17
  constructor(raftId: string, connManager: ConnManager, connectionMethod: RaftConnectionMethod);
10
18
  /**
11
19
  * Publish an event to all observers
@@ -77,6 +77,8 @@ var MartyConnector = /** @class */ (function (_super) {
77
77
  function MartyConnector(raftId, connManager, connectionMethod) {
78
78
  var _this = _super.call(this, raftId, connManager) || this;
79
79
  _this.type = RaftTypeE.MARTY;
80
+ _this.colourDiagnosticsReady = false;
81
+ _this.colourDiagnosticsGeneration = 0;
80
82
  if (connectionMethod === RaftConnectionMethod.WEB_BLE) {
81
83
  var streamHandler = _this.connManager.getConnector().getStreamHandler();
82
84
  // RaftJS chunks logical stream blocks to the safe Web Bluetooth write size.
@@ -84,6 +86,21 @@ var MartyConnector = /** @class */ (function (_super) {
84
86
  }
85
87
  return _this;
86
88
  }
89
+ MartyConnector.prototype.resetColourDiagnosticsReadiness = function () {
90
+ this.colourDiagnosticsReady = false;
91
+ return ++this.colourDiagnosticsGeneration;
92
+ };
93
+ MartyConnector.prototype.sendRestMessage = function (msg, params, options) {
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ return __generator(this, function (_a) {
96
+ // Local capability query: older wrappers forward it and cannot confirm safe register access.
97
+ if (msg === "diagnostics/colourSensorReady") {
98
+ return [2 /*return*/, { rslt: "ok", colourDiagnosticsProtocol: 1, ready: this.colourDiagnosticsReady }];
99
+ }
100
+ return [2 /*return*/, _super.prototype.sendRestMessage.call(this, msg, params, options)];
101
+ });
102
+ });
103
+ };
87
104
  /**
88
105
  * Publish an event to all observers
89
106
  * Set in RICConnector as an event listener callback
@@ -109,6 +126,7 @@ var MartyConnector = /** @class */ (function (_super) {
109
126
  return __generator(this, function (_a) {
110
127
  switch (_a.label) {
111
128
  case 0:
129
+ this.resetColourDiagnosticsReadiness();
112
130
  raftSystemUtils = this.connManager.getConnector().getRaftSystemUtils();
113
131
  return [4 /*yield*/, raftSystemUtils.getSystemInfo()];
114
132
  case 1:
@@ -143,6 +161,7 @@ var MartyConnector = /** @class */ (function (_super) {
143
161
  return __generator(this, function (_a) {
144
162
  switch (_a.label) {
145
163
  case 0:
164
+ this.resetColourDiagnosticsReadiness();
146
165
  raftChannel = this.connManager.getConnector().getRaftChannel();
147
166
  if (raftChannel) {
148
167
  raftChannel.ricRestCmdBeforeDisconnect = function () { return null; };
@@ -186,7 +205,7 @@ var MartyConnector = /** @class */ (function (_super) {
186
205
  MartyConnector.prototype.connectionEventHandler = function (eventEnum, eventName, data) {
187
206
  var _a;
188
207
  return __awaiter(this, void 0, void 0, function () {
189
- var _b, addOnManager, raftSystemUtils, msgHandler, addonManager, ricSystemUtils, spu, spuTwo, shouldUseLegacySoktoMode;
208
+ var _b, diagnosticGeneration, addOnManager, raftSystemUtils, msgHandler, addonManager, ricSystemUtils, retrieved, spu, spuTwo, shouldUseLegacySoktoMode;
190
209
  return __generator(this, function (_c) {
191
210
  switch (_c.label) {
192
211
  case 0:
@@ -194,13 +213,20 @@ var MartyConnector = /** @class */ (function (_super) {
194
213
  _b = eventEnum;
195
214
  switch (_b) {
196
215
  case RaftConnEvent.CONN_CONNECTED: return [3 /*break*/, 1];
197
- case RaftConnEvent.CONN_VERIFIED_CORRECT: return [3 /*break*/, 2];
216
+ case RaftConnEvent.CONN_DISCONNECTED: return [3 /*break*/, 2];
217
+ case RaftConnEvent.CONN_REJECTED: return [3 /*break*/, 2];
218
+ case RaftConnEvent.CONN_VERIFIED_CORRECT: return [3 /*break*/, 3];
198
219
  }
199
- return [3 /*break*/, 4];
200
- case 1:
201
- // ignore
202
- return [3 /*break*/, 5];
220
+ return [3 /*break*/, 5];
221
+ case 1:
222
+ this.resetColourDiagnosticsReadiness();
223
+ // ignore
224
+ return [3 /*break*/, 6];
203
225
  case 2:
226
+ this.resetColourDiagnosticsReadiness();
227
+ return [3 /*break*/, 6];
228
+ case 3:
229
+ diagnosticGeneration = this.resetColourDiagnosticsReadiness();
204
230
  addOnManager = this.connManager.getSystemType().getAddOnManager();
205
231
  RICRoboticalAddOns.registerAddOns(addOnManager);
206
232
  raftSystemUtils = this.connManager.getConnector().getRaftSystemUtils();
@@ -208,8 +234,11 @@ var MartyConnector = /** @class */ (function (_super) {
208
234
  addonManager = this.connManager.getSystemType().getAddOnManager();
209
235
  ricSystemUtils = new RICSystemUtils(msgHandler, addonManager);
210
236
  return [4 /*yield*/, ricSystemUtils.retrieveMartySystemInfo()];
211
- case 3:
212
- _c.sent();
237
+ case 4:
238
+ retrieved = _c.sent();
239
+ if (diagnosticGeneration !== this.colourDiagnosticsGeneration)
240
+ return [2 /*return*/];
241
+ this.colourDiagnosticsReady = retrieved;
213
242
  spu = RICServoParamUpdater.getSingletonInstance(msgHandler);
214
243
  spu && spu.init();
215
244
  spuTwo = RICServoParamUpdater.getSingletonInstance();
@@ -219,9 +248,9 @@ var MartyConnector = /** @class */ (function (_super) {
219
248
  this.connManager.getConnector().setLegacySoktoMode(shouldUseLegacySoktoMode);
220
249
  // checking for servo faults (this will trigger reportMsgCallback)
221
250
  (_a = this.connManager.getConnector().getSystemType()) === null || _a === void 0 ? void 0 : _a.getRICServoFaultDetector().atomicReadOperation();
222
- return [3 /*break*/, 5];
223
- case 4: return [3 /*break*/, 5];
224
- case 5: return [2 /*return*/];
251
+ return [3 /*break*/, 6];
252
+ case 5: return [3 /*break*/, 6];
253
+ case 6: return [2 /*return*/];
225
254
  }
226
255
  });
227
256
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/webapp-types",
3
- "version": "3.24.4",
3
+ "version": "3.25.0",
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",