modbus_core/frame/
tcp.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
6pub type TransactionId = u16;
7pub type UnitId = u8;
8
9#[cfg_attr(all(feature = "defmt", target_os = "none"), derive(defmt::Format))]
10#[derive(Debug, Clone, Copy, PartialEq, Eq)]
11pub struct Header {
12    pub transaction_id: TransactionId,
13    pub unit_id: UnitId,
14}
15
16#[cfg_attr(all(feature = "defmt", target_os = "none"), derive(defmt::Format))]
17#[derive(Debug, Clone, Copy, PartialEq, Eq)]
18pub struct RequestAdu<'r> {
19    pub hdr: Header,
20    pub pdu: RequestPdu<'r>,
21}
22
23#[cfg_attr(all(feature = "defmt", target_os = "none"), derive(defmt::Format))]
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub struct ResponseAdu<'r> {
26    pub hdr: Header,
27    pub pdu: ResponsePdu<'r>,
28}