AnyTypeExtensions Class

Extension class for IAdsConnection to provide reactive ADS extensions (accessing symbol value sequences with the ANY_TYPE concept)

Inheritance Hierarchy

SystemObject
  TwinCAT.Ads.ReactiveAnyTypeExtensions

Namespace: TwinCAT.Ads.Reactive
Assembly: TwinCAT.Ads.Reactive (in TwinCAT.Ads.Reactive.dll) Version: 7.0.0+e56d35ccc4675faac24789a4aab60071fc61d470

Syntax

C#

public static class AnyTypeExtensions

The AnyTypeExtensions type exposes the following members.

Methods

 

Name

Description

PollValues(IAdsConnection, String, Type, IObservableUnit)

Polls the symbol values on timepoints where the polling observable streams data / triggers

PollValues(IAdsConnection, String, Type, TimeSpan)

Polls the symbol as value sequence of object values with a specified period time.

PollValues(IAdsConnection, ISymbol, Type, IObservableUnit)

Polls the symbol values on timepoints where the polling observable streams data / triggers

PollValues(IAdsConnection, ISymbol, Type, TimeSpan)

Polls the symbol as value sequence of object values with a specified period time.

PollValues(IAdsConnection, String, Type, Int32, TimeSpan)

Polls the symbol as value sequence of object values with a specified period time.

PollValues(IAdsConnection, String, Type, IObservableUnit, FuncException, Object)

Polls the symbol values on timepoints where the polling observable streams data / triggers

PollValues(IAdsConnection, String, Type, TimeSpan, FuncException, Object)

Polls the symbol as value sequence of object values with a specified period time.

PollValues(IAdsConnection, ISymbol, Type, Int32, TimeSpan)

Polls the symbol as value sequence of object values with a specified period time.

PollValues(IAdsConnection, ISymbol, Type, IObservableUnit, FuncException, Object)

Polls the symbol values on timepoints where the polling observable streams data / triggers

PollValues(IAdsConnection, ISymbol, Type, TimeSpan, FuncException, Object)

Polls the symbol as value sequence of object values with a specified period time.

PollValues(IAdsConnection, String, Type, Int32, IObservableUnit, FuncException, Object)

Polls the symbol values on time points where the polling observable streams data / triggers

PollValues(IAdsConnection, String, Type, Int32, TimeSpan, FuncException, Object)

Polls the symbol as value sequence of object values with a specified period time.

PollValues(IAdsConnection, ISymbol, Type, Int32, IObservableUnit, FuncException, Object)

Polls the symbol values on time points where the polling observable streams data / triggers

PollValues(IAdsConnection, ISymbol, Type, Int32, TimeSpan, FuncException, Object)

Polls the symbol as value sequence of object values with a specified period time.

PollValuesT(IAdsConnection, String, IObservableUnit)

Polls the symbol values on timepoints where the polling observable streams data / triggers

PollValuesT(IAdsConnection, String, TimeSpan)

Polls the symbol as value sequence of object values with a specified period time.

PollValuesT(IAdsConnection, ISymbol, IObservableUnit)

Polls the symbol values on timepoints where the polling observable streams data / triggers

PollValuesT(IAdsConnection, ISymbol, TimeSpan)

Polls the symbol as value sequence of object values with a specified period time.

PollValuesT(IAdsConnection, String, Int32, IObservableUnit)

Polls the symbol values on time points where the polling observable streams data / triggers

AnyTypeExtensions Class 1:

PollValuesT(IAdsConnection, String, Int32, TimeSpan)

Polls the symbol as value sequence of object values with a specified period time.

PollValuesT(IAdsConnection, String, IObservableUnit, FuncException, T)

Polls the symbol values on timepoints where the polling observable streams data / triggers

PollValuesT(IAdsConnection, String, TimeSpan, FuncException, T)

Polls the symbol as value sequence of object values with a specified period time.

