Browse Source

abidi change1

mehrabi
mehrabi 3 years ago
parent
commit
946796c965
  1. 2
      Plx/include/LowLevel/HonaLowLevelAPI.h
  2. 64
      Plx/src/LowLevel/HonaLowLevelAPI.cpp
  3. 4
      Test/MainWindow.cpp

2
Plx/include/LowLevel/HonaLowLevelAPI.h

@ -3,6 +3,7 @@
#include <QObject>
#include <QMutex>
#include <QWaitCondition>
#include <QTimer>
#include "LowLevel/Setting/Setting.h"
#include "LowLevel/HonaPacket.h"
@ -118,6 +119,7 @@ private:
public:
signals:
void lowLevelHonaData(QList<HonaPacket> honaPacketList, quint32 hsruLoss, quint32 Doa);

64
Plx/src/LowLevel/HonaLowLevelAPI.cpp

@ -3,7 +3,8 @@
#include "include/LowLevel/HonaLowLevelAPI.h"
#include "include/Wrapper/PlxWrapper.h"
#include <QDebug>
#include <QTimer>
#include <QDateTime>
quint32 HonaLowLevelAPI::packetLenInt4;
quint32 HonaLowLevelAPI::packetLenRes4;
quint32 HonaLowLevelAPI::packetLenSinglePulse;
@ -185,12 +186,16 @@ void HonaLowLevelAPI::hsruMainThread()
throw HonaException();
}
_isHsruReaderThreadFree = false;
_isHsruUpdateThreadFree = false;
QtConcurrent::run(this, &HonaLowLevelAPI::hsruReadThread);
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread);
_mutex.lock();
_hsruStopEvent.wait(&_mutex);
_mutex.unlock();
_isHsruReaderThreadFree = true;
_isHsruUpdateThreadFree = true;
@ -258,6 +263,9 @@ void HonaLowLevelAPI::hsruUpdateThread()
quint32 Doa = 0;
Doa = hiruGetDOA();
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();
}
}
@ -306,7 +314,6 @@ quint32 HonaLowLevelAPI::hsruParserInt123C(const QVector<quint32>& honaData,
{
if((honaData[Ind] & 0xFF000000) == 0x0F000000)
{
HonaPacket tempHonaPacketInt123C;
tempHonaPacketInt123C.setPacketType(honaPacketType::interrogationMode123C);
packetLenInt123C = 6;
tempHonaPacketInt123C.setPacketNumber(honaData[Ind] & 0x0000FFFF);
@ -357,6 +364,10 @@ quint32 HonaLowLevelAPI::hsruParserInt123C(const QVector<quint32>& honaData,
tempHonaPacketInt123C.setCodeL(0);
nextInt123C = 6;
}
else if(honaData[Ind] == 0xEEEEEEEE)
{
break;
}
if(nextInt123C == packetLenInt123C)
{
@ -432,6 +443,10 @@ quint32 HonaLowLevelAPI::hsruParserRes123C(const QVector<quint32>& honaData,
nextRes123C = 6;
}
else if(honaData[Ind] == 0xEEEEEEEE)
{
break;
}
if(nextRes123C == packetLenRes123C)
{
@ -513,8 +528,7 @@ quint32 HonaLowLevelAPI::hsruParserIntS(const QVector<quint32>& honaData,
else if(((honaData[Ind] & 0xF0000000) == 0x60000000) && (nextIntS == 6))
{
tempHonaPacketIntS.setCodeM(tempHonaPacketIntS.getCodeM() +
(static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) <<
36);
((static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << 36));
tempHonaPacketIntS.setCodeL(0);
nextIntS = 7;
}
@ -527,10 +541,13 @@ quint32 HonaLowLevelAPI::hsruParserIntS(const QVector<quint32>& honaData,
else if(((honaData[Ind] & 0xF0000000) == 0x80000000) && (nextIntS == 8))
{
tempHonaPacketIntS.setCodeM(tempHonaPacketIntS.getCodeM() +
(static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) <<
36);
((static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << 36));
nextIntS = 9;
}
else if(honaData[Ind] == 0xEEEEEEEE)
{
break;
}
if(nextIntS == packetLenIntS)
{
@ -613,8 +630,7 @@ quint32 HonaLowLevelAPI::hsruParserResS(const QVector<quint32>& honaData,
else if(((honaData[Ind] & 0xF0000000) == 0x60000000) && (nextResS == 6))
{
tempHonaPacketResS.setCodeM(tempHonaPacketResS.getCodeM() +
(static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) <<
36);
((static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << 36));
tempHonaPacketResS.setCodeL(0);
nextResS = 7;
}
@ -627,10 +643,14 @@ quint32 HonaLowLevelAPI::hsruParserResS(const QVector<quint32>& honaData,
else if(((honaData[Ind] & 0xF0000000) == 0x80000000) && (nextResS == 8))
{
tempHonaPacketResS.setCodeM(tempHonaPacketResS.getCodeM() +
(static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) <<
36);
((static_cast<quint64>(honaData[Ind] & 0x0FFFFFFF)) << 36));
nextResS = 9;
}
else if(honaData[Ind] == 0xEEEEEEEE)
{
break;
}
if(nextResS == packetLenResS)
{
if(isValid(tempHonaPacketResS))
@ -710,6 +730,10 @@ quint32 HonaLowLevelAPI::hsruParserInt4(const QVector<quint32>& honaData,
tempHonaPacketInt4.setm4Status(static_cast<quint8>((honaData[Ind] & 0x0F000000) >> 20));
nextInt4 = 7;
}
else if(honaData[Ind] == 0xEEEEEEEE)
{
break;
}
if(nextInt4 == packetLenInt4)
{
@ -775,6 +799,10 @@ quint32 HonaLowLevelAPI::hsruParserRes4(const QVector<quint32>& honaData,
((honaData[Ind] & 0x00F00000) >> 8));
nextRes4 = 5;
}
else if(honaData[Ind] == 0xEEEEEEEE)
{
break;
}
if(nextRes4 == packetLenRes4)
{
@ -818,14 +846,14 @@ quint32 HonaLowLevelAPI::hsruParserSinglePulse(const QVector<quint32>& honaData,
else if(((honaData[Ind] & 0xF0000000) == 0x10000000) && (nextSinglePulse == 1))
{
tempHonaPacketSinglePulse.setToa(static_cast<quint64>(honaData[Ind] &
0x0FFFFFFF));
0x0FFFFFFF));
nextSinglePulse = 2;
}
else if(((honaData[Ind] & 0xF0000000) == 0x20000000) && (nextSinglePulse == 2))
{
tempHonaPacketSinglePulse.setToa(tempHonaPacketSinglePulse.getToa() +
((static_cast<quint64>(honaData[Ind] &
0x0000FFFF)) << 28));
0x0000FFFF)) << 28));
tempHonaPacketSinglePulse.setPa2((honaData[Ind] & 0x0FFF0000) >> 16);
nextSinglePulse = 3;
}
@ -844,6 +872,10 @@ quint32 HonaLowLevelAPI::hsruParserSinglePulse(const QVector<quint32>& honaData,
((honaData[Ind] & 0x00F00000) >> 8));
nextSinglePulse = 5;
}
else if(honaData[Ind] == 0xEEEEEEEE)
{
break;
}
if(nextSinglePulse == packetLenSinglePulse)
{
@ -889,10 +921,10 @@ QVector<quint32> HonaLowLevelAPI::hsruReadHonaBuffer(honaReceivers receiver)
throw HonaException();
}
// qDebug() << " hsruReadHonaBuffer receiver "<< receiver;
// for(auto i = 0 ; i < 10; i++)
// qDebug() << "[" << i << "] " << "0x" << QString::number(honaData[i], 16);
// qDebug() << "------------------------------------------------------------";
qDebug() << " hsruReadHonaBuffer receiver "<< receiver;
for(auto i = 0 ; i < 10; i++)
qDebug() << "[" << i << "] " << "0x" << QString::number(honaData[i], 16);
qDebug() << "------------------------------------------------------------";
return honaData;
}

4
Test/MainWindow.cpp

@ -7,6 +7,10 @@ MainWindow::MainWindow(QWidget* parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
// system("sudo PlxSdk/Bin/Plx_load 9054 d");
// system("echo jangal28 | sudo -S gedit");
ui->setupUi(this);
connect(&_honaAPI, &HonaAPI::honaDataResult, this, &MainWindow::honaDataResultUi);
}

Loading…
Cancel
Save