Skip to content

Add remote stream selection command - #144

Open
sena-neuro wants to merge 2 commits into
labstreaminglayer:masterfrom
sena-neuro:add-select-stream
Open

sena-neuro wants to merge 2 commits into
labstreaminglayer:masterfrom
sena-neuro:add-select-stream

Conversation

@sena-neuro

Copy link
Copy Markdown

Summary

Add select <query> to the remote control TCP interface, where <query> is an LSL resolver predicate such as name='BioSemi' or type='EEG'.

This allows remote clients to select a subset of streams before starting a recording.

Why The Supporting Changes Are Included

Remote start previously selected all streams before recording. That would override any stream subset selected through select <query>, so remote start now records the current selection instead.

Starting a recording refreshes the stream list. To keep TCP-selected streams stable across that refresh, the selected state is preserved before rebuilding the list, and stream matching now uses source_id when available with a fallback for streams that do not provide one.

The stream list is rebuilt from both refresh and remote-selection paths, so the list rebuild logic is shared rather than duplicated.

Remote responses were tightened because start can now fail for normal remote-control reasons, such as no streams being selected.

Compatibility Notes

Remote start no longer implicitly selects all streams. Clients that need the previous behavior should send select all before start.

A valid query that matches no streams returns WARNING no streams matched and leaves the current selection unchanged. Clients that need a deterministic subset should send select none before select <query>.

Command parsing is exact and case-sensitive.

Validation

  • Built the GUI target locally.
  • Ran TCP interface tests on the validation branch.
  • Ran a manual TCP smoke validation with synthetic LSL streams.

Smoke validation script:
https://gist.github.com/sena-neuro/ed12a2570c496ba0e43214fdf24029b4

@cboulay

cboulay commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

I recommend addressing two selection issues before merging. Both were reproduced using this PR's actual GUI code in an isolated offscreen Qt build at commit 0ae59bb79fc0098c1cd9ef416ee808f8d3f4d66b.

  1. Stream matching can select unintended streams (src/mainwindow.h:30-34). When one stream has an empty source_id, StreamItem::matches() falls back to name/type/host/session even when the other stream has a nonempty source ID. I created two otherwise identical outlets, one with an empty ID and one with different-source, then ran the selection sequence corresponding to select none -> select source_id='different-source' -> refresh. The returned recording selection contained both streams. If either source ID is nonempty, require matching IDs rather than falling back across the empty/nonempty boundary. Please add a regression test verifying the actual selected stream identities after refresh.

  2. Missing streams become selected again after select none (src/mainwindow.cpp:290-305). updateKnownStreamSelectionFromUi() saves only known-stream selection, while rebuildStreamList() unconditionally checks every missing-stream entry. In the reproduction, hasSelectedStreams() returned false after selectNoStreams(), then true after saving selection and rebuilding the list. Because a successful select <query> also rebuilds the list, select none -> select <query> restores unwanted missing streams to the selection; they can subsequently be watched and recorded when they appear. Preserve selection state for missing streams and ensure unchecked entries do not enter the recording watchlist.

Validation: the isolated GUI-code build passed, the two cases above reproduced, and malformed-query handling correctly returned InvalidQuery. The linked smoke script checks command responses but does not start a successful recording or verify its stream contents. Please include these selection regressions in checked-in tests, ideally also verifying the resulting XDF contains only the intended streams.

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