AdsConnection.TryReadState Method (Int32, StateInfo.)

Reads the ADS status and the device status from an ADS server. Unlike the ReadState method this method does not call an exception on failure. Instead an AdsErrorCode is returned. If the return value is equal to AdsErrorCode.NoError the call was successfull.

Namespace:  TwinCAT.Ads
Assembly:  TwinCAT.Ads (in TwinCAT.Ads.dll) Version: 4.3.0.0

Syntax

C#

public AdsErrorCode TryReadState(
    int timeout,
    out StateInfo stateInfo
)

VB

Public Function TryReadState ( 
    timeout As Integer,
    <OutAttribute> ByRef stateInfo As StateInfo
) As AdsErrorCode

Parameters

timeout

Type: System.Int32
The timeout.

stateInfo

Type: TwinCAT.Ads.StateInfo.
The ADS statue and device status.

Return Value

Type: AdsErrorCode
AdsErrorCode of the ads read state call. Check for AdsErrorCode.NoError to see if call was successfull.

Exceptions

Exception

Condition

ObjectDisposedException

Reference

AdsConnection Class

TryReadState Overload

TwinCAT.Ads Namespace