| 300 | } |
| 301 | |
| 302 | static int get_string_value (int board_id, int preset, const char *param_name, char *string, |
| 303 | int *len, int max_len, bool use_logger) |
| 304 | { |
| 305 | std::string preset_str = get_preset_str (preset); |
| 306 | if (preset_str.empty ()) |
| 307 | { |
| 308 | return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR; |
| 309 | } |
| 310 | try |
| 311 | { |
| 312 | std::string val = |
| 313 | boards_struct |
| 314 | .brainflow_boards_json["boards"][std::to_string (board_id)][preset_str][param_name]; |
| 315 | return copy_string_value (val, string, len, max_len, use_logger); |
| 316 | } |
| 317 | catch (json::exception &e) |
| 318 | { |
| 319 | if (use_logger) |
| 320 | { |
| 321 | Board::board_logger->error ( |
| 322 | "Failed to get board info: {}, usually it means that device has no such channels, " |
| 323 | "use get_board_descr method for the info about supported channels", |
| 324 | e.what ()); |
| 325 | } |
| 326 | return (int)BrainFlowExitCodes::UNSUPPORTED_BOARD_ERROR; |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | static std::string get_preset_str (int preset) |
| 331 | { |
no test coverage detected