2016-10-05 13:59:38 +08:00
|
|
|
use std::io::{self, Write};
|
|
|
|
use proto::*;
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Header {
|
|
|
|
pub sent_bytes: u32,
|
|
|
|
pub total_byte_count: u64,
|
|
|
|
pub overflow_occurred: bool,
|
|
|
|
pub log_channel: u8,
|
|
|
|
pub dds_onehot_sel: bool
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Header {
|
|
|
|
pub fn write_to(&self, writer: &mut Write) -> io::Result<()> {
|
2017-02-01 06:18:59 +08:00
|
|
|
write_u32(writer, self.sent_bytes)?;
|
|
|
|
write_u64(writer, self.total_byte_count)?;
|
|
|
|
write_u8(writer, self.overflow_occurred as u8)?;
|
|
|
|
write_u8(writer, self.log_channel)?;
|
|
|
|
write_u8(writer, self.dds_onehot_sel as u8)?;
|
2016-10-05 13:59:38 +08:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|