modbus_core/frame/
rtu.rs

1// SPDX-FileCopyrightText: Copyright (c) 2018-2025 slowtec GmbH <post@slowtec.de>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4use super::*;
5
6/// Slave ID
7pub type SlaveId = u8;
8
9/// RTU header
10#[cfg_attr(all(feature = "defmt", target_os = "none"), derive(defmt::Format))]
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub struct Header {
13    pub slave: SlaveId,
14}
15
16/// RTU Request ADU
17#[cfg_attr(all(feature = "defmt", target_os = "none"), derive(defmt::Format))]
18#[derive(Debug, Clone, Copy, PartialEq, Eq)]
19pub struct RequestAdu<'r> {
20    pub hdr: Header,
21    pub pdu: RequestPdu<'r>,
22}
23
24/// RTU Response ADU
25#[cfg_attr(all(feature = "defmt", target_os = "none"), derive(defmt::Format))]
26#[derive(Debug, Clone, Copy, PartialEq, Eq)]
27pub struct ResponseAdu<'r> {
28    pub hdr: Header,
29    pub pdu: ResponsePdu<'r>,
30}