@luxonis/visualizer-protobuf 2.1.1 → 2.3.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.
- package/dist/{communicator-ZAqNuwq6.js → FoxgloveServer-tJZcJH5-.js} +1216 -184
- package/dist/apps/depthai-visualizer/src/components/Panel.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/components/Panel.js +13 -4
- package/dist/apps/depthai-visualizer/src/components/Panel.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.js +12 -12
- package/dist/apps/depthai-visualizer/src/components/PanelToolbar.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/adapter.d.ts +10 -7
- package/dist/apps/depthai-visualizer/src/connection/adapter.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/adapter.js +11 -5
- package/dist/apps/depthai-visualizer/src/connection/adapter.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/communicator.d.ts +17 -13
- package/dist/apps/depthai-visualizer/src/connection/communicator.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/communicator.js +17 -24
- package/dist/apps/depthai-visualizer/src/connection/communicator.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/connection.d.ts +14 -13
- package/dist/apps/depthai-visualizer/src/connection/connection.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/connection.js +25 -22
- package/dist/apps/depthai-visualizer/src/connection/connection.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/foxglove-protocol.d.ts +6 -0
- package/dist/apps/depthai-visualizer/src/connection/foxglove-protocol.d.ts.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/foxglove-protocol.js +63 -0
- package/dist/apps/depthai-visualizer/src/connection/foxglove-protocol.js.map +1 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/bridge.d.ts +2 -2
- package/dist/apps/depthai-visualizer/src/connection/webrtc/bridge.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/bridge.js +76 -45
- package/dist/apps/depthai-visualizer/src/connection/webrtc/bridge.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.d.ts +50 -15
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.js +71 -26
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker-utils.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker.js +15 -0
- package/dist/apps/depthai-visualizer/src/connection/webrtc/worker.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker.d.ts +16 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker.js +114 -2
- package/dist/apps/depthai-visualizer/src/connection/ws/worker.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/context/ConnectionsProvider.d.ts +1 -1
- package/dist/apps/depthai-visualizer/src/context/ConnectionsProvider.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/index.d.ts +1 -2
- package/dist/apps/depthai-visualizer/src/index.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/index.js +0 -1
- package/dist/apps/depthai-visualizer/src/index.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/detection.js +2 -2
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/detection.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/utils.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization/detections/utils.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/deserialization.js +5 -5
- package/dist/apps/depthai-visualizer/src/messaging/deserialization.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/utils.d.ts +7 -6
- package/dist/apps/depthai-visualizer/src/messaging/utils.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/messaging/utils.js +2 -2
- package/dist/apps/depthai-visualizer/src/messaging/utils.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/EncodedFrame.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImageAnnotations.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgDetections.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/ImgFrame.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/PointCloudData.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/SpatialImgDetections.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.js +3 -0
- package/dist/apps/depthai-visualizer/src/protobuf.generated/common.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/artificial-worker.d.ts +7 -4
- package/dist/apps/depthai-visualizer/src/utils/artificial-worker.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/artificial-worker.js +15 -2
- package/dist/apps/depthai-visualizer/src/utils/artificial-worker.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.d.ts +1 -1
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.js +5 -5
- package/dist/apps/depthai-visualizer/src/utils/callback-manager.js.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/compatibility.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.d.ts.map +1 -1
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.js +1 -0
- package/dist/apps/depthai-visualizer/src/utils/metrics-manager.js.map +1 -1
- package/dist/communicator-D9LSiWws.js +147 -0
- package/dist/foxglove-protocol-RBwoTi12.js +76 -0
- package/dist/{index-DvdDp1CU.js → index-BatOjqHR.js} +4 -5
- package/dist/{index-fkPdppby.js → index-BeMujwTx.js} +4 -5
- package/dist/{index-yfE-EHjv.js → index-Bmv-vCsr.js} +4 -5
- package/dist/{index-BNmANBei.js → index-Bpb1nLXX.js} +4 -5
- package/dist/{index-Cv9FekAD.js → index-C38MwKQ5.js} +4 -5
- package/dist/{index-DszVVt5Z.js → index-C4Xw5gJf.js} +4 -5
- package/dist/{index-r3QAVuN1.js → index-CCjTYhIj.js} +4 -5
- package/dist/{index-Bk2FsKKi.js → index-CRzS8jhh.js} +4 -5
- package/dist/{index-2U-xZM02.js → index-CTV8k4Ur.js} +4 -5
- package/dist/{index-BEeIqwPz.js → index-Cjzn2Mk3.js} +4 -5
- package/dist/{index-sbw9t8iK.js → index-CzJG5yoW.js} +4 -5
- package/dist/{index-FWvVjhSv.js → index-D2tE4ai8.js} +5 -6
- package/dist/{index-lPEkwJ-1.js → index-D8PL1mUz.js} +4 -5
- package/dist/{index-CKhCc5vm.js → index-Dx5rKk7S.js} +252 -156
- package/dist/{index-nxmrq-HQ.js → index-JdSlhtdz.js} +4 -5
- package/dist/{index-Djz0avqZ.js → index-LBWmbzab.js} +4 -5
- package/dist/{index-TgQ8-Lib.js → index-fDKFJqYA.js} +4 -5
- package/dist/{index-DakMDXW9.js → index-kO40p_fI.js} +4 -5
- package/dist/{index-QYS2yYV7.js → index-lcxcWrBB.js} +4 -5
- package/dist/index.js +4 -5
- package/dist/worker-BX0SIDt0.js +163 -0
- package/dist/worker-C6ruK-iB.js +150 -0
- package/package.json +2 -2
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.d.ts +0 -18
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.d.ts.map +0 -1
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.js +0 -103
- package/dist/apps/depthai-visualizer/src/connection/ws/worker-utils.js.map +0 -1
- package/dist/apps/depthai-visualizer/src/panels/CanvasPanel.d.ts +0 -12
- package/dist/apps/depthai-visualizer/src/panels/CanvasPanel.d.ts.map +0 -1
- package/dist/apps/depthai-visualizer/src/panels/CanvasPanel.js +0 -52
- package/dist/apps/depthai-visualizer/src/panels/CanvasPanel.js.map +0 -1
- package/dist/worker-ByVSTHSI.js +0 -102
- package/dist/worker-DlZ2xp8p.js +0 -11
- package/dist/worker-utils-BNThsbdN.js +0 -1332
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { au as ExternalTokenizer, aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, az as flatIndent, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport } from './index-
|
|
2
|
-
import './
|
|
3
|
-
import 'hydrated-ws';
|
|
4
|
-
import 'ms';
|
|
5
|
-
import './communicator-ZAqNuwq6.js';
|
|
1
|
+
import { au as ExternalTokenizer, aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, az as flatIndent, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport } from './index-Dx5rKk7S.js';
|
|
2
|
+
import './FoxgloveServer-tJZcJH5-.js';
|
|
6
3
|
import 'protobufjs/minimal';
|
|
4
|
+
import 'ms';
|
|
7
5
|
import 'react';
|
|
8
6
|
import 'zustand';
|
|
9
7
|
import 'react-mosaic-component';
|
|
10
8
|
import '@mui/material';
|
|
11
9
|
import './i18next-C5Qe4-E1.js';
|
|
10
|
+
import './foxglove-protocol-RBwoTi12.js';
|
|
12
11
|
import 'react-dnd';
|
|
13
12
|
import 'react-dnd-html5-backend';
|
|
14
13
|
import '@emotion/react';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { an as indentNodeProp, ao as continuedIndent, ap as foldNodeProp, aq as styleTags, ar as tags, as as LRLanguage, at as LanguageSupport, au as ExternalTokenizer, av as LRParser, aw as ifNotIn, ax as completeFromList, ay as syntaxTree } from './index-
|
|
2
|
-
import './
|
|
3
|
-
import 'hydrated-ws';
|
|
4
|
-
import 'ms';
|
|
5
|
-
import './communicator-ZAqNuwq6.js';
|
|
1
|
+
import { an as indentNodeProp, ao as continuedIndent, ap as foldNodeProp, aq as styleTags, ar as tags, as as LRLanguage, at as LanguageSupport, au as ExternalTokenizer, av as LRParser, aw as ifNotIn, ax as completeFromList, ay as syntaxTree } from './index-Dx5rKk7S.js';
|
|
2
|
+
import './FoxgloveServer-tJZcJH5-.js';
|
|
6
3
|
import 'protobufjs/minimal';
|
|
4
|
+
import 'ms';
|
|
7
5
|
import 'react';
|
|
8
6
|
import 'zustand';
|
|
9
7
|
import 'react-mosaic-component';
|
|
10
8
|
import '@mui/material';
|
|
11
9
|
import './i18next-C5Qe4-E1.js';
|
|
10
|
+
import './foxglove-protocol-RBwoTi12.js';
|
|
12
11
|
import 'react-dnd';
|
|
13
12
|
import 'react-dnd-html5-backend';
|
|
14
13
|
import '@emotion/react';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { au as ExternalTokenizer, aC as ContextTracker, aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, ap as foldNodeProp, aB as foldInside, an as indentNodeProp, ao as continuedIndent, aH as defineCSSCompletionSource, at as LanguageSupport } from './index-
|
|
2
|
-
import './
|
|
3
|
-
import 'hydrated-ws';
|
|
4
|
-
import 'ms';
|
|
5
|
-
import './communicator-ZAqNuwq6.js';
|
|
1
|
+
import { au as ExternalTokenizer, aC as ContextTracker, aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, ap as foldNodeProp, aB as foldInside, an as indentNodeProp, ao as continuedIndent, aH as defineCSSCompletionSource, at as LanguageSupport } from './index-Dx5rKk7S.js';
|
|
2
|
+
import './FoxgloveServer-tJZcJH5-.js';
|
|
6
3
|
import 'protobufjs/minimal';
|
|
4
|
+
import 'ms';
|
|
7
5
|
import 'react';
|
|
8
6
|
import 'zustand';
|
|
9
7
|
import 'react-mosaic-component';
|
|
10
8
|
import '@mui/material';
|
|
11
9
|
import './i18next-C5Qe4-E1.js';
|
|
10
|
+
import './foxglove-protocol-RBwoTi12.js';
|
|
12
11
|
import 'react-dnd';
|
|
13
12
|
import 'react-dnd-html5-backend';
|
|
14
13
|
import '@emotion/react';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, az as flatIndent, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport } from './index-
|
|
2
|
-
import './
|
|
3
|
-
import 'hydrated-ws';
|
|
4
|
-
import 'ms';
|
|
5
|
-
import './communicator-ZAqNuwq6.js';
|
|
1
|
+
import { aq as styleTags, ar as tags, av as LRParser, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, az as flatIndent, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport } from './index-Dx5rKk7S.js';
|
|
2
|
+
import './FoxgloveServer-tJZcJH5-.js';
|
|
6
3
|
import 'protobufjs/minimal';
|
|
4
|
+
import 'ms';
|
|
7
5
|
import 'react';
|
|
8
6
|
import 'zustand';
|
|
9
7
|
import 'react-mosaic-component';
|
|
10
8
|
import '@mui/material';
|
|
11
9
|
import './i18next-C5Qe4-E1.js';
|
|
10
|
+
import './foxglove-protocol-RBwoTi12.js';
|
|
12
11
|
import 'react-dnd';
|
|
13
12
|
import 'react-dnd-html5-backend';
|
|
14
13
|
import '@emotion/react';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { au as ExternalTokenizer, aC as ContextTracker, aq as styleTags, ar as tags, av as LRParser, aD as LocalTokenGroup, aE as snippetCompletion, ay as syntaxTree, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, az as flatIndent, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport, aw as ifNotIn, ax as completeFromList, aF as IterMode, aG as NodeWeakMap } from './index-
|
|
2
|
-
import './
|
|
3
|
-
import 'hydrated-ws';
|
|
4
|
-
import 'ms';
|
|
5
|
-
import './communicator-ZAqNuwq6.js';
|
|
1
|
+
import { au as ExternalTokenizer, aC as ContextTracker, aq as styleTags, ar as tags, av as LRParser, aD as LocalTokenGroup, aE as snippetCompletion, ay as syntaxTree, as as LRLanguage, an as indentNodeProp, ao as continuedIndent, az as flatIndent, aA as delimitedIndent, ap as foldNodeProp, aB as foldInside, at as LanguageSupport, aw as ifNotIn, ax as completeFromList, aF as IterMode, aG as NodeWeakMap } from './index-Dx5rKk7S.js';
|
|
2
|
+
import './FoxgloveServer-tJZcJH5-.js';
|
|
6
3
|
import 'protobufjs/minimal';
|
|
4
|
+
import 'ms';
|
|
7
5
|
import 'react';
|
|
8
6
|
import 'zustand';
|
|
9
7
|
import 'react-mosaic-component';
|
|
10
8
|
import '@mui/material';
|
|
11
9
|
import './i18next-C5Qe4-E1.js';
|
|
10
|
+
import './foxglove-protocol-RBwoTi12.js';
|
|
12
11
|
import 'react-dnd';
|
|
13
12
|
import 'react-dnd-html5-backend';
|
|
14
13
|
import '@emotion/react';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { aR as ImagePanel, aQ as PanelLayout, aS as PointCloudPanel, aO as VisualizerConnection, aP as VisualizerContext } from './index-
|
|
2
|
-
|
|
3
|
-
import './communicator-ZAqNuwq6.js';
|
|
1
|
+
export { aR as ImagePanel, aQ as PanelLayout, aS as PointCloudPanel, aO as VisualizerConnection, aP as VisualizerContext } from './index-Dx5rKk7S.js';
|
|
2
|
+
import './FoxgloveServer-tJZcJH5-.js';
|
|
4
3
|
import 'protobufjs/minimal';
|
|
4
|
+
import 'ms';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'zustand';
|
|
7
7
|
import 'react-mosaic-component';
|
|
8
8
|
import '@mui/material';
|
|
9
9
|
import './i18next-C5Qe4-E1.js';
|
|
10
|
+
import './foxglove-protocol-RBwoTi12.js';
|
|
10
11
|
import 'react-dnd';
|
|
11
12
|
import 'react-dnd-html5-backend';
|
|
12
13
|
import '@emotion/react';
|
|
@@ -19,5 +20,3 @@ import 'rehype-sanitize';
|
|
|
19
20
|
import 'extend';
|
|
20
21
|
import 'react-icons';
|
|
21
22
|
import '@pandacss/dev';
|
|
22
|
-
import 'hydrated-ws';
|
|
23
|
-
import 'ms';
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { F as FoxgloveCommunicator, r as recordToDataView } from './communicator-D9LSiWws.js';
|
|
2
|
+
import { m as makeServiceCallRequest } from './foxglove-protocol-RBwoTi12.js';
|
|
3
|
+
import './FoxgloveServer-tJZcJH5-.js';
|
|
4
|
+
import 'protobufjs/minimal';
|
|
5
|
+
import 'ms';
|
|
6
|
+
|
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
8
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
9
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
10
|
+
|
|
11
|
+
class WebRtcHandler extends FoxgloveCommunicator {
|
|
12
|
+
#subscriptionId = 0;
|
|
13
|
+
#messageReady = false;
|
|
14
|
+
#systemReady = false;
|
|
15
|
+
#subscriptions = new Map();
|
|
16
|
+
isReady() {
|
|
17
|
+
return this.#messageReady && this.#systemReady;
|
|
18
|
+
}
|
|
19
|
+
send(message) {
|
|
20
|
+
self.postMessage(message);
|
|
21
|
+
}
|
|
22
|
+
sendWithTransfer(message, transfer) {
|
|
23
|
+
self.postMessage(message, transfer);
|
|
24
|
+
}
|
|
25
|
+
#rawSubscribe(channelIds) {
|
|
26
|
+
const subscriptions = channelIds.map(channelId => ({
|
|
27
|
+
id: ++this.#subscriptionId,
|
|
28
|
+
channelId
|
|
29
|
+
}));
|
|
30
|
+
self.postMessage({
|
|
31
|
+
type: "send",
|
|
32
|
+
data: {
|
|
33
|
+
channel: "system",
|
|
34
|
+
data: recordToDataView({
|
|
35
|
+
op: "subscribe",
|
|
36
|
+
subscriptions
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return subscriptions;
|
|
41
|
+
}
|
|
42
|
+
subscribe(topics) {
|
|
43
|
+
const channelIds = this.getPublicChannels().filter(publicChannel => topics.includes(publicChannel.topic)).map(channel => channel.id);
|
|
44
|
+
const subscriptions = this.#rawSubscribe(channelIds);
|
|
45
|
+
for (const subscription of subscriptions) {
|
|
46
|
+
const channel = this.getPublicChannels().find(publicChannel => publicChannel.id === subscription.channelId);
|
|
47
|
+
if (channel) {
|
|
48
|
+
this.#subscriptions.set(subscription.id, {
|
|
49
|
+
topic: channel.topic,
|
|
50
|
+
schema: channel.schemaName,
|
|
51
|
+
kind: channel.kind
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
#rawUnsubscribe(subscriptionIds) {
|
|
57
|
+
self.postMessage({
|
|
58
|
+
type: "send",
|
|
59
|
+
data: {
|
|
60
|
+
channel: "system",
|
|
61
|
+
data: recordToDataView({
|
|
62
|
+
op: "unsubscribe",
|
|
63
|
+
subscriptionIds
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
unsubscribe(topics) {
|
|
69
|
+
const subscriptionIds = [...this.#subscriptions.entries()].filter(([_id, data]) => topics.includes(data.topic)).map(subscription => subscription[0]);
|
|
70
|
+
this.#rawUnsubscribe(subscriptionIds);
|
|
71
|
+
for (const subscriptionId of subscriptionIds) {
|
|
72
|
+
this.#subscriptions.delete(subscriptionId);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
sendServiceCallRequest(args) {
|
|
76
|
+
const data = makeServiceCallRequest(args);
|
|
77
|
+
self.postMessage({
|
|
78
|
+
type: "send",
|
|
79
|
+
data: {
|
|
80
|
+
channel: "message",
|
|
81
|
+
data
|
|
82
|
+
}
|
|
83
|
+
}, [data.buffer]);
|
|
84
|
+
}
|
|
85
|
+
handleRawSend(data) {
|
|
86
|
+
self.postMessage({
|
|
87
|
+
type: "send",
|
|
88
|
+
data
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
handleConnection(data) {
|
|
92
|
+
if (!data.channel || data.channel === "message") {
|
|
93
|
+
this.#messageReady = data.ready;
|
|
94
|
+
}
|
|
95
|
+
if (!data.channel || data.channel === "system") {
|
|
96
|
+
this.#systemReady = data.ready;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
handleGeneric(message) {
|
|
100
|
+
const subscription = this.#subscriptions.get(message.subscriptionId);
|
|
101
|
+
if (subscription) {
|
|
102
|
+
this.handleGenericMessage(subscription.topic, subscription.schema, message.data);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
handleServiceCall(message) {
|
|
106
|
+
this.callService(message);
|
|
107
|
+
}
|
|
108
|
+
handleSystem(message) {
|
|
109
|
+
switch (message.op) {
|
|
110
|
+
case "advertise":
|
|
111
|
+
{
|
|
112
|
+
this.handleChannelsAdvertisement(message.channels);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case "unadvertise":
|
|
116
|
+
{
|
|
117
|
+
this.handleChannelsUnadvertisement(message.channelIds);
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case "advertiseServices":
|
|
121
|
+
{
|
|
122
|
+
this.handleServicesAdvertisement(message.services);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case "unadvertiseServices":
|
|
126
|
+
{
|
|
127
|
+
this.handleServicesUnadvertisement(message.serviceIds);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case "serviceResponse":
|
|
131
|
+
{
|
|
132
|
+
this.handleServiceResponse(message);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
140
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
141
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
142
|
+
|
|
143
|
+
const handler = new WebRtcHandler();
|
|
144
|
+
self.addEventListener("message", event => {
|
|
145
|
+
if (event.data.kind === 'genericMessage') {
|
|
146
|
+
handler.handleGeneric(event.data.data.message);
|
|
147
|
+
} else if (event.data.kind === 'systemMessage') {
|
|
148
|
+
handler.handleSystem(event.data.data.message);
|
|
149
|
+
} else if (event.data.kind === 'serviceCall') {
|
|
150
|
+
handler.handleServiceCall(event.data.data.message);
|
|
151
|
+
} else if (event.data.kind === 'rawSend') {
|
|
152
|
+
handler.handleRawSend({
|
|
153
|
+
channel: event.data.data.message.channel,
|
|
154
|
+
data: event.data.data.message.message
|
|
155
|
+
});
|
|
156
|
+
} else if (event.data.kind === 'subscribe') {
|
|
157
|
+
handler.subscribe(event.data.data.message.topics);
|
|
158
|
+
} else if (event.data.kind === 'unsubscribe') {
|
|
159
|
+
handler.unsubscribe(event.data.data.message.topics);
|
|
160
|
+
} else {
|
|
161
|
+
handler.handleConnection(event.data.data);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { Waterfall } from 'hydrated-ws';
|
|
2
|
+
import { F as FoxgloveClient } from './FoxgloveServer-tJZcJH5-.js';
|
|
3
|
+
import { F as FoxgloveCommunicator } from './communicator-D9LSiWws.js';
|
|
4
|
+
import 'protobufjs/minimal';
|
|
5
|
+
import 'ms';
|
|
6
|
+
|
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
8
|
+
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
9
|
+
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
10
|
+
|
|
11
|
+
class WsWorker extends FoxgloveCommunicator {
|
|
12
|
+
#ws;
|
|
13
|
+
#client;
|
|
14
|
+
#subscriptions = new Map();
|
|
15
|
+
send(message) {
|
|
16
|
+
self.postMessage(message);
|
|
17
|
+
}
|
|
18
|
+
sendWithTransfer(message, transfer) {
|
|
19
|
+
self.postMessage(message, transfer);
|
|
20
|
+
}
|
|
21
|
+
#createWs(url, onReconnect) {
|
|
22
|
+
this.#ws = new Waterfall(url, FoxgloveClient.SUPPORTED_SUBPROTOCOL, {
|
|
23
|
+
connectionTimeout: 2000,
|
|
24
|
+
retryPolicy: _attempt => {
|
|
25
|
+
onReconnect();
|
|
26
|
+
return 1_000;
|
|
27
|
+
},
|
|
28
|
+
factory: wsUrl => {
|
|
29
|
+
const rawWs = new WebSocket(wsUrl, FoxgloveClient.SUPPORTED_SUBPROTOCOL);
|
|
30
|
+
rawWs.binaryType = "arraybuffer";
|
|
31
|
+
return rawWs;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
#createClient() {
|
|
36
|
+
this.#client = new FoxgloveClient({
|
|
37
|
+
ws: this.#ws
|
|
38
|
+
});
|
|
39
|
+
this.#client.on("open", () => {
|
|
40
|
+
this.send({
|
|
41
|
+
type: "open"
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
this.#client.on("close", () => {
|
|
45
|
+
this.send({
|
|
46
|
+
type: "close"
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
this.#client.on("error", error => {
|
|
50
|
+
this.send({
|
|
51
|
+
type: "error",
|
|
52
|
+
error
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
this.#client.on("message", ({
|
|
56
|
+
subscriptionId,
|
|
57
|
+
data
|
|
58
|
+
}) => {
|
|
59
|
+
const subscription = this.#subscriptions.get(subscriptionId);
|
|
60
|
+
if (subscription) {
|
|
61
|
+
this.handleGenericMessage(subscription.topic, subscription.schema, data);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
#handleMessages() {
|
|
66
|
+
this.#client.on("advertise", this.handleChannelsAdvertisement.bind(this));
|
|
67
|
+
this.#client.on("unadvertise", this.handleChannelsUnadvertisement.bind(this));
|
|
68
|
+
this.#client.on("advertiseServices", this.handleServicesAdvertisement.bind(this));
|
|
69
|
+
this.#client.on("unadvertiseServices", this.handleServicesUnadvertisement.bind(this));
|
|
70
|
+
this.#client.on("serviceCallResponse", this.handleServiceResponse.bind(this));
|
|
71
|
+
}
|
|
72
|
+
sendServiceCallRequest(request) {
|
|
73
|
+
this.#client.sendServiceCallRequest(request);
|
|
74
|
+
}
|
|
75
|
+
isReady() {
|
|
76
|
+
return this.#ws.readyState === this.#ws.OPEN;
|
|
77
|
+
}
|
|
78
|
+
constructor(wsUrl) {
|
|
79
|
+
super();
|
|
80
|
+
try {
|
|
81
|
+
this.#createWs(wsUrl, this.handleReconnect.bind(this));
|
|
82
|
+
this.#createClient();
|
|
83
|
+
this.#handleMessages();
|
|
84
|
+
} catch (error) {
|
|
85
|
+
// try-catch is needed to catch `Mixed Content` errors in Chrome, where the client
|
|
86
|
+
// attempts to load `ws://` from `https://`. (Safari would catch these in `ws.onerror`
|
|
87
|
+
// but with `undefined` as an error.)
|
|
88
|
+
this.send({
|
|
89
|
+
type: "error",
|
|
90
|
+
error: error ?? {
|
|
91
|
+
message: "Insecure WebSocket connection"
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
subscribe(topics) {
|
|
97
|
+
const channels = this.getPublicChannels().filter(publicChannel => topics.includes(publicChannel.topic));
|
|
98
|
+
for (const channel of channels) {
|
|
99
|
+
const subscription = this.#client.subscribe(channel.id);
|
|
100
|
+
this.#subscriptions.set(subscription, {
|
|
101
|
+
topic: channel.topic,
|
|
102
|
+
schema: channel.schemaName,
|
|
103
|
+
kind: channel.kind
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
unsubscribe(topics) {
|
|
108
|
+
const subscriptionIds = [...this.#subscriptions.entries()].filter(([_id, data]) => topics.includes(data.topic)).map(subscription => subscription[0]);
|
|
109
|
+
for (const subscriptionId of subscriptionIds) {
|
|
110
|
+
this.#subscriptions.delete(subscriptionId);
|
|
111
|
+
this.#client.unsubscribe(subscriptionId);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
callService(args) {
|
|
115
|
+
super.callService(args);
|
|
116
|
+
}
|
|
117
|
+
close() {
|
|
118
|
+
this.#client.close();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
let wsWorker = null;
|
|
122
|
+
self.addEventListener('message', async event => {
|
|
123
|
+
const {
|
|
124
|
+
type,
|
|
125
|
+
data
|
|
126
|
+
} = event.data;
|
|
127
|
+
if (type !== 'open' && !wsWorker) {
|
|
128
|
+
console.warn(`WS Worker Error: Requested ${type} before open`);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
switch (type) {
|
|
132
|
+
case "open":
|
|
133
|
+
wsWorker = new WsWorker('wsUrl' in data ? data.wsUrl : '');
|
|
134
|
+
break;
|
|
135
|
+
case "close":
|
|
136
|
+
wsWorker.close();
|
|
137
|
+
break;
|
|
138
|
+
case "call_service":
|
|
139
|
+
wsWorker.callService(data);
|
|
140
|
+
break;
|
|
141
|
+
case 'subscribe':
|
|
142
|
+
wsWorker.subscribe(data);
|
|
143
|
+
break;
|
|
144
|
+
case 'unsubscribe':
|
|
145
|
+
wsWorker.unsubscribe(data);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
export { WsWorker };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxonis/visualizer-protobuf",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "RobotHub Visualizer Library",
|
|
6
6
|
"author": "Luxonis Corp",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@emotion/react": "11.11.3",
|
|
17
17
|
"@emotion/styled": "11.11.0",
|
|
18
18
|
"@luxonis/common-fe-components": "1.9.5",
|
|
19
|
-
"@luxonis/remote-connection": "2.
|
|
19
|
+
"@luxonis/remote-connection": "2.1.0",
|
|
20
20
|
"@mui/icons-material": "5.15.5",
|
|
21
21
|
"@mui/material": "5.15.6",
|
|
22
22
|
"color": "^4.2.3",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ServiceCallPayload } from "@foxglove/ws-protocol";
|
|
2
|
-
import { FoxgloveCommunicator, FoxgloveAdapterInputMessage, FoxgloveAdapterOutputMessage } from "../communicator.js";
|
|
3
|
-
export declare class WsWorker extends FoxgloveCommunicator {
|
|
4
|
-
#private;
|
|
5
|
-
protected send: (message: FoxgloveAdapterOutputMessage) => void;
|
|
6
|
-
protected sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void;
|
|
7
|
-
protected isReady(): boolean;
|
|
8
|
-
protected sendServiceCallRequest(request: ServiceCallPayload): void;
|
|
9
|
-
protected subscribe(channel: number): number;
|
|
10
|
-
constructor(wsUrl: string, send: (message: FoxgloveAdapterOutputMessage) => void, sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void);
|
|
11
|
-
rawSend(data: string | ArrayBuffer | ArrayBufferView): void;
|
|
12
|
-
close(): void;
|
|
13
|
-
callService({ name, serviceCallId, body }: (FoxgloveAdapterInputMessage & {
|
|
14
|
-
type: "call_service";
|
|
15
|
-
})["data"]): void;
|
|
16
|
-
}
|
|
17
|
-
export declare function createWsWorkerMessageListener(send: (message: FoxgloveAdapterOutputMessage) => void, sendWithTransfer: (message: FoxgloveAdapterOutputMessage, transfer: ArrayBuffer[]) => void): (event: MessageEvent<FoxgloveAdapterInputMessage>) => Promise<void>;
|
|
18
|
-
//# sourceMappingURL=worker-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker-utils.d.ts","sourceRoot":"","sources":["../../../../../../src/connection/ws/worker-utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAErH,qBAAa,QAAS,SAAQ,oBAAoB;;IAoD9C,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI;IAC/D,SAAS,CAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI;cAfnF,OAAO,IAAI,OAAO;cAIlB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;cAIzD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;gBAKnD,KAAK,EAAE,MAAM,EACH,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI,EACrD,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI;IAmB/F,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,IAAI;IAM3D,KAAK,IAAI,IAAI;IAIJ,WAAW,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,IAAS,EACV,EAAE,CAAC,2BAA2B,GAAG;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI;CAG3E;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,IAAI,EACrD,gBAAgB,EAAE,CAAC,OAAO,EAAE,4BAA4B,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,GACzF,CAAC,KAAK,EAAE,YAAY,CAAC,2BAA2B,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAoBrE"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
-
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
3
|
-
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
4
|
-
import { Waterfall } from "hydrated-ws";
|
|
5
|
-
import { FoxgloveClient } from "@foxglove/ws-protocol";
|
|
6
|
-
import { FoxgloveCommunicator } from "../communicator.js";
|
|
7
|
-
export class WsWorker extends FoxgloveCommunicator {
|
|
8
|
-
send;
|
|
9
|
-
sendWithTransfer;
|
|
10
|
-
#ws;
|
|
11
|
-
#client;
|
|
12
|
-
#createWs(url, onReconnect) {
|
|
13
|
-
this.#ws = new Waterfall(url, FoxgloveClient.SUPPORTED_SUBPROTOCOL, {
|
|
14
|
-
connectionTimeout: 2000,
|
|
15
|
-
retryPolicy: (_attempt) => {
|
|
16
|
-
onReconnect();
|
|
17
|
-
return 1_000;
|
|
18
|
-
},
|
|
19
|
-
factory: (wsUrl) => {
|
|
20
|
-
const rawWs = new WebSocket(wsUrl, FoxgloveClient.SUPPORTED_SUBPROTOCOL);
|
|
21
|
-
rawWs.binaryType = "arraybuffer";
|
|
22
|
-
return rawWs;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
#createClient() {
|
|
27
|
-
this.#client = new FoxgloveClient({ ws: this.#ws });
|
|
28
|
-
this.#client.on("open", () => { this.send({ type: "open" }); });
|
|
29
|
-
this.#client.on("close", () => { this.send({ type: "close" }); });
|
|
30
|
-
this.#client.on("error", (error) => { this.send({ type: "error", error }); });
|
|
31
|
-
this.#client.on("message", ({ subscriptionId, data }) => {
|
|
32
|
-
this.handleGenericMessage(subscriptionId, data);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
#handleMessages() {
|
|
36
|
-
this.#client.on("advertise", this.handleChannelsAdvertisement.bind(this));
|
|
37
|
-
this.#client.on("unadvertise", this.handleChannelsUnadvertisement.bind(this));
|
|
38
|
-
this.#client.on("advertiseServices", this.handleServicesAdvertisement.bind(this));
|
|
39
|
-
this.#client.on("unadvertiseServices", this.handleServicesUnadvertisement.bind(this));
|
|
40
|
-
this.#client.on("serviceCallResponse", this.handleServiceResponse.bind(this));
|
|
41
|
-
}
|
|
42
|
-
isReady() {
|
|
43
|
-
return this.#ws.readyState === this.#ws.OPEN;
|
|
44
|
-
}
|
|
45
|
-
;
|
|
46
|
-
sendServiceCallRequest(request) {
|
|
47
|
-
this.#client.sendServiceCallRequest(request);
|
|
48
|
-
}
|
|
49
|
-
subscribe(channel) {
|
|
50
|
-
return this.#client.subscribe(channel);
|
|
51
|
-
}
|
|
52
|
-
constructor(wsUrl, send, sendWithTransfer) {
|
|
53
|
-
super();
|
|
54
|
-
this.send = send;
|
|
55
|
-
this.sendWithTransfer = sendWithTransfer;
|
|
56
|
-
try {
|
|
57
|
-
this.#createWs(wsUrl, this.handleReconnect.bind(this));
|
|
58
|
-
this.#createClient();
|
|
59
|
-
this.#handleMessages();
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
// try-catch is needed to catch `Mixed Content` errors in Chrome, where the client
|
|
63
|
-
// attempts to load `ws://` from `https://`. (Safari would catch these in `ws.onerror`
|
|
64
|
-
// but with `undefined` as an error.)
|
|
65
|
-
send({
|
|
66
|
-
type: "error",
|
|
67
|
-
error: error ?? { message: "Insecure WebSocket connection" }
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
rawSend(data) {
|
|
72
|
-
if (this.#ws.readyState === this.#ws.OPEN) {
|
|
73
|
-
this.#ws.send(data);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
close() {
|
|
77
|
-
this.#client.close();
|
|
78
|
-
}
|
|
79
|
-
callService({ name, serviceCallId, body = {} }) {
|
|
80
|
-
super.callService({ name, serviceCallId, body });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
export function createWsWorkerMessageListener(send, sendWithTransfer) {
|
|
84
|
-
let wsWorker = null;
|
|
85
|
-
return async (event) => {
|
|
86
|
-
const { type, data } = event.data;
|
|
87
|
-
switch (type) {
|
|
88
|
-
case "open":
|
|
89
|
-
wsWorker = new WsWorker('wsUrl' in data ? data.wsUrl : '', send, sendWithTransfer);
|
|
90
|
-
break;
|
|
91
|
-
case "close":
|
|
92
|
-
wsWorker?.close();
|
|
93
|
-
break;
|
|
94
|
-
case "send":
|
|
95
|
-
wsWorker?.rawSend(data);
|
|
96
|
-
break;
|
|
97
|
-
case "call_service":
|
|
98
|
-
wsWorker?.callService(data);
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=worker-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker-utils.js","sourceRoot":"","sources":["../../../../../../src/connection/ws/worker-utils.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAA6D,MAAM,oBAAoB,CAAC;AAErH,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KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;gBACnF,MAAM;YACR,KAAK,OAAO;gBACV,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAClB,MAAM;YACR,KAAK,MAAM;gBACT,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBACxB,MAAM;YACR,KAAK,cAAc;gBACjB,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC5B,MAAM;QACV,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface CanvasPanelProps {
|
|
3
|
-
imageTopic: string;
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
onPlaybackStateChange?: (state: {
|
|
7
|
-
isPlaying: boolean;
|
|
8
|
-
}) => void;
|
|
9
|
-
}
|
|
10
|
-
export declare const CanvasPanel: React.NamedExoticComponent<CanvasPanelProps>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=CanvasPanel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasPanel.d.ts","sourceRoot":"","sources":["../../../../../src/panels/CanvasPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,UAAU,gBAAgB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CACjE;AAID,eAAO,MAAM,WAAW,8CAqDtB,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
-
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
4
|
-
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { service } from "@foxglove/studio-base/panels/ThreeDeeRender/renderables/Images/WorkerImageDecoder.worker";
|
|
7
|
-
import { useFlatContext } from "../context/VisualizerFlatContext";
|
|
8
|
-
// FIXME: Unsupported
|
|
9
|
-
// TODO: Rewrite in the same was as Image and PointCloud
|
|
10
|
-
export const CanvasPanel = React.memo(function CanvasPanel({ imageTopic, width, height, onPlaybackStateChange }) {
|
|
11
|
-
const canvasRef = React.useRef(null);
|
|
12
|
-
const connections = useFlatContext();
|
|
13
|
-
const [isPlaying, setIsPlaying] = React.useState(false);
|
|
14
|
-
React.useEffect(() => {
|
|
15
|
-
onPlaybackStateChange?.({ isPlaying });
|
|
16
|
-
}, [isPlaying, onPlaybackStateChange]);
|
|
17
|
-
React.useEffect(() => {
|
|
18
|
-
if (connections.length === 0) {
|
|
19
|
-
setIsPlaying(false);
|
|
20
|
-
}
|
|
21
|
-
for (const connection of connections) {
|
|
22
|
-
connection.setListener(async (state) => {
|
|
23
|
-
const canvas = canvasRef.current;
|
|
24
|
-
if (!canvas) {
|
|
25
|
-
setIsPlaying(false);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const canvasContext = canvas.getContext("2d");
|
|
29
|
-
if (!canvasContext) {
|
|
30
|
-
// console.debug("Failed to get canvas context");
|
|
31
|
-
setIsPlaying(false);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if ((state.problems ?? []).length > 0) {
|
|
35
|
-
console.warn("State has problems", state.problems);
|
|
36
|
-
setIsPlaying(false);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const messagesAll = state.activeData?.messages ?? [];
|
|
40
|
-
const messages = messagesAll.filter((m) => m.topic === imageTopic);
|
|
41
|
-
setIsPlaying(messages.length !== 0);
|
|
42
|
-
for (const message of messages) {
|
|
43
|
-
// console.debug("Receiving frame", message.receiveTime);
|
|
44
|
-
const imageData = service.decode(message.message, {});
|
|
45
|
-
canvasContext.putImageData(imageData, 0, 0, 0, 0, width, height);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}, [connections, height, imageTopic, width, setIsPlaying]);
|
|
50
|
-
return _jsx("canvas", { ref: canvasRef, width: width, height: height });
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=CanvasPanel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasPanel.js","sourceRoot":"","sources":["../../../../../src/panels/CanvasPanel.tsx"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,oEAAoE;AACpE,0DAA0D;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,OAAO,EAAE,MAAM,0FAA0F,CAAC;AAInH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AASlE,qBAAqB;AACrB,wDAAwD;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,WAAW,CAAC,EACzD,UAAU,EACV,KAAK,EACL,MAAM,EACN,qBAAqB,EACJ;IACjB,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAA2B,IAAI,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,qBAAqB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IACzC,CAAC,EAAE,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAEvC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,YAAY,CAAC,KAAK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