DynamicSymbol Class

Dynamic Symbol object.

Inheritance Hierarchy

System.Object
  System.Dynamic.DynamicObject
    TwinCAT.TypeSystem.DynamicSymbol
      More...

Namespace:  TwinCAT.TypeSystem
Assembly:  TwinCAT.Ads (in TwinCAT.Ads.dll) Version: 6.0.328+39e3229

Syntax

C#

public class DynamicSymbol : DynamicObject, 
    IDynamicSymbol, ISymbol, IAttributedInstance, IInstance, IBitSize, 
    ISymbolFactoryServicesProvider, IValueSymbol, IValueRawSymbol, IHierarchicalSymbol, IValueAccessorProvider, 
    IContextMaskProvider

The DynamicSymbol type exposes the following members.

Properties

 

Name

Description

DynamicSymbol Class 1:

_InnerSymbol

Gets the inner symbol of this DynamicSymbol

DynamicSymbol Class 2:

AccessRights

Gets the access rights.

DynamicSymbol Class 3:

AllowIGIOAccess

Indicates, that the aggregates symbols is an IProcessImageAddress (and most probably IAdsSymbol)

DynamicSymbol Class 4:

Attributes

Gets the Symbol Attributes

DynamicSymbol Class 5:

BitSize

Gets the size of the IDataType in bits.

DynamicSymbol Class 6:

ByteSize

Gets the (aligned) size of of the Type/Instance in Bytes

DynamicSymbol Class 7:

Category

Gets the category.

DynamicSymbol Class 8:

Comment

Gets the comment of the IInstance

DynamicSymbol Class 9:

Connection

Gets the connection bound to this DynamicSymbol

DynamicSymbol Class 10:

DataType

Gets the IDataType of the IInstance.

DynamicSymbol Class 11:

HasValue

Gets a value indicating whether this instance has value (only the non VirtualInstances, what means the Symbols with locations).

DynamicSymbol Class 12:

InstanceName

