#ifndef HONALOWLEVELAPI_H #define HONALOWLEVELAPI_H #include #include #include #include #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 honaPacketList; QMutex _mutex; int _threadSforValue = 0; bool _isHsruMainThreadFree = false; bool _isHsruReaderThreadFree = false; bool _isHsruUpdateThreadFree = false; bool _isHiruReaderThreadFree = false; bool _isHiruUpdateThreadFree = false; QVector 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: quint64 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& honaData, QList& honaPacketList); quint32 hsruParserRes123C(const QVector& honaData, QList& honaPacketList); quint32 hsruParserIntS(const QVector& honaData, QList& honaPacketList); quint32 hsruParserResS(const QVector& honaData, QList& honaPacketList); quint32 hsruParserInt4(const QVector& honaData, QList& honaPacketList); quint32 hsruParserRes4(const QVector& honaData, QList& honaPacketList); quint32 hsruParserSinglePulse(const QVector& honaData, QList& honaPacketList); QVector hsruReadHonaBuffer(honaReceivers receiver); bool isValid(HonaPacket hp); public: signals: void lowLevelHonaData(QList honaPacketList, quint32 hsruLoss, quint32 Doa); //uncrustify off public slots: //uncrustify on }; #endif //HONALOWLEVELAPI_H