Skip to content

Commit 0e51673

Browse files
frontend: src: Update zenoh to 1.7.2
1 parent 28aaedf commit 0e51673

File tree

6 files changed

+121
-151
lines changed

6 files changed

+121
-151
lines changed

core/frontend/bun.lockb

8.68 KB
Binary file not shown.

core/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"lint": "eslint --max-warnings=0 --ext .js,.vue --ignore-path .gitignore --ignore-pattern src/components/vue-tour src"
1515
},
1616
"dependencies": {
17-
"@eclipse-zenoh/zenoh-ts": "1.3.4",
17+
"@eclipse-zenoh/zenoh-ts": "1.7.2",
1818
"@ffmpeg/ffmpeg": "^0.12.15",
1919
"@ffmpeg/util": "^0.12.2",
2020
"@foxglove/rosmsg": "^5.0.4",

core/frontend/src/components/cloud/CloudTrayMenu.vue

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174

175175
<script lang="ts">
176176
import {
177-
Config, QueryTarget, Receiver, RecvErr, ReplyError, Sample, Session, Subscriber,
177+
ChannelReceiver, Config, QueryTarget, Reply, ReplyError, Sample, Session, Subscriber,
178178
} from '@eclipse-zenoh/zenoh-ts'
179179
import axios from 'axios'
180180
import { StatusCodes } from 'http-status-codes'
@@ -463,30 +463,23 @@ export default Vue.extend({
463463
}
464464
465465
try {
466-
const receiver: void | Receiver = this.file_sync_session.get(topic, {
467-
target: QueryTarget.BestMatching,
466+
const receiver: ChannelReceiver<Reply> | undefined = await this.file_sync_session.get(topic, {
467+
target: QueryTarget.BEST_MATCHING,
468468
})
469469
470-
if (!(receiver instanceof Receiver)) {
470+
if (!receiver) {
471471
console.warn(`[CloudTrayMenu] Query for ${topic} returned void receiver.`)
472472
return null
473473
}
474474
475-
let reply = await receiver.receive()
476-
while (reply !== RecvErr.Disconnected) {
477-
if (reply === RecvErr.MalformedReply) {
478-
console.warn(`[CloudTrayMenu] Malformed reply while querying ${topic}.`)
479-
} else {
480-
const response = reply.result()
481-
if (response instanceof Sample) {
482-
const payload = response.payload().to_string()
483-
return this.parseFileSyncQueue(payload)
484-
}
485-
const errorResponse: ReplyError = response
486-
console.warn(`[CloudTrayMenu] Query error for ${topic}:`, errorResponse.payload().to_string())
475+
for await (const reply of receiver) {
476+
const response = reply.result()
477+
if (response instanceof Sample) {
478+
const payload = response.payload().toString()
479+
return this.parseFileSyncQueue(payload)
487480
}
488-
489-
reply = await receiver.receive()
481+
const errorResponse: ReplyError = response
482+
console.warn(`[CloudTrayMenu] Query error for ${topic}:`, errorResponse.payload().toString())
490483
}
491484
} catch (error) {
492485
console.error(`[CloudTrayMenu] Failed to query ${topic}:`, error)
@@ -534,7 +527,7 @@ export default Vue.extend({
534527
}
535528
536529
try {
537-
this.uploading_subscriber = await this.file_sync_session.declare_subscriber(
530+
this.uploading_subscriber = await this.file_sync_session.declareSubscriber(
538531
MAJOR_TOM_FILE_SYNC_UPLOADING_TOPIC,
539532
{
540533
handler: (sample: Sample) => {
@@ -549,7 +542,7 @@ export default Vue.extend({
549542
},
550543
handleUploadingSample(sample: Sample): void {
551544
try {
552-
const payload = sample.payload().to_string()
545+
const payload = sample.payload().toString()
553546
const event = JSON.parse(payload) as FileSyncUploadingEvent
554547
const transfer = this.normalizeUploadingEvent(event)
555548
if (!transfer) {

core/frontend/src/components/zenoh-inspector/ZenohInspector.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export default Vue.extend({
180180
if (!this.current_message?.payload || !this.video_reader) {
181181
return null
182182
}
183-
const msg: { data: Uint8Array } = this.video_reader.readMessage(this.current_message.payload.to_bytes())
183+
const msg: { data: Uint8Array } = this.video_reader.readMessage(this.current_message.payload.toBytes())
184184
return msg.data
185185
},
186186
},
@@ -213,12 +213,12 @@ export default Vue.extend({
213213
}
214214
215215
if (message.encoding === Encoding.TEXT_PLAIN.toString()) {
216-
formattedMessage.payload = message.payload.to_string()
216+
formattedMessage.payload = message.payload.toString()
217217
} else if (message.encoding === Encoding.APPLICATION_JSON.toString()) {
218-
formattedMessage.payload = JSON.parse(message.payload.to_string())
218+
formattedMessage.payload = JSON.parse(message.payload.toString())
219219
} else if (message.encoding === Encoding.ZENOH_BYTES.toString()) {
220220
try {
221-
formattedMessage.payload = JSON.parse(message.payload.to_string())
221+
formattedMessage.payload = JSON.parse(message.payload.toString())
222222
} catch (exception) {
223223
// Keep the raw payload if it's not valid JSON
224224
formattedMessage.payload = message.payload.toString()
@@ -235,7 +235,7 @@ export default Vue.extend({
235235
this.session = await Session.open(config)
236236
237237
// Setup regular message subscriber
238-
this.subscriber = await this.session.declare_subscriber('**', {
238+
this.subscriber = await this.session.declareSubscriber('**', {
239239
handler: async (sample: Sample) => {
240240
const topic = sample.keyexpr().toString()
241241
const payload = sample.payload()
@@ -262,7 +262,7 @@ export default Vue.extend({
262262
// Setup liveliness subscriber
263263
const lv_ke = '@/**/@ros2_lv/**'
264264
265-
this.liveliness_subscriber = await this.session.liveliness().declare_subscriber(lv_ke, {
265+
this.liveliness_subscriber = await this.session.liveliness().declareSubscriber(lv_ke, {
266266
handler: (sample: Sample) => {
267267
// Parse the liveliness token using regex
268268
// eslint-disable-next-line max-len

0 commit comments

Comments
 (0)