Page 1 of 1

AppConnector C# retrieve messages

Posted: 17 Nov 2011, 09:50
by krcn
Hi there,

I'm trying to retrieve messages from BCI2000 over UDP connection.
I'm using the AppConnector: http://www.bci2000.org/wiki/index.php/T ... _Connector
and I receive messages that have the following format:

EmotivGyroX 26720
EmotivGyroY 26832
EmotivCQCMS 1
EmotivCQDRL 1
EmotivCQFP1 0
EmotivCQAF3 0
EmotivCQF7 0
EmotivCQF3 0
EmotivCQFC5 0
EmotivCQT7 0
EmotivCQP7 0
EmotivCQO1 0
EmotivCQO2 0
EmotivCQP8 0
EmotivCQT8 0
EmotivCQFC6 0
EmotivCQF4 0
EmotivCQF8 0
EmotivCQAF4 0
EmotivCQFP2 0
Running 1
Recording 1
SourceTime 36288
FixationViolated 0
GazeCorrectionMode 0
TargetCode 0
ResultCode 0
Feedback 0
CursorPosX 0
CursorPosY 0
CursorPosZ 0
StimulusTime 36277
Signal(0,0) 5.21222

I read on the BCI-Wiki: http://www.bci2000.org/wiki/index.php/T ... 0_Messages
that each message starts with a descriptor.
How can I read the descriptor value?
I retrieve messages with the following code:

receive_byte_array = listener.Receive(ref groupEP);
udpMessage = Encoding.ASCII.GetString(receive_byte_array, 0, receive_byte_array.Length);

But the variable "udpMessage" just contains the content, no descriptor value...
How to extract the descriptor value?

Another question: Are messages always in the same order?

Any help would be great :)

Nadine

Re: AppConnector C# retrieve messages

Posted: 18 Nov 2011, 08:39
by mellinger
Hi,

AppConnector messages are completely unrelated to the binary message format BCI2000 uses for communication between its modules. The format of AppConnector messages is described on the AppConnector wiki page, under "Protocol":
http://www.bci2000.org/wiki/index.php/T ... r#Protocol

AppConnector messages are just pairs of names and values in ASCII representation, separated with a space character.
Another question: Are messages always in the same order?
Once BCI2000 has started up, messages will always be in the same order. On the next start of BCI2000, states may have been added or removed, so the order will not be preserved. In the current version of BCI2000, states are sent first, in alphabetical order, and then signal values follow. This may change in future versions of BCI2000, so you should not rely on it.

Regards,
Juergen

Re: AppConnector C# retrieve messages

Posted: 21 Nov 2011, 03:17
by krcn
Okay, thank You for your help!

Nadine