rzellertownson / neurorighter

Closed Loop, Open Source Electrophysiology
6 stars 5 forks source link

DatSrv should have a 'push to client' ('subscribe') option #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In addition to the reads initiated by the client thread, there should be an 
option for DatSrv to trigger an event everytime it receives data-  thus, 
clients could process data when it is freshest, which would decrease times on 
the spike triggered stimulus benchmark.  This could be used as an alternative 
to the 'loop' task in the closed-loop experiment task.

Original issue reported on code.google.com by RZellerT...@gmail.com on 19 Jun 2012 at 6:42

GoogleCodeExporter commented 9 years ago
This is really as simple as having all server objects have an event triggered 
on new data coming in. That way subscribers could do whatever they want when 
this occurs. 

An example of an event handler like this is the non-loop 'loop' method that you 
are describing. But really it could be up to the user what to do with when the 
event is fired so long as there is method that allows subscribers to read only 
that fresh data only without supplying parameters for the read like is 
currently implemented.

e.g. ReadFresh()

Original comment by jonathan...@gmail.com on 19 Jun 2012 at 7:12

GoogleCodeExporter commented 9 years ago
yeah.. come to think of it I'm pretty sure all of the (like 3) closed loop 
protocols I've written basically boiled down to approximating a ReadFresh() 
from within Loop().

Original comment by RZellerT...@gmail.com on 19 Jun 2012 at 7:22

GoogleCodeExporter commented 9 years ago
I added this functionality in r484. My comments on that commit:

- Added extension library to LINQ in ./lib/MoreLinq.dll
- Added public events for new data on the two main data server types:
EventDataSrv and RawDataSrv. NRTasks can subscribe to these events to have a
data driven loop function. I have not implemented anything in NRTask.cs to
specifically handle these events, although that would be good. Right now, the
user still hast to make a loop function in an overridden NRTask even if they are
using this data driven method. (this uses the MoreLinq functions).

Original comment by jonathan...@gmail.com on 20 Jun 2012 at 4:31

GoogleCodeExporter commented 9 years ago
This addition has now been extensively tested and is being used in closed loop 
algorithms. I'm marking it as done.

Original comment by jonathan...@gmail.com on 11 Oct 2012 at 2:58