From 0ebd1924872dbe89d42d22d6ddd98ee7eeb28052 Mon Sep 17 00:00:00 2001 From: Valmo Trindade Date: Thu, 7 May 2026 04:35:52 -0300 Subject: [PATCH] fixed URI Stream sharing --- src/uas/packets.rs | 22 ++++++++++++++++++++-- src/uas/send.rs | 3 ++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/uas/packets.rs b/src/uas/packets.rs index e66d9df..df0c2fd 100644 --- a/src/uas/packets.rs +++ b/src/uas/packets.rs @@ -265,13 +265,31 @@ pub(crate) fn video_stream_information_packet( msg.extend_from_slice(&720u16.to_le_bytes()); msg.extend_from_slice(&0u16.to_le_bytes()); msg.extend_from_slice(&(hfov_deg.clamp(1.0, 360.0).round() as u16).to_le_bytes()); - msg.push(0); + msg.push(1); msg.push(1); msg.push(stream_type); msg.extend_from_slice(&name); msg.extend_from_slice(&uri); msg.push(VIDEO_STREAM_ENCODING_H264); - msg.push(CAMERA_COMPONENT_ID); + msg.push(0); build_v2_packet(system_id, CAMERA_COMPONENT_ID, 269, &msg, 109) } + +pub(crate) fn video_stream_status_packet( + system_id: u8, + hfov_deg: f32, +) -> Vec { + let mut msg = Vec::with_capacity(19); + msg.extend_from_slice(&30f32.to_le_bytes()); + msg.extend_from_slice(&4_000_000u32.to_le_bytes()); + msg.extend_from_slice(&VIDEO_STREAM_STATUS_FLAGS_RUNNING.to_le_bytes()); + msg.extend_from_slice(&1280u16.to_le_bytes()); + msg.extend_from_slice(&720u16.to_le_bytes()); + msg.extend_from_slice(&0u16.to_le_bytes()); + msg.extend_from_slice(&(hfov_deg.clamp(1.0, 360.0).round() as u16).to_le_bytes()); + msg.push(1); + msg.push(0); + + build_v2_packet(system_id, CAMERA_COMPONENT_ID, 270, &msg, 59) +} diff --git a/src/uas/send.rs b/src/uas/send.rs index 77f9055..6d2859d 100644 --- a/src/uas/send.rs +++ b/src/uas/send.rs @@ -9,7 +9,7 @@ use super::packets::{ attitude_packet, autopilot_version_packet, camera_information_packet, component_heartbeat_packet, extended_sys_state_packet, global_position_int_packet, gps_raw_int_packet, heartbeat_packet, system_status_packet, vfr_hud_packet, - video_stream_information_packet, + video_stream_information_packet, video_stream_status_packet, }; use super::payload::{UasSystemPayload, UasTelemetryPayload}; @@ -136,6 +136,7 @@ pub fn send_uas_system(ctx: Context, payload: UasSystemPayload) -> &'static str &payload.video_uri, payload.hfov_deg, )); + packets.push(video_stream_status_packet(system_id, payload.hfov_deg)); } else if !payload.video_uri.trim().is_empty() { info!( "Skipping VIDEO_STREAM_INFORMATION for sysid={} because URI is not a supported stream URI: {}",