Merge remote-tracking branch 'origin/main' into TargetIdWithApid
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use derive_new::new;
|
||||
use zerocopy::AsBytes;
|
||||
use satrs_example::TargetIdWithApid;
|
||||
use zerocopy::AsBytes;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum AcsHkIds {
|
||||
@ -33,7 +33,11 @@ impl HkUniqueId {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn bytes_from_target_id_with_apid(&self, buf: &mut [u8], target_id: TargetIdWithApid) -> Result<(), ()> {
|
||||
pub fn bytes_from_target_id_with_apid(
|
||||
&self,
|
||||
buf: &mut [u8],
|
||||
target_id: TargetIdWithApid,
|
||||
) -> Result<(), ()> {
|
||||
self.bytes_from_target_id(buf, target_id.target)
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
use delegate::delegate;
|
||||
use derive_new::new;
|
||||
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||
use satrs_core::events::{EventU32TypedSev, SeverityInfo};
|
||||
use satrs_core::objects::ObjectId;
|
||||
use satrs_core::spacepackets::ecss::tc::{GenericPusTcSecondaryHeader, IsPusTelecommand, PusTc};
|
||||
use satrs_core::spacepackets::ecss::tc::IsPusTelecommand;
|
||||
use satrs_core::spacepackets::ecss::PusPacket;
|
||||
use satrs_core::spacepackets::{ByteConversionError, CcsdsPacket, SizeMissmatch};
|
||||
use satrs_core::spacepackets::{ByteConversionError, CcsdsPacket};
|
||||
use satrs_core::tmtc::TargetId;
|
||||
use std::fmt;
|
||||
use std::net::Ipv4Addr;
|
||||
@ -13,9 +12,6 @@ use thiserror::Error;
|
||||
|
||||
use satrs_mib::res_code::{ResultU16, ResultU16Info};
|
||||
use satrs_mib::resultcode;
|
||||
|
||||
//pub mod can;
|
||||
//mod can_ids;
|
||||
mod logger;
|
||||
|
||||
pub type Apid = u16;
|
||||
@ -55,13 +51,12 @@ impl TargetIdWithApid {
|
||||
tc: &(impl CcsdsPacket + PusPacket + IsPusTelecommand),
|
||||
) -> Result<Self, TargetIdCreationError> {
|
||||
if tc.user_data().len() < 4 {
|
||||
return Err(ByteConversionError::FromSliceTooSmall(SizeMissmatch {
|
||||
return Err(ByteConversionError::FromSliceTooSmall {
|
||||
found: tc.user_data().len(),
|
||||
expected: 8,
|
||||
})
|
||||
}
|
||||
.into());
|
||||
}
|
||||
let target_id = u32::from_be_bytes(tc.user_data()[0..4].try_into().unwrap());
|
||||
Ok(Self {
|
||||
apid: tc.apid(),
|
||||
target: u32::from_be_bytes(tc.user_data()[0..4].try_into().unwrap()),
|
||||
|
@ -419,7 +419,9 @@ fn main() {
|
||||
let mut buf: [u8; 8] = [0; 8];
|
||||
|
||||
let hk_id = HkUniqueId::new(1);
|
||||
hk_id.bytes_from_target_id_with_apid(&mut buf, target).unwrap();
|
||||
hk_id
|
||||
.bytes_from_target_id_with_apid(&mut buf, target)
|
||||
.unwrap();
|
||||
let pus_tm = PusTmCreator::new(
|
||||
&mut sp_header,
|
||||
sec_header,
|
||||
|
Reference in New Issue
Block a user