A datapoint read can be issued because of periodic polling, an on-demand get request, event-driven monitoring, or when polling the first datapoint of a device for first provision, test action, or health checking. In all the cases, the DpRead callback function is called by the IDL that was registered during the init process.
Datapoint Read Callback Function
DpRead
IdlErrorCodes DpRead(int callback_index, IdlDev *dev, IdlDatapoint *dp, void *idlContext); |
The callback_index is of no significance to the IDI. It must be passed as is back to the IDL when calling IdlDpReadResult.
When a datapoint read is complete, IDI reports the result to the IDL using IdlDpReadResult.
Datapoint Read Related Functions
IdlDpReadCallbackSet
void IdlDpReadCallbackSet(Idl *idl, int (*DpRead)(int, IdlDev *, IdlDatapoint *, void *)); |
Must be called by the IDI prior to calling IdlInit
.
IdlDpReadResult
void IdlDpReadResult(int callbackIndex, IdlDev *dev, IdlDatapoint *dp, void *idlContext, int idlError, char *prioArray, double value); |
Must be called by the IDI at the end of the callback function before exiting.
The actual value of the datapoint must be sent as a double value.
Note: prioArray is not used by the IDL currently. The IDI can send it as NULL.