PollValuesT(IAdsConnection, ISymbol, Int32, IObservableUnit)

Polls the symbol values on time points where the polling observable streams data / triggers

AnyTypeExtensions Class 2:

PollValuesT(IAdsConnection, ISymbol, Int32, TimeSpan)

Polls the symbol as value sequence of object values with a specified period time.

PollValuesT(IAdsConnection, ISymbol, IObservableUnit, FuncException, T)

Polls the symbol values on timepoints where the polling observable streams data / triggers

PollValuesT(IAdsConnection, ISymbol, TimeSpan, FuncException, T)

Polls the symbol as value sequence of object values with a specified period time.

PollValuesT(IAdsConnection, String, Int32, IObservableUnit, FuncException, T)

Polls the symbol values on timepoints where the polling observable streams data / triggers

AnyTypeExtensions Class 3:

PollValuesT(IAdsConnection, String, Int32, TimeSpan, FuncException, T)

Polls the symbol as value sequence of object values with a specified period time.

PollValuesT(IAdsConnection, ISymbol, Int32, IObservableUnit, FuncException, T)

Polls the symbol values on timepoints where the polling observable streams data / triggers

AnyTypeExtensions Class 4:

PollValuesT(IAdsConnection, ISymbol, Int32, TimeSpan, FuncException, T)

Polls the symbol as value sequence of object values with a specified period time.

PollValues2T(IAdsConnection, String, Int32, IObservableUnit)

Polls the symbol values on time points where the polling observable streams data / triggers

PollValues2T(IAdsConnection, ISymbol, Int32, IObservableUnit)

Polls the symbol values on timepoints where the polling observable streams data / triggers

AnyTypeExtensions Class 5:

WhenNotification(IAdsConnection, String, Type, NotificationSettings)

Creates an observable sequence of values that are created by ADS Notifications.

AnyTypeExtensions Class 6:

WhenNotificationT(IAdsConnection, String, NotificationSettings)

Creates an observable sequence of values that are created by ADS Notifications.

AnyTypeExtensions Class 7:

WriteValuesT(IAdsConnection, String, IObservableT)

Writes the sequence of values to the symbol specified by the instance path.

AnyTypeExtensions Class 8:

WriteValuesT(IAdsConnection, String, IObservableT, ActionException)

Writes the sequence of values to the symbol specified by the instance path.

Remarks

Reactive Extensions (Rx) are a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers. The ADS reactive extensions are build on top of this library to enable ADS Symbol and State Observables, seamlessly bound to the reactive extensions. To use the ADS reactive extensions the TwinCAT.Ads.Reactive Nuget package (or the included TwinCAT.Ads.Reactive.dll) must be referenced. (Beckhoff.TwinCAT.Ads.Reactive package on Nuget).

Example

Example1: Observe Value changed Notifications with the reactive AnyTypeExtensions

Observe a single changing ADS Symbols (Extended AdsNotifications, ANY_TYPE)

// To Test the Observer run a project on the local PLC System (Port 851)
using (AdsClient client = new AdsClient())
{
    // Connect to target
    client.Connect(new AmsAddress(AmsNetId.Local, 851));

    // Reactive Notification Handler
    var valueObserver = Observer.Create<ushort>(val =>
    {
    Console.WriteLine(string.Format("Value: {0}", val.ToString()));
    }
    );

    // Turning ADS Notifications into sequences of Value Objects (Taking 20 Values)
    // and subscribe to them.
    IDisposable subscription = client.WhenNotification<ushort>("TwinCAT_SystemInfoVarList._TaskInfo.CycleCount", NotificationSettings.Default).Take(20).Subscribe(valueObserver);

    Console.ReadKey(); // Wait for Key press
    subscription.Dispose(); // Dispose the Subscription
}

Reference

TwinCAT.Ads.Reactive Namespace AdsClientExtensions ValueSymbolExtensions

Beckhoff Automation GmbH & Co. KG 2001-2026