init
This commit is contained in:
17
device/exception/exceptioncode.h
Normal file
17
device/exception/exceptioncode.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef EXCEPTIONCODE_H
|
||||
#define EXCEPTIONCODE_H
|
||||
|
||||
#define DEV_INIT_FAIL 10000 //控制初始化失败
|
||||
#define RESET_FAIL 10001 //复位失败
|
||||
#define IS_MOVE_VEL_SET_FAIL 10002 //轴移动中,速度设置失败
|
||||
#define IS_MOVE_DISEN_FAIL 10003 //轴移动中,取消使能失败
|
||||
#define IS_MOVE_CMD_FAIL 10004 //轴移动中,命令执行失败
|
||||
#define DEV_NOT_INIT 10005 //设备未初始化
|
||||
#define AXIS_NOT_RESET 10006 //轴未复位
|
||||
#define DEV_NOT_RESET 10007 //设备未完成复位
|
||||
#define MRCH_NOT_CALIB 10008
|
||||
#define MACHCODEPATHISEMPT 10009
|
||||
#define WRITE_LOG_FAIL 10002
|
||||
|
||||
|
||||
#endif // EXCEPTIONCODE_H
|
||||
70
device/exception/myexception.cpp
Normal file
70
device/exception/myexception.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
#include "myexception.h"
|
||||
|
||||
MyException::MyException(ExceptLevel value)
|
||||
{
|
||||
exceptInfo = QString("");
|
||||
level = value;
|
||||
exceptCode = NOTHING;
|
||||
}
|
||||
|
||||
MyException::MyException(const QString& text,ExceptLevel value)
|
||||
{
|
||||
exceptInfo = text;
|
||||
level = value;
|
||||
exceptCode = NOTHING;
|
||||
}
|
||||
|
||||
MyException::MyException(int exceptCodeValue,ExceptLevel value)
|
||||
{
|
||||
exceptCode = exceptCodeValue;
|
||||
level = value;
|
||||
exceptInfo = QString("");
|
||||
}
|
||||
|
||||
MyException::MyException(QString text,int exceptCodeValue,ExceptLevel value)
|
||||
{
|
||||
exceptInfo = text;
|
||||
exceptCode = exceptCodeValue;
|
||||
level = value;
|
||||
}
|
||||
|
||||
void MyException::setExceptLevel(ExceptLevel levelValue)
|
||||
{
|
||||
level = levelValue;
|
||||
}
|
||||
|
||||
QString MyException::getExceptInfo()
|
||||
{
|
||||
return exceptInfo;
|
||||
}
|
||||
|
||||
QString MyException::getExceptInfoWithExceptCode()
|
||||
{
|
||||
return exceptInfo+getExceptCodeText();
|
||||
}
|
||||
|
||||
int MyException::getExceptCode()
|
||||
{
|
||||
return exceptCode;
|
||||
}
|
||||
void MyException::setExceptCode(int value)
|
||||
{
|
||||
exceptCode = value;
|
||||
}
|
||||
|
||||
ExceptLevel MyException::getExceptLevel()
|
||||
{
|
||||
return level;
|
||||
}
|
||||
|
||||
void MyException::setExceptInfo(QString text)
|
||||
{
|
||||
exceptInfo = text;
|
||||
}
|
||||
|
||||
QString MyException::getExceptCodeText()
|
||||
{
|
||||
return QString(" 异常代码为:%1").arg(exceptCode);
|
||||
}
|
||||
|
||||
|
||||
33
device/exception/myexception.h
Normal file
33
device/exception/myexception.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef MYEXCEPTION_H
|
||||
#define MYEXCEPTION_H
|
||||
#include <QString>
|
||||
|
||||
#define NOTHING 50000
|
||||
enum ExceptLevel {MY_WARN,
|
||||
MY_CRITICAL };
|
||||
|
||||
class MyException
|
||||
{
|
||||
public:
|
||||
MyException(ExceptLevel value = MY_CRITICAL);
|
||||
MyException(const QString& text,ExceptLevel value = MY_CRITICAL);
|
||||
MyException(int exceptCodeValue,ExceptLevel value = MY_CRITICAL);
|
||||
MyException(QString text,int exceptCodeValue,ExceptLevel value = MY_CRITICAL);
|
||||
void setExceptLevel(ExceptLevel levelValue);
|
||||
ExceptLevel getExceptLevel();
|
||||
void setExceptInfo(QString text);
|
||||
QString getExceptInfo();
|
||||
QString getExceptInfoWithExceptCode();
|
||||
int getExceptCode();
|
||||
void setExceptCode(int value);
|
||||
private:
|
||||
QString getExceptCodeText();
|
||||
|
||||
private:
|
||||
QString exceptInfo;
|
||||
ExceptLevel level;
|
||||
int exceptCode;
|
||||
|
||||
};
|
||||
|
||||
#endif // MYEXCEPTION_H
|
||||
Reference in New Issue
Block a user