> On 26/01/2016, at 08:01, Brina <
sah...@gmail.com> wrote:
>
> I do have a computer science background but no experience in TCP, networking or driver coding. What would you recommend as a first step? I really don't know where to start here…
Hi Sabrina,
Great, so it sounds like you'll be well-placed to deal with this. There are lots of on-line resources for implementing TCP communications in Python.
> According to the manual, the protocol TCP/IP. I'm not sure how relevant this is, but these further specifications are given: It's WLAN IEE 702.11b/g, 9dBm (8mW) radiated power and a WEP encryption.
These technical specs won't be too relevant: its just a (poorly secured) wireless network like any other, but used to connect two specific machines rather than provide a connection to the internet. I'm not sure which direction this ad hoc network will go: it sounds like the EEG hosts the network (i.e. you join it from your computer like you would any other wireless network), but it is possible that it expects to join one broadcast by your computer (the manual should specify that). If your computer has to host the network itself, just google for instructions on how to set one up on your particular operating system.
The communication technology is TCP/IP. At this stage, this still doesn't tell us how to meaningfully communicate. The analogy is that we now know that the means of communication with a particular person should be by e-mail rather than Twitter, but we don't know the e-mail address of the receiver or what language she speaks.
The first step is to find out the IP address of the EEG system on the ad hoc network. There will also be a particular port number that the EEG will be listening on. The analogy here is that the IP address is like the street address of an apartment building, but to ensure a letter goes to the right person, we also need to know the apartment number.
With that information, communicating in python is actually pretty simple. Here is some example code adapted from <
https://wiki.python.org/moin/TcpCommunication>:
import socket # a standard python module that allows TCP & UDP communication
IP_number = '127.0.0.1' # this example value is your computer's home address, which can be used
# for testing purposes. You will need to replace this with the actual EEG IP address.
port_number = 5005 # your EEG manual should specify what port it is listening on
buffer_size = 1024 # for simple protocols, sometimes you might want to make it shorter than this default
message = "Hello, World!" # sadly, your EEG won't understand this
# set up the communication socket with who-knows-what default technical characteristics:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# point the socket to the actual destination (the EEG in your case):
s.connect((IP_number, port_number))
# and send a message. The content of this, only the manual can tell you:
s.send(message)
# the EEG might send data back in response (probably not so important for you):
data = s.recv(buffer_size)
# shut the connection down when done:
s.close()
So the code to set up and use the communication link isn't very daunting.
But the key thing we don't yet know is what the actual communication protocol is. By 'protocol', here I mean the message format and sequence expected by your particular EEG, rather than the technology used to send it. Hopefully the manual should gives those details, but I would expect that there will be specific strings of characters that represent trigger/event markers and perhaps commands to start & stop recording etc. That really will be specific to your brand and model of system and so unless someone here is familiar with that particular EEG, you'll need to dig it out of the manual or speak to the manufacturer's technical support team.
Hope that helps?
Mike