#ifndef MODBUS_RTU_PRIVATE_H
#define MODBUS_RTU_PRIVATE_H
#ifndef _MSC_VER
#include <stdint.h>
#else
#include "stdint.h"
#endif
#if defined(_WIN32)
#include <windows.h>
#else
#include <termios.h>
#endif
#define _MODBUS_RTU_HEADER_LENGTH 1
#define _MODBUS_RTU_PRESET_REQ_LENGTH 6
#define _MODBUS_RTU_PRESET_RSP_LENGTH 2
#define _MODBUS_RTU_CHECKSUM_LENGTH 2
#if defined(_WIN32)
#if !defined(ENOTSUP)
#define ENOTSUP WSAEOPNOTSUPP
#endif
#define PY_BUF_SIZE 512
struct win32_ser {
HANDLE fd;
uint8_t buf[PY_BUF_SIZE];
DWORD n_bytes;
};
#endif
typedef struct _modbus_rtu {
char *device;
int baud;
uint8_t data_bit;
uint8_t stop_bit;
char parity;
#if defined(_WIN32)
struct win32_ser w_ser;
DCB old_dcb;
#else
struct termios old_tios;
#endif
#if HAVE_DECL_TIOCSRS485
int serial_mode;
#endif
#if HAVE_DECL_TIOCM_RTS
int rts;
int rts_delay;
int onebyte_time;
void (*set_rts) (modbus_t *ctx, int on);
#endif
int confirmation_to_ignore;
} modbus_rtu_t;
#endif