#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_allEmbFunctionList.clear(); m_allSensorList.clear(); m_allErrorCodeAndStateList.clear(); initAllSensorList(); } MachineTypeFun::~MachineTypeFun() { m_allParasList.clear(); m_allOutCtrlList.clear(); m_allShortCutList.clear(); m_allAssistList.clear(); m_allPatternSetList.clear(); m_allParaSetList.clear(); m_allEmbFunctionList.clear(); m_allSensorList.clear(); m_allErrorCodeAndStateList.clear(); } //获取传感器列表 QList MachineTypeFun::getSensorList() { return m_allSensorList; } //获取错误代码列表 QList MachineTypeFun::getErrorCodeAndStateList() { return m_allErrorCodeAndStateList; } 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 MachineTypeFun::getEmbFunctionListByFilter() { return m_allEmbFunctionList; } QList MachineTypeFun::getParaSetListByFilter() { return m_allParaSetList; } QList MachineTypeFun::getPatternSetListByFilter() { return m_allPatternSetList; } QList MachineTypeFun::getAssistListByFilter() { return m_allAssistList; } QList MachineTypeFun::getShortCutListByFilter() { return m_allShortCutList; } QList MachineTypeFun::getOutCtrlListByFilter() { return m_allOutCtrlList; } QList MachineTypeFun::getParasListByMcSel() { QList 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; }