diff --git a/src/datIf.cpp b/src/datIf.cpp index 25e4365..ea18f4e 100755 --- a/src/datIf.cpp +++ b/src/datIf.cpp @@ -6,6 +6,7 @@ History: */ #include "datIf.h" +#include "hwapi.h" #include "sendWRcmd.h" #include "controlBus.h" #include "storeINdata.h" @@ -513,6 +514,8 @@ char T_datif::loadRecDataFromFrame() return 0; } + memset(receivedData, 0x00, sizeof(receivedData)); + ret=myDCIF->getReceivedInData(&SlaveAdr, &readSource, &readAddress, &RdDleng, receivedData); // nur true wenn CommandState OK und readState OK @@ -545,6 +548,37 @@ char T_datif::loadRecDataFromFrame() gpi_storeRecPayLoad(RdDleng, receivedData); // save for host (user of hwapi) + if (myDCIF && myDCIF->getSerialPort()) { + QVector &readCmds = myDCIF->getSerialPort()->getReadCmds(); + + if (readCmds.size() == 1) { + if (readSource == myDCIF->getReadSource() && readSource == readCmds[0]) { + if (waitForTestResponse) { + if (readCmds[0] == CMD2DC_TestSerial) { + if (QString(QByteArray((char const *)receivedData, RdDleng)) == "< SlaveResponse") { + waitForTestResponse = false; + ((hwapi *)parent())->dc_autoRequest(true); + } + } + } + readCmds.clear(); + } else { + qCritical() << __func__ << ":" << __LINE__ << ":" << readSource << myDCIF->getReadSource() << readCmds[0]; + qCritical() << __func__ << ":" << __LINE__ << ":" << QByteArray((char const *)receivedData, RdDleng).toHex(':'); + readCmds.clear(); + return 0; + } + } else { + readCmds.clear(); + if (parent()) { + waitForTestResponse = true; + ((hwapi *)parent())->dc_autoRequest(false); + ((hwapi *)parent())->dc_requTestResponse(); + } + return 0; + } + } + // uint8_t nn; //qDebug() << "\n datif: got valid data, rdsrc:" << readSource << " rdadd:" << readAddress // << " rdlen:" << RdDleng;