Class OnlinerBase<T>
Base generic class for onliner types. Instance of OnlinerBase<T> is commonly referred to as 'tag' or 'PLC tag'.
Inheritance
Inherited Members
Namespace: AXSharp.Connector.ValueTypes
Assembly: AXSharp.Connector.dll
Syntax
public abstract class OnlinerBase<T> : OnlinerBase, ITwinPrimitive, ITwinElement, IOnline<T>, IShadow<T>, INotifyPropertyChanged, IValueBoundaries<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
| Edit this page View SourceOnlinerBase()
Allows for parameter-less constructor in derived class.
Declaration
protected OnlinerBase()
OnlinerBase(ITwinObject, string, string)
Creates an instance of OnlinerBase<T>.
Declaration
protected OnlinerBase(ITwinObject parent, string readableTail, string symbolTail)
Parameters
Type | Name | Description |
---|---|---|
ITwinObject | parent | Parent object that creates this instance. |
string | readableTail | HumanReadable tail of this instance. |
string | symbolTail | Symbol tail of this instance. |
Fields
| Edit this page View Sourcevalidator
Holder field for validation rule.
Declaration
protected OnlinerValidationRule<T> validator
Field Value
Type | Description |
---|---|
OnlinerValidationRule<T> |
Properties
| Edit this page View SourceAttributeMaximum
Gets or sets max. value allowed for this tag. If the value is not set the max. value will be the maximum allowed for this type.
note
The value is typically set by attribute in the PLC code
{attribute addProperty Minimum 10}
{attribute addProperty Maximum 50}
_integerVar : INT;
Declaration
public T AttributeMaximum { get; set; }
Property Value
Type | Description |
---|---|
T |
AttributeMinimum
Gets or sets min. value allowed for this tag. If the value is not set the min. value will be the maximum allowed for this type.
note
The value is typically set by attribute in the PLC code
{attribute addProperty Minimum 10}
{attribute addProperty Maximum 50}
_integerVar : INT;
Declaration
public T AttributeMinimum { get; set; }
Property Value
Type | Description |
---|---|
T |
AttributeToolTip
Gets or sets tool tip message for this tag.
Declaration
public string AttributeToolTip { get; set; }
Property Value
Type | Description |
---|---|
string |
AttributeUnits
Gets or sets the attribute units.
Declaration
public string AttributeUnits { get; set; }
Property Value
Type | Description |
---|---|
string |
Cyclic
Gets the value that was read in the last cycle or sets the value to be written in the next cycle.
Declaration
public virtual T Cyclic { get; set; }
Property Value
Type | Description |
---|---|
T |
CyclicToWrite
Gets the value that will be written in the next cycle.
Declaration
protected T CyclicToWrite { get; set; }
Property Value
Type | Description |
---|---|
T |
Edit
Gets the cyclically read value. Setter set the value that will be written in the next cycle. The value is validated prior to performing write operation. The value must fall between InstanceMinValue and InstanceMaxValue, any value outside permissible range will not be written and original value will remain unaltered. Editing of the value invokes EditValue(T, T) which allows for value change logging via EditValueChange delegate.
Declaration
public T Edit { get; set; }
Property Value
Type | Description |
---|---|
T |
EditValueChange
Gets or sets delegate that executes when Edit property is changed.
Declaration
public override OnlinerBase.ValueChangeDelegate EditValueChange { get; set; }
Property Value
Type | Description |
---|---|
OnlinerBase.ValueChangeDelegate |
Overrides
| Edit this page View SourceInstanceMaxValue
Gets the maximum value allowed for this tag. The default max. value is maximum of this type if AttributeMaximum is not set. If the AttributeMaximum property is set then InstanceMaxValue will return its value.
Declaration
public abstract T InstanceMaxValue { get; }
Property Value
Type | Description |
---|---|
T |
InstanceMinValue
Gets the minimal value allowed for this tag. The default min. value is minimum of this type if AttributeMinimum is not set. If the AttributeMinimum property is set then InstanceMinValue will return its value.
Declaration
public abstract T InstanceMinValue { get; }
Property Value
Type | Description |
---|---|
T |
IsSubscribed
Get whether this primitive is subscribed for periodic reading.
Declaration
public bool? IsSubscribed { get; }
Property Value
Type | Description |
---|---|
bool? |
LastValue
Gets the last value retrieved from cyclical or batched reading. Without requesting cyclical read operation on this onliner.
Declaration
public virtual T LastValue { get; }
Property Value
Type | Description |
---|---|
T |
Raw
Gets the raw value read from the controller. The value is not affected by TranslatorBase or StringInterpolator.
Declaration
public virtual T Raw { get; }
Property Value
Type | Description |
---|---|
T |
ReadFromPlcIsRequested
Gets or sets a value indicating whether read from plc is requested.
Declaration
public bool ReadFromPlcIsRequested { get; protected set; }
Property Value
Type | Description |
---|---|
bool |
SetLastValue
Sets LastValue property value. This property should be used only for testing purposes.
Declaration
[Obsolete("Use cyclic instead", false)]
public T SetLastValue { set; }
Property Value
Type | Description |
---|---|
T |
Shadow
Gets or sets shadow placeholder for the value of this instance. Shadow is off line placeholder that does not affect the PLC controller's value of this tag. Shadow values can be written to PLC controller via 'FlushShadowToOnline' method of a respective structure. Online values can be written to its Shadow representation via 'FlushOnlineToShadow' method of the respective structure. The value must fall between InstanceMinValue and InstanceMaxValue, any value outside permissible range will not be set and original value will remain unaltered. Change of the shadow value can be observed via ShadowValueChange delegate.
Declaration
public T Shadow { get; set; }
Property Value
Type | Description |
---|---|
T |
ShadowValueChange
Gets or sets delegate that executed when Shadow property is changed.
Declaration
public override OnlinerBase.ValueChangeDelegate ShadowValueChange { get; set; }
Property Value
Type | Description |
---|---|
OnlinerBase.ValueChangeDelegate |
Overrides
| Edit this page View SourceValidator
Gets the validation rule for this type. Validation occurs only when property Edit is changed.
Declaration
public OnlinerValidationRule<T> Validator { get; }
Property Value
Type | Description |
---|---|
OnlinerValidationRule<T> |
VariableInfo
Gets information about this tag's online variable info.
Declaration
protected ITwinPrimitiveInfo VariableInfo { get; set; }
Property Value
Type | Description |
---|---|
ITwinPrimitiveInfo |
Methods
| Edit this page View SourceFromOnlineToShadow()
Copies the value from the plc to the shadow value holder.
Declaration
public override void FromOnlineToShadow()
Overrides
| Edit this page View SourceFromShadowToOnline()
Copies the value from the shadow value holder to the respective plc variable.
Declaration
public override void FromShadowToOnline()
Overrides
| Edit this page View SourceGetAsync()
Gets the value of this variable from the controller asynchronously.
Declaration
public virtual Task<T> GetAsync()
Returns
Type | Description |
---|---|
Task<T> |
Remarks
This method accesses the item in a single request over communication layer; accessing multiple items may result in performance degradation over the communication interface with the target system. This method is to be used only when you need the item to be read from the PLC and the return the control of the program. Consider using ITwinObjects ReadAsync(ITwinObject) or WriteAsync(ITwinObject) methods for bulk access to entire structures.
GetAsync(CultureInfo)
Gets value translated in give CultureInfo
Declaration
public virtual Task<T> GetAsync(CultureInfo culture = null)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | culture | Culture into which the value should be translated. |
Returns
Type | Description |
---|---|
Task<T> | Translated value. |
GetAttributeToolTip(CultureInfo)
Gets translated tooltip for given CultureInfo
Declaration
public string GetAttributeToolTip(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | culture | Culture used to translate this tooltip |
Returns
Type | Description |
---|---|
string | Translated tooltip |
GetCyclic(CultureInfo)
Gets Cyclic translated with provided CultureInfo
Declaration
public virtual T GetCyclic(CultureInfo culture = null)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | culture | Desired culture. |
Returns
Type | Description |
---|---|
T | Translated value |
GetDeclaringAssembly()
Gets the assembly that declares the instance of this tag.
Declaration
public Assembly GetDeclaringAssembly()
Returns
Type | Description |
---|---|
Assembly |
GetLastAvailableValue()
Declaration
public virtual T GetLastAvailableValue()
Returns
Type | Description |
---|---|
T |
HasWriteAccess()
Get true when this tag has write access.
Declaration
public bool HasWriteAccess()
Returns
Type | Description |
---|---|
bool | The bool. |
InitializeDefaults()
Initializes default value of this generic OnlinerBase<T>.
Declaration
protected static T InitializeDefaults()
Returns
Type | Description |
---|---|
T |
ReadFromItem()
NVI should be implemented in derived class. When implemented in derived class provide reading of the Cyclicvalue for this tag from a stream.
Declaration
protected virtual void ReadFromItem()
SetAsync(T)
Sets the value of this variable to the controller asynchronously.
Declaration
public virtual Task<T> SetAsync(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value |
Returns
Type | Description |
---|---|
Task<T> |
Remarks
This method accesses the item in a single request over communication layer; accessing multiple items may result in performance degradation over the communication interface with the target system. This method is to be used only when you need the item to be read from the PLC and the return the control of the program. Consider using ITwinObjects ReadAsync(ITwinObject) or WriteAsync(ITwinObject) methods for bulk access to entire structures.
UpdateRead(T)
Updates cyclically read value and performs notifications.
Declaration
protected void UpdateRead(T val)
Parameters
Type | Name | Description |
---|---|---|
T | val | Updated value. |
WriteItem()
NVI should be implemented in derived class. When implemented in derived class provide writing of the Cyclicvalue for this tag from a stream.
Declaration
protected virtual void WriteItem()
Events
| Edit this page View SourceShadowValueChangeEvent
Shadow value changed event.
Declaration
public event ValueChangedEventHandlerDelegate ShadowValueChangeEvent
Event Type
Type | Description |
---|---|
ValueChangedEventHandlerDelegate |