Minor: adding comments
This commit is contained in:
parent
2b2cd25276
commit
0f7ab3c71c
@ -551,26 +551,40 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
if (myDCIF && myDCIF->getSerialPort()) {
|
if (myDCIF && myDCIF->getSerialPort()) {
|
||||||
QVector<uint16_t> &readCmds = myDCIF->getSerialPort()->getReadCmds();
|
QVector<uint16_t> &readCmds = myDCIF->getSerialPort()->getReadCmds();
|
||||||
|
|
||||||
if (readCmds.size() == 1) {
|
if (readCmds.size() == 1) { // there can be only one command been sent to the DC
|
||||||
|
// the command number active at the moment must be the same as the saved one
|
||||||
if (readSource == myDCIF->getReadSource() && readSource == readCmds[0]) {
|
if (readSource == myDCIF->getReadSource() && readSource == readCmds[0]) {
|
||||||
|
// maybe we have sent a explicit request for a test-response
|
||||||
if (waitForTestResponse) {
|
if (waitForTestResponse) {
|
||||||
if (readCmds[0] == CMD2DC_TestSerial) {
|
if (readCmds[0] == CMD2DC_TestSerial) {
|
||||||
if (QString(QByteArray((char const *)receivedData, RdDleng)) == "< SlaveResponse") {
|
if (QString(QByteArray((char const *)receivedData, RdDleng)) == "< SlaveResponse") {
|
||||||
waitForTestResponse = false;
|
waitForTestResponse = false;
|
||||||
((hwapi *)parent())->dc_autoRequest(true);
|
qCritical() << __func__ << ":" << __LINE__ << "turn on auto-request";
|
||||||
|
((hwapi *)parent())->dc_autoRequest(true); // return autorequest to true
|
||||||
|
} else {
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << "received wrong test-response"
|
||||||
|
<< QString(QByteArray((char const *)receivedData, RdDleng));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// usual handling of response
|
||||||
}
|
}
|
||||||
readCmds.clear();
|
readCmds.clear();
|
||||||
} else {
|
} else { // error
|
||||||
qCritical() << __func__ << ":" << __LINE__ << ":" << readSource << myDCIF->getReadSource() << readCmds[0];
|
qCritical() << __func__ << ":" << __LINE__ << ":" << readSource << myDCIF->getReadSource() << readCmds[0];
|
||||||
qCritical() << __func__ << ":" << __LINE__ << ":" << QByteArray((char const *)receivedData, RdDleng).toHex(':');
|
qCritical() << __func__ << ":" << __LINE__ << ":" << QByteArray((char const *)receivedData, RdDleng).toHex(':');
|
||||||
readCmds.clear();
|
readCmds.clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// error: read commands has not size 1 as it should be: turn off
|
||||||
|
// auto requests and send explicit request for test-response:
|
||||||
|
// once this response has been received, turn on the autmatic requests
|
||||||
|
// again.
|
||||||
readCmds.clear();
|
readCmds.clear();
|
||||||
if (parent()) {
|
if (parent()) {
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << "turn off auto-request";
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << "send request for test-response";
|
||||||
waitForTestResponse = true;
|
waitForTestResponse = true;
|
||||||
((hwapi *)parent())->dc_autoRequest(false);
|
((hwapi *)parent())->dc_autoRequest(false);
|
||||||
((hwapi *)parent())->dc_requTestResponse();
|
((hwapi *)parent())->dc_requTestResponse();
|
||||||
|
Loading…
Reference in New Issue
Block a user