Skip to content

Commit

Permalink
Add log message for EOF in PlaybackFileBoard. (#663)
Browse files Browse the repository at this point in the history
* Add log message for EOF in PlaybackFileBoard.
  • Loading branch information
stellarpower committed Aug 6, 2023
1 parent 0dbd69d commit a584036
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/board_controller/playback_file_board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ void PlaybackFileBoard::read_thread (int preset, std::string file)
int timestamp_channel = board_preset["timestamp_channel"];
double accumulated_time_delta = 0.0;

bool reached_end = false;
while (keep_alive)
{
auto start = std::chrono::high_resolution_clock::now ();
Expand Down Expand Up @@ -245,6 +246,15 @@ void PlaybackFileBoard::read_thread (int preset, std::string file)
}
if ((!loopback) && (res == NULL))
{
if (!reached_end)
{
reached_end = true;
// Log just once to inform the user that we have reached the endof the file, as we
// stop sending any samples. The user-programmer could be waiting as the stream
// needs to be stopped manually.
safe_logger (
spdlog::level::trace, "End of file reached and not set to loop. Sleeping.");
}
// busy wait instead exit
#ifdef _WIN32
Sleep (1);
Expand Down Expand Up @@ -400,4 +410,4 @@ int PlaybackFileBoard::get_file_offsets (std::string filename, std::vector<long
}

return (int)BrainFlowExitCodes::STATUS_OK;
}
}

0 comments on commit a584036

Please sign in to comment.