The CoV (Change of Value) functions can be used by drivers to support true event-based monitoring.
Note: For drivers that do not support true event-based monitoring, such as the Modbus driver, datapoints can still be configured for CoV updates from the CMS, however, the monitoring is handled completely by the IDL by issuing round robin read requests to the datapoints every 0.5 seconds.
CoV Callback Functions
The following two callback functions must be defined to support CoV updates. An IDL Driver Instance (IDI) must register both of the callback functions to support CoV updates. If only one is registered, the driver process exits.
DpEnableEvent
IdlErrorCodes DpEnableEvent(int callback_index, IdlDev *dev, IdlDatapoint *dp); |
When a datapoint's monitor.event attribute is set to true, the IDL calls the DpEnableEvent() callback function and waits for a timeout of dpEventTimeoutMs to receive a response from the IDL driver instance (IDI). The IDI reports success or failure to the IDL by calling IdlDpEnableEventResult(). If success is received, then the IDL understands that the IDI has successfully started event-based monitoring for that datapoint, and expects that the IDI will send frequent updates for that datapoint. If failure is received, the IDL uses round-robin polling for that datapoint. If the IDI does not respond to DpEnableEvent within the timeout dpEventTimeoutMs, the IDL retries by calling DpEnableEvent again. IDL retries up to three times before assuming a failure and then starts polling the datapoint in round-robin.
DpDisableEvent
IdlErrorCodes DpDisableEvent(int callback_index, IdlDev *dev, IdlDatapoint *dp); |
When a datapoint's monitor.event attribute is set to false, the IDL calls the DpDisableEvent callback function. The IDL driver instance (IDI) responds to this request by calling IdlDpDisableEventResult.
CoV Related Functions
The following functions are used to support CoV-related activities.
IdlDpEnableEventCallbackSet
void IdlDpEnableEventCallbackSet(Idl *idl, IdlErrorCodes(*DpEnableEvent)(int, IdlDev *, IdlDatapoint *)); |
IdlDpDisableEventCallbackSet
void IdlDpDisableEventCallbackSet(Idl *idl, IdlErrorCodes(*DpDisableEvent)(int, IdlDev *, IdlDatapoint *)); |
IdlDpEnableEventResult
void IdlDpEnableEventResult(int callbackIndex, IdlDev *dev, IdlDatapoint *dp, IdlErrorCodes idlError); |
This function is called by DpEnableEvent
to return an indication of success or failure.
IdlDpDisableEventResult
void IdlDpDisableEventResult(int callbackIndex, IdlDev *dev, IdlDatapoint *dp, IdlErrorCodes idlError); |
This function is called by DpDisableEvent
to return an indication of failure.
IdlOnDpEvent
void IdlOnDpEvent(IdlDev *dev, IdlDatapoint *dp, char *prioArray, double value); |
For all successful CoV subscriptions, the IDI reports a changed datapoint value using IdlOnDpEvent. The IDL passes the value through the fast path algorithm and publishes to ev/data
for all other monitoring filters.