SRS-control 0.1.4
Loading...
Searching...
No Matches
SRSWorld.cpp
Go to the documentation of this file.
1#include "SRSWorld.hpp"
2#include "srs/SRSEmulator.hpp"
3#include <memory>
4#include <optional>
5#include <spdlog/spdlog.h>
6#include <string>
7#include <string_view>
8#include <thread>
9
10namespace srs::test
11{
12 World::World(std::string_view input_filename)
13 : app_config_{ app_.get_config_ref() }
14 {
16 std::make_unique<SRSEmulator>(SRSEmulator::Config{ .data_port = app_config_.fec_data_receive_port,
17 .listen_port = app_config_.fec_control_remote_port,
18 .write_port = app_config_.fec_control_local_port,
19 .filename = input_filename });
20 }
21
22 void World::init() { app_.init(); }
23
24 auto World::launch_server() -> std::optional<std::string>
25 {
26 srs_server_thread_ = std::jthread(
27 [this]()
28 {
29 srs_server_->wait_for_connection();
30 spdlog::trace("World: Server stops waiting for connections.");
31 });
32 return {};
33 }
34
35} // namespace srs::test
std::jthread srs_server_thread_
Definition SRSWorld.hpp:42
std::unique_ptr< SRSEmulator > srs_server_
Definition SRSWorld.hpp:39
auto launch_server() -> std::optional< std::string >
Definition SRSWorld.cpp:24
World(std::string_view input_filename)
Definition SRSWorld.cpp:12
Config & app_config_
Definition SRSWorld.hpp:38