TargetIdWithApid #63
@ -5,20 +5,20 @@ 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>"]
|
||||||
description = "Core components of the sat-rs framework to build software for remote systems"
|
description = "Core components of the sat-rs framework to build software for remote systems"
|
||||||
homepage = "https://egit.irs.uni-stuttgart.de/rust/satrs-core"
|
homepage = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
|
||||||
repository = "https://egit.irs.uni-stuttgart.de/rust/satrs-core"
|
repository = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
keywords = ["no-std", "space", "aerospace"]
|
keywords = ["no-std", "space", "aerospace"]
|
||||||
categories = ["aerospace", "aerospace::space-protocols", "no-std", "hardware-support", "embedded"]
|
categories = ["aerospace", "aerospace::space-protocols", "no-std", "hardware-support", "embedded"]
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
delegate = ">=0.8, <0.11"
|
delegate = ">0.7, <=0.10"
|
||||||
paste = "1"
|
paste = "1"
|
||||||
embed-doc-image = "0.1"
|
embed-doc-image = "0.1"
|
||||||
|
|
||||||
[dependencies.num_enum]
|
[dependencies.num_enum]
|
||||||
version = "0.6"
|
version = ">0.5, <=0.7"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dependencies.dyn-clone]
|
[dependencies.dyn-clone]
|
||||||
@ -61,15 +61,16 @@ default-features = false
|
|||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dependencies.spacepackets]
|
[dependencies.spacepackets]
|
||||||
# version = "0.6"
|
version = "0.7.0-beta.1"
|
||||||
# path = "../spacepackets"
|
# path = "../../spacepackets"
|
||||||
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
# git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
||||||
rev = "62df510147b"
|
# rev = ""
|
||||||
|
# branch = ""
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde = "1"
|
serde = "1"
|
||||||
zerocopy = "0.6"
|
zerocopy = "0.7"
|
||||||
once_cell = "1.13"
|
once_cell = "1.13"
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
[![Crates.io](https://img.shields.io/crates/v/satrs-core)](https://crates.io/crates/satrs-core)
|
||||||
|
[![docs.rs](https://img.shields.io/docsrs/satrs-core)](https://docs.rs/satrs-core)
|
||||||
|
|
||||||
satrs-core
|
satrs-core
|
||||||
======
|
======
|
||||||
|
|
||||||
This crate contains the core components of the sat-rs framework.
|
This crate contains the core components of the sat-rs framework.
|
||||||
You can find more information on [homepage](https://egit.irs.uni-stuttgart.de/rust/sat-rs)
|
You can find more information on [homepage](https://egit.irs.uni-stuttgart.de/rust/sat-rs).
|
||||||
|
|
||||||
|
25
satrs-core/release-checklist.md
Normal file
25
satrs-core/release-checklist.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
Checklist for new releases
|
||||||
|
=======
|
||||||
|
|
||||||
|
# Pre-Release
|
||||||
|
|
||||||
|
1. Make sure any new modules are documented sufficiently enough and check docs with
|
||||||
|
`cargo doc --all-features --open`.
|
||||||
|
2. Bump version specifier in `Cargo.toml`.
|
||||||
|
3. Update `CHANGELOG.md`: Convert `unreleased` section into version section with date and add new
|
||||||
|
`unreleased` section.
|
||||||
|
4. Run `cargo test --all-features`.
|
||||||
|
5. Run `cargo fmt` and `cargo clippy`. Check `cargo msrv` against MSRV in `Cargo.toml`.
|
||||||
|
6. Wait for CI/CD results for EGit and Github. These also check cross-compilation for bare-metal
|
||||||
|
targets.
|
||||||
|
|
||||||
|
# Release
|
||||||
|
|
||||||
|
1. `cargo publish`
|
||||||
|
|
||||||
|
# Post-Release
|
||||||
|
|
||||||
|
1. Create a new annotaged tag and push it with `git tag -a satrs-core-<version>` and
|
||||||
|
`git push -u origin satrs-core-<version>`
|
||||||
|
2. Create a new release on `EGit` based on the tag.
|
||||||
|
|
@ -33,7 +33,7 @@ use core::marker::PhantomData;
|
|||||||
use delegate::delegate;
|
use delegate::delegate;
|
||||||
use spacepackets::ecss::EcssEnumeration;
|
use spacepackets::ecss::EcssEnumeration;
|
||||||
use spacepackets::util::{ToBeBytes, UnsignedEnum};
|
use spacepackets::util::{ToBeBytes, UnsignedEnum};
|
||||||
use spacepackets::{ByteConversionError, SizeMissmatch};
|
use spacepackets::ByteConversionError;
|
||||||
|
|
||||||
/// Using a type definition allows to change this to u64 in the future more easily
|
/// Using a type definition allows to change this to u64 in the future more easily
|
||||||
pub type LargestEventRaw = u32;
|
pub type LargestEventRaw = u32;
|
||||||
@ -124,10 +124,10 @@ impl<RAW: ToBeBytes, GID, UID> EventBase<RAW, GID, UID> {
|
|||||||
width: usize,
|
width: usize,
|
||||||
) -> Result<usize, ByteConversionError> {
|
) -> Result<usize, ByteConversionError> {
|
||||||
if buf.len() < width {
|
if buf.len() < width {
|
||||||
return Err(ByteConversionError::ToSliceTooSmall(SizeMissmatch {
|
return Err(ByteConversionError::ToSliceTooSmall {
|
||||||
found: buf.len(),
|
found: buf.len(),
|
||||||
expected: width,
|
expected: width,
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
buf.copy_from_slice(raw.to_be_bytes().as_ref());
|
buf.copy_from_slice(raw.to_be_bytes().as_ref());
|
||||||
Ok(raw.written_len())
|
Ok(raw.written_len())
|
||||||
@ -783,9 +783,9 @@ mod tests {
|
|||||||
let err = HIGH_SEV_EVENT.write_to_be_bytes(&mut buf);
|
let err = HIGH_SEV_EVENT.write_to_be_bytes(&mut buf);
|
||||||
assert!(err.is_err());
|
assert!(err.is_err());
|
||||||
let err = err.unwrap_err();
|
let err = err.unwrap_err();
|
||||||
if let ByteConversionError::ToSliceTooSmall(missmatch) = err {
|
if let ByteConversionError::ToSliceTooSmall { found, expected } = err {
|
||||||
assert_eq!(missmatch.expected, 4);
|
assert_eq!(expected, 4);
|
||||||
assert_eq!(missmatch.found, 3);
|
assert_eq!(found, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -795,9 +795,9 @@ mod tests {
|
|||||||
let err = HIGH_SEV_EVENT_SMALL.write_to_be_bytes(&mut buf);
|
let err = HIGH_SEV_EVENT_SMALL.write_to_be_bytes(&mut buf);
|
||||||
assert!(err.is_err());
|
assert!(err.is_err());
|
||||||
let err = err.unwrap_err();
|
let err = err.unwrap_err();
|
||||||
if let ByteConversionError::ToSliceTooSmall(missmatch) = err {
|
if let ByteConversionError::ToSliceTooSmall { found, expected } = err {
|
||||||
assert_eq!(missmatch.expected, 2);
|
assert_eq!(expected, 2);
|
||||||
assert_eq!(missmatch.found, 1);
|
assert_eq!(found, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use crate::tmtc::TargetId;
|
|||||||
use core::mem::size_of;
|
use core::mem::size_of;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use spacepackets::{ByteConversionError, SizeMissmatch};
|
use spacepackets::ByteConversionError;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
@ -26,10 +26,10 @@ impl ModeAndSubmode {
|
|||||||
|
|
||||||
pub fn from_be_bytes(buf: &[u8]) -> Result<Self, ByteConversionError> {
|
pub fn from_be_bytes(buf: &[u8]) -> Result<Self, ByteConversionError> {
|
||||||
if buf.len() < 6 {
|
if buf.len() < 6 {
|
||||||
return Err(ByteConversionError::FromSliceTooSmall(SizeMissmatch {
|
return Err(ByteConversionError::FromSliceTooSmall {
|
||||||
expected: 6,
|
expected: 6,
|
||||||
found: buf.len(),
|
found: buf.len(),
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
mode: u32::from_be_bytes(buf[0..4].try_into().unwrap()),
|
mode: u32::from_be_bytes(buf[0..4].try_into().unwrap()),
|
||||||
|
@ -55,7 +55,6 @@ use paste::paste;
|
|||||||
use spacepackets::ecss::{EcssEnumU16, EcssEnumU32, EcssEnumU64, EcssEnumU8};
|
use spacepackets::ecss::{EcssEnumU16, EcssEnumU32, EcssEnumU64, EcssEnumU8};
|
||||||
use spacepackets::util::UnsignedEnum;
|
use spacepackets::util::UnsignedEnum;
|
||||||
use spacepackets::ByteConversionError;
|
use spacepackets::ByteConversionError;
|
||||||
use spacepackets::SizeMissmatch;
|
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub use alloc_mod::*;
|
pub use alloc_mod::*;
|
||||||
@ -80,10 +79,10 @@ macro_rules! param_to_be_bytes_impl {
|
|||||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
||||||
let raw_len = self.raw_len();
|
let raw_len = self.raw_len();
|
||||||
if buf.len() < raw_len {
|
if buf.len() < raw_len {
|
||||||
return Err(ByteConversionError::ToSliceTooSmall(SizeMissmatch {
|
return Err(ByteConversionError::ToSliceTooSmall {
|
||||||
found: buf.len(),
|
found: buf.len(),
|
||||||
expected: raw_len,
|
expected: raw_len,
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
buf[0..raw_len].copy_from_slice(&self.to_be_bytes());
|
buf[0..raw_len].copy_from_slice(&self.to_be_bytes());
|
||||||
Ok(raw_len)
|
Ok(raw_len)
|
||||||
@ -186,10 +185,10 @@ macro_rules! scalar_byte_conversions_impl {
|
|||||||
|
|
||||||
fn try_from(v: &[u8]) -> Result<Self, Self::Error> {
|
fn try_from(v: &[u8]) -> Result<Self, Self::Error> {
|
||||||
if v.len() < size_of::<$ty>() {
|
if v.len() < size_of::<$ty>() {
|
||||||
return Err(ByteConversionError::FromSliceTooSmall(SizeMissmatch {
|
return Err(ByteConversionError::FromSliceTooSmall{
|
||||||
expected: size_of::<$ty>(),
|
expected: size_of::<$ty>(),
|
||||||
found: v.len()
|
found: v.len()
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
Ok([<$ty:upper>]($ty::from_be_bytes(v[0..size_of::<$ty>()].try_into().unwrap())))
|
Ok([<$ty:upper>]($ty::from_be_bytes(v[0..size_of::<$ty>()].try_into().unwrap())))
|
||||||
}
|
}
|
||||||
@ -225,10 +224,10 @@ macro_rules! pair_byte_conversions_impl {
|
|||||||
|
|
||||||
fn try_from(v: &[u8]) -> Result<Self, Self::Error> {
|
fn try_from(v: &[u8]) -> Result<Self, Self::Error> {
|
||||||
if v.len() < 2 * size_of::<$ty>() {
|
if v.len() < 2 * size_of::<$ty>() {
|
||||||
return Err(ByteConversionError::FromSliceTooSmall(SizeMissmatch {
|
return Err(ByteConversionError::FromSliceTooSmall{
|
||||||
expected: 2 * size_of::<$ty>(),
|
expected: 2 * size_of::<$ty>(),
|
||||||
found: v.len()
|
found: v.len()
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
Ok([<$ty:upper Pair>](
|
Ok([<$ty:upper Pair>](
|
||||||
$ty::from_be_bytes(v[0..size_of::<$ty>()].try_into().unwrap()),
|
$ty::from_be_bytes(v[0..size_of::<$ty>()].try_into().unwrap()),
|
||||||
@ -269,10 +268,10 @@ macro_rules! triplet_to_be_bytes_impl {
|
|||||||
|
|
||||||
fn try_from(v: &[u8]) -> Result<Self, Self::Error> {
|
fn try_from(v: &[u8]) -> Result<Self, Self::Error> {
|
||||||
if v.len() < 3 * size_of::<$ty>() {
|
if v.len() < 3 * size_of::<$ty>() {
|
||||||
return Err(ByteConversionError::FromSliceTooSmall(SizeMissmatch {
|
return Err(ByteConversionError::FromSliceTooSmall{
|
||||||
expected: 3 * size_of::<$ty>(),
|
expected: 3 * size_of::<$ty>(),
|
||||||
found: v.len()
|
found: v.len()
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
Ok([<$ty:upper Triplet>](
|
Ok([<$ty:upper Triplet>](
|
||||||
$ty::from_be_bytes(v[0..size_of::<$ty>()].try_into().unwrap()),
|
$ty::from_be_bytes(v[0..size_of::<$ty>()].try_into().unwrap()),
|
||||||
|
@ -344,7 +344,7 @@ mod alloc_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Pool implementation providing sub-pools with fixed size memory blocks. More details in
|
/// Pool implementation providing sub-pools with fixed size memory blocks. More details in
|
||||||
/// the [module documentation][super::pool]
|
/// the [module documentation][crate::pool]
|
||||||
pub struct LocalPool {
|
pub struct LocalPool {
|
||||||
pool_cfg: PoolCfg,
|
pool_cfg: PoolCfg,
|
||||||
pool: Vec<Vec<u8>>,
|
pool: Vec<Vec<u8>>,
|
||||||
|
@ -425,12 +425,12 @@ mod tests {
|
|||||||
let err = reporter.event_info(sender, &time_stamp_empty, event, None);
|
let err = reporter.event_info(sender, &time_stamp_empty, event, None);
|
||||||
assert!(err.is_err());
|
assert!(err.is_err());
|
||||||
let err = err.unwrap_err();
|
let err = err.unwrap_err();
|
||||||
if let EcssTmtcError::Pus(PusError::ByteConversion(ByteConversionError::ToSliceTooSmall(
|
if let EcssTmtcError::Pus(PusError::ByteConversion(
|
||||||
missmatch,
|
ByteConversionError::ToSliceTooSmall { found, expected },
|
||||||
))) = err
|
)) = err
|
||||||
{
|
{
|
||||||
assert_eq!(missmatch.expected, 4);
|
assert_eq!(expected, 4);
|
||||||
assert_eq!(missmatch.found, expected_found_len);
|
assert_eq!(found, expected_found_len);
|
||||||
} else {
|
} else {
|
||||||
panic!("Unexpected error {:?}", err);
|
panic!("Unexpected error {:?}", err);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ use std::error::Error;
|
|||||||
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader};
|
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader};
|
||||||
use spacepackets::ecss::tm::PusTmCreator;
|
use spacepackets::ecss::tm::PusTmCreator;
|
||||||
use spacepackets::ecss::PusError;
|
use spacepackets::ecss::PusError;
|
||||||
use spacepackets::{ByteConversionError, SizeMissmatch, SpHeader};
|
use spacepackets::{ByteConversionError, SpHeader};
|
||||||
|
|
||||||
pub mod event;
|
pub mod event;
|
||||||
pub mod event_man;
|
pub mod event_man;
|
||||||
@ -735,10 +735,10 @@ pub mod std_mod {
|
|||||||
pub(crate) fn source_buffer_large_enough(cap: usize, len: usize) -> Result<(), EcssTmtcError> {
|
pub(crate) fn source_buffer_large_enough(cap: usize, len: usize) -> Result<(), EcssTmtcError> {
|
||||||
if len > cap {
|
if len > cap {
|
||||||
return Err(
|
return Err(
|
||||||
PusError::ByteConversion(ByteConversionError::ToSliceTooSmall(SizeMissmatch {
|
PusError::ByteConversion(ByteConversionError::ToSliceTooSmall {
|
||||||
found: cap,
|
found: cap,
|
||||||
expected: len,
|
expected: len,
|
||||||
}))
|
})
|
||||||
.into(),
|
.into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1584,12 +1584,12 @@ mod tests {
|
|||||||
assert_eq!(err_with_token.1, tok);
|
assert_eq!(err_with_token.1, tok);
|
||||||
match err_with_token.0 {
|
match err_with_token.0 {
|
||||||
EcssTmtcError::Pus(PusError::ByteConversion(e)) => match e {
|
EcssTmtcError::Pus(PusError::ByteConversion(e)) => match e {
|
||||||
ByteConversionError::ToSliceTooSmall(missmatch) => {
|
ByteConversionError::ToSliceTooSmall { found, expected } => {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
missmatch.expected,
|
expected,
|
||||||
fail_data.len() + RequestId::SIZE_AS_BYTES + fail_code.size()
|
fail_data.len() + RequestId::SIZE_AS_BYTES + fail_code.size()
|
||||||
);
|
);
|
||||||
assert_eq!(missmatch.found, b.rep().allowed_source_data_len());
|
assert_eq!(found, b.rep().allowed_source_data_len());
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
panic!("{}", format!("Unexpected error {:?}", e))
|
panic!("{}", format!("Unexpected error {:?}", e))
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use spacepackets::ecss::{EcssEnumU16, EcssEnumeration};
|
use spacepackets::ecss::{EcssEnumU16, EcssEnumeration};
|
||||||
use spacepackets::util::UnsignedEnum;
|
use spacepackets::util::UnsignedEnum;
|
||||||
use spacepackets::{ByteConversionError, SizeMissmatch};
|
use spacepackets::ByteConversionError;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
@ -42,10 +42,10 @@ impl UnsignedEnum for ResultU16 {
|
|||||||
|
|
||||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
||||||
if buf.len() < 2 {
|
if buf.len() < 2 {
|
||||||
return Err(ByteConversionError::ToSliceTooSmall(SizeMissmatch {
|
return Err(ByteConversionError::ToSliceTooSmall {
|
||||||
found: buf.len(),
|
found: buf.len(),
|
||||||
expected: 2,
|
expected: 2,
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
buf[0] = self.group_id;
|
buf[0] = self.group_id;
|
||||||
buf[1] = self.unique_id;
|
buf[1] = self.unique_id;
|
||||||
|
@ -89,7 +89,7 @@ use crate::tmtc::{ReceivesCcsdsTc, ReceivesTcCore};
|
|||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use core::fmt::{Display, Formatter};
|
use core::fmt::{Display, Formatter};
|
||||||
use downcast_rs::Downcast;
|
use downcast_rs::Downcast;
|
||||||
use spacepackets::{ByteConversionError, CcsdsPacket, SizeMissmatch, SpHeader};
|
use spacepackets::{ByteConversionError, CcsdsPacket, SpHeader};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
@ -174,10 +174,10 @@ impl<E: 'static> ReceivesTcCore for CcsdsDistributor<E> {
|
|||||||
fn pass_tc(&mut self, tc_raw: &[u8]) -> Result<(), Self::Error> {
|
fn pass_tc(&mut self, tc_raw: &[u8]) -> Result<(), Self::Error> {
|
||||||
if tc_raw.len() < 7 {
|
if tc_raw.len() < 7 {
|
||||||
return Err(CcsdsError::ByteConversionError(
|
return Err(CcsdsError::ByteConversionError(
|
||||||
ByteConversionError::FromSliceTooSmall(SizeMissmatch {
|
ByteConversionError::FromSliceTooSmall {
|
||||||
found: tc_raw.len(),
|
found: tc_raw.len(),
|
||||||
expected: 7,
|
expected: 7,
|
||||||
}),
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let (sp_header, _) =
|
let (sp_header, _) =
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
//! [ReceivesTcCore] trait which allows to pass raw packets, CCSDS packets and PUS TC packets into
|
//! [ReceivesTcCore] trait which allows to pass raw packets, CCSDS packets and PUS TC packets into
|
||||||
//! it. Upon receiving a packet, it performs the following steps:
|
//! it. Upon receiving a packet, it performs the following steps:
|
||||||
//!
|
//!
|
||||||
//! 1. It tries to extract the [SpHeader] and [PusTc] objects from the raw bytestream. If this
|
//! 1. It tries to extract the [SpHeader] and [spacepackets::ecss::tc::PusTcReader] objects from
|
||||||
//! process fails, a [PusDistribError::PusError] is returned to the user.
|
//! the raw bytestream. If this process fails, a [PusDistribError::PusError] is returned to the
|
||||||
|
//! user.
|
||||||
//! 2. If it was possible to extract both components, the packet will be passed to the
|
//! 2. If it was possible to extract both components, the packet will be passed to the
|
||||||
//! [PusServiceProvider::handle_pus_tc_packet] method provided by the user.
|
//! [PusServiceProvider::handle_pus_tc_packet] method provided by the user.
|
||||||
//!
|
//!
|
||||||
|
@ -4,6 +4,8 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||||
default-run = "satrs-example"
|
default-run = "satrs-example"
|
||||||
|
homepage = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
|
||||||
|
repository = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fern = "0.6"
|
fern = "0.6"
|
||||||
@ -13,7 +15,7 @@ crossbeam-channel = "0.5"
|
|||||||
delegate = "0.10"
|
delegate = "0.10"
|
||||||
zerocopy = "0.6"
|
zerocopy = "0.6"
|
||||||
csv = "1"
|
csv = "1"
|
||||||
num_enum = "0.6"
|
num_enum = "0.7"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
embedded-can = "0.4"
|
embedded-can = "0.4"
|
||||||
#socketcan = "2.0"
|
#socketcan = "2.0"
|
||||||
@ -22,8 +24,10 @@ num-traits = "0.2"
|
|||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
|
|
||||||
[dependencies.satrs-core]
|
[dependencies.satrs-core]
|
||||||
|
# version = "0.1.0-alpha.0"
|
||||||
path = "../satrs-core"
|
path = "../satrs-core"
|
||||||
|
|
||||||
|
|
||||||
[dependencies.satrs-mib]
|
[dependencies.satrs-mib]
|
||||||
path = "../satrs-mib"
|
path = "../satrs-mib"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use derive_new::new;
|
use derive_new::new;
|
||||||
use zerocopy::AsBytes;
|
|
||||||
use satrs_example::TargetIdWithApid;
|
use satrs_example::TargetIdWithApid;
|
||||||
|
use zerocopy::AsBytes;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum AcsHkIds {
|
pub enum AcsHkIds {
|
||||||
@ -33,7 +33,11 @@ impl HkUniqueId {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn bytes_from_target_id_with_apid(&self, buf: &mut [u8], target_id: TargetIdWithApid) -> Result<(), ()> {
|
pub fn bytes_from_target_id_with_apid(
|
||||||
muellerr marked this conversation as resolved
Outdated
|
|||||||
|
&self,
|
||||||
|
buf: &mut [u8],
|
||||||
|
target_id: TargetIdWithApid,
|
||||||
|
) -> Result<(), ()> {
|
||||||
self.bytes_from_target_id(buf, target_id.target)
|
self.bytes_from_target_id(buf, target_id.target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
use delegate::delegate;
|
|
||||||
use derive_new::new;
|
use derive_new::new;
|
||||||
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||||
use satrs_core::events::{EventU32TypedSev, SeverityInfo};
|
use satrs_core::events::{EventU32TypedSev, SeverityInfo};
|
||||||
use satrs_core::objects::ObjectId;
|
use satrs_core::objects::ObjectId;
|
||||||
use satrs_core::spacepackets::ecss::tc::{GenericPusTcSecondaryHeader, IsPusTelecommand, PusTc};
|
use satrs_core::spacepackets::ecss::tc::IsPusTelecommand;
|
||||||
use satrs_core::spacepackets::ecss::PusPacket;
|
use satrs_core::spacepackets::ecss::PusPacket;
|
||||||
use satrs_core::spacepackets::{ByteConversionError, CcsdsPacket, SizeMissmatch};
|
use satrs_core::spacepackets::{ByteConversionError, CcsdsPacket};
|
||||||
use satrs_core::tmtc::TargetId;
|
use satrs_core::tmtc::TargetId;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::net::Ipv4Addr;
|
use std::net::Ipv4Addr;
|
||||||
@ -13,9 +12,6 @@ use thiserror::Error;
|
|||||||
|
|
||||||
use satrs_mib::res_code::{ResultU16, ResultU16Info};
|
use satrs_mib::res_code::{ResultU16, ResultU16Info};
|
||||||
use satrs_mib::resultcode;
|
use satrs_mib::resultcode;
|
||||||
|
|
||||||
//pub mod can;
|
|
||||||
//mod can_ids;
|
|
||||||
mod logger;
|
mod logger;
|
||||||
|
|
||||||
pub type Apid = u16;
|
pub type Apid = u16;
|
||||||
@ -55,13 +51,12 @@ impl TargetIdWithApid {
|
|||||||
tc: &(impl CcsdsPacket + PusPacket + IsPusTelecommand),
|
tc: &(impl CcsdsPacket + PusPacket + IsPusTelecommand),
|
||||||
) -> Result<Self, TargetIdCreationError> {
|
) -> Result<Self, TargetIdCreationError> {
|
||||||
if tc.user_data().len() < 4 {
|
if tc.user_data().len() < 4 {
|
||||||
return Err(ByteConversionError::FromSliceTooSmall(SizeMissmatch {
|
return Err(ByteConversionError::FromSliceTooSmall {
|
||||||
found: tc.user_data().len(),
|
found: tc.user_data().len(),
|
||||||
expected: 8,
|
expected: 8,
|
||||||
})
|
}
|
||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
let target_id = u32::from_be_bytes(tc.user_data()[0..4].try_into().unwrap());
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
apid: tc.apid(),
|
apid: tc.apid(),
|
||||||
target: u32::from_be_bytes(tc.user_data()[0..4].try_into().unwrap()),
|
target: u32::from_be_bytes(tc.user_data()[0..4].try_into().unwrap()),
|
||||||
|
@ -419,7 +419,9 @@ fn main() {
|
|||||||
let mut buf: [u8; 8] = [0; 8];
|
let mut buf: [u8; 8] = [0; 8];
|
||||||
|
|
||||||
let hk_id = HkUniqueId::new(1);
|
let hk_id = HkUniqueId::new(1);
|
||||||
hk_id.bytes_from_target_id_with_apid(&mut buf, target).unwrap();
|
hk_id
|
||||||
|
.bytes_from_target_id_with_apid(&mut buf, target)
|
||||||
|
.unwrap();
|
||||||
let pus_tm = PusTmCreator::new(
|
let pus_tm = PusTmCreator::new(
|
||||||
&mut sp_header,
|
&mut sp_header,
|
||||||
sec_header,
|
sec_header,
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "satrs-mib"
|
name = "satrs-mib"
|
||||||
version = "0.1.0"
|
version = "0.1.0-alpha.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
rust-version = "1.61"
|
||||||
|
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||||
|
description = """
|
||||||
|
Helper crate of the sat-rs framework to build a mission information base (MIB) from the
|
||||||
|
On-Board Software (OBSW) code directly."""
|
||||||
|
homepage = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
|
||||||
|
repository = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
keywords = ["no-std", "space", "aerospace"]
|
||||||
|
categories = ["aerospace", "aerospace::space-protocols", "no-std", "hardware-support", "embedded"]
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@ -13,10 +23,12 @@ version = "1"
|
|||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dependencies.satrs-core]
|
[dependencies.satrs-core]
|
||||||
path = "../satrs-core"
|
version = "0.1.0-alpha.0"
|
||||||
|
# path = "../satrs-core"
|
||||||
|
|
||||||
[dependencies.satrs-mib-codegen]
|
[dependencies.satrs-mib-codegen]
|
||||||
path = "codegen"
|
path = "codegen"
|
||||||
|
version = "0.1.0-alpha.0"
|
||||||
|
|
||||||
[dependencies.serde]
|
[dependencies.serde]
|
||||||
version = "1"
|
version = "1"
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "satrs-mib-codegen"
|
name = "satrs-mib-codegen"
|
||||||
version = "0.1.0"
|
version = "0.1.0-alpha.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
description = "satrs-mib proc macro implementation"
|
||||||
|
homepage = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
|
||||||
|
repository = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
[lib]
|
[lib]
|
||||||
@ -16,7 +20,8 @@ quote = "1"
|
|||||||
proc-macro2 = "1"
|
proc-macro2 = "1"
|
||||||
|
|
||||||
[dependencies.satrs-core]
|
[dependencies.satrs-core]
|
||||||
path = "../../satrs-core"
|
version = "0.1.0-alpha.0"
|
||||||
|
# path = "../../satrs-core"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
trybuild = { version = "1", features = ["diff"] }
|
trybuild = { version = "1", features = ["diff"] }
|
||||||
|
1
satrs-mib/codegen/LICENSE-APACHE
Symbolic link
1
satrs-mib/codegen/LICENSE-APACHE
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../LICENSE-APACHE
|
1
satrs-mib/codegen/NOTICE
Symbolic link
1
satrs-mib/codegen/NOTICE
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../NOTICE
|
25
satrs-mib/release-checklist.md
Normal file
25
satrs-mib/release-checklist.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
Checklist for new releases
|
||||||
|
=======
|
||||||
|
|
||||||
|
# Pre-Release
|
||||||
|
|
||||||
|
1. Make sure any new modules are documented sufficiently enough and check docs with
|
||||||
|
`cargo doc --all-features --open`.
|
||||||
|
2. Bump version specifier in `Cargo.toml`.
|
||||||
|
3. Update `CHANGELOG.md`: Convert `unreleased` section into version section with date and add new
|
||||||
|
`unreleased` section.
|
||||||
|
4. Run `cargo test --all-features`.
|
||||||
|
5. Run `cargo fmt` and `cargo clippy`. Check `cargo msrv` against MSRV in `Cargo.toml`.
|
||||||
|
6. Wait for CI/CD results for EGit and Github. These also check cross-compilation for bare-metal
|
||||||
|
targets.
|
||||||
|
|
||||||
|
# Release
|
||||||
|
|
||||||
|
1. `cargo publish`
|
||||||
|
|
||||||
|
# Post-Release
|
||||||
|
|
||||||
|
1. Create a new annotaged tag and push it with `git tag -a satrs-mib-<version>` and
|
||||||
|
`git push -u origin satrs-mib-<version>`
|
||||||
|
2. Create a new release on `EGit` based on the tag.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user
I'd create a constructor which constructs this type from a
TargetIdWithApid
and the unique ID (u32
)