Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+19
-20
@@ -13,15 +13,14 @@ using namespace NGL;
|
||||
|
||||
namespace TrainingAreaBaseOC
|
||||
{
|
||||
ConnectionHandlerTcpTtci::ConnectionHandlerTcpTtci()
|
||||
: m_messageDataStart(true)
|
||||
ConnectionHandlerTcpTtci::ConnectionHandlerTcpTtci() : m_messageDataStart(true)
|
||||
, m_wirkfeldDataStart(true)
|
||||
, m_wirkfeldMultiplex(0)
|
||||
, m_sendingData(false)
|
||||
, m_segmentToggle(0)
|
||||
, m_canDevice(new Device(this))
|
||||
, m_canChannel(new Channel(QLatin1Char('@'), true, this))
|
||||
{
|
||||
, m_canChannel(new Channel(QLatin1Char('@'), true, this)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
connect(m_canChannel, &Channel::dataAvailable, this, &ConnectionHandlerTcpTtci::slotReadCanFrame);
|
||||
connect(m_canChannel, &Channel::disconnectedFromEq, this, &ConnectionHandlerTcpTtci::disconnectedFromEq);
|
||||
}
|
||||
@@ -42,7 +41,7 @@ bool ConnectionHandlerTcpTtci::init()
|
||||
|
||||
void ConnectionHandlerTcpTtci::initCanSocket()
|
||||
{
|
||||
ERROR_LOG() << "InitCantSOcket";
|
||||
ERROR_LOG(m_logger) << "InitCantSOcket";
|
||||
|
||||
m_canChannel->setDevice(m_canDevice);
|
||||
m_canDevice->open();
|
||||
@@ -53,10 +52,10 @@ bool ConnectionHandlerTcpTtci::findNextSyncByte(int &iCurReadPos) const
|
||||
{
|
||||
if (iCurReadPos == m_buffer.size())
|
||||
{
|
||||
DEBUG_LOG() << "No more data available";
|
||||
DEBUG_LOG(m_logger) << "No more data available";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "Searching for next sync byte, start at: " << iCurReadPos;
|
||||
DEBUG_LOG(m_logger) << "Searching for next sync byte, start at: " << iCurReadPos;
|
||||
NGL::NGLLoggerHelper::hexDumpHelper(m_logger, NGL::LogLevel::Debug, m_buffer);
|
||||
|
||||
while (iCurReadPos < m_buffer.size())
|
||||
@@ -70,7 +69,7 @@ bool ConnectionHandlerTcpTtci::findNextSyncByte(int &iCurReadPos) const
|
||||
|
||||
if (m_buffer.size() < 4 + iCurReadPos)
|
||||
{
|
||||
DEBUG_LOG() << "Could not find sync byte in stream";
|
||||
DEBUG_LOG(m_logger) << "Could not find sync byte in stream";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -83,11 +82,11 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
int iCurReadPos = 0;
|
||||
while (findNextSyncByte(iCurReadPos))
|
||||
{
|
||||
DEBUG_LOG() << "Found Sync byte at " << iCurReadPos;
|
||||
DEBUG_LOG(m_logger) << "Found Sync byte at " << iCurReadPos;
|
||||
|
||||
|
||||
unsigned int len = (m_buffer.at(iCurReadPos + 1) & 0xF0) >> 4;
|
||||
DEBUG_LOG() << "Payload size: " << len;
|
||||
DEBUG_LOG(m_logger) << "Payload size: " << len;
|
||||
|
||||
if (len > 8)
|
||||
{
|
||||
@@ -96,22 +95,22 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
{
|
||||
case 9:
|
||||
|
||||
DEBUG_LOG() << "Read status data - skipping ";
|
||||
DEBUG_LOG(m_logger) << "Read status data - skipping ";
|
||||
iCurReadPos += 4;
|
||||
break;
|
||||
case 11:
|
||||
|
||||
DEBUG_LOG() << "Read communication SFM - PAN - skipping ";
|
||||
DEBUG_LOG(m_logger) << "Read communication SFM - PAN - skipping ";
|
||||
iCurReadPos += 5;
|
||||
break;
|
||||
case 12:
|
||||
|
||||
DEBUG_LOG() << "Read parameter request - skipping ";
|
||||
DEBUG_LOG(m_logger) << "Read parameter request - skipping ";
|
||||
iCurReadPos += 5;
|
||||
break;
|
||||
default:
|
||||
|
||||
WARNING_LOG() << "Invalid payload size (" << len << " - skipping";
|
||||
WARNING_LOG(m_logger) << "Invalid payload size (" << len << " - skipping";
|
||||
++iCurReadPos;
|
||||
break;
|
||||
}
|
||||
@@ -124,7 +123,7 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
int neededBytes = 4 + len + iCurReadPos;
|
||||
if (m_buffer.size() < neededBytes)
|
||||
{
|
||||
INFO_LOG() << "To few bytes in buffer - waiting for more (want: "
|
||||
INFO_LOG(m_logger) << "To few bytes in buffer - waiting for more (want: "
|
||||
<< neededBytes << " have: " << m_buffer.size() << ")";
|
||||
|
||||
break;
|
||||
@@ -134,7 +133,7 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
unsigned char id2 = m_buffer.at(iCurReadPos + 2);
|
||||
id = ((id << 8) + id2);
|
||||
bool rtr = ((m_buffer.at(iCurReadPos + 1) & 0x08) == 0x08);
|
||||
DEBUG_LOG() << "CAN ID: " << id << " rtr: " << rtr;
|
||||
DEBUG_LOG(m_logger) << "CAN ID: " << id << " rtr: " << rtr;
|
||||
|
||||
|
||||
unsigned char crc = 0;
|
||||
@@ -146,7 +145,7 @@ void ConnectionHandlerTcpTtci::slotReadCanFrame(const QByteArray &data)
|
||||
if (crc != crcSent)
|
||||
{
|
||||
|
||||
WARNING_LOG() << "CRC checksum missmatch (is: " << crcSent
|
||||
WARNING_LOG(m_logger) << "CRC checksum missmatch (is: " << crcSent
|
||||
<< " - calculated: " << crc << ") - skipping";
|
||||
iCurReadPos++;
|
||||
continue;
|
||||
@@ -179,7 +178,7 @@ bool ConnectionHandlerTcpTtci::send(const LtsUtils::SfmMessage &message)
|
||||
if (message.payload().size() > 8)
|
||||
return false;
|
||||
|
||||
INFO_LOG() << "start write";
|
||||
INFO_LOG(m_logger) << "start write";
|
||||
NGL::NGLLoggerHelper::hexDumpHelper(m_logger, NGL::LogLevel::Debug, message.payload());
|
||||
|
||||
QByteArray data(message.payload().size() + 4, Qt::Uninitialized);
|
||||
@@ -196,10 +195,10 @@ bool ConnectionHandlerTcpTtci::send(const LtsUtils::SfmMessage &message)
|
||||
crc += data.at(i);
|
||||
crc = ~crc;
|
||||
data[message.payload().size() + 3] = crc;
|
||||
INFO_LOG() << "end write ";
|
||||
INFO_LOG(m_logger) << "end write ";
|
||||
|
||||
if (!m_canChannel->writeData(data))
|
||||
ERROR_LOG() << "Error writing data to can channel";
|
||||
ERROR_LOG(m_logger) << "Error writing data to can channel";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user