Visual Basic (Declaration) | |
---|---|
Public MustInherit Class Status Inherits RemotableObject Implements IPropertyInfo, IPropertyInfo2, IRemoteNotifyPropertyChanged, IRemoteNotifyPropertyInfoChanged |
C# | |
---|---|
public abstract class Status : RemotableObject, IPropertyInfo, IPropertyInfo2, IRemoteNotifyPropertyChanged, IRemoteNotifyPropertyInfoChanged |
C++/CLI | |
---|---|
public ref class Status abstract : public RemotableObject, IPropertyInfo, IPropertyInfo2, IRemoteNotifyPropertyChanged, IRemoteNotifyPropertyInfoChanged |
The StatusBits enumeration contains the status bits that may be set or cleared by the measurement when the measurement is running (or stopped).
The Value property returns the current status.
PositiveMask and NegativeMask are applied to the status as it changes to produce the current values of PositiveValue and NegativeValue. The changes in these Positive/Negative-Values are added into PositiveSummary and NegativeSummary.
The PositiveSummary and NegativeSummary values are cleared when they are read. This means you can watch for transitions of status bits (see second part of example below).
You can also get events on changes in the Summary values by attaching an property change event handler for this class and looking for changes in PositiveValue, NegativeValue and MeasurementError.
See the C# Status Bits Demo for an example of how to query the status bits.
C# | ![]() |
---|---|
Measurement measurement = app.Measurements.SelectedItem; measurement.Pause(); // --- Simple polling loop: for bits that toggle when an operation is finished --- // Example: wait for the recording to finish measurement.Record(); System.Diagnostics.Trace.WriteLine("Waiting for recording to finish..."); bool isRecording = true; while(isRecording) { System.Threading.Thread.Sleep(10); isRecording = measurement.Status.Value.HasFlag(StatusBits.Recording); } System.Diagnostics.Trace.WriteLine("Recording finished."); app.Measurements.SelectedItem.Input.DataFrom = DataSource.Hardware; // --- Polling with masks: for bits that have multiple transitions once the measurement starts --- // Example: wait until the measurement hardware has triggered and then continue with code execution // The WaitTrigger bit will transition to positive some time after the measurement is // started. Once the measurement hardware has triggered, the VSA's WaitTrigger status // bit will transition to negative. We want to catch this negative edge. measurement.Status.NegativeMask = StatusBits.WaitTrigger; // set mask to watch for negative transition // read NegativeSummary once to clear it measurement.Status.NegativeSummary.HasFlag(StatusBits.None); measurement.Restart(); bool triggerHappened = false; System.Diagnostics.Trace.WriteLine("Waiting for trigger..."); while(!triggerHappened) { System.Threading.Thread.Sleep(10); StatusBits negSum = measurement.Status.NegativeSummary; // in case you want to test for multiple bits triggerHappened = negSum.HasFlag(StatusBits.WaitTrigger); } System.Diagnostics.Trace.WriteLine("Triggered."); |
Target Platforms: Windows 11 Professional or Enterprise; Windows 10 Professional, Enterprise, or Education (64-bit)