| 578 | } |
| 579 | |
| 580 | int Ganglion::config_board (std::string config, std::string &response) |
| 581 | { |
| 582 | if (config == "get_firmware_version") |
| 583 | { |
| 584 | response = std::to_string (firmware); |
| 585 | return (int)BrainFlowExitCodes::STATUS_OK; |
| 586 | } |
| 587 | const char *conf = config.c_str (); |
| 588 | safe_logger (spdlog::level::debug, "Trying to config Ganglion with {}", conf); |
| 589 | // need to pause, config and restart. I have no idea why it doesnt work if I restart it inside |
| 590 | // bglib or just call call_stop call_start, full restart solves the issue |
| 591 | if (keep_alive) |
| 592 | { |
| 593 | safe_logger (spdlog::level::info, "stoping streaming to configure board"); |
| 594 | // stop stream |
| 595 | keep_alive = false; |
| 596 | is_streaming = false; |
| 597 | streaming_thread.join (); |
| 598 | state = (int)BrainFlowExitCodes::SYNC_TIMEOUT_ERROR; |
| 599 | int res = call_stop (); |
| 600 | if (res != (int)BrainFlowExitCodes::STATUS_OK) |
| 601 | { |
| 602 | return res; |
| 603 | } |
| 604 | /* hack, in ganglion commands to enable/disable impedance check control data streaming |
| 605 | to handle it and keep it consistent with other devices we swap chars for command_start and |
| 606 | command_stop |
| 607 | */ |
| 608 | if ((strlen (conf)) && (conf[0] == 'z')) |
| 609 | { |
| 610 | start_command = "z"; |
| 611 | stop_command = "Z"; |
| 612 | } |
| 613 | else |
| 614 | { |
| 615 | if ((strlen (conf)) && (conf[0] == 'Z')) |
| 616 | { |
| 617 | start_command = "b"; |
| 618 | stop_command = "s"; |
| 619 | } |
| 620 | // plain command which doesnt change streaming behaviour |
| 621 | else |
| 622 | { |
| 623 | // call itself with disabled streaming |
| 624 | res = config_board (config, response); |
| 625 | } |
| 626 | } |
| 627 | if (res != (int)BrainFlowExitCodes::STATUS_OK) |
| 628 | { |
| 629 | return res; |
| 630 | } |
| 631 | return start_streaming_prepared (); |
| 632 | } |
| 633 | // streaming is not started, dont pause |
| 634 | else |
| 635 | { |
| 636 | if ((strlen (conf)) && (conf[0] == 'z')) |
| 637 | { |
nothing calls this directly
no test coverage detected