2 * Copyright © Stéphane Raimbault <stephane.raimbault@gmail.com>
4 * SPDX-License-Identifier: LGPL-2.1-or-later
7 #ifndef MODBUS_RTU_PRIVATE_H
8 #define MODBUS_RTU_PRIVATE_H
22 #define _MODBUS_RTU_HEADER_LENGTH 1
23 #define _MODBUS_RTU_PRESET_REQ_LENGTH 6
24 #define _MODBUS_RTU_PRESET_RSP_LENGTH 2
26 #define _MODBUS_RTU_CHECKSUM_LENGTH 2
30 #define ENOTSUP WSAEOPNOTSUPP
33 /* WIN32: struct containing serial handle and a receive buffer */
34 #define PY_BUF_SIZE 512
40 uint8_t buf
[PY_BUF_SIZE
];
46 typedef struct _modbus_rtu
{
47 /* Device: "/dev/ttyS0", "/dev/ttyUSB0" or "/dev/tty.USA19*" on Mac OS X. */
49 /* Bauds: 9600, 19200, 57600, 115200, etc */
55 /* Parity: 'N', 'O', 'E' */
58 struct win32_ser w_ser
;
61 /* Save old termios settings */
62 struct termios old_tios
;
64 #if HAVE_DECL_TIOCSRS485
67 #if HAVE_DECL_TIOCM_RTS
71 void (*set_rts
)(modbus_t
*ctx
, int on
);
73 /* To handle many slaves on the same link */
74 int confirmation_to_ignore
;
77 #endif /* MODBUS_RTU_PRIVATE_H */