Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+13
-14
@@ -10,10 +10,9 @@
|
||||
namespace TrainingAreaBaseOC
|
||||
{
|
||||
|
||||
ConnectionHandlerSerial::ConnectionHandlerSerial()
|
||||
: m_spQuerry(new LtsSerialPortQuerry::LtsSerialPortQuerry(this))
|
||||
, m_receiveTimeoutTimer(new QTimer(this))
|
||||
{
|
||||
ConnectionHandlerSerial::ConnectionHandlerSerial() : m_spQuerry(new LtsSerialPortQuerry::LtsSerialPortQuerry(this))
|
||||
, m_receiveTimeoutTimer(new QTimer(this)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
connect(m_spQuerry, &LtsSerialPortQuerry::LtsSerialPortQuerry::connectionEstablished, this, &ConnectionHandlerSerial::open);
|
||||
m_spQuerry->restartQuerry();
|
||||
m_receiveTimeoutTimer->setInterval(5000);
|
||||
@@ -34,25 +33,25 @@ bool ConnectionHandlerSerial::send(const LtsUtils::SfmMessage &message)
|
||||
|
||||
if (!m_serialPort->isOpen())
|
||||
{
|
||||
ERROR_LOG() << "Port is not opened!";
|
||||
ERROR_LOG(m_logger) << "Port is not opened!";
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray data = LtsUtils::byteStreamFromSfmMessage(message);
|
||||
|
||||
DEBUG_LOG() << "Sending frame: " << data.toHex(' ');
|
||||
DEBUG_LOG(m_logger) << "Sending frame: " << data.toHex(' ');
|
||||
|
||||
const qint64 byteswritten = m_serialPort->write(data);
|
||||
m_serialPort->flush();
|
||||
|
||||
if (byteswritten == -1)
|
||||
{
|
||||
ERROR_LOG() << "Failed to write data to port " << m_serialPort->portName() << " error: " << m_serialPort->errorString();
|
||||
ERROR_LOG(m_logger) << "Failed to write data to port " << m_serialPort->portName() << " error: " << m_serialPort->errorString();
|
||||
return false;
|
||||
}
|
||||
else if (byteswritten != data.size())
|
||||
{
|
||||
ERROR_LOG() << "Failed to write all data to port " << m_serialPort->portName() << " error: " << m_serialPort->errorString();
|
||||
ERROR_LOG(m_logger) << "Failed to write all data to port " << m_serialPort->portName() << " error: " << m_serialPort->errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -83,7 +82,7 @@ void ConnectionHandlerSerial::read()
|
||||
const QByteArray ba = m_serialPort->readAll();
|
||||
m_currentDataRead.append(ba);
|
||||
|
||||
DEBUG_LOG() << "Binary data from sfm: " << ba.toHex(' ');
|
||||
DEBUG_LOG(m_logger) << "Binary data from sfm: " << ba.toHex(' ');
|
||||
|
||||
int idxStart = -1;
|
||||
int idxEnd = -1;
|
||||
@@ -94,21 +93,21 @@ void ConnectionHandlerSerial::read()
|
||||
QByteArray message = m_currentDataRead.mid(idxStart, (idxEnd - idxStart) + 1);
|
||||
|
||||
LtsUtils::SfmMessage sfmMsg;
|
||||
DEBUG_LOG() << "Frame from sfm as binary " << message.toHex();
|
||||
DEBUG_LOG(m_logger) << "Frame from sfm as binary " << message.toHex();
|
||||
try
|
||||
{
|
||||
sfmMsg = LtsUtils::byteStreamToSfmMessage(message);
|
||||
}
|
||||
catch (const LtsUtils::ConversionError &ex)
|
||||
{
|
||||
ERROR_LOG() << "Error converting QByteArray into LtsUtils::SfmMessage: " << ex.what();
|
||||
ERROR_LOG() << "Faulty Data from sfm as binary " << message.toHex();
|
||||
ERROR_LOG(m_logger) << "Error converting QByteArray into LtsUtils::SfmMessage: " << ex.what();
|
||||
ERROR_LOG(m_logger) << "Faulty Data from sfm as binary " << message.toHex();
|
||||
m_currentDataRead = m_currentDataRead.mid(idxEnd + 1);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
INFO_LOG() << "Decoded message from sfm Id: " << sfmMsg.id() << " RTR: " << sfmMsg.rtr() << " Data: " << sfmMsg.payload().toHex();
|
||||
INFO_LOG(m_logger) << "Decoded message from sfm Id: " << sfmMsg.id() << " RTR: " << sfmMsg.rtr() << " Data: " << sfmMsg.payload().toHex();
|
||||
|
||||
m_receiveTimeoutTimer->start();
|
||||
|
||||
@@ -118,7 +117,7 @@ void ConnectionHandlerSerial::read()
|
||||
}
|
||||
|
||||
if (m_serialPort->bytesAvailable() > 0)
|
||||
DEBUG_LOG() << "Still " << m_serialPort->bytesAvailable() << " available to be read";
|
||||
DEBUG_LOG(m_logger) << "Still " << m_serialPort->bytesAvailable() << " available to be read";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user