111 lines
2.4 KiB
C++
111 lines
2.4 KiB
C++
|
#include "machinetypefun.h"
|
||
|
|
||
|
MachineTypeFun::MachineTypeFun(QObject *parent) : QObject(parent)
|
||
|
{
|
||
|
m_allParasList.clear();
|
||
|
m_allOutCtrlList.clear();
|
||
|
m_allShortCutList.clear();
|
||
|
m_allAssistList.clear();
|
||
|
m_allPatternSetList.clear();
|
||
|
m_allParaSetList.clear();
|
||
|
m_allSensorList.clear();
|
||
|
m_allErrorCodeAndStateList.clear();
|
||
|
m_allDebugFunList.clear();
|
||
|
|
||
|
initAllSensorList();
|
||
|
}
|
||
|
|
||
|
MachineTypeFun::~MachineTypeFun()
|
||
|
{
|
||
|
m_allParasList.clear();
|
||
|
m_allOutCtrlList.clear();
|
||
|
m_allShortCutList.clear();
|
||
|
m_allAssistList.clear();
|
||
|
m_allPatternSetList.clear();
|
||
|
m_allParaSetList.clear();
|
||
|
m_allSensorList.clear();
|
||
|
m_allErrorCodeAndStateList.clear();
|
||
|
m_allDebugFunList.clear();
|
||
|
}
|
||
|
|
||
|
//获取传感器列表
|
||
|
QList<SensorItem> MachineTypeFun::getSensorList()
|
||
|
{
|
||
|
return m_allSensorList;
|
||
|
}
|
||
|
|
||
|
//获取错误代码列表
|
||
|
QList<ErrorCodeStateItem> MachineTypeFun::getErrorCodeAndStateList()
|
||
|
{
|
||
|
return m_allErrorCodeAndStateList;
|
||
|
}
|
||
|
|
||
|
//获取调试功能
|
||
|
QList<DebugItem> MachineTypeFun::getDebugFunList()
|
||
|
{
|
||
|
return m_allDebugFunList;
|
||
|
}
|
||
|
|
||
|
void MachineTypeFun::initAllSensorList()
|
||
|
{
|
||
|
//所有传感器列表,字符为空
|
||
|
m_allSensorList.clear();
|
||
|
int addr, byteaddr, bitaddr;
|
||
|
|
||
|
SensorItem item;
|
||
|
|
||
|
for (addr = 0; addr < MAX_SENSOR_NUM; addr++)
|
||
|
{
|
||
|
byteaddr = addr / 8;
|
||
|
bitaddr = addr % 8; //(0-7)
|
||
|
item.setItemValue(byteaddr, bitaddr, "");
|
||
|
m_allSensorList.append(item);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
QList<ParaSetItem> MachineTypeFun::getParaSetListByFilter()
|
||
|
{
|
||
|
return m_allParaSetList;
|
||
|
}
|
||
|
|
||
|
QList<PatternSetItem> MachineTypeFun::getPatternSetListByFilter()
|
||
|
{
|
||
|
return m_allPatternSetList;
|
||
|
}
|
||
|
|
||
|
QList<AssistItem> MachineTypeFun::getAssistListByFilter()
|
||
|
{
|
||
|
return m_allAssistList;
|
||
|
}
|
||
|
|
||
|
QList<ShortCutItem> MachineTypeFun::getShortCutListByFilter()
|
||
|
{
|
||
|
return m_allShortCutList;
|
||
|
}
|
||
|
|
||
|
QList<OutCtrlItem> MachineTypeFun::getOutCtrlListByFilter()
|
||
|
{
|
||
|
return m_allOutCtrlList;
|
||
|
}
|
||
|
|
||
|
QList<ParaItem> MachineTypeFun::getParasListByMcSel()
|
||
|
{
|
||
|
QList <ParaItem> paralist;
|
||
|
int size = m_allParasList.size();
|
||
|
|
||
|
for (int i = 0; i < size; i++)
|
||
|
{
|
||
|
const ParaItem & item = m_allParasList.at(i);
|
||
|
paralist.append(item);
|
||
|
#if(0)
|
||
|
if ((item.mcenSel & mcensel) != 0)
|
||
|
{
|
||
|
paralist.append(item);
|
||
|
}
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
qStableSort(paralist.begin(), paralist.end(), comparePriority);
|
||
|
return paralist;
|
||
|
}
|