diff --git a/src/lib/drivers/fake.rs b/src/lib/drivers/fake.rs index f245a0e..cb8fd6a 100644 --- a/src/lib/drivers/fake.rs +++ b/src/lib/drivers/fake.rs @@ -78,32 +78,17 @@ impl Driver for FakeSink { } } - let version = match &**message { - Packet::V1(_) => mavlink::MavlinkVersion::V1, - Packet::V2(_) => mavlink::MavlinkVersion::V2, - }; - - let frame = match mavlink::MavFrame::::deser( - version, - message.as_slice(), - ) { - Ok(frame) => frame, - Err(error) => { - warn!("Failed to deserialize Mavlink Message: {error:?}"); - continue; - } + let Ok(mavlink_json) = message + .to_mavlink_json::() + .await + else { + continue; }; - let mavlink::MavFrame { - header, - msg: message, - protocol_version: _, - } = frame; - if self.print { - println!("Message received: {header:?} {message:?}"); + println!("Message received: {mavlink_json:#?}"); } else { - trace!("Message received: {header:?} {message:?}"); + trace!("Message received: {mavlink_json:#?}"); } }