1 #ifndef H_EXTENSIONS_CUTEHMI_MODBUS_2_INCLUDE_CUTEHMI_MODBUS_INTERNAL_RTUSERVERCONFIG_HPP
2 #define H_EXTENSIONS_CUTEHMI_MODBUS_2_INCLUDE_CUTEHMI_MODBUS_INTERNAL_RTUSERVERCONFIG_HPP
8 #include <QReadWriteLock>
9 #include <QtSerialPort>
23 static constexpr
int MIN_SLAVE_ADDRESS = 1;
24 static constexpr
int MAX_SLAVE_ADDRESS = 247;
26 static constexpr QSerialPort::Parity INITIAL_PARITY = QSerialPort::NoParity;
27 static constexpr QSerialPort::BaudRate INITIAL_BAUD_RATE = QSerialPort::Baud19200;
28 static constexpr QSerialPort::DataBits INITIAL_DATA_BITS = QSerialPort::Data8;
29 static constexpr QSerialPort::StopBits INITIAL_STOP_BITS = QSerialPort::OneStop;
30 static constexpr
int INITIAL_SLAVE_ADDRESS = MIN_SLAVE_ADDRESS;
31 static constexpr
int INITIAL_COILS_ADDRESS_RANGE_MIN = 0;
32 static constexpr
int INITIAL_COILS_ADDRESS_RANGE_MAX = 65535;
33 static constexpr
int INITIAL_DISCRETE_INPUTS_ADDRESS_RANGE_MIN = 0;
34 static constexpr
int INITIAL_DISCRETE_INPUTS_ADDRESS_RANGE_MAX = 65535;
35 static constexpr
int INITIAL_HOLDING_REGISTERS_ADDRESS_RANGE_MIN = 0;
36 static constexpr
int INITIAL_HOLDING_REGISTERS_ADDRESS_RANGE_MAX = 65535;
37 static constexpr
int INITIAL_INPUT_REGISTERS_ADDRESS_RANGE_MIN = 0;
38 static constexpr
int INITIAL_INPUT_REGISTERS_ADDRESS_RANGE_MAX = 65535;
44 void setPort(
const QString & port);
46 QSerialPort::Parity parity()
const;
48 void setParity(QSerialPort::Parity parity);
50 QSerialPort::BaudRate baudRate()
const;
52 void setBaudRate(QSerialPort::BaudRate baudRate);
54 QSerialPort::DataBits dataBits()
const;
56 void setDataBits(QSerialPort::DataBits dataBits);
58 QSerialPort::StopBits stopBits()
const;
60 void setStopBits(QSerialPort::StopBits stopBits);
62 int slaveAddress()
const;
64 void setSlaveAddress(
int address);
72 void setInputRegistersAddressRange(
AddressRange addressRange);
76 void setDiscreteInputsAddressRange(
AddressRange addressRange);
80 void setHoldingRegistersAddressRange(
AddressRange addressRange);
86 QSerialPort::Parity parity = INITIAL_PARITY;
87 QSerialPort::BaudRate baudRate = INITIAL_BAUD_RATE;
88 QSerialPort::DataBits dataBits = INITIAL_DATA_BITS;
89 QSerialPort::StopBits stopBits = INITIAL_STOP_BITS;
90 int slaveAddress = INITIAL_SLAVE_ADDRESS;
92 AddressRange discreteInputsAddressRange =
AddressRange(INITIAL_DISCRETE_INPUTS_ADDRESS_RANGE_MIN, INITIAL_DISCRETE_INPUTS_ADDRESS_RANGE_MAX);
93 AddressRange holdingRegistersAddressRange =
AddressRange(INITIAL_HOLDING_REGISTERS_ADDRESS_RANGE_MIN, INITIAL_HOLDING_REGISTERS_ADDRESS_RANGE_MAX);
94 AddressRange inputRegistersAddressRange =
AddressRange(INITIAL_INPUT_REGISTERS_ADDRESS_RANGE_MIN, INITIAL_INPUT_REGISTERS_ADDRESS_RANGE_MAX);