Add Event Broadcaster JSON option#283
Merged
aacuevas merged 5 commits intoopen-ephys:developmentfrom Feb 26, 2019
Merged
Conversation
Contributor
|
It looks like some recent changes to the event broadcaster architecture on |
3d486d1 to
6bd8740
Compare
…ne-lab/plugin-GUI into event-broadcaster-json-release
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Event Broadcaster only sent the raw binary event data out. This made reading/understanding the outbound data difficult. This feature adds the ability to choose your output format (Raw Binary, Header, Header/JSON) from a drop down list on the plugin.
Here the Header was implemented as starting with the type of event (spike, text, binary, ttl) followed by some important information (id, channel, timestamp, etc). The JSON object holds all information about the event, including metadata.
Example Header:
"spike/sortedid:1/id:spikesource/ts:23384"Example JSON:
{'type': 'spike', 'sortedID': 1, 'numChannels': 2, 'threshold': [150, 160], 'timing': {'sampleRate': 40000, 'timestamp': 23384}, 'identifier': 'spikesource', 'name': 'ST p112.0 n0', 'metaData': {'Color': ['255', '255', '0']}}It is a fairly big change, but nearly all of the additions involve parsing the event and building the JSON object to be sent. We found this very helpful so we could use the existing event class structure to get the event information instead of building our own parser after receiving the data!
Overview of Implementation
sendEvent()was heavily rewritten to now build a message object that holds all the information to be published. A JSON object was also made if the Header/JSON format is selected and then it's added to the message object.This message object was sent to a new
sendMessage()function that iterated through all the message parts and published them on the ZMQ socket.The last few functions added
getDataReader() , binaryValuetoVar() , stringValuetoVar()were used because JUCE has no built-in constructor for uint64/uint32 to Var which is needed to create the JSON object.Let me know if you have any comments!