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
///
/// see also https://opssat1.esoc.esa.int/dmsf/files/6/view
use crate::requests::CompositeRequest;
use derive_new::new;
use log::debug;
use ops_sat_rs::TimeStampHelper;
use satrs::action::{ActionRequest, ActionRequestVariant};
use satrs::hk::HkRequest;
use satrs::pus::EcssTmSender;
use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId};
use satrs::tmtc::PacketAsVec;
use serde::{Deserialize, Serialize};
use std::io::Error;
use std::process::Command;
@ -137,20 +138,18 @@ impl CameraPictureParameters {
#[allow(dead_code)]
#[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,
// mode_interface: MpscModeLeafInterface,
composite_request_receiver: mpsc::Receiver<GenericMessage<CompositeRequest>>,
// hk_reply_sender: mpsc::Sender<GenericMessage<HkReply>>,
tm_sender: TmSender,
tm_sender: mpsc::Sender<PacketAsVec>,
stamp_helper: TimeStampHelper,
}
#[allow(non_snake_case)]
#[allow(dead_code)]
impl<TmSender: EcssTmSender>
IMS100BatchHandler<TmSender>
{
impl IMS100BatchHandler {
pub fn periodic_operation(&mut self) {
self.stamp_helper.update_from_now();
// 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
}
@ -202,12 +205,10 @@ impl<TmSender: EcssTmSender>
));
}
ActionRequestVariant::VecData(data) => {
let param: serde_json::Result<CameraPictureParameters>=
let param: serde_json::Result<CameraPictureParameters> =
serde_json::from_slice(data.as_slice());
match param {
Ok(param) => {
param
}
Ok(param) => param,
Err(_) => {
return Err(Error::other("Unable to deserialize parameters"));
}