| 313 | } |
| 314 | |
| 315 | int AAVAAv3::config_board (std::string config, std::string &response) |
| 316 | { |
| 317 | safe_logger (spdlog::level::trace, "config requested: {}", config); |
| 318 | if (!initialized) |
| 319 | { |
| 320 | return (int)BrainFlowExitCodes::BOARD_NOT_CREATED_ERROR; |
| 321 | } |
| 322 | if (config.empty ()) |
| 323 | { |
| 324 | return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR; |
| 325 | } |
| 326 | |
| 327 | int res = (int)BrainFlowExitCodes::STATUS_OK; |
| 328 | |
| 329 | if (config == "w") |
| 330 | { |
| 331 | safe_logger (spdlog::level::trace, "device status was requested {}", device_status); |
| 332 | response = device_status; |
| 333 | device_status = ""; |
| 334 | return res; |
| 335 | } |
| 336 | |
| 337 | if ((config[0] == 'z') || (config[0] == 'Z')) |
| 338 | { |
| 339 | bool was_streaming = is_streaming; |
| 340 | if (was_streaming) |
| 341 | { |
| 342 | safe_logger (spdlog::level::trace, |
| 343 | "disabling streaming to turn on or off impedance, stop command is: {}", |
| 344 | stop_command.c_str ()); |
| 345 | res = send_command (stop_command); |
| 346 | if (res == (int)BrainFlowExitCodes::STATUS_OK) |
| 347 | { |
| 348 | is_streaming = false; |
| 349 | } |
| 350 | } |
| 351 | if (config[0] == 'z') |
| 352 | { |
| 353 | start_command = "z"; |
| 354 | stop_command = "Z"; |
| 355 | } |
| 356 | else if (config[0] == 'Z') |
| 357 | { |
| 358 | start_command = "b"; |
| 359 | stop_command = "s"; |
| 360 | } |
| 361 | if (was_streaming) |
| 362 | { |
| 363 | if (res == (int)BrainFlowExitCodes::STATUS_OK) |
| 364 | { |
| 365 | safe_logger (spdlog::level::trace, |
| 366 | "enabling streaming to turn on or off impedance, start command is: {}", |
| 367 | start_command.c_str ()); |
| 368 | res = send_command (start_command); |
| 369 | } |
| 370 | if (res == (int)BrainFlowExitCodes::STATUS_OK) |
| 371 | { |
| 372 | is_streaming = true; |