Browse Source

fix some code

heydari
Alireza 3 years ago
parent
commit
7a5f336957
  1. 23
      Plx/include/LowLevel/Exception/HonaAlreadyStartedException.h
  2. 23
      Plx/include/LowLevel/Exception/HonaBusyException.h
  3. 13
      Plx/include/LowLevel/HonaLowLevelAPI.h
  4. 6
      Plx/src/LowLevel/Exception/HonaAlreadyStartedException.cpp
  5. 6
      Plx/src/LowLevel/Exception/HonaBusyException.cpp
  6. 61
      Plx/src/LowLevel/HonaLowLevelAPI.cpp

23
Plx/include/LowLevel/Exception/HonaAlreadyStartedException.h

@ -1,17 +1,24 @@
#ifndef HONAALREADYSTARTEDEXCEPTION_H #ifndef HONAALREADYSTARTEDEXCEPTION_H
#define HONAALREADYSTARTEDEXCEPTION_H #define HONAALREADYSTARTEDEXCEPTION_H
#include <QObject> #include <QDebug>
#include <QString>
class HonaAlreadyStartedException : public QObject class HonaAlreadyStartedException : public std::exception
{ {
Q_OBJECT private:
public: QString _str;
explicit HonaAlreadyStartedException(QObject *parent = nullptr);
signals: public:
HonaAlreadyStartedException(QString str)
{
_str = str;
}
public slots: virtual const char* what() const throw()
{
return _str.toStdString().c_str();
}
}; };
#endif // HONAALREADYSTARTEDEXCEPTION_H #endif //HONAALREADYSTARTEDEXCEPTION_H

23
Plx/include/LowLevel/Exception/HonaBusyException.h

@ -1,17 +1,24 @@
#ifndef HONABUSYEXCEPTION_H #ifndef HONABUSYEXCEPTION_H
#define HONABUSYEXCEPTION_H #define HONABUSYEXCEPTION_H
#include <QObject> #include <QDebug>
#include <QString>
class HonaBusyException : public QObject class HonaBusyException : public std::exception
{ {
Q_OBJECT private:
public: QString _str;
explicit HonaBusyException(QObject *parent = nullptr);
signals: public:
HonaBusyException(QString str)
{
_str = str;
}
public slots: virtual const char* what() const throw()
{
return _str.toStdString().c_str();
}
}; };
#endif // HONABUSYEXCEPTION_H #endif //HONABUSYEXCEPTION_H

13
Plx/include/LowLevel/HonaLowLevelAPI.h

@ -10,12 +10,17 @@ class HonaLowLevelAPI : public QObject
{ {
Q_OBJECT Q_OBJECT
private:
bool _hsruIsStarted;
bool _hiruIsStarted;
HonaSetting _honaSetting;
public: public:
explicit HonaLowLevelAPI(QObject* parent = nullptr); explicit HonaLowLevelAPI(QObject* parent = nullptr);
bool isHsruStarted(); bool isHsruStarted();
bool isHiruStarted(); bool isHiruStarted();
void deviceReset(); void deviceReset();
void setConfig(HonaSetting& honaSetting); void setConfig(HonaSetting* honaSetting);
HonaSetting getConfig(); HonaSetting getConfig();
QString getSwVersion(); QString getSwVersion();
QString getDeviceId(); QString getDeviceId();
@ -23,6 +28,12 @@ public:
void hiruStart(); void hiruStart();
void init(); void init();
bool getHsruIsStarted() const;
void setHsruIsStarted(bool hsruIsStarted);
bool getHiruIsStarted() const;
void setHiruIsStarted(bool hiruIsStarted);
private: private:
void writeSettingToRegisters(HonaSetting& honaSetting); void writeSettingToRegisters(HonaSetting& honaSetting);
void setConfig(); void setConfig();

6
Plx/src/LowLevel/Exception/HonaAlreadyStartedException.cpp

@ -1,6 +0,0 @@
#include "../../../include/LowLevel/Exception/HonaAlreadyStartedException.h"
HonaAlreadyStartedException::HonaAlreadyStartedException(QObject *parent) : QObject(parent)
{
}

6
Plx/src/LowLevel/Exception/HonaBusyException.cpp

@ -1,6 +0,0 @@
#include "../../../include/LowLevel/Exception/HonaBusyException.h"
HonaBusyException::HonaBusyException(QObject *parent) : QObject(parent)
{
}

61
Plx/src/LowLevel/HonaLowLevelAPI.cpp

@ -1,28 +1,83 @@
#include "../../include/LowLevel/HonaLowLevelAPI.h" #include "../../include/LowLevel/HonaLowLevelAPI.h"
#include "qdebug.h"
#include "QTime"
bool HonaLowLevelAPI::getHsruIsStarted() const
{
return _hsruIsStarted;
}
/*************************************************************************************************/
void HonaLowLevelAPI::setHsruIsStarted(bool hsruIsStarted)
{
_hsruIsStarted = hsruIsStarted;
}
/*************************************************************************************************/
bool HonaLowLevelAPI::getHiruIsStarted() const
{
return _hiruIsStarted;
}
/*************************************************************************************************/
void HonaLowLevelAPI::setHiruIsStarted(bool hiruIsStarted)
{
_hiruIsStarted = hiruIsStarted;
}
/*************************************************************************************************/
HonaLowLevelAPI::HonaLowLevelAPI(QObject* parent) : QObject(parent) HonaLowLevelAPI::HonaLowLevelAPI(QObject* parent) : QObject(parent)
{ {
} }
/*************************************************************************************************/
bool HonaLowLevelAPI::isHsruStarted() bool HonaLowLevelAPI::isHsruStarted()
{ {
return true; return getHsruIsStarted();
} }
/*************************************************************************************************/ /*************************************************************************************************/
bool HonaLowLevelAPI::isHiruStarted() bool HonaLowLevelAPI::isHiruStarted()
{ {
return true; return getHiruIsStarted();
} }
/*************************************************************************************************/ /*************************************************************************************************/
void HonaLowLevelAPI::deviceReset() void HonaLowLevelAPI::deviceReset()
{ {
/*
QTime t;
t.elapsed()
PLX_STATUS status = base.DeviceReset();
qDebug() << "Board Reseted, status: " + status.ToString());
if (status == PLX_STATUS.ApiSuccess)
{
toaStartBoard = (ulong) (DateTime.Now.Ticks);
return ApiResult.Success;
}
else
return ApiResult.Error; */
} }
/*************************************************************************************************/ /*************************************************************************************************/
void HonaLowLevelAPI::setConfig(HonaSetting& honaSetting) void HonaLowLevelAPI::setConfig(HonaSetting* honaSetting)
{ {
//Initial State Checking
/*
HonaRegisterBuffer = new uint[8]; // Mode4 :: changed from 5 to 8 by H.H
DeviceReadRegisters(0x10000000, ref HonaRegisterBuffer);
_honaSetting = Settings;
HonaFillRegisters(Settings);
DeviceWriteRegisters(0x10000000, HonaRegisterBuffer);
HonaRegisterBuffer = new uint[8]; // Mode4 :: changed from 5 to 8 by H.H
DeviceReadRegisters(0x10000000, ref HonaRegisterBuffer);
return ApiResult.Success; */
} }
/*************************************************************************************************/ /*************************************************************************************************/

Loading…
Cancel
Save