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

Method config_board

src/board_controller/playback_file_board.cpp:366–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366int PlaybackFileBoard::config_board (std::string config, std::string &response)
367{
368 if (strcmp (config.c_str (), SET_LOOPBACK_TRUE) == 0)
369 {
370 loopback = true;
371 }
372 else if (strcmp (config.c_str (), SET_LOOPBACK_FALSE) == 0)
373 {
374 loopback = false;
375 }
376 else if (strcmp (config.c_str (), NEW_TIMESTAMPS) == 0)
377 {
378 use_new_timestamps = true;
379 }
380 else if (strcmp (config.c_str (), OLD_TIMESTAMPS) == 0)
381 {
382 use_new_timestamps = false;
383 }
384 else if (strncmp (config.c_str (), SET_INDEX_PREFIX, strlen (SET_INDEX_PREFIX)) == 0)
385 {
386 try
387 {
388 double new_index = std::stod (config.substr (strlen (SET_INDEX_PREFIX)));
389 if (((int)new_index >= 0) && ((int)new_index < 100))
390 {
391 lock.lock ();
392 std::fill (pos_percentage.begin (), pos_percentage.end (), new_index);
393 lock.unlock ();
394 }
395 else
396 {
397 safe_logger (
398 spdlog::level::err, "invalid index value, should be between 0 and 100");
399 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
400 }
401 }
402 catch (const std::exception &e)
403 {
404 safe_logger (spdlog::level::err, "need to write a number after {}, exception is: {}",
405 SET_INDEX_PREFIX, e.what ());
406 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
407 }
408 }
409 else
410 {
411 safe_logger (spdlog::level::warn, "invalid config string {}", config);
412 }
413
414 return (int)BrainFlowExitCodes::STATUS_OK;
415}
416
417int PlaybackFileBoard::get_file_offsets (std::string filename, std::vector<long int> &offsets)
418{

Callers

nothing calls this directly

Calls 3

whatMethod · 0.80
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected