@robotical/webapp-types 3.18.10 → 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.
- package/dist-types/src/application/RAFTs/Marty/Marty.js +5 -2
- package/dist-types/src/application/RAFTs/Marty/MartySoundStreamingStats.d.ts +3 -1
- package/dist-types/src/application/RAFTs/Marty/MartySoundStreamingStats.js +11 -1
- package/dist-types/src/types/events/raft-info.d.ts +8 -0
- package/dist-types/src/wrapper-app/connectors/MartyConnector/MartyConnector.js +1 -3
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
+
};
|
|
@@ -60,8 +60,6 @@ import { WrapperSentMessage } from "../../../types/communication-between-apps/wr
|
|
|
60
60
|
var SHOW_LOGS = true;
|
|
61
61
|
var TAG = "MartyConnector";
|
|
62
62
|
var UNPLUGGED_MODE_CHECK_TIMEOUT_MS = 750;
|
|
63
|
-
var WEB_BLE_ASSUMED_MTU = 185;
|
|
64
|
-
var WEB_BLE_STREAM_BLOCK_SIZE = Math.floor(WEB_BLE_ASSUMED_MTU * 0.9);
|
|
65
63
|
var WEB_BLE_AUDIO_BLOCKS_WITHOUT_PAUSE = 0;
|
|
66
64
|
var timeout = function (promise, timeoutMs) {
|
|
67
65
|
var timeoutId;
|
|
@@ -81,7 +79,7 @@ var MartyConnector = /** @class */ (function (_super) {
|
|
|
81
79
|
_this.type = RaftTypeE.MARTY;
|
|
82
80
|
if (connectionMethod === RaftConnectionMethod.WEB_BLE) {
|
|
83
81
|
var streamHandler = _this.connManager.getConnector().getStreamHandler();
|
|
84
|
-
|
|
82
|
+
// RaftJS chunks logical stream blocks to the safe Web Bluetooth write size.
|
|
85
83
|
streamHandler.setNumBlocksWithoutPause(WEB_BLE_AUDIO_BLOCKS_WITHOUT_PAUSE);
|
|
86
84
|
}
|
|
87
85
|
return _this;
|