Oh okay. I thought this was completely replaced with TCP tagging. However, if I would use external stimulations, I need to do this in C++, right? Thanks for asking your expert. I would prefer the TCP tagging solution with python since all my code is based on python. So please let me know
. Thanks.
This is what I do right now:
I acquire the signals from the generic oscillator.
In the designer I use the network-acquisition.xml example.
After I started the acquisition server and designer, I execute the example script tcp-tagging-client.py
Code: Select all
import sys
import socket
from time import time, sleep
# host and port of tcp tagging server
HOST = '127.0.0.1'
PORT = 15361
# Event identifier (See stimulation codes in OpenVibe documentation)
EVENT_ID = 0x00008205
# Artificial delay (ms). It may need to be increased if the time to send the tag is too long and causes tag loss.
DELAY=0
# transform a value into an array of byte values in little-endian order.
def to_byte(value, length):
for x in range(length):
yield value%256
value//=256
# connect
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
for i in range(100):
# create the three pieces of the tag, padding, event_id and timestamp
padding=[0]*8
event_id=list(to_byte(EVENT_ID, 8))
# timestamp can be either the posix time in ms, or 0 to let the acquisition server timestamp the tag itself.
timestamp= list(to_byte(int(time()*1000)+DELAY, 8))
# send tag and sleep
s.sendall(bytes(padding+event_id+timestamp))
sleep(1)
s.close()
Now I would expect, that the stimuli are displayed but they aren't.
Best,
klaro