MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / start_stream

Method start_stream

src/board_controller/playback_file_board.cpp:121–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121int PlaybackFileBoard::start_stream (int buffer_size, const char *streamer_params)
122{
123 safe_logger (spdlog::level::trace, "start stream");
124 if (keep_alive)
125 {
126 safe_logger (spdlog::level::err, "Streaming thread already running");
127 return (int)BrainFlowExitCodes::STREAM_ALREADY_RUN_ERROR;
128 }
129
130 int res = prepare_for_acquisition (buffer_size, streamer_params);
131 if (res != (int)BrainFlowExitCodes::STATUS_OK)
132 {
133 return res;
134 }
135 if (!params.file.empty ())
136 {
137 res = validate_file_access (params.file);
138 if (res != (int)BrainFlowExitCodes::STATUS_OK)
139 {
140 return res;
141 }
142 }
143 if (!params.file_aux.empty ())
144 {
145 res = validate_file_access (params.file_aux);
146 if (res != (int)BrainFlowExitCodes::STATUS_OK)
147 {
148 return res;
149 }
150 }
151 if (!params.file_anc.empty ())
152 {
153 res = validate_file_access (params.file_anc);
154 if (res != (int)BrainFlowExitCodes::STATUS_OK)
155 {
156 return res;
157 }
158 }
159
160 keep_alive = true;
161 if (!params.file.empty ())
162 {
163 streaming_threads.push_back (std::thread (
164 [this] { this->read_thread ((int)BrainFlowPresets::DEFAULT_PRESET, params.file); }));
165 }
166 if (!params.file_aux.empty ())
167 {
168 streaming_threads.push_back (std::thread ([this]
169 { this->read_thread ((int)BrainFlowPresets::AUXILIARY_PRESET, params.file_aux); }));
170 }
171 if (!params.file_anc.empty ())
172 {
173 streaming_threads.push_back (std::thread ([this]
174 { this->read_thread ((int)BrainFlowPresets::ANCILLARY_PRESET, params.file_anc); }));
175 }
176
177 return (int)BrainFlowExitCodes::STATUS_OK;
178}

Callers

nothing calls this directly

Calls 2

read_threadMethod · 0.95
emptyMethod · 0.80

Tested by

no test coverage detected