Blame view

3rdparty/libmodbus/modbus-rtu-private.h 1.66 KB
5735b406   Peter M. Groen   Revert "Setting u...
1
2
3
4
5
  /*
   * Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@gmail.com>
   *
   * SPDX-License-Identifier: LGPL-2.1+
   */
500c015a   Peter M. Groen   Setting up workin...
6
  
5735b406   Peter M. Groen   Revert "Setting u...
7
8
  #ifndef MODBUS_RTU_PRIVATE_H
  #define MODBUS_RTU_PRIVATE_H
500c015a   Peter M. Groen   Setting up workin...
9
  
5735b406   Peter M. Groen   Revert "Setting u...
10
  #ifndef _MSC_VER
500c015a   Peter M. Groen   Setting up workin...
11
  #include <stdint.h>
5735b406   Peter M. Groen   Revert "Setting u...
12
13
14
15
16
17
18
  #else
  #include "stdint.h"
  #endif
  
  #if defined(_WIN32)
  #include <windows.h>
  #else
500c015a   Peter M. Groen   Setting up workin...
19
  #include <termios.h>
5735b406   Peter M. Groen   Revert "Setting u...
20
  #endif
500c015a   Peter M. Groen   Setting up workin...
21
22
23
24
25
26
27
  
  #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
  
5735b406   Peter M. Groen   Revert "Setting u...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  #if defined(_WIN32)
  #if !defined(ENOTSUP)
  #define ENOTSUP WSAEOPNOTSUPP
  #endif
  
  /* WIN32: struct containing serial handle and a receive buffer */
  #define PY_BUF_SIZE 512
  struct win32_ser {
      /* File handle */
      HANDLE fd;
      /* Receive buffer */
      uint8_t buf[PY_BUF_SIZE];
      /* Received chars */
      DWORD n_bytes;
  };
  #endif /* _WIN32 */
  
  typedef struct _modbus_rtu {
500c015a   Peter M. Groen   Setting up workin...
46
47
48
49
50
51
52
53
54
55
      /* Device: "/dev/ttyS0", "/dev/ttyUSB0" or "/dev/tty.USA19*" on Mac OS X. */
      char *device;
      /* Bauds: 9600, 19200, 57600, 115200, etc */
      int baud;
      /* Data bit */
      uint8_t data_bit;
      /* Stop bit */
      uint8_t stop_bit;
      /* Parity: 'N', 'O', 'E' */
      char parity;
5735b406   Peter M. Groen   Revert "Setting u...
56
57
58
59
  #if defined(_WIN32)
      struct win32_ser w_ser;
      DCB old_dcb;
  #else
500c015a   Peter M. Groen   Setting up workin...
60
61
      /* Save old termios settings */
      struct termios old_tios;
5735b406   Peter M. Groen   Revert "Setting u...
62
  #endif
500c015a   Peter M. Groen   Setting up workin...
63
64
65
  #if HAVE_DECL_TIOCSRS485
      int serial_mode;
  #endif
5735b406   Peter M. Groen   Revert "Setting u...
66
67
68
69
70
71
72
  //***Not part of libmodbus - added for QModMaster***//
  #if defined(_WIN32) || HAVE_DECL_TIOCM_RTS
      int rts;
      int rts_delay;
      int onebyte_time;
      void (*set_rts) (modbus_t *ctx, int on);
  #endif
500c015a   Peter M. Groen   Setting up workin...
73
74
75
      /* To handle many slaves on the same link */
      int confirmation_to_ignore;
  } modbus_rtu_t;
5735b406   Peter M. Groen   Revert "Setting u...
76
77
  
  #endif /* MODBUS_RTU_PRIVATE_H */