Digitalisierte Elektroverteilung zur permanenten Verbraucherüberwachung
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ModbusTcp.cpp 528B

3 years ago
12345678910111213141516171819202122232425
  1. #include "ModbusTcp.h"
  2. ModbusTCP::ModbusTCP(const u_int id, const std::string _ip, const unsigned int _port)
  3. : ModbusInterface(id, _ip), port(std::to_string(_port))
  4. {
  5. }
  6. ModbusTCP::~ModbusTCP()
  7. {
  8. //if(my_slave != nullptr){
  9. // delete my_slave;
  10. //}
  11. //if(my_modbus != nullptr){
  12. // my_modbus->close();
  13. // delete my_modbus;
  14. //}
  15. }
  16. void ModbusTCP::modbus_init() {
  17. if (my_modbus == nullptr){
  18. my_modbus = new Modbus::Master(Modbus::Tcp, device, port);
  19. assignSlave();
  20. }
  21. }