continue test verification handler
This commit is contained in:
parent
d7be5224f1
commit
5d51d40371
@ -18,7 +18,8 @@ default-features = false
|
||||
optional = true
|
||||
|
||||
[dependencies.spacepackets]
|
||||
version = "0.9"
|
||||
version = "0.10"
|
||||
git = "https://github.com/us-irs/spacepackets-rs.git"
|
||||
default-features = false
|
||||
|
||||
[features]
|
||||
|
@ -52,6 +52,10 @@ impl UnsignedEnum for ResultU16 {
|
||||
buf[1] = self.unique_id;
|
||||
Ok(self.size())
|
||||
}
|
||||
|
||||
fn value(&self) -> u64 {
|
||||
self.raw() as u64
|
||||
}
|
||||
}
|
||||
|
||||
impl EcssEnumeration for ResultU16 {
|
||||
|
@ -17,7 +17,10 @@ delegate = ">0.7, <=0.10"
|
||||
paste = "1"
|
||||
smallvec = "1"
|
||||
crc = "3"
|
||||
satrs-shared = "0.1.1"
|
||||
|
||||
[dependencies.satrs-shared]
|
||||
# version = "0.1.1"
|
||||
path = "../satrs-shared"
|
||||
|
||||
[dependencies.num_enum]
|
||||
version = ">0.5, <=0.7"
|
||||
@ -68,7 +71,8 @@ features = ["all"]
|
||||
optional = true
|
||||
|
||||
[dependencies.spacepackets]
|
||||
version = "0.9"
|
||||
version = "0.10"
|
||||
git = "https://github.com/us-irs/spacepackets-rs.git"
|
||||
default-features = false
|
||||
|
||||
[dependencies.cobs]
|
||||
|
@ -23,7 +23,7 @@ use spacepackets::{
|
||||
tlv::{msg_to_user::MsgToUserTlv, EntityIdTlv, GenericTlv, TlvType},
|
||||
ChecksumType, ConditionCode, FaultHandlerCode, PduType, TransmissionMode,
|
||||
},
|
||||
util::UnsignedByteField,
|
||||
util::{UnsignedByteField, UnsignedEnum},
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
|
@ -9,7 +9,7 @@ use spacepackets::{
|
||||
pdu::{FileDirectiveType, PduError, PduHeader},
|
||||
ChecksumType, ConditionCode, FaultHandlerCode, PduType, TransmissionMode,
|
||||
},
|
||||
util::UnsignedByteField,
|
||||
util::{UnsignedByteField, UnsignedEnum},
|
||||
};
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
|
@ -412,6 +412,10 @@ impl UnsignedEnum for EventU32 {
|
||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
||||
self.base.write_to_bytes(self.raw(), buf, self.size())
|
||||
}
|
||||
|
||||
fn value(&self) -> u64 {
|
||||
self.raw().into()
|
||||
}
|
||||
}
|
||||
|
||||
impl EcssEnumeration for EventU32 {
|
||||
@ -425,6 +429,7 @@ impl<SEVERITY: HasSeverity> UnsignedEnum for EventU32TypedSev<SEVERITY> {
|
||||
delegate!(to self.event {
|
||||
fn size(&self) -> usize;
|
||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError>;
|
||||
fn value(&self) -> u64;
|
||||
});
|
||||
}
|
||||
|
||||
@ -560,6 +565,10 @@ impl UnsignedEnum for EventU16 {
|
||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError> {
|
||||
self.base.write_to_bytes(self.raw(), buf, self.size())
|
||||
}
|
||||
|
||||
fn value(&self) -> u64 {
|
||||
self.raw().into()
|
||||
}
|
||||
}
|
||||
impl EcssEnumeration for EventU16 {
|
||||
#[inline]
|
||||
@ -573,6 +582,7 @@ impl<SEVERITY: HasSeverity> UnsignedEnum for EventU16TypedSev<SEVERITY> {
|
||||
delegate!(to self.event {
|
||||
fn size(&self) -> usize;
|
||||
fn write_to_be_bytes(&self, buf: &mut [u8]) -> Result<usize, ByteConversionError>;
|
||||
fn value(&self) -> u64;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1430,11 +1430,11 @@ pub mod tests {
|
||||
pub struct VerificationStatus {
|
||||
pub accepted: Option<bool>,
|
||||
pub started: Option<bool>,
|
||||
pub step: u32,
|
||||
pub step: u64,
|
||||
pub step_status: Option<bool>,
|
||||
pub completed: Option<bool>,
|
||||
pub failure_data: Option<Vec<u8>>,
|
||||
pub fail_enum: Option<Vec<u8>>,
|
||||
pub fail_enum: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
@ -1495,8 +1495,7 @@ pub mod tests {
|
||||
Some(entry) => {
|
||||
entry.accepted = Some(false);
|
||||
entry.failure_data = params.failure_data.map(|v| v.to_vec());
|
||||
// TODO: Enable this after the spacepackets update.
|
||||
// entry.fail_enum= params.failure_code.to_vec();
|
||||
entry.fail_enum = Some(params.failure_code.value());
|
||||
}
|
||||
None => panic!(
|
||||
"unexpected acceptance failure for request ID {}",
|
||||
@ -1535,8 +1534,7 @@ pub mod tests {
|
||||
Some(entry) => {
|
||||
entry.started = Some(false);
|
||||
entry.failure_data = params.failure_data.map(|v| v.to_vec());
|
||||
// TODO: Enable this after the spacepackets update.
|
||||
// entry.fail_enum= params.failure_code.to_vec();
|
||||
entry.fail_enum = Some(params.failure_code.value());
|
||||
}
|
||||
None => panic!("unexpected start failure for request ID {}", token.req_id()),
|
||||
};
|
||||
@ -1547,13 +1545,12 @@ pub mod tests {
|
||||
&self,
|
||||
token: &VerificationToken<super::TcStateStarted>,
|
||||
_time_stamp: Option<&[u8]>,
|
||||
_step: impl spacepackets::ecss::EcssEnumeration,
|
||||
step: impl spacepackets::ecss::EcssEnumeration,
|
||||
) -> Result<(), EcssTmtcError> {
|
||||
let verif_map = self.verification_map.lock().unwrap();
|
||||
match verif_map.borrow_mut().get_mut(&token.req_id) {
|
||||
Some(entry) => {
|
||||
// TODO: Enable this after the spacepackets update.
|
||||
// entry.step = Some(step.value()),
|
||||
entry.step = step.value();
|
||||
entry.step_status = Some(true);
|
||||
}
|
||||
None => panic!("unexpected start success for request ID {}", token.req_id()),
|
||||
@ -1569,8 +1566,6 @@ pub mod tests {
|
||||
let verif_map = self.verification_map.lock().unwrap();
|
||||
match verif_map.borrow_mut().get_mut(&token.req_id) {
|
||||
Some(entry) => {
|
||||
// TODO: Enable this after the spacepackets update.
|
||||
// entry.step = Some(step.value()),
|
||||
entry.step_status = Some(false);
|
||||
}
|
||||
None => panic!("unexpected start success for request ID {}", token.req_id()),
|
||||
@ -1604,8 +1599,7 @@ pub mod tests {
|
||||
Some(entry) => {
|
||||
entry.completed = Some(false);
|
||||
entry.failure_data = params.failure_data.map(|v| v.to_vec());
|
||||
// TODO: Enable this after the spacepackets update.
|
||||
// entry.fail_enum= params.failure_code.to_vec();
|
||||
entry.fail_enum = Some(params.failure_code.value());
|
||||
}
|
||||
None => panic!(
|
||||
"unexpected acceptance success for request ID {}",
|
||||
|
Loading…
Reference in New Issue
Block a user