Skip to content

Rewrite of cbsdk#157

Merged
cboulay merged 169 commits intomasterfrom
cboulay/modularize
Mar 16, 2026
Merged

Rewrite of cbsdk#157
cboulay merged 169 commits intomasterfrom
cboulay/modularize

Conversation

@cboulay
Copy link
Collaborator

@cboulay cboulay commented Nov 12, 2025

Modular rewrite of cbsdk

Replaces the monolithic cbsdk with a layered architecture:

cbproto → Protocol definitions, packet types, translation between protocol versions
cbshm → Shared memory (Central-compat and native layouts)
cbdev → Device transport (UDP sockets, handshake, clock sync, threaded receive)
cbsdk → SDK orchestration (cbdev + cbshm + typed callbacks + config queries)
ccfutils → CCF XML config file load/save
pycbsdk → Python wrapper via cffi ABI mode (no compiler needed at install)

Key capabilities

  • STANDALONE mode: CereLink owns the device connection and shared memory
  • CLIENT mode: Attach to another CereLink instance's shared memory
  • CENTRAL_COMPAT CLIENT mode: Attach to Central's shared memory with on-the-fly protocol translation
  • C API: 30+ exported functions in cbsdk.h with CBSDK_API for DLL export
  • Python API: pycbsdk package with decorator-based callbacks (@session.on_event, @session.on_group)
  • Protocol translation: Bidirectional translation between protocol versions (3.11 ↔ 4.0 ↔ 4.1 ↔ 4.2)
  • Clock sync: Device-to-host time synchronization
  • All device types: LEGACY_NSP, NSP, HUB1–HUB3, NPLAY, CUSTOM
  • GHA CI: Automated tests (Windows/macOS/Linux) and wheel builds for pycbsdk

Remaining work

  • Modular architecture (cbproto, cbshm, cbdev, cbsdk, ccfutils)
  • STANDALONE and CLIENT modes
  • Central-compat CLIENT mode with protocol translation
  • C API with DLL export
  • Python wrapper (pycbsdk) with cffi
  • Typed callbacks (event, group, config)
  • CCF file load/save
  • Clock sync
  • GHA CI for tests and wheel builds
  • Instrument time API (full stack)
  • Patient info API (full stack)
  • Analog output monitoring API (full stack)
  • Central recording control (open/start/stop/close)
  • Channel config get/set accessors (C API + Python)
  • Protocol version query API
  • Spike processing config (spike length, pretrigger)
  • Analog output waveform generation
  • Matlab bindings
  • C# bindings

…d by Central so users shouldn't be able to modify it.
…pl = m_impl.get()) instead of capturing this.
@cboulay cboulay marked this pull request as ready for review March 11, 2026 17:36
@cboulay
Copy link
Collaborator Author

cboulay commented Mar 11, 2026

Matlab bindings will come later.
This is ready for review and will likely be merged soon!

@cboulay cboulay merged commit 4a44b55 into master Mar 16, 2026
12 checks passed
@cboulay cboulay deleted the cboulay/modularize branch March 16, 2026 09:50
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.

2 participants