Skip to content

Feat: create lsl reader and config parser - #30

Merged
MichalSzandar merged 7 commits into
mainfrom
feat/create-lsl-reader-and-config
Aug 4, 2026
Merged

Feat: create lsl reader and config parser#30
MichalSzandar merged 7 commits into
mainfrom
feat/create-lsl-reader-and-config

Conversation

@MichalSzandar

@MichalSzandar MichalSzandar commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator
  • Add LSLReader
  • Add ConfigParser - json -> ExperimentConfig (new structure that stores information about device name, montage standard, expected channel count, channels' labels etc.)
  • Remove dummy tests
  • Update gcovr config (fails below 90% coverage)
  • Update readme

Here is an example of config.json file

{
  "config_version": "1.0",
  "device_name": "OpenBCI Cyton 8ch",
  "montage_standard": "10-20",

  "lsl_stream": {
    "name": "obci_eeg1",
    "type": "EEG",
    "source_id": "cyton-a1b2c3",
    "expected_channel_count": 8,
    "expected_sample_rate_hz": 250
  },

  "reference": {
    "label": "linked_mastoids",
    "scheme": "physical"
  },
  "ground": {
    "label": "Fpz"
  },

  "channels": [
    { "index": 0, "label": "Fz",  "enabled": true,  "unit": "microvolts" },
    { "index": 1, "label": "Cz",  "enabled": true,  "unit": "microvolts" },
    { "index": 2, "label": "Pz",  "enabled": true,  "unit": "microvolts" },
    { "index": 3, "label": "Oz",  "enabled": true,  "unit": "microvolts" },
    { "index": 4, "label": "P3",  "enabled": true,  "unit": "microvolts" },
    { "index": 5, "label": "P4",  "enabled": true,  "unit": "microvolts" },
    { "index": 6, "label": "O1",  "enabled": true,  "unit": "microvolts" },
    { "index": 7, "label": "O2",  "enabled": false, "unit": "microvolts" }
  ],

  "impedance_check": {
    "supported": true,
    "threshold_kohm": 5.0
  }
}

@MichalSzandar MichalSzandar self-assigned this Jul 1, 2026
@MichalSzandar MichalSzandar linked an issue Jul 1, 2026 that may be closed by this pull request
@MichalSzandar MichalSzandar changed the title Feat: create lsl reader and config Feat: create lsl reader and config parser Jul 1, 2026
Comment thread src/lslreader/LSLReader.cpp
Comment thread include/config/ExperimentConfig.hpp Outdated
Comment thread src/config/ConfigParser.cpp Outdated
@M1KUS3Q

M1KUS3Q commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

The config boundary between what stays in protobuf files and what goes in via JSON is never documented. This should be established early to avoid later config refactoring.

Comment thread include/config/ConfigParser.hpp
Comment thread include/config/ExperimentConfig.hpp Outdated
Comment thread src/lslreader/LSLReader.cpp
Comment thread include/config/ExperimentConfig.hpp Outdated

@M1KUS3Q M1KUS3Q left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left stuff to think about in comments, otherwise lgtm

- rename ExperimentConfig to DeviceConfig: it describes the acquisition hardware, not the experiment, which lives in the protobuf files
- move `channels` to the top level of DeviceConfig so the struct mirrors config.json 1:1, like every other field already does
- LSLReader: create the inlet with liblsl's recover flag off and catch lsl::lost_error to re-resolve and re-validate a dropped stream, as README §6 already claimed. With recover on, lost_error is never thrown, so the documented behaviour could not have held
- LSLReader: take a DeviceConfig and forward only the channels the config enables, in declaration order; reject a config that enables none
- ConfigParser: validate config_version (MAJOR.MINOR) before any other field, rejecting an unsupported major and unparseable versions
- README: document the protobuf/JSON config boundary and the schema versioning rules (§5)

Note: I decided to leave all static classes as they are, and created a seperate issue to refactor them into namespaces
@MichalSzandar
MichalSzandar merged commit 564131f into main Aug 4, 2026
1 check passed
@MichalSzandar
MichalSzandar deleted the feat/create-lsl-reader-and-config branch August 4, 2026 17:30
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.

Create LSLReader class

2 participants