MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / start_stream

Method start_stream

src/board_controller/muse/muse_athena.cpp:396–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396int MuseAthena::start_stream (int buffer_size, const char *streamer_params)
397{
398 if (!initialized)
399 {
400 return (int)BrainFlowExitCodes::BOARD_NOT_CREATED_ERROR;
401 }
402
403 int res = prepare_for_acquisition (buffer_size, streamer_params);
404 if (res == (int)BrainFlowExitCodes::STATUS_OK)
405 {
406 std::lock_guard<std::mutex> callback_guard (callback_lock);
407 reset_timestamps ();
408 last_battery = 0.0;
409 }
410 if (res == (int)BrainFlowExitCodes::STATUS_OK)
411 {
412 res = config_board ("dc001");
413 }
414 if (res == (int)BrainFlowExitCodes::STATUS_OK)
415 {
416 std::this_thread::sleep_for (std::chrono::milliseconds (50));
417 res = config_board ("dc001");
418 }
419 if ((res == (int)BrainFlowExitCodes::STATUS_OK) && enable_low_latency)
420 {
421 std::this_thread::sleep_for (std::chrono::milliseconds (100));
422 int l1_res = config_board ("L1");
423 if (l1_res != (int)BrainFlowExitCodes::STATUS_OK)
424 {
425 safe_logger (spdlog::level::warn, "Failed to enable MuseAthena low latency mode");
426 }
427 }
428 if (res == (int)BrainFlowExitCodes::STATUS_OK)
429 {
430 std::this_thread::sleep_for (std::chrono::milliseconds (300));
431 int status_res = config_board ("s");
432 if (status_res != (int)BrainFlowExitCodes::STATUS_OK)
433 {
434 safe_logger (spdlog::level::warn, "Failed to request MuseAthena status after start");
435 }
436 std::this_thread::sleep_for (std::chrono::milliseconds (200));
437 }
438 if (res == (int)BrainFlowExitCodes::STATUS_OK)
439 {
440 is_streaming = true;
441 }
442
443 return res;
444}
445
446int MuseAthena::stop_stream ()
447{

Callers

nothing calls this directly

Calls 1

config_boardFunction · 0.50

Tested by

no test coverage detected