You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.6 KiB
129 lines
3.6 KiB
#ifndef HONALOWLEVELAPI_H
|
|
#define HONALOWLEVELAPI_H
|
|
#include <QObject>
|
|
#include <QMutex>
|
|
#include <QWaitCondition>
|
|
|
|
#include "LowLevel/Setting/Setting.h"
|
|
#include "LowLevel/HonaPacket.h"
|
|
#include "LowLevel/Setting/Setting.h"
|
|
#include "HonaPacket.h"
|
|
#include "LowLevel/Exception/HonaAlreadyStartedException.h"
|
|
#include "LowLevel/Exception/HonaException.h"
|
|
#include "Wrapper/PlxWrapper.h"
|
|
#include "LowLevel/Utils/Utils.h"
|
|
|
|
class HonaLowLevelAPI : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
bool _hsruIsStarted = false;
|
|
bool _hiruIsStarted = false;
|
|
quint32 _hsruLoss;
|
|
HonaSettings _honaSetting;
|
|
QWaitCondition _hsruReadDone, _hsruUpdateAck, _hsruStopEvent, _hiruReadDone0, _hiruCountDone,
|
|
_hiruUpdateAck1;
|
|
|
|
QList<HonaPacket> honaPacketList;
|
|
QMutex _mutex;
|
|
int _threadSforValue = 0;
|
|
bool _isHsruMainThreadFree = false;
|
|
bool _isHsruReaderThreadFree = false;
|
|
bool _isHsruUpdateThreadFree = false;
|
|
|
|
bool _isHiruReaderThreadFree = false;
|
|
bool _isHiruUpdateThreadFree = false;
|
|
QVector<quint32> honaRegisterBuffer;
|
|
PlxWrapper plxWrapper;
|
|
|
|
static quint32 packetLenInt4;
|
|
static quint32 packetLenRes4;
|
|
static quint32 packetLenSinglePulse;
|
|
|
|
static quint32 packetLenInt123C;
|
|
static quint32 packetLenRes123C;
|
|
static quint32 packetLenIntS;
|
|
static quint32 packetLenResS;
|
|
|
|
static quint32 nextInt4;
|
|
static quint32 nextRes4;
|
|
static quint32 nextSinglePulse;
|
|
|
|
static quint32 nextInt123C;
|
|
static quint32 nextRes123C;
|
|
static quint32 nextIntS;
|
|
static quint32 nextResS;
|
|
|
|
quint32 lastPNInt4 = 0;
|
|
quint32 lastPNRes4 = 0;
|
|
quint32 lastPNSinglePulse = 0;
|
|
|
|
quint32 lastPNInt123C = 0;
|
|
quint32 lastPNRes123C = 0;
|
|
quint32 lastPNIntS = 0;
|
|
quint32 lastPNResS = 0;
|
|
|
|
HonaPacket tempHonaPacketInt4;
|
|
HonaPacket tempHonaPacketRes4;
|
|
HonaPacket tempHonaPacketSinglePulse;
|
|
|
|
HonaPacket tempHonaPacketInt123C;
|
|
HonaPacket tempHonaPacketRes123C;
|
|
HonaPacket tempHonaPacketIntS;
|
|
HonaPacket tempHonaPacketResS;
|
|
|
|
public:
|
|
qulonglong toaStartBoard = 0;
|
|
|
|
HonaLowLevelAPI(QObject* parent = nullptr);
|
|
~HonaLowLevelAPI()
|
|
{
|
|
}
|
|
|
|
void deviceReset();
|
|
|
|
void setConfig(HonaSettings& settings);
|
|
HonaSettings getConfig();
|
|
QString getSwVersion();
|
|
QString getDeviceId();
|
|
void hsruStart();
|
|
void hiruStart();
|
|
void hsruStop();
|
|
void init();
|
|
|
|
private:
|
|
void writeSettingToRegisters(HonaSettings& settings);
|
|
void setConfig();
|
|
void hsruMainThread();
|
|
void hsruReadThread();
|
|
void hsruUpdateThread();
|
|
void hiruMainThread();
|
|
void hiruReadThread();
|
|
void hiruUpdateThread();
|
|
quint32 hiruGetDOA();
|
|
|
|
quint32 hsruParserInt123C(const QVector<quint32>& honaData, QList<HonaPacket>& honaPacketList);
|
|
quint32 hsruParserRes123C(const QVector<quint32>& honaData, QList<HonaPacket>& honaPacketList);
|
|
quint32 hsruParserIntS(const QVector<quint32>& honaData, QList<HonaPacket>& honaPacketList);
|
|
quint32 hsruParserResS(const QVector<quint32>& honaData, QList<HonaPacket>& honaPacketList);
|
|
quint32 hsruParserInt4(const QVector<quint32>& honaData, QList<HonaPacket>& honaPacketList);
|
|
quint32 hsruParserRes4(const QVector<quint32>& honaData, QList<HonaPacket>& honaPacketList);
|
|
quint32 hsruParserSinglePulse(const QVector<quint32>& honaData,
|
|
QList<HonaPacket>& honaPacketList);
|
|
|
|
QVector<quint32> hsruReadHonaBuffer(honaReceivers receiver);
|
|
|
|
bool isValid(HonaPacket hp);
|
|
|
|
public:
|
|
|
|
signals:
|
|
void lowLevelHonaData(QList<HonaPacket> &honaPacketList, quint32 hsruLoss, quint32 Doa);
|
|
|
|
//uncrustify off
|
|
public slots:
|
|
//uncrustify on
|
|
};
|
|
|
|
#endif //HONALOWLEVELAPI_H
|
|
|