AdsSyncWriteControlReqEx

Changes the ADS state and the device state of an ADS server.

LONG AdsSyncWriteControlReqEx(
  LONG      port,
  PAmsAddr  pAddr,
  USHORT    nAdsState,
  USHORT    nDeviceState,
  ULONG     nLength,
  PVOID     pData
);

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.

nAdsState

[in] New ADS state.

nDeviceState

[in] New device state.

nLength

[in] Length of the data in bytes.

pData

[in] Pointer to data sent additionally to the ADS device.

Return value

Returns the function's error state.

Comments

In addition to changing the ADS state and the device state, it is also possible to send data to the ADS server in order to transfer further information. In the current ADS devices (PLC, NC, ...) this data has no further effect. 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

See Sample 6: Start/stop PLC.