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

Function get_board_presets

src/board_controller/board_info_getter.cpp:23–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 const std::string &value, char *destination, int *len, int max_len, bool use_logger);
22
23int get_board_presets (int board_id, int *presets, int *len)
24{
25 int counter = 0;
26 try
27 {
28 for (auto &el :
29 boards_struct.brainflow_boards_json["boards"][std::to_string (board_id)].items ())
30 {
31 if (el.key () == "default")
32 {
33 presets[counter++] = (int)BrainFlowPresets::DEFAULT_PRESET;
34 }
35 else if (el.key () == "auxiliary")
36 {
37 presets[counter++] = (int)BrainFlowPresets::AUXILIARY_PRESET;
38 }
39 else if (el.key () == "ancillary")
40 {
41 presets[counter++] = (int)BrainFlowPresets::ANCILLARY_PRESET;
42 }
43 else
44 {
45 Board::board_logger->warn ("unknown preset found in json: {}", el.key ());
46 }
47 }
48 if (counter == 0)
49 {
50 Board::board_logger->error ("no presets found"); // more likely will never be executed
51 return (int)BrainFlowExitCodes::GENERAL_ERROR;
52 }
53 else
54 {
55 *len = counter;
56 }
57 return (int)BrainFlowExitCodes::STATUS_OK;
58 }
59 catch (json::exception &e)
60 {
61 Board::board_logger->error (
62 "Failed to get board info: {}, usually it means that you provided wrong board id",
63 e.what ());
64 return (int)BrainFlowExitCodes::UNSUPPORTED_BOARD_ERROR;
65 }
66}
67
68int get_board_descr (int board_id, int preset, char *board_descr, int *len, int max_len)
69{

Callers

nothing calls this directly

Calls 1

whatMethod · 0.80

Tested by

no test coverage detected