Subscribe to references
- Last UpdatedAug 21, 2026
- 2 minute read
DataReferenceSource
The DataReferenceSource class is used to define and subscribe to the reference source, and to receive data from it.
DataReferenceSource
public class DataReferenceSource
{
/// <summary>
/// Initializes a new instance of the DataReferenceSource class.
/// </summary>
/// <param name="referenceString">The reference string</param>
/// <param name="owningObject">The owning object name</param>
/// <param name="dataChangedAction">The action to receive the data/quality change</param>
public DataReferenceSource(string referenceString, string owningObject, Action<DataReference> dataChangedAction);
/// <summary>
/// Initializes a new instance of the DataReferenceSource class.
/// </summary>
/// <param name="referenceString">The reference string</param>
/// <param name="dataChangedAction">The action to receive the data/quality change</param>
public DataReferenceSource(string referenceString, Action<IDataReference> dataChangedAction);
/// <summary>
/// Gets the owning object.
/// </summary>
public string OwningObject { get; }
/// <summary>
/// Gets the reference string.
/// </summary>
public string ReferenceString { get; }
/// <summary>
/// Gets the action to receive the data/quality update.
/// The Action passes the DataReference that triggers the data change.
/// </summary>
public Action<IDataReference> DataChangedAction { get; }
}
DataReference
Once you have subscribed to the DataReferenceSource, you can receive the DataReference from it. The DataReference can then be used to read/write the run-time data.
DataReference
public abstract class DataReference
{
/// <summary>
/// Gets the VTQ of the data item
/// </summary>
public Vtq Vtq { get; }
/// <summary>
/// Initiate the process to write the value to the reference
/// </summary>
/// <param name="value">The value to be written</param>
/// <returns>The status of the initiation process</returns>
public abstract WriteOperationStatus Write(object value);
/// <summary>
/// Initiate the process to write the value to the element of the referenced array.
/// </summary>
/// <param name="value">The value to be written</param>
/// <param name="elementIndex">The index of array element</param>
/// <returns>The status of the initiation process</returns>
public abstract WriteOperationStatus Write(object value, int elementIndex);
/// <summary>
/// Initiate the process to write the value to the reference. System will call back to update the write status there after
/// </summary>
/// <param name="value">The value to be written</param>
/// <param name="writeStatusChangedAction">The call back for the write status. The DataReference is the reference to be written; The StatusSettingType contains the status of the Write operation.</param>
/// <returns>The status of the initiation process</returns>
public abstract WriteOperationStatus Write(object value, Action<DataReference, StatusSettingType> writeStatusChangedAction);
/// <summary>
/// Initiate the process to write the value to the element of the referenced array. System will call back to update the write status there after
/// </summary>
/// <param name="value">The value to be written</param>
/// <param name="elementIndex">The index of array element</param>
/// <param name="writeStatusChangedAction">The call back for the write status. The DataReference is the reference to be written; The StatusSettingType contains the status of the Write operation.</param>
/// <returns>The status of the initiation process</returns>
public abstract WriteOperationStatus Write(object value, int elementIndex, Action<DataReference, StatusSettingType> writeStatusChangedAction);
}