CuteHMI - Modbus (CuteHMI.Modbus.2)
QtTCPServer.hpp
1 #ifndef H_EXTENSIONS_CUTEHMI_MODBUS_2_INCLUDE_CUTEHMI_MODBUS_INTERNAL_QTTCPSERVER_HPP
2 #define H_EXTENSIONS_CUTEHMI_MODBUS_2_INCLUDE_CUTEHMI_MODBUS_INTERNAL_QTTCPSERVER_HPP
3 
4 #include "common.hpp"
5 #include "RegisterTraits.hpp"
6 #include "QtServerMixin.hpp"
7 
8 #include <QModbusTcpServer>
9 
10 namespace cutehmi {
11 namespace modbus {
12 namespace internal {
13 
17 class CUTEHMI_MODBUS_PRIVATE QtTCPServer:
18  public QModbusTcpServer,
19  protected QtServerMixin<QtTCPServer>
20 {
21  Q_OBJECT
22 
23  friend class QtServerMixin<QtTCPServer>;
25 
26  public:
31 
32  QtTCPServer(CoilDataContainer * coilData,
33  DiscreteInputDataContainer * discreteInputData,
34  HoldingRegisterDataContainer * holdingRegisterData,
35  InputRegisterDataContainer * inputRegisterData,
36  QObject * parent = nullptr);
37 
38  bool setMap(const QModbusDataUnitMap & map) override;
39 
40  protected:
41  bool readData(QModbusDataUnit * newData) const override;
42 
43  bool writeData(const QModbusDataUnit & newData) override;
44 
45  private:
46  struct Members {
47  CoilDataContainer * coilData;
48  DiscreteInputDataContainer * discreteInputData;
49  HoldingRegisterDataContainer * holdingRegisterData;
50  InputRegisterDataContainer * inputRegisterData;
51  };
52 
53  MPtr<Members> m;
54 };
55 
56 }
57 }
58 }
59 
60 #endif
61 
62 //(c)C: Copyright © 2019, Michał Policht <michal@policht.pl>. All rights reserved.
63 //(c)C: This file is a part of CuteHMI.
64 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
65 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
66 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
cutehmi::modbus::internal::RegisterTraits
Definition: RegisterTraits.hpp:15
cutehmi::modbus::internal::QtTCPServer::HoldingRegisterDataContainer
RegisterTraits< HoldingRegister >::Container HoldingRegisterDataContainer
Definition: QtTCPServer.hpp:29
cutehmi::modbus::internal::QtServerMixin
Definition: QtServerMixin.hpp:15
cutehmi::MPtr< Members >
cutehmi::modbus::internal::QtTCPServer::CoilDataContainer
RegisterTraits< Coil >::Container CoilDataContainer
Definition: QtTCPServer.hpp:27
QObject
cutehmi
cutehmi::modbus::internal::QtTCPServer
Qt SerialBus based TCP server.
Definition: QtTCPServer.hpp:17
QModbusDataUnit
cutehmi::modbus::internal::QtTCPServer::InputRegisterDataContainer
RegisterTraits< InputRegister >::Container InputRegisterDataContainer
Definition: QtTCPServer.hpp:30
std::internal
T internal(T... args)
QModbusTcpServer
cutehmi::modbus::internal::QtTCPServer::DiscreteInputDataContainer
RegisterTraits< DiscreteInput >::Container DiscreteInputDataContainer
Definition: QtTCPServer.hpp:28