Cicode Programming Reference > Cicode Function Categories > Tag Functions Introduction > SubscriptionAddCallback


Adds a function callback to a tag subscription. When the value change for a subscribed tag is detected, a callback function can be called. This implements change based Cicode and avoids continuously polling a tag value to monitor changes.

Multiple callbacks are possible to the same subscription.

To remove a callback from a subscription use the SubscriptionRemoveCallback function.


SubscriptionAddCallback(iHandle, sCallback)


Integer handle of the subscription to add a callback to.


String stating the name of a function to call when the value is updated. The function should have the structure:

FUNCTION evtHandler(INT subsHandle)

Where subsHandle is the subscription that raised the event.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

TagSubscribe, TagUnsubscribe, SubscriptionGetAttribute, SubscriptionRemoveCallback

See Also

Tag Functions