appears to work now
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
This commit is contained in:
parent
d0e6ccdaa3
commit
d5722b7f39
@ -68,8 +68,8 @@ optional = true
|
|||||||
[dependencies.spacepackets]
|
[dependencies.spacepackets]
|
||||||
version = "0.7.0-beta.1"
|
version = "0.7.0-beta.1"
|
||||||
# path = "../../spacepackets"
|
# path = "../../spacepackets"
|
||||||
# git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
||||||
# rev = ""
|
rev = "79d26e1a6"
|
||||||
# branch = ""
|
# branch = ""
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
|
@ -2,36 +2,59 @@
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
|
use spacepackets::PacketId;
|
||||||
|
|
||||||
use crate::tmtc::ReceivesTc;
|
use crate::tmtc::ReceivesTc;
|
||||||
|
|
||||||
pub trait PacketIdLookup {
|
pub trait PacketIdLookup {
|
||||||
fn validate(&self, apid: u16) -> bool;
|
fn validate(&self, packet_id: u16) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
impl PacketIdLookup for Vec<u16> {
|
impl PacketIdLookup for Vec<u16> {
|
||||||
fn validate(&self, apid: u16) -> bool {
|
fn validate(&self, packet_id: u16) -> bool {
|
||||||
self.contains(&apid)
|
self.contains(&packet_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "alloc")]
|
||||||
|
impl PacketIdLookup for Vec<PacketId> {
|
||||||
|
fn validate(&self, packet_id: u16) -> bool {
|
||||||
|
self.contains(&PacketId::from(packet_id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
impl PacketIdLookup for HashSet<u16> {
|
impl PacketIdLookup for HashSet<u16> {
|
||||||
fn validate(&self, apid: u16) -> bool {
|
fn validate(&self, packet_id: u16) -> bool {
|
||||||
self.contains(&apid)
|
self.contains(&packet_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "alloc")]
|
||||||
|
impl PacketIdLookup for HashSet<PacketId> {
|
||||||
|
fn validate(&self, packet_id: u16) -> bool {
|
||||||
|
self.contains(&PacketId::from(packet_id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PacketIdLookup for &[u16] {
|
impl PacketIdLookup for &[u16] {
|
||||||
fn validate(&self, apid: u16) -> bool {
|
fn validate(&self, packet_id: u16) -> bool {
|
||||||
if self.binary_search(&apid).is_ok() {
|
if self.binary_search(&packet_id).is_ok() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PacketIdLookup for &[PacketId] {
|
||||||
|
fn validate(&self, packet_id: u16) -> bool {
|
||||||
|
if self.binary_search(&PacketId::from(packet_id)).is_ok() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
/// This function parses a given buffer for tightly packed CCSDS space packets. It uses the
|
/// This function parses a given buffer for tightly packed CCSDS space packets. It uses the
|
||||||
/// [PacketId] field of the CCSDS packets to detect the start of a CCSDS space packet and then
|
/// [PacketId] field of the CCSDS packets to detect the start of a CCSDS space packet and then
|
||||||
/// uses the length field of the packet to extract CCSDS packets.
|
/// uses the length field of the packet to extract CCSDS packets.
|
||||||
|
Loading…
Reference in New Issue
Block a user