ValueSymbolExtensionsPollValues2(IValueSymbol, TimeSpan) Method
Poll symbol values with communication return codes.
Namespace: TwinCAT.Ads.Reactive
Assembly: TwinCAT.Ads.Reactive (in
TwinCAT.Ads.Reactive.dll) Version:
7.0.0+e56d35ccc4675faac24789a4aab60071fc61d470
Syntax
C#
public static IObservable<ResultReadValueAccess2<IValueSymbol, Object?>> PollValues2(
this IValueSymbol symbol,
TimeSpan period
)Return Value
IObservable
ResultReadValueAccess2
IValueSymbol,
Object
IObservable<ResultReadValueAccess>.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IValueSymbol. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This reactive method polls the symbol version together with additional information. The distinct result data is ResultReadValueAccess which contains the value (if succeeded) together with the communication return code. If the ErrorCode is > 0, then the Value property will return the default value. This has the advantage, that the Observable doesn't produces Errors when communication requests return Errors and the Observer can continue. Internally for optimization reasons because it is expected that the polling occurs many times, this reactive method creates the symbol handle before the first polling trigger (one roundtrip), reads the value with each trigger and unregisters the handle on finalize. So the number of communication roundtrips is Trigggers + 2.
Reference
ValueSymbolExtensions Class PollValues2 Overload TwinCAT.Ads.Reactive Namespace PollValues(IValueSymbol, TimeSpan)
Beckhoff Automation GmbH & Co. KG 2001-2026