Class OnlinerBaseType<T>
Base generic class for onliner types. Instance of OnlinerBaseType<T> is commonly referred to as 'tag' or 'PLC tag'.
Inheritance
System.Object
OnlinerBaseType<T>
Implements
System.ComponentModel.INotifyPropertyChanged
Assembly: Vortex.Connector.dll
Syntax
public abstract class OnlinerBaseType<T> : OnlinerBaseType, IOnline<T>, IShadow<T>, IValueTag, ITwinPrimitive, IVortexElement, INotifyPropertyChanged, IValueBoundaries<T>
Type Parameters
Constructors
OnlinerBaseType()
Allows for parameterless constructor in derived class.
Declaration
protected OnlinerBaseType()
OnlinerBaseType(IVortexObject, String, String)
Declaration
protected OnlinerBaseType(IVortexObject parent, string readableTail, string symbolTail)
Parameters
Type |
Name |
Description |
IVortexObject |
parent |
Parent object that creates this instance.
|
System.String |
readableTail |
HumanReadable tail of this instance.
|
System.String |
symbolTail |
Symbol tail of this instance.
|
Fields
_attributeName
Declaration
Field Value
Type |
Description |
System.String |
|
_humanReadable
Declaration
Field Value
Type |
Description |
System.String |
|
_shadow
Declaration
Field Value
_translator
Declaration
Field Value
Type |
Description |
Vortex.Localizations.Abstractions.ITranslator |
|
attributeMax
Declaration
Field Value
attributeMin
Declaration
Field Value
Declaration
Field Value
Type |
Description |
System.String |
|
cyclic
Field contains last cyclically read value.
Declaration
Field Value
raw
Declaration
Field Value
validator
Holder field for validation rule.
Declaration
protected OnlinerValidationRule<T> validator
Field Value
Properties
AttributeMaximum
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
This example demonstrates how to set value boundaries for a numerical value. AttributeMinimum and AttributeMaximum.
Notice that the name of the 'added property' is prefixed with 'Attribute' when
trans-piled into .net class.
{attribute addProperty Minimum 10}
{attribute addProperty Maximum 50}
_integerVar : INT;
Declaration
public T AttributeMaximum { get; set; }
Property Value
AttributeMaxSet
Declaration
Property Value
Type |
Description |
System.Boolean |
|
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
This example demonstrates how to set value boundaries for a numerical value. AttributeMinimum and AttributeMaximum.
Notice that the name of the 'added property' is prefixed with 'Attribute' when
trans-piled into .net class.
{attribute addProperty Minimum 10}
{attribute addProperty Maximum 50}
_integerVar : INT;
Declaration
public T AttributeMinimum { get; set; }
Property Value
AttributeMinSet
Declaration
Property Value
Type |
Description |
System.Boolean |
|
AttributeName
Gets or sets the attribute name.
Declaration
public string AttributeName { get; set; }
Property Value
Type |
Description |
System.String |
|
Gets or sets tool tip message for this tag.
Declaration
public string AttributeToolTip { get; set; }
Property Value
Type |
Description |
System.String |
|
AttributeUnits
Gets or sets the attribute units.
Declaration
public string AttributeUnits { get; set; }
Property Value
Type |
Description |
System.String |
|
CwCycle
Declaration
Property Value
Type |
Description |
System.Int64 |
|
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
CyclicReading
Gets or sets a value indicating whether cyclic reading of this tag is active.
Declaration
public bool CyclicReading { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
cyclicToWrite
Gets the value that will be written in the next cycle.
Declaration
protected T cyclicToWrite { get; set; }
Property Value
Edit
Gets the cyclicly 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
EditValueChange
Gets or sets delegate that executes when Edit property is changed.
Declaration
public override OnlinerBaseType.ValueChangeDelegate EditValueChange { get; set; }
Property Value
Overrides
HasBeenWritten
Gets or sets a value indicating whether has been written in the last cycle.
Declaration
public bool HasBeenWritten { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
HumanReadable
Provides a string combined from AttributeName of ancestors (GetParent()) of this instance and the tail of this instance.
Declaration
public string HumanReadable { get; protected set; }
Property Value
Type |
Description |
System.String |
|
InstanceMaxValue
Declaration
public abstract T InstanceMaxValue { get; }
Property Value
InstanceMinValue
Declaration
public abstract T InstanceMinValue { get; }
Property Value
IsToBeRead
Gets a value indicating whether is to be read in the next cycle.
Declaration
public bool IsToBeRead { get; }
Property Value
Type |
Description |
System.Boolean |
|
IsToBeWritten
Gets a value indicating whether is to be written.
Declaration
public bool IsToBeWritten { get; }
Property Value
Type |
Description |
System.Boolean |
|
LastValue
Gets the last value retrieved from cyclical or batched reading. Without requesting cyclical read operation on this onliner.
Declaration
public T LastValue { get; }
Property Value
Parent
Gets the parent object of this instance. Parent object is the object that created this instance.
Declaration
protected IVortexObject Parent { get; }
Property Value
Raw
Declaration
public virtual T Raw { get; }
Property Value
ReadFromPlcIsRequested
Gets or sets a value indicating whether read from plc is requested.
Declaration
public bool ReadFromPlcIsRequested { get; protected set; }
Property Value
Type |
Description |
System.Boolean |
|
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
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
ShadowValueChange
Gets or sets delegate that executed when Shadow property is changed.
Declaration
public override OnlinerBaseType.ValueChangeDelegate ShadowValueChange { get; set; }
Property Value
Overrides
Symbol
Gets the symbol of this on line variable.
Declaration
public string Symbol { get; }
Property Value
Type |
Description |
System.String |
|
SymbolTail
Gets or sets the tail of the symbol of this tag.
Declaration
protected string SymbolTail { get; set; }
Property Value
Type |
Description |
System.String |
|
Synchron
Gets or sets the online value synchronously.
Declaration
public virtual T Synchron { get; set; }
Property Value
Translator
Provides translator for the localization for this tag.
Declaration
public ITranslator Translator { get; }
Property Value
Type |
Description |
Vortex.Localizations.Abstractions.ITranslator |
|
Validator
Gets the validation rule for this type. Validation occurs only when property Edit is changed.
Declaration
public OnlinerValidationRule<T> Validator { get; }
Property Value
VariableInfo
Gets information about this tag's online variable info.
Declaration
public IValueTagInfo VariableInfo { get; protected set; }
Property Value
WriteToPlcIsRequested
Gets or sets a value indicating whether this variable should be written to the controller in the next cycle.
Declaration
public bool WriteToPlcIsRequested { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
ChangeShadowValue(T, T)
Declaration
void ChangeShadowValue(T origin, T newValue)
Parameters
Type |
Name |
Description |
T |
origin |
|
T |
newValue |
|
CreateSymbol(String, String)
Declaration
static string CreateSymbol(string rootSymbol, string symbol)
Parameters
Type |
Name |
Description |
System.String |
rootSymbol |
|
System.String |
symbol |
|
Returns
Type |
Description |
System.String |
|
EditValue(T, T)
Declaration
void EditValue(T origin, T newValue)
Parameters
Type |
Name |
Description |
T |
origin |
|
T |
newValue |
|
GetDeclaringAssembly()
Gets the assembly that declares the instance of this tag.
Declaration
public Assembly GetDeclaringAssembly()
Returns
Type |
Description |
System.Reflection.Assembly |
|
GetLastAvailableValue()
Gets tha most recent value either LastValue or Cyclic if that is more recent.
Declaration
public virtual T GetLastAvailableValue()
Returns
GetParent()
Gets the parent object of this instance.
Parent object is the object that created this instance.
Declaration
public IVortexObject GetParent()
Returns
GetSymbolTail()
Gets tail of the this tag symbol.
Declaration
public string GetSymbolTail()
Returns
Type |
Description |
System.String |
Tail of this tag's symbol.
|
GetValueChangeEventSubscribers()
Gets delegates associated with ValueChangeEvent
Declaration
public IEnumerable<Delegate> GetValueChangeEventSubscribers()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Delegate> |
|
HasWriteAccess()
Get true when this tag has write access.
Declaration
public bool HasWriteAccess()
Returns
Type |
Description |
System.Boolean |
The System.Boolean.
|
InitializeDefaults()
Declaration
protected static T InitializeDefaults()
Returns
NotifyPropertyChanged(String)
Implementation of System.ComponentModel.INotifyPropertyChanged.
Declaration
protected void NotifyPropertyChanged(string propertyName)
Parameters
Type |
Name |
Description |
System.String |
propertyName |
Property name.
|
OnShadowValueChangeEvent(T)
Declaration
void OnShadowValueChangeEvent(T newValue)
Parameters
Type |
Name |
Description |
T |
newValue |
|
OnValueChangeEvent(T)
Notifies the change of Cyclicvalue.
Declaration
protected void OnValueChangeEvent(T newValue)
Parameters
Type |
Name |
Description |
T |
newValue |
|
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()
Subscribe(ValueChangedEventHandlerDelegate)
Declaration
public void Subscribe(ValueChangedEventHandlerDelegate handler)
Parameters
UnSubscribe(ValueChangedEventHandlerDelegate)
Un-subscribes this tag from handling the value change.
The cyclical reading of this tag will not be cancelled.
Declaration
public void UnSubscribe(ValueChangedEventHandlerDelegate handler)
Parameters
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
PropertyChanged
Implementation of System.ComponentModel.INotifyPropertyChanged interface.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type |
Description |
System.ComponentModel.PropertyChangedEventHandler |
|
ShadowValueChangeEvent
Declaration
public event ValueChangedEventHandlerDelegate ShadowValueChangeEvent
Event Type
ValueChangeEvent
Online Cyclic property changed event.
Declaration
public event ValueChangedEventHandlerDelegate ValueChangeEvent
Event Type
Explicit Interface Implementations
IOnline<T>.AttributeName
Declaration
string IOnline<T>.AttributeName { get; set; }
Returns
Type |
Description |
System.String |
|
IOnline<T>.AttributeUnits
Declaration
string IOnline<T>.AttributeUnits { get; set; }
Returns
Type |
Description |
System.String |
|
IOnline<T>.Cyclic
Declaration
T IOnline<T>.Cyclic { get; set; }
Returns
IOnline<T>.Edit
Declaration
T IOnline<T>.Edit { get; set; }
Returns
IOnline<T>.Symbol
Declaration
string IOnline<T>.Symbol { get; }
Returns
Type |
Description |
System.String |
|
IOnline<T>.Synchron
Declaration
T IOnline<T>.Synchron { get; set; }
Returns
IOnline<T>.Value
Declaration
T IOnline<T>.Value { get; set; }
Returns
IOnline<T>.ValueChanged
Declaration
event ValueChangedEventHandlerDelegate IOnline<T>.ValueChanged
Returns
IShadow<T>.AttributeName
Declaration
string IShadow<T>.AttributeName { get; set; }
Returns
Type |
Description |
System.String |
|
IShadow<T>.AttributeUnits
Declaration
string IShadow<T>.AttributeUnits { get; set; }
Returns
Type |
Description |
System.String |
|
IShadow<T>.Shadow
Declaration
T IShadow<T>.Shadow { get; set; }
Returns
IShadow<T>.Symbol
Declaration
string IShadow<T>.Symbol { get; }
Returns
Type |
Description |
System.String |
|
IShadow<T>.Value
Declaration
T IShadow<T>.Value { get; set; }
Returns
IShadow<T>.ValueChanged
Declaration
event ValueChangedEventHandlerDelegate IShadow<T>.ValueChanged
Returns
Implements
System.ComponentModel.INotifyPropertyChanged
Extension Methods