|
12345678910111213141516171819202122232425 |
- #include "ModbusTcp.h"
-
- ModbusTCP::ModbusTCP(const u_int id, const std::string _ip, const unsigned int _port)
- : ModbusInterface(id, _ip), port(std::to_string(_port))
- {
-
- }
-
- ModbusTCP::~ModbusTCP()
- {
- //if(my_slave != nullptr){
- // delete my_slave;
- //}
- //if(my_modbus != nullptr){
- // my_modbus->close();
- // delete my_modbus;
- //}
- }
-
- void ModbusTCP::modbus_init() {
- if (my_modbus == nullptr){
- my_modbus = new Modbus::Master(Modbus::Tcp, device, port);
- assignSlave();
- }
- }
|