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

Method push_package

src/board_controller/board.cpp:157–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void Board::push_package (double *package, int preset)
158{
159 std::string preset_str = preset_to_string (preset);
160 if ((board_descr.find (preset_str) == board_descr.end ()) || (dbs.find (preset) == dbs.end ()))
161 {
162 safe_logger (spdlog::level::err, "invalid json or push_package args, no such key");
163 return;
164 }
165
166 lock.lock ();
167 json board_preset = board_descr[preset_str];
168 try
169 {
170 int marker_channel = board_preset["marker_channel"];
171 if (marker_queues[preset].empty ())
172 {
173 package[marker_channel] = 0.0;
174 }
175 else
176 {
177 double marker = marker_queues[preset].at (0);
178 package[marker_channel] = marker;
179 marker_queues[preset].pop_front ();
180 }
181 }
182 catch (...)
183 {
184 safe_logger (spdlog::level::err, "Failed to get marker channel/value");
185 }
186
187 if (dbs[preset] != NULL)
188 {
189 dbs[preset]->add_data (package);
190 }
191 if (streamers.find (preset) != streamers.end ())
192 {
193 for (auto &streamer : streamers[preset])
194 {
195 streamer->stream_data (package);
196 }
197 }
198 lock.unlock ();
199}
200
201int Board::insert_marker (double value, int preset)
202{

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.80
lockMethod · 0.45
add_dataMethod · 0.45
stream_dataMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected