These tutorials explains how to use foreign (as in non-Java) code in your Reactive Block application. Another term for foreign is native, because embedding non-Java code usually introduces platform and portability issues.
Make sure you have read the intro foreign-code-intro to prepare what you need for this tutorial.
Download the tutorial named “(Level 3) Foreign code v1: External process”
* Transfer the file to your Raspberry-Pi.
* Compile to an executable with this command:
gcc -W -o wd wd-1.c
Now you you have created one executable named
wd on the Raspberry-Pi that you can test.
The block to understand is the WD Process. It has three start pins, enable, disable and heartbeat that controls the watchdog. Each command takes some time to execute and in that period the block will not accept any other command. Errors are reported on the error pin and the ok pin indicates successful operation.
All commands to the watchdog will generate a commandline that is forwarded to the Process Runner, that also resides in the same project.
In case the command is not completed in time, the process will be killed. You should be careful to tune the timeout to not abort the child-process to early vs. having a blocked/runaway process for too long time.
All commands reference the applicaton you generated in part 1 of this tutorial.