ConnectionStateExtension.SetAdsState Method

Sets an AdsState/AdsStateCommand to an AdsServer and waits until the StateChange finishes.

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

Syntax

C#

public static ResultWriteControl SetAdsState(
    this IAdsConnection connection,
    AdsStateCommand requested,
    TimeSpan pollingRate,
    TimeSpan waitTimeout,
    bool noReinit,
    bool noWait
)

Parameters

connection

Type: TwinCAT.Ads.IAdsConnection
The connection.

requested

Type: TwinCAT.Ads.AdsStateCommand
The requested state / command.

pollingRate

Type: System.TimeSpan
The polling rate.

waitTimeout

Type: System.TimeSpan
The wait timeout.

noReinit

Type: System.Boolean
Checks first for the actual state and decides to return immediatly if the device is already in the expected target state.

noWait

Type: System.Boolean
if set to true [no wait].

Return Value

Type: ResultWriteControl
ResultWriteControl.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IAdsConnection. 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).

Exceptions

Exception

Condition

ClientNotConnectedException

AdsException

Polling rate higher than connection timeout!

AdsException

Cannot set '{address}' to '{requested}'. This would leave the target system unavailable for ADS!

Reference

ConnectionStateExtension Class

TwinCAT.Ads.Extensions Namespace