#include "SimulaterModbus.h" #include "QDebug" #include #include #include Simulatermodbus::Simulatermodbus(QObject *parent) : QObject(parent) { } void Simulatermodbus::init() { QEventLoop qloop; qDebug() << "Simulatermodbus::init" << QThread::currentThreadId() ; timer = new QTimer(); timer->setInterval(2000); timer->start(); connect(timer, &QTimer::timeout, &qloop, &QEventLoop::quit); qloop.exec(); timer->stop(); } void Simulatermodbus::open(QString serialPort, int slaveAddress) { QEventLoop qloop; qDebug() << "Simulatermodbus::open " << QThread::currentThreadId() ; QThread::sleep(2); timer = new QTimer(); timer->setInterval(2000); timer->start(); connect(timer, &QTimer::timeout, &qloop, &QEventLoop::quit); qloop.exec(); qDebug() << " Simulatermodbus open Done serial is " << serialPort; qDebug() << " Simulatermodbus open Done slaveAddress is " << slaveAddress; timer->stop(); }