Gets the name of the instance (without periods (.)

DynamicSymbol Class 13:

InstancePath

Gets the relative / absolute access path to the instance (with periods (.))

DynamicSymbol Class 14:

IsBitType

Gets a value indicating whether this instance is not basing on a full DataType but instead of some sort of bit mapping

DynamicSymbol Class 15:

IsByteAligned

Indicates that the Size of the Object is Byte aligned (BitSize % 8 == 0)

DynamicSymbol Class 16:

IsContainerType

Gets a value indicating whether this Symbol is acontainer type.

DynamicSymbol Class 17:

IsPersistent

Gets a value indicating whether this ISymbol is persistent.

DynamicSymbol Class 18:

IsPointer

Indicates that the IInstance represents a Pointer type (Pointer TO)

DynamicSymbol Class 19:

IsPrimitiveType

Gets a value indicating whether this instance is a primitive type.

DynamicSymbol Class 20:

IsReadOnly

Indicates that this instance is read only.

DynamicSymbol Class 21:

IsRecursive

Gets a value indicating whether this instance is recursive.

DynamicSymbol Class 22:

IsReference

Indicates that the IInstance represents a Reference type (REFERENCE TO)

DynamicSymbol Class 23:

IsStatic

Gets a value indicating whether this instance is static.

DynamicSymbol Class 24:

NormalizedName

Gets the normalized instance name (fixed name for dynamic property access that doesn't contain invalid characters),

DynamicSymbol Class 25:

NotificationSettings

Gets the notification settings.

DynamicSymbol Class 26:

Parent

Gets the parent Symbol

DynamicSymbol Class 27:

Size

Gets the size of the IInstance in bytes.

DynamicSymbol Class 28:

SubSymbols

Gets the SubSymbols of the ISymbol

DynamicSymbol Class 29:

TypeName

Gets the name of the DataType that is used for this IInstance.

DynamicSymbol Class 30:

ValueEncoding

Gets the value encoding.

Methods

 

Name

Description

DynamicSymbol Class 31:

Equals

Equals (Overrides Object.Equals(Object).)

DynamicSymbol Class 32:

Finalize

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)

DynamicSymbol Class 33:

GetDynamicMemberNames

Returns the enumeration of all dynamic member names. (Overrides DynamicObject.GetDynamicMemberNames..)

DynamicSymbol Class 34:

GetHashCode

Gets the HashCode of the Address (Overrides Object.GetHashCode..)

DynamicSymbol Class 35:

GetMetaObject

Provides a DynamicMetaObject that dispatches to the dynamic virtual methods. The object can be encapsulated inside another DynamicMetaObject to provide custom behavior for individual actions. This method supports the Dynamic Language Runtime infrastructure for language implementers and it is not intended to be used directly from your code. (Inherited from DynamicObject.)

DynamicSymbol Class 36:

GetType

Gets the Type of the current instance. (Inherited from Object.)

DynamicSymbol Class 37:

MemberwiseClone

Creates a shallow copy of the current Object. (Inherited from Object.)

DynamicSymbol Class 38:

OnReadAnyValue

Handler function for reading ADS 'Any' Values.

DynamicSymbol Class 39:

OnReadRawValue

Handler function for reading Raw symbol value.

DynamicSymbol Class 40:

OnReadRawValueAsync

Handler function reading the raw value of the DynamicSymbol.

DynamicSymbol Class 41:

OnReadValue

Handler function for the

DynamicSymbol Class 42:

OnReadValueAsync

Handler function reading the DynamicSymbols value asynchronously.

DynamicSymbol Class 43:

OnSetInstanceName

Sets a new InstanceName InstancePath

DynamicSymbol Class 44:

OnTryReadValue

Handler function for the

DynamicSymbol Class 45:

OnTryWriteValue

Handler Function for writing value.

DynamicSymbol Class 46:

OnWriteRawValue

Handler function for reading symbols raw value.

DynamicSymbol Class 47:

OnWriteRawValueAsync

Handler function for writing the raw DynamicSymbol value.

DynamicSymbol Class 48:

OnWriteValue

Handler Function for writing value.

DynamicSymbol Class 49:

OnWriteValueAsync

Handler Function for writing value.

DynamicSymbol Class 50:

ReadAnyValue

Reads the value of this Value into a new created instance of the managed type

DynamicSymbol Class 51:

ReadRawValue.

Reads the raw value of the IValueSymbol (Ads Read / Write)

DynamicSymbol Class 52:

ReadRawValue(Int32)

Reads the Symbols raw value

DynamicSymbol Class 53:

ReadRawValueAsync

Read raw value as an asynchronous operation.

DynamicSymbol Class 54:

ReadValue.

Reads the value of this DynamicSymbol.

DynamicSymbol Class 55:

ReadValue(Int32)

Reads the value of this DynamicSymbol.

DynamicSymbol Class 56:

ReadValueAsync

Reads the Value of the IValueSymbol asynchronously.

DynamicSymbol Class 57:

ToString

Returns a String that represents this instance. (Overrides Object.ToString..)

DynamicSymbol Class 58:

TryBinaryOperation

Provides implementation for binary operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as addition and multiplication. (Inherited from DynamicObject.)

DynamicSymbol Class 59:

TryConvert

Provides implementation for type conversion operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations that convert an object from one type to another. (Inherited from DynamicObject.)

DynamicSymbol Class 60:

TryCreateInstance

Provides the implementation for operations that initialize a new instance of a dynamic object. This method is not intended for use in C# or Visual Basic. (Inherited from DynamicObject.)

DynamicSymbol Class 61:

TryDeleteIndex

Provides the implementation for operations that delete an object by index. This method is not intended for use in C# or Visual Basic. (Inherited from DynamicObject.)

DynamicSymbol Class 62:

TryDeleteMember

Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic. (Inherited from DynamicObject.)

DynamicSymbol Class 63:

TryGetIndex

Provides the implementation for operations that get a value by index. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for indexing operations. (Inherited from DynamicObject.)

DynamicSymbol Class 64:

TryGetMember

Provides the implementation for operations that get member values. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as getting a value for a property. (Overrides DynamicObject.TryGetMember(GetMemberBinder, Object.).)

DynamicSymbol Class 65:

TryInvoke

Provides the implementation for operations that invoke an object. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as invoking an object or a delegate. (Inherited from DynamicObject.)

DynamicSymbol Class 66:

TryInvokeMember

Provides the implementation for operations that invoke a member. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as calling a method. (Inherited from DynamicObject.)

DynamicSymbol Class 67:

TryReadValue

Reads the Value of the IValueSymbol

DynamicSymbol Class 68:

TrySetIndex

Provides the implementation for operations that set a value by index. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations that access objects by a specified index. (Inherited from DynamicObject.)

DynamicSymbol Class 69:

TrySetMember

Provides the implementation for operations that set member values. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as setting a value for a property. (Inherited from DynamicObject.)

DynamicSymbol Class 70:

TryUnaryOperation

Provides implementation for unary operations. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations such as negation, increment, or decrement. (Inherited from DynamicObject.)

DynamicSymbol Class 71:

DynamicSymbol Class 72:

TryWriteValue

Writes the specified value to the DynamicSymbol.

DynamicSymbol Class 73:

UpdateAnyValue

Reads the value of this Value into the specified managed value.

DynamicSymbol Class 74:

WriteAnyValue

Writes the value represented by the managed value to this Value

DynamicSymbol Class 75:

WriteRawValue(.Byte.)

Writes the raw value of the IValueSymbol (Ads Read / Write)

DynamicSymbol Class 76:

WriteRawValue(.Byte., Int32)

Writes the raw value of the IValueSymbol (Ads Read / Write)

DynamicSymbol Class 77:

WriteRawValueAsync

Writes the raw value of the IValueSymbol (Ads Read / Write)

DynamicSymbol Class 78:

WriteValue(Object)

Writes the specified value to the DynamicSymbol.

DynamicSymbol Class 79:

DynamicSymbol Class 80:

WriteValue(Object, Int32)

Writes the specified value to the DynamicSymbol.

DynamicSymbol Class 81:

WriteValueAsync

Writes the Value of the IValueSymbol

Events

 

Name

Description

DynamicSymbol Class 82:

RawValueChanged

Occurs when the RawValue of the IValueSymbol has changed.

DynamicSymbol Class 83:

ValueChanged

Occurs when the (Primitive) value of the IValueSymbol has changed.

Operators

 

Name

Description

DynamicSymbol Class 84:

DynamicSymbol Class 85:

Equality

Operator==

DynamicSymbol Class 86:

DynamicSymbol Class 87:

Inequality

Implements the != operator.

Fields

 

Name

Description

DynamicSymbol Class 88:

syncObject

Synchronization object

Extension Methods

 

Name

Description

DynamicSymbol Class 89:

PollValues(IObservable.Unit.)

Overloaded.

Poll symbol values on trigger signals. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 90:

DynamicSymbol Class 91:

PollValues(TimeSpan)

Overloaded.

Polls the symbol as value sequence of object values with a specified period time. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 92:

PollValues(IObservable.Unit., Boolean)

Overloaded.

Polls symbol values on trigger signals. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 93:

DynamicSymbol Class 94:

PollValues(TimeSpan, Boolean)

Overloaded.

Polls the symbol as value sequence of object values with a specified period time. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 95:

PollValues.T.(IObservable.Unit.)

Overloaded.

Poll symbol values as a value sequence on trigger signals (typed) (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 96:

DynamicSymbol Class 97:

PollValues.T.(TimeSpan)

Overloaded.

Polls the symbol as value sequence of object values with a specified period time (typed) (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 98:

DynamicSymbol Class 99:

PollValues.T.(IObservable.Unit., Func.ResultReadValueAccess2.IValueSymbol, Object., T.)

Overloaded.

Poll symbol values on trigger signals (typed) (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 100:

PollValues.T.(IObservable.Unit., Boolean)

Overloaded.

Poll symbol values on trigger signals (typed) (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 101:

PollValues.T.(TimeSpan, Boolean)

Overloaded.

Polls the symbol as value sequence of object values with a specified period time (typed) (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 102:

PollValues2(IObservable.Unit.)

Overloaded.

Poll symbol values as a sequence of annotated results (Value + ErrorCode) (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 103:

PollValues2(TimeSpan)

Overloaded.

Poll symbol values with communication return codes. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 104:

ReferencesExternalData

Indicates, that the Instance value includes process memory data, that cannot be read in one memory block. (Defined by DataTypeExtension.)

DynamicSymbol Class 105:

DynamicSymbol Class 106:

WhenValueChanged

Gets an observable sequence when the value of the IValueSymbol has changed. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 107:

DynamicSymbol Class 108:

WriteValues(IObservable.Object.)

Overloaded.

Subscribes the IValueSymbol to an observable sequence of values and writes them to the IValueSymbol. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 109:

WriteValues(IObservable.Object., Action.Exception.)

Overloaded.

Subscribes the IValueSymbol to an observable sequence of values and writes them to the IValueSymbol. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 110:

WriteValues(IObservable.Object., CancellationToken)

Overloaded.

Subscribes the IValueSymbol to an observable sequence of values and writes them to the IValueSymbol. (Defined by ValueSymbolExtensions.)

DynamicSymbol Class 111:

WriteValues(IObservable.Object., Action.Exception., CancellationToken)

Overloaded.

Subscribes the IValueSymbol to an observable sequence of values and writes them to the IValueSymbol. (Defined by ValueSymbolExtensions.)

Remarks

The DynamicSymbol adds dynamic run time behaviour to the ISymbol/IValueSymbol. That means e.g. for StructSymbols that .NET Properties are defined and dispatched at runtime to the structs fields like they are defined in TwinCAT / ADS Types. Indexed access to Array Symbols is another example where the dynamic runtime support takes place.

Examples

Sample for the dynamic resolution of Symbols:

Dynamic Symbol access

/// <summary>
/// Defines the entry point of the application.
/// </summary>
/// <param name="args">The arguments.</param>
static async void Main(string[] args)
{
    // Get the AdsAddress from command-line arguments
    AmsAddress address = ArgParser.Parse(args);

    CancellationTokenSource cancelSource = new CancellationTokenSource();
    CancellationToken cancel = cancelSource.Token;

    using (AdsClient client = new AdsClient())
    {
    // Connect to the target device
    client.Connect(address);

    // Usage of "dynamic" Type and Symbols (>= .NET4 only)
    SymbolLoaderSettings settings = new SymbolLoaderSettings(SymbolsLoadMode.DynamicTree);
    IAdsSymbolLoader dynLoader = (IAdsSymbolLoader)SymbolLoaderFactory.Create(client, settings);

Reference

TwinCAT.TypeSystem Namespace

TwinCAT.TypeSystem.IDynamicSymbol

TwinCAT.TypeSystem.IValueSymbol

TwinCAT.TypeSystem.ISymbol

System.Dynamic.DynamicObject

Inheritance Hierarchy

System.Object
  System.Dynamic.DynamicObject
    TwinCAT.TypeSystem.DynamicSymbol
      TwinCAT.TypeSystem.DynamicAliasInstance
      TwinCAT.TypeSystem.DynamicArrayInstance
      TwinCAT.TypeSystem.DynamicInterfaceInstance
      TwinCAT.TypeSystem.DynamicPointerInstance
      TwinCAT.TypeSystem.DynamicReferenceInstance
      TwinCAT.TypeSystem.DynamicUnionInstance