@robotical/webapp-types 3.18.11 → 3.18.12

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.
@@ -269,11 +269,14 @@ var Marty = /** @class */ (function (_super) {
269
269
  */
270
270
  Marty.prototype.raftInfoEventHandler = function (eventEnum, eventName, data) {
271
271
  return __awaiter(this, void 0, void 0, function () {
272
+ var systemInfoEventData;
272
273
  return __generator(this, function (_a) {
273
274
  switch (eventEnum) {
274
- case RaftInfoEvents.SYSTEM_INFO:
275
- this.soundStreamingStats.configureSoundStreamingForRobot(data.systemInfo);
275
+ case RaftInfoEvents.SYSTEM_INFO: {
276
+ systemInfoEventData = data;
277
+ this.soundStreamingStats.configureSoundStreamingForRobot(systemInfoEventData.systemInfo, systemInfoEventData.transportInfo);
276
278
  break;
279
+ }
277
280
  default:
278
281
  break;
279
282
  }
@@ -1,4 +1,5 @@
1
1
  import { RaftSystemInfo } from "@robdobsn/raftjs";
2
+ import { RaftTransportInfo } from "../../../types/events/raft-info";
2
3
  export type MartySoundStreamingProfile = {
3
4
  bitRate: number;
4
5
  sampleRate: number;
@@ -7,10 +8,11 @@ export type MartySoundStreamingProfile = {
7
8
  export default class MartySoundStreamingStats {
8
9
  private readonly MAX_WARNINGS_PER_PROFILE;
9
10
  private readonly RIC_VERSION_NEW_SOKTO_MODE;
11
+ private readonly LOW_MTU_THRESHOLD;
10
12
  private readonly soundStreamingProfiles;
11
13
  private currentSoundStreamingProfileIndex;
12
14
  getCurrentProfile(): MartySoundStreamingProfile;
13
15
  increaseWarning(): void;
14
16
  setBitRate(bitRate: number): boolean;
15
- configureSoundStreamingForRobot(systemInfo: Pick<RaftSystemInfo, "SystemVersion"> | null): void;
17
+ configureSoundStreamingForRobot(systemInfo: Pick<RaftSystemInfo, "SystemVersion"> | null, transportInfo?: RaftTransportInfo): void;
16
18
  }
@@ -12,6 +12,7 @@ var MartySoundStreamingStats = /** @class */ (function () {
12
12
  function MartySoundStreamingStats() {
13
13
  this.MAX_WARNINGS_PER_PROFILE = 2;
14
14
  this.RIC_VERSION_NEW_SOKTO_MODE = "1.2.52";
15
+ this.LOW_MTU_THRESHOLD = 200;
15
16
  // Profiles must be listed in decreasing order by bitrate.
16
17
  this.soundStreamingProfiles = [
17
18
  new SoundStreamingProfile(64, 44100, true),
@@ -46,7 +47,16 @@ var MartySoundStreamingStats = /** @class */ (function () {
46
47
  this.currentSoundStreamingProfileIndex = profileIndex;
47
48
  return true;
48
49
  };
49
- MartySoundStreamingStats.prototype.configureSoundStreamingForRobot = function (systemInfo) {
50
+ MartySoundStreamingStats.prototype.configureSoundStreamingForRobot = function (systemInfo, transportInfo) {
51
+ var bleMtu = transportInfo === null || transportInfo === void 0 ? void 0 : transportInfo.bleMtu;
52
+ if (typeof bleMtu === "number" &&
53
+ Number.isFinite(bleMtu) &&
54
+ bleMtu > 0 &&
55
+ bleMtu < this.LOW_MTU_THRESHOLD) {
56
+ // Preserve the legacy native/iPad fallback for constrained BLE links.
57
+ this.setBitRate(16);
58
+ return;
59
+ }
50
60
  if ((systemInfo === null || systemInfo === void 0 ? void 0 : systemInfo.SystemVersion) &&
51
61
  isVersionGreater(this.RIC_VERSION_NEW_SOKTO_MODE, systemInfo.SystemVersion)) {
52
62
  this.setBitRate(16);
@@ -1,3 +1,4 @@
1
+ import type { RaftSystemInfo } from "@robdobsn/raftjs";
1
2
  export declare enum RaftInfoEvents {
2
3
  RAFT_NAME = "RAFT_NAME",
3
4
  SYSTEM_INFO = "SYSTEM_INFO",
@@ -8,3 +9,10 @@ export declare enum RaftInfoEvents {
8
9
  IS_REGISTERED_TO_WARRANTY = "IS_REGISTERED_TO_WARRANTY",
9
10
  RAFT_IS_VERIFIED = "RAFT_IS_VERIFIED"
10
11
  }
12
+ export type RaftTransportInfo = {
13
+ bleMtu?: number;
14
+ };
15
+ export type RaftSystemInfoEventData = {
16
+ systemInfo: RaftSystemInfo;
17
+ transportInfo?: RaftTransportInfo;
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/webapp-types",
3
- "version": "3.18.11",
3
+ "version": "3.18.12",
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",