diff --git a/satrs-core/src/tmtc/ccsds_distrib.rs b/satrs-core/src/tmtc/ccsds_distrib.rs index fa6e143..8934a90 100644 --- a/satrs-core/src/tmtc/ccsds_distrib.rs +++ b/satrs-core/src/tmtc/ccsds_distrib.rs @@ -148,7 +148,8 @@ impl ReceivesTc for CcsdsDistributor { }), )); } - let (sp_header, _) = SpHeader::from_be_bytes(tc_raw).map_err(|e| CcsdsError::PacketError(e))?; + let (sp_header, _) = + SpHeader::from_be_bytes(tc_raw).map_err(|e| CcsdsError::PacketError(e))?; self.dispatch_ccsds(&sp_header, tc_raw) } } diff --git a/satrs-core/src/tmtc/tm_helper.rs b/satrs-core/src/tmtc/tm_helper.rs index 4c28381..88deea7 100644 --- a/satrs-core/src/tmtc/tm_helper.rs +++ b/satrs-core/src/tmtc/tm_helper.rs @@ -1,4 +1,5 @@ -use spacepackets::time::{CdsShortTimeProvider, TimeWriter}; +use spacepackets::time::cds::TimeProvider; +use spacepackets::time::TimeWriter; use spacepackets::tm::{PusTm, PusTmSecondaryHeader}; use spacepackets::SpHeader; @@ -22,7 +23,7 @@ impl PusTmWithCdsShortHelper { subservice: u8, source_data: Option<&'a [u8]>, ) -> PusTm { - let time_stamp = CdsShortTimeProvider::from_now().unwrap(); + let time_stamp = TimeProvider::from_now_with_u16_days().unwrap(); time_stamp.write_to_bytes(&mut self.cds_short_buf).unwrap(); self.create_pus_tm_common(service, subservice, source_data) } @@ -32,7 +33,7 @@ impl PusTmWithCdsShortHelper { service: u8, subservice: u8, source_data: Option<&'a [u8]>, - stamper: &CdsShortTimeProvider, + stamper: &TimeProvider, ) -> PusTm { stamper.write_to_bytes(&mut self.cds_short_buf).unwrap(); self.create_pus_tm_common(service, subservice, source_data) diff --git a/satrs-example/src/main.rs b/satrs-example/src/main.rs index efb6628..c955507 100644 --- a/satrs-example/src/main.rs +++ b/satrs-example/src/main.rs @@ -20,7 +20,8 @@ use satrs_core::pus::{EcssTmError, EcssTmSender}; use satrs_core::seq_count::SimpleSeqCountProvider; use satrs_core::tmtc::CcsdsError; use satrs_example::{OBSW_SERVER_ADDR, SERVER_PORT}; -use spacepackets::time::{CdsShortTimeProvider, TimeWriter}; +use spacepackets::time::cds::TimeProvider; +use spacepackets::time::TimeWriter; use spacepackets::tm::PusTm; use std::net::{IpAddr, SocketAddr}; use std::sync::mpsc::channel; @@ -132,7 +133,7 @@ fn main() { let jh2 = thread::spawn(move || { let mut timestamp: [u8; 7] = [0; 7]; let mut sender = EventTmSender::new(tm_store_helper, tm_funnel_tx); - let mut time_provider = CdsShortTimeProvider::new(0, 0); + let mut time_provider = TimeProvider::new_with_u16_days(0, 0); let mut report_completion = |event_req: EventRequestWithToken, timestamp: &[u8]| { reporter1 .completion_success(event_req.token, timestamp) @@ -171,7 +172,7 @@ fn main() { jh2.join().expect("Joining Event Manager thread failed"); } -pub fn update_time(time_provider: &mut CdsShortTimeProvider, timestamp: &mut [u8]) { +pub fn update_time(time_provider: &mut TimeProvider, timestamp: &mut [u8]) { time_provider .update_from_now() .expect("Could not get current time"); diff --git a/satrs-example/src/pus.rs b/satrs-example/src/pus.rs index 41c7879..20ba72a 100644 --- a/satrs-example/src/pus.rs +++ b/satrs-example/src/pus.rs @@ -12,7 +12,8 @@ use satrs_core::tmtc::PusServiceProvider; use satrs_example::{INVALID_PUS_SERVICE, INVALID_PUS_SUBSERVICE, NOT_ENOUGH_APP_DATA}; use spacepackets::ecss::PusPacket; use spacepackets::tc::PusTc; -use spacepackets::time::{CdsShortTimeProvider, TimeWriter}; +use spacepackets::time::cds::TimeProvider; +use spacepackets::time::TimeWriter; use spacepackets::SpHeader; use std::sync::mpsc; @@ -22,7 +23,7 @@ pub struct PusReceiver { pub tm_store: TmStore, pub verif_reporter: StdVerifReporterWithSender, event_request_tx: mpsc::Sender, - stamper: CdsShortTimeProvider, + stamper: TimeProvider, time_stamp: [u8; 7], } @@ -40,7 +41,7 @@ impl PusReceiver { tm_store, verif_reporter, event_request_tx, - stamper: CdsShortTimeProvider::default(), + stamper: TimeProvider::default(), time_stamp: [0; 7], } } diff --git a/spacepackets b/spacepackets index 038755e..4d64394 160000 --- a/spacepackets +++ b/spacepackets @@ -1 +1 @@ -Subproject commit 038755e56eb4f43f5959687180fa98c80cd16b59 +Subproject commit 4d643946373a86b45e71d6cda0d535e29005f9ba