camera_merge_main #7

Merged
lkoester merged 9 commits from camera_merge_main into main 2024-04-19 11:45:25 +02:00
2 changed files with 13 additions and 12 deletions
Showing only changes of commit f960f24415 - Show all commits

View File

@ -24,14 +24,15 @@
/// v Y /// v Y
/// ///
/// see also https://opssat1.esoc.esa.int/dmsf/files/6/view /// see also https://opssat1.esoc.esa.int/dmsf/files/6/view
use crate::requests::CompositeRequest; use crate::requests::CompositeRequest;
use derive_new::new; use derive_new::new;
use log::debug; use log::debug;
use ops_sat_rs::TimeStampHelper; use ops_sat_rs::TimeStampHelper;
use satrs::action::{ActionRequest, ActionRequestVariant}; use satrs::action::{ActionRequest, ActionRequestVariant};
use satrs::hk::HkRequest; use satrs::hk::HkRequest;
use satrs::pus::EcssTmSender;
use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId}; use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId};
use satrs::tmtc::PacketAsVec;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::io::Error; use std::io::Error;
use std::process::Command; use std::process::Command;
@ -137,20 +138,18 @@ impl CameraPictureParameters {
#[allow(dead_code)] #[allow(dead_code)]
#[derive(new)] #[derive(new)]
lkoester marked this conversation as resolved Outdated

I don't think we need to abstract the TM Sender. It will always be a mpsc::Sender<PacketAsVec>

I don't think we need to abstract the TM Sender. It will always be a `mpsc::Sender<PacketAsVec>`
pub struct IMS100BatchHandler<TmSender: EcssTmSender> { pub struct IMS100BatchHandler {
id: UniqueApidTargetId, id: UniqueApidTargetId,
// mode_interface: MpscModeLeafInterface, // mode_interface: MpscModeLeafInterface,
composite_request_receiver: mpsc::Receiver<GenericMessage<CompositeRequest>>, composite_request_receiver: mpsc::Receiver<GenericMessage<CompositeRequest>>,
// hk_reply_sender: mpsc::Sender<GenericMessage<HkReply>>, // hk_reply_sender: mpsc::Sender<GenericMessage<HkReply>>,
tm_sender: TmSender, tm_sender: mpsc::Sender<PacketAsVec>,
stamp_helper: TimeStampHelper, stamp_helper: TimeStampHelper,
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[allow(dead_code)] #[allow(dead_code)]
impl<TmSender: EcssTmSender> impl IMS100BatchHandler {
IMS100BatchHandler<TmSender>
{
pub fn periodic_operation(&mut self) { pub fn periodic_operation(&mut self) {
self.stamp_helper.update_from_now(); self.stamp_helper.update_from_now();
// Handle requests. // Handle requests.
@ -174,7 +173,11 @@ impl<TmSender: EcssTmSender>
} }
} }
pub fn handle_hk_request(&mut self, _requestor_info: &MessageMetadata, _hk_request: &HkRequest) { pub fn handle_hk_request(
&mut self,
_requestor_info: &MessageMetadata,
_hk_request: &HkRequest,
) {
// TODO add hk to opssat // TODO add hk to opssat
} }
@ -202,12 +205,10 @@ impl<TmSender: EcssTmSender>
)); ));
} }
ActionRequestVariant::VecData(data) => { ActionRequestVariant::VecData(data) => {
let param: serde_json::Result<CameraPictureParameters>= let param: serde_json::Result<CameraPictureParameters> =
serde_json::from_slice(data.as_slice()); serde_json::from_slice(data.as_slice());
match param { match param {
Ok(param) => { Ok(param) => param,
param
}
Err(_) => { Err(_) => {
return Err(Error::other("Unable to deserialize parameters")); return Err(Error::other("Unable to deserialize parameters"));
} }

View File

@ -33,4 +33,4 @@ impl SpacePacketValidator for SimpleSpValidator {
} }
SpValidity::Skip SpValidity::Skip
} }
} }