This repository contains skeleton code for a Xentara driver with the following features:
Connection based | Batch processing | Polymorphic Data Points |
---|---|---|
NO | YES | YES |
This driver template requires the Xentara development environment, as well as a Xentara licence. You can get a Xentara licence in the Xentara Online Shop.
The documentation for Xentara can be found at https://docs.xentara.io/xentara.
This driver template uses the Xentara Utility Library, as well as the Xentara Plugin Framework. The corresponding documentation can be found here:
https://docs.xentara.io/xentara-utils/
https://docs.xentara.io/xentara-plugin/
The repository include a CMakeLists.txt file for use with CMake, which allows you to build the source code out of the box, as long as the Xentara development environment is installed. If you whish to use a different build system, you must generate the necessary build configuration file yourself.
The source code in this repository is documented using Doxygen comments. If you have Doxygen installed, you can generate detailed documentation for all classes, functions etc., including a TODO list. To generate the documentation using CMake, just build the target docs by executing the following command in your build directory:
cmake --build . --target docs
This will generate HTML documentation in the subdirectory docs/html.
(See I/O Components in the Xentara documentation)
src/TemplateIoComponent.hpp
src/TemplateIoComponent.cpp
The I/O component template provides template code for I/O components that can never be disconnected or reconnected to the computer. Such components are either entirely stateless, or require a single initialization and deinitialization call. This generally includes three types of components:
- I/O components that are physically located inside the computer (PCIe expansion boards, SPI or I2C components etc.),
- I/O components that are permanently attached to the computer, and cannot be removed or reattached without shutting down, or
- virtual I/O components, that do not represent physical devices at all (simulators, A/I models, computational units etc.).
(See I/O Transactions in the Xentara documentation)
src/TemplateIoTransaction.hpp
src/TemplateIoTransaction.cpp
The I/O transaction template provides template code for a batch communications request that can read and write multiple data points at the same time.
The template code has the following features:
- All data points attached to an I/O transaction share common Xentara attributes for update time, quality and error code, which are maintained centrally in the I/O transaction. These attributes are then inherited by the data points, so that they can be accessed as attributes of the data point as well.
- The I/O transaction publishes a Xentara task called read, which acquires the current values of all data points from the I/O component using a read command.
- The I/O transaction publishes a Xentara task called write, that checks which outputs have pending output values, and writes those outputs to the I/O component using a write command (if there are any).
- The I/O transaction publishes Xentara events to signal if a write command was sent, or if a write error occurred. These events are not inherited by the data points, who have their own individual events instead. This is done so that the events of the individual outputs can be raised individually for only those outputs that were actually written.
(See Skill Data Points in the Xentara documentation)
src/TemplateInput.hpp
src/TemplateInput.cpp
The input template provides template code for a read-only skill data point whose value is read using an I/O transaction.
The template code has the following features:
- The data type of the value is configurable in the model.json file.
- The input inherits Xentara attributes for update time, quality and error code from the I/O transaction, and shares them with all other data points belonging to the same I/O transaction.
src/TemplateOutput.hpp
src/TemplateOutput.cpp
The output template provides template code for a read/write skill data point whose value must be read and written using individual commands for each output.
The template code has the following features:
- The data type of the value is configurable in the model.json file.
- The input and output values are handled entirely separately. A written output value is not reflected in the input value until it has been read back from the I/O component by the I/O transaction. This is necessary because the I/O component might reject or modify the written value.
- The value of the output is not sent to the I/O component directly when it is written, but placed in a queue to be written by the I/O transaction.
- The output inherits Xentara attributes for update time, quality and error code from the I/O transaction, and shares them with all other data points belonging to the same I/O transaction.
- The output publishes Xentara events to signal if a new value was written, or if a write error occurred.