Update #48
@ -60,8 +60,7 @@ optional = true
|
|||||||
# version = "0.5.4"
|
# version = "0.5.4"
|
||||||
# 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 = "ec5d98a9b5ec"
|
rev = "ef4244c8cb5c"
|
||||||
|
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -405,12 +405,12 @@ try_from_impls!(SeverityMedium, Severity::MEDIUM, u32, EventU32TypedSev);
|
|||||||
try_from_impls!(SeverityHigh, Severity::HIGH, u32, EventU32TypedSev);
|
try_from_impls!(SeverityHigh, Severity::HIGH, u32, EventU32TypedSev);
|
||||||
|
|
||||||
impl UnsignedEnum for EventU32 {
|
impl UnsignedEnum for EventU32 {
|
||||||
fn len(&self) -> usize {
|
fn size(&self) -> usize {
|
||||||
core::mem::size_of::<u32>()
|
core::mem::size_of::<u32>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
||||||
self.base.write_to_bytes(self.raw(), buf, self.len())
|
self.base.write_to_bytes(self.raw(), buf, self.size())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ impl EcssEnumeration for EventU32 {
|
|||||||
//noinspection RsTraitImplementation
|
//noinspection RsTraitImplementation
|
||||||
impl<SEVERITY: HasSeverity> UnsignedEnum for EventU32TypedSev<SEVERITY> {
|
impl<SEVERITY: HasSeverity> UnsignedEnum for EventU32TypedSev<SEVERITY> {
|
||||||
delegate!(to self.event {
|
delegate!(to self.event {
|
||||||
fn len(&self) -> usize;
|
fn size(&self) -> usize;
|
||||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError>;
|
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError>;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -553,12 +553,12 @@ impl<SEVERITY: HasSeverity> EventU16TypedSev<SEVERITY> {
|
|||||||
impl_event_provider!(EventU16, EventU16TypedSev, u16, u8, u8);
|
impl_event_provider!(EventU16, EventU16TypedSev, u16, u8, u8);
|
||||||
|
|
||||||
impl UnsignedEnum for EventU16 {
|
impl UnsignedEnum for EventU16 {
|
||||||
fn len(&self) -> usize {
|
fn size(&self) -> usize {
|
||||||
core::mem::size_of::<u16>()
|
core::mem::size_of::<u16>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
||||||
self.base.write_to_bytes(self.raw(), buf, self.len())
|
self.base.write_to_bytes(self.raw(), buf, self.size())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl EcssEnumeration for EventU16 {
|
impl EcssEnumeration for EventU16 {
|
||||||
@ -571,7 +571,7 @@ impl EcssEnumeration for EventU16 {
|
|||||||
//noinspection RsTraitImplementation
|
//noinspection RsTraitImplementation
|
||||||
impl<SEVERITY: HasSeverity> UnsignedEnum for EventU16TypedSev<SEVERITY> {
|
impl<SEVERITY: HasSeverity> UnsignedEnum for EventU16TypedSev<SEVERITY> {
|
||||||
delegate!(to self.event {
|
delegate!(to self.event {
|
||||||
fn len(&self) -> usize;
|
fn size(&self) -> usize;
|
||||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError>;
|
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError>;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ macro_rules! writable_as_be_bytes_ecss_enum_impl {
|
|||||||
($EnumIdent: ident) => {
|
($EnumIdent: ident) => {
|
||||||
impl WritableToBeBytes for $EnumIdent {
|
impl WritableToBeBytes for $EnumIdent {
|
||||||
fn raw_len(&self) -> usize {
|
fn raw_len(&self) -> usize {
|
||||||
self.len()
|
self.size()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
||||||
|
@ -124,7 +124,7 @@ impl EventReporterBase {
|
|||||||
event_id: impl EcssEnumeration,
|
event_id: impl EcssEnumeration,
|
||||||
aux_data: Option<&[u8]>,
|
aux_data: Option<&[u8]>,
|
||||||
) -> Result<PusTm, EcssTmtcError> {
|
) -> Result<PusTm, EcssTmtcError> {
|
||||||
let mut src_data_len = event_id.len();
|
let mut src_data_len = event_id.size();
|
||||||
if let Some(aux_data) = aux_data {
|
if let Some(aux_data) = aux_data {
|
||||||
src_data_len += aux_data.len();
|
src_data_len += aux_data.len();
|
||||||
}
|
}
|
||||||
@ -138,8 +138,8 @@ impl EventReporterBase {
|
|||||||
Some(time_stamp),
|
Some(time_stamp),
|
||||||
);
|
);
|
||||||
let mut current_idx = 0;
|
let mut current_idx = 0;
|
||||||
event_id.write_to_be_bytes(&mut buf[0..event_id.len()])?;
|
event_id.write_to_be_bytes(&mut buf[0..event_id.size()])?;
|
||||||
current_idx += event_id.len();
|
current_idx += event_id.size();
|
||||||
if let Some(aux_data) = aux_data {
|
if let Some(aux_data) = aux_data {
|
||||||
buf[current_idx..current_idx + aux_data.len()].copy_from_slice(aux_data);
|
buf[current_idx..current_idx + aux_data.len()].copy_from_slice(aux_data);
|
||||||
current_idx += aux_data.len();
|
current_idx += aux_data.len();
|
||||||
|
@ -840,7 +840,7 @@ impl VerificationReporterCore {
|
|||||||
) -> Result<PusTm<'src_data>, EcssTmtcError> {
|
) -> Result<PusTm<'src_data>, EcssTmtcError> {
|
||||||
let mut source_data_len = size_of::<u32>();
|
let mut source_data_len = size_of::<u32>();
|
||||||
if let Some(step) = step {
|
if let Some(step) = step {
|
||||||
source_data_len += step.len();
|
source_data_len += step.size();
|
||||||
}
|
}
|
||||||
source_buffer_large_enough(src_data_buf.len(), source_data_len)?;
|
source_buffer_large_enough(src_data_buf.len(), source_data_len)?;
|
||||||
let mut idx = 0;
|
let mut idx = 0;
|
||||||
@ -848,7 +848,7 @@ impl VerificationReporterCore {
|
|||||||
idx += RequestId::SIZE_AS_BYTES;
|
idx += RequestId::SIZE_AS_BYTES;
|
||||||
if let Some(step) = step {
|
if let Some(step) = step {
|
||||||
// Size check was done beforehand
|
// Size check was done beforehand
|
||||||
step.write_to_be_bytes(&mut src_data_buf[idx..idx + step.len()])
|
step.write_to_be_bytes(&mut src_data_buf[idx..idx + step.size()])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
let mut sp_header = SpHeader::tm_unseg(self.apid(), seq_count, 0).unwrap();
|
let mut sp_header = SpHeader::tm_unseg(self.apid(), seq_count, 0).unwrap();
|
||||||
@ -875,9 +875,9 @@ impl VerificationReporterCore {
|
|||||||
params: &FailParams<'src_data, '_>,
|
params: &FailParams<'src_data, '_>,
|
||||||
) -> Result<PusTm<'src_data>, EcssTmtcError> {
|
) -> Result<PusTm<'src_data>, EcssTmtcError> {
|
||||||
let mut idx = 0;
|
let mut idx = 0;
|
||||||
let mut source_data_len = RequestId::SIZE_AS_BYTES + params.failure_code.len();
|
let mut source_data_len = RequestId::SIZE_AS_BYTES + params.failure_code.size();
|
||||||
if let Some(step) = step {
|
if let Some(step) = step {
|
||||||
source_data_len += step.len();
|
source_data_len += step.size();
|
||||||
}
|
}
|
||||||
if let Some(failure_data) = params.failure_data {
|
if let Some(failure_data) = params.failure_data {
|
||||||
source_data_len += failure_data.len();
|
source_data_len += failure_data.len();
|
||||||
@ -887,14 +887,14 @@ impl VerificationReporterCore {
|
|||||||
idx += RequestId::SIZE_AS_BYTES;
|
idx += RequestId::SIZE_AS_BYTES;
|
||||||
if let Some(step) = step {
|
if let Some(step) = step {
|
||||||
// Size check done beforehand
|
// Size check done beforehand
|
||||||
step.write_to_be_bytes(&mut src_data_buf[idx..idx + step.len()])
|
step.write_to_be_bytes(&mut src_data_buf[idx..idx + step.size()])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
idx += step.len();
|
idx += step.size();
|
||||||
}
|
}
|
||||||
params
|
params
|
||||||
.failure_code
|
.failure_code
|
||||||
.write_to_be_bytes(&mut src_data_buf[idx..idx + params.failure_code.len()])?;
|
.write_to_be_bytes(&mut src_data_buf[idx..idx + params.failure_code.size()])?;
|
||||||
idx += params.failure_code.len();
|
idx += params.failure_code.size();
|
||||||
if let Some(failure_data) = params.failure_data {
|
if let Some(failure_data) = params.failure_data {
|
||||||
src_data_buf[idx..idx + failure_data.len()].copy_from_slice(failure_data);
|
src_data_buf[idx..idx + failure_data.len()].copy_from_slice(failure_data);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ impl From<ResultU16> for EcssEnumU16 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UnsignedEnum for ResultU16 {
|
impl UnsignedEnum for ResultU16 {
|
||||||
fn len(&self) -> usize {
|
fn size(&self) -> usize {
|
||||||
core::mem::size_of::<u16>()
|
core::mem::size_of::<u16>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ impl UnsignedEnum for ResultU16 {
|
|||||||
}
|
}
|
||||||
buf[0] = self.group_id;
|
buf[0] = self.group_id;
|
||||||
buf[1] = self.unique_id;
|
buf[1] = self.unique_id;
|
||||||
Ok(self.len())
|
Ok(self.size())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user