public static int AlarmSignalLength(uint ascanNum, GateType type, ref GateAlarmSignalLength len) { int error_code; int gateNum = (int)type; uint attr = DaqAttrType.gate[gateNum].AlarmSignalLength; uint val = 0; if (ascanNum < ascanNumMin || ascanNum > ascanNumMax) { error_code = -1; return(error_code); } if (type < gateTypeMin || type > gateTypeMax) { error_code = -1; return(error_code); } error_code = DAQ.daqGet(ascanNum, attr, ref val); if (error_code != (int)PDAQ_ERR.GOOD) { MessageShow.show("Error:Get the Gate alarm signal length failed!", "错误:获取Gate alarm signal length失败!"); } len = (GateAlarmSignalLength)val; return(error_code); }
//需要确定 //public static int AlarmMode(uint ascanNum, uint ascanPort, GateType type, GateAlarmActive active) //{ // int error_code; // int gateNum = (int)type; // uint attr = DaqAttrType.dGate[gateNum].AlarmActive; // uint val = 0; // if (ascanNum < ascanNumMin || ascanNum > ascanNumMax) // { // error_code = -1; // return error_code; // } // if (type < gateTypeMin || type > gateTypeMax) // { // error_code = -1; // return error_code; // } // error_code = DAQ.daqSet(ascanNum, ascanPort, attr, ref val); // if (error_code != (int)PDAQ_ERR.GOOD) // { // MessageShow.show("Error:Get alarm active double gate failed!", "错误:获得门的报警使能失败!"); // } // active = (GateAlarmActive)val; // return error_code; //} public static int AlarmSignalLength(uint ascanNum, uint ascanPort, DGateType type, GateAlarmSignalLength length) { int error_code; int gateNum = (int)type; uint attr = DaqAttrType.dGate[gateNum].AlarmSignalLength; uint val = (uint)length; if (ascanNum < ascanNumMin || ascanNum > ascanNumMax) { error_code = -1; return(error_code); } if (type < gateTypeMin || type > gateTypeMax) { error_code = -1; return(error_code); } error_code = DAQ.daqSet(ascanNum, ascanPort, attr, val); if (error_code != (int)PDAQ_ERR.GOOD) { MessageShow.show("Error:Set alarm singal length of double gate failed!", "错误:设置门的报警信号长度失败!"); } return(error_code); }