Skip to content

Commit

Permalink
API to convert FDT to xml
Browse files Browse the repository at this point in the history
  • Loading branch information
ypo committed Dec 7, 2023
1 parent 14a18a5 commit 0680c5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sender/fdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl Fdt {
self.complete = Some(true)
}

fn to_xml(&self, now: SystemTime) -> Result<Vec<u8>> {
pub fn to_xml(&self, now: SystemTime) -> Result<Vec<u8>> {
let mut buffer = ToFmtWrite(Vec::new());
let mut writer = quick_xml::Writer::new_with_indent(&mut buffer, b' ', 2);

Expand Down Expand Up @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions src/sender/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ impl Sender {
self.fdt.allocate_toi()
}

/// Convert current FDT to XML
pub fn fdt_xml_data(&self, now: SystemTime) -> Result<Vec<u8>> {
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
Expand Down

0 comments on commit 0680c5b

Please sign in to comment.