From 0680c5b52a0d4f0fef5fd14490a99b42666dd93d Mon Sep 17 00:00:00 2001 From: Yannick Poirier Date: Thu, 7 Dec 2023 17:14:20 +0100 Subject: [PATCH] API to convert FDT to xml --- src/sender/fdt.rs | 3 ++- src/sender/sender.rs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sender/fdt.rs b/src/sender/fdt.rs index 4720993..8a14b16 100644 --- a/src/sender/fdt.rs +++ b/src/sender/fdt.rs @@ -373,7 +373,7 @@ impl Fdt { self.complete = Some(true) } - fn to_xml(&self, now: SystemTime) -> Result> { + pub fn to_xml(&self, now: SystemTime) -> Result> { let mut buffer = ToFmtWrite(Vec::new()); let mut writer = quick_xml::Writer::new_with_indent(&mut buffer, b' ', 2); @@ -479,6 +479,7 @@ mod tests { fdt.add_object(obj1).unwrap(); fdt.add_object(obj2).unwrap(); + fdt.groups = Some(vec!("Group1".to_owned(), "Group2".to_owned())); fdt } diff --git a/src/sender/sender.rs b/src/sender/sender.rs index 5b17c0b..3354bd2 100644 --- a/src/sender/sender.rs +++ b/src/sender/sender.rs @@ -232,6 +232,11 @@ impl Sender { self.fdt.allocate_toi() } + /// Convert current FDT to XML + pub fn fdt_xml_data(&self, now: SystemTime) -> Result> { + self.fdt.to_xml(now) + } + /// Read the next ALC/LCT packet /// return None if there is no new packet to be transferred /// ALC/LCT packet should be encapsulated into a UDP/IP payload and transferred via UDP/multicast