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.
 
 
 

133 lines
3.6 KiB

#ifndef HONALOWLEVELAPI_H
#define HONALOWLEVELAPI_H
#include <QObject>
#include "include/LowLevel/Setting/Setting.h"
#include "include/LowLevel/HonaPacket.h"
#include "LowLevel/Setting/Setting.h"
#include "HonaPacket.h"
#include "QWaitCondition"
#include "QMutex"
#include "include/LowLevel/Exception/HonaAlreadyStartedException.h"
#include "include/LowLevel/Exception/HonaException.h"
#include "include/Wrapper/PlxWrapper.h"
#include "include/LowLevel/Utils/Utils.h"
class HonaLowLevelAPI : public QObject
{
Q_OBJECT
private:
bool _hsruIsStarted;
bool _hiruIsStarted;
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;
public:
explicit HonaLowLevelAPI(QObject* parent = nullptr);
bool isHsruStarted();
bool isHiruStarted();
void deviceReset();
void setConfig(HonaSettings& settings);
HonaSettings getConfig();
QString getSwVersion();
QString getDeviceId();
void hsruStart();
void hiruStart();
void hsruStop();
void init();
bool getHsruIsStarted() const;
void setHsruIsStarted(bool hsruIsStarted);
bool getHiruIsStarted() const;
void setHiruIsStarted(bool hiruIsStarted);
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);
signals:
void signalToTop(QList<HonaPacket> honaPacketList, quint32 i, quint32 j);
//uncrustify off
public slots:
//uncrustify on
};
#endif //HONALOWLEVELAPI_H