Next: , Up: Using Dezyne in your C++ environment   [Contents]

3.2.1 Creating the C++ environment

The first step to start integrating your Dezyne models in an actual application is to generate code from all the models. This can be done in two ways, namely through the Dezyne application or by use of the command line client. In the Dezyne application, right-click on your *.dzn files and navigate to the ‘Generate Code‘ menu item. There you can select multiple programming languages to generate code for. Select a location where the generated code should be stored and Dezyne will generate code for you. Later on in this section, we will discuss how to automate this process by use of the Dezyne command line client and a makefile in Breakdown of example makefile automating Dezyne features.


Up until now, we have approached the application as an event-based system. In order to run as a program on the Raspberry, though, we must have some kind of (infinite) loop that will provide the system with events. From here on after, this loop will be referred to as the event loop. Let’s start by creating a main function to contain this event loop for our application.

int main(int argc, char* argv[]) {
  while(true) {
    // Dezyne interaction

The above main function will run until cancelled and each iteration of the while(true) loop will perform some kind of interaction with Dezyne later on. This is the easiest way of facilitating the event loop required by the Dezyne-generated code.