AdsSyncReadStateReqEx
Reads the ADS status and the device status from an ADS server.
LONG AdsSyncReadStateReqEx(
LONG port,
PAmsAddr pAddr,
USHORT *pAdsState,
PUSHORT pDeviceState);
Parameters
port
[in] port number of an Ads port that had previously been opened with AdsPortOpenEx or AdsPortOpen.
pAddr
[in] Structure with NetId and port number of the ADS server.
pAdsState
[out] Address of a variable that will receive the ADS status (see data type ADSSTATE).
pDeviceState
[out] Address of a variable that will receive the device status.
Return value
Returns the function's error status.
Remarks
Any ADS device can inform another ADS device of its current state. A distinction is drawn here between the status of the device itself (DeviceState) and the status of the ADS interface of the ADS device (AdsState). The states that the ADS interface can adopt are laid down in the ADS specification.
Example 11 illustrates how the change can be detected with the aid of a callback function.