|
@ -54,6 +54,12 @@ void ModbusWrapper::init() |
|
|
&ModbusMaster::getInputRegister, |
|
|
&ModbusMaster::getInputRegister, |
|
|
Qt::BlockingQueuedConnection); |
|
|
Qt::BlockingQueuedConnection); |
|
|
|
|
|
|
|
|
|
|
|
connect(this, |
|
|
|
|
|
&ModbusWrapper::setSingleCoilOrder, |
|
|
|
|
|
&_modbusMaster, |
|
|
|
|
|
&ModbusMaster::setSingleCoil, |
|
|
|
|
|
Qt::BlockingQueuedConnection); |
|
|
|
|
|
|
|
|
emit initOrder(); |
|
|
emit initOrder(); |
|
|
|
|
|
|
|
|
qDebug() << "init done"; |
|
|
qDebug() << "init done"; |
|
@ -62,44 +68,35 @@ void ModbusWrapper::init() |
|
|
/*************************************************************************************************/ |
|
|
/*************************************************************************************************/ |
|
|
QBitArray ModbusWrapper::getCoil(int startAddress, quint16 readSize) |
|
|
QBitArray ModbusWrapper::getCoil(int startAddress, quint16 readSize) |
|
|
{ |
|
|
{ |
|
|
auto result = emit getCoilOrder(startAddress, readSize); |
|
|
return emit getCoilOrder(startAddress, readSize); |
|
|
qDebug() << "getCoil done"; |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
/*************************************************************************************************/ |
|
|
QBitArray ModbusWrapper::getInputCoil(int startAddress, quint16 readSize) |
|
|
QBitArray ModbusWrapper::getInputCoil(int startAddress, quint16 readSize) |
|
|
{ |
|
|
{ |
|
|
auto result = emit getInputCoilOrder(startAddress, readSize); |
|
|
return emit getInputCoilOrder(startAddress, readSize); |
|
|
qDebug() << "getInputCoilOrder done"; |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
/*************************************************************************************************/ |
|
|
QVector<quint16> ModbusWrapper::getHoldingRegister(int startAddress, quint16 readSize) |
|
|
QVector<quint16> ModbusWrapper::getHoldingRegister(int startAddress, quint16 readSize) |
|
|
{ |
|
|
{ |
|
|
auto result = emit getHoldingRegisterOrder(startAddress, readSize); |
|
|
return emit getHoldingRegisterOrder(startAddress, readSize); |
|
|
qDebug() << "getHoldingRegister done"; |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
/*************************************************************************************************/ |
|
|
QVector<quint16> ModbusWrapper::getInputRegister(int startAddress, quint16 readSize) |
|
|
QVector<quint16> ModbusWrapper::getInputRegister(int startAddress, quint16 readSize) |
|
|
{ |
|
|
{ |
|
|
auto result = emit getInputRegisterOrder(startAddress, readSize); |
|
|
return emit getInputRegisterOrder(startAddress, readSize); |
|
|
qDebug() << "getInputRegister done"; |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
/*************************************************************************************************/ |
|
|
|
|
|
void ModbusWrapper::setSingleCoil(int startAddress, bool coilFlag) |
|
|
|
|
|
{ |
|
|
|
|
|
emit setSingleCoilOrder(startAddress, coilFlag); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
/*************************************************************************************************/ |
|
|
void ModbusWrapper::connectToDevice(ModbusConfig modbusConfig) |
|
|
void ModbusWrapper::connectToDevice(ModbusConfig modbusConfig) |
|
|
{ |
|
|
{ |
|
|
emit connectOrder(modbusConfig); |
|
|
emit connectOrder(modbusConfig); |
|
|
qDebug() << "connect done"; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
|
|