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

Method prepare_session

src/board_controller/playback_file_board.cpp:45–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45int PlaybackFileBoard::prepare_session ()
46{
47 if (initialized)
48 {
49 safe_logger (spdlog::level::info, "Session is already prepared");
50 return (int)BrainFlowExitCodes::STATUS_OK;
51 }
52
53 if (params.master_board == (int)BoardIds::NO_BOARD)
54 {
55 safe_logger (spdlog::level::err, "master board id is not provided");
56 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
57 }
58 try
59 {
60 board_id = params.master_board;
61 board_descr = boards_struct.brainflow_boards_json["boards"][std::to_string (board_id)];
62 }
63 catch (json::exception &e)
64 {
65 safe_logger (spdlog::level::err, "invalid json for master board");
66 safe_logger (spdlog::level::err, e.what ());
67 return (int)BrainFlowExitCodes::GENERAL_ERROR;
68 }
69 catch (const std::exception &e)
70 {
71 safe_logger (
72 spdlog::level::err, "Write board id of board which recorded data to other_info field");
73 safe_logger (spdlog::level::err, e.what ());
74 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
75 }
76
77 if (!params.file.empty ())
78 {
79 std::vector<long int> offsets;
80 int res = get_file_offsets (params.file, offsets);
81 if (res != (int)BrainFlowExitCodes::STATUS_OK)
82 {
83 return res;
84 }
85 else
86 {
87 file_offsets.push_back (offsets);
88 }
89 }
90 if (!params.file_aux.empty ())
91 {
92 std::vector<long int> offsets;
93 int res = get_file_offsets (params.file_aux, offsets);
94 if (res != (int)BrainFlowExitCodes::STATUS_OK)
95 {
96 return res;
97 }
98 else
99 {
100 file_offsets.push_back (offsets);
101 }
102 }

Callers

nothing calls this directly

Calls 2

whatMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected