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

Method parse_streamer_params

src/board_controller/board.cpp:373–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373int Board::parse_streamer_params (const char *streamer_params, std::string &streamer_type,
374 std::string &streamer_dest, std::string &streamer_mods)
375{
376 if ((streamer_params == NULL) || (streamer_params[0] == '\0'))
377 {
378 safe_logger (spdlog::level::err, "invalid streamer params");
379 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
380 }
381
382 // parse string, sscanf doesnt work
383 std::string streamer_params_str = streamer_params;
384 size_t idx1 = streamer_params_str.find ("://");
385 if (idx1 == std::string::npos)
386 {
387 safe_logger (spdlog::level::err, "format is streamer_type://streamer_dest:streamer_args");
388 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
389 }
390 size_t idx2 = streamer_params_str.find_last_of (":", std::string::npos);
391 if ((idx2 == std::string::npos) || (idx1 == idx2))
392 {
393 safe_logger (spdlog::level::err, "format is streamer_type://streamer_dest:streamer_args");
394 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
395 }
396
397 streamer_type = streamer_params_str.substr (0, idx1);
398 streamer_dest = streamer_params_str.substr (idx1 + 3, idx2 - idx1 - 3);
399 streamer_mods = streamer_params_str.substr (idx2 + 1);
400
401 return (int)BrainFlowExitCodes::STATUS_OK;
402}
403
404int Board::get_current_board_data (
405 int num_samples, int preset, double *data_buf, int *returned_samples)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected