| 267 | } |
| 268 | |
| 269 | static int get_array_value ( |
| 270 | int board_id, int preset, const char *param_name, int *output_array, int *len, bool use_logger) |
| 271 | { |
| 272 | std::string preset_str = get_preset_str (preset); |
| 273 | if (preset_str.empty ()) |
| 274 | { |
| 275 | return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR; |
| 276 | } |
| 277 | try |
| 278 | { |
| 279 | std::vector<int> values = |
| 280 | boards_struct |
| 281 | .brainflow_boards_json["boards"][std::to_string (board_id)][preset_str][param_name]; |
| 282 | if (!values.empty ()) |
| 283 | { |
| 284 | memcpy (output_array, &values[0], sizeof (int) * values.size ()); |
| 285 | } |
| 286 | *len = (int)values.size (); |
| 287 | return (int)BrainFlowExitCodes::STATUS_OK; |
| 288 | } |
| 289 | catch (json::exception &e) |
| 290 | { |
| 291 | if (use_logger) |
| 292 | { |
| 293 | Board::board_logger->error ( |
| 294 | "Failed to get board info: {}, usually it means that device has no such channels, " |
| 295 | "use get_board_descr method for the info about supported channels", |
| 296 | e.what ()); |
| 297 | } |
| 298 | return (int)BrainFlowExitCodes::UNSUPPORTED_BOARD_ERROR; |
| 299 | } |
| 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) |
no test coverage detected