#ifndef WORK_THREAD_H
|
#define WORK_THREAD_H
|
|
#include <QThread>
|
#include "rs485_pack.h"
|
#include "rs485_powerctrl.h"
|
#include "Common/app_define.h"
|
#include <QTimer>
|
#include "Common/classxml.h"
|
|
|
|
//#define _debug_demo_
|
|
|
|
extern QStringList alarmStateText;
|
|
|
class Work_Thread : public QThread
|
{
|
Q_OBJECT
|
|
public:
|
Work_Thread();
|
virtual void run();
|
~Work_Thread();
|
|
public:
|
static const int CMD_Null = 0;
|
static const int CMD_StartTest = 1;
|
static const int CMD_StopTest = 2;
|
//static const int CMD_StartDischarge = 1;
|
//static const int CMD_StopDischarge = 2;
|
//static const int CMD_StartCharge = 3;
|
//static const int CMD_StopCharge = 4;
|
static const int CMD_SetTestParam = 5;
|
static const int CMD_SetActivePack = 6;
|
|
|
|
static const int CMD_GetAdjParamSet = 21;
|
static const int CMD_SetAdjParamSet = 22;
|
static const int CMD_AdjStartDis = 23;
|
static const int CMD_AdjStartChr = 24;
|
static const int CMD_AdjStopTest = 25;
|
|
|
static const int CMD_GetVolDropParam = 26;
|
static const int CMD_SetVolDropParam = 27;
|
|
|
static const int RES_OK = 0;
|
static const int RES_Error_MOS_State = -21;
|
|
|
public:
|
|
TEST_PARAM testParam;
|
PACK_PARAM packParam;
|
SYSTEM_PARAM_XML sysParamXml;
|
|
ADJ_PARAM_SET adjParamSet;
|
VOL_DROP_PARAM volDropParam;
|
|
MOD_TEST_DATA modTestData;
|
MOD_TEST_DATA modTestData_Origin;
|
PACK_DATA packData;
|
PACK_DATA packData_Origin;
|
CELL_MAX_MIN cellMaxMInValue;
|
|
ICON_STATE iconState;
|
|
TEST_STATE_DATA testStateData;
|
|
RS485_Pack *rs485_Pack;
|
RS485_PowerCtrl *rs485_PowerCtrl;
|
|
REMOTE_STATE remoteState;
|
|
PASSTHROUGH_ST passthroughState;
|
|
quint8 adjWorkState;
|
|
QString packBarcode;
|
|
|
void setWorkThreadCMD(int cmd);
|
void saveTestParam(TEST_PARAM &testparam);
|
void savePackParam(PACK_PARAM &packparam);
|
void saveSysParam(SYSTEM_PARAM_XML &sysparam);
|
void setRemoteState(REMOTE_STATE &st);
|
void setPackBarcodeStr(QString code);
|
void saveAdjParam(ADJ_PARAM_SET ¶m);
|
void saveVolDropParam(VOL_DROP_PARAM ¶m);
|
void setPassthroughState(PASSTHROUGH_ST &st);
|
|
void setPageIndex(const quint8 pageindex);
|
quint8 getPageIndex(void);
|
|
int startErrorCheck();
|
|
CT_DATE_TIME getTestStartTime();
|
|
private:
|
int workThreadCMD;
|
int cmdExecResult;
|
|
quint8 stateWorkCount;
|
|
QTimer *timer_1s;
|
|
quint8 pageIndex;
|
|
FBO_DATA fboData;
|
CT_DATE_TIME testStartTime;
|
QString testfilename;
|
|
|
void processWorkThreadCMD();
|
|
void initValueForParam(void);
|
|
int initTestState();
|
|
int setTestParam(const quint8 testtype);
|
|
int setIOBoardState(const quint8 testype,bool is_start);
|
|
int setPreChgMos_Close();
|
int setPreChgMos_Break();
|
int setChargeMos_Close();
|
int setChargeMos_Break();
|
int setDischgMos_Close();
|
int setDischgMos_Break();
|
|
int closePrechgMos(void);
|
|
int getMos_State(quint16 *premos,quint16 *chgmos,quint16 *dismos);
|
|
int setMOS_BeforeDischarge();
|
int setMOS_AfterDischarge();
|
int openDischargePower();
|
int closeDischargePower();
|
int startDischarge();
|
int stopDischarge(const quint8 stoptype);
|
|
int setMOS_BeforeCharge();
|
int setMOS_AfterCharge();
|
int openChargePower();
|
int closeChargePower();
|
int startCharge();
|
int stopCharge(const quint8 stoptype);
|
|
int activePackByCharge(void);
|
|
int getAdjParamFromIOBoard(void);
|
int setAdjParamToIOBoard(void);
|
|
int getDropVolParamFromIOBoard(void);
|
int setDropVolParamToIOBoard(void);
|
|
|
void CheckIfStop();
|
|
quint16 getCellVolLowCount(const quint16 celllow);
|
quint16 getCellVolHighCount(const quint16 cellhigh);
|
|
quint16 getCellTempHighCount(const quint16 cellhigh);
|
|
|
void CheckIconState(void);
|
quint8 CheckDiskState(const QString &disk);
|
|
QString format_data_name(void);
|
void initFBO_Data(FBO_DATA_HEAD_START &fbo_data_head_start);
|
void makeFBO_Data(void);
|
void SaveFbo_Data(bool force_save);
|
void closeTestFbo_Data(const quint8 stoptype);
|
|
|
|
signals:
|
void sendCMD_Result(int res);
|
|
private slots:
|
void RecvModTestData(MOD_TEST_DATA testdata);
|
|
void RecvPackData(PACK_DATA packdata);
|
|
void Timer1sSlot(void);
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // WORK_THREAD_H
|