I don't think channel IDs are required anymore
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
This commit is contained in:
parent
f5e56c5bf8
commit
73291908f6
74
satrs-example/src/acs/mgm.rs
Normal file
74
satrs-example/src/acs/mgm.rs
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
use std::sync::mpsc::{self};
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
use satrs::mode::{ModeAndSubmode, ModeProvider, ModeReply, ModeRequest, ModeRequestHandler};
|
||||||
|
use satrs::pus::EcssTmSenderCore;
|
||||||
|
use satrs::request::GenericMessage;
|
||||||
|
use satrs::ComponentId;
|
||||||
|
|
||||||
|
use crate::pus::hk::HkReply;
|
||||||
|
use crate::requests::RequestWithToken;
|
||||||
|
|
||||||
|
pub trait SpiInterface {
|
||||||
|
type Error;
|
||||||
|
fn transfer(&mut self, data: &mut [u8]) -> Result<(), Self::Error>;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
pub struct MgmData {
|
||||||
|
pub x: f32,
|
||||||
|
pub y: f32,
|
||||||
|
pub z: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MgmHandler<ComInterface: SpiInterface, TmSender: EcssTmSenderCore> {
|
||||||
|
id: ComponentId,
|
||||||
|
dev_str: &'static str,
|
||||||
|
mode_request_receiver: mpsc::Receiver<GenericMessage<ModeRequest>>,
|
||||||
|
mode_reply_sender_to_pus: mpsc::Sender<GenericMessage<ModeReply>>,
|
||||||
|
mode_reply_sender_to_parent: mpsc::Sender<GenericMessage<ModeReply>>,
|
||||||
|
composite_request_receiver: mpsc::Receiver<RequestWithToken>,
|
||||||
|
hk_reply_sender: mpsc::Sender<GenericMessage<HkReply>>,
|
||||||
|
hk_tm_sender: TmSender,
|
||||||
|
mode: ModeAndSubmode,
|
||||||
|
spi_interface: ComInterface,
|
||||||
|
shared_mgm_set: Arc<Mutex<MgmData>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<ComInterface: SpiInterface, TmSender: EcssTmSenderCore> MgmHandler<ComInterface, TmSender> {
|
||||||
|
pub fn perform_operation(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<ComInterface: SpiInterface, TmSender: EcssTmSenderCore> ModeProvider
|
||||||
|
for MgmHandler<ComInterface, TmSender>
|
||||||
|
{
|
||||||
|
fn mode_and_submode(&self) -> ModeAndSubmode {
|
||||||
|
self.mode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<ComInterface: SpiInterface, TmSender: EcssTmSenderCore> ModeRequestHandler
|
||||||
|
for MgmHandler<ComInterface, TmSender>
|
||||||
|
{
|
||||||
|
fn start_transition(
|
||||||
|
&mut self,
|
||||||
|
request_id: satrs::request::RequestId,
|
||||||
|
sender_id: ComponentId,
|
||||||
|
mode_and_submode: ModeAndSubmode,
|
||||||
|
) -> Result<(), satrs::mode::ModeError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn announce_mode(
|
||||||
|
&self,
|
||||||
|
request_id: satrs::request::RequestId,
|
||||||
|
sender_id: satrs::ComponentId,
|
||||||
|
recursive: bool,
|
||||||
|
) {
|
||||||
|
log::info!("{} announcing mode: {:?}", self.dev_str, self.mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_mode_reached(&mut self) -> Result<(), satrs::queue::GenericTargetedMessagingError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
@ -1,26 +1,6 @@
|
|||||||
use std::sync::mpsc::{self, TryRecvError};
|
mod mgm;
|
||||||
|
|
||||||
use log::{info, warn};
|
|
||||||
use satrs::pus::verification::VerificationReportingProvider;
|
|
||||||
use satrs::pus::{EcssTmSender, PusTmWrapper};
|
|
||||||
use satrs::request::TargetAndApidId;
|
|
||||||
use satrs::spacepackets::ecss::hk::Subservice as HkSubservice;
|
|
||||||
use satrs::{
|
|
||||||
hk::HkRequest,
|
|
||||||
spacepackets::{
|
|
||||||
ecss::tm::{PusTmCreator, PusTmSecondaryHeader},
|
|
||||||
time::cds::{DaysLen16Bits, TimeProvider},
|
|
||||||
SequenceFlags, SpHeader,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
use satrs_example::config::{RequestTargetId, PUS_APID};
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
hk::{AcsHkIds, HkUniqueId},
|
|
||||||
requests::{Request, RequestWithToken},
|
|
||||||
update_time,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
/*
|
||||||
pub struct AcsTask<VerificationReporter: VerificationReportingProvider> {
|
pub struct AcsTask<VerificationReporter: VerificationReportingProvider> {
|
||||||
timestamp: [u8; 7],
|
timestamp: [u8; 7],
|
||||||
time_provider: TimeProvider<DaysLen16Bits>,
|
time_provider: TimeProvider<DaysLen16Bits>,
|
||||||
@ -112,3 +92,4 @@ impl<VerificationReporter: VerificationReportingProvider> AcsTask<VerificationRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
@ -94,27 +94,16 @@ pub mod hk_err {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::enum_variant_names)]
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum TmSenderId {
|
pub enum ComponentIdList {
|
||||||
PusVerification = 0,
|
PusVerification = 0,
|
||||||
PusTest = 1,
|
EventManagement = 1,
|
||||||
PusEvent = 2,
|
PusTest = 2,
|
||||||
PusHk = 3,
|
PusAction = 3,
|
||||||
PusAction = 4,
|
PusSched = 4,
|
||||||
PusSched = 5,
|
PusHk = 5,
|
||||||
AllEvents = 6,
|
|
||||||
AcsSubsystem = 7,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
|
||||||
pub enum TcReceiverId {
|
|
||||||
PusTest = 1,
|
|
||||||
PusEvent = 2,
|
|
||||||
PusHk = 3,
|
|
||||||
PusAction = 4,
|
|
||||||
PusSched = 5,
|
|
||||||
}
|
|
||||||
pub mod pool {
|
pub mod pool {
|
||||||
use super::*;
|
use super::*;
|
||||||
pub fn create_static_pools() -> (StaticMemoryPool, StaticMemoryPool) {
|
pub fn create_static_pools() -> (StaticMemoryPool, StaticMemoryPool) {
|
||||||
|
@ -14,9 +14,9 @@ use satrs::{
|
|||||||
verification::{TcStateStarted, VerificationReportingProvider, VerificationToken},
|
verification::{TcStateStarted, VerificationReportingProvider, VerificationToken},
|
||||||
EcssTmSender,
|
EcssTmSender,
|
||||||
},
|
},
|
||||||
spacepackets::time::cds::{self, TimeProvider},
|
spacepackets::time::cds::{self, TimeProvider}, ComponentId,
|
||||||
};
|
};
|
||||||
use satrs_example::config::PUS_APID;
|
use satrs_example::config::{PUS_APID, ComponentIdList};
|
||||||
|
|
||||||
use crate::update_time;
|
use crate::update_time;
|
||||||
|
|
||||||
@ -48,9 +48,9 @@ impl<VerificationReporter: VerificationReportingProvider> PusEventHandler<Verifi
|
|||||||
let pus_event_dispatcher =
|
let pus_event_dispatcher =
|
||||||
DefaultPusEventU32Dispatcher::new_with_default_backend(event_reporter);
|
DefaultPusEventU32Dispatcher::new_with_default_backend(event_reporter);
|
||||||
let pus_event_man_send_provider =
|
let pus_event_man_send_provider =
|
||||||
EventU32SenderMpscBounded::new(1, pus_event_man_tx, event_queue_cap);
|
EventU32SenderMpscBounded::new(ComponentIdList::EventManagement as ComponentId, pus_event_man_tx, event_queue_cap);
|
||||||
|
|
||||||
event_manager.subscribe_all(pus_event_man_send_provider.channel_id());
|
event_manager.subscribe_all(pus_event_man_send_provider.target_id());
|
||||||
event_manager.add_sender(pus_event_man_send_provider);
|
event_manager.add_sender(pus_event_man_send_provider);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
@ -23,11 +23,13 @@ use satrs_example::config::pool::{create_sched_tc_pool, create_static_pools};
|
|||||||
use satrs_example::config::tasks::{
|
use satrs_example::config::tasks::{
|
||||||
FREQ_MS_AOCS, FREQ_MS_EVENT_HANDLING, FREQ_MS_PUS_STACK, FREQ_MS_UDP_TMTC,
|
FREQ_MS_AOCS, FREQ_MS_EVENT_HANDLING, FREQ_MS_PUS_STACK, FREQ_MS_UDP_TMTC,
|
||||||
};
|
};
|
||||||
use satrs_example::config::{RequestTargetId, TmSenderId, OBSW_SERVER_ADDR, PUS_APID, SERVER_PORT};
|
use satrs_example::config::{
|
||||||
|
ComponentIdList, RequestTargetId, OBSW_SERVER_ADDR, PUS_APID, SERVER_PORT,
|
||||||
|
};
|
||||||
use tmtc::PusTcSourceProviderDynamic;
|
use tmtc::PusTcSourceProviderDynamic;
|
||||||
use udp::DynamicUdpTmHandler;
|
use udp::DynamicUdpTmHandler;
|
||||||
|
|
||||||
use crate::acs::AcsTask;
|
// use crate::acs::AcsTask;
|
||||||
use crate::ccsds::CcsdsReceiver;
|
use crate::ccsds::CcsdsReceiver;
|
||||||
use crate::logger::setup_logger;
|
use crate::logger::setup_logger;
|
||||||
use crate::pus::action::{create_action_service_dynamic, create_action_service_static};
|
use crate::pus::action::{create_action_service_dynamic, create_action_service_static};
|
||||||
@ -47,7 +49,7 @@ use satrs::pus::verification::{VerificationReporterCfg, VerificationReporterWith
|
|||||||
use satrs::pus::{EcssTmSender, TmAsVecSenderWithId, TmInSharedPoolSenderWithId};
|
use satrs::pus::{EcssTmSender, TmAsVecSenderWithId, TmInSharedPoolSenderWithId};
|
||||||
use satrs::spacepackets::{time::cds::TimeProvider, time::TimeWriter};
|
use satrs::spacepackets::{time::cds::TimeProvider, time::TimeWriter};
|
||||||
use satrs::tmtc::CcsdsDistributor;
|
use satrs::tmtc::CcsdsDistributor;
|
||||||
use satrs::ChannelId;
|
use satrs::ComponentId;
|
||||||
use std::net::{IpAddr, SocketAddr};
|
use std::net::{IpAddr, SocketAddr};
|
||||||
use std::sync::mpsc::{self, channel};
|
use std::sync::mpsc::{self, channel};
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
@ -77,7 +79,7 @@ fn static_tmtc_pool_main() {
|
|||||||
// Every software component which needs to generate verification telemetry, receives a cloned
|
// Every software component which needs to generate verification telemetry, receives a cloned
|
||||||
// verification reporter.
|
// verification reporter.
|
||||||
let verif_reporter = create_verification_reporter(TmInSharedPoolSenderWithId::new(
|
let verif_reporter = create_verification_reporter(TmInSharedPoolSenderWithId::new(
|
||||||
TmSenderId::PusVerification as ChannelId,
|
ComponentIdList::PusVerification as ComponentId,
|
||||||
"verif_sender",
|
"verif_sender",
|
||||||
shared_tm_pool.clone(),
|
shared_tm_pool.clone(),
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
@ -105,7 +107,7 @@ fn static_tmtc_pool_main() {
|
|||||||
// in the sat-rs documentation.
|
// in the sat-rs documentation.
|
||||||
let mut event_handler = EventHandler::new(
|
let mut event_handler = EventHandler::new(
|
||||||
TmInSharedPoolSenderWithId::new(
|
TmInSharedPoolSenderWithId::new(
|
||||||
TmSenderId::AllEvents as ChannelId,
|
ComponentIdList::EventManagement as ComponentId,
|
||||||
"ALL_EVENTS_TX",
|
"ALL_EVENTS_TX",
|
||||||
shared_tm_pool.clone(),
|
shared_tm_pool.clone(),
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
@ -209,6 +211,7 @@ fn static_tmtc_pool_main() {
|
|||||||
)
|
)
|
||||||
.expect("tcp server creation failed");
|
.expect("tcp server creation failed");
|
||||||
|
|
||||||
|
/*
|
||||||
let mut acs_task = AcsTask::new(
|
let mut acs_task = AcsTask::new(
|
||||||
TmInSharedPoolSenderWithId::new(
|
TmInSharedPoolSenderWithId::new(
|
||||||
TmSenderId::AcsSubsystem as ChannelId,
|
TmSenderId::AcsSubsystem as ChannelId,
|
||||||
@ -219,6 +222,7 @@ fn static_tmtc_pool_main() {
|
|||||||
acs_thread_rx,
|
acs_thread_rx,
|
||||||
verif_reporter,
|
verif_reporter,
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
let mut tm_funnel = TmFunnelStatic::new(
|
let mut tm_funnel = TmFunnelStatic::new(
|
||||||
shared_tm_pool,
|
shared_tm_pool,
|
||||||
@ -272,7 +276,7 @@ fn static_tmtc_pool_main() {
|
|||||||
let jh_aocs = thread::Builder::new()
|
let jh_aocs = thread::Builder::new()
|
||||||
.name("AOCS".to_string())
|
.name("AOCS".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
acs_task.periodic_operation();
|
// acs_task.periodic_operation();
|
||||||
thread::sleep(Duration::from_millis(FREQ_MS_AOCS));
|
thread::sleep(Duration::from_millis(FREQ_MS_AOCS));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -312,7 +316,7 @@ fn dyn_tmtc_pool_main() {
|
|||||||
// Every software component which needs to generate verification telemetry, gets a cloned
|
// Every software component which needs to generate verification telemetry, gets a cloned
|
||||||
// verification reporter.
|
// verification reporter.
|
||||||
let verif_reporter = create_verification_reporter(TmAsVecSenderWithId::new(
|
let verif_reporter = create_verification_reporter(TmAsVecSenderWithId::new(
|
||||||
TmSenderId::PusVerification as ChannelId,
|
ComponentIdList::PusVerification as ComponentId,
|
||||||
"verif_sender",
|
"verif_sender",
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
));
|
));
|
||||||
@ -333,7 +337,7 @@ fn dyn_tmtc_pool_main() {
|
|||||||
// in the sat-rs documentation.
|
// in the sat-rs documentation.
|
||||||
let mut event_handler = EventHandler::new(
|
let mut event_handler = EventHandler::new(
|
||||||
TmAsVecSenderWithId::new(
|
TmAsVecSenderWithId::new(
|
||||||
TmSenderId::AllEvents as ChannelId,
|
ComponentIdList::EventManagement as ComponentId,
|
||||||
"ALL_EVENTS_TX",
|
"ALL_EVENTS_TX",
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
),
|
),
|
||||||
@ -428,15 +432,17 @@ fn dyn_tmtc_pool_main() {
|
|||||||
)
|
)
|
||||||
.expect("tcp server creation failed");
|
.expect("tcp server creation failed");
|
||||||
|
|
||||||
|
/*
|
||||||
let mut acs_task = AcsTask::new(
|
let mut acs_task = AcsTask::new(
|
||||||
TmAsVecSenderWithId::new(
|
TmAsVecSenderWithId::new(
|
||||||
TmSenderId::AcsSubsystem as ChannelId,
|
TmSenderId::AcsSubsystem as ComponentId,
|
||||||
"ACS_TASK_SENDER",
|
"ACS_TASK_SENDER",
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
),
|
),
|
||||||
acs_thread_rx,
|
acs_thread_rx,
|
||||||
verif_reporter,
|
verif_reporter,
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
let mut tm_funnel = TmFunnelDynamic::new(sync_tm_tcp_source, tm_funnel_rx, tm_server_tx);
|
let mut tm_funnel = TmFunnelDynamic::new(sync_tm_tcp_source, tm_funnel_rx, tm_server_tx);
|
||||||
|
|
||||||
info!("Starting TMTC and UDP task");
|
info!("Starting TMTC and UDP task");
|
||||||
@ -484,7 +490,7 @@ fn dyn_tmtc_pool_main() {
|
|||||||
let jh_aocs = thread::Builder::new()
|
let jh_aocs = thread::Builder::new()
|
||||||
.name("AOCS".to_string())
|
.name("AOCS".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
acs_task.periodic_operation();
|
// acs_task.periodic_operation();
|
||||||
thread::sleep(Duration::from_millis(FREQ_MS_AOCS));
|
thread::sleep(Duration::from_millis(FREQ_MS_AOCS));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -3,11 +3,11 @@ use satrs::action::{ActionRequest, ActionRequestVariant};
|
|||||||
use satrs::params::WritableToBeBytes;
|
use satrs::params::WritableToBeBytes;
|
||||||
use satrs::pool::{SharedStaticMemoryPool, StoreAddr};
|
use satrs::pool::{SharedStaticMemoryPool, StoreAddr};
|
||||||
use satrs::pus::action::{
|
use satrs::pus::action::{
|
||||||
ActionReplyPus, ActionReplyPusWithActionId, ActionRequestWithId, ActivePusActionRequestStd,
|
ActionReplyPus, ActionReplyPusWithActionId, ActivePusActionRequestStd,
|
||||||
DefaultActiveActionRequestMap,
|
DefaultActiveActionRequestMap,
|
||||||
};
|
};
|
||||||
use satrs::pus::verification::{
|
use satrs::pus::verification::{
|
||||||
self, FailParams, FailParamsWithStep, TcStateAccepted,
|
FailParams, FailParamsWithStep, TcStateAccepted,
|
||||||
VerificationReporterWithSharedPoolMpscBoundedSender, VerificationReporterWithVecMpscSender,
|
VerificationReporterWithSharedPoolMpscBoundedSender, VerificationReporterWithVecMpscSender,
|
||||||
VerificationReportingProvider, VerificationToken,
|
VerificationReportingProvider, VerificationToken,
|
||||||
};
|
};
|
||||||
@ -22,8 +22,8 @@ use satrs::request::{GenericMessage, TargetAndApidId};
|
|||||||
use satrs::spacepackets::ecss::tc::PusTcReader;
|
use satrs::spacepackets::ecss::tc::PusTcReader;
|
||||||
use satrs::spacepackets::ecss::{EcssEnumU16, PusPacket};
|
use satrs::spacepackets::ecss::{EcssEnumU16, PusPacket};
|
||||||
use satrs::tmtc::tm_helper::SharedTmPool;
|
use satrs::tmtc::tm_helper::SharedTmPool;
|
||||||
use satrs::ChannelId;
|
use satrs::ComponentId;
|
||||||
use satrs_example::config::{tmtc_err, TcReceiverId, TmSenderId, PUS_APID};
|
use satrs_example::config::{tmtc_err, ComponentIdList, PUS_APID};
|
||||||
use std::sync::mpsc::{self};
|
use std::sync::mpsc::{self};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ impl PusReplyHandler<ActivePusActionRequestStd, ActionReplyPusWithActionId> for
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct ExampleActionRequestConverter {}
|
pub struct ExampleActionRequestConverter {}
|
||||||
|
|
||||||
impl PusTcToRequestConverter<ActivePusActionRequestStd, ActionRequestWithId>
|
impl PusTcToRequestConverter<ActivePusActionRequestStd, ActionRequest>
|
||||||
for ExampleActionRequestConverter
|
for ExampleActionRequestConverter
|
||||||
{
|
{
|
||||||
type Error = GenericConversionError;
|
type Error = GenericConversionError;
|
||||||
@ -146,7 +146,7 @@ impl PusTcToRequestConverter<ActivePusActionRequestStd, ActionRequestWithId>
|
|||||||
tc: &PusTcReader,
|
tc: &PusTcReader,
|
||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
verif_reporter: &impl VerificationReportingProvider,
|
verif_reporter: &impl VerificationReportingProvider,
|
||||||
) -> Result<(ActivePusActionRequestStd, ActionRequestWithId), Self::Error> {
|
) -> Result<(ActivePusActionRequestStd, ActionRequest), Self::Error> {
|
||||||
let subservice = tc.subservice();
|
let subservice = tc.subservice();
|
||||||
let user_data = tc.user_data();
|
let user_data = tc.user_data();
|
||||||
if user_data.len() < 8 {
|
if user_data.len() < 8 {
|
||||||
@ -174,13 +174,10 @@ impl PusTcToRequestConverter<ActivePusActionRequestStd, ActionRequestWithId>
|
|||||||
token,
|
token,
|
||||||
Duration::from_secs(30),
|
Duration::from_secs(30),
|
||||||
),
|
),
|
||||||
ActionRequestWithId {
|
ActionRequest::new(
|
||||||
request_id: verification::RequestId::new(tc).into(),
|
action_id,
|
||||||
request: ActionRequest::new(
|
ActionRequestVariant::VecData(user_data[8..].to_vec()),
|
||||||
action_id,
|
),
|
||||||
ActionRequestVariant::VecData(user_data[8..].to_vec()),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
verif_reporter
|
verif_reporter
|
||||||
@ -209,13 +206,13 @@ pub fn create_action_service_static(
|
|||||||
VerificationReporterWithSharedPoolMpscBoundedSender,
|
VerificationReporterWithSharedPoolMpscBoundedSender,
|
||||||
> {
|
> {
|
||||||
let action_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
let action_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
||||||
TmSenderId::PusAction as ChannelId,
|
ComponentIdList::PusAction as ComponentId,
|
||||||
"PUS_8_TM_SENDER",
|
"PUS_8_TM_SENDER",
|
||||||
shared_tm_store.clone(),
|
shared_tm_store.clone(),
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let action_srv_receiver = MpscTcReceiver::new(
|
let action_srv_receiver = MpscTcReceiver::new(
|
||||||
TcReceiverId::PusAction as ChannelId,
|
ComponentIdList::PusAction as ComponentId,
|
||||||
"PUS_8_TC_RECV",
|
"PUS_8_TC_RECV",
|
||||||
pus_action_rx,
|
pus_action_rx,
|
||||||
);
|
);
|
||||||
@ -253,12 +250,12 @@ pub fn create_action_service_dynamic(
|
|||||||
VerificationReporterWithVecMpscSender,
|
VerificationReporterWithVecMpscSender,
|
||||||
> {
|
> {
|
||||||
let action_srv_tm_sender = TmAsVecSenderWithId::new(
|
let action_srv_tm_sender = TmAsVecSenderWithId::new(
|
||||||
TmSenderId::PusAction as ChannelId,
|
ComponentIdList::PusAction as ComponentId,
|
||||||
"PUS_8_TM_SENDER",
|
"PUS_8_TM_SENDER",
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let action_srv_receiver = MpscTcReceiver::new(
|
let action_srv_receiver = MpscTcReceiver::new(
|
||||||
TcReceiverId::PusAction as ChannelId,
|
ComponentIdList::PusAction as ComponentId,
|
||||||
"PUS_8_TC_RECV",
|
"PUS_8_TC_RECV",
|
||||||
pus_action_rx,
|
pus_action_rx,
|
||||||
);
|
);
|
||||||
@ -296,7 +293,7 @@ pub struct Pus8Wrapper<
|
|||||||
ActionReplyHandler,
|
ActionReplyHandler,
|
||||||
DefaultActiveActionRequestMap,
|
DefaultActiveActionRequestMap,
|
||||||
ActivePusActionRequestStd,
|
ActivePusActionRequestStd,
|
||||||
ActionRequestWithId,
|
ActionRequest,
|
||||||
ActionReplyPusWithActionId,
|
ActionReplyPusWithActionId,
|
||||||
>,
|
>,
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ use satrs::pus::{
|
|||||||
TmInSharedPoolSenderWithId,
|
TmInSharedPoolSenderWithId,
|
||||||
};
|
};
|
||||||
use satrs::tmtc::tm_helper::SharedTmPool;
|
use satrs::tmtc::tm_helper::SharedTmPool;
|
||||||
use satrs::ChannelId;
|
use satrs::ComponentId;
|
||||||
use satrs_example::config::{TcReceiverId, TmSenderId, PUS_APID};
|
use satrs_example::config::{ComponentIdList, PUS_APID};
|
||||||
|
|
||||||
pub fn create_event_service_static(
|
pub fn create_event_service_static(
|
||||||
shared_tm_store: SharedTmPool,
|
shared_tm_store: SharedTmPool,
|
||||||
@ -32,13 +32,13 @@ pub fn create_event_service_static(
|
|||||||
VerificationReporterWithSharedPoolMpscBoundedSender,
|
VerificationReporterWithSharedPoolMpscBoundedSender,
|
||||||
> {
|
> {
|
||||||
let event_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
let event_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
||||||
TmSenderId::PusEvent as ChannelId,
|
ComponentIdList::EventManagement as ComponentId,
|
||||||
"PUS_5_TM_SENDER",
|
"PUS_5_TM_SENDER",
|
||||||
shared_tm_store.clone(),
|
shared_tm_store.clone(),
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let event_srv_receiver = MpscTcReceiver::new(
|
let event_srv_receiver = MpscTcReceiver::new(
|
||||||
TcReceiverId::PusEvent as ChannelId,
|
ComponentIdList::EventManagement as ComponentId,
|
||||||
"PUS_5_TC_RECV",
|
"PUS_5_TC_RECV",
|
||||||
pus_event_rx,
|
pus_event_rx,
|
||||||
);
|
);
|
||||||
@ -69,12 +69,12 @@ pub fn create_event_service_dynamic(
|
|||||||
VerificationReporterWithVecMpscSender,
|
VerificationReporterWithVecMpscSender,
|
||||||
> {
|
> {
|
||||||
let event_srv_tm_sender = TmAsVecSenderWithId::new(
|
let event_srv_tm_sender = TmAsVecSenderWithId::new(
|
||||||
TmSenderId::PusEvent as ChannelId,
|
ComponentIdList::EventManagement as ComponentId,
|
||||||
"PUS_5_TM_SENDER",
|
"PUS_5_TM_SENDER",
|
||||||
tm_funnel_tx,
|
tm_funnel_tx,
|
||||||
);
|
);
|
||||||
let event_srv_receiver = MpscTcReceiver::new(
|
let event_srv_receiver = MpscTcReceiver::new(
|
||||||
TcReceiverId::PusEvent as ChannelId,
|
ComponentIdList::EventManagement as ComponentId,
|
||||||
"PUS_5_TC_RECV",
|
"PUS_5_TC_RECV",
|
||||||
pus_event_rx,
|
pus_event_rx,
|
||||||
);
|
);
|
||||||
|
@ -17,8 +17,8 @@ use satrs::request::{GenericMessage, TargetAndApidId};
|
|||||||
use satrs::spacepackets::ecss::tc::PusTcReader;
|
use satrs::spacepackets::ecss::tc::PusTcReader;
|
||||||
use satrs::spacepackets::ecss::{hk, PusPacket};
|
use satrs::spacepackets::ecss::{hk, PusPacket};
|
||||||
use satrs::tmtc::tm_helper::SharedTmPool;
|
use satrs::tmtc::tm_helper::SharedTmPool;
|
||||||
use satrs::ChannelId;
|
use satrs::ComponentId;
|
||||||
use satrs_example::config::{hk_err, tmtc_err, TcReceiverId, TmSenderId, PUS_APID};
|
use satrs_example::config::{hk_err, tmtc_err, ComponentIdList, PUS_APID};
|
||||||
use std::sync::mpsc::{self};
|
use std::sync::mpsc::{self};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
@ -227,13 +227,16 @@ pub fn create_hk_service_static(
|
|||||||
VerificationReporterWithSharedPoolMpscBoundedSender,
|
VerificationReporterWithSharedPoolMpscBoundedSender,
|
||||||
> {
|
> {
|
||||||
let hk_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
let hk_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
||||||
TmSenderId::PusHk as ChannelId,
|
ComponentIdList::PusHk as ComponentId,
|
||||||
"PUS_3_TM_SENDER",
|
"PUS_3_TM_SENDER",
|
||||||
shared_tm_store.clone(),
|
shared_tm_store.clone(),
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let hk_srv_receiver =
|
let hk_srv_receiver = MpscTcReceiver::new(
|
||||||
MpscTcReceiver::new(TcReceiverId::PusHk as ChannelId, "PUS_8_TC_RECV", pus_hk_rx);
|
ComponentIdList::PusHk as ComponentId,
|
||||||
|
"PUS_8_TC_RECV",
|
||||||
|
pus_hk_rx,
|
||||||
|
);
|
||||||
let pus_3_handler = PusTargetedRequestService::new(
|
let pus_3_handler = PusTargetedRequestService::new(
|
||||||
PusServiceHelper::new(
|
PusServiceHelper::new(
|
||||||
hk_srv_receiver,
|
hk_srv_receiver,
|
||||||
@ -266,12 +269,15 @@ pub fn create_hk_service_dynamic(
|
|||||||
VerificationReporterWithVecMpscSender,
|
VerificationReporterWithVecMpscSender,
|
||||||
> {
|
> {
|
||||||
let hk_srv_tm_sender = TmAsVecSenderWithId::new(
|
let hk_srv_tm_sender = TmAsVecSenderWithId::new(
|
||||||
TmSenderId::PusHk as ChannelId,
|
ComponentIdList::PusHk as ComponentId,
|
||||||
"PUS_3_TM_SENDER",
|
"PUS_3_TM_SENDER",
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let hk_srv_receiver =
|
let hk_srv_receiver = MpscTcReceiver::new(
|
||||||
MpscTcReceiver::new(TcReceiverId::PusHk as ChannelId, "PUS_8_TC_RECV", pus_hk_rx);
|
ComponentIdList::PusHk as ComponentId,
|
||||||
|
"PUS_8_TC_RECV",
|
||||||
|
pus_hk_rx,
|
||||||
|
);
|
||||||
let pus_3_handler = PusTargetedRequestService::new(
|
let pus_3_handler = PusTargetedRequestService::new(
|
||||||
PusServiceHelper::new(
|
PusServiceHelper::new(
|
||||||
hk_srv_receiver,
|
hk_srv_receiver,
|
||||||
|
@ -199,15 +199,17 @@ where
|
|||||||
return Err(e.into());
|
return Err(e.into());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let verif_request_id = verification::RequestId::new(&tc);
|
let verif_request_id = verification::RequestId::new(&tc).raw();
|
||||||
//if let Err(e) =
|
//if let Err(e) =
|
||||||
match self
|
match self.request_router.route(
|
||||||
.request_router
|
request_info.target_id(),
|
||||||
.route(request_info.target_id(), request, request_info.token())
|
verif_request_id,
|
||||||
{
|
request,
|
||||||
|
request_info.token(),
|
||||||
|
) {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
self.active_request_map
|
self.active_request_map
|
||||||
.insert(&verif_request_id.into(), request_info);
|
.insert(&verif_request_id, request_info);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.request_router.handle_error_generic(
|
self.request_router.handle_error_generic(
|
||||||
|
@ -16,8 +16,8 @@ use satrs::pus::{
|
|||||||
TmInSharedPoolSenderWithId,
|
TmInSharedPoolSenderWithId,
|
||||||
};
|
};
|
||||||
use satrs::tmtc::tm_helper::SharedTmPool;
|
use satrs::tmtc::tm_helper::SharedTmPool;
|
||||||
use satrs::ChannelId;
|
use satrs::ComponentId;
|
||||||
use satrs_example::config::{TcReceiverId, TmSenderId, PUS_APID};
|
use satrs_example::config::{ComponentIdList, PUS_APID};
|
||||||
|
|
||||||
use crate::tmtc::PusTcSourceProviderSharedPool;
|
use crate::tmtc::PusTcSourceProviderSharedPool;
|
||||||
|
|
||||||
@ -145,13 +145,13 @@ pub fn create_scheduler_service_static(
|
|||||||
VerificationReporterWithSharedPoolMpscBoundedSender,
|
VerificationReporterWithSharedPoolMpscBoundedSender,
|
||||||
> {
|
> {
|
||||||
let sched_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
let sched_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
||||||
TmSenderId::PusSched as ChannelId,
|
ComponentIdList::PusSched as ComponentId,
|
||||||
"PUS_11_TM_SENDER",
|
"PUS_11_TM_SENDER",
|
||||||
shared_tm_store.clone(),
|
shared_tm_store.clone(),
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let sched_srv_receiver = MpscTcReceiver::new(
|
let sched_srv_receiver = MpscTcReceiver::new(
|
||||||
TcReceiverId::PusSched as ChannelId,
|
ComponentIdList::PusSched as ComponentId,
|
||||||
"PUS_11_TC_RECV",
|
"PUS_11_TC_RECV",
|
||||||
pus_sched_rx,
|
pus_sched_rx,
|
||||||
);
|
);
|
||||||
@ -188,12 +188,12 @@ pub fn create_scheduler_service_dynamic(
|
|||||||
VerificationReporterWithVecMpscSender,
|
VerificationReporterWithVecMpscSender,
|
||||||
> {
|
> {
|
||||||
let sched_srv_tm_sender = TmAsVecSenderWithId::new(
|
let sched_srv_tm_sender = TmAsVecSenderWithId::new(
|
||||||
TmSenderId::PusSched as ChannelId,
|
ComponentIdList::PusSched as ComponentId,
|
||||||
"PUS_11_TM_SENDER",
|
"PUS_11_TM_SENDER",
|
||||||
tm_funnel_tx,
|
tm_funnel_tx,
|
||||||
);
|
);
|
||||||
let sched_srv_receiver = MpscTcReceiver::new(
|
let sched_srv_receiver = MpscTcReceiver::new(
|
||||||
TcReceiverId::PusSched as ChannelId,
|
ComponentIdList::PusSched as ComponentId,
|
||||||
"PUS_11_TC_RECV",
|
"PUS_11_TC_RECV",
|
||||||
pus_sched_rx,
|
pus_sched_rx,
|
||||||
);
|
);
|
||||||
|
@ -17,9 +17,9 @@ use satrs::spacepackets::ecss::PusPacket;
|
|||||||
use satrs::spacepackets::time::cds::TimeProvider;
|
use satrs::spacepackets::time::cds::TimeProvider;
|
||||||
use satrs::spacepackets::time::TimeWriter;
|
use satrs::spacepackets::time::TimeWriter;
|
||||||
use satrs::tmtc::tm_helper::SharedTmPool;
|
use satrs::tmtc::tm_helper::SharedTmPool;
|
||||||
use satrs::ChannelId;
|
use satrs::ComponentId;
|
||||||
use satrs::{events::EventU32, pus::EcssTcInSharedStoreConverter};
|
use satrs::{events::EventU32, pus::EcssTcInSharedStoreConverter};
|
||||||
use satrs_example::config::{tmtc_err, TcReceiverId, TmSenderId, PUS_APID, TEST_EVENT};
|
use satrs_example::config::{tmtc_err, ComponentIdList, PUS_APID, TEST_EVENT};
|
||||||
use std::sync::mpsc::{self, Sender};
|
use std::sync::mpsc::{self, Sender};
|
||||||
|
|
||||||
pub fn create_test_service_static(
|
pub fn create_test_service_static(
|
||||||
@ -36,13 +36,13 @@ pub fn create_test_service_static(
|
|||||||
VerificationReporterWithSharedPoolMpscBoundedSender,
|
VerificationReporterWithSharedPoolMpscBoundedSender,
|
||||||
> {
|
> {
|
||||||
let test_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
let test_srv_tm_sender = TmInSharedPoolSenderWithId::new(
|
||||||
TmSenderId::PusTest as ChannelId,
|
ComponentIdList::PusTest as ComponentId,
|
||||||
"PUS_17_TM_SENDER",
|
"PUS_17_TM_SENDER",
|
||||||
shared_tm_store.clone(),
|
shared_tm_store.clone(),
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let test_srv_receiver = MpscTcReceiver::new(
|
let test_srv_receiver = MpscTcReceiver::new(
|
||||||
TcReceiverId::PusTest as ChannelId,
|
ComponentIdList::PusTest as ComponentId,
|
||||||
"PUS_17_TC_RECV",
|
"PUS_17_TC_RECV",
|
||||||
pus_test_rx,
|
pus_test_rx,
|
||||||
);
|
);
|
||||||
@ -71,12 +71,12 @@ pub fn create_test_service_dynamic(
|
|||||||
VerificationReporterWithVecMpscSender,
|
VerificationReporterWithVecMpscSender,
|
||||||
> {
|
> {
|
||||||
let test_srv_tm_sender = TmAsVecSenderWithId::new(
|
let test_srv_tm_sender = TmAsVecSenderWithId::new(
|
||||||
TmSenderId::PusTest as ChannelId,
|
ComponentIdList::PusTest as ComponentId,
|
||||||
"PUS_17_TM_SENDER",
|
"PUS_17_TM_SENDER",
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let test_srv_receiver = MpscTcReceiver::new(
|
let test_srv_receiver = MpscTcReceiver::new(
|
||||||
TcReceiverId::PusTest as ChannelId,
|
ComponentIdList::PusTest as ComponentId,
|
||||||
"PUS_17_TC_RECV",
|
"PUS_17_TC_RECV",
|
||||||
pus_test_rx,
|
pus_test_rx,
|
||||||
);
|
);
|
||||||
|
@ -1,50 +1,42 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
|
|
||||||
use derive_new::new;
|
|
||||||
use log::warn;
|
use log::warn;
|
||||||
|
use satrs::action::ActionRequest;
|
||||||
use satrs::hk::HkRequest;
|
use satrs::hk::HkRequest;
|
||||||
use satrs::mode::ModeRequest;
|
|
||||||
use satrs::pus::action::ActionRequestWithId;
|
|
||||||
use satrs::pus::verification::{
|
use satrs::pus::verification::{
|
||||||
FailParams, TcStateStarted, VerificationReportingProvider, VerificationToken,
|
FailParams, TcStateStarted, VerificationReportingProvider, VerificationToken,
|
||||||
};
|
};
|
||||||
use satrs::pus::{ActiveRequestProvider, GenericRoutingError, PusRequestRouter};
|
use satrs::pus::{ActiveRequestProvider, GenericRoutingError, PusRequestRouter};
|
||||||
use satrs::queue::GenericSendError;
|
use satrs::queue::GenericSendError;
|
||||||
|
use satrs::request::{GenericMessage, RequestId};
|
||||||
use satrs::spacepackets::ecss::tc::PusTcReader;
|
use satrs::spacepackets::ecss::tc::PusTcReader;
|
||||||
use satrs::spacepackets::ecss::PusPacket;
|
use satrs::spacepackets::ecss::PusPacket;
|
||||||
use satrs::ComponentId;
|
use satrs::ComponentId;
|
||||||
use satrs_example::config::tmtc_err;
|
use satrs_example::config::tmtc_err;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum Request {
|
pub enum CompositeRequest {
|
||||||
Hk(HkRequest),
|
Hk(HkRequest),
|
||||||
Mode(ModeRequest),
|
Action(ActionRequest),
|
||||||
Action(ActionRequestWithId),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, new)]
|
|
||||||
pub struct TargetedRequest {
|
|
||||||
pub(crate) target_id: ComponentId,
|
|
||||||
pub(crate) request: Request,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct RequestWithToken {
|
pub struct RequestWithToken {
|
||||||
pub(crate) targeted_request: TargetedRequest,
|
pub(crate) targeted_request: GenericMessage<CompositeRequest>,
|
||||||
pub(crate) token: VerificationToken<TcStateStarted>,
|
pub(crate) token: VerificationToken<TcStateStarted>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RequestWithToken {
|
impl RequestWithToken {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
target_id: ComponentId,
|
target_id: ComponentId,
|
||||||
request: Request,
|
request_id: RequestId,
|
||||||
|
request: CompositeRequest,
|
||||||
token: VerificationToken<TcStateStarted>,
|
token: VerificationToken<TcStateStarted>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
targeted_request: TargetedRequest::new(target_id, request),
|
targeted_request: GenericMessage::new(request_id, target_id, request),
|
||||||
token,
|
token,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,6 +88,7 @@ impl PusRequestRouter<HkRequest> for GenericRequestRouter {
|
|||||||
fn route(
|
fn route(
|
||||||
&self,
|
&self,
|
||||||
target_id: ComponentId,
|
target_id: ComponentId,
|
||||||
|
request_id: RequestId,
|
||||||
hk_request: HkRequest,
|
hk_request: HkRequest,
|
||||||
token: VerificationToken<TcStateStarted>,
|
token: VerificationToken<TcStateStarted>,
|
||||||
) -> Result<(), Self::Error> {
|
) -> Result<(), Self::Error> {
|
||||||
@ -103,7 +96,8 @@ impl PusRequestRouter<HkRequest> for GenericRequestRouter {
|
|||||||
sender
|
sender
|
||||||
.send(RequestWithToken::new(
|
.send(RequestWithToken::new(
|
||||||
target_id,
|
target_id,
|
||||||
Request::Hk(hk_request),
|
request_id,
|
||||||
|
CompositeRequest::Hk(hk_request),
|
||||||
token,
|
token,
|
||||||
))
|
))
|
||||||
.map_err(|_| GenericRoutingError::Send(GenericSendError::RxDisconnected))?;
|
.map_err(|_| GenericRoutingError::Send(GenericSendError::RxDisconnected))?;
|
||||||
@ -112,20 +106,22 @@ impl PusRequestRouter<HkRequest> for GenericRequestRouter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PusRequestRouter<ActionRequestWithId> for GenericRequestRouter {
|
impl PusRequestRouter<ActionRequest> for GenericRequestRouter {
|
||||||
type Error = GenericRoutingError;
|
type Error = GenericRoutingError;
|
||||||
|
|
||||||
fn route(
|
fn route(
|
||||||
&self,
|
&self,
|
||||||
target_id: ComponentId,
|
target_id: ComponentId,
|
||||||
action_request: ActionRequestWithId,
|
request_id: RequestId,
|
||||||
|
action_request: ActionRequest,
|
||||||
token: VerificationToken<TcStateStarted>,
|
token: VerificationToken<TcStateStarted>,
|
||||||
) -> Result<(), Self::Error> {
|
) -> Result<(), Self::Error> {
|
||||||
if let Some(sender) = self.0.get(&target_id) {
|
if let Some(sender) = self.0.get(&target_id) {
|
||||||
sender
|
sender
|
||||||
.send(RequestWithToken::new(
|
.send(RequestWithToken::new(
|
||||||
target_id,
|
target_id,
|
||||||
Request::Action(action_request),
|
request_id,
|
||||||
|
CompositeRequest::Action(action_request),
|
||||||
token,
|
token,
|
||||||
))
|
))
|
||||||
.map_err(|_| GenericRoutingError::Send(GenericSendError::RxDisconnected))?;
|
.map_err(|_| GenericRoutingError::Send(GenericSendError::RxDisconnected))?;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
//! about events first:
|
//! about events first:
|
||||||
//!
|
//!
|
||||||
//! The event manager has a listener table abstracted by the [ListenerMapProvider], which maps
|
//! The event manager has a listener table abstracted by the [ListenerMapProvider], which maps
|
||||||
//! listener groups identified by [ListenerKey]s to a [sender ID][ChannelId].
|
//! listener groups identified by [ListenerKey]s to a [sender ID][ComponentId].
|
||||||
//! It also contains a sender table abstracted by the [SenderMapProvider] which maps these sender
|
//! It also contains a sender table abstracted by the [SenderMapProvider] which maps these sender
|
||||||
//! IDs to concrete [EventSendProvider]s. A simple approach would be to use one send event provider
|
//! IDs to concrete [EventSendProvider]s. A simple approach would be to use one send event provider
|
||||||
//! for each OBSW thread and then subscribe for all interesting events for a particular thread
|
//! for each OBSW thread and then subscribe for all interesting events for a particular thread
|
||||||
@ -50,7 +50,7 @@ use crate::queue::GenericSendError;
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use core::slice::Iter;
|
use core::slice::Iter;
|
||||||
|
|
||||||
use crate::ChannelId;
|
use crate::ComponentId;
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub use alloc_mod::*;
|
pub use alloc_mod::*;
|
||||||
@ -74,7 +74,7 @@ pub type EventU32WithAuxData = EventWithAuxData<EventU32>;
|
|||||||
pub type EventU16WithAuxData = EventWithAuxData<EventU16>;
|
pub type EventU16WithAuxData = EventWithAuxData<EventU16>;
|
||||||
|
|
||||||
pub trait EventSendProvider<EV: GenericEvent, AuxDataProvider = Params> {
|
pub trait EventSendProvider<EV: GenericEvent, AuxDataProvider = Params> {
|
||||||
fn channel_id(&self) -> ChannelId;
|
fn target_id(&self) -> ComponentId;
|
||||||
|
|
||||||
fn send_no_data(&self, event: EV) -> Result<(), GenericSendError> {
|
fn send_no_data(&self, event: EV) -> Result<(), GenericSendError> {
|
||||||
self.send(event, None)
|
self.send(event, None)
|
||||||
@ -95,8 +95,8 @@ pub trait ListenerMapProvider {
|
|||||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
|
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
|
||||||
fn get_listeners(&self) -> alloc::vec::Vec<ListenerKey>;
|
fn get_listeners(&self) -> alloc::vec::Vec<ListenerKey>;
|
||||||
fn contains_listener(&self, key: &ListenerKey) -> bool;
|
fn contains_listener(&self, key: &ListenerKey) -> bool;
|
||||||
fn get_listener_ids(&self, key: &ListenerKey) -> Option<Iter<ChannelId>>;
|
fn get_listener_ids(&self, key: &ListenerKey) -> Option<Iter<ComponentId>>;
|
||||||
fn add_listener(&mut self, key: ListenerKey, sender_id: ChannelId) -> bool;
|
fn add_listener(&mut self, key: ListenerKey, sender_id: ComponentId) -> bool;
|
||||||
fn remove_duplicates(&mut self, key: &ListenerKey);
|
fn remove_duplicates(&mut self, key: &ListenerKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,9 +106,9 @@ pub trait SenderMapProvider<
|
|||||||
Data = Params,
|
Data = Params,
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
fn contains_send_event_provider(&self, id: &ChannelId) -> bool;
|
fn contains_send_event_provider(&self, target_id: &ComponentId) -> bool;
|
||||||
|
|
||||||
fn get_send_event_provider(&self, id: &ChannelId) -> Option<&EventSender>;
|
fn get_send_event_provider(&self, target_id: &ComponentId) -> Option<&EventSender>;
|
||||||
fn add_send_event_provider(&mut self, send_provider: EventSender) -> bool;
|
fn add_send_event_provider(&mut self, send_provider: EventSender) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ pub enum EventRoutingResult<EV: GenericEvent, AUX> {
|
|||||||
pub enum EventRoutingError {
|
pub enum EventRoutingError {
|
||||||
Send(GenericSendError),
|
Send(GenericSendError),
|
||||||
NoSendersForKey(ListenerKey),
|
NoSendersForKey(ListenerKey),
|
||||||
NoSenderForId(ChannelId),
|
NoSenderForId(ComponentId),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -176,12 +176,12 @@ impl<
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Subscribe for a unique event.
|
/// Subscribe for a unique event.
|
||||||
pub fn subscribe_single(&mut self, event: &Ev, sender_id: ChannelId) {
|
pub fn subscribe_single(&mut self, event: &Ev, sender_id: ComponentId) {
|
||||||
self.update_listeners(ListenerKey::Single(event.raw_as_largest_type()), sender_id);
|
self.update_listeners(ListenerKey::Single(event.raw_as_largest_type()), sender_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subscribe for an event group.
|
/// Subscribe for an event group.
|
||||||
pub fn subscribe_group(&mut self, group_id: LargestGroupIdRaw, sender_id: ChannelId) {
|
pub fn subscribe_group(&mut self, group_id: LargestGroupIdRaw, sender_id: ComponentId) {
|
||||||
self.update_listeners(ListenerKey::Group(group_id), sender_id);
|
self.update_listeners(ListenerKey::Group(group_id), sender_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ impl<
|
|||||||
///
|
///
|
||||||
/// For example, this can be useful for a handler component which sends every event as
|
/// For example, this can be useful for a handler component which sends every event as
|
||||||
/// a telemetry packet.
|
/// a telemetry packet.
|
||||||
pub fn subscribe_all(&mut self, sender_id: ChannelId) {
|
pub fn subscribe_all(&mut self, sender_id: ComponentId) {
|
||||||
self.update_listeners(ListenerKey::All, sender_id);
|
self.update_listeners(ListenerKey::All, sender_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,14 +216,14 @@ impl<
|
|||||||
pub fn add_sender(&mut self, send_provider: SP) {
|
pub fn add_sender(&mut self, send_provider: SP) {
|
||||||
if !self
|
if !self
|
||||||
.sender_map
|
.sender_map
|
||||||
.contains_send_event_provider(&send_provider.channel_id())
|
.contains_send_event_provider(&send_provider.target_id())
|
||||||
{
|
{
|
||||||
self.sender_map.add_send_event_provider(send_provider);
|
self.sender_map.add_send_event_provider(send_provider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generic function to update the event subscribers.
|
/// Generic function to update the event subscribers.
|
||||||
fn update_listeners(&mut self, key: ListenerKey, sender_id: ChannelId) {
|
fn update_listeners(&mut self, key: ListenerKey, sender_id: ComponentId) {
|
||||||
self.listener_map.add_listener(key, sender_id);
|
self.listener_map.add_listener(key, sender_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ pub mod alloc_mod {
|
|||||||
/// Simple implementation which uses a [HashMap] and a [Vec] internally.
|
/// Simple implementation which uses a [HashMap] and a [Vec] internally.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct DefaultListenerMap {
|
pub struct DefaultListenerMap {
|
||||||
listeners: HashMap<ListenerKey, Vec<ChannelId>>,
|
listeners: HashMap<ListenerKey, Vec<ComponentId>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ListenerMapProvider for DefaultListenerMap {
|
impl ListenerMapProvider for DefaultListenerMap {
|
||||||
@ -358,11 +358,11 @@ pub mod alloc_mod {
|
|||||||
self.listeners.contains_key(key)
|
self.listeners.contains_key(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_listener_ids(&self, key: &ListenerKey) -> Option<Iter<ChannelId>> {
|
fn get_listener_ids(&self, key: &ListenerKey) -> Option<Iter<ComponentId>> {
|
||||||
self.listeners.get(key).map(|vec| vec.iter())
|
self.listeners.get(key).map(|vec| vec.iter())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_listener(&mut self, key: ListenerKey, sender_id: ChannelId) -> bool {
|
fn add_listener(&mut self, key: ListenerKey, sender_id: ComponentId) -> bool {
|
||||||
if let Some(existing_list) = self.listeners.get_mut(&key) {
|
if let Some(existing_list) = self.listeners.get_mut(&key) {
|
||||||
existing_list.push(sender_id);
|
existing_list.push(sender_id);
|
||||||
} else {
|
} else {
|
||||||
@ -388,7 +388,7 @@ pub mod alloc_mod {
|
|||||||
EV: GenericEvent = EventU32,
|
EV: GenericEvent = EventU32,
|
||||||
AUX = Params,
|
AUX = Params,
|
||||||
> {
|
> {
|
||||||
senders: HashMap<ChannelId, SP>,
|
senders: HashMap<ComponentId, SP>,
|
||||||
phantom: PhantomData<(EV, AUX)>,
|
phantom: PhantomData<(EV, AUX)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,18 +406,18 @@ pub mod alloc_mod {
|
|||||||
impl<SP: EventSendProvider<EV, AUX>, EV: GenericEvent, AUX> SenderMapProvider<SP, EV, AUX>
|
impl<SP: EventSendProvider<EV, AUX>, EV: GenericEvent, AUX> SenderMapProvider<SP, EV, AUX>
|
||||||
for DefaultSenderMap<SP, EV, AUX>
|
for DefaultSenderMap<SP, EV, AUX>
|
||||||
{
|
{
|
||||||
fn contains_send_event_provider(&self, id: &ChannelId) -> bool {
|
fn contains_send_event_provider(&self, id: &ComponentId) -> bool {
|
||||||
self.senders.contains_key(id)
|
self.senders.contains_key(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_send_event_provider(&self, id: &ChannelId) -> Option<&SP> {
|
fn get_send_event_provider(&self, id: &ComponentId) -> Option<&SP> {
|
||||||
self.senders
|
self.senders
|
||||||
.get(id)
|
.get(id)
|
||||||
.filter(|sender| sender.channel_id() == *id)
|
.filter(|sender| sender.target_id() == *id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_send_event_provider(&mut self, send_provider: SP) -> bool {
|
fn add_send_event_provider(&mut self, send_provider: SP) -> bool {
|
||||||
let id = send_provider.channel_id();
|
let id = send_provider.target_id();
|
||||||
if self.senders.contains_key(&id) {
|
if self.senders.contains_key(&id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -458,19 +458,19 @@ pub mod std_mod {
|
|||||||
/// send events.
|
/// send events.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct EventSenderMpsc<Event: GenericEvent + Send> {
|
pub struct EventSenderMpsc<Event: GenericEvent + Send> {
|
||||||
id: u32,
|
target_id: ComponentId,
|
||||||
sender: mpsc::Sender<(Event, Option<Params>)>,
|
sender: mpsc::Sender<(Event, Option<Params>)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Event: GenericEvent + Send> EventSenderMpsc<Event> {
|
impl<Event: GenericEvent + Send> EventSenderMpsc<Event> {
|
||||||
pub fn new(id: u32, sender: mpsc::Sender<(Event, Option<Params>)>) -> Self {
|
pub fn new(target_id: ComponentId, sender: mpsc::Sender<(Event, Option<Params>)>) -> Self {
|
||||||
Self { id, sender }
|
Self { target_id, sender }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Event: GenericEvent + Send> EventSendProvider<Event> for EventSenderMpsc<Event> {
|
impl<Event: GenericEvent + Send> EventSendProvider<Event> for EventSenderMpsc<Event> {
|
||||||
fn channel_id(&self) -> u32 {
|
fn target_id(&self) -> ComponentId {
|
||||||
self.id
|
self.target_id
|
||||||
}
|
}
|
||||||
fn send(&self, event: Event, aux_data: Option<Params>) -> Result<(), GenericSendError> {
|
fn send(&self, event: Event, aux_data: Option<Params>) -> Result<(), GenericSendError> {
|
||||||
self.sender
|
self.sender
|
||||||
@ -483,19 +483,19 @@ pub mod std_mod {
|
|||||||
/// events. This has the advantage that the channel is bounded and thus more deterministic.
|
/// events. This has the advantage that the channel is bounded and thus more deterministic.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct EventSenderMpscBounded<Event: GenericEvent + Send> {
|
pub struct EventSenderMpscBounded<Event: GenericEvent + Send> {
|
||||||
channel_id: u32,
|
target_id: ComponentId,
|
||||||
sender: mpsc::SyncSender<(Event, Option<Params>)>,
|
sender: mpsc::SyncSender<(Event, Option<Params>)>,
|
||||||
capacity: usize,
|
capacity: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Event: GenericEvent + Send> EventSenderMpscBounded<Event> {
|
impl<Event: GenericEvent + Send> EventSenderMpscBounded<Event> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
channel_id: u32,
|
target_id: ComponentId,
|
||||||
sender: mpsc::SyncSender<(Event, Option<Params>)>,
|
sender: mpsc::SyncSender<(Event, Option<Params>)>,
|
||||||
capacity: usize,
|
capacity: usize,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
channel_id,
|
target_id,
|
||||||
sender,
|
sender,
|
||||||
capacity,
|
capacity,
|
||||||
}
|
}
|
||||||
@ -503,8 +503,8 @@ pub mod std_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<Event: GenericEvent + Send> EventSendProvider<Event> for EventSenderMpscBounded<Event> {
|
impl<Event: GenericEvent + Send> EventSendProvider<Event> for EventSenderMpscBounded<Event> {
|
||||||
fn channel_id(&self) -> u32 {
|
fn target_id(&self) -> ComponentId {
|
||||||
self.channel_id
|
self.target_id
|
||||||
}
|
}
|
||||||
fn send(&self, event: Event, aux_data: Option<Params>) -> Result<(), GenericSendError> {
|
fn send(&self, event: Event, aux_data: Option<Params>) -> Result<(), GenericSendError> {
|
||||||
if let Err(e) = self.sender.try_send((event, aux_data)) {
|
if let Err(e) = self.sender.try_send((event, aux_data)) {
|
||||||
@ -577,11 +577,11 @@ mod tests {
|
|||||||
let event_grp_1_0 = EventU32::new(Severity::HIGH, 1, 0).unwrap();
|
let event_grp_1_0 = EventU32::new(Severity::HIGH, 1, 0).unwrap();
|
||||||
let (single_event_sender, single_event_receiver) = channel();
|
let (single_event_sender, single_event_receiver) = channel();
|
||||||
let single_event_listener = EventSenderMpsc::new(0, single_event_sender);
|
let single_event_listener = EventSenderMpsc::new(0, single_event_sender);
|
||||||
event_man.subscribe_single(&event_grp_0, single_event_listener.channel_id());
|
event_man.subscribe_single(&event_grp_0, single_event_listener.target_id());
|
||||||
event_man.add_sender(single_event_listener);
|
event_man.add_sender(single_event_listener);
|
||||||
let (group_event_sender_0, group_event_receiver_0) = channel();
|
let (group_event_sender_0, group_event_receiver_0) = channel();
|
||||||
let group_event_listener = EventU32SenderMpsc::new(1, group_event_sender_0);
|
let group_event_listener = EventU32SenderMpsc::new(1, group_event_sender_0);
|
||||||
event_man.subscribe_group(event_grp_1_0.group_id(), group_event_listener.channel_id());
|
event_man.subscribe_group(event_grp_1_0.group_id(), group_event_listener.target_id());
|
||||||
event_man.add_sender(group_event_listener);
|
event_man.add_sender(group_event_listener);
|
||||||
|
|
||||||
// Test event with one listener
|
// Test event with one listener
|
||||||
@ -609,7 +609,7 @@ mod tests {
|
|||||||
let event_grp_0 = EventU32::new(Severity::INFO, 0, 0).unwrap();
|
let event_grp_0 = EventU32::new(Severity::INFO, 0, 0).unwrap();
|
||||||
let (single_event_sender, single_event_receiver) = channel();
|
let (single_event_sender, single_event_receiver) = channel();
|
||||||
let single_event_listener = EventSenderMpsc::new(0, single_event_sender);
|
let single_event_listener = EventSenderMpsc::new(0, single_event_sender);
|
||||||
event_man.subscribe_single(&event_grp_0, single_event_listener.channel_id());
|
event_man.subscribe_single(&event_grp_0, single_event_listener.target_id());
|
||||||
event_man.add_sender(single_event_listener);
|
event_man.add_sender(single_event_listener);
|
||||||
event_sender
|
event_sender
|
||||||
.send((event_grp_0, Some(Params::Heapless((2_u32, 3_u32).into()))))
|
.send((event_grp_0, Some(Params::Heapless((2_u32, 3_u32).into()))))
|
||||||
@ -643,11 +643,11 @@ mod tests {
|
|||||||
let event_grp_0_and_1_listener = EventU32SenderMpsc::new(0, event_grp_0_sender);
|
let event_grp_0_and_1_listener = EventU32SenderMpsc::new(0, event_grp_0_sender);
|
||||||
event_man.subscribe_group(
|
event_man.subscribe_group(
|
||||||
event_grp_0.group_id(),
|
event_grp_0.group_id(),
|
||||||
event_grp_0_and_1_listener.channel_id(),
|
event_grp_0_and_1_listener.target_id(),
|
||||||
);
|
);
|
||||||
event_man.subscribe_group(
|
event_man.subscribe_group(
|
||||||
event_grp_1_0.group_id(),
|
event_grp_1_0.group_id(),
|
||||||
event_grp_0_and_1_listener.channel_id(),
|
event_grp_0_and_1_listener.target_id(),
|
||||||
);
|
);
|
||||||
event_man.add_sender(event_grp_0_and_1_listener);
|
event_man.add_sender(event_grp_0_and_1_listener);
|
||||||
|
|
||||||
@ -679,10 +679,10 @@ mod tests {
|
|||||||
let (event_0_tx_1, event_0_rx_1) = channel();
|
let (event_0_tx_1, event_0_rx_1) = channel();
|
||||||
let event_listener_0 = EventU32SenderMpsc::new(0, event_0_tx_0);
|
let event_listener_0 = EventU32SenderMpsc::new(0, event_0_tx_0);
|
||||||
let event_listener_1 = EventU32SenderMpsc::new(1, event_0_tx_1);
|
let event_listener_1 = EventU32SenderMpsc::new(1, event_0_tx_1);
|
||||||
let event_listener_0_sender_id = event_listener_0.channel_id();
|
let event_listener_0_sender_id = event_listener_0.target_id();
|
||||||
event_man.subscribe_single(&event_0, event_listener_0_sender_id);
|
event_man.subscribe_single(&event_0, event_listener_0_sender_id);
|
||||||
event_man.add_sender(event_listener_0);
|
event_man.add_sender(event_listener_0);
|
||||||
let event_listener_1_sender_id = event_listener_1.channel_id();
|
let event_listener_1_sender_id = event_listener_1.target_id();
|
||||||
event_man.subscribe_single(&event_0, event_listener_1_sender_id);
|
event_man.subscribe_single(&event_0, event_listener_1_sender_id);
|
||||||
event_man.add_sender(event_listener_1);
|
event_man.add_sender(event_listener_1);
|
||||||
event_sender
|
event_sender
|
||||||
@ -732,7 +732,7 @@ mod tests {
|
|||||||
let event_1 = EventU32::new(Severity::HIGH, 1, 0).unwrap();
|
let event_1 = EventU32::new(Severity::HIGH, 1, 0).unwrap();
|
||||||
let (event_0_tx_0, all_events_rx) = channel();
|
let (event_0_tx_0, all_events_rx) = channel();
|
||||||
let all_events_listener = EventU32SenderMpsc::new(0, event_0_tx_0);
|
let all_events_listener = EventU32SenderMpsc::new(0, event_0_tx_0);
|
||||||
event_man.subscribe_all(all_events_listener.channel_id());
|
event_man.subscribe_all(all_events_listener.target_id());
|
||||||
event_man.add_sender(all_events_listener);
|
event_man.add_sender(all_events_listener);
|
||||||
event_sender
|
event_sender
|
||||||
.send((event_0, None))
|
.send((event_0, None))
|
||||||
|
@ -13,7 +13,7 @@ pub use std_mod::*;
|
|||||||
use crate::{
|
use crate::{
|
||||||
queue::GenericTargetedMessagingError,
|
queue::GenericTargetedMessagingError,
|
||||||
request::{GenericMessage, MessageReceiver, MessageReceiverWithId, RequestId},
|
request::{GenericMessage, MessageReceiver, MessageReceiverWithId, RequestId},
|
||||||
ChannelId, ComponentId,
|
ComponentId,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type Mode = u32;
|
pub type Mode = u32;
|
||||||
@ -140,11 +140,11 @@ pub enum ModeReply {
|
|||||||
pub type GenericModeReply = GenericMessage<ModeReply>;
|
pub type GenericModeReply = GenericMessage<ModeReply>;
|
||||||
|
|
||||||
pub trait ModeRequestSender {
|
pub trait ModeRequestSender {
|
||||||
fn local_channel_id(&self) -> ChannelId;
|
fn local_channel_id(&self) -> ComponentId;
|
||||||
fn send_mode_request(
|
fn send_mode_request(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ModeRequest,
|
request: ModeRequest,
|
||||||
) -> Result<(), GenericTargetedMessagingError>;
|
) -> Result<(), GenericTargetedMessagingError>;
|
||||||
}
|
}
|
||||||
@ -184,11 +184,11 @@ pub trait ModeRequestHandler: ModeProvider {
|
|||||||
fn start_transition(
|
fn start_transition(
|
||||||
&mut self,
|
&mut self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
sender_id: ChannelId,
|
sender_id: ComponentId,
|
||||||
mode_and_submode: ModeAndSubmode,
|
mode_and_submode: ModeAndSubmode,
|
||||||
) -> Result<(), ModeError>;
|
) -> Result<(), ModeError>;
|
||||||
|
|
||||||
fn announce_mode(&self, request_id: RequestId, sender_id: ChannelId, recursive: bool);
|
fn announce_mode(&self, request_id: RequestId, sender_id: ComponentId, recursive: bool);
|
||||||
fn handle_mode_reached(&mut self) -> Result<(), GenericTargetedMessagingError>;
|
fn handle_mode_reached(&mut self) -> Result<(), GenericTargetedMessagingError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,12 +207,12 @@ impl<R: MessageReceiver<ModeReply>> ModeReplyReceiver for MessageReceiverWithId<
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait ModeReplySender {
|
pub trait ModeReplySender {
|
||||||
fn local_channel_id(&self) -> ChannelId;
|
fn local_channel_id(&self) -> ComponentId;
|
||||||
|
|
||||||
fn send_mode_reply(
|
fn send_mode_reply(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
reply: ModeReply,
|
reply: ModeReply,
|
||||||
) -> Result<(), GenericTargetedMessagingError>;
|
) -> Result<(), GenericTargetedMessagingError>;
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ pub mod alloc_mod {
|
|||||||
MessageSender, MessageSenderAndReceiver, MessageSenderMap, MessageSenderMapWithId,
|
MessageSender, MessageSenderAndReceiver, MessageSenderMap, MessageSenderMapWithId,
|
||||||
RequestAndReplySenderAndReceiver, RequestId,
|
RequestAndReplySenderAndReceiver, RequestId,
|
||||||
},
|
},
|
||||||
ChannelId,
|
ComponentId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -236,14 +236,14 @@ pub mod alloc_mod {
|
|||||||
pub fn send_mode_reply(
|
pub fn send_mode_reply(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
local_id: ChannelId,
|
local_id: ComponentId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ModeReply,
|
request: ModeReply,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.send_message(request_id, local_id, target_id, request)
|
self.send_message(request_id, local_id, target_id, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_reply_target(&mut self, target_id: ChannelId, request_sender: S) {
|
pub fn add_reply_target(&mut self, target_id: ComponentId, request_sender: S) {
|
||||||
self.add_message_target(target_id, request_sender)
|
self.add_message_target(target_id, request_sender)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,13 +252,13 @@ pub mod alloc_mod {
|
|||||||
fn send_mode_reply(
|
fn send_mode_reply(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_channel_id: ChannelId,
|
target_channel_id: ComponentId,
|
||||||
reply: ModeReply,
|
reply: ModeReply,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.send_message(request_id, target_channel_id, reply)
|
self.send_message(request_id, target_channel_id, reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn local_channel_id(&self) -> ChannelId {
|
fn local_channel_id(&self) -> ComponentId {
|
||||||
self.local_channel_id
|
self.local_channel_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,14 +266,14 @@ pub mod alloc_mod {
|
|||||||
impl<FROM, S: MessageSender<ModeReply>, R: MessageReceiver<FROM>> ModeReplySender
|
impl<FROM, S: MessageSender<ModeReply>, R: MessageReceiver<FROM>> ModeReplySender
|
||||||
for MessageSenderAndReceiver<ModeReply, FROM, S, R>
|
for MessageSenderAndReceiver<ModeReply, FROM, S, R>
|
||||||
{
|
{
|
||||||
fn local_channel_id(&self) -> ChannelId {
|
fn local_channel_id(&self) -> ComponentId {
|
||||||
self.local_channel_id_generic()
|
self.local_channel_id_generic()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_mode_reply(
|
fn send_mode_reply(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ModeReply,
|
request: ModeReply,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.message_sender_map.send_mode_reply(
|
self.message_sender_map.send_mode_reply(
|
||||||
@ -303,7 +303,7 @@ pub mod alloc_mod {
|
|||||||
R1: MessageReceiver<REQUEST>,
|
R1: MessageReceiver<REQUEST>,
|
||||||
> RequestAndReplySenderAndReceiver<REQUEST, ModeReply, S0, R0, S1, R1>
|
> RequestAndReplySenderAndReceiver<REQUEST, ModeReply, S0, R0, S1, R1>
|
||||||
{
|
{
|
||||||
pub fn add_reply_target(&mut self, target_id: ChannelId, reply_sender: S1) {
|
pub fn add_reply_target(&mut self, target_id: ComponentId, reply_sender: S1) {
|
||||||
self.reply_sender_map
|
self.reply_sender_map
|
||||||
.add_message_target(target_id, reply_sender)
|
.add_message_target(target_id, reply_sender)
|
||||||
}
|
}
|
||||||
@ -317,14 +317,14 @@ pub mod alloc_mod {
|
|||||||
R1: MessageReceiver<REQUEST>,
|
R1: MessageReceiver<REQUEST>,
|
||||||
> ModeReplySender for RequestAndReplySenderAndReceiver<REQUEST, ModeReply, S0, R0, S1, R1>
|
> ModeReplySender for RequestAndReplySenderAndReceiver<REQUEST, ModeReply, S0, R0, S1, R1>
|
||||||
{
|
{
|
||||||
fn local_channel_id(&self) -> ChannelId {
|
fn local_channel_id(&self) -> ComponentId {
|
||||||
self.local_channel_id_generic()
|
self.local_channel_id_generic()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_mode_reply(
|
fn send_mode_reply(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ModeReply,
|
request: ModeReply,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.reply_sender_map.send_mode_reply(
|
self.reply_sender_map.send_mode_reply(
|
||||||
@ -368,7 +368,7 @@ pub mod alloc_mod {
|
|||||||
pub fn send_mode_reply(
|
pub fn send_mode_reply(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
reply: ModeReply,
|
reply: ModeReply,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.send_message(request_id, target_id, reply)
|
self.send_message(request_id, target_id, reply)
|
||||||
@ -389,7 +389,7 @@ pub mod alloc_mod {
|
|||||||
pub fn send_mode_request(
|
pub fn send_mode_request(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
reply: ModeRequest,
|
reply: ModeRequest,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.send_message(request_id, target_id, reply)
|
self.send_message(request_id, target_id, reply)
|
||||||
@ -405,27 +405,27 @@ pub mod alloc_mod {
|
|||||||
pub fn send_mode_request(
|
pub fn send_mode_request(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
local_id: ChannelId,
|
local_id: ComponentId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ModeRequest,
|
request: ModeRequest,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.send_message(request_id, local_id, target_id, request)
|
self.send_message(request_id, local_id, target_id, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_request_target(&mut self, target_id: ChannelId, request_sender: S) {
|
pub fn add_request_target(&mut self, target_id: ComponentId, request_sender: S) {
|
||||||
self.add_message_target(target_id, request_sender)
|
self.add_message_target(target_id, request_sender)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: MessageSender<ModeRequest>> ModeRequestSender for MessageSenderMapWithId<ModeRequest, S> {
|
impl<S: MessageSender<ModeRequest>> ModeRequestSender for MessageSenderMapWithId<ModeRequest, S> {
|
||||||
fn local_channel_id(&self) -> ChannelId {
|
fn local_channel_id(&self) -> ComponentId {
|
||||||
self.local_channel_id
|
self.local_channel_id
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_mode_request(
|
fn send_mode_request(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ModeRequest,
|
request: ModeRequest,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.send_message(request_id, target_id, request)
|
self.send_message(request_id, target_id, request)
|
||||||
@ -445,14 +445,14 @@ pub mod alloc_mod {
|
|||||||
impl<FROM, S: MessageSender<ModeRequest>, R: MessageReceiver<FROM>> ModeRequestSender
|
impl<FROM, S: MessageSender<ModeRequest>, R: MessageReceiver<FROM>> ModeRequestSender
|
||||||
for MessageSenderAndReceiver<ModeRequest, FROM, S, R>
|
for MessageSenderAndReceiver<ModeRequest, FROM, S, R>
|
||||||
{
|
{
|
||||||
fn local_channel_id(&self) -> ChannelId {
|
fn local_channel_id(&self) -> ComponentId {
|
||||||
self.local_channel_id_generic()
|
self.local_channel_id_generic()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_mode_request(
|
fn send_mode_request(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ModeRequest,
|
request: ModeRequest,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.message_sender_map.send_mode_request(
|
self.message_sender_map.send_mode_request(
|
||||||
@ -472,7 +472,7 @@ pub mod alloc_mod {
|
|||||||
R1: MessageReceiver<ModeRequest>,
|
R1: MessageReceiver<ModeRequest>,
|
||||||
> RequestAndReplySenderAndReceiver<ModeRequest, REPLY, S0, R0, S1, R1>
|
> RequestAndReplySenderAndReceiver<ModeRequest, REPLY, S0, R0, S1, R1>
|
||||||
{
|
{
|
||||||
pub fn add_request_target(&mut self, target_id: ChannelId, request_sender: S0) {
|
pub fn add_request_target(&mut self, target_id: ComponentId, request_sender: S0) {
|
||||||
self.request_sender_map
|
self.request_sender_map
|
||||||
.add_message_target(target_id, request_sender)
|
.add_message_target(target_id, request_sender)
|
||||||
}
|
}
|
||||||
@ -487,14 +487,14 @@ pub mod alloc_mod {
|
|||||||
> ModeRequestSender
|
> ModeRequestSender
|
||||||
for RequestAndReplySenderAndReceiver<ModeRequest, REPLY, S0, R0, S1, R1>
|
for RequestAndReplySenderAndReceiver<ModeRequest, REPLY, S0, R0, S1, R1>
|
||||||
{
|
{
|
||||||
fn local_channel_id(&self) -> ChannelId {
|
fn local_channel_id(&self) -> ComponentId {
|
||||||
self.local_channel_id_generic()
|
self.local_channel_id_generic()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_mode_request(
|
fn send_mode_request(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ModeRequest,
|
request: ModeRequest,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.request_sender_map.send_mode_request(
|
self.request_sender_map.send_mode_request(
|
||||||
|
@ -3,7 +3,7 @@ use hashbrown::HashMap;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
mode::{Mode, ModeAndSubmode, Submode},
|
mode::{Mode, ModeAndSubmode, Submode},
|
||||||
ChannelId,
|
ComponentId,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
@ -19,7 +19,7 @@ pub struct ModeTableEntry {
|
|||||||
/// Name of respective table entry.
|
/// Name of respective table entry.
|
||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
/// Target channel ID.
|
/// Target channel ID.
|
||||||
pub channel_id: ChannelId,
|
pub channel_id: ComponentId,
|
||||||
pub mode_submode: ModeAndSubmode,
|
pub mode_submode: ModeAndSubmode,
|
||||||
pub allowed_submode_mask: Option<Submode>,
|
pub allowed_submode_mask: Option<Submode>,
|
||||||
pub check_success: bool,
|
pub check_success: bool,
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
action::{ActionId, ActionRequest},
|
action::{ActionId, ActionRequest},
|
||||||
params::Params,
|
params::Params,
|
||||||
request::{GenericMessage, RequestId},
|
request::{GenericMessage, RequestId},
|
||||||
ChannelId,
|
ComponentId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{verification::VerificationToken, ActivePusRequestStd, ActiveRequestProvider};
|
use super::{verification::VerificationToken, ActivePusRequestStd, ActiveRequestProvider};
|
||||||
@ -61,7 +61,7 @@ pub type GenericActionReplyPus = GenericMessage<ActionReplyPusWithActionId>;
|
|||||||
impl GenericActionReplyPus {
|
impl GenericActionReplyPus {
|
||||||
pub fn new_action_reply(
|
pub fn new_action_reply(
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
sender_id: ChannelId,
|
sender_id: ComponentId,
|
||||||
action_id: ActionId,
|
action_id: ActionId,
|
||||||
reply: ActionReplyPus,
|
reply: ActionReplyPus,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@ -82,7 +82,7 @@ pub mod alloc_mod {
|
|||||||
request::{
|
request::{
|
||||||
GenericMessage, MessageReceiver, MessageSender, MessageSenderAndReceiver, RequestId,
|
GenericMessage, MessageReceiver, MessageSender, MessageSenderAndReceiver, RequestId,
|
||||||
},
|
},
|
||||||
ChannelId,
|
ComponentId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::ActionReplyPusWithActionId;
|
use super::ActionReplyPusWithActionId;
|
||||||
@ -103,7 +103,7 @@ pub mod alloc_mod {
|
|||||||
pub fn send_action_reply(
|
pub fn send_action_reply(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
reply: ActionReplyPusWithActionId,
|
reply: ActionReplyPusWithActionId,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.send_message(request_id, target_id, reply)
|
self.send_message(request_id, target_id, reply)
|
||||||
@ -128,7 +128,7 @@ pub mod alloc_mod {
|
|||||||
pub fn send_action_request(
|
pub fn send_action_request(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_id: ChannelId,
|
target_id: ComponentId,
|
||||||
request: ActionRequest,
|
request: ActionRequest,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.send_message(request_id, target_id, request)
|
self.send_message(request_id, target_id, request)
|
||||||
|
@ -244,7 +244,7 @@ mod tests {
|
|||||||
use crate::events::{EventU32, Severity};
|
use crate::events::{EventU32, Severity};
|
||||||
use crate::pus::tests::CommonTmInfo;
|
use crate::pus::tests::CommonTmInfo;
|
||||||
use crate::pus::{EcssChannel, PusTmWrapper};
|
use crate::pus::{EcssChannel, PusTmWrapper};
|
||||||
use crate::ChannelId;
|
use crate::ComponentId;
|
||||||
use spacepackets::ByteConversionError;
|
use spacepackets::ByteConversionError;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
@ -269,7 +269,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl EcssChannel for TestSender {
|
impl EcssChannel for TestSender {
|
||||||
fn channel_id(&self) -> ChannelId {
|
fn channel_id(&self) -> ComponentId {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ use crate::pool::{StoreAddr, StoreError};
|
|||||||
use crate::pus::verification::{TcStateAccepted, TcStateToken, VerificationToken};
|
use crate::pus::verification::{TcStateAccepted, TcStateToken, VerificationToken};
|
||||||
use crate::queue::{GenericReceiveError, GenericSendError};
|
use crate::queue::{GenericReceiveError, GenericSendError};
|
||||||
use crate::request::{GenericMessage, RequestId};
|
use crate::request::{GenericMessage, RequestId};
|
||||||
use crate::{ChannelId, ComponentId};
|
use crate::ComponentId;
|
||||||
use core::fmt::{Display, Formatter};
|
use core::fmt::{Display, Formatter};
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
@ -144,7 +144,7 @@ impl Error for EcssTmtcError {
|
|||||||
}
|
}
|
||||||
pub trait EcssChannel: Send {
|
pub trait EcssChannel: Send {
|
||||||
/// Each sender can have an ID associated with it
|
/// Each sender can have an ID associated with it
|
||||||
fn channel_id(&self) -> ChannelId;
|
fn channel_id(&self) -> ComponentId;
|
||||||
fn name(&self) -> &'static str {
|
fn name(&self) -> &'static str {
|
||||||
"unset"
|
"unset"
|
||||||
}
|
}
|
||||||
@ -301,6 +301,7 @@ pub trait PusRequestRouter<Request> {
|
|||||||
fn route(
|
fn route(
|
||||||
&self,
|
&self,
|
||||||
target_id: ComponentId,
|
target_id: ComponentId,
|
||||||
|
request_id: RequestId,
|
||||||
request: Request,
|
request: Request,
|
||||||
token: VerificationToken<TcStateStarted>,
|
token: VerificationToken<TcStateStarted>,
|
||||||
) -> Result<(), Self::Error>;
|
) -> Result<(), Self::Error>;
|
||||||
@ -649,7 +650,7 @@ pub mod std_mod {
|
|||||||
GenericReceiveError, GenericSendError, PusTmWrapper, TryRecvTmtcError,
|
GenericReceiveError, GenericSendError, PusTmWrapper, TryRecvTmtcError,
|
||||||
};
|
};
|
||||||
use crate::tmtc::tm_helper::SharedTmPool;
|
use crate::tmtc::tm_helper::SharedTmPool;
|
||||||
use crate::{ChannelId, ComponentId};
|
use crate::ComponentId;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use spacepackets::ecss::tc::PusTcReader;
|
use spacepackets::ecss::tc::PusTcReader;
|
||||||
@ -724,14 +725,14 @@ pub mod std_mod {
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct TmInSharedPoolSenderWithId<Sender: EcssTmSenderCore> {
|
pub struct TmInSharedPoolSenderWithId<Sender: EcssTmSenderCore> {
|
||||||
channel_id: ChannelId,
|
channel_id: ComponentId,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
shared_tm_store: SharedTmPool,
|
shared_tm_store: SharedTmPool,
|
||||||
sender: Sender,
|
sender: Sender,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Sender: EcssTmSenderCore> EcssChannel for TmInSharedPoolSenderWithId<Sender> {
|
impl<Sender: EcssTmSenderCore> EcssChannel for TmInSharedPoolSenderWithId<Sender> {
|
||||||
fn channel_id(&self) -> ChannelId {
|
fn channel_id(&self) -> ComponentId {
|
||||||
self.channel_id
|
self.channel_id
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,7 +759,7 @@ pub mod std_mod {
|
|||||||
|
|
||||||
impl<Sender: EcssTmSenderCore> TmInSharedPoolSenderWithId<Sender> {
|
impl<Sender: EcssTmSenderCore> TmInSharedPoolSenderWithId<Sender> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
id: ChannelId,
|
id: ComponentId,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
shared_tm_store: SharedTmPool,
|
shared_tm_store: SharedTmPool,
|
||||||
sender: Sender,
|
sender: Sender,
|
||||||
@ -782,7 +783,7 @@ pub mod std_mod {
|
|||||||
/// going to be called with direct packets.
|
/// going to be called with direct packets.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct TmAsVecSenderWithId<Sender: EcssTmSenderCore> {
|
pub struct TmAsVecSenderWithId<Sender: EcssTmSenderCore> {
|
||||||
id: ChannelId,
|
id: ComponentId,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
sender: Sender,
|
sender: Sender,
|
||||||
}
|
}
|
||||||
@ -794,13 +795,13 @@ pub mod std_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<Sender: EcssTmSenderCore> TmAsVecSenderWithId<Sender> {
|
impl<Sender: EcssTmSenderCore> TmAsVecSenderWithId<Sender> {
|
||||||
pub fn new(id: u32, name: &'static str, sender: Sender) -> Self {
|
pub fn new(id: ComponentId, name: &'static str, sender: Sender) -> Self {
|
||||||
Self { id, sender, name }
|
Self { id, sender, name }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Sender: EcssTmSenderCore> EcssChannel for TmAsVecSenderWithId<Sender> {
|
impl<Sender: EcssTmSenderCore> EcssChannel for TmAsVecSenderWithId<Sender> {
|
||||||
fn channel_id(&self) -> ChannelId {
|
fn channel_id(&self) -> ComponentId {
|
||||||
self.id
|
self.id
|
||||||
}
|
}
|
||||||
fn name(&self) -> &'static str {
|
fn name(&self) -> &'static str {
|
||||||
@ -818,13 +819,13 @@ pub mod std_mod {
|
|||||||
pub type TmAsVecSenderWithBoundedMpsc = TmAsVecSenderWithId<mpsc::SyncSender<Vec<u8>>>;
|
pub type TmAsVecSenderWithBoundedMpsc = TmAsVecSenderWithId<mpsc::SyncSender<Vec<u8>>>;
|
||||||
|
|
||||||
pub struct MpscTcReceiver {
|
pub struct MpscTcReceiver {
|
||||||
id: ChannelId,
|
id: ComponentId,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
receiver: mpsc::Receiver<EcssTcAndToken>,
|
receiver: mpsc::Receiver<EcssTcAndToken>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EcssChannel for MpscTcReceiver {
|
impl EcssChannel for MpscTcReceiver {
|
||||||
fn channel_id(&self) -> ChannelId {
|
fn channel_id(&self) -> ComponentId {
|
||||||
self.id
|
self.id
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,7 +847,7 @@ pub mod std_mod {
|
|||||||
|
|
||||||
impl MpscTcReceiver {
|
impl MpscTcReceiver {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
id: ChannelId,
|
id: ComponentId,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
receiver: mpsc::Receiver<EcssTcAndToken>,
|
receiver: mpsc::Receiver<EcssTcAndToken>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@ -903,14 +904,14 @@ pub mod std_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct CrossbeamTcReceiver {
|
pub struct CrossbeamTcReceiver {
|
||||||
id: ChannelId,
|
id: ComponentId,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
receiver: cb::Receiver<EcssTcAndToken>,
|
receiver: cb::Receiver<EcssTcAndToken>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CrossbeamTcReceiver {
|
impl CrossbeamTcReceiver {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
id: ChannelId,
|
id: ComponentId,
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
receiver: cb::Receiver<EcssTcAndToken>,
|
receiver: cb::Receiver<EcssTcAndToken>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@ -919,7 +920,7 @@ pub mod std_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl EcssChannel for CrossbeamTcReceiver {
|
impl EcssChannel for CrossbeamTcReceiver {
|
||||||
fn channel_id(&self) -> ChannelId {
|
fn channel_id(&self) -> ComponentId {
|
||||||
self.id
|
self.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1443,7 +1443,7 @@ pub mod tests {
|
|||||||
EcssChannel, PusTmWrapper, TmInSharedPoolSenderWithId, TmInSharedPoolSenderWithMpsc,
|
EcssChannel, PusTmWrapper, TmInSharedPoolSenderWithId, TmInSharedPoolSenderWithMpsc,
|
||||||
};
|
};
|
||||||
use crate::tmtc::tm_helper::SharedTmPool;
|
use crate::tmtc::tm_helper::SharedTmPool;
|
||||||
use crate::ChannelId;
|
use crate::ComponentId;
|
||||||
use alloc::format;
|
use alloc::format;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
@ -1708,7 +1708,7 @@ pub mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl EcssChannel for TestSender {
|
impl EcssChannel for TestSender {
|
||||||
fn channel_id(&self) -> ChannelId {
|
fn channel_id(&self) -> ComponentId {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
fn name(&self) -> &'static str {
|
fn name(&self) -> &'static str {
|
||||||
|
@ -4,6 +4,8 @@ use std::error::Error;
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
|
|
||||||
|
use crate::ComponentId;
|
||||||
|
|
||||||
/// Generic channel ID type.
|
/// Generic channel ID type.
|
||||||
pub type ChannelId = u32;
|
pub type ChannelId = u32;
|
||||||
|
|
||||||
@ -12,7 +14,7 @@ pub type ChannelId = u32;
|
|||||||
pub enum GenericSendError {
|
pub enum GenericSendError {
|
||||||
RxDisconnected,
|
RxDisconnected,
|
||||||
QueueFull(Option<u32>),
|
QueueFull(Option<u32>),
|
||||||
TargetDoesNotExist(ChannelId),
|
TargetDoesNotExist(ComponentId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for GenericSendError {
|
impl Display for GenericSendError {
|
||||||
@ -38,7 +40,7 @@ impl Error for GenericSendError {}
|
|||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub enum GenericReceiveError {
|
pub enum GenericReceiveError {
|
||||||
Empty,
|
Empty,
|
||||||
TxDisconnected(Option<ChannelId>),
|
TxDisconnected(Option<ComponentId>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for GenericReceiveError {
|
impl Display for GenericReceiveError {
|
||||||
|
@ -15,7 +15,7 @@ use spacepackets::{
|
|||||||
ByteConversionError, CcsdsPacket,
|
ByteConversionError, CcsdsPacket,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{queue::GenericTargetedMessagingError, ChannelId, ComponentId};
|
use crate::{queue::GenericTargetedMessagingError, ComponentId};
|
||||||
|
|
||||||
/// Generic request ID type. Requests can be associated with an ID to have a unique identifier
|
/// Generic request ID type. Requests can be associated with an ID to have a unique identifier
|
||||||
/// for them. This can be useful for tasks like tracking their progress.
|
/// for them. This can be useful for tasks like tracking their progress.
|
||||||
@ -91,13 +91,13 @@ impl fmt::Display for TargetAndApidId {
|
|||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub struct GenericMessage<MSG> {
|
pub struct GenericMessage<MSG> {
|
||||||
pub sender_id: ChannelId,
|
|
||||||
pub request_id: RequestId,
|
pub request_id: RequestId,
|
||||||
|
pub sender_id: ComponentId,
|
||||||
pub message: MSG,
|
pub message: MSG,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<MSG> GenericMessage<MSG> {
|
impl<MSG> GenericMessage<MSG> {
|
||||||
pub fn new(request_id: RequestId, sender_id: ChannelId, message: MSG) -> Self {
|
pub fn new(request_id: RequestId, sender_id: ComponentId, message: MSG) -> Self {
|
||||||
Self {
|
Self {
|
||||||
request_id,
|
request_id,
|
||||||
sender_id,
|
sender_id,
|
||||||
@ -133,19 +133,19 @@ impl<MSG, R: MessageReceiver<MSG>> MessageWithSenderIdReceiver<MSG, R> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct MessageReceiverWithId<MSG, R: MessageReceiver<MSG>> {
|
pub struct MessageReceiverWithId<MSG, R: MessageReceiver<MSG>> {
|
||||||
local_channel_id: ChannelId,
|
local_channel_id: ComponentId,
|
||||||
reply_receiver: MessageWithSenderIdReceiver<MSG, R>,
|
reply_receiver: MessageWithSenderIdReceiver<MSG, R>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<MSG, R: MessageReceiver<MSG>> MessageReceiverWithId<MSG, R> {
|
impl<MSG, R: MessageReceiver<MSG>> MessageReceiverWithId<MSG, R> {
|
||||||
pub fn new(local_channel_id: ChannelId, reply_receiver: R) -> Self {
|
pub fn new(local_channel_id: ComponentId, reply_receiver: R) -> Self {
|
||||||
Self {
|
Self {
|
||||||
local_channel_id,
|
local_channel_id,
|
||||||
reply_receiver: MessageWithSenderIdReceiver::from(reply_receiver),
|
reply_receiver: MessageWithSenderIdReceiver::from(reply_receiver),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn local_channel_id(&self) -> ChannelId {
|
pub fn local_channel_id(&self) -> ComponentId {
|
||||||
self.local_channel_id
|
self.local_channel_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ pub mod alloc_mod {
|
|||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
|
|
||||||
pub struct MessageSenderMap<MSG, S: MessageSender<MSG>>(
|
pub struct MessageSenderMap<MSG, S: MessageSender<MSG>>(
|
||||||
pub HashMap<ChannelId, S>,
|
pub HashMap<ComponentId, S>,
|
||||||
pub(crate) PhantomData<MSG>,
|
pub(crate) PhantomData<MSG>,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -180,15 +180,15 @@ pub mod alloc_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<MSG, S: MessageSender<MSG>> MessageSenderMap<MSG, S> {
|
impl<MSG, S: MessageSender<MSG>> MessageSenderMap<MSG, S> {
|
||||||
pub fn add_message_target(&mut self, target_id: ChannelId, message_sender: S) {
|
pub fn add_message_target(&mut self, target_id: ComponentId, message_sender: S) {
|
||||||
self.0.insert(target_id, message_sender);
|
self.0.insert(target_id, message_sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_message(
|
pub fn send_message(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
local_channel_id: ChannelId,
|
local_channel_id: ComponentId,
|
||||||
target_channel_id: ChannelId,
|
target_channel_id: ComponentId,
|
||||||
message: MSG,
|
message: MSG,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
if self.0.contains_key(&target_channel_id) {
|
if self.0.contains_key(&target_channel_id) {
|
||||||
@ -203,12 +203,12 @@ pub mod alloc_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct MessageSenderMapWithId<MSG, S: MessageSender<MSG>> {
|
pub struct MessageSenderMapWithId<MSG, S: MessageSender<MSG>> {
|
||||||
pub local_channel_id: ChannelId,
|
pub local_channel_id: ComponentId,
|
||||||
pub message_sender_map: MessageSenderMap<MSG, S>,
|
pub message_sender_map: MessageSenderMap<MSG, S>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<MSG, S: MessageSender<MSG>> MessageSenderMapWithId<MSG, S> {
|
impl<MSG, S: MessageSender<MSG>> MessageSenderMapWithId<MSG, S> {
|
||||||
pub fn new(local_channel_id: ChannelId) -> Self {
|
pub fn new(local_channel_id: ComponentId) -> Self {
|
||||||
Self {
|
Self {
|
||||||
local_channel_id,
|
local_channel_id,
|
||||||
message_sender_map: Default::default(),
|
message_sender_map: Default::default(),
|
||||||
@ -218,7 +218,7 @@ pub mod alloc_mod {
|
|||||||
pub fn send_message(
|
pub fn send_message(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_channel_id: ChannelId,
|
target_channel_id: ComponentId,
|
||||||
message: MSG,
|
message: MSG,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.message_sender_map.send_message(
|
self.message_sender_map.send_message(
|
||||||
@ -229,14 +229,14 @@ pub mod alloc_mod {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_message_target(&mut self, target_id: ChannelId, message_sender: S) {
|
pub fn add_message_target(&mut self, target_id: ComponentId, message_sender: S) {
|
||||||
self.message_sender_map
|
self.message_sender_map
|
||||||
.add_message_target(target_id, message_sender)
|
.add_message_target(target_id, message_sender)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MessageSenderAndReceiver<TO, FROM, S: MessageSender<TO>, R: MessageReceiver<FROM>> {
|
pub struct MessageSenderAndReceiver<TO, FROM, S: MessageSender<TO>, R: MessageReceiver<FROM>> {
|
||||||
pub local_channel_id: ChannelId,
|
pub local_channel_id: ComponentId,
|
||||||
pub message_sender_map: MessageSenderMap<TO, S>,
|
pub message_sender_map: MessageSenderMap<TO, S>,
|
||||||
pub message_receiver: MessageWithSenderIdReceiver<FROM, R>,
|
pub message_receiver: MessageWithSenderIdReceiver<FROM, R>,
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ pub mod alloc_mod {
|
|||||||
impl<TO, FROM, S: MessageSender<TO>, R: MessageReceiver<FROM>>
|
impl<TO, FROM, S: MessageSender<TO>, R: MessageReceiver<FROM>>
|
||||||
MessageSenderAndReceiver<TO, FROM, S, R>
|
MessageSenderAndReceiver<TO, FROM, S, R>
|
||||||
{
|
{
|
||||||
pub fn new(local_channel_id: ChannelId, message_receiver: R) -> Self {
|
pub fn new(local_channel_id: ComponentId, message_receiver: R) -> Self {
|
||||||
Self {
|
Self {
|
||||||
local_channel_id,
|
local_channel_id,
|
||||||
message_sender_map: Default::default(),
|
message_sender_map: Default::default(),
|
||||||
@ -252,12 +252,12 @@ pub mod alloc_mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_message_target(&mut self, target_id: ChannelId, message_sender: S) {
|
pub fn add_message_target(&mut self, target_id: ComponentId, message_sender: S) {
|
||||||
self.message_sender_map
|
self.message_sender_map
|
||||||
.add_message_target(target_id, message_sender)
|
.add_message_target(target_id, message_sender)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn local_channel_id_generic(&self) -> ChannelId {
|
pub fn local_channel_id_generic(&self) -> ComponentId {
|
||||||
self.local_channel_id
|
self.local_channel_id
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ pub mod alloc_mod {
|
|||||||
pub fn send_message(
|
pub fn send_message(
|
||||||
&self,
|
&self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
target_channel_id: ChannelId,
|
target_channel_id: ComponentId,
|
||||||
message: TO,
|
message: TO,
|
||||||
) -> Result<(), GenericTargetedMessagingError> {
|
) -> Result<(), GenericTargetedMessagingError> {
|
||||||
self.message_sender_map.send_message(
|
self.message_sender_map.send_message(
|
||||||
@ -292,7 +292,7 @@ pub mod alloc_mod {
|
|||||||
S1: MessageSender<REPLY>,
|
S1: MessageSender<REPLY>,
|
||||||
R1: MessageReceiver<REQUEST>,
|
R1: MessageReceiver<REQUEST>,
|
||||||
> {
|
> {
|
||||||
pub local_channel_id: ChannelId,
|
pub local_channel_id: ComponentId,
|
||||||
// These 2 are a functional group.
|
// These 2 are a functional group.
|
||||||
pub request_sender_map: MessageSenderMap<REQUEST, S0>,
|
pub request_sender_map: MessageSenderMap<REQUEST, S0>,
|
||||||
pub reply_receiver: MessageWithSenderIdReceiver<REPLY, R0>,
|
pub reply_receiver: MessageWithSenderIdReceiver<REPLY, R0>,
|
||||||
@ -310,7 +310,11 @@ pub mod alloc_mod {
|
|||||||
R1: MessageReceiver<REQUEST>,
|
R1: MessageReceiver<REQUEST>,
|
||||||
> RequestAndReplySenderAndReceiver<REQUEST, REPLY, S0, R0, S1, R1>
|
> RequestAndReplySenderAndReceiver<REQUEST, REPLY, S0, R0, S1, R1>
|
||||||
{
|
{
|
||||||
pub fn new(local_channel_id: ChannelId, request_receiver: R1, reply_receiver: R0) -> Self {
|
pub fn new(
|
||||||
|
local_channel_id: ComponentId,
|
||||||
|
request_receiver: R1,
|
||||||
|
reply_receiver: R0,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
local_channel_id,
|
local_channel_id,
|
||||||
request_receiver: request_receiver.into(),
|
request_receiver: request_receiver.into(),
|
||||||
@ -320,7 +324,7 @@ pub mod alloc_mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn local_channel_id_generic(&self) -> ChannelId {
|
pub fn local_channel_id_generic(&self) -> ComponentId {
|
||||||
self.local_channel_id
|
self.local_channel_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,9 +394,9 @@ mod tests {
|
|||||||
|
|
||||||
use super::{GenericMessage, MessageReceiverWithId, MessageSenderMapWithId, TargetAndApidId};
|
use super::{GenericMessage, MessageReceiverWithId, MessageSenderMapWithId, TargetAndApidId};
|
||||||
|
|
||||||
const TEST_CHANNEL_ID_0: u32 = 1;
|
const TEST_CHANNEL_ID_0: u64 = 1;
|
||||||
const TEST_CHANNEL_ID_1: u32 = 2;
|
const TEST_CHANNEL_ID_1: u64 = 2;
|
||||||
const TEST_CHANNEL_ID_2: u32 = 3;
|
const TEST_CHANNEL_ID_2: u64 = 3;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_basic_target_id_with_apid() {
|
fn test_basic_target_id_with_apid() {
|
||||||
|
@ -13,7 +13,7 @@ use satrs::{
|
|||||||
mode::{ModeAndSubmode, ModeReply, ModeRequest},
|
mode::{ModeAndSubmode, ModeReply, ModeRequest},
|
||||||
queue::GenericTargetedMessagingError,
|
queue::GenericTargetedMessagingError,
|
||||||
request::GenericMessage,
|
request::GenericMessage,
|
||||||
ChannelId,
|
ComponentId,
|
||||||
};
|
};
|
||||||
use std::string::{String, ToString};
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ struct TestDevice {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
pub mode_node: ModeRequestHandlerMpscBounded,
|
pub mode_node: ModeRequestHandlerMpscBounded,
|
||||||
pub mode_and_submode: ModeAndSubmode,
|
pub mode_and_submode: ModeAndSubmode,
|
||||||
pub mode_requestor_info: Option<(RequestId, ChannelId)>,
|
pub mode_requestor_info: Option<(RequestId, ComponentId)>,
|
||||||
pub action_queue: mpsc::Receiver<GenericMessage<ActionRequest>>,
|
pub action_queue: mpsc::Receiver<GenericMessage<ActionRequest>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ impl ModeRequestHandler for TestDevice {
|
|||||||
fn start_transition(
|
fn start_transition(
|
||||||
&mut self,
|
&mut self,
|
||||||
_request_id: RequestId,
|
_request_id: RequestId,
|
||||||
_sender_id: ChannelId,
|
_sender_id: ComponentId,
|
||||||
mode_and_submode: ModeAndSubmode,
|
mode_and_submode: ModeAndSubmode,
|
||||||
) -> Result<(), ModeError> {
|
) -> Result<(), ModeError> {
|
||||||
self.mode_and_submode = mode_and_submode;
|
self.mode_and_submode = mode_and_submode;
|
||||||
@ -103,7 +103,7 @@ impl ModeRequestHandler for TestDevice {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn announce_mode(&self, _request_id: RequestId, _sender_id: ChannelId, _recursive: bool) {
|
fn announce_mode(&self, _request_id: RequestId, _sender_id: ComponentId, _recursive: bool) {
|
||||||
println!(
|
println!(
|
||||||
"{}: announcing mode: {:?}",
|
"{}: announcing mode: {:?}",
|
||||||
self.name, self.mode_and_submode
|
self.name, self.mode_and_submode
|
||||||
@ -123,7 +123,7 @@ impl ModeRequestHandler for TestDevice {
|
|||||||
|
|
||||||
struct TestAssembly {
|
struct TestAssembly {
|
||||||
pub mode_node: ModeRequestorAndHandlerMpscBounded,
|
pub mode_node: ModeRequestorAndHandlerMpscBounded,
|
||||||
pub mode_requestor_info: Option<(RequestId, ChannelId)>,
|
pub mode_requestor_info: Option<(RequestId, ComponentId)>,
|
||||||
pub mode_and_submode: ModeAndSubmode,
|
pub mode_and_submode: ModeAndSubmode,
|
||||||
pub target_mode_and_submode: Option<ModeAndSubmode>,
|
pub target_mode_and_submode: Option<ModeAndSubmode>,
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ impl ModeRequestHandler for TestAssembly {
|
|||||||
fn start_transition(
|
fn start_transition(
|
||||||
&mut self,
|
&mut self,
|
||||||
request_id: RequestId,
|
request_id: RequestId,
|
||||||
sender_id: ChannelId,
|
sender_id: ComponentId,
|
||||||
mode_and_submode: ModeAndSubmode,
|
mode_and_submode: ModeAndSubmode,
|
||||||
) -> Result<(), ModeError> {
|
) -> Result<(), ModeError> {
|
||||||
self.mode_requestor_info = Some((request_id, sender_id));
|
self.mode_requestor_info = Some((request_id, sender_id));
|
||||||
@ -201,7 +201,7 @@ impl ModeRequestHandler for TestAssembly {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn announce_mode(&self, request_id: RequestId, _sender_id: ChannelId, recursive: bool) {
|
fn announce_mode(&self, request_id: RequestId, _sender_id: ComponentId, recursive: bool) {
|
||||||
println!(
|
println!(
|
||||||
"TestAssembly: Announcing mode (recursively: {}): {:?}",
|
"TestAssembly: Announcing mode (recursively: {}): {:?}",
|
||||||
recursive, self.mode_and_submode
|
recursive, self.mode_and_submode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user