When a device create request is received from the CMS, the IDL calls the IDI (IDL Driver Instance) OnDevCreate callback function that was registered during the init process.

Callback_index is of no significance to the IDI. It must be passed as is back to the IDL when calling IdlDevCreateResult.

The “args” passed to the IDI device create callback function is the stringifiedargs” JSON object that is received in the actual MQTT request for device creation, which contains some or all of the following fields:

xif_dp_array is currently passed as NULL.  In future versions of IDL, this will contain the stringified JSON array of the datapoints obtained after parsing the XIF file. This will contain protocol specific information for the datapoints that IDL did not interpret. The IDI driver process will be responsible to parse this array and link the information to the main device and datapoint structures.

When the IDL calls the device create callback function, the IDI performs protocol specific device creation. If there is any protocol specific device data that needs to be linked to the IDL device structure, it can be linked to void *idiDevData within IdlDev. It can also link any protocol specific datapoint data to individual datapoints to void *idiDpData within IdlDatapoint.

Upon completion, the IDI must call IdlDevCreateResult with the callback_index, pointer to IdlDev, and the appropriate idlError  (see Error Codes).

Device Create Callback Function


IdlErrorCodes OnDevCreate(int callback_index, IdlDev *dev, char *args, char *xif_dp_array);

Device Create Related Functions


void IdlDevCreateCallbackSet(Idl *idl, int (*OnDevCreate)(int, IdlDev *, char *, char *));

Must be called by IDI prior to calling IdlInit.


void IdlDevCreateResult(int callback_Index, IdlDev *dev, int idlError);

Must be called at the end of the callback function before exiting.