Merge remote-tracking branch 'origin/main' into request-reply-messaging-mode-tree
This commit is contained in:
commit
3455a2500f
@ -12,7 +12,6 @@ use std::sync::{Arc, Mutex};
|
|||||||
use satrs::mode::{ModeAndSubmode, ModeProvider, ModeReply, ModeRequest, ModeRequestHandler};
|
use satrs::mode::{ModeAndSubmode, ModeProvider, ModeReply, ModeRequest, ModeRequestHandler};
|
||||||
use satrs::pus::{EcssTmSenderCore, PusTmVariant};
|
use satrs::pus::{EcssTmSenderCore, PusTmVariant};
|
||||||
use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId};
|
use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId};
|
||||||
use satrs::ComponentId;
|
|
||||||
use satrs_example::config::components::PUS_MODE_SERVICE;
|
use satrs_example::config::components::PUS_MODE_SERVICE;
|
||||||
|
|
||||||
use crate::pus::hk::{HkReply, HkReplyVariant};
|
use crate::pus::hk::{HkReply, HkReplyVariant};
|
||||||
|
@ -1,95 +1 @@
|
|||||||
pub mod mgm;
|
pub mod mgm;
|
||||||
|
|
||||||
/*
|
|
||||||
pub struct AcsTask<VerificationReporter: VerificationReportingProvider> {
|
|
||||||
timestamp: [u8; 7],
|
|
||||||
time_provider: CdsTime<DaysLen16Bits>,
|
|
||||||
verif_reporter: VerificationReporter,
|
|
||||||
tm_sender: Box<dyn EcssTmSender>,
|
|
||||||
request_rx: mpsc::Receiver<RequestWithToken>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<VerificationReporter: VerificationReportingProvider> AcsTask<VerificationReporter> {
|
|
||||||
pub fn new(
|
|
||||||
tm_sender: impl EcssTmSender,
|
|
||||||
request_rx: mpsc::Receiver<RequestWithToken>,
|
|
||||||
verif_reporter: VerificationReporter,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
|
||||||
timestamp: [0; 7],
|
|
||||||
time_provider: CdsTime::new_with_u16_days(0, 0),
|
|
||||||
verif_reporter,
|
|
||||||
tm_sender: Box::new(tm_sender),
|
|
||||||
request_rx,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_hk_request(&mut self, target_id: u32, unique_id: u32) {
|
|
||||||
assert_eq!(target_id, RequestTargetId::AcsSubsystem as u32);
|
|
||||||
if unique_id == AcsHkIds::TestMgmSet as u32 {
|
|
||||||
let mut sp_header = SpHeader::tm(PUS_APID, SequenceFlags::Unsegmented, 0, 0).unwrap();
|
|
||||||
let sec_header = PusTmSecondaryHeader::new_simple(
|
|
||||||
3,
|
|
||||||
HkSubservice::TmHkPacket as u8,
|
|
||||||
&self.timestamp,
|
|
||||||
);
|
|
||||||
let mut buf: [u8; 8] = [0; 8];
|
|
||||||
let hk_id = HkUniqueId::new(target_id, unique_id);
|
|
||||||
hk_id.write_to_be_bytes(&mut buf).unwrap();
|
|
||||||
let pus_tm = PusTmCreator::new(&mut sp_header, sec_header, &buf, true);
|
|
||||||
self.tm_sender
|
|
||||||
.send_tm(PusTmWrapper::Direct(pus_tm))
|
|
||||||
.expect("Sending HK TM failed");
|
|
||||||
}
|
|
||||||
// TODO: Verification failure for invalid unique IDs.
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn try_reading_one_request(&mut self) -> bool {
|
|
||||||
match self.request_rx.try_recv() {
|
|
||||||
Ok(request) => {
|
|
||||||
info!(
|
|
||||||
"ACS thread: Received HK request {:?}",
|
|
||||||
request.targeted_request
|
|
||||||
);
|
|
||||||
let target_and_apid_id = TargetAndApidId::from(request.targeted_request.target_id);
|
|
||||||
match request.targeted_request.request {
|
|
||||||
Request::Hk(hk_req) => match hk_req {
|
|
||||||
HkRequest::OneShot(unique_id) => {
|
|
||||||
self.handle_hk_request(target_and_apid_id.target, unique_id)
|
|
||||||
}
|
|
||||||
HkRequest::Enable(_) => {}
|
|
||||||
HkRequest::Disable(_) => {}
|
|
||||||
HkRequest::ModifyCollectionInterval(_, _) => {}
|
|
||||||
},
|
|
||||||
Request::Mode(_mode_req) => {
|
|
||||||
warn!("mode request handling not implemented yet")
|
|
||||||
}
|
|
||||||
Request::Action(_action_req) => {
|
|
||||||
warn!("action request handling not implemented yet")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.verif_reporter
|
|
||||||
.completion_success(request.token, &self.timestamp)
|
|
||||||
.expect("Sending completion success failed");
|
|
||||||
true
|
|
||||||
}
|
|
||||||
Err(e) => match e {
|
|
||||||
TryRecvError::Empty => false,
|
|
||||||
TryRecvError::Disconnected => {
|
|
||||||
warn!("ACS thread: Message Queue TX disconnected!");
|
|
||||||
false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn periodic_operation(&mut self) {
|
|
||||||
update_time(&mut self.time_provider, &mut self.timestamp);
|
|
||||||
loop {
|
|
||||||
if !self.try_reading_one_request() {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
@ -28,8 +28,8 @@ features = ["full"]
|
|||||||
trybuild = { version = "1", features = ["diff"] }
|
trybuild = { version = "1", features = ["diff"] }
|
||||||
|
|
||||||
[dev-dependencies.satrs-shared]
|
[dev-dependencies.satrs-shared]
|
||||||
path = "../../satrs-shared"
|
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
path = "../../satrs-shared"
|
||||||
|
|
||||||
[dev-dependencies.satrs-mib]
|
[dev-dependencies.satrs-mib]
|
||||||
path = ".."
|
path = ".."
|
||||||
|
@ -1006,16 +1006,6 @@ pub mod alloc_mod {
|
|||||||
token: VerificationToken<TcStateAccepted>,
|
token: VerificationToken<TcStateAccepted>,
|
||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
) -> Result<VerificationToken<TcStateStarted>, EcssTmtcError> {
|
) -> Result<VerificationToken<TcStateStarted>, EcssTmtcError> {
|
||||||
/*
|
|
||||||
let seq_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
let msg_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
*/
|
|
||||||
let mut buf = self.source_data_buf.borrow_mut();
|
let mut buf = self.source_data_buf.borrow_mut();
|
||||||
let (tm_creator, started_token) = self
|
let (tm_creator, started_token) = self
|
||||||
.reporter_creator
|
.reporter_creator
|
||||||
@ -1023,7 +1013,6 @@ pub mod alloc_mod {
|
|||||||
.map_err(PusError::ByteConversion)?;
|
.map_err(PusError::ByteConversion)?;
|
||||||
sender.send_tm(sender_id, PusTmVariant::Direct(tm_creator))?;
|
sender.send_tm(sender_id, PusTmVariant::Direct(tm_creator))?;
|
||||||
Ok(started_token)
|
Ok(started_token)
|
||||||
//self.reporter.send_start_success(sendable, sender)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 4\] packet, see 8.1.2.4 of the PUS standard.
|
/// Package and send a PUS TM\[1, 4\] packet, see 8.1.2.4 of the PUS standard.
|
||||||
@ -1037,16 +1026,6 @@ pub mod alloc_mod {
|
|||||||
token: VerificationToken<TcStateAccepted>,
|
token: VerificationToken<TcStateAccepted>,
|
||||||
params: FailParams,
|
params: FailParams,
|
||||||
) -> Result<(), EcssTmtcError> {
|
) -> Result<(), EcssTmtcError> {
|
||||||
/*
|
|
||||||
let seq_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
let msg_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
*/
|
|
||||||
let mut buf = self.source_data_buf.borrow_mut();
|
let mut buf = self.source_data_buf.borrow_mut();
|
||||||
let sendable = self
|
let sendable = self
|
||||||
.reporter_creator
|
.reporter_creator
|
||||||
@ -1067,17 +1046,6 @@ pub mod alloc_mod {
|
|||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
step: impl EcssEnumeration,
|
step: impl EcssEnumeration,
|
||||||
) -> Result<(), EcssTmtcError> {
|
) -> Result<(), EcssTmtcError> {
|
||||||
/*
|
|
||||||
let seq_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
let msg_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
|
|
||||||
*/
|
|
||||||
let mut buf = self.source_data_buf.borrow_mut();
|
let mut buf = self.source_data_buf.borrow_mut();
|
||||||
let sendable = self
|
let sendable = self
|
||||||
.reporter_creator
|
.reporter_creator
|
||||||
@ -1098,17 +1066,6 @@ pub mod alloc_mod {
|
|||||||
token: VerificationToken<TcStateStarted>,
|
token: VerificationToken<TcStateStarted>,
|
||||||
params: FailParamsWithStep,
|
params: FailParamsWithStep,
|
||||||
) -> Result<(), EcssTmtcError> {
|
) -> Result<(), EcssTmtcError> {
|
||||||
/*
|
|
||||||
let seq_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
let msg_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
|
|
||||||
*/
|
|
||||||
let mut buf = self.source_data_buf.borrow_mut();
|
let mut buf = self.source_data_buf.borrow_mut();
|
||||||
let sendable = self
|
let sendable = self
|
||||||
.reporter_creator
|
.reporter_creator
|
||||||
@ -1129,17 +1086,6 @@ pub mod alloc_mod {
|
|||||||
token: VerificationToken<TcState>,
|
token: VerificationToken<TcState>,
|
||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
) -> Result<(), EcssTmtcError> {
|
) -> Result<(), EcssTmtcError> {
|
||||||
/*
|
|
||||||
let seq_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
let msg_count = self
|
|
||||||
.seq_count_provider
|
|
||||||
.as_ref()
|
|
||||||
.map_or(0, |v| v.get_and_increment());
|
|
||||||
|
|
||||||
*/
|
|
||||||
let mut buf = self.source_data_buf.borrow_mut();
|
let mut buf = self.source_data_buf.borrow_mut();
|
||||||
let sendable = self
|
let sendable = self
|
||||||
.reporter_creator
|
.reporter_creator
|
||||||
|
Loading…
Reference in New Issue
Block a user