edition bump to 2024 ald clippy #244
@@ -15,6 +15,7 @@ pub trait UdpTmHandler {
|
|||||||
fn send_tm_to_udp_client(&mut self, socket: &UdpSocket, recv_addr: &SocketAddr);
|
fn send_tm_to_udp_client(&mut self, socket: &UdpSocket, recv_addr: &SocketAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub struct StaticUdpTmHandler {
|
pub struct StaticUdpTmHandler {
|
||||||
pub tm_rx: mpsc::Receiver<PacketInPool>,
|
pub tm_rx: mpsc::Receiver<PacketInPool>,
|
||||||
pub tm_store: SharedStaticMemoryPool,
|
pub tm_store: SharedStaticMemoryPool,
|
||||||
|
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
- Bump `sat-rs` edition to 2024.
|
||||||
|
|
||||||
# [v0.3.0-alpha.2] 2025-07-22
|
# [v0.3.0-alpha.2] 2025-07-22
|
||||||
|
|
||||||
`satrs-shared` update
|
`satrs-shared` update
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "satrs"
|
name = "satrs"
|
||||||
version = "0.3.0-alpha.2"
|
version = "0.3.0-alpha.2"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
rust-version = "1.82.0"
|
rust-version = "1.85.0"
|
||||||
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||||
description = "A library collection to build software for remote systems"
|
description = "A library collection to build software for remote systems"
|
||||||
homepage = "https://github.com/us-irs/sat-rs"
|
homepage = "https://github.com/us-irs/sat-rs"
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
mode::{ModeAndSubmode, ModeReply, ModeRequest, ModeRequestSender},
|
mode::{ModeAndSubmode, ModeReply, ModeRequest, ModeRequestSender},
|
||||||
mode_tree::{ModeStoreProvider, ModeStoreVec},
|
mode_tree::{ModeStoreProvider, ModeStoreVec},
|
||||||
queue::{GenericSendError, GenericTargetedMessagingError},
|
queue::{GenericSendError, GenericTargetedMessagingError},
|
||||||
request::{GenericMessage, RequestId},
|
request::{GenericMessage, RequestId},
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ impl<UserHook: DevManagerUserHook> DevManagerCommandingHelper<UserHook> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
mode::{tests::ModeReqSenderMock, UNKNOWN_MODE},
|
mode::{UNKNOWN_MODE, tests::ModeReqSenderMock},
|
||||||
request::MessageMetadata,
|
request::MessageMetadata,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
use spacepackets::{CcsdsPacket, SpHeader};
|
use spacepackets::{CcsdsPacket, SpHeader};
|
||||||
|
|
||||||
use crate::{tmtc::PacketSenderRaw, ComponentId};
|
use crate::{ComponentId, tmtc::PacketSenderRaw};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum SpValidity {
|
pub enum SpValidity {
|
||||||
@@ -90,13 +90,13 @@ pub fn parse_buffer_for_ccsds_space_packets<SendError>(
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use spacepackets::{
|
use spacepackets::{
|
||||||
ecss::tc::PusTcCreator, CcsdsPacket, PacketId, PacketSequenceCtrl, PacketType,
|
CcsdsPacket, PacketId, PacketSequenceCtrl, PacketType, SequenceFlags, SpHeader,
|
||||||
SequenceFlags, SpHeader,
|
ecss::tc::PusTcCreator,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{encoding::tests::TcCacher, ComponentId};
|
use crate::{ComponentId, encoding::tests::TcCacher};
|
||||||
|
|
||||||
use super::{parse_buffer_for_ccsds_space_packets, SpValidity, SpacePacketValidator};
|
use super::{SpValidity, SpacePacketValidator, parse_buffer_for_ccsds_space_packets};
|
||||||
|
|
||||||
const PARSER_ID: ComponentId = 0x05;
|
const PARSER_ID: ComponentId = 0x05;
|
||||||
const TEST_APID_0: u16 = 0x02;
|
const TEST_APID_0: u16 = 0x02;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
use crate::{tmtc::PacketSenderRaw, ComponentId};
|
use crate::{ComponentId, tmtc::PacketSenderRaw};
|
||||||
use cobs::{decode_in_place, encode, max_encoding_length};
|
use cobs::{decode_in_place, encode, max_encoding_length};
|
||||||
|
|
||||||
/// This function encodes the given packet with COBS and also wraps the encoded packet with
|
/// This function encodes the given packet with COBS and also wraps the encoded packet with
|
||||||
@@ -104,8 +104,8 @@ pub(crate) mod tests {
|
|||||||
use cobs::encode;
|
use cobs::encode;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
encoding::tests::{encode_simple_packet, TcCacher, INVERTED_PACKET, SIMPLE_PACKET},
|
|
||||||
ComponentId,
|
ComponentId,
|
||||||
|
encoding::tests::{INVERTED_PACKET, SIMPLE_PACKET, TcCacher, encode_simple_packet},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::parse_buffer_for_cobs_encoded_packets;
|
use super::parse_buffer_for_cobs_encoded_packets;
|
||||||
|
@@ -11,8 +11,8 @@ pub(crate) mod tests {
|
|||||||
use alloc::collections::VecDeque;
|
use alloc::collections::VecDeque;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
tmtc::{PacketAsVec, PacketSenderRaw},
|
|
||||||
ComponentId,
|
ComponentId,
|
||||||
|
tmtc::{PacketAsVec, PacketSenderRaw},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::cobs::encode_packet_with_cobs;
|
use super::cobs::encode_packet_with_cobs;
|
||||||
|
@@ -136,7 +136,7 @@ pub trait ListenerMapProvider {
|
|||||||
#[cfg(feature = "alloc")]
|
#[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<ComponentId>>;
|
fn get_listener_ids(&self, key: &ListenerKey) -> Option<Iter<'_, ComponentId>>;
|
||||||
fn add_listener(&mut self, key: ListenerKey, listener_id: ComponentId) -> bool;
|
fn add_listener(&mut self, key: ListenerKey, listener_id: ComponentId) -> bool;
|
||||||
fn remove_duplicates(&mut self, key: &ListenerKey);
|
fn remove_duplicates(&mut self, key: &ListenerKey);
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ impl<
|
|||||||
EventSender: EventSendProvider<Event, ParamProvider>,
|
EventSender: EventSendProvider<Event, ParamProvider>,
|
||||||
Event: GenericEvent + Copy,
|
Event: GenericEvent + Copy,
|
||||||
ParamProvider: Debug,
|
ParamProvider: Debug,
|
||||||
> EventManager<EventReceiver, SenderMap, ListenerMap, EventSender, Event, ParamProvider>
|
> EventManager<EventReceiver, SenderMap, ListenerMap, EventSender, Event, ParamProvider>
|
||||||
{
|
{
|
||||||
pub fn remove_duplicates(&mut self, key: &ListenerKey) {
|
pub fn remove_duplicates(&mut self, key: &ListenerKey) {
|
||||||
self.listener_map.remove_duplicates(key)
|
self.listener_map.remove_duplicates(key)
|
||||||
@@ -235,7 +235,7 @@ impl<
|
|||||||
EventSenderMap: EventSendProvider<Event, ParamProvider>,
|
EventSenderMap: EventSendProvider<Event, ParamProvider>,
|
||||||
Event: GenericEvent + Copy,
|
Event: GenericEvent + Copy,
|
||||||
ParamProvider: Debug,
|
ParamProvider: Debug,
|
||||||
> EventManager<EventReceiver, SenderMap, ListenerMap, EventSenderMap, Event, ParamProvider>
|
> EventManager<EventReceiver, SenderMap, ListenerMap, EventSenderMap, Event, ParamProvider>
|
||||||
{
|
{
|
||||||
pub fn new_with_custom_maps(
|
pub fn new_with_custom_maps(
|
||||||
event_receiver: EventReceiver,
|
event_receiver: EventReceiver,
|
||||||
@@ -273,7 +273,7 @@ impl<
|
|||||||
EventSenderMap: EventSendProvider<Event, ParamProvider, Error = GenericSendError>,
|
EventSenderMap: EventSendProvider<Event, ParamProvider, Error = GenericSendError>,
|
||||||
Event: GenericEvent + Copy,
|
Event: GenericEvent + Copy,
|
||||||
ParamProvider: Clone + Debug,
|
ParamProvider: Clone + Debug,
|
||||||
> EventManager<EventReceiver, SenderMap, ListenerMap, EventSenderMap, Event, ParamProvider>
|
> EventManager<EventReceiver, SenderMap, ListenerMap, EventSenderMap, Event, ParamProvider>
|
||||||
{
|
{
|
||||||
/// This function will use the cached event receiver and try to receive one event.
|
/// This function will use the cached event receiver and try to receive one event.
|
||||||
/// If an event was received, it will try to route that event to all subscribed event listeners.
|
/// If an event was received, it will try to route that event to all subscribed event listeners.
|
||||||
@@ -402,7 +402,7 @@ pub mod alloc_mod {
|
|||||||
self.listeners.contains_key(key)
|
self.listeners.contains_key(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_listener_ids(&self, key: &ListenerKey) -> Option<Iter<ComponentId>> {
|
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())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,9 +31,9 @@ use core::fmt::Debug;
|
|||||||
use core::hash::Hash;
|
use core::hash::Hash;
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use delegate::delegate;
|
use delegate::delegate;
|
||||||
|
use spacepackets::ByteConversionError;
|
||||||
use spacepackets::ecss::EcssEnumeration;
|
use spacepackets::ecss::EcssEnumeration;
|
||||||
use spacepackets::util::{ToBeBytes, UnsignedEnum};
|
use spacepackets::util::{ToBeBytes, UnsignedEnum};
|
||||||
use spacepackets::ByteConversionError;
|
|
||||||
|
|
||||||
/// Using a type definition allows to change this to u64 in the future more easily
|
/// Using a type definition allows to change this to u64 in the future more easily
|
||||||
pub type LargestEventRaw = u32;
|
pub type LargestEventRaw = u32;
|
||||||
|
@@ -55,7 +55,8 @@ pub fn exec_sched_single<
|
|||||||
let mut cycle_count = 0;
|
let mut cycle_count = 0;
|
||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name(String::from(executable.task_name()))
|
.name(String::from(executable.task_name()))
|
||||||
.spawn(move || loop {
|
.spawn(move || {
|
||||||
|
loop {
|
||||||
if let Some(ref mut terminator) = termination {
|
if let Some(ref mut terminator) = termination {
|
||||||
match terminator.try_recv() {
|
match terminator.try_recv() {
|
||||||
Ok(_) | Err(TryRecvError::Disconnected) => {
|
Ok(_) | Err(TryRecvError::Disconnected) => {
|
||||||
@@ -83,6 +84,7 @@ pub fn exec_sched_single<
|
|||||||
if let Some(freq) = task_freq {
|
if let Some(freq) = task_freq {
|
||||||
thread::sleep(freq);
|
thread::sleep(freq);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +112,8 @@ pub fn exec_sched_multi<
|
|||||||
|
|
||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name(String::from(task_name))
|
.name(String::from(task_name))
|
||||||
.spawn(move || loop {
|
.spawn(move || {
|
||||||
|
loop {
|
||||||
if let Some(ref mut terminator) = termination {
|
if let Some(ref mut terminator) = termination {
|
||||||
match terminator.try_recv() {
|
match terminator.try_recv() {
|
||||||
Ok(_) | Err(TryRecvError::Disconnected) => {
|
Ok(_) | Err(TryRecvError::Disconnected) => {
|
||||||
@@ -147,14 +150,15 @@ pub fn exec_sched_multi<
|
|||||||
}
|
}
|
||||||
let freq = task_freq.unwrap_or_else(|| panic!("No task frequency specified"));
|
let freq = task_freq.unwrap_or_else(|| panic!("No task frequency specified"));
|
||||||
thread::sleep(freq);
|
thread::sleep(freq);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{
|
use super::{
|
||||||
exec_sched_multi, exec_sched_single, Executable, ExecutableWithType, ExecutionType,
|
Executable, ExecutableWithType, ExecutionType, OpResult, exec_sched_multi,
|
||||||
OpResult,
|
exec_sched_single,
|
||||||
};
|
};
|
||||||
use bus::Bus;
|
use bus::Bus;
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
|
@@ -13,10 +13,10 @@ use crate::encoding::parse_buffer_for_cobs_encoded_packets;
|
|||||||
use crate::tmtc::PacketSenderRaw;
|
use crate::tmtc::PacketSenderRaw;
|
||||||
use crate::tmtc::PacketSource;
|
use crate::tmtc::PacketSource;
|
||||||
|
|
||||||
|
use crate::ComponentId;
|
||||||
use crate::hal::std::tcp_server::{
|
use crate::hal::std::tcp_server::{
|
||||||
ConnectionResult, ServerConfig, TcpTcParser, TcpTmSender, TcpTmtcError, TcpTmtcGenericServer,
|
ConnectionResult, ServerConfig, TcpTcParser, TcpTmSender, TcpTmtcError, TcpTmtcGenericServer,
|
||||||
};
|
};
|
||||||
use crate::ComponentId;
|
|
||||||
|
|
||||||
use super::tcp_server::HandledConnectionHandler;
|
use super::tcp_server::HandledConnectionHandler;
|
||||||
use super::tcp_server::HandledConnectionInfo;
|
use super::tcp_server::HandledConnectionInfo;
|
||||||
@@ -141,7 +141,7 @@ impl<
|
|||||||
HandledConnection: HandledConnectionHandler,
|
HandledConnection: HandledConnectionHandler,
|
||||||
TmError: 'static,
|
TmError: 'static,
|
||||||
TcError: 'static,
|
TcError: 'static,
|
||||||
> TcpTmtcInCobsServer<TmSource, TcReceiver, HandledConnection, TmError, TcError>
|
> TcpTmtcInCobsServer<TmSource, TcReceiver, HandledConnection, TmError, TcError>
|
||||||
{
|
{
|
||||||
/// Create a new TCP TMTC server which exchanges TMTC packets encoded with
|
/// Create a new TCP TMTC server which exchanges TMTC packets encoded with
|
||||||
/// [COBS protocol](https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing).
|
/// [COBS protocol](https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing).
|
||||||
@@ -206,14 +206,14 @@ mod tests {
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
encoding::tests::{INVERTED_PACKET, SIMPLE_PACKET},
|
encoding::tests::{INVERTED_PACKET, SIMPLE_PACKET},
|
||||||
hal::std::tcp_server::{
|
hal::std::tcp_server::{
|
||||||
tests::{ConnectionFinishedHandler, SyncTmSource},
|
|
||||||
ConnectionResult, ServerConfig,
|
ConnectionResult, ServerConfig,
|
||||||
|
tests::{ConnectionFinishedHandler, SyncTmSource},
|
||||||
},
|
},
|
||||||
queue::GenericSendError,
|
queue::GenericSendError,
|
||||||
tmtc::PacketAsVec,
|
tmtc::PacketAsVec,
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use cobs::encode;
|
use cobs::encode;
|
||||||
@@ -435,7 +435,8 @@ mod tests {
|
|||||||
generic_tmtc_server(&auto_port_addr, tc_sender.clone(), tm_source, None);
|
generic_tmtc_server(&auto_port_addr, tc_sender.clone(), tm_source, None);
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
// Call the connection handler in separate thread, does block.
|
// Call the connection handler in separate thread, does block.
|
||||||
let thread_jh = thread::spawn(move || loop {
|
let thread_jh = thread::spawn(move || {
|
||||||
|
loop {
|
||||||
let result = tcp_server.handle_all_connections(Some(Duration::from_millis(20)));
|
let result = tcp_server.handle_all_connections(Some(Duration::from_millis(20)));
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
panic!("handling connection failed: {:?}", result.unwrap_err());
|
panic!("handling connection failed: {:?}", result.unwrap_err());
|
||||||
@@ -447,6 +448,7 @@ mod tests {
|
|||||||
if Instant::now() - start > Duration::from_millis(100) {
|
if Instant::now() - start > Duration::from_millis(100) {
|
||||||
panic!("regular stop signal handling failed");
|
panic!("regular stop signal handling failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
thread_jh.join().expect("thread join failed");
|
thread_jh.join().expect("thread join failed");
|
||||||
}
|
}
|
||||||
@@ -469,7 +471,8 @@ mod tests {
|
|||||||
let stop_signal_copy = stop_signal.clone();
|
let stop_signal_copy = stop_signal.clone();
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
// Call the connection handler in separate thread, does block.
|
// Call the connection handler in separate thread, does block.
|
||||||
let thread_jh = thread::spawn(move || loop {
|
let thread_jh = thread::spawn(move || {
|
||||||
|
loop {
|
||||||
let result = tcp_server.handle_all_connections(Some(Duration::from_millis(20)));
|
let result = tcp_server.handle_all_connections(Some(Duration::from_millis(20)));
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
panic!("handling connection failed: {:?}", result.unwrap_err());
|
panic!("handling connection failed: {:?}", result.unwrap_err());
|
||||||
@@ -484,6 +487,7 @@ mod tests {
|
|||||||
if Instant::now() - start > Duration::from_millis(100) {
|
if Instant::now() - start > Duration::from_millis(100) {
|
||||||
panic!("regular stop signal handling failed");
|
panic!("regular stop signal handling failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// We connect but do not do anything.
|
// We connect but do not do anything.
|
||||||
let _stream = TcpStream::connect(dest_addr).expect("connecting to TCP server failed");
|
let _stream = TcpStream::connect(dest_addr).expect("connecting to TCP server failed");
|
||||||
|
@@ -11,8 +11,8 @@ use std::io::{self, Read};
|
|||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use crate::tmtc::{PacketSenderRaw, PacketSource};
|
|
||||||
use crate::ComponentId;
|
use crate::ComponentId;
|
||||||
|
use crate::tmtc::{PacketSenderRaw, PacketSource};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
// Re-export the TMTC in COBS server.
|
// Re-export the TMTC in COBS server.
|
||||||
@@ -194,7 +194,7 @@ impl<
|
|||||||
HandledConnection: HandledConnectionHandler,
|
HandledConnection: HandledConnectionHandler,
|
||||||
TmError: 'static,
|
TmError: 'static,
|
||||||
TcSendError: 'static,
|
TcSendError: 'static,
|
||||||
>
|
>
|
||||||
TcpTmtcGenericServer<
|
TcpTmtcGenericServer<
|
||||||
TmSource,
|
TmSource,
|
||||||
TcSender,
|
TcSender,
|
||||||
|
@@ -5,9 +5,9 @@ use mio::net::{TcpListener, TcpStream};
|
|||||||
use std::{io::Write, net::SocketAddr};
|
use std::{io::Write, net::SocketAddr};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
encoding::{ccsds::SpacePacketValidator, parse_buffer_for_ccsds_space_packets},
|
encoding::{ccsds::SpacePacketValidator, parse_buffer_for_ccsds_space_packets},
|
||||||
tmtc::{PacketSenderRaw, PacketSource},
|
tmtc::{PacketSenderRaw, PacketSource},
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::tcp_server::{
|
use super::tcp_server::{
|
||||||
@@ -113,7 +113,7 @@ impl<
|
|||||||
HandledConnection: HandledConnectionHandler,
|
HandledConnection: HandledConnectionHandler,
|
||||||
TmError: 'static,
|
TmError: 'static,
|
||||||
TcError: 'static,
|
TcError: 'static,
|
||||||
> TcpSpacepacketsServer<TmSource, TcSender, Validator, HandledConnection, TmError, TcError>
|
> TcpSpacepacketsServer<TmSource, TcSender, Validator, HandledConnection, TmError, TcError>
|
||||||
{
|
{
|
||||||
///
|
///
|
||||||
/// ## Parameter
|
/// ## Parameter
|
||||||
@@ -185,19 +185,19 @@ mod tests {
|
|||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use spacepackets::{
|
use spacepackets::{
|
||||||
ecss::{tc::PusTcCreator, WritablePusPacket},
|
|
||||||
CcsdsPacket, PacketId, SpHeader,
|
CcsdsPacket, PacketId, SpHeader,
|
||||||
|
ecss::{WritablePusPacket, tc::PusTcCreator},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
encoding::ccsds::{SpValidity, SpacePacketValidator},
|
encoding::ccsds::{SpValidity, SpacePacketValidator},
|
||||||
hal::std::tcp_server::{
|
hal::std::tcp_server::{
|
||||||
tests::{ConnectionFinishedHandler, SyncTmSource},
|
|
||||||
ConnectionResult, ServerConfig,
|
ConnectionResult, ServerConfig,
|
||||||
|
tests::{ConnectionFinishedHandler, SyncTmSource},
|
||||||
},
|
},
|
||||||
queue::GenericSendError,
|
queue::GenericSendError,
|
||||||
tmtc::PacketAsVec,
|
tmtc::PacketAsVec,
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::TcpSpacepacketsServer;
|
use super::TcpSpacepacketsServer;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
//! Generic UDP TC server.
|
//! Generic UDP TC server.
|
||||||
use crate::tmtc::PacketSenderRaw;
|
|
||||||
use crate::ComponentId;
|
use crate::ComponentId;
|
||||||
|
use crate::tmtc::PacketSenderRaw;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use std::io::{self, ErrorKind};
|
use std::io::{self, ErrorKind};
|
||||||
use std::net::{SocketAddr, ToSocketAddrs, UdpSocket};
|
use std::net::{SocketAddr, ToSocketAddrs, UdpSocket};
|
||||||
@@ -105,7 +105,7 @@ impl<TcSender: PacketSenderRaw<Error = SendError>, SendError: Debug + 'static>
|
|||||||
Err(ReceiveResult::NothingReceived)
|
Err(ReceiveResult::NothingReceived)
|
||||||
} else {
|
} else {
|
||||||
Err(e.into())
|
Err(e.into())
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let (num_bytes, from) = res;
|
let (num_bytes, from) = res;
|
||||||
@@ -123,13 +123,13 @@ impl<TcSender: PacketSenderRaw<Error = SendError>, SendError: Debug + 'static>
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use crate::ComponentId;
|
||||||
use crate::hal::std::udp_server::{ReceiveResult, UdpTcServer};
|
use crate::hal::std::udp_server::{ReceiveResult, UdpTcServer};
|
||||||
use crate::queue::GenericSendError;
|
use crate::queue::GenericSendError;
|
||||||
use crate::tmtc::PacketSenderRaw;
|
use crate::tmtc::PacketSenderRaw;
|
||||||
use crate::ComponentId;
|
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use spacepackets::ecss::tc::PusTcCreator;
|
|
||||||
use spacepackets::SpHeader;
|
use spacepackets::SpHeader;
|
||||||
|
use spacepackets::ecss::tc::PusTcCreator;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
@@ -11,11 +11,11 @@ pub use alloc_mod::*;
|
|||||||
pub use std_mod::*;
|
pub use std_mod::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
queue::{GenericReceiveError, GenericSendError},
|
queue::{GenericReceiveError, GenericSendError},
|
||||||
request::{
|
request::{
|
||||||
GenericMessage, MessageMetadata, MessageReceiverProvider, MessageReceiverWithId, RequestId,
|
GenericMessage, MessageMetadata, MessageReceiverProvider, MessageReceiverWithId, RequestId,
|
||||||
},
|
},
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type Mode = u32;
|
pub type Mode = u32;
|
||||||
@@ -313,8 +313,7 @@ pub mod alloc_mod {
|
|||||||
Sender: MessageSenderProvider<ModeReply>,
|
Sender: MessageSenderProvider<ModeReply>,
|
||||||
Receiver: MessageReceiverProvider<From>,
|
Receiver: MessageReceiverProvider<From>,
|
||||||
SenderStore: MessageSenderStoreProvider<ModeReply, Sender>,
|
SenderStore: MessageSenderStoreProvider<ModeReply, Sender>,
|
||||||
> ModeReplySender
|
> ModeReplySender for MessageSenderAndReceiver<ModeReply, From, Sender, Receiver, SenderStore>
|
||||||
for MessageSenderAndReceiver<ModeReply, From, Sender, Receiver, SenderStore>
|
|
||||||
{
|
{
|
||||||
fn local_channel_id(&self) -> ComponentId {
|
fn local_channel_id(&self) -> ComponentId {
|
||||||
self.local_channel_id_generic()
|
self.local_channel_id_generic()
|
||||||
@@ -338,8 +337,7 @@ pub mod alloc_mod {
|
|||||||
Sender: MessageSenderProvider<To>,
|
Sender: MessageSenderProvider<To>,
|
||||||
Receiver: MessageReceiverProvider<ModeReply>,
|
Receiver: MessageReceiverProvider<ModeReply>,
|
||||||
SenderStore: MessageSenderStoreProvider<To, Sender>,
|
SenderStore: MessageSenderStoreProvider<To, Sender>,
|
||||||
> ModeReplyReceiver
|
> ModeReplyReceiver for MessageSenderAndReceiver<To, ModeReply, Sender, Receiver, SenderStore>
|
||||||
for MessageSenderAndReceiver<To, ModeReply, Sender, Receiver, SenderStore>
|
|
||||||
{
|
{
|
||||||
fn try_recv_mode_reply(
|
fn try_recv_mode_reply(
|
||||||
&self,
|
&self,
|
||||||
@@ -726,7 +724,7 @@ pub(crate) mod tests {
|
|||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
use crate::{request::RequestId, ComponentId};
|
use crate::{ComponentId, request::RequestId};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@ use alloc::vec::Vec;
|
|||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
mode::{Mode, ModeAndSubmode, ModeReply, ModeRequest, Submode},
|
mode::{Mode, ModeAndSubmode, ModeReply, ModeRequest, Submode},
|
||||||
request::MessageSenderProvider,
|
request::MessageSenderProvider,
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
|
@@ -47,10 +47,10 @@ use crate::pool::PoolAddr;
|
|||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use core::mem::size_of;
|
use core::mem::size_of;
|
||||||
use paste::paste;
|
use paste::paste;
|
||||||
use spacepackets::ecss::{EcssEnumU16, EcssEnumU32, EcssEnumU64, EcssEnumU8};
|
use spacepackets::ByteConversionError;
|
||||||
|
use spacepackets::ecss::{EcssEnumU8, EcssEnumU16, EcssEnumU32, EcssEnumU64};
|
||||||
pub use spacepackets::util::ToBeBytes;
|
pub use spacepackets::util::ToBeBytes;
|
||||||
use spacepackets::util::UnsignedEnum;
|
use spacepackets::util::UnsignedEnum;
|
||||||
use spacepackets::ByteConversionError;
|
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use alloc::string::{String, ToString};
|
use alloc::string::{String, ToString};
|
||||||
|
@@ -281,7 +281,7 @@ pub trait PoolProviderWithGuards: PoolProvider {
|
|||||||
/// This can prevent memory leaks. Users can read the data and release the guard
|
/// This can prevent memory leaks. Users can read the data and release the guard
|
||||||
/// if the data in the store is valid for further processing. If the data is faulty, no
|
/// if the data in the store is valid for further processing. If the data is faulty, no
|
||||||
/// manual deletion is necessary when returning from a processing function prematurely.
|
/// manual deletion is necessary when returning from a processing function prematurely.
|
||||||
fn read_with_guard(&mut self, addr: PoolAddr) -> PoolGuard<Self>;
|
fn read_with_guard(&mut self, addr: PoolAddr) -> PoolGuard<'_, Self>;
|
||||||
|
|
||||||
/// This function behaves like [PoolProvider::modify], but consumes the provided
|
/// This function behaves like [PoolProvider::modify], but consumes the provided
|
||||||
/// address and returns a RAII conformant guard object.
|
/// address and returns a RAII conformant guard object.
|
||||||
@@ -291,7 +291,7 @@ pub trait PoolProviderWithGuards: PoolProvider {
|
|||||||
/// This can prevent memory leaks. Users can read (and modify) the data and release the guard
|
/// This can prevent memory leaks. Users can read (and modify) the data and release the guard
|
||||||
/// if the data in the store is valid for further processing. If the data is faulty, no
|
/// if the data in the store is valid for further processing. If the data is faulty, no
|
||||||
/// manual deletion is necessary when returning from a processing function prematurely.
|
/// manual deletion is necessary when returning from a processing function prematurely.
|
||||||
fn modify_with_guard(&mut self, addr: PoolAddr) -> PoolRwGuard<Self>;
|
fn modify_with_guard(&mut self, addr: PoolAddr) -> PoolRwGuard<'_, Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PoolGuard<'a, MemProvider: PoolProvider + ?Sized> {
|
pub struct PoolGuard<'a, MemProvider: PoolProvider + ?Sized> {
|
||||||
@@ -602,7 +602,7 @@ pub mod heapless_mod {
|
|||||||
if i < start_at_subpool as usize {
|
if i < start_at_subpool as usize {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if pool_cfg.block_size as usize >= req_size {
|
if pool_cfg.block_size >= req_size {
|
||||||
return Ok(i as u16);
|
return Ok(i as u16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -638,7 +638,7 @@ pub mod heapless_mod {
|
|||||||
|
|
||||||
fn raw_pos(&self, addr: &StaticPoolAddr) -> Option<usize> {
|
fn raw_pos(&self, addr: &StaticPoolAddr) -> Option<usize> {
|
||||||
let (pool_cfg, _) = self.pool.get(addr.pool_idx as usize)?;
|
let (pool_cfg, _) = self.pool.get(addr.pool_idx as usize)?;
|
||||||
Some(addr.packet_idx as usize * pool_cfg.block_size as usize)
|
Some(addr.packet_idx as usize * pool_cfg.block_size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,7 +707,7 @@ pub mod heapless_mod {
|
|||||||
let subpool_cfg = self.pool.get(addr.pool_idx as usize).unwrap().0;
|
let subpool_cfg = self.pool.get(addr.pool_idx as usize).unwrap().0;
|
||||||
let raw_pos = self.raw_pos(&addr).unwrap();
|
let raw_pos = self.raw_pos(&addr).unwrap();
|
||||||
let block = &mut self.pool.get_mut(addr.pool_idx as usize).unwrap().1
|
let block = &mut self.pool.get_mut(addr.pool_idx as usize).unwrap().1
|
||||||
[raw_pos..raw_pos + subpool_cfg.block_size as usize];
|
[raw_pos..raw_pos + subpool_cfg.block_size];
|
||||||
let size_list = self.sizes_lists.get_mut(addr.pool_idx as usize).unwrap();
|
let size_list = self.sizes_lists.get_mut(addr.pool_idx as usize).unwrap();
|
||||||
size_list[addr.packet_idx as usize] = STORE_FREE;
|
size_list[addr.packet_idx as usize] = STORE_FREE;
|
||||||
block.fill(0);
|
block.fill(0);
|
||||||
@@ -742,11 +742,11 @@ pub mod heapless_mod {
|
|||||||
impl<const MAX_NUM_SUBPOOLS: usize> PoolProviderWithGuards
|
impl<const MAX_NUM_SUBPOOLS: usize> PoolProviderWithGuards
|
||||||
for StaticHeaplessMemoryPool<MAX_NUM_SUBPOOLS>
|
for StaticHeaplessMemoryPool<MAX_NUM_SUBPOOLS>
|
||||||
{
|
{
|
||||||
fn modify_with_guard(&mut self, addr: PoolAddr) -> PoolRwGuard<Self> {
|
fn modify_with_guard(&mut self, addr: PoolAddr) -> PoolRwGuard<'_, Self> {
|
||||||
PoolRwGuard::new(self, addr)
|
PoolRwGuard::new(self, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_with_guard(&mut self, addr: PoolAddr) -> PoolGuard<Self> {
|
fn read_with_guard(&mut self, addr: PoolAddr) -> PoolGuard<'_, Self> {
|
||||||
PoolGuard::new(self, addr)
|
PoolGuard::new(self, addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1058,11 +1058,11 @@ mod alloc_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PoolProviderWithGuards for StaticMemoryPool {
|
impl PoolProviderWithGuards for StaticMemoryPool {
|
||||||
fn modify_with_guard(&mut self, addr: PoolAddr) -> PoolRwGuard<Self> {
|
fn modify_with_guard(&mut self, addr: PoolAddr) -> PoolRwGuard<'_, Self> {
|
||||||
PoolRwGuard::new(self, addr)
|
PoolRwGuard::new(self, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_with_guard(&mut self, addr: PoolAddr) -> PoolGuard<Self> {
|
fn read_with_guard(&mut self, addr: PoolAddr) -> PoolGuard<'_, Self> {
|
||||||
PoolGuard::new(self, addr)
|
PoolGuard::new(self, addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1307,9 +1307,11 @@ mod tests {
|
|||||||
let addr = pool_provider.add(&test_buf).expect("Adding data failed");
|
let addr = pool_provider.add(&test_buf).expect("Adding data failed");
|
||||||
let read_guard = PoolGuard::new(pool_provider, addr);
|
let read_guard = PoolGuard::new(pool_provider, addr);
|
||||||
drop(read_guard);
|
drop(read_guard);
|
||||||
assert!(!pool_provider
|
assert!(
|
||||||
|
!pool_provider
|
||||||
.has_element_at(&addr)
|
.has_element_at(&addr)
|
||||||
.expect("Invalid address"));
|
.expect("Invalid address")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generic_test_pool_guard_deletion(pool_provider: &mut impl PoolProviderWithGuards) {
|
fn generic_test_pool_guard_deletion(pool_provider: &mut impl PoolProviderWithGuards) {
|
||||||
@@ -1317,9 +1319,11 @@ mod tests {
|
|||||||
let addr = pool_provider.add(&test_buf).expect("Adding data failed");
|
let addr = pool_provider.add(&test_buf).expect("Adding data failed");
|
||||||
let read_guard = pool_provider.read_with_guard(addr);
|
let read_guard = pool_provider.read_with_guard(addr);
|
||||||
drop(read_guard);
|
drop(read_guard);
|
||||||
assert!(!pool_provider
|
assert!(
|
||||||
|
!pool_provider
|
||||||
.has_element_at(&addr)
|
.has_element_at(&addr)
|
||||||
.expect("Invalid address"));
|
.expect("Invalid address")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generic_test_pool_guard_with_release(pool_provider: &mut impl PoolProviderWithGuards) {
|
fn generic_test_pool_guard_with_release(pool_provider: &mut impl PoolProviderWithGuards) {
|
||||||
@@ -1328,9 +1332,11 @@ mod tests {
|
|||||||
let mut read_guard = PoolGuard::new(pool_provider, addr);
|
let mut read_guard = PoolGuard::new(pool_provider, addr);
|
||||||
read_guard.release();
|
read_guard.release();
|
||||||
drop(read_guard);
|
drop(read_guard);
|
||||||
assert!(pool_provider
|
assert!(
|
||||||
|
pool_provider
|
||||||
.has_element_at(&addr)
|
.has_element_at(&addr)
|
||||||
.expect("Invalid address"));
|
.expect("Invalid address")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generic_test_pool_modify_guard_man_creation(
|
fn generic_test_pool_modify_guard_man_creation(
|
||||||
@@ -1341,9 +1347,11 @@ mod tests {
|
|||||||
let mut rw_guard = PoolRwGuard::new(pool_provider, addr);
|
let mut rw_guard = PoolRwGuard::new(pool_provider, addr);
|
||||||
rw_guard.update(&mut |_| {}).expect("modify failed");
|
rw_guard.update(&mut |_| {}).expect("modify failed");
|
||||||
drop(rw_guard);
|
drop(rw_guard);
|
||||||
assert!(!pool_provider
|
assert!(
|
||||||
|
!pool_provider
|
||||||
.has_element_at(&addr)
|
.has_element_at(&addr)
|
||||||
.expect("Invalid address"));
|
.expect("Invalid address")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generic_test_pool_modify_guard(pool_provider: &mut impl PoolProviderWithGuards) {
|
fn generic_test_pool_modify_guard(pool_provider: &mut impl PoolProviderWithGuards) {
|
||||||
@@ -1352,9 +1360,11 @@ mod tests {
|
|||||||
let mut rw_guard = pool_provider.modify_with_guard(addr);
|
let mut rw_guard = pool_provider.modify_with_guard(addr);
|
||||||
rw_guard.update(&mut |_| {}).expect("modify failed");
|
rw_guard.update(&mut |_| {}).expect("modify failed");
|
||||||
drop(rw_guard);
|
drop(rw_guard);
|
||||||
assert!(!pool_provider
|
assert!(
|
||||||
|
!pool_provider
|
||||||
.has_element_at(&addr)
|
.has_element_at(&addr)
|
||||||
.expect("Invalid address"));
|
.expect("Invalid address")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generic_modify_pool_index_above_0(pool_provider: &mut impl PoolProvider) {
|
fn generic_modify_pool_index_above_0(pool_provider: &mut impl PoolProvider) {
|
||||||
@@ -1654,30 +1664,36 @@ mod tests {
|
|||||||
fn small_heapless_pool() -> StaticHeaplessMemoryPool<3> {
|
fn small_heapless_pool() -> StaticHeaplessMemoryPool<3> {
|
||||||
let mut heapless_pool: StaticHeaplessMemoryPool<3> =
|
let mut heapless_pool: StaticHeaplessMemoryPool<3> =
|
||||||
StaticHeaplessMemoryPool::new(false);
|
StaticHeaplessMemoryPool::new(false);
|
||||||
assert!(heapless_pool
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_1.take(),
|
SUBPOOL_1.take(),
|
||||||
unsafe { &mut *SUBPOOL_1_SIZES.lock().unwrap().get() },
|
unsafe { &mut *SUBPOOL_1_SIZES.lock().unwrap().get() },
|
||||||
SUBPOOL_1_NUM_ELEMENTS,
|
SUBPOOL_1_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(heapless_pool
|
);
|
||||||
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_2.take(),
|
SUBPOOL_2.take(),
|
||||||
SUBPOOL_2_SIZES.take(),
|
SUBPOOL_2_SIZES.take(),
|
||||||
SUBPOOL_2_NUM_ELEMENTS,
|
SUBPOOL_2_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(heapless_pool
|
);
|
||||||
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_3.take(),
|
SUBPOOL_3.take(),
|
||||||
SUBPOOL_3_SIZES.take(),
|
SUBPOOL_3_SIZES.take(),
|
||||||
SUBPOOL_3_NUM_ELEMENTS,
|
SUBPOOL_3_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
|
);
|
||||||
heapless_pool
|
heapless_pool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1793,22 +1809,26 @@ mod tests {
|
|||||||
fn test_spills_to_higher_subpools() {
|
fn test_spills_to_higher_subpools() {
|
||||||
let mut heapless_pool: StaticHeaplessMemoryPool<2> =
|
let mut heapless_pool: StaticHeaplessMemoryPool<2> =
|
||||||
StaticHeaplessMemoryPool::new(true);
|
StaticHeaplessMemoryPool::new(true);
|
||||||
assert!(heapless_pool
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_2.take(),
|
SUBPOOL_2.take(),
|
||||||
SUBPOOL_2_SIZES.take(),
|
SUBPOOL_2_SIZES.take(),
|
||||||
SUBPOOL_2_NUM_ELEMENTS,
|
SUBPOOL_2_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(heapless_pool
|
);
|
||||||
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_4.take(),
|
SUBPOOL_4.take(),
|
||||||
SUBPOOL_4_SIZES.take(),
|
SUBPOOL_4_SIZES.take(),
|
||||||
SUBPOOL_4_NUM_ELEMENTS,
|
SUBPOOL_4_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
|
);
|
||||||
generic_test_spills_to_higher_subpools(&mut heapless_pool);
|
generic_test_spills_to_higher_subpools(&mut heapless_pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1816,22 +1836,26 @@ mod tests {
|
|||||||
fn test_spillage_fails_as_well() {
|
fn test_spillage_fails_as_well() {
|
||||||
let mut heapless_pool: StaticHeaplessMemoryPool<2> =
|
let mut heapless_pool: StaticHeaplessMemoryPool<2> =
|
||||||
StaticHeaplessMemoryPool::new(true);
|
StaticHeaplessMemoryPool::new(true);
|
||||||
assert!(heapless_pool
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_5.take(),
|
SUBPOOL_5.take(),
|
||||||
SUBPOOL_5_SIZES.take(),
|
SUBPOOL_5_SIZES.take(),
|
||||||
SUBPOOL_5_NUM_ELEMENTS,
|
SUBPOOL_5_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(heapless_pool
|
);
|
||||||
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_3.take(),
|
SUBPOOL_3.take(),
|
||||||
SUBPOOL_3_SIZES.take(),
|
SUBPOOL_3_SIZES.take(),
|
||||||
SUBPOOL_3_NUM_ELEMENTS,
|
SUBPOOL_3_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
|
);
|
||||||
generic_test_spillage_fails_as_well(&mut heapless_pool);
|
generic_test_spillage_fails_as_well(&mut heapless_pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1839,30 +1863,36 @@ mod tests {
|
|||||||
fn test_spillage_works_across_multiple_subpools() {
|
fn test_spillage_works_across_multiple_subpools() {
|
||||||
let mut heapless_pool: StaticHeaplessMemoryPool<3> =
|
let mut heapless_pool: StaticHeaplessMemoryPool<3> =
|
||||||
StaticHeaplessMemoryPool::new(true);
|
StaticHeaplessMemoryPool::new(true);
|
||||||
assert!(heapless_pool
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_5.take(),
|
SUBPOOL_5.take(),
|
||||||
SUBPOOL_5_SIZES.take(),
|
SUBPOOL_5_SIZES.take(),
|
||||||
SUBPOOL_5_NUM_ELEMENTS,
|
SUBPOOL_5_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(heapless_pool
|
);
|
||||||
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_6.take(),
|
SUBPOOL_6.take(),
|
||||||
SUBPOOL_6_SIZES.take(),
|
SUBPOOL_6_SIZES.take(),
|
||||||
SUBPOOL_6_NUM_ELEMENTS,
|
SUBPOOL_6_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(heapless_pool
|
);
|
||||||
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_3.take(),
|
SUBPOOL_3.take(),
|
||||||
SUBPOOL_3_SIZES.take(),
|
SUBPOOL_3_SIZES.take(),
|
||||||
SUBPOOL_3_NUM_ELEMENTS,
|
SUBPOOL_3_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
|
);
|
||||||
generic_test_spillage_works_across_multiple_subpools(&mut heapless_pool);
|
generic_test_spillage_works_across_multiple_subpools(&mut heapless_pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1870,30 +1900,36 @@ mod tests {
|
|||||||
fn test_spillage_fails_across_multiple_subpools() {
|
fn test_spillage_fails_across_multiple_subpools() {
|
||||||
let mut heapless_pool: StaticHeaplessMemoryPool<3> =
|
let mut heapless_pool: StaticHeaplessMemoryPool<3> =
|
||||||
StaticHeaplessMemoryPool::new(true);
|
StaticHeaplessMemoryPool::new(true);
|
||||||
assert!(heapless_pool
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_5.take(),
|
SUBPOOL_5.take(),
|
||||||
SUBPOOL_5_SIZES.take(),
|
SUBPOOL_5_SIZES.take(),
|
||||||
SUBPOOL_5_NUM_ELEMENTS,
|
SUBPOOL_5_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(heapless_pool
|
);
|
||||||
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_6.take(),
|
SUBPOOL_6.take(),
|
||||||
SUBPOOL_6_SIZES.take(),
|
SUBPOOL_6_SIZES.take(),
|
||||||
SUBPOOL_6_NUM_ELEMENTS,
|
SUBPOOL_6_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(heapless_pool
|
);
|
||||||
|
assert!(
|
||||||
|
heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_3.take(),
|
SUBPOOL_3.take(),
|
||||||
SUBPOOL_3_SIZES.take(),
|
SUBPOOL_3_SIZES.take(),
|
||||||
SUBPOOL_3_NUM_ELEMENTS,
|
SUBPOOL_3_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
|
);
|
||||||
generic_test_spillage_fails_across_multiple_subpools(&mut heapless_pool);
|
generic_test_spillage_fails_across_multiple_subpools(&mut heapless_pool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -190,7 +190,7 @@ mod tests {
|
|||||||
|
|
||||||
use std::sync::mpsc::{self, TryRecvError};
|
use std::sync::mpsc::{self, TryRecvError};
|
||||||
|
|
||||||
use crate::{queue::GenericSendError, request::GenericMessage, ComponentId};
|
use crate::{ComponentId, queue::GenericSendError, request::GenericMessage};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@@ -65,13 +65,13 @@ impl GenericActionReplyPus {
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub mod alloc_mod {
|
pub mod alloc_mod {
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
action::ActionRequest,
|
action::ActionRequest,
|
||||||
queue::{GenericReceiveError, GenericSendError},
|
queue::{GenericReceiveError, GenericSendError},
|
||||||
request::{
|
request::{
|
||||||
GenericMessage, MessageReceiverProvider, MessageSenderAndReceiver,
|
GenericMessage, MessageReceiverProvider, MessageSenderAndReceiver,
|
||||||
MessageSenderProvider, MessageSenderStoreProvider, RequestId,
|
MessageSenderProvider, MessageSenderStoreProvider, RequestId,
|
||||||
},
|
},
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::ActionReplyPus;
|
use super::ActionReplyPus;
|
||||||
@@ -141,12 +141,12 @@ pub mod std_mod {
|
|||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
pus::{
|
pus::{
|
||||||
verification::{self, TcStateToken},
|
|
||||||
ActivePusRequestStd, ActiveRequestProvider, DefaultActiveRequestMap,
|
ActivePusRequestStd, ActiveRequestProvider, DefaultActiveRequestMap,
|
||||||
|
verification::{self, TcStateToken},
|
||||||
},
|
},
|
||||||
request::{MessageSenderMap, OneMessageSender},
|
request::{MessageSenderMap, OneMessageSender},
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
use crate::pus::source_buffer_large_enough;
|
use crate::pus::source_buffer_large_enough;
|
||||||
|
use spacepackets::ByteConversionError;
|
||||||
|
use spacepackets::ecss::EcssEnumeration;
|
||||||
use spacepackets::ecss::tm::PusTmCreator;
|
use spacepackets::ecss::tm::PusTmCreator;
|
||||||
use spacepackets::ecss::tm::PusTmSecondaryHeader;
|
use spacepackets::ecss::tm::PusTmSecondaryHeader;
|
||||||
use spacepackets::ecss::EcssEnumeration;
|
use spacepackets::{MAX_APID, SpHeader};
|
||||||
use spacepackets::ByteConversionError;
|
|
||||||
use spacepackets::{SpHeader, MAX_APID};
|
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub use alloc_mod::*;
|
pub use alloc_mod::*;
|
||||||
@@ -132,8 +132,8 @@ impl EventReportCreator {
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
mod alloc_mod {
|
mod alloc_mod {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::pus::{EcssTmSender, EcssTmtcError};
|
|
||||||
use crate::ComponentId;
|
use crate::ComponentId;
|
||||||
|
use crate::pus::{EcssTmSender, EcssTmtcError};
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
@@ -265,13 +265,13 @@ mod alloc_mod {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::ComponentId;
|
||||||
use crate::events::{EventU32, Severity};
|
use crate::events::{EventU32, Severity};
|
||||||
use crate::pus::test_util::TEST_COMPONENT_ID_0;
|
use crate::pus::test_util::TEST_COMPONENT_ID_0;
|
||||||
use crate::pus::tests::CommonTmInfo;
|
use crate::pus::tests::CommonTmInfo;
|
||||||
use crate::pus::{ChannelWithId, EcssTmSender, EcssTmtcError, PusTmVariant};
|
use crate::pus::{ChannelWithId, EcssTmSender, EcssTmtcError, PusTmVariant};
|
||||||
use crate::ComponentId;
|
|
||||||
use spacepackets::ecss::PusError;
|
|
||||||
use spacepackets::ByteConversionError;
|
use spacepackets::ByteConversionError;
|
||||||
|
use spacepackets::ecss::PusError;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
@@ -6,13 +6,13 @@ use core::hash::Hash;
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
|
||||||
pub use crate::pus::event::EventReporter;
|
|
||||||
use crate::pus::verification::TcStateToken;
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use crate::pus::EcssTmSender;
|
use crate::pus::EcssTmSender;
|
||||||
use crate::pus::EcssTmtcError;
|
use crate::pus::EcssTmtcError;
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
|
pub use crate::pus::event::EventReporter;
|
||||||
|
use crate::pus::verification::TcStateToken;
|
||||||
|
#[cfg(feature = "alloc")]
|
||||||
pub use alloc_mod::*;
|
pub use alloc_mod::*;
|
||||||
#[cfg(feature = "heapless")]
|
#[cfg(feature = "heapless")]
|
||||||
pub use heapless_mod::*;
|
pub use heapless_mod::*;
|
||||||
@@ -311,9 +311,9 @@ pub mod alloc_mod {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use alloc::string::{String, ToString};
|
use alloc::string::{String, ToString};
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
|
use spacepackets::ecss::PusPacket;
|
||||||
use spacepackets::ecss::event::Subservice;
|
use spacepackets::ecss::event::Subservice;
|
||||||
use spacepackets::ecss::tm::PusTmReader;
|
use spacepackets::ecss::tm::PusTmReader;
|
||||||
use spacepackets::ecss::PusPacket;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::request::UniqueApidTargetId;
|
use crate::request::UniqueApidTargetId;
|
||||||
|
@@ -3,8 +3,8 @@ use crate::pus::event_man::{EventRequest, EventRequestWithToken};
|
|||||||
use crate::pus::verification::TcStateToken;
|
use crate::pus::verification::TcStateToken;
|
||||||
use crate::pus::{DirectPusPacketHandlerResult, PartialPusHandlingError, PusPacketHandlingError};
|
use crate::pus::{DirectPusPacketHandlerResult, PartialPusHandlingError, PusPacketHandlingError};
|
||||||
use crate::queue::GenericSendError;
|
use crate::queue::GenericSendError;
|
||||||
use spacepackets::ecss::event::Subservice;
|
|
||||||
use spacepackets::ecss::PusPacket;
|
use spacepackets::ecss::PusPacket;
|
||||||
|
use spacepackets::ecss::event::Subservice;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
|
|
||||||
use super::verification::VerificationReportingProvider;
|
use super::verification::VerificationReportingProvider;
|
||||||
@@ -29,7 +29,7 @@ impl<
|
|||||||
TmSender: EcssTmSender,
|
TmSender: EcssTmSender,
|
||||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||||
VerificationReporter: VerificationReportingProvider,
|
VerificationReporter: VerificationReportingProvider,
|
||||||
> PusEventServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
|
> PusEventServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
|
||||||
{
|
{
|
||||||
pub fn new(
|
pub fn new(
|
||||||
service_helper: PusServiceHelper<
|
service_helper: PusServiceHelper<
|
||||||
@@ -122,7 +122,7 @@ impl<
|
|||||||
| Subservice::TmHighSeverityReport => {
|
| Subservice::TmHighSeverityReport => {
|
||||||
return Err(PusPacketHandlingError::RequestConversion(
|
return Err(PusPacketHandlingError::RequestConversion(
|
||||||
GenericConversionError::WrongService(tc.subservice()),
|
GenericConversionError::WrongService(tc.subservice()),
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
Subservice::TcEnableEventGeneration => {
|
Subservice::TcEnableEventGeneration => {
|
||||||
handle_enable_disable_request(true)?;
|
handle_enable_disable_request(true)?;
|
||||||
@@ -146,14 +146,14 @@ impl<
|
|||||||
mod tests {
|
mod tests {
|
||||||
use delegate::delegate;
|
use delegate::delegate;
|
||||||
use spacepackets::ecss::event::Subservice;
|
use spacepackets::ecss::event::Subservice;
|
||||||
use spacepackets::time::{cds, TimeWriter};
|
use spacepackets::time::{TimeWriter, cds};
|
||||||
use spacepackets::util::UnsignedEnum;
|
use spacepackets::util::UnsignedEnum;
|
||||||
use spacepackets::{
|
use spacepackets::{
|
||||||
|
SpHeader,
|
||||||
ecss::{
|
ecss::{
|
||||||
tc::{PusTcCreator, PusTcSecondaryHeader},
|
tc::{PusTcCreator, PusTcSecondaryHeader},
|
||||||
tm::PusTmReader,
|
tm::PusTmReader,
|
||||||
},
|
},
|
||||||
SpHeader,
|
|
||||||
};
|
};
|
||||||
use std::sync::mpsc::{self, Sender};
|
use std::sync::mpsc::{self, Sender};
|
||||||
|
|
||||||
@@ -167,10 +167,10 @@ mod tests {
|
|||||||
use crate::{
|
use crate::{
|
||||||
events::EventU32,
|
events::EventU32,
|
||||||
pus::{
|
pus::{
|
||||||
|
DirectPusPacketHandlerResult, EcssTcInSharedPoolConverter, PusPacketHandlingError,
|
||||||
event_man::EventRequestWithToken,
|
event_man::EventRequestWithToken,
|
||||||
tests::PusServiceHandlerWithSharedStoreCommon,
|
tests::PusServiceHandlerWithSharedStoreCommon,
|
||||||
verification::{TcStateAccepted, VerificationToken},
|
verification::{TcStateAccepted, VerificationToken},
|
||||||
DirectPusPacketHandlerResult, EcssTcInSharedPoolConverter, PusPacketHandlingError,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! This module contains structures to make working with the PUS C standard easier.
|
//! This module contains structures to make working with the PUS C standard easier.
|
||||||
//! The satrs-example application contains various usage examples of these components.
|
//! The satrs-example application contains various usage examples of these components.
|
||||||
|
use crate::ComponentId;
|
||||||
use crate::pool::{PoolAddr, PoolError};
|
use crate::pool::{PoolAddr, PoolError};
|
||||||
use crate::pus::verification::{TcStateAccepted, TcStateToken, VerificationToken};
|
use crate::pus::verification::{TcStateAccepted, TcStateToken, VerificationToken};
|
||||||
use crate::queue::{GenericReceiveError, GenericSendError};
|
use crate::queue::{GenericReceiveError, GenericSendError};
|
||||||
@@ -9,19 +10,18 @@ use crate::request::{GenericMessage, MessageMetadata, RequestId};
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use crate::tmtc::PacketAsVec;
|
use crate::tmtc::PacketAsVec;
|
||||||
use crate::tmtc::PacketInPool;
|
use crate::tmtc::PacketInPool;
|
||||||
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")]
|
||||||
use downcast_rs::{impl_downcast, Downcast};
|
use downcast_rs::{Downcast, impl_downcast};
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use dyn_clone::DynClone;
|
use dyn_clone::DynClone;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
|
use spacepackets::ecss::PusError;
|
||||||
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader};
|
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader};
|
||||||
use spacepackets::ecss::tm::PusTmCreator;
|
use spacepackets::ecss::tm::PusTmCreator;
|
||||||
use spacepackets::ecss::PusError;
|
|
||||||
use spacepackets::{ByteConversionError, SpHeader};
|
use spacepackets::{ByteConversionError, SpHeader};
|
||||||
|
|
||||||
pub mod action;
|
pub mod action;
|
||||||
@@ -659,18 +659,18 @@ pub mod alloc_mod {
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub mod std_mod {
|
pub mod std_mod {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::ComponentId;
|
||||||
use crate::pool::{
|
use crate::pool::{
|
||||||
PoolAddr, PoolError, PoolProvider, PoolProviderWithGuards, SharedStaticMemoryPool,
|
PoolAddr, PoolError, PoolProvider, PoolProviderWithGuards, SharedStaticMemoryPool,
|
||||||
};
|
};
|
||||||
use crate::pus::verification::{TcStateAccepted, VerificationToken};
|
use crate::pus::verification::{TcStateAccepted, VerificationToken};
|
||||||
use crate::tmtc::{PacketAsVec, PacketSenderWithSharedPool};
|
use crate::tmtc::{PacketAsVec, PacketSenderWithSharedPool};
|
||||||
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::WritablePusPacket;
|
|
||||||
use spacepackets::time::StdTimestampError;
|
|
||||||
use spacepackets::ByteConversionError;
|
use spacepackets::ByteConversionError;
|
||||||
|
use spacepackets::ecss::WritablePusPacket;
|
||||||
|
use spacepackets::ecss::tc::PusTcReader;
|
||||||
|
use spacepackets::time::StdTimestampError;
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::sync::mpsc::TryRecvError;
|
use std::sync::mpsc::TryRecvError;
|
||||||
@@ -1261,8 +1261,8 @@ pub mod test_util {
|
|||||||
use crate::request::UniqueApidTargetId;
|
use crate::request::UniqueApidTargetId;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
verification::{self, TcStateAccepted, VerificationToken},
|
|
||||||
DirectPusPacketHandlerResult, PusPacketHandlingError,
|
DirectPusPacketHandlerResult, PusPacketHandlingError,
|
||||||
|
verification::{self, TcStateAccepted, VerificationToken},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const TEST_APID: u16 = 0x101;
|
pub const TEST_APID: u16 = 0x101;
|
||||||
@@ -1296,21 +1296,21 @@ pub mod test_util {
|
|||||||
pub mod tests {
|
pub mod tests {
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use std::sync::mpsc::TryRecvError;
|
use std::sync::mpsc::TryRecvError;
|
||||||
use std::sync::{mpsc, RwLock};
|
use std::sync::{RwLock, mpsc};
|
||||||
|
|
||||||
use alloc::collections::VecDeque;
|
use alloc::collections::VecDeque;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use satrs_shared::res_code::ResultU16;
|
use satrs_shared::res_code::ResultU16;
|
||||||
|
use spacepackets::CcsdsPacket;
|
||||||
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader};
|
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader};
|
||||||
use spacepackets::ecss::tm::{GenericPusTmSecondaryHeader, PusTmCreator, PusTmReader};
|
use spacepackets::ecss::tm::{GenericPusTmSecondaryHeader, PusTmCreator, PusTmReader};
|
||||||
use spacepackets::ecss::{PusPacket, WritablePusPacket};
|
use spacepackets::ecss::{PusPacket, WritablePusPacket};
|
||||||
use spacepackets::CcsdsPacket;
|
|
||||||
use test_util::{TEST_APID, TEST_COMPONENT_ID_0};
|
use test_util::{TEST_APID, TEST_COMPONENT_ID_0};
|
||||||
|
|
||||||
|
use crate::ComponentId;
|
||||||
use crate::pool::{PoolProvider, SharedStaticMemoryPool, StaticMemoryPool, StaticPoolConfig};
|
use crate::pool::{PoolProvider, SharedStaticMemoryPool, StaticMemoryPool, StaticPoolConfig};
|
||||||
use crate::pus::verification::{RequestId, VerificationReporter};
|
use crate::pus::verification::{RequestId, VerificationReporter};
|
||||||
use crate::tmtc::{PacketAsVec, PacketInPool, PacketSenderWithSharedPool, SharedPacketPool};
|
use crate::tmtc::{PacketAsVec, PacketInPool, PacketSenderWithSharedPool, SharedPacketPool};
|
||||||
use crate::ComponentId;
|
|
||||||
|
|
||||||
use super::verification::test_util::TestVerificationReporter;
|
use super::verification::test_util::TestVerificationReporter;
|
||||||
use super::verification::{
|
use super::verification::{
|
||||||
|
@@ -340,8 +340,8 @@ pub fn generate_insert_telecommand_app_data(
|
|||||||
pub mod alloc_mod {
|
pub mod alloc_mod {
|
||||||
use alloc::{
|
use alloc::{
|
||||||
collections::{
|
collections::{
|
||||||
btree_map::{Entry, Range},
|
|
||||||
BTreeMap,
|
BTreeMap,
|
||||||
|
btree_map::{Entry, Range},
|
||||||
},
|
},
|
||||||
vec::Vec,
|
vec::Vec,
|
||||||
};
|
};
|
||||||
@@ -855,9 +855,9 @@ mod tests {
|
|||||||
PoolAddr, PoolError, PoolProvider, StaticMemoryPool, StaticPoolAddr, StaticPoolConfig,
|
PoolAddr, PoolError, PoolProvider, StaticMemoryPool, StaticPoolAddr, StaticPoolConfig,
|
||||||
};
|
};
|
||||||
use alloc::collections::btree_map::Range;
|
use alloc::collections::btree_map::Range;
|
||||||
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
|
|
||||||
use spacepackets::ecss::WritablePusPacket;
|
use spacepackets::ecss::WritablePusPacket;
|
||||||
use spacepackets::time::{cds, TimeWriter, UnixTime};
|
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
|
||||||
|
use spacepackets::time::{TimeWriter, UnixTime, cds};
|
||||||
use spacepackets::{PacketId, PacketSequenceCtrl, PacketType, SequenceFlags, SpHeader};
|
use spacepackets::{PacketId, PacketSequenceCtrl, PacketType, SequenceFlags, SpHeader};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
@@ -9,7 +9,7 @@ use crate::pool::PoolProvider;
|
|||||||
use crate::pus::PusPacketHandlingError;
|
use crate::pus::PusPacketHandlingError;
|
||||||
use crate::tmtc::{PacketAsVec, PacketSenderWithSharedPool};
|
use crate::tmtc::{PacketAsVec, PacketSenderWithSharedPool};
|
||||||
use alloc::string::ToString;
|
use alloc::string::ToString;
|
||||||
use spacepackets::ecss::{scheduling, PusPacket};
|
use spacepackets::ecss::{PusPacket, scheduling};
|
||||||
use spacepackets::time::cds::CdsTime;
|
use spacepackets::time::cds::CdsTime;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
|
|
||||||
@@ -39,8 +39,7 @@ impl<
|
|||||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||||
VerificationReporter: VerificationReportingProvider,
|
VerificationReporter: VerificationReportingProvider,
|
||||||
Scheduler: PusSchedulerProvider,
|
Scheduler: PusSchedulerProvider,
|
||||||
>
|
> PusSchedServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter, Scheduler>
|
||||||
PusSchedServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter, Scheduler>
|
|
||||||
{
|
{
|
||||||
pub fn new(
|
pub fn new(
|
||||||
service_helper: PusServiceHelper<
|
service_helper: PusServiceHelper<
|
||||||
@@ -102,11 +101,12 @@ impl<
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.scheduler.enable();
|
self.scheduler.enable();
|
||||||
|
if self.scheduler.is_enabled()
|
||||||
if self.scheduler.is_enabled() && opt_started_token.is_some() {
|
&& let Some(started_token) = opt_started_token
|
||||||
|
{
|
||||||
if let Err(e) = self.service_helper.verif_reporter().completion_success(
|
if let Err(e) = self.service_helper.verif_reporter().completion_success(
|
||||||
&self.service_helper.common.tm_sender,
|
&self.service_helper.common.tm_sender,
|
||||||
opt_started_token.unwrap(),
|
started_token,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
) {
|
) {
|
||||||
error_callback(&PartialPusHandlingError::Verification(e));
|
error_callback(&PartialPusHandlingError::Verification(e));
|
||||||
@@ -131,10 +131,12 @@ impl<
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.scheduler.disable();
|
self.scheduler.disable();
|
||||||
if !self.scheduler.is_enabled() && opt_started_token.is_some() {
|
if !self.scheduler.is_enabled()
|
||||||
|
&& let Some(started_token) = opt_started_token
|
||||||
|
{
|
||||||
if let Err(e) = self.service_helper.verif_reporter().completion_success(
|
if let Err(e) = self.service_helper.verif_reporter().completion_success(
|
||||||
&self.service_helper.common.tm_sender,
|
&self.service_helper.common.tm_sender,
|
||||||
opt_started_token.unwrap(),
|
started_token,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
) {
|
) {
|
||||||
error_callback(&PartialPusHandlingError::Verification(e));
|
error_callback(&PartialPusHandlingError::Verification(e));
|
||||||
@@ -249,21 +251,21 @@ mod tests {
|
|||||||
use crate::pus::test_util::{PusTestHarness, TEST_APID};
|
use crate::pus::test_util::{PusTestHarness, TEST_APID};
|
||||||
use crate::pus::verification::{VerificationReporter, VerificationReportingProvider};
|
use crate::pus::verification::{VerificationReporter, VerificationReportingProvider};
|
||||||
|
|
||||||
|
use crate::pus::{DirectPusPacketHandlerResult, MpscTcReceiver, PusPacketHandlingError};
|
||||||
use crate::pus::{
|
use crate::pus::{
|
||||||
|
EcssTcInSharedPoolConverter,
|
||||||
scheduler::{self, PusSchedulerProvider, TcInfo},
|
scheduler::{self, PusSchedulerProvider, TcInfo},
|
||||||
tests::PusServiceHandlerWithSharedStoreCommon,
|
tests::PusServiceHandlerWithSharedStoreCommon,
|
||||||
verification::{RequestId, TcStateAccepted, VerificationToken},
|
verification::{RequestId, TcStateAccepted, VerificationToken},
|
||||||
EcssTcInSharedPoolConverter,
|
|
||||||
};
|
};
|
||||||
use crate::pus::{DirectPusPacketHandlerResult, MpscTcReceiver, PusPacketHandlingError};
|
|
||||||
use crate::tmtc::PacketSenderWithSharedPool;
|
use crate::tmtc::PacketSenderWithSharedPool;
|
||||||
use alloc::collections::VecDeque;
|
use alloc::collections::VecDeque;
|
||||||
use delegate::delegate;
|
use delegate::delegate;
|
||||||
|
use spacepackets::SpHeader;
|
||||||
|
use spacepackets::ecss::WritablePusPacket;
|
||||||
use spacepackets::ecss::scheduling::Subservice;
|
use spacepackets::ecss::scheduling::Subservice;
|
||||||
use spacepackets::ecss::tc::PusTcSecondaryHeader;
|
use spacepackets::ecss::tc::PusTcSecondaryHeader;
|
||||||
use spacepackets::ecss::WritablePusPacket;
|
|
||||||
use spacepackets::time::TimeWriter;
|
use spacepackets::time::TimeWriter;
|
||||||
use spacepackets::SpHeader;
|
|
||||||
use spacepackets::{
|
use spacepackets::{
|
||||||
ecss::{tc::PusTcCreator, tm::PusTmReader},
|
ecss::{tc::PusTcCreator, tm::PusTmReader},
|
||||||
time::cds,
|
time::cds,
|
||||||
|
@@ -2,9 +2,9 @@ use crate::pus::{
|
|||||||
DirectPusPacketHandlerResult, PartialPusHandlingError, PusPacketHandlingError, PusTmVariant,
|
DirectPusPacketHandlerResult, PartialPusHandlingError, PusPacketHandlingError, PusTmVariant,
|
||||||
};
|
};
|
||||||
use crate::tmtc::{PacketAsVec, PacketSenderWithSharedPool};
|
use crate::tmtc::{PacketAsVec, PacketSenderWithSharedPool};
|
||||||
use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
|
|
||||||
use spacepackets::ecss::PusPacket;
|
|
||||||
use spacepackets::SpHeader;
|
use spacepackets::SpHeader;
|
||||||
|
use spacepackets::ecss::PusPacket;
|
||||||
|
use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
|
|
||||||
use super::verification::{VerificationReporter, VerificationReportingProvider};
|
use super::verification::{VerificationReporter, VerificationReportingProvider};
|
||||||
@@ -31,7 +31,7 @@ impl<
|
|||||||
TmSender: EcssTmSender,
|
TmSender: EcssTmSender,
|
||||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||||
VerificationReporter: VerificationReportingProvider,
|
VerificationReporter: VerificationReportingProvider,
|
||||||
> PusService17TestHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
|
> PusService17TestHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
|
||||||
{
|
{
|
||||||
pub fn new(
|
pub fn new(
|
||||||
service_helper: PusServiceHelper<
|
service_helper: PusServiceHelper<
|
||||||
@@ -134,6 +134,7 @@ pub type PusService17TestHandlerStaticWithBoundedMpsc = PusService17TestHandler<
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use crate::ComponentId;
|
||||||
use crate::pus::test_util::{PusTestHarness, SimplePusPacketHandler, TEST_APID};
|
use crate::pus::test_util::{PusTestHarness, SimplePusPacketHandler, TEST_APID};
|
||||||
use crate::pus::tests::{
|
use crate::pus::tests::{
|
||||||
PusServiceHandlerWithSharedStoreCommon, PusServiceHandlerWithVecCommon,
|
PusServiceHandlerWithSharedStoreCommon, PusServiceHandlerWithVecCommon,
|
||||||
@@ -148,13 +149,12 @@ mod tests {
|
|||||||
PartialPusHandlingError, PusPacketHandlingError,
|
PartialPusHandlingError, PusPacketHandlingError,
|
||||||
};
|
};
|
||||||
use crate::tmtc::PacketSenderWithSharedPool;
|
use crate::tmtc::PacketSenderWithSharedPool;
|
||||||
use crate::ComponentId;
|
|
||||||
use delegate::delegate;
|
use delegate::delegate;
|
||||||
|
use spacepackets::SpHeader;
|
||||||
|
use spacepackets::ecss::PusPacket;
|
||||||
use spacepackets::ecss::tc::{PusTcCreator, PusTcSecondaryHeader};
|
use spacepackets::ecss::tc::{PusTcCreator, PusTcSecondaryHeader};
|
||||||
use spacepackets::ecss::tm::PusTmReader;
|
use spacepackets::ecss::tm::PusTmReader;
|
||||||
use spacepackets::ecss::PusPacket;
|
use spacepackets::time::{TimeWriter, cds};
|
||||||
use spacepackets::time::{cds, TimeWriter};
|
|
||||||
use spacepackets::SpHeader;
|
|
||||||
|
|
||||||
use super::PusService17TestHandler;
|
use super::PusService17TestHandler;
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@
|
|||||||
//! for the verification module contains examples how this module could be used in a more complex
|
//! for the verification module contains examples how this module could be used in a more complex
|
||||||
//! context involving multiple threads
|
//! context involving multiple threads
|
||||||
use crate::params::{Params, WritableToBeBytes};
|
use crate::params::{Params, WritableToBeBytes};
|
||||||
use crate::pus::{source_buffer_large_enough, EcssTmSender, EcssTmtcError};
|
use crate::pus::{EcssTmSender, EcssTmtcError, source_buffer_large_enough};
|
||||||
use core::fmt::{Debug, Display, Formatter};
|
use core::fmt::{Debug, Display, Formatter};
|
||||||
use core::hash::{Hash, Hasher};
|
use core::hash::{Hash, Hasher};
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
@@ -90,11 +90,11 @@ use core::mem::size_of;
|
|||||||
use delegate::delegate;
|
use delegate::delegate;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use spacepackets::ecss::EcssEnumeration;
|
||||||
use spacepackets::ecss::tc::IsPusTelecommand;
|
use spacepackets::ecss::tc::IsPusTelecommand;
|
||||||
use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
|
use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
|
||||||
use spacepackets::ecss::EcssEnumeration;
|
|
||||||
use spacepackets::{ByteConversionError, CcsdsPacket, PacketId, PacketSequenceCtrl};
|
use spacepackets::{ByteConversionError, CcsdsPacket, PacketId, PacketSequenceCtrl};
|
||||||
use spacepackets::{SpHeader, MAX_APID};
|
use spacepackets::{MAX_APID, SpHeader};
|
||||||
|
|
||||||
pub use spacepackets::ecss::verification::*;
|
pub use spacepackets::ecss::verification::*;
|
||||||
pub use spacepackets::seq_count::SeqCountProviderSimple;
|
pub use spacepackets::seq_count::SeqCountProviderSimple;
|
||||||
@@ -102,8 +102,8 @@ pub use spacepackets::seq_count::SeqCountProviderSimple;
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub use alloc_mod::*;
|
pub use alloc_mod::*;
|
||||||
|
|
||||||
use crate::request::Apid;
|
|
||||||
use crate::ComponentId;
|
use crate::ComponentId;
|
||||||
|
use crate::request::Apid;
|
||||||
|
|
||||||
/// This is a request identifier as specified in 5.4.11.2 c. of the PUS standard.
|
/// This is a request identifier as specified in 5.4.11.2 c. of the PUS standard.
|
||||||
///
|
///
|
||||||
@@ -1686,39 +1686,39 @@ pub mod test_util {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
|
use crate::ComponentId;
|
||||||
use crate::params::Params;
|
use crate::params::Params;
|
||||||
use crate::pool::{SharedStaticMemoryPool, StaticMemoryPool, StaticPoolConfig};
|
use crate::pool::{SharedStaticMemoryPool, StaticMemoryPool, StaticPoolConfig};
|
||||||
use crate::pus::test_util::{TEST_APID, TEST_COMPONENT_ID_0};
|
use crate::pus::test_util::{TEST_APID, TEST_COMPONENT_ID_0};
|
||||||
use crate::pus::tests::CommonTmInfo;
|
use crate::pus::tests::CommonTmInfo;
|
||||||
use crate::pus::verification::{
|
use crate::pus::verification::{
|
||||||
handle_step_failure_with_generic_params, EcssTmSender, EcssTmtcError, FailParams,
|
EcssTmSender, EcssTmtcError, FailParams, FailParamsWithStep, RequestId, TcStateNone,
|
||||||
FailParamsWithStep, RequestId, TcStateNone, VerificationReporter, VerificationReporterCfg,
|
VerificationReporter, VerificationReporterCfg, VerificationToken,
|
||||||
VerificationToken,
|
handle_step_failure_with_generic_params,
|
||||||
};
|
};
|
||||||
use crate::pus::{ChannelWithId, PusTmVariant};
|
use crate::pus::{ChannelWithId, PusTmVariant};
|
||||||
use crate::request::MessageMetadata;
|
use crate::request::MessageMetadata;
|
||||||
use crate::spacepackets::seq_count::{CcsdsSimpleSeqCountProvider, SequenceCountProvider};
|
use crate::spacepackets::seq_count::{CcsdsSimpleSeqCountProvider, SequenceCountProvider};
|
||||||
use crate::tmtc::{PacketSenderWithSharedPool, SharedPacketPool};
|
use crate::tmtc::{PacketSenderWithSharedPool, SharedPacketPool};
|
||||||
use crate::ComponentId;
|
|
||||||
use alloc::format;
|
use alloc::format;
|
||||||
use alloc::string::ToString;
|
use alloc::string::ToString;
|
||||||
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
|
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
|
||||||
use spacepackets::ecss::{
|
use spacepackets::ecss::{
|
||||||
EcssEnumU16, EcssEnumU32, EcssEnumU8, EcssEnumeration, PusError, PusPacket,
|
EcssEnumU8, EcssEnumU16, EcssEnumU32, EcssEnumeration, PusError, PusPacket,
|
||||||
WritablePusPacket,
|
WritablePusPacket,
|
||||||
};
|
};
|
||||||
use spacepackets::util::UnsignedEnum;
|
use spacepackets::util::UnsignedEnum;
|
||||||
use spacepackets::{ByteConversionError, SpHeader};
|
use spacepackets::{ByteConversionError, SpHeader};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::sync::{mpsc, RwLock};
|
use std::sync::{RwLock, mpsc};
|
||||||
use std::vec;
|
use std::vec;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
handle_completion_failure_with_generic_params, DummyVerificationHook, FailParamHelper,
|
DummyVerificationHook, FailParamHelper, SeqCountProviderSimple, TcStateAccepted,
|
||||||
SeqCountProviderSimple, TcStateAccepted, TcStateStarted, VerificationHookProvider,
|
TcStateStarted, VerificationHookProvider, VerificationReportingProvider,
|
||||||
VerificationReportingProvider, WasAtLeastAccepted,
|
WasAtLeastAccepted, handle_completion_failure_with_generic_params,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn is_send<T: Send>(_: &T) {}
|
fn is_send<T: Send>(_: &T) {}
|
||||||
|
@@ -9,13 +9,13 @@ pub use alloc_mod::*;
|
|||||||
pub use std_mod::*;
|
pub use std_mod::*;
|
||||||
|
|
||||||
use spacepackets::{
|
use spacepackets::{
|
||||||
ecss::{tc::IsPusTelecommand, PusPacket},
|
|
||||||
ByteConversionError,
|
ByteConversionError,
|
||||||
|
ecss::{PusPacket, tc::IsPusTelecommand},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
queue::{GenericReceiveError, GenericSendError},
|
|
||||||
ComponentId,
|
ComponentId,
|
||||||
|
queue::{GenericReceiveError, GenericSendError},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// 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
|
||||||
@@ -497,8 +497,8 @@ mod tests {
|
|||||||
|
|
||||||
use alloc::string::ToString;
|
use alloc::string::ToString;
|
||||||
use spacepackets::{
|
use spacepackets::{
|
||||||
ecss::tc::{PusTcCreator, PusTcSecondaryHeader},
|
|
||||||
ByteConversionError, SpHeader,
|
ByteConversionError, SpHeader,
|
||||||
|
ecss::tc::{PusTcCreator, PusTcSecondaryHeader},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@@ -211,8 +211,8 @@ mod tests {
|
|||||||
println,
|
println,
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
sync::{
|
sync::{
|
||||||
mpsc::{self, TryRecvError},
|
|
||||||
Arc, Mutex,
|
Arc, Mutex,
|
||||||
|
mpsc::{self, TryRecvError},
|
||||||
},
|
},
|
||||||
time::Instant,
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
health::{HealthState, HealthTableProvider},
|
health::{HealthState, HealthTableProvider},
|
||||||
mode::{Mode, ModeAndSubmode, ModeReply, ModeRequest, ModeRequestSender, UNKNOWN_MODE_VAL},
|
mode::{Mode, ModeAndSubmode, ModeReply, ModeRequest, ModeRequestSender, UNKNOWN_MODE_VAL},
|
||||||
mode_tree::{
|
mode_tree::{
|
||||||
@@ -7,7 +8,6 @@ use crate::{
|
|||||||
},
|
},
|
||||||
queue::GenericTargetedMessagingError,
|
queue::GenericTargetedMessagingError,
|
||||||
request::{GenericMessage, RequestId},
|
request::{GenericMessage, RequestId},
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
@@ -252,10 +252,10 @@ impl SequenceExecutionHelper {
|
|||||||
Ok(ModeCommandingResult::AwaitingSuccessCheck)
|
Ok(ModeCommandingResult::AwaitingSuccessCheck)
|
||||||
} else if seq_table_value.entries.len() - 1 == sequence_idx {
|
} else if seq_table_value.entries.len() - 1 == sequence_idx {
|
||||||
self.state = SequenceExecutionHelperState::Idle;
|
self.state = SequenceExecutionHelperState::Idle;
|
||||||
return Ok(ModeCommandingResult::Done);
|
Ok(ModeCommandingResult::Done)
|
||||||
} else {
|
} else {
|
||||||
self.current_sequence_index = Some(sequence_idx + 1);
|
self.current_sequence_index = Some(sequence_idx + 1);
|
||||||
return Ok(ModeCommandingResult::StepDone);
|
Ok(ModeCommandingResult::StepDone)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,9 +682,10 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ComponentId,
|
||||||
mode::{
|
mode::{
|
||||||
tests::{ModeReqSenderMock, ModeReqWrapper},
|
|
||||||
Mode, ModeAndSubmode, ModeReply, ModeRequest, UNKNOWN_MODE,
|
Mode, ModeAndSubmode, ModeReply, ModeRequest, UNKNOWN_MODE,
|
||||||
|
tests::{ModeReqSenderMock, ModeReqWrapper},
|
||||||
},
|
},
|
||||||
mode_tree::{
|
mode_tree::{
|
||||||
ModeStoreProvider, ModeStoreVec, SequenceModeTables, SequenceTableEntry,
|
ModeStoreProvider, ModeStoreVec, SequenceModeTables, SequenceTableEntry,
|
||||||
@@ -693,7 +694,6 @@ mod tests {
|
|||||||
queue::GenericTargetedMessagingError,
|
queue::GenericTargetedMessagingError,
|
||||||
request::{GenericMessage, MessageMetadata, RequestId},
|
request::{GenericMessage, MessageMetadata, RequestId},
|
||||||
subsystem::{ModeCommandingResult, ModeTreeHelperState, SequenceExecutionHelperState},
|
subsystem::{ModeCommandingResult, ModeTreeHelperState, SequenceExecutionHelperState},
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@@ -9,20 +9,20 @@
|
|||||||
//! They only need to send the received and generated data to these objects.
|
//! They only need to send the received and generated data to these objects.
|
||||||
use crate::queue::GenericSendError;
|
use crate::queue::GenericSendError;
|
||||||
use crate::{
|
use crate::{
|
||||||
pool::{PoolAddr, PoolError},
|
|
||||||
ComponentId,
|
ComponentId,
|
||||||
|
pool::{PoolAddr, PoolError},
|
||||||
};
|
};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub use alloc_mod::*;
|
pub use alloc_mod::*;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use downcast_rs::{impl_downcast, Downcast};
|
use downcast_rs::{Downcast, impl_downcast};
|
||||||
use spacepackets::{
|
use spacepackets::{
|
||||||
|
SpHeader,
|
||||||
ecss::{
|
ecss::{
|
||||||
tc::PusTcReader,
|
tc::PusTcReader,
|
||||||
tm::{PusTmCreator, PusTmReader},
|
tm::{PusTmCreator, PusTmReader},
|
||||||
},
|
},
|
||||||
SpHeader,
|
|
||||||
};
|
};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
|
|
||||||
use spacepackets::time::cds::CdsTime;
|
|
||||||
use spacepackets::time::TimeWriter;
|
|
||||||
use spacepackets::SpHeader;
|
use spacepackets::SpHeader;
|
||||||
|
use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
|
||||||
|
use spacepackets::time::TimeWriter;
|
||||||
|
use spacepackets::time::cds::CdsTime;
|
||||||
|
|
||||||
pub struct PusTmWithCdsShortHelper {
|
pub struct PusTmWithCdsShortHelper {
|
||||||
apid: u16,
|
apid: u16,
|
||||||
@@ -56,7 +56,7 @@ impl PusTmWithCdsShortHelper {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use spacepackets::{ecss::PusPacket, time::cds::CdsTime, CcsdsPacket};
|
use spacepackets::{CcsdsPacket, ecss::PusPacket, time::cds::CdsTime};
|
||||||
|
|
||||||
use super::PusTmWithCdsShortHelper;
|
use super::PusTmWithCdsShortHelper;
|
||||||
|
|
||||||
|
@@ -4,13 +4,13 @@ use satrs::dev_mgmt::{
|
|||||||
DevManagerCommandingHelper, DevManagerHelperResult, TransparentDevManagerHook,
|
DevManagerCommandingHelper, DevManagerHelperResult, TransparentDevManagerHook,
|
||||||
};
|
};
|
||||||
use satrs::mode::{
|
use satrs::mode::{
|
||||||
Mode, ModeError, ModeProvider, ModeReplyReceiver, ModeReplySender, ModeRequestHandler,
|
INVALID_MODE, Mode, ModeError, ModeProvider, ModeReplyReceiver, ModeReplySender,
|
||||||
ModeRequestHandlerMpscBounded, ModeRequestReceiver, ModeRequestorAndHandlerMpscBounded,
|
ModeRequestHandler, ModeRequestHandlerMpscBounded, ModeRequestReceiver,
|
||||||
ModeRequestorOneChildBoundedMpsc, INVALID_MODE, UNKNOWN_MODE,
|
ModeRequestorAndHandlerMpscBounded, ModeRequestorOneChildBoundedMpsc, UNKNOWN_MODE,
|
||||||
};
|
};
|
||||||
use satrs::mode_tree::{
|
use satrs::mode_tree::{
|
||||||
connect_mode_nodes, ModeChild, ModeNode, ModeParent, ModeStoreProvider, SequenceTableEntry,
|
ModeChild, ModeNode, ModeParent, ModeStoreProvider, SequenceTableEntry, SequenceTableMapTable,
|
||||||
SequenceTableMapTable, TargetTableEntry,
|
TargetTableEntry, connect_mode_nodes,
|
||||||
};
|
};
|
||||||
use satrs::mode_tree::{SequenceTablesMapValue, TargetTablesMapValue};
|
use satrs::mode_tree::{SequenceTablesMapValue, TargetTablesMapValue};
|
||||||
use satrs::request::{MessageMetadata, RequestId};
|
use satrs::request::{MessageMetadata, RequestId};
|
||||||
@@ -20,10 +20,10 @@ use satrs::subsystem::{
|
|||||||
StartSequenceError, SubsystemCommandingHelper, SubsystemHelperResult,
|
StartSequenceError, SubsystemCommandingHelper, SubsystemHelperResult,
|
||||||
};
|
};
|
||||||
use satrs::{
|
use satrs::{
|
||||||
|
ComponentId,
|
||||||
mode::{ModeAndSubmode, ModeReply, ModeRequest},
|
mode::{ModeAndSubmode, ModeReply, ModeRequest},
|
||||||
queue::GenericTargetedMessagingError,
|
queue::GenericTargetedMessagingError,
|
||||||
request::GenericMessage,
|
request::GenericMessage,
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
use std::borrow::{Borrow, BorrowMut};
|
use std::borrow::{Borrow, BorrowMut};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
@@ -8,10 +8,10 @@ pub mod crossbeam_test {
|
|||||||
VerificationReportingProvider,
|
VerificationReportingProvider,
|
||||||
};
|
};
|
||||||
use satrs::tmtc::{PacketSenderWithSharedPool, SharedStaticMemoryPool};
|
use satrs::tmtc::{PacketSenderWithSharedPool, SharedStaticMemoryPool};
|
||||||
|
use spacepackets::SpHeader;
|
||||||
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
|
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
|
||||||
use spacepackets::ecss::tm::PusTmReader;
|
use spacepackets::ecss::tm::PusTmReader;
|
||||||
use spacepackets::ecss::{EcssEnumU16, EcssEnumU8, PusPacket, WritablePusPacket};
|
use spacepackets::ecss::{EcssEnumU8, EcssEnumU16, PusPacket, WritablePusPacket};
|
||||||
use spacepackets::SpHeader;
|
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@@ -17,12 +17,13 @@ use core::{
|
|||||||
use std::{
|
use std::{
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream},
|
net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream},
|
||||||
sync::{mpsc, Mutex},
|
sync::{Mutex, mpsc},
|
||||||
thread,
|
thread,
|
||||||
};
|
};
|
||||||
|
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use satrs::{
|
use satrs::{
|
||||||
|
ComponentId,
|
||||||
encoding::{
|
encoding::{
|
||||||
ccsds::{SpValidity, SpacePacketValidator},
|
ccsds::{SpValidity, SpacePacketValidator},
|
||||||
cobs::encode_packet_with_cobs,
|
cobs::encode_packet_with_cobs,
|
||||||
@@ -32,11 +33,10 @@ use satrs::{
|
|||||||
TcpSpacepacketsServer, TcpTmtcInCobsServer,
|
TcpSpacepacketsServer, TcpTmtcInCobsServer,
|
||||||
},
|
},
|
||||||
tmtc::PacketSource,
|
tmtc::PacketSource,
|
||||||
ComponentId,
|
|
||||||
};
|
};
|
||||||
use spacepackets::{
|
use spacepackets::{
|
||||||
ecss::{tc::PusTcCreator, WritablePusPacket},
|
|
||||||
CcsdsPacket, PacketId, SpHeader,
|
CcsdsPacket, PacketId, SpHeader,
|
||||||
|
ecss::{WritablePusPacket, tc::PusTcCreator},
|
||||||
};
|
};
|
||||||
use std::{collections::VecDeque, sync::Arc, vec::Vec};
|
use std::{collections::VecDeque, sync::Arc, vec::Vec};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user