this should suffice

This commit is contained in:
Robin Müller 2022-09-11 14:58:51 +02:00
parent ab2fa4c050
commit 35942aadb6
No known key found for this signature in database
GPG Key ID: 9C287E88FED11DF3
2 changed files with 22 additions and 6 deletions

View File

@ -104,7 +104,7 @@ pub struct RequestId {
impl Display for RequestId {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
write!(f, "Request ID {:#08x}", self.raw())
write!(f, "{:#08x}", self.raw())
}
}

View File

@ -9,14 +9,13 @@ use std::time::Duration;
fn main() {
let mut buf = [0; 32];
let addr = SocketAddr::new(IpAddr::V4(OBSW_SERVER_ADDR), SERVER_PORT);
let mut sph = SpHeader::tc(0x02, 0, 0).unwrap();
let pus_tc = PusTc::new_simple(&mut sph, 17, 1, None, true);
let client = UdpSocket::bind("127.0.0.1:7302").expect("Connecting to UDP server failed");
let tc_req_id = RequestId::new(&pus_tc);
println!(
"Packing and sending PUS ping command TC[17,1] with {}",
"Packing and sending PUS ping command TC[17,1] with request ID {}",
tc_req_id
);
let size = pus_tc.write_to(&mut buf).expect("Creating PUS TC failed");
@ -44,16 +43,33 @@ fn main() {
}
let req_id = RequestId::from_bytes(src_data).unwrap();
if pus_tm.subservice() == 1 {
println!("Received TM[1,1] acceptance success for {}", req_id)
println!(
"Received TM[1,1] acceptance success for request ID {}",
req_id
)
} else if pus_tm.subservice() == 2 {
println!(
"Received TM[1,2] acceptance failure for request ID {}",
req_id
)
} else if pus_tm.subservice() == 3 {
println!("Received TM[1,3] start success for {}", req_id)
println!("Received TM[1,3] start success for request ID {}", req_id)
} else if pus_tm.subservice() == 4 {
println!("Received TM[1,2] start failure for request ID {}", req_id)
} else if pus_tm.subservice() == 5 {
println!("Received TM[1,5] step success for {}", req_id)
println!("Received TM[1,5] step success for request ID {}", req_id)
} else if pus_tm.subservice() == 6 {
println!("Received TM[1,6] step failure for request ID {}", req_id)
} else if pus_tm.subservice() == 7 {
println!(
"Received TM[1,7] completion success for request ID {}",
req_id
)
} else if pus_tm.subservice() == 8 {
println!(
"Received TM[1,8] completion failure for request ID {}",
req_id
);
}
} else {
println!(