| 271 | |
| 272 | |
| 273 | int SynchroniBoard::prepare_session () |
| 274 | { |
| 275 | if (initialized) |
| 276 | { |
| 277 | safe_logger (spdlog::level::info, "Session is already prepared"); |
| 278 | return (int)BrainFlowExitCodes::STATUS_OK; |
| 279 | } |
| 280 | if (params.timeout <= 0) |
| 281 | { |
| 282 | params.timeout = 5; |
| 283 | } |
| 284 | if (!g_dll_loader) |
| 285 | { |
| 286 | g_dll_loader = make_shared<DLLLoader> (get_lib_name ().c_str ()); |
| 287 | } |
| 288 | if (!dll_loader) |
| 289 | { |
| 290 | dll_loader = shared_ptr<DLLLoader> (g_dll_loader); |
| 291 | } |
| 292 | |
| 293 | if (!dll_loader->load_library ()) |
| 294 | { |
| 295 | safe_logger (spdlog::level::err, "Failed to load library"); |
| 296 | dll_loader = NULL; |
| 297 | return (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 298 | } |
| 299 | safe_logger (spdlog::level::debug, "Library is loaded"); |
| 300 | int res = call_init (); |
| 301 | if (res != (int)BrainFlowExitCodes::STATUS_OK) |
| 302 | { |
| 303 | dll_loader = NULL; |
| 304 | return res; |
| 305 | } |
| 306 | res = call_open (); |
| 307 | if (res != (int)BrainFlowExitCodes::STATUS_OK) |
| 308 | { |
| 309 | dll_loader = NULL; |
| 310 | return res; |
| 311 | } |
| 312 | initialized = true; |
| 313 | return (int)BrainFlowExitCodes::STATUS_OK; |
| 314 | } |
| 315 | |
| 316 | int SynchroniBoard::start_stream (int buffer_size, const char *streamer_params) |
| 317 | { |
nothing calls this directly
no test coverage detected