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

Method get_board_data

src/board_controller/board.cpp:459–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459int Board::get_board_data (int data_count, int preset, double *data_buf)
460{
461 std::string preset_str = preset_to_string (preset);
462 if (board_descr.find (preset_str) == board_descr.end ())
463 {
464 safe_logger (spdlog::level::err, "invalid preset");
465 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
466 }
467 if (dbs.find (preset) == dbs.end ())
468 {
469 safe_logger (spdlog::level::err,
470 "stream is not started or no preset: {} found for this board", preset);
471 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
472 }
473 if (!dbs[preset])
474 {
475 return (int)BrainFlowExitCodes::EMPTY_BUFFER_ERROR;
476 }
477 if (!data_buf)
478 {
479 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
480 }
481 int num_rows = (int)board_descr[preset_str]["num_rows"];
482 double *buf = new double[data_count * num_rows];
483 int num_data_points = (int)dbs[preset]->get_data (data_count, buf);
484 reshape_data (num_data_points, preset, buf, data_buf);
485 delete[] buf;
486 return (int)BrainFlowExitCodes::STATUS_OK;
487}
488
489void Board::reshape_data (int data_count, int preset, const double *buf, double *output_buf)
490{

Callers

nothing calls this directly

Calls 1

get_dataMethod · 0.80

Tested by

no test coverage detected