private ErrorInfo.ErrorCode ProcessOneEvent(MessageContainer message) { ErrorInfo.ErrorCode errorCode = ErrorInfo.ErrorCode.NoErrors; if (message == null || message.Message == null) { errorCode = _outputManagement.SetAllOff(); Logger.Log("message null"); Thread.Sleep(1000); Environment.Exit(1); } else if (message.Message is MsgSingleOuput) { var msg = message.Message as MsgSingleOuput; errorCode = _outputManagement.Set(msg.DigiPortType, msg.OutputID, msg.DigiLogicState); } else if (message.Message is MsgTurnAllOff) { errorCode = _outputManagement.SetAllOff(); } else if (message.Message is MsgExit) { errorCode = _outputManagement.SetAllOff(); Thread.Sleep(1000); Environment.Exit(0); } return(errorCode); }
private void ProcessErrorAndResponse(ErrorInfo.ErrorCode errorCode, MessageContainer message) { if (ClientConnected) { var response = new MsgResponse { ErrorCode = errorCode, Message = message.Message }; _server.PushMessage(new MessageContainer(response)); } if (errorCode != ErrorInfo.ErrorCode.NoErrors) { for (int i = 0; i < 5; i++) { var err = _outputManagement.SetAllOff(); if (err == ErrorInfo.ErrorCode.NoErrors) { break; } System.Threading.Thread.Sleep(200); } Logger.Log("ProcessErrorAndResponse: " + errorCode.ToString()); System.Threading.Thread.Sleep(2000); Environment.Exit(1); } }
public void Write(double voltage) { ErrorInfo result = board.VOut(0, Range.Bip10Volts, (float)voltage, options); ErrorInfo.ErrorCode code = result.Value; if (code != ErrorInfo.ErrorCode.NoErrors) { logger.Error("Omega Error: " + result.Message); } }