|
|
@ -46,29 +46,38 @@ void MainWindow::on_readButton_clicked() |
|
|
|
{ |
|
|
|
int startAddress = ui->startAddress->text().toInt(); |
|
|
|
int numberOfEntries = ui->readSize->text().toInt(); |
|
|
|
switch(ui->writeTable->currentData().toInt()) |
|
|
|
try |
|
|
|
{ |
|
|
|
switch(ui->writeTable->currentData().toInt()) |
|
|
|
{ |
|
|
|
case 0: |
|
|
|
printCoilsDataFromClient(modbusWrapper.getCoil(startAddress, |
|
|
|
static_cast<quint16>(numberOfEntries))); |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
printCoilsDataFromClient(modbusWrapper.getInputCoil(startAddress, |
|
|
|
static_cast<quint16>( |
|
|
|
numberOfEntries))); |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
printRegisterDataFromClient(modbusWrapper.getInputRegister(startAddress, |
|
|
|
static_cast<quint16>( |
|
|
|
numberOfEntries))); |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
printRegisterDataFromClient(modbusWrapper.getHoldingRegister(startAddress, |
|
|
|
static_cast<quint16>( |
|
|
|
numberOfEntries))); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
catch(const ServoException& exp) |
|
|
|
{ |
|
|
|
case 0: |
|
|
|
printCoilsDataFromClient(modbusWrapper.getCoil(startAddress, |
|
|
|
static_cast<quint16>(numberOfEntries))); |
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
printCoilsDataFromClient(modbusWrapper.getInputCoil(startAddress, |
|
|
|
static_cast<quint16>(numberOfEntries))); |
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
printRegisterDataFromClient(modbusWrapper.getInputRegister(startAddress, |
|
|
|
static_cast<quint16>( |
|
|
|
numberOfEntries))); |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
printRegisterDataFromClient(modbusWrapper.getHoldingRegister(startAddress, |
|
|
|
static_cast<quint16>( |
|
|
|
numberOfEntries))); |
|
|
|
break; |
|
|
|
qDebug() << "aaaa"; |
|
|
|
qDebug() << exp.what(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|