Skip to content

Commit

Permalink
Added ReadExceptionStatus at PDU Response (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoRBosco authored Dec 5, 2024
1 parent 0870110 commit 159caf0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/codec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ impl<'r> Encode for Response<'r> {
buf[idx + 1] = *d;
}
}
Self::ReadExceptionStatus(error_code) => {
buf[1] = *error_code;
}
#[cfg(feature = "rtu")]
_ => {
// TODO:
Expand Down
1 change: 1 addition & 0 deletions src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ impl<'r> Response<'r> {
| Self::ReadHoldingRegisters(words)
| Self::ReadWriteMultipleRegisters(words) => 2 + words.len() * 2,
Self::Custom(_, data) => 1 + data.len(),
Self::ReadExceptionStatus(_) => 2,
#[cfg(feature = "rtu")]
_ => unimplemented!(), // TODO
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ mod codec;
mod error;
mod frame;

pub use codec::*;
pub use codec::rtu;
pub use codec::tcp;
pub use error::*;
pub use frame::*;

0 comments on commit 159caf0

Please sign in to comment.