/*
 * Copyright © Stéphane Raimbault <stephane.raimbault@gmail.com>
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#ifndef MODBUS_RTUOVERUDP_H
#define MODBUS_RTUOVERUDP_H

#include "modbus.h"

MODBUS_BEGIN_DECLS

/* Modbus_Application_Protocol_V1_1b.pdf Chapter 4 Section 1 Page 5
 * RS232 / RS485 ADU = 253 bytes + slave (1 byte) + CRC (2 bytes) = 256 bytes
 */
#define MODBUS_RTU_MAX_ADU_LENGTH 256

MODBUS_API modbus_t *
modbus_new_rtuoverudp(const char *ip, int port);

#define MODBUS_RTU_RS232 0
#define MODBUS_RTU_RS485 1

#define MODBUS_RTU_RTS_NONE 0
#define MODBUS_RTU_RTS_UP   1
#define MODBUS_RTU_RTS_DOWN 2

MODBUS_END_DECLS

#endif /* MODBUS_RTU_H */
