new resultcode module
This commit is contained in:
parent
c00270aa7a
commit
76245cb55f
@ -29,5 +29,6 @@ pub mod params;
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
|
||||
pub mod pool;
|
||||
pub mod pus;
|
||||
pub mod resultcode;
|
||||
pub mod seq_count;
|
||||
pub mod tmtc;
|
||||
|
36
satrs-core/src/resultcode.rs
Normal file
36
satrs-core/src/resultcode.rs
Normal file
@ -0,0 +1,36 @@
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub struct ResultU16 {
|
||||
group_id: u8,
|
||||
unique_id: u8,
|
||||
}
|
||||
|
||||
impl ResultU16 {
|
||||
pub const fn const_new(group_id: u8, unique_id: u8) -> Self {
|
||||
Self {
|
||||
group_id,
|
||||
unique_id,
|
||||
}
|
||||
}
|
||||
pub fn raw(&self) -> u16 {
|
||||
((self.group_id as u16) << 8) | self.unique_id as u16
|
||||
}
|
||||
pub fn group_id(&self) -> u8 {
|
||||
self.group_id
|
||||
}
|
||||
pub fn unique_id(&self) -> u8 {
|
||||
self.unique_id
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ResultU16Ext {
|
||||
pub name: &'static str,
|
||||
pub result: ResultU16,
|
||||
pub info: &'static str,
|
||||
}
|
||||
|
||||
impl ResultU16Ext {
|
||||
pub const fn const_new(name: &'static str, result: ResultU16, info: &'static str) -> Self {
|
||||
Self { name, result, info }
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
|
Loading…
x
Reference in New Issue
Block a user