Description
Hey there.
I require a Labview Interface to liblsl. When triing to create a wrapper for the liblsl64.dll in labview i noticed that labview cant interface methods which use classes (C++) like xml_element, stream_info, stream_outlet, or stream_inlet as parameters or return types. My current idea is to create a C wrapper for the C++ Code (like so: https://stackoverflow.com/questions/32572505/labview-dll-import ) which i would then compile to a dll and wrap again with labview (like so: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Ls1SAE&l=de-DE ).
From quickly looking over the i.e. matlab interface i noticed, that those, to my understanding, fully rewrite the classes. I am not sure if that is a better approach. It seems that it would be harder to maintain if lsl is updated.
Before starting to try to implement the wrapper-wrapper i wanted to ask for advice, if a labview interface is already available or planned, or if pure C wrapper code (which would be usefull for other language interfaces as well) is already available.
thank you very much for your time!
Activity
cboulay commentedon May 2, 2019
liblsl uses a C API. Are you including lsl_c.h?
https://github.com/sccn/liblsl/blob/1.13/include/lsl_c.h
mgrivich commentedon May 2, 2019
To use a few more words that Chadwick: The primary interface for LSL is written in C, and is visible in lsl_c.h. lsl_cpp.h is a wrapper around lsl_c.h. LabView should interface with lsl_c.h fine, and you won't lose any functionality by doing so.
maltesen commentedon May 3, 2019
Thx for the very fast response! It was on spot. I didn't understand that the C API was complete.
I managed to wrap some functions of the C Interface with LabVIEW and created an outlet appearing as "(invalid: bad lexical cast: source type value could not be interpreted as target) ()" in Lab Recorder. So far I call that a success. Ill put more time into that interface next week.
Have a nice weekend!
wjcroft commentedon Sep 15, 2019
@maltesen, hi. Do you have any updates on your LabVIEW LSL capability? It would also be helpful for those OpenBCI users who want to stream data from our Cyton or Ganglion boards. Let us know if you have a website or repo.
Regards, William Croft, OpenBCI
mgrivich commentedon Sep 15, 2019
That issue that maltesen ran into should be fixed in the latest releases. https://github.com/sccn/liblsl/releases
maltesen commentedon Sep 16, 2019
I just made my code public due to @wjcroft s request.: https://github.com/maltesen/liblsl-LabVIEW
It is WORK IN PROGRESS. I did not implement wrappers for all datatypes/package/message types (not sure what they called them). IIRC in the contained labview project i did auto create wrappers for all functions. However the auto created ones do not work (wrong types are beeing used or similar) so i moved all of them to a TODO or similary named folder in in labview project and only implemented a few of them in a working state (those not in the TODO folder) for proof of concept. It is undocumented and unsupported - just my personal copy of it. It is not based on the latest version of labview (though it should work in LV2019 (not tested)) nor liblsl (it contains a precompiled liblsl dll iirc which is of an older version). it does exemplarily show how to wrap the library and how to read/write from a socket of say the matlab example using a single or a few of the available datatypes/packages/messages. Im sorry i cant provide anything more atm. as our use of liblsl has been posponed i never developed it past proof of concept. It will however be further developed/finished at some point (liblsl is a planed feature for our current project).
wjcroft commentedon Sep 16, 2019
@maltesen / Malte, you are a gentleman and a scholar! Thanks so much. Have referred our forum thread to your code and this issue.
https://openbci.com/forum/index.php?p=/discussion/2292/how-should-my-labview-program-interact-with-ganglion-bled112#latest
Best regards, William Croft, OpenBCI
veruccia commentedon Jan 12, 2021
Dear @maltesen,
I need to stream data from Emotiv Epoc Flex to LabView. Emotiv support LSL connection with Matlab (https://github.com/Emotiv/labstreaminglayer) but no information about LSL sta exchange to LabView.
Can you please help me to do it with your code?I'm using Mac. Thanks
maltesen commentedon Jan 12, 2021
vg1969 commentedon Jan 12, 2021
Dear @maltesen thank you for reply.
The real time data exchange between Emotiv and LabView can be performed using LSL or websocket.
maltesen commentedon Jan 13, 2021
maltesen commentedon Jan 13, 2021
vg1969 commentedon Jan 13, 2021
Thank you very much for support.
I thought it was simpler. The interface with Matlab using LSL is easy using the function vis_stream.m (https://github.com/Emotiv/labstreaminglayer/blob/master/examples/matlab/readme.md) but I need to use LabView with something likes this code (https://forums.ni.com/t5/Example-Code/LabVIEW-Emotiv-Toolkit-V2/ta-p/3493301?profile.language=it) that is used for the oldest version of Emotiv devices.
maltesen commentedon Jan 13, 2021
vg1969 commentedon Jan 13, 2021
I think is a good solution. I will try