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

Method get_current_board_data

src/board_controller/board.cpp:404–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402}
403
404int Board::get_current_board_data (
405 int num_samples, int preset, double *data_buf, int *returned_samples)
406{
407 std::string preset_str = preset_to_string (preset);
408 if (board_descr.find (preset_str) == board_descr.end ())
409 {
410 safe_logger (spdlog::level::err, "invalid preset");
411 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
412 }
413 if (dbs.find (preset) == dbs.end ())
414 {
415 safe_logger (spdlog::level::err,
416 "stream is not started or no preset: {} found for this board", preset_str.c_str ());
417 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
418 }
419 if (!dbs[preset])
420 {
421 return (int)BrainFlowExitCodes::EMPTY_BUFFER_ERROR;
422 }
423 if ((!data_buf) || (!returned_samples))
424 {
425 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
426 }
427
428 int num_rows = (int)board_descr[preset_str]["num_rows"];
429
430 double *buf = new double[num_samples * num_rows];
431 int num_data_points = (int)dbs[preset]->get_current_data (num_samples, buf);
432 reshape_data (num_data_points, preset, buf, data_buf);
433 delete[] buf;
434 *returned_samples = num_data_points;
435 return (int)BrainFlowExitCodes::STATUS_OK;
436}
437
438int Board::get_board_data_count (int preset, int *result)
439{

Callers

nothing calls this directly

Calls 1

get_current_dataMethod · 0.80

Tested by

no test coverage detected