Repository navigation
Add BrainVision RDA DATA32 acquisition gateway - #883
Andrey1994 wants to merge 2 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 117dc9292f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (config == "get_channel_names") | ||
| response = json (channel_names).dump (); |
There was a problem hiding this comment.
Handle invalid UTF-8 before serializing RDA strings
If an RDA channel label contains invalid UTF-8, get_channel_names throws an uncaught C++ exception instead of returning a BrainFlow error. rda::text accepts arbitrary non-NUL bytes, but json::dump() requires UTF-8: a START fixture containing byte 0xE9 is accepted by the decoder and then throws json.exception.type_error.316 here. The exported config_board wrapper does not catch this exception, so calling it through Python ctypes can terminate the acquisition process. Marker type/description serialization has the same problem. Validate or convert incoming strings, or catch serialization errors before they cross the C ABI.
Useful? React with 👍 / 👎.
| int count = socket->recv (static_cast<uint8_t *> (data) + offset, int (size - offset)); | ||
| if (count <= 0) | ||
| return false; |
There was a problem hiding this comment.
Honor the configured first-sample timeout on receive timeouts
When params.timeout exceeds five seconds and the connected server remains silent for five seconds before sending its first sample, the reader exits early despite the configured deadline. SocketClientTCP::connect() sets SO_RCVTIMEO to five seconds, and this branch treats the resulting receive timeout as a fatal connection error; consequently, a requested 30-second first-sample wait returns INCOMMING_MSG_ERROR after roughly five seconds. Distinguish temporary receive timeouts from EOF/fatal errors and continue waiting until the configured first-sample deadline, or configure the socket timeout consistently with that deadline.
Useful? React with 👍 / 👎.
Adds
BRAINVISION_RDA_BOARD(71), a TCP gateway for BrainVision Recorder configured for exactly 32 EEG channels at 1000 Hz. It validates START metadata and bounded message lengths, handles fragmented DATA32 reads, scales each channel to microvolts, and reconnects with fresh metadata on every start. Other profiles and DATA16 fail explicitly.RDA markers retain block/sample offsets and text in a bounded queue exposed through
get_marker; coincident events are preserved separately from BrainFlow's inserted markers. Channel labels are available throughget_channel_names. A socket shutdown operation lets stop interrupt a blocked reader safely before closing its descriptor.All binding IDs and supported-board documentation are updated. This is a Recorder network integration, not a direct USB driver or a claim to support every Brain Products configuration.
Validation: warnings-as-errors Linux build; all 66 native tests pass. The loopback integration test passes fragmented messages, scaling, coincident markers, wrong profiles, oversized headers, timeout interruption, Recorder STOP and session restart/reprepare. The emulator runs in Linux CI. An additional run against the independently compiled FieldTrip
buffer_rdaserver (commit02149cbf43920b87b823567b28feaa1cd9d5e6a4) acquired 98 samples whose EEG values exactly matched the input. The JSON marker path also tests invalid UTF-8 replacement. Physical Recorder/amplifier validation remains outstanding.References: Brain Products RDA implementation, FieldTrip RDA server.