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.
|
|
|
#include "MainWindow.h"
|
|
|
|
#include "ui_MainWindow.h"
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget* parent)
|
|
|
|
: QMainWindow(parent)
|
|
|
|
, ui(new Ui::MainWindow)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************************************/
|
|
|
|
void MainWindow::on_connect_clicked()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
configDevice.serialPort = "/dev/pts/2";
|
|
|
|
configDevice.clientAddress = 1;
|
|
|
|
configDevice.responseTime = 1000;
|
|
|
|
configDevice.numberOfRetries = 3;
|
|
|
|
qDebug() << "before init";
|
|
|
|
modbusWrapper.init();
|
|
|
|
qDebug() << "after init";
|
|
|
|
qDebug() << "before connect";
|
|
|
|
modbusWrapper.connectToDevice(configDevice);
|
|
|
|
qDebug() << "after connect";
|
|
|
|
}
|
|
|
|
catch(ServoException ex)
|
|
|
|
{
|
|
|
|
qDebug() << ex.what();
|
|
|
|
}
|
|
|
|
}
|