QtWS17 - QtIVI: Integrating and Testing vehicle functions with Qt Automotive Suite, KDAB
Channel: Qt Group
Date: 2017-10-25

QtIVI has been part of the Qt Automotive Suite since its initial release. It facilitates the creation of Qt based interfaces for vehicle functions such as climate control, media services, etc.

Taking native vehicle data APIs and bringing them into Qt is potentially cumbersome. Code has to be deriving from QObject, exposing properties, and mapping values and calls to the native APIs. Some vehicle data require custom data models and special handling of data updates. Often the real vehicle is not available for application developers so it is useful to build versions of the API that simulated the vehicle data. Finally, testing and profiling tools for native APIs are usually cumbersome and do not integrate with Qt nicely.

The Qt Automotive Suite QtIVI module introduced a number of patterns to handle these issues including a base classes for basic scenarios, switchable plugins to  selected between real or simulated backends, and tools in Gammaray to access and manipulate properties of objects at run time. While this was a big step forward, these still required work writing many objects and models, integrating the backend APIs and maintaining the required plugins.

In order to simplify this process further, Qt Automotive Suite 2.0, which will be launched at the end of the year, Introduces the IVIGenerator which is based on the QFace autogeneration framework. QFace is an open source framework where the vehicle interfaces are described in an IDL which supports familiar Qt constructs such as properties, operations, signals, models, etc. IVIGenerator then uses a template based code generator to produce code for the frontend Qt interface as well as for the backend.

The IDL supports additional concepts such as valid ranges, default values, etc. These are used in the simulator backend to support debugging. IVIGenerator can also generate backends to support unit testing based on the provided values.

In this talk we show how the code generator can be used to fully automate the generation of the frontend code while producing easily extendable stubbed backend code. We go on to show how the actual generation, by virtue of being templated, can be modified to include much of the back end integration code.