TargetIdWithApid #63
@ -17,8 +17,6 @@ zerocopy = "0.6"
|
||||
csv = "1"
|
||||
num_enum = "0.7"
|
||||
thiserror = "1"
|
||||
embedded-can = "0.4"
|
||||
#socketcan = "2.0"
|
||||
derive-new = "0.5"
|
||||
num-traits = "0.2"
|
||||
num-derive = "0.3"
|
||||
|
@ -1,6 +1,5 @@
|
||||
use derive_new::new;
|
||||
use satrs_example::TargetIdWithApid;
|
||||
use zerocopy::AsBytes;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum AcsHkIds {
|
||||
@ -19,6 +18,7 @@ impl From<u32> for HkUniqueId {
|
||||
}
|
||||
|
||||
impl HkUniqueId {
|
||||
#[allow(dead_code)]
|
||||
pub fn id(&self) -> u32 {
|
||||
self.id
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ use thiserror::Error;
|
||||
|
||||
use satrs_mib::res_code::{ResultU16, ResultU16Info};
|
||||
use satrs_mib::resultcode;
|
||||
mod logger;
|
||||
|
||||
pub type Apid = u16;
|
||||
|
||||
@ -64,37 +63,6 @@ impl TargetIdWithApid {
|
||||
}
|
||||
}
|
||||
|
||||
// #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, new)]
|
||||
// #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
// pub struct TargetIdWithUniqueId {
|
||||
// target_id: TargetIdWithApid,
|
||||
// unique_id: u32,
|
||||
// }
|
||||
//
|
||||
// impl TargetIdWithUniqueId {
|
||||
// delegate! {
|
||||
// to self.target_id {
|
||||
// pub fn apid(&self) -> Apid;
|
||||
// pub fn target_id(&self) -> TargetId;
|
||||
// }
|
||||
// }
|
||||
// pub fn unique_id(&self) -> u32 {
|
||||
// self.unique_id
|
||||
// }
|
||||
//
|
||||
// pub fn write_target_id_and_unique_id_as_pus_header(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
||||
// if buf.len() < 8 {
|
||||
// return Err(ByteConversionError::ToSliceTooSmall(SizeMissmatch {
|
||||
// found: buf.len(),
|
||||
// expected: 8,
|
||||
// }));
|
||||
// }
|
||||
// buf[0..4].copy_from_slice(&self.target_id.target_id().to_be_bytes());
|
||||
// buf[4..8].copy_from_slice(&self.unique_id.to_be_bytes());
|
||||
// Ok(8)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
pub const PUS_APID: u16 = 0x02;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, TryFromPrimitive, IntoPrimitive)]
|
||||
|
@ -1,8 +1,3 @@
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use chrono;
|
||||
use log::{debug, error, info, trace, warn};
|
||||
|
||||
pub fn setup_logger() -> Result<(), fern::InitError> {
|
||||
fern::Dispatch::new()
|
||||
.format(|out, message, record| {
|
||||
|
@ -1,16 +0,0 @@
|
||||
pub fn setup_logger() -> Result<(), fern::InitError> {
|
||||
fern::Dispatch::new()
|
||||
.format(|out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"{}[{}][{}] {}",
|
||||
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
||||
record.target(), //(std::thread::current().name().expect("unnamed_thread"),
|
||||
record.level(),
|
||||
message
|
||||
))
|
||||
})
|
||||
.level(log::LevelFilter::Debug)
|
||||
.chain(std::io::stdout())
|
||||
.apply()?;
|
||||
Ok(())
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
mod ccsds;
|
||||
mod hk;
|
||||
mod logging;
|
||||
mod logger;
|
||||
mod pus;
|
||||
mod requests;
|
||||
mod tcp;
|
||||
@ -12,9 +12,8 @@ use satrs_core::hal::std::tcp_server::ServerConfig;
|
||||
use satrs_core::hal::std::udp_server::UdpTcServer;
|
||||
|
||||
use crate::ccsds::CcsdsReceiver;
|
||||
use crate::hk::AcsHkIds;
|
||||
use crate::hk::{AcsHkIds, HkUniqueId};
|
||||
use crate::logging::setup_logger;
|
||||
use crate::logger::setup_logger;
|
||||
use crate::pus::action::{Pus8Wrapper, PusService8ActionHandler};
|
||||
use crate::pus::event::Pus5Wrapper;
|
||||
use crate::pus::hk::{Pus3Wrapper, PusService3HkHandler};
|
||||
@ -51,7 +50,7 @@ use satrs_core::spacepackets::{
|
||||
SpHeader,
|
||||
};
|
||||
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
||||
use satrs_core::tmtc::TargetId;
|
||||
use satrs_core::tmtc::{CcsdsDistributor, TargetId};
|
||||
use satrs_core::ChannelId;
|
||||
use satrs_example::{
|
||||
RequestTargetId, TargetIdWithApid, TcReceiverId, TmSenderId, OBSW_SERVER_ADDR, PUS_APID,
|
||||
@ -465,7 +464,7 @@ fn main() {
|
||||
);
|
||||
let mut buf: [u8; 8] = [0; 8];
|
||||
|
||||
let hk_id = HkUniqueId::new(1);
|
||||
let hk_id = HkUniqueId::new(unique_id);
|
||||
hk_id
|
||||
.bytes_from_target_id_with_apid(&mut buf, target)
|
||||
.unwrap();
|
||||
|
@ -10,7 +10,6 @@ use satrs_core::pus::{
|
||||
};
|
||||
use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
||||
use satrs_core::spacepackets::ecss::PusPacket;
|
||||
use satrs_core::tmtc::TargetId;
|
||||
use satrs_example::{tmtc_err, TargetIdWithApid};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::requests::{Request, RequestWithToken};
|
||||
use log::{error, warn};
|
||||
use satrs_core::hk::{CollectionIntervalFactor, HkRequest, UniqueId};
|
||||
use satrs_core::hk::{CollectionIntervalFactor, HkRequest};
|
||||
use satrs_core::pool::{SharedPool, StoreAddr};
|
||||
use satrs_core::pus::verification::{
|
||||
FailParams, StdVerifReporterWithSender, TcStateAccepted, VerificationToken,
|
||||
@ -11,7 +11,6 @@ use satrs_core::pus::{
|
||||
};
|
||||
use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
||||
use satrs_core::spacepackets::ecss::{hk, PusPacket};
|
||||
use satrs_core::tmtc::TargetId;
|
||||
use satrs_example::{hk_err, tmtc_err, TargetIdWithApid};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
@ -2,7 +2,6 @@ use derive_new::new;
|
||||
use satrs_core::hk::HkRequest;
|
||||
use satrs_core::mode::ModeRequest;
|
||||
use satrs_core::pus::verification::{TcStateAccepted, VerificationToken};
|
||||
use satrs_core::tmtc::TargetId;
|
||||
use satrs_example::TargetIdWithApid;
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
Loading…
Reference in New Issue
Block a user