Skip to main content

Crate xtce_decode

Crate xtce_decode 

Source
Expand description

Decode CCSDS telemetry packets against an XTCE definition.

use xtce_decode::{Decoder, ccsds::PacketIter};
use xtce_model::XtceDb;

let db = XtceDb::from_path("definition.xml")?;
let decoder = Decoder::new(&db)?;

let stream = std::fs::read("telemetry.bin")?;
for packet in PacketIter::new(&stream, 0) {
    let decoded = decoder.decode(packet?.bytes())?;
    for (name, value) in decoded.iter_named() {
        println!("{name} = {} (raw {})", value.eng, value.raw);
    }
}

§Guarantees

  • No panics. Every failure is a DecodeError. A corrupt or hostile packet must not take down a process sitting on a live downlink, so the library code denies unwrap, expect and panic! outright.
  • No allocation for aligned reads. Byte-aligned binary and string fields borrow straight from the packet.
  • Raw and engineering values are both kept. XTCE treats them as distinct, restriction criteria may test either, and differential testing needs both.

Re-exports§

pub use bits::BitCursor;
pub use bits::BitError;
pub use ccsds::FramingError;
pub use ccsds::PacketIter;
pub use ccsds::PacketReadError;
pub use ccsds::PacketReader;
pub use ccsds::SpacePacketBytes;
pub use error::DecodeError;
pub use value::DecodedPacket;
pub use value::EngValue;
pub use value::ParameterValue;
pub use value::RawValue;

Modules§

bits
MSB-first bit cursor over a byte slice.
calibrate
Calibrators: raw encoded value to engineering value.
ccsds
CCSDS Space Packet framing.
charset
Text decoding for the character sets XTCE permits.
error
Decoding failures.
value
Decoded parameter values.

Structs§

Decoder
Decodes packets against one XTCE database, starting from one root container.