void m_MyStringProperty_OnPreflightSetProperty(SetPropertyEventArgs args) { SetStringPropertyEventArgs stringArgs = args as SetStringPropertyEventArgs; String message = String.Format("New value #{0}#", stringArgs.NewValue); m_MyCmDevice.AuditMessage(AuditLevel.Warning, message); // AuditLevel.Warning so that it shows up in Ready Check Results }
void OnPreflightEnd(PreflightEventArgs args) { // Report the blob content if (args.RunContext.IsSemanticCheck || args.RunContext.IsReadyCheck) { m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnPreflightEnd handler"); ReportBlob(args.RunContext); } }
private void OnSetPosition(SetPropertyEventArgs args) { SetIntPropertyEventArgs setPositionArgs = args as SetIntPropertyEventArgs; if (setPositionArgs.NewValue.HasValue) { m_Position = setPositionArgs.NewValue.Value; m_InjectHandler.PositionProperty.Update(m_Position); } else { m_Device.AuditMessage(AuditLevel.Error, "Invalid position."); } }
private void OnSetFlow(SetPropertyEventArgs args) { SetDoublePropertyEventArgs doubleArgs = args as SetDoublePropertyEventArgs; double newFlow = doubleArgs.NewValue.Value; m_Device.AuditMessage(AuditLevel.Normal, "Flow is set to " + newFlow.ToString() + " ml/min"); m_FlowHandler.FlowNominalProperty.Update(newFlow); // Usually the value would be update from the hardware during some status poll. m_FlowHandler.FlowValueProperty.Update(newFlow); // The pressure would also change somehow. // We emulate this by deriving a pressure form the flow. m_PressureValue.Update(newFlow * 40); }
public void AuditMessage(AuditLevel level, string text, string callerMethodName = null) { if (string.IsNullOrEmpty(callerMethodName)) { callerMethodName = CallerMethodName; } m_Device.AuditMessage(level, text); Log.WriteLine(Id, level, text, callerMethodName); }
/// <summary> /// OnConnect we set up some initial values. /// In a real driver, OnConnect would establish the hardware connection first and /// retrieve the actual hardware status from the hardware. /// </summary> internal void OnConnect() { // Write a message to the audit trail m_MyCmDevice.AuditMessage(AuditLevel.Message, "ExampleDevice.OnConnect()"); // set up the initial values m_EnableClockProperty.Update(0); m_MyString = "Initial value"; // Send the updated string to Chromeleon. m_AnyTextProperty.Update(m_MyString); m_Percentage = 11.11; // Send the updated percentage to Chromeleon. m_PercentageProperty.Update(m_Percentage); // Update the other properties m_FilterTimeConstantProperty.Update(0.0); m_MeasurementRangeProperty.Update(10.0); }
/// <summary> /// OnTransferPfToRun is called when the previously preflighted instrument method is actually started. /// </summary> /// <param name="args">The PreflightEventArgs contain the IRunContext with the ProgramSteps.</param> private void OnTransferPfToRun(PreflightEventArgs args) { m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnTransferPreflightToRun handler OnTransferPfToRun, please wait..."); // We use the IProgramStep interface to walk the list of events in the instrument method. // In a real driver we would need to build some kind of time table and send it to the hardware. // In this example we create a list instead and write it to the audit trail. // Note that the property is not updated, as this would be done asynchronously during the run. StringBuilder sb = new StringBuilder("Table of timed events:\n"); foreach (IProgramStep step in args.RunContext.ProgramSteps) { IPropertyAssignmentStep propertyAssignment = step as IPropertyAssignmentStep; if (propertyAssignment != null) { if (propertyAssignment.Value.Property == m_EventAProperty || propertyAssignment.Value.Property == m_EventBProperty) { IIntPropertyValue value = propertyAssignment.Value as IIntPropertyValue; sb.Append("Retention "); sb.Append(step.Retention.Minutes.ToString("F3")); sb.Append(": "); sb.Append(propertyAssignment.Value.Property.Name); sb.Append("="); sb.Append(value.Value.ToString()); sb.Append("\n"); } } } m_MyCmDevice.AuditMessage(AuditLevel.Message, sb.ToString()); m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnTransferPreflightToRun handler OnTransferPfToRun has finished."); }
/// <summary> /// OnConnect we set up some initial values. /// In a real driver, OnConnect would establish the hardware connection first and /// retrieve the actual hardware status from the hardware. /// </summary> internal void OnConnect() { // Write a message to the audit trail m_MyCmDevice.AuditMessage(AuditLevel.Message, "TimeTableDevice.OnConnect()"); // Send the initial flow to Chromeleon. m_FlowHandler.FlowNominalProperty.Update(0.1); // Send the initial percentage to Chromeleon. m_FlowHandler.ComponentProperties[1].Update(11.11); }
void m_MyCmDevice_OnPreflightBegin(PreflightEventArgs args) { m_MyCmDevice.AuditMessage(AuditLevel.Warning, "OnPreflightBegin handler"); }
private void OnPfTest(SetPropertyEventArgs args) { m_MyCmDevice.AuditMessage(AuditLevel.Warning, args.RunContext.ProgramTime.Minutes.ToString() + " min: OnPreflightSetProperty handler OnPfTest"); }
void simpleProperty_OnSetProperty(SetPropertyEventArgs args) { m_Device.AuditMessage(AuditLevel.Normal, "Device.simpleProperty_OnSetProperty() called"); }
/// <summary> /// Called when the injection has finished. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void m_InjectionTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { m_MyCmDevice.AuditMessage(AuditLevel.Message, "The sampler has finished the injection, sending inject response."); m_InjectHandler.NotifyInjectResponse(); }