first implementation of apid with target id, currently main broken

This commit is contained in:
lkoester
2023-08-15 08:49:54 +02:00
parent 698c2edb93
commit 075dc38434
8 changed files with 163 additions and 79 deletions

View File

@ -4,6 +4,8 @@ mod logging;
mod pus;
mod requests;
mod tmtc;
//mod can;
//mod can_ids;
use log::{info, warn};
@ -43,11 +45,9 @@ use satrs_core::spacepackets::{
SpHeader,
};
use satrs_core::tmtc::tm_helper::SharedTmStore;
use satrs_core::tmtc::{AddressableId, TargetId};
use satrs_core::tmtc::{TargetId};
use satrs_core::ChannelId;
use satrs_example::{
RequestTargetId, TcReceiverId, TmSenderId, OBSW_SERVER_ADDR, PUS_APID, SERVER_PORT,
};
use satrs_example::{RequestTargetId, TcReceiverId, TmSenderId, OBSW_SERVER_ADDR, PUS_APID, SERVER_PORT, TargetIdWithApid};
use std::collections::HashMap;
use std::net::{IpAddr, SocketAddr};
use std::sync::mpsc::{channel, TryRecvError};
@ -124,7 +124,8 @@ fn main() {
// Some request are targetable. This map is used to retrieve sender handles based on a target ID.
let mut request_map = HashMap::new();
let (acs_thread_tx, acs_thread_rx) = channel::<RequestWithToken>();
request_map.insert(RequestTargetId::AcsSubsystem as TargetId, acs_thread_tx);
let target_apid = TargetIdWithApid::new(PUS_APID, RequestTargetId::AcsSubsystem as TargetId);
request_map.insert(target_apid, acs_thread_tx);
let tc_source_wrapper = PusTcSource {
tc_store: tc_store.clone(),
@ -393,8 +394,8 @@ fn main() {
Request::Hk(hk_req) => match hk_req {
HkRequest::OneShot(unique_id) => {
let target = request.targeted_request.target_id;
assert_eq!(target, RequestTargetId::AcsSubsystem as u32);
if request.targeted_request.target_id
assert_eq!(target.target_id(), RequestTargetId::AcsSubsystem as u32);
if request.targeted_request.target_id.target
== AcsHkIds::TestMgmSet as u32
{
let mut sp_header = SpHeader::tm(
@ -410,11 +411,8 @@ fn main() {
&timestamp,
);
let mut buf: [u8; 8] = [0; 8];
let addressable_id = AddressableId {
target_id: target,
unique_id,
};
addressable_id.write_to_be_bytes(&mut buf).unwrap();
target.target.write_to_be_bytes(&mut buf).unwrap();
let pus_tm = PusTmCreator::new(
&mut sp_header,
sec_header,