This commit is contained in:
parent
fe4060b4d9
commit
8c2ea2b18b
@ -12,7 +12,7 @@ use satrs_core::{
|
|||||||
SequenceFlags, SpHeader,
|
SequenceFlags, SpHeader,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use satrs_example::{RequestTargetId, PUS_APID};
|
use satrs_example::config::{RequestTargetId, PUS_APID};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
hk::{AcsHkIds, HkUniqueId},
|
hk::{AcsHkIds, HkUniqueId},
|
||||||
|
@ -5,7 +5,7 @@ use satrs_core::{
|
|||||||
spacepackets::ecss::{PusPacket, WritablePusPacket},
|
spacepackets::ecss::{PusPacket, WritablePusPacket},
|
||||||
spacepackets::SpHeader,
|
spacepackets::SpHeader,
|
||||||
};
|
};
|
||||||
use satrs_example::{OBSW_SERVER_ADDR, SERVER_PORT};
|
use satrs_example::config::{OBSW_SERVER_ADDR, SERVER_PORT};
|
||||||
use std::net::{IpAddr, SocketAddr, UdpSocket};
|
use std::net::{IpAddr, SocketAddr, UdpSocket};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use satrs_core::pus::ReceivesEcssPusTc;
|
use satrs_core::pus::ReceivesEcssPusTc;
|
||||||
use satrs_core::spacepackets::{CcsdsPacket, SpHeader};
|
use satrs_core::spacepackets::{CcsdsPacket, SpHeader};
|
||||||
use satrs_core::tmtc::{CcsdsPacketHandler, ReceivesCcsdsTc};
|
use satrs_core::tmtc::{CcsdsPacketHandler, ReceivesCcsdsTc};
|
||||||
use satrs_example::PUS_APID;
|
use satrs_example::config::PUS_APID;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CcsdsReceiver<
|
pub struct CcsdsReceiver<
|
||||||
|
142
satrs-example/src/config.rs
Normal file
142
satrs-example/src/config.rs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
use satrs_core::res_code::ResultU16;
|
||||||
|
use satrs_mib::res_code::ResultU16Info;
|
||||||
|
use satrs_mib::resultcode;
|
||||||
|
use std::net::Ipv4Addr;
|
||||||
|
|
||||||
|
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||||
|
use satrs_core::{
|
||||||
|
events::{EventU32TypedSev, SeverityInfo},
|
||||||
|
pool::{StaticMemoryPool, StaticPoolConfig},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const PUS_APID: u16 = 0x02;
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, TryFromPrimitive, IntoPrimitive)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum CustomPusServiceId {
|
||||||
|
Mode = 200,
|
||||||
|
Health = 201,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||||
|
pub enum RequestTargetId {
|
||||||
|
AcsSubsystem = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const AOCS_APID: u16 = 1;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum GroupId {
|
||||||
|
Tmtc = 0,
|
||||||
|
Hk = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const OBSW_SERVER_ADDR: Ipv4Addr = Ipv4Addr::UNSPECIFIED;
|
||||||
|
pub const SERVER_PORT: u16 = 7301;
|
||||||
|
|
||||||
|
pub const TEST_EVENT: EventU32TypedSev<SeverityInfo> =
|
||||||
|
EventU32TypedSev::<SeverityInfo>::const_new(0, 0);
|
||||||
|
|
||||||
|
pub mod tmtc_err {
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[resultcode]
|
||||||
|
pub const INVALID_PUS_SERVICE: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 0);
|
||||||
|
#[resultcode]
|
||||||
|
pub const INVALID_PUS_SUBSERVICE: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 1);
|
||||||
|
#[resultcode]
|
||||||
|
pub const PUS_SERVICE_NOT_IMPLEMENTED: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 2);
|
||||||
|
#[resultcode]
|
||||||
|
pub const UNKNOWN_TARGET_ID: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 3);
|
||||||
|
|
||||||
|
#[resultcode(
|
||||||
|
info = "Not enough data inside the TC application data field. Optionally includes: \
|
||||||
|
8 bytes of failure data containing 2 failure parameters, \
|
||||||
|
P1 (u32 big endian): Expected data length, P2: Found data length"
|
||||||
|
)]
|
||||||
|
pub const NOT_ENOUGH_APP_DATA: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 2);
|
||||||
|
|
||||||
|
pub const TMTC_RESULTS: &[ResultU16Info] = &[
|
||||||
|
INVALID_PUS_SERVICE_EXT,
|
||||||
|
INVALID_PUS_SUBSERVICE_EXT,
|
||||||
|
NOT_ENOUGH_APP_DATA_EXT,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod hk_err {
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[resultcode]
|
||||||
|
pub const TARGET_ID_MISSING: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 0);
|
||||||
|
#[resultcode]
|
||||||
|
pub const UNIQUE_ID_MISSING: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 1);
|
||||||
|
#[resultcode]
|
||||||
|
pub const UNKNOWN_TARGET_ID: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 2);
|
||||||
|
#[resultcode]
|
||||||
|
pub const COLLECTION_INTERVAL_MISSING: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::enum_variant_names)]
|
||||||
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
|
pub enum TmSenderId {
|
||||||
|
PusVerification = 0,
|
||||||
|
PusTest = 1,
|
||||||
|
PusEvent = 2,
|
||||||
|
PusHk = 3,
|
||||||
|
PusAction = 4,
|
||||||
|
PusSched = 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 {
|
||||||
|
use super::*;
|
||||||
|
pub fn create_static_pools() -> (StaticMemoryPool, StaticMemoryPool) {
|
||||||
|
(
|
||||||
|
StaticMemoryPool::new(StaticPoolConfig::new(vec![
|
||||||
|
(30, 32),
|
||||||
|
(15, 64),
|
||||||
|
(15, 128),
|
||||||
|
(15, 256),
|
||||||
|
(15, 1024),
|
||||||
|
(15, 2048),
|
||||||
|
])),
|
||||||
|
StaticMemoryPool::new(StaticPoolConfig::new(vec![
|
||||||
|
(30, 32),
|
||||||
|
(15, 64),
|
||||||
|
(15, 128),
|
||||||
|
(15, 256),
|
||||||
|
(15, 1024),
|
||||||
|
(15, 2048),
|
||||||
|
])),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn create_sched_tc_pool() -> StaticMemoryPool {
|
||||||
|
StaticMemoryPool::new(StaticPoolConfig::new(vec![
|
||||||
|
(30, 32),
|
||||||
|
(15, 64),
|
||||||
|
(15, 128),
|
||||||
|
(15, 256),
|
||||||
|
(15, 1024),
|
||||||
|
(15, 2048),
|
||||||
|
]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod tasks {
|
||||||
|
pub const FREQ_MS_UDP_TMTC: u64 = 200;
|
||||||
|
pub const FREQ_MS_EVENT_HANDLING: u64 = 400;
|
||||||
|
pub const FREQ_MS_AOCS: u64 = 500;
|
||||||
|
pub const FREQ_MS_PUS_STACK: u64 = 200;
|
||||||
|
}
|
@ -17,7 +17,7 @@ use satrs_core::{
|
|||||||
},
|
},
|
||||||
spacepackets::time::cds::{self, TimeProvider},
|
spacepackets::time::cds::{self, TimeProvider},
|
||||||
};
|
};
|
||||||
use satrs_example::PUS_APID;
|
use satrs_example::config::PUS_APID;
|
||||||
|
|
||||||
use crate::update_time;
|
use crate::update_time;
|
||||||
|
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
use derive_new::new;
|
use derive_new::new;
|
||||||
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
|
||||||
use satrs_core::events::{EventU32TypedSev, SeverityInfo};
|
|
||||||
use satrs_core::objects::ObjectId;
|
|
||||||
use satrs_core::spacepackets::ecss::tc::IsPusTelecommand;
|
use satrs_core::spacepackets::ecss::tc::IsPusTelecommand;
|
||||||
use satrs_core::spacepackets::ecss::PusPacket;
|
use satrs_core::spacepackets::ecss::PusPacket;
|
||||||
use satrs_core::spacepackets::{ByteConversionError, CcsdsPacket};
|
use satrs_core::spacepackets::{ByteConversionError, CcsdsPacket};
|
||||||
use satrs_core::tmtc::TargetId;
|
use satrs_core::tmtc::TargetId;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::net::Ipv4Addr;
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use satrs_mib::res_code::{ResultU16, ResultU16Info};
|
pub mod config;
|
||||||
use satrs_mib::resultcode;
|
|
||||||
|
|
||||||
pub type Apid = u16;
|
pub type Apid = u16;
|
||||||
|
|
||||||
@ -62,97 +57,3 @@ impl TargetIdWithApid {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const PUS_APID: u16 = 0x02;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, TryFromPrimitive, IntoPrimitive)]
|
|
||||||
#[repr(u8)]
|
|
||||||
pub enum CustomPusServiceId {
|
|
||||||
Mode = 200,
|
|
||||||
Health = 201,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
|
||||||
pub enum RequestTargetId {
|
|
||||||
AcsSubsystem = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const AOCS_APID: u16 = 1;
|
|
||||||
|
|
||||||
pub const ACS_OBJECT_ID: ObjectId = ObjectId {
|
|
||||||
id: RequestTargetId::AcsSubsystem as u32,
|
|
||||||
name: "ACS_SUBSYSTEM",
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum GroupId {
|
|
||||||
Tmtc = 0,
|
|
||||||
Hk = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const OBSW_SERVER_ADDR: Ipv4Addr = Ipv4Addr::UNSPECIFIED;
|
|
||||||
pub const SERVER_PORT: u16 = 7301;
|
|
||||||
|
|
||||||
pub const TEST_EVENT: EventU32TypedSev<SeverityInfo> =
|
|
||||||
EventU32TypedSev::<SeverityInfo>::const_new(0, 0);
|
|
||||||
|
|
||||||
pub mod tmtc_err {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[resultcode]
|
|
||||||
pub const INVALID_PUS_SERVICE: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 0);
|
|
||||||
#[resultcode]
|
|
||||||
pub const INVALID_PUS_SUBSERVICE: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 1);
|
|
||||||
#[resultcode]
|
|
||||||
pub const PUS_SERVICE_NOT_IMPLEMENTED: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 2);
|
|
||||||
#[resultcode]
|
|
||||||
pub const UNKNOWN_TARGET_ID: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 3);
|
|
||||||
|
|
||||||
#[resultcode(
|
|
||||||
info = "Not enough data inside the TC application data field. Optionally includes: \
|
|
||||||
8 bytes of failure data containing 2 failure parameters, \
|
|
||||||
P1 (u32 big endian): Expected data length, P2: Found data length"
|
|
||||||
)]
|
|
||||||
pub const NOT_ENOUGH_APP_DATA: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 2);
|
|
||||||
|
|
||||||
pub const TMTC_RESULTS: &[ResultU16Info] = &[
|
|
||||||
INVALID_PUS_SERVICE_EXT,
|
|
||||||
INVALID_PUS_SUBSERVICE_EXT,
|
|
||||||
NOT_ENOUGH_APP_DATA_EXT,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod hk_err {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[resultcode]
|
|
||||||
pub const TARGET_ID_MISSING: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 0);
|
|
||||||
#[resultcode]
|
|
||||||
pub const UNIQUE_ID_MISSING: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 1);
|
|
||||||
#[resultcode]
|
|
||||||
pub const UNKNOWN_TARGET_ID: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 2);
|
|
||||||
#[resultcode]
|
|
||||||
pub const COLLECTION_INTERVAL_MISSING: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(clippy::enum_variant_names)]
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
|
||||||
pub enum TmSenderId {
|
|
||||||
PusVerification = 0,
|
|
||||||
PusTest = 1,
|
|
||||||
PusEvent = 2,
|
|
||||||
PusHk = 3,
|
|
||||||
PusAction = 4,
|
|
||||||
PusSched = 5,
|
|
||||||
AllEvents = 6,
|
|
||||||
AcsSubsystem = 7,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
|
||||||
pub enum TcReceiverId {
|
|
||||||
PusTest = 1,
|
|
||||||
PusEvent = 2,
|
|
||||||
PusHk = 3,
|
|
||||||
PusAction = 4,
|
|
||||||
PusSched = 5,
|
|
||||||
}
|
|
||||||
|
@ -17,6 +17,11 @@ use log::info;
|
|||||||
use pus::test::create_test_service_dynamic;
|
use pus::test::create_test_service_dynamic;
|
||||||
use satrs_core::hal::std::tcp_server::ServerConfig;
|
use satrs_core::hal::std::tcp_server::ServerConfig;
|
||||||
use satrs_core::hal::std::udp_server::UdpTcServer;
|
use satrs_core::hal::std::udp_server::UdpTcServer;
|
||||||
|
use satrs_example::config::pool::{create_sched_tc_pool, create_static_pools};
|
||||||
|
use satrs_example::config::tasks::{
|
||||||
|
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 tmtc::PusTcSourceProviderDynamic;
|
use tmtc::PusTcSourceProviderDynamic;
|
||||||
use udp::DynamicUdpTmHandler;
|
use udp::DynamicUdpTmHandler;
|
||||||
|
|
||||||
@ -35,7 +40,6 @@ use crate::tmtc::{
|
|||||||
PusTcSourceProviderSharedPool, SharedTcPool, TcArgs, TmArgs, TmtcTaskDynamic, TmtcTaskStatic,
|
PusTcSourceProviderSharedPool, SharedTcPool, TcArgs, TmArgs, TmtcTaskDynamic, TmtcTaskStatic,
|
||||||
};
|
};
|
||||||
use crate::udp::{StaticUdpTmHandler, UdpTmtcServer};
|
use crate::udp::{StaticUdpTmHandler, UdpTmtcServer};
|
||||||
use satrs_core::pool::{StaticMemoryPool, StaticPoolConfig};
|
|
||||||
use satrs_core::pus::event_man::EventRequestWithToken;
|
use satrs_core::pus::event_man::EventRequestWithToken;
|
||||||
use satrs_core::pus::verification::{VerificationReporterCfg, VerificationReporterWithSender};
|
use satrs_core::pus::verification::{VerificationReporterCfg, VerificationReporterWithSender};
|
||||||
use satrs_core::pus::{EcssTmSender, MpscTmAsVecSender, MpscTmInStoreSender};
|
use satrs_core::pus::{EcssTmSender, MpscTmAsVecSender, MpscTmInStoreSender};
|
||||||
@ -43,9 +47,7 @@ use satrs_core::spacepackets::{time::cds::TimeProvider, time::TimeWriter};
|
|||||||
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
||||||
use satrs_core::tmtc::{CcsdsDistributor, TargetId};
|
use satrs_core::tmtc::{CcsdsDistributor, TargetId};
|
||||||
use satrs_core::ChannelId;
|
use satrs_core::ChannelId;
|
||||||
use satrs_example::{
|
use satrs_example::TargetIdWithApid;
|
||||||
RequestTargetId, TargetIdWithApid, TmSenderId, OBSW_SERVER_ADDR, PUS_APID, SERVER_PORT,
|
|
||||||
};
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::net::{IpAddr, SocketAddr};
|
use std::net::{IpAddr, SocketAddr};
|
||||||
use std::sync::mpsc::{self, channel};
|
use std::sync::mpsc::{self, channel};
|
||||||
@ -53,38 +55,6 @@ use std::sync::{Arc, RwLock};
|
|||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
fn create_static_pools() -> (StaticMemoryPool, StaticMemoryPool) {
|
|
||||||
(
|
|
||||||
StaticMemoryPool::new(StaticPoolConfig::new(vec![
|
|
||||||
(30, 32),
|
|
||||||
(15, 64),
|
|
||||||
(15, 128),
|
|
||||||
(15, 256),
|
|
||||||
(15, 1024),
|
|
||||||
(15, 2048),
|
|
||||||
])),
|
|
||||||
StaticMemoryPool::new(StaticPoolConfig::new(vec![
|
|
||||||
(30, 32),
|
|
||||||
(15, 64),
|
|
||||||
(15, 128),
|
|
||||||
(15, 256),
|
|
||||||
(15, 1024),
|
|
||||||
(15, 2048),
|
|
||||||
])),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_sched_tc_pool() -> StaticMemoryPool {
|
|
||||||
StaticMemoryPool::new(StaticPoolConfig::new(vec![
|
|
||||||
(30, 32),
|
|
||||||
(15, 64),
|
|
||||||
(15, 128),
|
|
||||||
(15, 256),
|
|
||||||
(15, 1024),
|
|
||||||
(15, 2048),
|
|
||||||
]))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_verification_reporter(verif_sender: impl EcssTmSender) -> VerificationReporterWithSender {
|
fn create_verification_reporter(verif_sender: impl EcssTmSender) -> VerificationReporterWithSender {
|
||||||
let verif_cfg = VerificationReporterCfg::new(PUS_APID, 1, 2, 8).unwrap();
|
let verif_cfg = VerificationReporterCfg::new(PUS_APID, 1, 2, 8).unwrap();
|
||||||
// Every software component which needs to generate verification telemetry, gets a cloned
|
// Every software component which needs to generate verification telemetry, gets a cloned
|
||||||
@ -268,7 +238,7 @@ fn static_tmtc_pool_main() {
|
|||||||
loop {
|
loop {
|
||||||
udp_tmtc_server.periodic_operation();
|
udp_tmtc_server.periodic_operation();
|
||||||
tmtc_task.periodic_operation();
|
tmtc_task.periodic_operation();
|
||||||
thread::sleep(Duration::from_millis(400));
|
thread::sleep(Duration::from_millis(FREQ_MS_UDP_TMTC));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -285,7 +255,7 @@ fn static_tmtc_pool_main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Starting TM funnel task");
|
info!("Starting TM funnel task");
|
||||||
let jh1 = thread::Builder::new()
|
let jh_tm_funnel = thread::Builder::new()
|
||||||
.name("TM Funnel".to_string())
|
.name("TM Funnel".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
tm_funnel.operation();
|
tm_funnel.operation();
|
||||||
@ -293,41 +263,48 @@ fn static_tmtc_pool_main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Starting event handling task");
|
info!("Starting event handling task");
|
||||||
let jh2 = thread::Builder::new()
|
let jh_event_handling = thread::Builder::new()
|
||||||
.name("Event".to_string())
|
.name("Event".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
event_handler.periodic_operation();
|
event_handler.periodic_operation();
|
||||||
thread::sleep(Duration::from_millis(400));
|
thread::sleep(Duration::from_millis(FREQ_MS_EVENT_HANDLING));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Starting AOCS thread");
|
info!("Starting AOCS thread");
|
||||||
let jh3 = 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(500));
|
thread::sleep(Duration::from_millis(FREQ_MS_AOCS));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Starting PUS handler thread");
|
info!("Starting PUS handler thread");
|
||||||
let jh4 = thread::Builder::new()
|
let jh_pus_handler = thread::Builder::new()
|
||||||
.name("PUS".to_string())
|
.name("PUS".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
pus_stack.periodic_operation();
|
pus_stack.periodic_operation();
|
||||||
thread::sleep(Duration::from_millis(200));
|
thread::sleep(Duration::from_millis(FREQ_MS_PUS_STACK));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
jh_udp_tmtc
|
jh_udp_tmtc
|
||||||
.join()
|
.join()
|
||||||
.expect("Joining UDP TMTC server thread failed");
|
.expect("Joining UDP TMTC server thread failed");
|
||||||
jh_tcp
|
jh_tcp
|
||||||
.join()
|
.join()
|
||||||
.expect("Joining TCP TMTC server thread failed");
|
.expect("Joining TCP TMTC server thread failed");
|
||||||
jh1.join().expect("Joining TM Funnel thread failed");
|
jh_tm_funnel
|
||||||
jh2.join().expect("Joining Event Manager thread failed");
|
.join()
|
||||||
jh3.join().expect("Joining AOCS thread failed");
|
.expect("Joining TM Funnel thread failed");
|
||||||
jh4.join().expect("Joining PUS handler thread failed");
|
jh_event_handling
|
||||||
|
.join()
|
||||||
|
.expect("Joining Event Manager thread failed");
|
||||||
|
jh_aocs.join().expect("Joining AOCS thread failed");
|
||||||
|
jh_pus_handler
|
||||||
|
.join()
|
||||||
|
.expect("Joining PUS handler thread failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dyn_tmtc_pool_main() {
|
fn dyn_tmtc_pool_main() {
|
||||||
@ -466,7 +443,7 @@ fn dyn_tmtc_pool_main() {
|
|||||||
loop {
|
loop {
|
||||||
udp_tmtc_server.periodic_operation();
|
udp_tmtc_server.periodic_operation();
|
||||||
tmtc_task.periodic_operation();
|
tmtc_task.periodic_operation();
|
||||||
thread::sleep(Duration::from_millis(400));
|
thread::sleep(Duration::from_millis(FREQ_MS_UDP_TMTC));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -483,7 +460,7 @@ fn dyn_tmtc_pool_main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Starting TM funnel task");
|
info!("Starting TM funnel task");
|
||||||
let jh1 = thread::Builder::new()
|
let jh_tm_funnel = thread::Builder::new()
|
||||||
.name("TM Funnel".to_string())
|
.name("TM Funnel".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
tm_funnel.operation();
|
tm_funnel.operation();
|
||||||
@ -491,41 +468,48 @@ fn dyn_tmtc_pool_main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Starting event handling task");
|
info!("Starting event handling task");
|
||||||
let jh2 = thread::Builder::new()
|
let jh_event_handling = thread::Builder::new()
|
||||||
.name("Event".to_string())
|
.name("Event".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
event_handler.periodic_operation();
|
event_handler.periodic_operation();
|
||||||
thread::sleep(Duration::from_millis(400));
|
thread::sleep(Duration::from_millis(FREQ_MS_EVENT_HANDLING));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Starting AOCS thread");
|
info!("Starting AOCS thread");
|
||||||
let jh3 = 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(500));
|
thread::sleep(Duration::from_millis(FREQ_MS_AOCS));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
info!("Starting PUS handler thread");
|
info!("Starting PUS handler thread");
|
||||||
let jh4 = thread::Builder::new()
|
let jh_pus_handler = thread::Builder::new()
|
||||||
.name("PUS".to_string())
|
.name("PUS".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
pus_stack.periodic_operation();
|
pus_stack.periodic_operation();
|
||||||
thread::sleep(Duration::from_millis(200));
|
thread::sleep(Duration::from_millis(FREQ_MS_PUS_STACK));
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
jh_udp_tmtc
|
jh_udp_tmtc
|
||||||
.join()
|
.join()
|
||||||
.expect("Joining UDP TMTC server thread failed");
|
.expect("Joining UDP TMTC server thread failed");
|
||||||
jh_tcp
|
jh_tcp
|
||||||
.join()
|
.join()
|
||||||
.expect("Joining TCP TMTC server thread failed");
|
.expect("Joining TCP TMTC server thread failed");
|
||||||
jh1.join().expect("Joining TM Funnel thread failed");
|
jh_tm_funnel
|
||||||
jh2.join().expect("Joining Event Manager thread failed");
|
.join()
|
||||||
jh3.join().expect("Joining AOCS thread failed");
|
.expect("Joining TM Funnel thread failed");
|
||||||
jh4.join().expect("Joining PUS handler thread failed");
|
jh_event_handling
|
||||||
|
.join()
|
||||||
|
.expect("Joining Event Manager thread failed");
|
||||||
|
jh_aocs.join().expect("Joining AOCS thread failed");
|
||||||
|
jh_pus_handler
|
||||||
|
.join()
|
||||||
|
.expect("Joining PUS handler thread failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -13,7 +13,8 @@ use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
|||||||
use satrs_core::spacepackets::ecss::PusPacket;
|
use satrs_core::spacepackets::ecss::PusPacket;
|
||||||
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
||||||
use satrs_core::ChannelId;
|
use satrs_core::ChannelId;
|
||||||
use satrs_example::{tmtc_err, TargetIdWithApid, TcReceiverId, TmSenderId, PUS_APID};
|
use satrs_example::config::{tmtc_err, TcReceiverId, TmSenderId, PUS_APID};
|
||||||
|
use satrs_example::TargetIdWithApid;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::mpsc::{self, Sender};
|
use std::sync::mpsc::{self, Sender};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ use satrs_core::pus::{
|
|||||||
};
|
};
|
||||||
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
||||||
use satrs_core::ChannelId;
|
use satrs_core::ChannelId;
|
||||||
use satrs_example::{TcReceiverId, TmSenderId, PUS_APID};
|
use satrs_example::config::{TcReceiverId, TmSenderId, PUS_APID};
|
||||||
|
|
||||||
pub fn create_event_service_static(
|
pub fn create_event_service_static(
|
||||||
shared_tm_store: SharedTmStore,
|
shared_tm_store: SharedTmStore,
|
||||||
|
@ -13,7 +13,8 @@ use satrs_core::pus::{
|
|||||||
use satrs_core::spacepackets::ecss::{hk, PusPacket};
|
use satrs_core::spacepackets::ecss::{hk, PusPacket};
|
||||||
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
||||||
use satrs_core::ChannelId;
|
use satrs_core::ChannelId;
|
||||||
use satrs_example::{hk_err, tmtc_err, TargetIdWithApid, TcReceiverId, TmSenderId, PUS_APID};
|
use satrs_example::config::{hk_err, tmtc_err, TcReceiverId, TmSenderId, PUS_APID};
|
||||||
|
use satrs_example::TargetIdWithApid;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::mpsc::{self, Sender};
|
use std::sync::mpsc::{self, Sender};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
|||||||
use satrs_core::spacepackets::ecss::PusServiceId;
|
use satrs_core::spacepackets::ecss::PusServiceId;
|
||||||
use satrs_core::spacepackets::time::cds::TimeProvider;
|
use satrs_core::spacepackets::time::cds::TimeProvider;
|
||||||
use satrs_core::spacepackets::time::TimeWriter;
|
use satrs_core::spacepackets::time::TimeWriter;
|
||||||
use satrs_example::{tmtc_err, CustomPusServiceId};
|
use satrs_example::config::{tmtc_err, CustomPusServiceId};
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
|
|
||||||
pub mod action;
|
pub mod action;
|
||||||
|
@ -13,7 +13,7 @@ use satrs_core::pus::{
|
|||||||
};
|
};
|
||||||
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
||||||
use satrs_core::ChannelId;
|
use satrs_core::ChannelId;
|
||||||
use satrs_example::{TcReceiverId, TmSenderId, PUS_APID};
|
use satrs_example::config::{TcReceiverId, TmSenderId, PUS_APID};
|
||||||
|
|
||||||
use crate::tmtc::PusTcSourceProviderSharedPool;
|
use crate::tmtc::PusTcSourceProviderSharedPool;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ use satrs_core::spacepackets::time::TimeWriter;
|
|||||||
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
||||||
use satrs_core::ChannelId;
|
use satrs_core::ChannelId;
|
||||||
use satrs_core::{events::EventU32, pus::EcssTcInSharedStoreConverter};
|
use satrs_core::{events::EventU32, pus::EcssTcInSharedStoreConverter};
|
||||||
use satrs_example::{tmtc_err, TcReceiverId, TmSenderId, PUS_APID, TEST_EVENT};
|
use satrs_example::config::{tmtc_err, TcReceiverId, TmSenderId, 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(
|
||||||
|
@ -9,7 +9,7 @@ use satrs_core::{
|
|||||||
spacepackets::PacketId,
|
spacepackets::PacketId,
|
||||||
tmtc::{CcsdsDistributor, CcsdsError, TmPacketSourceCore},
|
tmtc::{CcsdsDistributor, CcsdsError, TmPacketSourceCore},
|
||||||
};
|
};
|
||||||
use satrs_example::PUS_APID;
|
use satrs_example::config::PUS_APID;
|
||||||
|
|
||||||
pub const PACKET_ID_LOOKUP: &[PacketId] = &[PacketId::const_tc(true, PUS_APID)];
|
pub const PACKET_ID_LOOKUP: &[PacketId] = &[PacketId::const_tc(true, PUS_APID)];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user