AdsSyncReadStateReqEx

Reads the ADS state and the device state from an ADS server.

LONG AdsSyncReadStateReqEx(
  LONG      port,
  PAmsAddr  pAddr,
  USHORT    *pAdsState,
  PUSHORT   pDeviceState
);

Parameter

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 state (see data type ADSSTATE).

pDeviceState

[out] Address of a variable that will receive the device state.

Return value

Returns the function's error state.

Comments

Any ADS device can inform another ADS device of its current state. A distinction is made between the state of the device itself (DeviceState) and the state of the ADS interface of the ADS device (AdsState). The states that the ADS interface can adopt are laid down in the ADS specification.
Sample 11 illustrates how the change can be detected with the aid of a callback function.

Sample

See Sample 4: Read ADS state.