|
@ -3,7 +3,8 @@ |
|
|
#include "include/LowLevel/HonaLowLevelAPI.h" |
|
|
#include "include/LowLevel/HonaLowLevelAPI.h" |
|
|
#include "include/Wrapper/PlxWrapper.h" |
|
|
#include "include/Wrapper/PlxWrapper.h" |
|
|
#include <QDebug> |
|
|
#include <QDebug> |
|
|
#include <QTimer> |
|
|
#include <QDateTime> |
|
|
|
|
|
|
|
|
quint32 HonaLowLevelAPI::packetLenInt4; |
|
|
quint32 HonaLowLevelAPI::packetLenInt4; |
|
|
quint32 HonaLowLevelAPI::packetLenRes4; |
|
|
quint32 HonaLowLevelAPI::packetLenRes4; |
|
|
quint32 HonaLowLevelAPI::packetLenSinglePulse; |
|
|
quint32 HonaLowLevelAPI::packetLenSinglePulse; |
|
@ -185,12 +186,16 @@ void HonaLowLevelAPI::hsruMainThread() |
|
|
throw HonaException(); |
|
|
throw HonaException(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_isHsruReaderThreadFree = false; |
|
|
|
|
|
_isHsruUpdateThreadFree = false; |
|
|
|
|
|
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruReadThread); |
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruReadThread); |
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread); |
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread); |
|
|
|
|
|
|
|
|
_mutex.lock(); |
|
|
_mutex.lock(); |
|
|
_hsruStopEvent.wait(&_mutex); |
|
|
_hsruStopEvent.wait(&_mutex); |
|
|
_mutex.unlock(); |
|
|
_mutex.unlock(); |
|
|
|
|
|
|
|
|
_isHsruReaderThreadFree = true; |
|
|
_isHsruReaderThreadFree = true; |
|
|
_isHsruUpdateThreadFree = true; |
|
|
_isHsruUpdateThreadFree = true; |
|
|
|
|
|
|
|
@ -258,6 +263,9 @@ void HonaLowLevelAPI::hsruUpdateThread() |
|
|
quint32 Doa = 0; |
|
|
quint32 Doa = 0; |
|
|
Doa = hiruGetDOA(); |
|
|
Doa = hiruGetDOA(); |
|
|
emit lowLevelHonaData(honaPacketList, _hsruLoss, Doa); |
|
|
emit lowLevelHonaData(honaPacketList, _hsruLoss, Doa); |
|
|
|
|
|
QThread::msleep(200); |
|
|
|
|
|
// QDateTime time = QDateTime :: currentDateTime ();//Get the current time of the system
|
|
|
|
|
|
// QString str = time.toString ("yyyy-MM-dd hh: mm: ss: zzz ddd");//Set the display format
|
|
|
_hsruUpdateAck.wakeAll(); |
|
|
_hsruUpdateAck.wakeAll(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -306,7 +314,6 @@ quint32 HonaLowLevelAPI::hsruParserInt123C(const QVector<quint32>& honaData, |
|
|
{ |
|
|
{ |
|
|
if((honaData[Ind] & 0xFF000000) == 0x0F000000) |
|
|
if((honaData[Ind] & 0xFF000000) == 0x0F000000) |
|
|
{ |
|
|
{ |
|
|
HonaPacket tempHonaPacketInt123C; |
|
|
|
|
|
tempHonaPacketInt123C.setPacketType(honaPacketType::interrogationMode123C); |
|
|
tempHonaPacketInt123C.setPacketType(honaPacketType::interrogationMode123C); |
|
|
packetLenInt123C = 6; |
|
|
packetLenInt123C = 6; |
|
|
tempHonaPacketInt123C.setPacketNumber(honaData[Ind] & 0x0000FFFF); |
|
|
tempHonaPacketInt123C.setPacketNumber(honaData[Ind] & 0x0000FFFF); |
|
@ -357,6 +364,10 @@ quint32 HonaLowLevelAPI::hsruParserInt123C(const QVector<quint32>& honaData, |
|
|
tempHonaPacketInt123C.setCodeL(0); |
|
|
tempHonaPacketInt123C.setCodeL(0); |
|
|
nextInt123C = 6; |
|
|
nextInt123C = 6; |
|
|
} |
|
|
} |
|
|
|
|
|
else if(honaData[Ind] == 0xEEEEEEEE) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(nextInt123C == packetLenInt123C) |
|
|
if(nextInt123C == packetLenInt123C) |
|
|
{ |
|
|
{ |
|
@ -432,6 +443,10 @@ quint32 HonaLowLevelAPI::hsruParserRes123C(const QVector<quint32>& honaData, |
|
|
|
|
|
|
|
|
nextRes123C = 6; |
|
|
nextRes123C = 6; |
|
|
} |
|
|
} |
|
|
|
|
|
else if(honaData[Ind] == 0xEEEEEEEE) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(nextRes123C == packetLenRes123C) |
|
|
if(nextRes123C == packetLenRes123C) |
|
|
{ |
|
|
{ |
|
@ -513,8 +528,7 @@ quint32 HonaLowLevelAPI::hsruParserIntS(const QVector<quint32>& honaData, |
|
|
else if(((honaData[Ind] & 0xF0000000) == 0x60000000) && (nextIntS == 6)) |
|
|
else if(((honaData[Ind] & 0xF0000000) == 0x60000000) && (nextIntS == 6)) |
|
|
{ |
|
|
{ |
|
|
tempHonaPacketIntS.setCodeM(tempHonaPacketIntS.getCodeM() + |
|
|
tempHonaPacketIntS.setCodeM(tempHonaPacketIntS.getCodeM() + |
|
|
(static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << |
|
|
((static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << 36)); |
|
|
36); |
|
|
|
|
|
tempHonaPacketIntS.setCodeL(0); |
|
|
tempHonaPacketIntS.setCodeL(0); |
|
|
nextIntS = 7; |
|
|
nextIntS = 7; |
|
|
} |
|
|
} |
|
@ -527,10 +541,13 @@ quint32 HonaLowLevelAPI::hsruParserIntS(const QVector<quint32>& honaData, |
|
|
else if(((honaData[Ind] & 0xF0000000) == 0x80000000) && (nextIntS == 8)) |
|
|
else if(((honaData[Ind] & 0xF0000000) == 0x80000000) && (nextIntS == 8)) |
|
|
{ |
|
|
{ |
|
|
tempHonaPacketIntS.setCodeM(tempHonaPacketIntS.getCodeM() + |
|
|
tempHonaPacketIntS.setCodeM(tempHonaPacketIntS.getCodeM() + |
|
|
(static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << |
|
|
((static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << 36)); |
|
|
36); |
|
|
|
|
|
nextIntS = 9; |
|
|
nextIntS = 9; |
|
|
} |
|
|
} |
|
|
|
|
|
else if(honaData[Ind] == 0xEEEEEEEE) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(nextIntS == packetLenIntS) |
|
|
if(nextIntS == packetLenIntS) |
|
|
{ |
|
|
{ |
|
@ -613,8 +630,7 @@ quint32 HonaLowLevelAPI::hsruParserResS(const QVector<quint32>& honaData, |
|
|
else if(((honaData[Ind] & 0xF0000000) == 0x60000000) && (nextResS == 6)) |
|
|
else if(((honaData[Ind] & 0xF0000000) == 0x60000000) && (nextResS == 6)) |
|
|
{ |
|
|
{ |
|
|
tempHonaPacketResS.setCodeM(tempHonaPacketResS.getCodeM() + |
|
|
tempHonaPacketResS.setCodeM(tempHonaPacketResS.getCodeM() + |
|
|
(static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << |
|
|
((static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << 36)); |
|
|
36); |
|
|
|
|
|
tempHonaPacketResS.setCodeL(0); |
|
|
tempHonaPacketResS.setCodeL(0); |
|
|
nextResS = 7; |
|
|
nextResS = 7; |
|
|
} |
|
|
} |
|
@ -627,10 +643,14 @@ quint32 HonaLowLevelAPI::hsruParserResS(const QVector<quint32>& honaData, |
|
|
else if(((honaData[Ind] & 0xF0000000) == 0x80000000) && (nextResS == 8)) |
|
|
else if(((honaData[Ind] & 0xF0000000) == 0x80000000) && (nextResS == 8)) |
|
|
{ |
|
|
{ |
|
|
tempHonaPacketResS.setCodeM(tempHonaPacketResS.getCodeM() + |
|
|
tempHonaPacketResS.setCodeM(tempHonaPacketResS.getCodeM() + |
|
|
(static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << |
|
|
((static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << 36)); |
|
|
36); |
|
|
|
|
|
nextResS = 9; |
|
|
nextResS = 9; |
|
|
} |
|
|
} |
|
|
|
|
|
else if(honaData[Ind] == 0xEEEEEEEE) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(nextResS == packetLenResS) |
|
|
if(nextResS == packetLenResS) |
|
|
{ |
|
|
{ |
|
|
if(isValid(tempHonaPacketResS)) |
|
|
if(isValid(tempHonaPacketResS)) |
|
@ -710,6 +730,10 @@ quint32 HonaLowLevelAPI::hsruParserInt4(const QVector<quint32>& honaData, |
|
|
tempHonaPacketInt4.setm4Status(static_cast<quint8>((honaData[Ind] & 0x0F000000) >> 20)); |
|
|
tempHonaPacketInt4.setm4Status(static_cast<quint8>((honaData[Ind] & 0x0F000000) >> 20)); |
|
|
nextInt4 = 7; |
|
|
nextInt4 = 7; |
|
|
} |
|
|
} |
|
|
|
|
|
else if(honaData[Ind] == 0xEEEEEEEE) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(nextInt4 == packetLenInt4) |
|
|
if(nextInt4 == packetLenInt4) |
|
|
{ |
|
|
{ |
|
@ -775,6 +799,10 @@ quint32 HonaLowLevelAPI::hsruParserRes4(const QVector<quint32>& honaData, |
|
|
((honaData[Ind] & 0x00F00000) >> 8)); |
|
|
((honaData[Ind] & 0x00F00000) >> 8)); |
|
|
nextRes4 = 5; |
|
|
nextRes4 = 5; |
|
|
} |
|
|
} |
|
|
|
|
|
else if(honaData[Ind] == 0xEEEEEEEE) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(nextRes4 == packetLenRes4) |
|
|
if(nextRes4 == packetLenRes4) |
|
|
{ |
|
|
{ |
|
@ -844,6 +872,10 @@ quint32 HonaLowLevelAPI::hsruParserSinglePulse(const QVector<quint32>& honaData, |
|
|
((honaData[Ind] & 0x00F00000) >> 8)); |
|
|
((honaData[Ind] & 0x00F00000) >> 8)); |
|
|
nextSinglePulse = 5; |
|
|
nextSinglePulse = 5; |
|
|
} |
|
|
} |
|
|
|
|
|
else if(honaData[Ind] == 0xEEEEEEEE) |
|
|
|
|
|
{ |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(nextSinglePulse == packetLenSinglePulse) |
|
|
if(nextSinglePulse == packetLenSinglePulse) |
|
|
{ |
|
|
{ |
|
@ -889,10 +921,10 @@ QVector<quint32> HonaLowLevelAPI::hsruReadHonaBuffer(honaReceivers receiver) |
|
|
throw HonaException(); |
|
|
throw HonaException(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// qDebug() << " hsruReadHonaBuffer receiver "<< receiver;
|
|
|
qDebug() << " hsruReadHonaBuffer receiver "<< receiver; |
|
|
// for(auto i = 0 ; i < 10; i++)
|
|
|
for(auto i = 0 ; i < 10; i++) |
|
|
// qDebug() << "[" << i << "] " << "0x" << QString::number(honaData[i], 16);
|
|
|
qDebug() << "[" << i << "] " << "0x" << QString::number(honaData[i], 16); |
|
|
// qDebug() << "------------------------------------------------------------";
|
|
|
qDebug() << "------------------------------------------------------------"; |
|
|
return honaData; |
|
|
return honaData; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|