| 21 | const std::string &value, char *destination, int *len, int max_len, bool use_logger); |
| 22 | |
| 23 | int 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 | |
| 68 | int get_board_descr (int board_id, int preset, char *board_descr, int *len, int max_len) |
| 69 | { |