An external application sending information to BCI2000
An external application sending information to BCI2000
Hi
I am now working on sending data from an external application to BCI2000, running locally.
I have read 'Technical Reference:App Connector'
What I understand is I should use UDP socket to send data to certain address( local) and certain port. But I don't fully understand what should I send and how the BCI 2000 can interpret it.
For example, I want to send 2 variable value (float) X and Y. And I have alreadly created corresponding states in BCI2000 application.
What should I send if I want to set the value of X to 1?
Thanks a lot~
Enhao
I am now working on sending data from an external application to BCI2000, running locally.
I have read 'Technical Reference:App Connector'
What I understand is I should use UDP socket to send data to certain address( local) and certain port. But I don't fully understand what should I send and how the BCI 2000 can interpret it.
For example, I want to send 2 variable value (float) X and Y. And I have alreadly created corresponding states in BCI2000 application.
What should I send if I want to set the value of X to 1?
Thanks a lot~
Enhao
Enhao,
BCI2000 states hold only unsigned integers, so you cannot store float values in them.
To set the value of a state X to 1, sendto the UDP socket, i.e. the name of the state followed with white space followed with the value and a newline character.
Best regards,
Juergen
BCI2000 states hold only unsigned integers, so you cannot store float values in them.
To set the value of a state X to 1, send
Code: Select all
X 1\n
Best regards,
Juergen
When I send data through udp, it says
'Warning:ConnectorInput::Process: Ignoring value for non-existent'
in the system log.
Why?
The sended states exist and can be found from BCI2000 Viewer.
Thanks
'Warning:ConnectorInput::Process: Ignoring value for non-existent'
in the system log.
Why?
The sended states exist and can be found from BCI2000 Viewer.
Thanks
mellinger wrote:Enhao,
BCI2000 states hold only unsigned integers, so you cannot store float values in them.
To set the value of a state X to 1, sendto the UDP socket, i.e. the name of the state followed with white space followed with the value and a newline character.Code: Select all
X 1\n
Best regards,
Juergen
I just write like:
sprintf(sendBuf,"X %d\n",_value);
sendto(_svr,sendBuf,strlen(sendBuf)+1,0,(sockaddr*)&_addrsvr,len);
Is "\n" the right newline character?
sprintf(sendBuf,"X %d\n",_value);
sendto(_svr,sendBuf,strlen(sendBuf)+1,0,(sockaddr*)&_addrsvr,len);
Is "\n" the right newline character?
mellinger wrote:I tested the connector input, and found that I can send state information via UDP. Could it be that you are sending a DOS line ending rather than a newline character at the end of each line?
Thanks a lot.mellinger wrote:You send one more character than there are characters in the string. This will result in an additional '\0' character being sent at the end of the string. Removing the "+1" from your code will probably make it work.
I have correct this mistake.
It works well to use'Running 0\n' to suspend the application.
I want to use external signal to control the cursor position in visualization module, what should I do?
I have tried in the Signal Generator application but did not make it. I set 'CursorPosX 1\n' but the Cursor does not change it position.
Enhao
Enhao,
the cursor is not controlled via the CursorPos states. Rather, its horizontal and vertical speed are controlled by the signal: Signal(0,0) controls horizontal velocity, Signal(1,0) controls vertical velocity. Velocities are scaled by the application module, such that a control signal with zero mean and unit variance will move the cursor across the screen in the amount of time given by the FeedbackDuration parameter.
Regards,
Juergen
the cursor is not controlled via the CursorPos states. Rather, its horizontal and vertical speed are controlled by the signal: Signal(0,0) controls horizontal velocity, Signal(1,0) controls vertical velocity. Velocities are scaled by the application module, such that a control signal with zero mean and unit variance will move the cursor across the screen in the amount of time given by the FeedbackDuration parameter.
Regards,
Juergen
Thanks Juergenmellinger wrote:Enhao,
the cursor is not controlled via the CursorPos states. Rather, its horizontal and vertical speed are controlled by the signal: Signal(0,0) controls horizontal velocity, Signal(1,0) controls vertical velocity. Velocities are scaled by the application module, such that a control signal with zero mean and unit variance will move the cursor across the screen in the amount of time given by the FeedbackDuration parameter.
Regards,
Juergen
So does it means that we have to modify the cursor application if we want to directly control the position of the cursor instead of velocity of movement.
I have just programmed a .cpp and .h as logger of the external input.
In the wiki, it says:
'Now, when we add the ThumbWheelLogger.cpp file to a source module, then the module will contain an object of our newly created class, and it will listen to the --LogThumbWheel=1 command line option.'
Should I just add the object into the g.USBamp source module? I haven't used Borland so I am a little confused
Thanks a lot
Enhao,
if you want to use a logger, add its cpp file to the project that builds the source module you want to use. In the Borland IDE, this can be done by first activating the project in the projects view (double-clicking it), and then dragging the logger's cpp file onto the projects view.
Regards,
Juergen
if you want to use a logger, add its cpp file to the project that builds the source module you want to use. In the Borland IDE, this can be done by first activating the project in the projects view (double-clicking it), and then dragging the logger's cpp file onto the projects view.
Regards,
Juergen
Who is online
Users browsing this forum: No registered users and 25 guests