Skip to content

Refuse recording-locked settings while the device is recording - #218

Open
cboulay wants to merge 1 commit into
masterfrom
feat/recording-gate
Open

cboulay wants to merge 1 commit into
masterfrom
feat/recording-gate

Conversation

@cboulay

@cboulay cboulay commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #215.

Summary

While the device reports a recording in progress (its last REPFILECFG has options == cbFILECFG_OPT_REC, whoever started the recording), a session refuses to change the settings Central's own dialogs lock during recording. The call returns an error and nothing is sent.

Central never filtered packets from other programs. Every check of IsFileRecording() in Central-Suite is in its UI: dialogs disable controls, or a "stop recording?" prompt appears. Its transmit-buffer drain (CentralDlg.cpp, InstNetwork.cpp) forwards cbsdk packets regardless. So this is the session's own rule, not a replacement for something Central-compat mode provided.

What is refused while recording

Refused outright Refused only if it changes a field
SYSSETSPKLEN (spike length / pre-trigger) CHANSETSMP / full CHANSET: smpgroup
SS_DETECTSET, SS_NOISE_BOUNDARYSET CHANSETAINP / full CHANSET: the cbAINP_RAWSTREAM_ENABLED bit
CHANSETNTRODEGROUP, SETNTRODEINFO SS_STATUSSET: switching continuous sorting on (cntlNumUnits.nMode → ADAPT_ALWAYS)
SS_RESETSET (restart spike sorting)
  • Full CHANSET: checked because setChannelConfig() and loadCCF() can change a sample group with it. Central only sends it from its Crosstalk / AutoImpedance tools, and only after recording has stopped.
  • Field checks let an unchanged resend through. Freeze / lock spike sorting (ADAPT_NEVER) is allowed, as in Central.
  • Not affected: labels, thresholds, spike options, scaling, LNC / ref electrode, comments, digital / analog out, recording control.

How

  • Rules: src/cbsdk/src/recording_gate.h, a pure function of the packet and the current config.
  • Where it is applied: SdkSession::Impl::rejectWhileRecording() runs in sendPacket, sendBulkPackets, loadCCF, and the STANDALONE branches of setChannelConfig / setSpikeLength. Batches (bulk setters, CCF loads) are checked as a whole before anything is sent.
  • CLIENT sessions: the STANDALONE session mirrors the recording state (REPFILECFG with REC / STOP / TIMEOUT, same filter as cbdev's device_config.fileinfo) into native shared memory, so CLIENTs apply the same rule.
  • Central-compat sessions (CERELINK_CENTRAL_COMPAT=1) are not gated.

Tests

Not verified:

  • Against a real recording. That needs Central's File Storage running somewhere on the network.
  • Whether a session that starts mid-recording receives a REPFILECFG promptly. Until one arrives, the gate is not applied.

🤖 Generated with Claude Code

While the last REPFILECFG reports cbFILECFG_OPT_REC, a session rejects
the settings Central's own dialogs lock during recording: sample groups
(CHANSETSMP, or a full CHANSET that changes smpgroup), the raw-stream
bit, spike length, spike detection / noise boundaries, n-trode grouping,
and restarting or switching on continuous spike sorting. The call
returns an error and nothing is sent; a batch (bulk setters, loadCCF) is
checked as a whole first. Central itself never filtered packets from
other programs, so this is the session's own rule.

The STANDALONE session mirrors the recording state into native shared
memory so CLIENT sessions apply the same rule. Central-compat sessions
are not gated.

Co-Authored-By: Claude <[email protected]>
Base automatically changed from feat/native-default-central-deprecated to master November 6, 2026 21:38

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