removed pus tm handler generic for camera handler

This commit is contained in:
lkoester 2024-04-17 10:38:40 +02:00
parent 2d3a4cd90c
commit f960f24415
2 changed files with 13 additions and 12 deletions

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)]
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"));
} }