Custom Driver Example Overview
This section of the developer’s guide provides an outline for creating a custom driver. It includes inline code references to sample C++ code that implements a simple example custom driver. This driver example demonstrates the general architecture and flow of a custom driver and uses the primary IDL library calls. In place of communicating to actual third-party devices using a custom protocol, this example outputs information to the SmartServer IoT console to show you the general software flow for a custom driver instance (IDI), and the data passed between a driver instance and IDL.
This example includes the following files.
- main.cpp – The software entry point for an IDL driver. main.cpp instantiates a new IDL driver instance (IDI), registers callback routines with the IDL library, defines any threads needed by the custom driver for its own operation, and kicks off the custom driver by initializing the driver instance itself.
- example.cpp – The primary source file for the custom IDL driver example. It contains the callback functions, as well as code associated with any custom driver threads instantiated in main.cpp.
- example.h – The header file for example.cpp.
- example.conf – The configuration file used to run the driver as a service.
- example-idl.conf – The configuration file used to start up the driver instance with the IDL library.
- exampledevice.xpl – A sample device interface (XIF) file to use with this driver.
- exampledevice.dtd – A sample device type definition file to use with this driver.
- makefile – A make file that can be used to simplify compiling the example driver.