Sending trigger to acquisition server from CSharp Programm

Come here to discuss about OpenViBE in general!
Post Reply
Fry
Posts: 3
Joined: Wed Feb 04, 2015 7:45 am

Sending trigger to acquisition server from CSharp Programm

Post by Fry »

Hi,

I try to send triggers to the acquisition server.
With an C++ program it works well.
But I have a C# program, who have to send the triggers.

I tried to use an C++ DLL that will start from C#, but it don't work. He don't send any Signal.

Has anyone an idea how to do that?

Thanks,
Fry

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: Sending trigger to acquisition server from CSharp Progra

Post by toncho11 »

Hi,

I am the creator of the software tagging. I have C# wrapper for all the taggings.You need to use the attached C++ Managed code wrapper dll. It is designed for P300, but you can use it with TestWriteValue for anything:

Code: Select all

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace test_managed_tagger
{
    class Program
    {
        //managed wrapper openvibe-tagging-wrapper dll is required
        //unamanaged inpout32.dll is required
        static void Main(string[] args)
        {
            OpenVibeTaggingWrapper p = new OpenVibeTaggingWrapper(OpenVibeTaggingWrapper.eProtocol.Software,"openvibeExternalStimulations");
            //OpenVibeTaggingWrapper p = new OpenVibeTaggingWrapper(OpenVibeTaggingWrapper.eProtocol.EightBitParallelPort,"888");
            //string comPort = Console.ReadLine();
            //OpenVibeTaggingWrapper p = new OpenVibeTaggingWrapper(OpenVibeTaggingWrapper.eProtocol.SerialPort, comPort);

            for (int i = 0; i < 10; i++)
            {
                //p.SetTargetRow(5);
                Console.WriteLine(i);
                System.Threading.Thread.Sleep(1000);
                //p.TestWriteValue(i);
                p.TestWriteValue(32779);
            }
        }
    }
}
https://drive.google.com/file/d/0B2R2Bc ... sp=sharing

It also supports Serial port and USB, parallel port, etc.
We use this wrapper for P300 C# speller application.

Fry
Posts: 3
Joined: Wed Feb 04, 2015 7:45 am

Re: Sending trigger to acquisition server from CSharp Progra

Post by Fry »

Hi,

thanks for your answer.
I test the Csharp code with your dll, but the Acquisition client receives no Signal.

Here is a Picture of my OpenVibe Designer Scenario:
designer_scenario.png
designer_scenario.png (19.67 KiB) Viewed 12024 times
In the Acquisition Server I have enabled the Plugin Settings "EnableExternalStimulations" and openvibeExternalStimulations as the "ExternalStimulationQueueName".
aq_server_conf.png
aq_server_conf.png (19.64 KiB) Viewed 12024 times
What do I wrong? Have I to do something else?

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: Sending trigger to acquisition server from CSharp Progra

Post by toncho11 »

It was working last time I checked.

I will need to debug it.

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: Sending trigger to acquisition server from CSharp Progra

Post by toncho11 »

Ok, so one important thing is that you need to start your c# program before the AS.

I also tried with different version of boost library. I compiled both my C# application wrapper and the acquisition server with boost 1.54 (OV uses 1.47) and now it is working.

toncho11
Posts: 124
Joined: Tue Apr 19, 2011 7:58 pm

Re: Sending trigger to acquisition server from CSharp Progra

Post by toncho11 »

https://drive.google.com/file/d/0B2R2Bc ... sp=sharing
https://drive.google.com/file/d/0B2R2Bc ... sp=sharing

So the above is an AS compiled in Debug with boost 1.54
and the wrapper compiled in Release with boost 1.54
Both were compiled with source code of OV 0.17

It might all work for you now.

Fry
Posts: 3
Joined: Wed Feb 04, 2015 7:45 am

Re: Sending trigger to acquisition server from CSharp Progra

Post by Fry »

Unfortunately it don't work. :(

The "openvibe-acquisition-server.exe" does not start. He don't find "GUSBAMP.DLL". What is it?
"openvibe-tagging-wrapper.dll" runs, but I get still no signal.


My current solution:
What I do now to get signals to the AQ-Server is to use the sample from here:
http://openvibe.inria.fr/vrpn-tutorial- ... -openvibe/
I modified the Button VRPN Client to get 4 diffrent signal types.

To send signals from my CSharp program I use VrpnNet (http://wwwx.cs.unc.edu/~chrisv/vrpnnet).

To test the timing i send singals in 1000ms interval to openvibe.
With a frequence of 1024 Hz in the aquistion server (generic oscillator) I get an accuracy from +-2ms.
Using the EEG driver with 500Hz the accuracy is +-4ms.
Thats good enough for now.


But I would like to test your "tagging-wrapper" also.

Post Reply