AdsSyncAddDeviceNotificationReqEx

A notification is defined within an ADS server (e.g. PLC). When a certain event occurs, a function (the callback function) is invoked in the ADS client (C program).

LONG AdsSyncAddDeviceNotificationReqEx(
     LONG  port,
     PAmsAddr  pAddr,
     ULONG  nIndexGroup,
     ULONG  nIndexOffset,
     PAdsNotificationAttrib  pNoteAttrib,
     PAdsNotificationFuncEx  pNoteFunc,
     ULONG  hUser,
     PULONG  pNotification
);

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.

nIndexGroup

[in] IndexGroup.

nIndexOffset

[in] IndexOffset.

pNoteAttrib

[in] Pointer to the structure that contains further information.

pNoteFunc

[in] Name of the callback function.

hUser

[in] 32-bit value that is passed to the callback function.

pNotification

[out] Address of the variable that will receive the handle of the notification.

Return value

Returns the function's error status.

Limitation:

Per ADS-Port a limited number of 550 notifications are available.

Remarks

If the TwinCAT router is stopped and then started again, the notifications become invalid. You can trap this event with the AdsAmsRegisterRouterNotification() function.

Example

See example 8.