- Add new shared subcrate satrs-shared to split off some shared components not expected to change very often. - Renmame `satrs-core` to `satrs`. It is expected that sat-rs will remain the primary crate, so the core information is superfluous, and core also implies stability, which will not be the case for some time.
This commit is contained in:
Cargo.tomlREADME.md
automation
satrs-example
Cargo.toml
src
satrs-mib
satrs-shared
satrs
.gitignoreCHANGELOG.mdCargo.tomlLICENSE-APACHENOTICEREADME.mdrelease-checklist.md
src
cfdp
device.rsencoding
event_man.rsevents.rsexecutable.rshal
hk.rslib.rsmode.rsobjects.rsparams.rspool.rspower.rspus
event.rsevent_man.rsevent_srv.rshk.rsmod.rsmode.rsscheduler.rsscheduler_srv.rstest.rsverification.rs
request.rsres_code.rsseq_count.rstmtc
tests
40
satrs/src/encoding/mod.rs
Normal file
40
satrs/src/encoding/mod.rs
Normal file
@ -0,0 +1,40 @@
|
||||
pub mod ccsds;
|
||||
pub mod cobs;
|
||||
|
||||
pub use crate::encoding::ccsds::parse_buffer_for_ccsds_space_packets;
|
||||
pub use crate::encoding::cobs::{encode_packet_with_cobs, parse_buffer_for_cobs_encoded_packets};
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
use alloc::{collections::VecDeque, vec::Vec};
|
||||
|
||||
use crate::tmtc::ReceivesTcCore;
|
||||
|
||||
use super::cobs::encode_packet_with_cobs;
|
||||
|
||||
pub(crate) const SIMPLE_PACKET: [u8; 5] = [1, 2, 3, 4, 5];
|
||||
pub(crate) const INVERTED_PACKET: [u8; 5] = [5, 4, 3, 2, 1];
|
||||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct TcCacher {
|
||||
pub(crate) tc_queue: VecDeque<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl ReceivesTcCore for TcCacher {
|
||||
type Error = ();
|
||||
|
||||
fn pass_tc(&mut self, tc_raw: &[u8]) -> Result<(), Self::Error> {
|
||||
self.tc_queue.push_back(tc_raw.to_vec());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn encode_simple_packet(encoded_buf: &mut [u8], current_idx: &mut usize) {
|
||||
encode_packet_with_cobs(&SIMPLE_PACKET, encoded_buf, current_idx);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn encode_inverted_packet(encoded_buf: &mut [u8], current_idx: &mut usize) {
|
||||
encode_packet_with_cobs(&INVERTED_PACKET, encoded_buf, current_idx);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user