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

Method ping_thread

src/board_controller/emotibit/emotibit.cpp:869–891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

867}
868
869void Emotibit::ping_thread ()
870{
871 int sleep_time = 1;
872 int package_num = 1;
873 while (initialized)
874 {
875#ifdef _WIN32
876 Sleep (sleep_time * 1000);
877#else
878 usleep (sleep_time * 1000000);
879#endif
880 std::vector<std::string> payload;
881 payload.push_back (DATA_PORT);
882 payload.push_back (std::to_string (data_port));
883 std::string package = create_package (PING, package_num++, payload);
884 // safe_logger (spdlog::level::trace, "sending package: {}", package.c_str ());
885 int bytes_send = adv_socket->send (package.c_str (), (int)package.size ());
886 if (bytes_send != (int)package.size ())
887 {
888 safe_logger (spdlog::level::err, "failed to send adv package, res is {}", bytes_send);
889 }
890 }
891}

Callers 1

prepare_sessionMethod · 0.95

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected