From 159caf0229af2d1d04a096ad01f1b8557eea4a35 Mon Sep 17 00:00:00 2001 From: MarcoRBosco Date: Thu, 5 Dec 2024 17:06:27 +0100 Subject: [PATCH] Added ReadExceptionStatus at PDU Response (#13) --- src/codec/mod.rs | 3 +++ src/frame/mod.rs | 1 + src/lib.rs | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/codec/mod.rs b/src/codec/mod.rs index 179347c..475d427 100644 --- a/src/codec/mod.rs +++ b/src/codec/mod.rs @@ -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: diff --git a/src/frame/mod.rs b/src/frame/mod.rs index b6df4ae..985c854 100644 --- a/src/frame/mod.rs +++ b/src/frame/mod.rs @@ -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 } diff --git a/src/lib.rs b/src/lib.rs index 7548311..1f2abd6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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::*; +