Added examples and better error reporting

+ The field that errors is now reported
+ The formats/ dir contains all predefined formats
  + Includes CCSDS packet for now
+ There appears to be an issue with bit formatting, the APID field is not being parsed correctly (upper 8 bits is not being factored in
This commit is contained in:
joeyahines committed 2021-10-09 10:57:34 -06:00
1 parent 4e9f4bff1d
commit 6daf3a55f2
4 files changed
+68 -7

No files matched your search

+2 -2
View File
@@ -8,7 +8,7 @@ pub enum ByteStreamError {
impl Display for ByteStreamError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
ByteStreamError::OutOfRange => write!(f, "Request values out of range")
ByteStreamError::OutOfRange => write!(f, "Requested values out of range")
}
}
}
@@ -44,7 +44,7 @@ impl ByteStream {
byte_count
};
if bytes_needed > self.data.len() || bytes_needed + byte_ndx > self.data.len() {
if bytes_needed > self.data.len() || (bytes_needed + byte_ndx) > self.data.len() {
return Err(ByteStreamError::OutOfRange);
}