public static string ReadMachineStatus(ushort handle) { Utility.CncMachineState _cncMachineState = Utility.CncMachineState.Unknown; FocasLibBase.ODBST a = new FocasLibBase.ODBST(); FocasLib.cnc_statinfo(handle, a); return(Utility.GetMachineStatus(out _cncMachineState, a)); }
public static string GetMachineStatus(out Utility.CncMachineState _cncMachineState, FocasLibBase.ODBST odbst) { string str = string.Empty; _cncMachineState = Utility.CncMachineState.Unknown; return(GetMachineStatusSeriesDefault(odbst, ref _cncMachineState)); }
private static string GetMachineStatusSeriesDefault(FocasLibBase.ODBST odbst, ref Utility.CncMachineState _cncMachineState) { string str = string.Empty; if ((odbst.emergency != 0)) { _cncMachineState = Utility.CncMachineState.Unavailable; str = "Unavailable"; if (odbst.emergency != 0) { return("Emergency"); } //if (odbst.alarm != 0) //{ // str = "Alarm"; //} return(str); } //if (odbst.aut == 1 || odbst.aut == 10) { switch (odbst.run) { case 0: _cncMachineState = Utility.CncMachineState.Idle; return("Idle"); case 1: _cncMachineState = Utility.CncMachineState.Unavailable; return("STOP"); case 2: _cncMachineState = Utility.CncMachineState.FeedHold; return("Feed Hold"); case 3: _cncMachineState = Utility.CncMachineState.InCycle; return("In Cycle"); case 4: _cncMachineState = Utility.CncMachineState.InCycle; return("MSTR"); } _cncMachineState = Utility.CncMachineState.Unknown; return("Code: " + odbst.run.ToString()); } _cncMachineState = Utility.CncMachineState.Unavailable; return("Unavailable"); }