fennec_modbus/tcp.rs
1//! Sans-IO Modbus-over-TCP client.
2
3pub mod header;
4pub mod tokio;
5pub mod transaction;
6mod unit_id;
7
8pub use self::unit_id::UnitId;
9
10/// Modbus Application Protocol (Data Unit) header aka «MBAP header».
11#[must_use]
12#[derive(Clone)]
13pub struct Header {
14 /// Transaction ID used to match responses with requests.
15 pub transaction_id: u16,
16
17 /// Protocol ID. Always `0` for Modbus.
18 pub protocol_id: u16,
19
20 /// Number of following codec, *including the Unit Identifier and data fields*.
21 pub length: u16,
22
23 /// Unit identifier aka «slave ID».
24 ///
25 /// Identification of a remote slave connected on a serial line or on other buses.
26 pub unit_id: UnitId,
27}
28
29impl Header {
30 pub const PROTOCOL_ID: u16 = 0;
31}