2022-08-18 01:32:02 +02:00
|
|
|
use fsrc_example::{OBSW_SERVER_ADDR, SERVER_PORT};
|
|
|
|
use spacepackets::tc::PusTc;
|
|
|
|
use spacepackets::SpHeader;
|
|
|
|
use std::net::{IpAddr, SocketAddr, UdpSocket};
|
|
|
|
|
|
|
|
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);
|
2022-08-28 00:28:29 +02:00
|
|
|
let client = UdpSocket::bind("127.0.0.1:7302").expect("Connecting to UDP server failed");
|
2022-08-18 01:32:02 +02:00
|
|
|
let size = pus_tc.write_to(&mut buf).expect("Creating PUS TC failed");
|
|
|
|
client
|
|
|
|
.send_to(&buf[0..size], &addr)
|
|
|
|
.expect(&*format!("Sending to {:?} failed", addr));
|
|
|
|
}
|