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:
4 files changed
+68
-7
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user