cortex-lab / Rigbox

A MATLAB toolbox for running behavioral neuroscience experiments and managing data
GNU General Public License v3.0
33 stars 16 forks source link

Logging UDPs when Timeline is running on expServer #301

Open k1o0 opened 4 years ago

k1o0 commented 4 years ago

UDPs sent events may be logged in Timeline by your services:

In prepareExp, if your srv.Service object has a Timeline property, it is assigned a handle to srv.expServer's hw.Timeline instance.
https://github.com/cortex-lab/Rigbox/blob/cd888f0ae2653ac78651243b22d566ab67a6fb60/%2Bsrv/prepareExp.m#L17-L31

When the services are started (a callback of the experimentInit event) or stopped (a callback of the experimentCleanup event), the start and stop methods of your service object may log the event with using Timeline's record method.

What service subclasses are people using (e.g. srv.PrimitiveUDPService)? It's here that you need to add the logic for recording the UDP events. See the code for srv.RemoteMPEPService:

https://github.com/cortex-lab/Rigbox/blob/cd888f0ae2653ac78651243b22d566ab67a6fb60/cortexlab/%2Bsrv/RemoteMPEPService.m#L222-L234

Note that the block file contains the timestamps for the experiment events, which will be in Timeline time if it's running for that experiment. These timestamps will tell you when the tart and stop methods were called, which should be just before the UDPs are sent.