What is the datapointInterface for?


#1

I’m not a 100% sure if I understand the purpose of the dataPointInterface correctly. What I think it is:

It is an interface which is called whenever a value for an IO point is received. The value can be manipulated at this point before it is written to the IO point. So you could do data conversion stuff like converting from int to float or the other way around. And because you get the link id you could also do something like mapping value ranges to each other. For example if you have IO points io1 and io2 and io1 produces values in the range [0;100] and io2 expects values in the range [0;300] you could map it here like follows (super simplified pseudocode :wink: )

if (src == io1 and dest == io2)
   mapValues();

Am I right?


#2

Yes!

The original intent is to allow customized IO Points, that would have their own logic and visual appearance.
Every GUI-IOPoints is also just a html5 webpage.

The process is like this:
New Data Input -> your code -> callback to engine -> write processed data to the record -> Check if that record has links.

You can find for example a very simple delay experiment in the datapointInterface files.

Every IO point has a this.plugin value. Right now it is set to default. But this setting can be used to define which IO-Point plugin is used for your IO-Point.

This has a lot of potential to be well reflected in the Reality Editor GUI.
You can see in some of the earlier work (Like the Lego Car), that we have programmed virtual programming points. That concept can be implemented with the datapointInterface but I have not had the time to bring it back with the Reality Editor App or really make use of it.

In the Media Lab we are working on a better version at the moment for representing the virtual dataPointInterface in the GUI. Because I am not quite sure if the present IO-Point GUI representation for virtual (logical) IO-Points is the best solution.

If you have some ideas for that, you can modify and play around with the editor code:

All you need to do is to drop it in to your own webserver and point the reality editor app to that URL to load your modified versions. (Thats a feature since Reality Editor Version 1.5.2)