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 |
---|---|---|
|
Gets the inner symbol of this DynamicSymbol | |
|
Gets the access rights. | |
|
Indicates, that the aggregates symbols is an IProcessImageAddress (and most probably IAdsSymbol) | |
|
Gets the Symbol Attributes | |
|
Gets the size of the IDataType in bits. | |
|
Gets the (aligned) size of of the Type/Instance in Bytes | |
|
Gets the category. | |
|
Gets the comment of the IInstance | |
|
Gets the connection bound to this DynamicSymbol | |
| ||
|
Gets a value indicating whether this instance has value (only the non VirtualInstances, what means the Symbols with locations). | |
|
Gets the name of the instance (without periods (.) | |
|
Gets the relative / absolute access path to the instance (with periods (.)) | |
|
Gets a value indicating whether this instance is not basing on a full DataType but instead of some sort of bit mapping | |
|
Indicates that the Size of the Object is Byte aligned (BitSize % 8 == 0) | |
|
Gets a value indicating whether this Symbol is acontainer type. | |
|
Gets a value indicating whether this ISymbol is persistent. | |
|
Indicates that the IInstance represents a Pointer type (Pointer TO) | |
|
Gets a value indicating whether this instance is a primitive type. | |
|
Indicates that this instance is read only. | |
|
Gets a value indicating whether this instance is recursive. | |
|
Indicates that the IInstance represents a Reference type (REFERENCE TO) | |
|
Gets a value indicating whether this instance is static. | |
|
Gets the normalized instance name (fixed name for dynamic property access that doesn't contain invalid characters), | |
|
Gets the notification settings. | |
|
Gets the parent Symbol | |
|
Gets the size of the IInstance in bytes. | |
|
Gets the SubSymbols of the ISymbol | |
|
Gets the name of the DataType that is used for this IInstance. | |
|
Gets the value encoding. |
Methods
|
Name |
Description |
---|---|---|
|
Equals (Overrides Object.Equals(Object).) | |
|
Finalize |
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
|
Returns the enumeration of all dynamic member names. (Overrides DynamicObject.GetDynamicMemberNames..) | |
|
Gets the HashCode of the Address (Overrides Object.GetHashCode..) | |
|
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.) |
|
GetType |
Gets the Type of the current instance. (Inherited from Object.) |
|
MemberwiseClone |
Creates a shallow copy of the current Object. (Inherited from Object.) |
|
Handler function for reading ADS 'Any' Values. | |
|
Handler function for reading Raw symbol value. | |
|
Handler function reading the raw value of the DynamicSymbol. | |
|
Handler function for the | |
|
Handler function reading the DynamicSymbols value asynchronously. | |
|
Sets a new InstanceName InstancePath | |
|
Handler function for the | |
|
Handler Function for writing value. | |
|
Handler function for reading symbols raw value. | |
|
Handler function for writing the raw DynamicSymbol value. | |
|
Handler Function for writing value. | |
|
Handler Function for writing value. | |
|
Reads the value of this Value into a new created instance of the managed type | |
|
Reads the raw value of the IValueSymbol (Ads Read / Write) | |
|
Reads the Symbols raw value | |
|
Read raw value as an asynchronous operation. | |
|
Reads the value of this DynamicSymbol. | |
|
Reads the value of this DynamicSymbol. | |
|
Reads the Value of the IValueSymbol asynchronously. | |
|
Returns a String that represents this instance. (Overrides Object.ToString..) | |
|
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.) |
|
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.) |
|
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.) |
|
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.) |
|
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.) |
|
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.) |
|
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.).) | |
|
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.) |
|
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.) |
|
Reads the Value of the IValueSymbol | |
|
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.) |
|
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.) |
|
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.) |
|
Writes the specified value to the DynamicSymbol. | |
|
Reads the value of this Value into the specified managed value. | |
|
Writes the value represented by the managed value to this Value | |
|
Writes the raw value of the IValueSymbol (Ads Read / Write) | |
|
Writes the raw value of the IValueSymbol (Ads Read / Write) | |
|
Writes the raw value of the IValueSymbol (Ads Read / Write) | |
|
Writes the specified value to the DynamicSymbol. | |
|
Writes the specified value to the DynamicSymbol. | |
|
Writes the Value of the IValueSymbol |
Events
|
Name |
Description |
---|---|---|
|
Occurs when the RawValue of the IValueSymbol has changed. | |
|
Occurs when the (Primitive) value of the IValueSymbol has changed. |
Extension Methods
|
Name |
Description |
---|---|---|
|
Overloaded. Poll symbol values on trigger signals. (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Polls the symbol as value sequence of object values with a specified period time. (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Polls symbol values on trigger signals. (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Polls the symbol as value sequence of object values with a specified period time. (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Poll symbol values as a value sequence on trigger signals (typed) (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Polls the symbol as value sequence of object values with a specified period time (typed) (Defined by ValueSymbolExtensions.) | |
|
PollValues.T.(IObservable.Unit., Func.ResultReadValueAccess2.IValueSymbol, Object., T.) |
Overloaded. Poll symbol values on trigger signals (typed) (Defined by ValueSymbolExtensions.) |
|
Overloaded. Poll symbol values on trigger signals (typed) (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Polls the symbol as value sequence of object values with a specified period time (typed) (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Poll symbol values as a sequence of annotated results (Value + ErrorCode) (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Poll symbol values with communication return codes. (Defined by ValueSymbolExtensions.) | |
|
Indicates, that the Instance value includes process memory data, that cannot be read in one memory block. (Defined by DataTypeExtension.) | |
|
Gets an observable sequence when the value of the IValueSymbol has changed. (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Subscribes the IValueSymbol to an observable sequence of values and writes them to the IValueSymbol. (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Subscribes the IValueSymbol to an observable sequence of values and writes them to the IValueSymbol. (Defined by ValueSymbolExtensions.) | |
|
Overloaded. Subscribes the IValueSymbol to an observable sequence of values and writes them to the IValueSymbol. (Defined by ValueSymbolExtensions.) | |
|
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.IDynamicSymbol
TwinCAT.TypeSystem.IValueSymbol
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