public void FrequencyFilter(int filter, string channel) { HandlerError.ClearErrors(); try { switch (filter) { case 0: WriteCommand("SENS:VOLT:AC:BAND 3, (@" + channel + ")"); break; case 1: WriteCommand("SENS:VOLT:AC:BAND 20, (@" + channel + ")"); break; case 2: WriteCommand("SENS:VOLT:AC:BAND 200, (@" + channel + ")"); break; } } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "command Agilent Method. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
private async Task Handle(EventData eventData) { try { HConsole.WriteLine(this, $"Handle event, correlation:{eventData.Message.CorrelationId} queue:{eventData.PartitionId}"); await eventData.Subscription.HandleAsync(eventData.Message).CfAwait(); } catch (Exception e) { HConsole.WriteLine(this, "Handler has thrown."); Interlocked.Increment(ref _exceptionCount); var args = new DistributedEventExceptionEventArgs(e, eventData.Message); var correlationId = eventData.Message.CorrelationId; try { HandlerError?.Invoke(this, args); } catch (Exception ee) { var ae = new AggregateException(e, ee); _logger.LogError(ae, $"An event handler [{correlationId}] has thrown an unhandled exception. " + "In addition, the error handler has also thrown an exception."); } if (!args.Handled) { Interlocked.Increment(ref _unhandledExceptionCount); _logger.LogError(e, $"An event handler [{correlationId}] has thrown an unhandled exception."); } } }
public ResponseError Validate() { string fieldsValidation = ValidateModelFields(); _responseError.ContainsError = false; if (!string.IsNullOrEmpty(fieldsValidation)) { fieldsValidation = HandlerError.GetErrorDescription(ConstantError.MISSING_FIELDS, fieldsValidation); _responseError.Message = fieldsValidation; _responseError.ErrorCode = ConstantError.MISSING_FIELDS; _responseError.ContainsError = true; } else if (_userRepository.VerifyIfExists(Email)) { _responseError.Message = "E-mail already exists"; _responseError.ErrorCode = ConstantError.EMAIL_ALREADY_EXISTS; _responseError.ContainsError = true; } else if (!ValidateEmail()) { _responseError.Message = "Email is not valid"; _responseError.ErrorCode = ConstantError.INVALID_EMAIL; _responseError.ContainsError = true; } return(_responseError); }
public double GetLowFreq(string channel) { HandlerError.ClearErrors(); double measures = 0; try { //GPIBVisa.WriteCommand("SENS:DIG:DATA:BYTE? (@" + Channel + ")"); WriteCommand("CONF:FREQ (@" + channel + ")"); WriteCommand("SENS:FREQ:RANG:LOW 3, (@" + channel + ")"); WriteCommand("INIT"); WriteCommand("FETCh?"); //System.Threading.Thread.Sleep(2000); ReadCommand(out measures); //return measures; } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } return(measures); }
public StreamCommandFailed(StreamCommand <T> command, HandlerError error, DateTime failedTimeUtc) { Command = command ?? throw new ArgumentNullException(nameof(command)); Error = error ?? throw new ArgumentNullException(nameof(error)); FailedTimeUtc = failedTimeUtc; }
public virtual void Initialization() { HandlerError.ClearErrors(); try { //SeaMaxDeviceHandler = new SeaMAX(); } catch (Exception e) { throw new Exception("SEA LEVEL Error: " + e.Message); } }
/// <summary> /// Clear Device /// </summary> public void ClearDevice() { HandlerError.ClearErrors(); try { ResourceIO.IO.Clear(); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Clear Device command VisaCom Method. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
/// <summary> /// Abort Device /// </summary> public void Abort() { HandlerError.ClearErrors(); try { ResourceIO.WriteString("ABOR", true); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Abort command VisaCom Method. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
/// <summary> /// Poll /// </summary> public void Poll() { HandlerError.ClearErrors(); try { ResourceIO.WriteString("*STB?", true); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Find Device command VisaCom Method. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void UnLatchInputs(string channels) { HandlerError.ClearErrors(); try { OpenChannel(channels); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void SetMeasure(MeasType command, string channel) { HandlerError.ClearErrors(); try { WriteCommand(MeasureType.SetMeasure(command) + " (@" + channel + ")"); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void ClearScan() { HandlerError.ClearErrors(); try { WriteCommand("ROUT:SCAN (@)"); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void Latch(string commands) { HandlerError.ClearErrors(); try { CloseChannel(commands); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
/// <summary> /// Reset Device /// </summary> public void Reset() { HandlerError.ClearErrors(); try { WriteCommand("*RST"); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Reset command VisaCom Method. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void EnableOutput(InputType onOff) { HandlerError.ClearErrors(); try { WriteCommand(MeasureType.EnableOutput(onOff)); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Enabled OutPut command Agilent Method. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void SetMeasure(MeasType command) { HandlerError.ClearErrors(); try { WriteCommand(MeasureType.SetMeasure(command)); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34401A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void SetCurrent(string sValue) { HandlerError.ClearErrors(); try { WriteCommand("CURR " + sValue); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Set Current command Agilent Method. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void Close() { HandlerError.ClearErrors(); try { _serialPort.Close(); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Closed port. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
/// <summary> /// Write to COM /// </summary> /// <param name="data">data</param> protected void WriteCom(string data) { HandlerError.ClearErrors(); try { WriteCommand(data); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Write COM resource method. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void Write(string message) { HandlerError.ClearErrors(); try { _serialPort.Write(message); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Write port. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
public virtual void Initialization() { HandlerError.ClearErrors(); try { _serialPort = new SerialPort(PortName, BaudRate, Parity, DataBits, StopBits); _serialPort.DataReceived += DataReceivedHandler; } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Open port. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void SM_Close() { HandlerError.ClearErrors(); try { SeaMaxDeviceHandler.SM_Close(); } catch (Exception e) { HandlerError.ErrorCode = -1; HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Close Returned Error Code: " + HandlerError.ErrorCode + ", when try to Open Port"; throw new Exception(e.Message); } }
/// <summary> /// Clean the Device Buffer /// </summary> public void Flush() { HandlerError.ClearErrors(); try { ResourceIO.FlushWrite(false); ResourceIO.IO.Clear(); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Flush command VisaCom Method. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
private void OpenChannel(string channel) { HandlerError.ClearErrors(); try { WriteCommand("ROUT:OPEN (@" + channel + ")"); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
/// <summary> /// Triger Device /// </summary> public void Trigger() { HandlerError.ClearErrors(); try { ResourceIO.IO.AssertTrigger(Ivi.Visa.Interop.TriggerProtocol.TRIG_PROT_ON); HandlerCpu.Delay(1); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Trigger command VisaCom Method. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
/// <summary> /// Read COM /// </summary> /// <returns>Get COM</returns> protected string ReadCom() { HandlerError.ClearErrors(); var buffer = ""; try { buffer = ReadCommand(); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Read COM resource method. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } return(buffer); }
public void SetDelay(string channel, double dDelay) { HandlerError.ClearErrors(); var val = ""; dDelay.ToString(val); try { WriteCommand("ROUT:CHAN:DEL " + val + ", (@" + channel + ")"); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }
public void Open() { HandlerError.ClearErrors(); try { if (_serialPort.IsOpen) { throw new Exception("its Open the ports"); } _serialPort.Open(); } catch (Exception ex) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Open port. " + ex.Message; throw new Exception(HandlerError.ErrorMsg); } }
public double GetMeasure(MeasType command, int channel) { HandlerError.ClearErrors(); double measures = 0; try { WriteCommand(MeasureType.GetMeasure(command) + " (@" + channel + ")"); ReadCommand(out measures); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } return(measures); }
public double Fetch() { HandlerError.ClearErrors(); try { WriteCommand("INIT"); WriteCommand("FETCh?"); double measure = 0; ReadCommand(out measure); return(measure); } catch (Exception e) { HandlerError.ErrorOccurred = true; HandlerError.ErrorMsg = "Data Adquisition Agilent 34970A. " + e.Message; throw new Exception(HandlerError.ErrorMsg); } }