added low priority downlink folder and downlinking logs
This commit is contained in:
parent
cbdb017fe2
commit
eeba6fab44
@ -9,7 +9,9 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
pub const STOP_FILE_NAME: &str = "stop-experiment";
|
pub const STOP_FILE_NAME: &str = "stop-experiment";
|
||||||
pub const CONFIG_FILE_NAME: &str = "exp278.toml";
|
pub const CONFIG_FILE_NAME: &str = "exp278.toml";
|
||||||
pub const HOME_FOLDER_EXPERIMENT: &str = "/home/exp278";
|
pub const HOME_FOLDER_EXPERIMENT: &str = "/home/exp278"; // also where IMS-100 images are placed
|
||||||
|
pub const TO_GROUND_FOLDER_EXPERIMENT: &str = "/home/exp278/toGround";
|
||||||
|
pub const TO_GROUND_LP_FOLDER_EXPERIMENT: &str = "/home/exp278/toGroundLP";
|
||||||
pub const LOG_FOLDER: &str = "logs";
|
pub const LOG_FOLDER: &str = "logs";
|
||||||
|
|
||||||
pub const OBSW_SERVER_ADDR: Ipv4Addr = Ipv4Addr::UNSPECIFIED;
|
pub const OBSW_SERVER_ADDR: Ipv4Addr = Ipv4Addr::UNSPECIFIED;
|
||||||
@ -291,3 +293,10 @@ pub mod tasks {
|
|||||||
pub const STOP_CHECK_FREQUENCY_MS: u64 = 400;
|
pub const STOP_CHECK_FREQUENCY_MS: u64 = 400;
|
||||||
pub const STOP_CHECK_FREQUENCY: Duration = Duration::from_millis(STOP_CHECK_FREQUENCY_MS);
|
pub const STOP_CHECK_FREQUENCY: Duration = Duration::from_millis(STOP_CHECK_FREQUENCY_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn create_low_priority_ground_dir() {
|
||||||
|
log::debug!("Creating low priority to ground directory");
|
||||||
|
if !Path::new(TO_GROUND_LP_FOLDER_EXPERIMENT).exists() && std::fs::create_dir_all(TO_GROUND_LP_FOLDER_EXPERIMENT).is_err() {
|
||||||
|
log::error!("Failed to create low priority to ground directory '{}'", TO_GROUND_LP_FOLDER_EXPERIMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -10,7 +10,8 @@ use std::{
|
|||||||
sync::{atomic::AtomicBool, mpsc, Arc},
|
sync::{atomic::AtomicBool, mpsc, Arc},
|
||||||
};
|
};
|
||||||
|
|
||||||
use ops_sat_rs::config::{action_err::INVALID_ACTION_ID, HOME_PATH, STOP_FILE_NAME};
|
use ops_sat_rs::config::{action_err::INVALID_ACTION_ID, HOME_PATH, STOP_FILE_NAME, TO_GROUND_FOLDER_EXPERIMENT};
|
||||||
|
use crate::logger::LOGFILE_PATH;
|
||||||
|
|
||||||
use crate::requests::CompositeRequest;
|
use crate::requests::CompositeRequest;
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ use crate::requests::CompositeRequest;
|
|||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum ActionId {
|
pub enum ActionId {
|
||||||
StopExperiment = 1,
|
StopExperiment = 1,
|
||||||
|
DownlinkLogfile = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExperimentController {
|
pub struct ExperimentController {
|
||||||
@ -96,7 +98,19 @@ impl ExperimentController {
|
|||||||
ActionReplyVariant::Completed,
|
ActionReplyVariant::Completed,
|
||||||
));
|
));
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
log::error!("sending action reply failed");
|
log::error!("Sending action reply failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ActionId::DownlinkLogfile => {
|
||||||
|
if let Some(logfile_path) = LOGFILE_PATH.get() {
|
||||||
|
if let Ok(logfile_path) = <PathBuf as Clone>::clone(logfile_path).into_os_string().into_string() {
|
||||||
|
let ground_folder_path = TO_GROUND_FOLDER_EXPERIMENT.to_string();
|
||||||
|
if std::fs::copy(logfile_path.as_str(), ground_folder_path.as_str()).is_err() {
|
||||||
|
log::error!("Copying logfile into downlink path failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log::error!("Downlink path emtpy")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main.rs
15
src/main.rs
@ -5,14 +5,8 @@ use std::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
use log::info;
|
use log::{debug, info};
|
||||||
use ops_sat_rs::config::{
|
use ops_sat_rs::config::{cfg_file::create_app_config, components::{CONTROLLER_ID, TCP_SERVER, TCP_SPP_CLIENT, UDP_SERVER}, create_low_priority_ground_dir, pool::create_sched_tc_pool, tasks::{FREQ_MS_CAMERA_HANDLING, FREQ_MS_CTRL, FREQ_MS_PUS_STACK, STOP_CHECK_FREQUENCY}, VALID_PACKET_ID_LIST, VERSION};
|
||||||
cfg_file::create_app_config,
|
|
||||||
components::{CONTROLLER_ID, TCP_SERVER, TCP_SPP_CLIENT, UDP_SERVER},
|
|
||||||
pool::create_sched_tc_pool,
|
|
||||||
tasks::{FREQ_MS_CAMERA_HANDLING, FREQ_MS_CTRL, FREQ_MS_PUS_STACK, STOP_CHECK_FREQUENCY},
|
|
||||||
VALID_PACKET_ID_LIST, VERSION,
|
|
||||||
};
|
|
||||||
use ops_sat_rs::config::{components::CAMERA_HANDLER, tasks::FREQ_MS_EVENT_HANDLING};
|
use ops_sat_rs::config::{components::CAMERA_HANDLER, tasks::FREQ_MS_EVENT_HANDLING};
|
||||||
use ops_sat_rs::config::{tasks::FREQ_MS_UDP_TMTC, OBSW_SERVER_ADDR, SERVER_PORT};
|
use ops_sat_rs::config::{tasks::FREQ_MS_UDP_TMTC, OBSW_SERVER_ADDR, SERVER_PORT};
|
||||||
use ops_sat_rs::TimeStampHelper;
|
use ops_sat_rs::TimeStampHelper;
|
||||||
@ -54,10 +48,11 @@ mod tmtc;
|
|||||||
fn main() {
|
fn main() {
|
||||||
setup_logger().expect("setting up logging with fern failed");
|
setup_logger().expect("setting up logging with fern failed");
|
||||||
let version_str = VERSION.unwrap_or("?");
|
let version_str = VERSION.unwrap_or("?");
|
||||||
println!("OPS-SAT Rust Experiment OBSW v{}", version_str);
|
debug!("OPS-SAT Rust Experiment OBSW v{}", version_str);
|
||||||
|
create_low_priority_ground_dir();
|
||||||
|
|
||||||
let app_cfg = create_app_config();
|
let app_cfg = create_app_config();
|
||||||
println!("App Configuration: {:?}", app_cfg);
|
debug!("App Configuration: {:?}", app_cfg);
|
||||||
|
|
||||||
let stop_signal = Arc::new(AtomicBool::new(false));
|
let stop_signal = Arc::new(AtomicBool::new(false));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user