Now, here is a step-by-step on how implement OpenVibe VRPN server in OpenInterface.
1) Open a new general project in eclipse (File> new> project> general> project);
call it, for example, “VRPN_OV”
2) Create an OI component folder (right click on the project name);
5) Generate a c++ CDIL (right click on the component) and save it into the projet ETC directory;
<NDims ref=”### a parameter name giving the size of dimension No0 ###” type=”custom”/>
<NDims ref=”number” type=”custom”/>
Where “number” is the name of the argument that represent the size of the array.
Now we have to write the c++ code for the component. To help us, OpenInterface can generate the main structure.
For this, right click on the CDIL file and click on “Generate OI Component Skeleton> C Skeleton”.
We have to modify our VRPN code to comply with this structure.
An other point is that our VRPN code use a “struct” in the callback arguments but OpenInterface only allows primitive types (like int, double, …).
So, we will use the original Analog VRPN callback to call an other callback with the 2 primitive arguments needed (the number of channels and the array who contain the value of each channel).
Here is the final code that we have to implement :
Compile it, as a DLL, with Visual Studio.
In Eclipse, add “VRPN_OV_Facet.h” and “VRPN_OV.dll” in the bin directory of the component.
Install the component (right click on oi.package.manifest> istall OI Package)
Now we will verify the component.
We will use a simple Sinus oscillator in OpenVibe and send the signal with a VRPN server.
In our Skemmi diagram, we will add an array spliter (OI Adapters) and an oscilloscope (Skemmi components). The array splitter is used to split our array into separate data (the OI oscilloscope can’t display an array, it can only displays separate values). There is no offset for the splitter array (we want all the channels).
Run OpenVibe and OpenInterface.