bump spacepackets #80
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "satrs-core"
|
name = "satrs-core"
|
||||||
version = "0.1.0-alpha.0"
|
version = "0.1.0-alpha.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.61"
|
rust-version = "1.61"
|
||||||
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||||
@ -15,6 +15,7 @@ categories = ["aerospace", "aerospace::space-protocols", "no-std", "hardware-sup
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
delegate = ">0.7, <=0.10"
|
delegate = ">0.7, <=0.10"
|
||||||
paste = "1"
|
paste = "1"
|
||||||
|
# TODO: Remove this as soon as the image including the description was moved to the satrs-book.
|
||||||
embed-doc-image = "0.1"
|
embed-doc-image = "0.1"
|
||||||
|
|
||||||
[dependencies.smallvec]
|
[dependencies.smallvec]
|
||||||
@ -72,12 +73,11 @@ features = ["all"]
|
|||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dependencies.spacepackets]
|
[dependencies.spacepackets]
|
||||||
# version = "0.7.0-beta.1"
|
version = "0.7.0-beta.2"
|
||||||
# path = "../../spacepackets"
|
|
||||||
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
|
||||||
rev = "79d26e1a6"
|
|
||||||
# branch = ""
|
|
||||||
default-features = false
|
default-features = false
|
||||||
|
# git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
||||||
|
# rev = "79d26e1a6"
|
||||||
|
# branch = ""
|
||||||
|
|
||||||
[dependencies.cobs]
|
[dependencies.cobs]
|
||||||
git = "https://github.com/robamu/cobs.rs.git"
|
git = "https://github.com/robamu/cobs.rs.git"
|
||||||
|
@ -220,13 +220,10 @@ mod tests {
|
|||||||
});
|
});
|
||||||
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
||||||
let ping_tc = PusTcCreator::new_simple(&mut sph, 17, 1, None, true);
|
let ping_tc = PusTcCreator::new_simple(&mut sph, 17, 1, None, true);
|
||||||
let mut buffer: [u8; 32] = [0; 32];
|
let tc_0 = ping_tc.to_vec().expect("packet generation failed");
|
||||||
let packet_len_ping = ping_tc
|
|
||||||
.write_to_bytes(&mut buffer)
|
|
||||||
.expect("writing packet failed");
|
|
||||||
let mut stream = TcpStream::connect(dest_addr).expect("connecting to TCP server failed");
|
let mut stream = TcpStream::connect(dest_addr).expect("connecting to TCP server failed");
|
||||||
stream
|
stream
|
||||||
.write_all(&buffer[..packet_len_ping])
|
.write_all(&tc_0)
|
||||||
.expect("writing to TCP server failed");
|
.expect("writing to TCP server failed");
|
||||||
drop(stream);
|
drop(stream);
|
||||||
|
|
||||||
@ -242,12 +239,11 @@ mod tests {
|
|||||||
// Check that TC has arrived.
|
// Check that TC has arrived.
|
||||||
let mut tc_queue = tc_receiver.tc_queue.lock().unwrap();
|
let mut tc_queue = tc_receiver.tc_queue.lock().unwrap();
|
||||||
assert_eq!(tc_queue.len(), 1);
|
assert_eq!(tc_queue.len(), 1);
|
||||||
assert_eq!(tc_queue.pop_front().unwrap(), buffer[..packet_len_ping]);
|
assert_eq!(tc_queue.pop_front().unwrap(), tc_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multi_tc_multi_tm() {
|
fn test_multi_tc_multi_tm() {
|
||||||
let mut buffer: [u8; 32] = [0; 32];
|
|
||||||
let auto_port_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 0);
|
let auto_port_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 0);
|
||||||
let tc_receiver = SyncTcCacher::default();
|
let tc_receiver = SyncTcCacher::default();
|
||||||
let mut tm_source = SyncTmSource::default();
|
let mut tm_source = SyncTmSource::default();
|
||||||
@ -256,19 +252,13 @@ mod tests {
|
|||||||
let mut total_tm_len = 0;
|
let mut total_tm_len = 0;
|
||||||
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
||||||
let verif_tm = PusTcCreator::new_simple(&mut sph, 1, 1, None, true);
|
let verif_tm = PusTcCreator::new_simple(&mut sph, 1, 1, None, true);
|
||||||
let tm_packet_len = verif_tm
|
let tm_0 = verif_tm.to_vec().expect("writing packet failed");
|
||||||
.write_to_bytes(&mut buffer)
|
total_tm_len += tm_0.len();
|
||||||
.expect("writing packet failed");
|
|
||||||
total_tm_len += tm_packet_len;
|
|
||||||
let tm_0 = buffer[..tm_packet_len].to_vec();
|
|
||||||
tm_source.add_tm(&tm_0);
|
tm_source.add_tm(&tm_0);
|
||||||
let mut sph = SpHeader::tc_unseg(TEST_APID_1, 0, 0).unwrap();
|
let mut sph = SpHeader::tc_unseg(TEST_APID_1, 0, 0).unwrap();
|
||||||
let verif_tm = PusTcCreator::new_simple(&mut sph, 1, 3, None, true);
|
let verif_tm = PusTcCreator::new_simple(&mut sph, 1, 3, None, true);
|
||||||
let tm_packet_len = verif_tm
|
let tm_1 = verif_tm.to_vec().expect("writing packet failed");
|
||||||
.write_to_bytes(&mut buffer)
|
total_tm_len += tm_1.len();
|
||||||
.expect("writing packet failed");
|
|
||||||
total_tm_len += tm_packet_len;
|
|
||||||
let tm_1 = buffer[..tm_packet_len].to_vec();
|
|
||||||
tm_source.add_tm(&tm_1);
|
tm_source.add_tm(&tm_1);
|
||||||
|
|
||||||
// Set up server
|
// Set up server
|
||||||
@ -309,19 +299,13 @@ mod tests {
|
|||||||
// Send telecommands
|
// Send telecommands
|
||||||
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
||||||
let ping_tc = PusTcCreator::new_simple(&mut sph, 17, 1, None, true);
|
let ping_tc = PusTcCreator::new_simple(&mut sph, 17, 1, None, true);
|
||||||
let packet_len = ping_tc
|
let tc_0 = ping_tc.to_vec().expect("ping tc creation failed");
|
||||||
.write_to_bytes(&mut buffer)
|
|
||||||
.expect("writing packet failed");
|
|
||||||
let tc_0 = buffer[..packet_len].to_vec();
|
|
||||||
stream
|
stream
|
||||||
.write_all(&tc_0)
|
.write_all(&tc_0)
|
||||||
.expect("writing to TCP server failed");
|
.expect("writing to TCP server failed");
|
||||||
let mut sph = SpHeader::tc_unseg(TEST_APID_1, 0, 0).unwrap();
|
let mut sph = SpHeader::tc_unseg(TEST_APID_1, 0, 0).unwrap();
|
||||||
let action_tc = PusTcCreator::new_simple(&mut sph, 8, 0, None, true);
|
let action_tc = PusTcCreator::new_simple(&mut sph, 8, 0, None, true);
|
||||||
let packet_len = action_tc
|
let tc_1 = action_tc.to_vec().expect("action tc creation failed");
|
||||||
.write_to_bytes(&mut buffer)
|
|
||||||
.expect("writing packet failed");
|
|
||||||
let tc_1 = buffer[..packet_len].to_vec();
|
|
||||||
stream
|
stream
|
||||||
.write_all(&tc_1)
|
.write_all(&tc_1)
|
||||||
.expect("writing to TCP server failed");
|
.expect("writing to TCP server failed");
|
||||||
|
@ -166,16 +166,12 @@ const TEST_PACKET_ID_0: PacketId = PacketId::const_tc(true, TEST_APID_0);
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ccsds_server() {
|
fn test_ccsds_server() {
|
||||||
let mut buffer: [u8; 32] = [0; 32];
|
|
||||||
let tc_receiver = SyncTcCacher::default();
|
let tc_receiver = SyncTcCacher::default();
|
||||||
let mut tm_source = SyncTmSource::default();
|
let mut tm_source = SyncTmSource::default();
|
||||||
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
||||||
let verif_tm = PusTcCreator::new_simple(&mut sph, 1, 1, None, true);
|
let verif_tm = PusTcCreator::new_simple(&mut sph, 1, 1, None, true);
|
||||||
let tm_packet_len = verif_tm
|
let tm_0 = verif_tm.to_vec().expect("tm generation failed");
|
||||||
.write_to_bytes(&mut buffer)
|
tm_source.add_tm(&tm_0);
|
||||||
.expect("writing packet failed");
|
|
||||||
tm_source.add_tm(&buffer[..tm_packet_len]);
|
|
||||||
let tm_vec = buffer[..tm_packet_len].to_vec();
|
|
||||||
let mut packet_id_lookup = HashSet::new();
|
let mut packet_id_lookup = HashSet::new();
|
||||||
packet_id_lookup.insert(TEST_PACKET_ID_0);
|
packet_id_lookup.insert(TEST_PACKET_ID_0);
|
||||||
let mut tcp_server = TcpSpacepacketsServer::new(
|
let mut tcp_server = TcpSpacepacketsServer::new(
|
||||||
@ -202,29 +198,30 @@ fn test_ccsds_server() {
|
|||||||
set_if_done.store(true, Ordering::Relaxed);
|
set_if_done.store(true, Ordering::Relaxed);
|
||||||
});
|
});
|
||||||
let mut stream = TcpStream::connect(dest_addr).expect("connecting to TCP server failed");
|
let mut stream = TcpStream::connect(dest_addr).expect("connecting to TCP server failed");
|
||||||
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
|
||||||
let ping_tc = PusTcCreator::new_simple(&mut sph, 17, 1, None, true);
|
|
||||||
stream
|
stream
|
||||||
.set_read_timeout(Some(Duration::from_millis(10)))
|
.set_read_timeout(Some(Duration::from_millis(10)))
|
||||||
.expect("setting reas timeout failed");
|
.expect("setting reas timeout failed");
|
||||||
let packet_len = ping_tc
|
|
||||||
.write_to_bytes(&mut buffer)
|
|
||||||
.expect("writing packet failed");
|
|
||||||
stream
|
|
||||||
.write_all(&buffer[..packet_len])
|
|
||||||
.expect("writing to TCP server failed");
|
|
||||||
|
|
||||||
|
// Send ping telecommand.
|
||||||
|
let mut sph = SpHeader::tc_unseg(TEST_APID_0, 0, 0).unwrap();
|
||||||
|
let ping_tc = PusTcCreator::new_simple(&mut sph, 17, 1, None, true);
|
||||||
|
let tc_0 = ping_tc.to_vec().expect("packet creation failed");
|
||||||
|
stream
|
||||||
|
.write_all(&tc_0)
|
||||||
|
.expect("writing to TCP server failed");
|
||||||
// Done with writing.
|
// Done with writing.
|
||||||
stream
|
stream
|
||||||
.shutdown(std::net::Shutdown::Write)
|
.shutdown(std::net::Shutdown::Write)
|
||||||
.expect("shutting down write failed");
|
.expect("shutting down write failed");
|
||||||
|
|
||||||
|
// Now read all the telemetry from the server.
|
||||||
let mut read_buf: [u8; 16] = [0; 16];
|
let mut read_buf: [u8; 16] = [0; 16];
|
||||||
let mut read_len_total = 0;
|
let mut read_len_total = 0;
|
||||||
// Timeout ensures this does not block forever.
|
// Timeout ensures this does not block forever.
|
||||||
while read_len_total < tm_packet_len {
|
while read_len_total < tm_0.len() {
|
||||||
let read_len = stream.read(&mut read_buf).expect("read failed");
|
let read_len = stream.read(&mut read_buf).expect("read failed");
|
||||||
read_len_total += read_len;
|
read_len_total += read_len;
|
||||||
assert_eq!(read_buf[..read_len], tm_vec);
|
assert_eq!(read_buf[..read_len], tm_0);
|
||||||
}
|
}
|
||||||
drop(stream);
|
drop(stream);
|
||||||
|
|
||||||
@ -240,5 +237,5 @@ fn test_ccsds_server() {
|
|||||||
// Check that TC has arrived.
|
// Check that TC has arrived.
|
||||||
let mut tc_queue = tc_receiver.tc_queue.lock().unwrap();
|
let mut tc_queue = tc_receiver.tc_queue.lock().unwrap();
|
||||||
assert_eq!(tc_queue.len(), 1);
|
assert_eq!(tc_queue.len(), 1);
|
||||||
assert_eq!(tc_queue.pop_front().unwrap(), buffer[..packet_len]);
|
assert_eq!(tc_queue.pop_front().unwrap(), tc_0);
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ version = "1"
|
|||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dependencies.satrs-core]
|
[dependencies.satrs-core]
|
||||||
# version = "0.1.0-alpha.0"
|
version = "0.1.0-alpha.1"
|
||||||
git = "https://egit.irs.uni-stuttgart.de/rust/sat-rs.git"
|
# git = "https://egit.irs.uni-stuttgart.de/rust/sat-rs.git"
|
||||||
rev = "35e1f7a983f6535c5571186e361fe101d4306b89"
|
# rev = "35e1f7a983f6535c5571186e361fe101d4306b89"
|
||||||
|
|
||||||
[dependencies.satrs-mib-codegen]
|
[dependencies.satrs-mib-codegen]
|
||||||
path = "codegen"
|
path = "codegen"
|
||||||
|
@ -20,9 +20,9 @@ quote = "1"
|
|||||||
proc-macro2 = "1"
|
proc-macro2 = "1"
|
||||||
|
|
||||||
[dependencies.satrs-core]
|
[dependencies.satrs-core]
|
||||||
# version = "0.1.0-alpha.0"
|
version = "0.1.0-alpha.1"
|
||||||
git = "https://egit.irs.uni-stuttgart.de/rust/sat-rs.git"
|
# git = "https://egit.irs.uni-stuttgart.de/rust/sat-rs.git"
|
||||||
rev = "35e1f7a983f6535c5571186e361fe101d4306b89"
|
# rev = "35e1f7a983f6535c5571186e361fe101d4306b89"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
trybuild = { version = "1", features = ["diff"] }
|
trybuild = { version = "1", features = ["diff"] }
|
||||||
|
Loading…
Reference in New Issue
Block a user