Class PolledValues
- Namespace
- Acuit.Pinpoint.Workflows.Testing.Activities
- Assembly
- Acuit.Pinpoint.Workflows.Testing.dll
Produces a data source that polls a value, which can be used by other activities like samplers.
public class PolledValues : Activity<IDataSource>, IActivity
- Inheritance
-
PolledValues
- Implements
- Inherited Members
Constructors
PolledValues()
public PolledValues()
Properties
DataSourceDisplayName
Gets or sets the optional human-readable name of the data source (e.g., a reading name), or null if there is none.
public ValueSource<string?>? DataSourceDisplayName { get; set; }
Property Value
Remarks
This should be in title case (for example, "Gas Pressure").
PollPeriod
Gets or sets the period at which to poll the value. This is required and must be greater than or equal to zero.
public ValueSource<TimeSpan>? PollPeriod { get; set; }
Property Value
Precision
Gets or sets the optional precision of data values to use for this data source's data value descriptor. This should only be used when the data values are numeric and is specified as the number of digits after the decimal point, where negative values indicate the number of digits before the decimal point.
public ValueSource<int?>? Precision { get; set; }
Property Value
Remarks
If neither Units nor Precision is specified, then the data value descriptor of the first value will be used to determine the units and precision. Data values without descriptors will be treated as basic values with no units and default formatting.
If either Units or Precision is specified, then a custom data value descriptor will be used for this data source based on those values, and any data value descriptors provided by the polled values will be ignored.
Units
Gets or sets the optional units of measurement to use for this data source's data value descriptor.
public ValueSource<string?>? Units { get; set; }
Property Value
Remarks
If neither Units nor Precision is specified, then the data value descriptor of the first value will be used to determine the units and precision. Data values without descriptors will be treated as basic values with no units and default formatting.
If either Units or Precision is specified, then a custom data value descriptor will be used for this data source based on those values, and any data value descriptors provided by the polled values will be ignored.
Value
Gets or sets the value to poll. This is required, but it can evaluate to null.
public ValueSource? Value { get; set; }
Property Value
Remarks
This can come from a variety of sources. Typically, this would be an activity that reads a value from an external device.
Methods
OnExecuteAsync(ActivityContext, CancellationToken)
Derived classes must implement this to perform the activity.
protected override Task<IDataSource> OnExecuteAsync(ActivityContext context, CancellationToken cancellationToken)
Parameters
contextActivityContextThe activity context.
cancellationTokenCancellationTokenThe cancellation token used to request canceling the activity.
Returns
- Task<IDataSource>
A task that represents the asynchronous operation. The value of its Result property contains the result.
Exceptions
- ArgumentNullException
contextis null.- InvalidOperationException
A service required by the activity is not available, or a required activity property value is not set.
- Exception
An error occurred while performing the activity.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Remarks
This is expected to produce a string suitable for labeling this activity in a workflow diagram. It should be as specific as possible, but while keeping it very short. In general, it should be the short name of the class (as that is how it would typically be defined in the workflow XAML), optionally followed by other property values of interest in a diagram. The default implementation returns the short name of the class.