interpret yes, parse no
This commit is contained in:
1 parent
3586e6006b
commit
fe484f3003
2 files changed
+6
-6
No files matched your search
+1
-1
@@ -47,5 +47,5 @@ pub trait DeviceHandler: Debug {
|
||||
) -> Result<Option<Self::Telemetry>>;
|
||||
|
||||
/// Device sent a reply in a mode where no replies are expected: handle it
|
||||
fn parse_unrequested_device_reply(&mut self, device_reply: &[u8]) -> Result<Self::Telemetry>;
|
||||
fn interpret_unrequested_device_reply(&mut self, device_reply: &[u8]) -> Result<Self::Telemetry>;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ impl DemoHandler {
|
||||
|
||||
/// This fn is stateless and as such not implemented as a member fn
|
||||
/// This is needed during parsing, to avoid borrow fails
|
||||
fn parse_device_reply(
|
||||
fn interpret_device_reply(
|
||||
reply: &[u8],
|
||||
) -> crate::device::Result<<DemoHandler as DeviceHandler>::Telemetry> {
|
||||
log::warn!("{:?}", reply);
|
||||
@@ -96,7 +96,7 @@ impl DemoHandler {
|
||||
};
|
||||
|
||||
// our protocol is simple
|
||||
// none simple protocols would be parsed here
|
||||
// none simple protocols would be interpreted here
|
||||
// we only extract the first data byte
|
||||
|
||||
let data = reply[1];
|
||||
@@ -188,7 +188,7 @@ impl DeviceHandler for DemoHandler {
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
|
||||
let reply = interface.read(&mut self.io_buffer)?;
|
||||
let tm = Self::parse_device_reply(reply)?;
|
||||
let tm = Self::interpret_device_reply(reply)?;
|
||||
|
||||
// // There is only one type of telemetry, so if there is one, it is the correct one
|
||||
// let Telemetry::TheOneAndOnlyTelemetry(_) = tm else {
|
||||
@@ -212,11 +212,11 @@ impl DeviceHandler for DemoHandler {
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_unrequested_device_reply(
|
||||
fn interpret_unrequested_device_reply(
|
||||
&mut self,
|
||||
device_reply: &[u8],
|
||||
) -> crate::device::Result<Self::Telemetry> {
|
||||
Self::parse_device_reply(device_reply)
|
||||
Self::interpret_device_reply(device_reply)
|
||||
}
|
||||
|
||||
fn shutdown(
|
||||
|
||||
Reference in new issue
Block a user