Alireza
3 years ago
14 changed files with 409 additions and 153 deletions
@ -0,0 +1,40 @@ |
|||
#ifndef HONAAPI_H |
|||
#define HONAAPI_H |
|||
|
|||
#include <QObject> |
|||
|
|||
#include "LowLevel/Setting/Setting.h" |
|||
#include "include/LowLevel/Exception/HonaAlreadyStartedException.h" |
|||
#include "include/LowLevel/Exception/HonaException.h" |
|||
#include "include/LowLevel/Utils/Utils.h" |
|||
#include "include/LowLevel/HonaLowLevelAPI.h" |
|||
|
|||
class HonaAPI : public QObject |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
private: |
|||
HonaLowLevelAPI _honaLowLevelAPI; |
|||
|
|||
public: |
|||
explicit HonaAPI(QObject* parent = nullptr); |
|||
ApiResult isHsruStarted(); |
|||
ApiResult isHiruStarted(); |
|||
ApiResult deviceReset(); |
|||
|
|||
ApiResult setConfig(HonaSettings& settings); |
|||
ApiResult getConfig(HonaSettings& settings); |
|||
ApiResult getSwVersion(QString& swVerion); |
|||
ApiResult getDeviceId(QString& deviceId); |
|||
ApiResult hsruStart(); |
|||
ApiResult hiruStart(); |
|||
ApiResult hsruStop(); |
|||
ApiResult init(); |
|||
|
|||
signals: |
|||
//uncrustify off
|
|||
public slots: |
|||
//uncrustify on
|
|||
}; |
|||
|
|||
#endif //HONAAPI_H
|
@ -1,62 +0,0 @@ |
|||
#ifndef HONAPACKET_H |
|||
#define HONAPACKET_H |
|||
|
|||
#include <QtGlobal> |
|||
|
|||
#include "include/LowLevel/Utils/Utils.h" |
|||
|
|||
class HonaPacket |
|||
{ |
|||
private: |
|||
qreal toaClock; |
|||
honaPacketType m_PacketType; |
|||
quint32 m_PacketNumber; |
|||
qulonglong m_Toa; |
|||
quint32 m_Doa; |
|||
quint32 m_Pa1; |
|||
quint32 m_Pa2; |
|||
quint32 m_Pa3; |
|||
quint32 m_Pa4; |
|||
quint32 m_Code; |
|||
quint32 m_CodeL; |
|||
quint32 m_CodeM; |
|||
|
|||
public: |
|||
HonaPacket(); |
|||
/******************************************************************/ |
|||
honaPacketType getPacketType(); |
|||
void setPacketType(honaPacketType temp); |
|||
/******************************************************************/ |
|||
quint32 getPacketNumber(); |
|||
void setPacketNumber(quint32 temp); |
|||
/******************************************************************/ |
|||
qulonglong getToa(); |
|||
void setToa(qulonglong temp); |
|||
/******************************************************************/ |
|||
quint32 getDoa(); |
|||
void setDoa(quint32 temp); |
|||
/******************************************************************/ |
|||
quint32 getPa1(); |
|||
void setPa1(quint32 temp); |
|||
/******************************************************************/ |
|||
quint32 getPa2(); |
|||
void setPa2(quint32 temp); |
|||
/******************************************************************/ |
|||
quint32 getPa3(); |
|||
void setPa3(quint32 temp); |
|||
/******************************************************************/ |
|||
quint32 getPa4(); |
|||
void setPa4(quint32 temp); |
|||
/******************************************************************/ |
|||
quint32 getCode(); |
|||
void setCode(quint32 temp); |
|||
/******************************************************************/ |
|||
quint32 getCodeL(); |
|||
void setCodeL(quint32 temp); |
|||
/******************************************************************/ |
|||
quint32 getCodeM(); |
|||
void setCodeM(quint32 temp); |
|||
/******************************************************************/ |
|||
}; |
|||
|
|||
#endif //HONAPACKET_H |
@ -0,0 +1,183 @@ |
|||
#include "include/API/HonaAPI.h" |
|||
|
|||
HonaAPI::HonaAPI(QObject* parent) : QObject(parent) |
|||
{ |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::isHsruStarted() |
|||
{ |
|||
try { |
|||
if(_honaLowLevelAPI.isHsruStarted()) |
|||
return ApiResult::success; |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::isHiruStarted() |
|||
{ |
|||
try { |
|||
if(_honaLowLevelAPI.isHiruStarted()) |
|||
return ApiResult::success; |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::deviceReset() |
|||
{ |
|||
try { |
|||
_honaLowLevelAPI.deviceReset(); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
catch(HonaAlreadyStartedException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::setConfig(HonaSettings& settings) |
|||
{ |
|||
try { |
|||
_honaLowLevelAPI.setConfig(settings); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
catch(HonaAlreadyStartedException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::getConfig(HonaSettings& settings) |
|||
{ |
|||
try { |
|||
settings = _honaLowLevelAPI.getConfig(); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::getSwVersion(QString& swVerion) |
|||
{ |
|||
try { |
|||
swVerion = _honaLowLevelAPI.getSwVersion(); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::getDeviceId(QString& deviceId) |
|||
{ |
|||
try { |
|||
deviceId = _honaLowLevelAPI.getDeviceId(); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::hsruStart() |
|||
{ |
|||
try { |
|||
_honaLowLevelAPI.hsruStart(); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
catch(HonaAlreadyStartedException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::hiruStart() |
|||
{ |
|||
try { |
|||
_honaLowLevelAPI.hiruStart(); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
catch(HonaAlreadyStartedException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::hsruStop() |
|||
{ |
|||
try { |
|||
_honaLowLevelAPI.hsruStop(); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
catch(HonaAlreadyStartedException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
|||
ApiResult HonaAPI::init() |
|||
{ |
|||
try { |
|||
_honaLowLevelAPI.init(); |
|||
} |
|||
catch(HonaException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
catch(HonaAlreadyStartedException ex) |
|||
{ |
|||
return ApiResult::error; |
|||
} |
|||
|
|||
return ApiResult::success; |
|||
} |
|||
|
|||
/*************************************************************************************************/ |
@ -1,7 +1,7 @@ |
|||
TEMPLATE = subdirs |
|||
|
|||
SUBDIRS += \ |
|||
Plx\ |
|||
Plx \ |
|||
Test |
|||
Test.depends += Plx |
|||
|
|||
|
Loading…
Reference in new issue