Skip to content

Add BrainVision RDA DATA32 acquisition gateway - #883

Open
Andrey1994 wants to merge 2 commits into
masterfrom
codex/add-brainvision-rda-20261110
Open

Andrey1994 wants to merge 2 commits into
masterfrom
codex/add-brainvision-rda-20261110

Conversation

@Andrey1994

@Andrey1994 Andrey1994 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

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 through get_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_rda server (commit 02149cbf43920b87b823567b28feaa1cd9d5e6a4) 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T23:44:35.555496Z 117dc92 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +190 to +191
if (config == "get_channel_names")
response = json (channel_names).dump ();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +87 to +89
int count = socket->recv (static_cast<uint8_t *> (data) + offset, int (size - offset));
if (count <= 0)
return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant