AppConnectorExample data packet

Forum for software developers to discuss BCI2000 software development
Locked
NooN
Posts: 4
Joined: 14 Sep 2011, 00:12

AppConnectorExample data packet

Post by NooN » 14 Sep 2011, 00:25

Hi,

i am using the AppConnectorExample to forward the packets to java application
in java side when i tried to extract the data i could not interpret the info.
i have read the http://www.bci2000.org/wiki/index.php/T ... 0_Messages
but it was not so useful to me
I know it sends state & value but what they represent and how could i use them ???
Sending data occurs immediately after the task filter of the application module processes the data; receiving occurs immediately before the task filter.
does this mean that i am getting the result of each flash of row/column ?
and how to get the filtered result??

thank you in advance .....

mellinger
Posts: 1052
Joined: 12 Feb 2003, 11:06

Re: AppConnectorExample data packet

Post by mellinger » 14 Sep 2011, 09:18

For information about the AppConnector protocol, see
http://www.bci2000.org/wiki/index.php/T ... _Connector

For information about state values and signals in the P3Speller configuration, please see
http://www.bci2000.org/wiki/index.php/U ... oralFilter
http://www.bci2000.org/wiki/index.php/U ... ask#States

Basically, the Signal Processing module sends scores for individual rows and columns in Signal(0,0) whenever the StimulusCodeRes state is nonzero. The value of StimulusCodeRes then represents the stimulus: 1..N are rows, N+1..N+M are columns when N is the number of rows, and M the number of columns.

Regards,
Juergen

NooN
Posts: 4
Joined: 14 Sep 2011, 00:12

Re: AppConnectorExample data packet

Post by NooN » 23 Sep 2011, 15:20

thank you very much,

i have tried to listen to the same port number by using java UDPReceive without the AppConnector, i get the packets but i can't understand why i received the same "SelectedTarget" value 29 times but the other states are different such( SourceTime , StimulusTime ...etc)
e.g. i received this 29 times
SelectedTarget 35
------
SelectedRow 6
------
SelectedColumn 5


________________________________________________________________________
i know that the AppConnector is bi-directional, but what the advantage of using it over using the conventional UDP receive classes to listen to the packets ?

thank you again

NooN
Posts: 4
Joined: 14 Sep 2011, 00:12

Re: AppConnectorExample data packet

Post by NooN » 24 Sep 2011, 00:56

NooN wrote:thank you very much,

i have tried to listen to the same port number by using java UDPReceive without the AppConnector, i get the packets but i can't understand why i received the same "SelectedTarget" value 29 times but the other states are different such( SourceTime , StimulusTime ...etc)
e.g. i received this 29 times
SelectedTarget 35
------
SelectedRow 6
------
SelectedColumn 5


________________________________________________________________________
sorry i was writing the IP address in connector instead of writing it in Destination address

mellinger
Posts: 1052
Joined: 12 Feb 2003, 11:06

Re: AppConnectorExample data packet

Post by mellinger » 26 Sep 2011, 08:42

"AppConnector" is the name of a protocol that uses UDP to transfer data from BCI2000 to external applications, and back. When your external application is written in Java, then you use Java means to send and receive AppConnector data over UDP. There is no alternative between the two, as you seem to imply in your post.

The "SelectedTarget", "SelectedRow", and "SelectedColumn" states are set once classification is done, and they keep their nonzero values until the next presentation sequence starts.
To get information about what state values mean, go to
http://www.bci2000.org/wiki/index.php/U ... nce:States
and search for the name of the state you are interested in. Information about that state is provided via the links listed under its name.

Regards,
Juergen

mmadrid
Posts: 2
Joined: 01 Nov 2011, 13:30

Re: AppConnectorExample data packet

Post by mmadrid » 16 Feb 2012, 09:23

Hi!

I'm testing the AppConnectorExample but it crashes or freezes when I am running BCI2000 and I can't see all the packets.
Is there any way I can capture UDP packets from BCI2000 using wireshark? I'm trying to do it, but I'm not catching anything from BCI2000.

My final goal is to make my SSVEP application to work with signals from BCI2000. When launching BCI2000 should I pick the dummy application and then run also mine?

Thank you in advance.

mmadrid
Posts: 2
Joined: 01 Nov 2011, 13:30

Re: AppConnectorExample data packet

Post by mmadrid » 16 Feb 2012, 11:18

By the way, I think I shouldn't be getting these numeric states, right?

Image

mellinger
Posts: 1052
Joined: 12 Feb 2003, 11:06

Re: AppConnectorExample data packet

Post by mellinger » 16 Feb 2012, 13:54

I'm testing the AppConnectorExample but it crashes or freezes when I am running BCI2000 and I can't see all the packets.
I fixed a few issues in the AppConnectorExample, so it should work properly now.
Is there any way I can capture UDP packets from BCI2000 using wireshark? I'm trying to do it, but I'm not catching anything from BCI2000.
This should work fine. I guess you need to read from the UDP socket in question, otherwise no traffic flows that might be picked up by wireshark.
My final goal is to make my SSVEP application to work with signals from BCI2000. When launching BCI2000 should I pick the dummy application and then run also mine?
Yes, that's how it is supposed to work. To receive data in a robust manner, you have to take into account that the UDP socket's buffer contents are overwritten when data is not read in a timely manner, so you may receive incomplete data packets, which may confuse your application if reading data is not done in a robust fashion. This was the reason for the "number" states you observed -- I guess you were transmitting a large amount of data, so the AppConnectorExample could not keep up, and data were lost.

In the updated version of the AppConnectorExample, two things have been improved:
1) Data is now read line-by-line rather than string-by-string. This way, data loss cannot cause parsing of names and values to go out of sync, as it was happening for you.
2) Data is now read from a separate thread, so data will be read from the buffer in a timely manner, which should make data loss practically impossible (unless storing a packet's data takes more time than transmission itself).

Regards,
Juergen

Locked

Who is online

Users browsing this forum: No registered users and 1 guest