loadRecDataFromFrame():
Read last message if only one command to device controller is active. Otherwise assume that the data is obsolete. Trigger the sending of a known test-response to find new valid data-stream.
This commit is contained in:
parent
26a11e6c56
commit
900b0ef952
@ -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<uint16_t> &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;
|
||||
|
Loading…
Reference in New Issue
Block a user