open-ephys-plugins / network-events

Adds TTL events via a network connection
4 stars 4 forks source link

Add TTL Word option to store integer event codes #6

Open joschaschmiedt opened 2 months ago

joschaschmiedt commented 2 months ago

Hi everyone,

I've just started working with OpenEphys and am setting up a new neuropixels lab. So far, I'm really happy with the customizability and design of OE! Thanks to all the developers.

Our experimental control software produces 16-bit integer codes for events, which we previously have sent as digital words to our recording systems. I'd like to be able to send these codes also via the Network Events plugin.

At the moment the TTL [Line=1-256] [State=0/1] command emulates actual TTL lines, which have to be turned on an off individually (and are limited to 256). I'd like to propose adding a command to send a word at once, which is stored as a time-stamped event, e.g.

TTL Word=uint64

As far as I've seen, this is not possible yet. I'd go ahead and add handling such a message NetworkEvents::handleSpecialMessages. Does it make sense to create these events using the TTLEvent's factory method createTTLEvent(const EventChannel* channelInfo, int64 sampleNumber, uint8 line, bool state, uint64 word)?

anjaldoshi commented 2 months ago

Hi @joschaschmiedt,

Yes, currently it is not possible to send TTL words directly via Network Events. But, you're on the right track. It should be able to receive and add TTL word events if you implement your mentioned changes. The TTLEvent factory method you mentioned for TTL words should work here.

You can see an example of how to use that method in the SourceNode::process code here: https://github.com/open-ephys/plugin-GUI/blob/main/Source/Processors/SourceNode/SourceNode.cpp#L335-L359

Feel free to ask any further questions!

joschaschmiedt commented 2 months ago

Hi @anjaldoshi,

Thanks for the hint. I implemented the new TTL Word=<word> command (commit 82fc00661065336603b2e0714c7389b79ce0e468) . Would you mind having a look a the pull request (#7) and checking whether this is in the right direction? I still would like to do some proper testing before actually merging this.

I also fixed the windows GitHub pipeline. Would you mind enabling the GitHub Actions on this repository?