Add control functions to PcmStream

-move json parsing to Server class
-improve error handling with the new ErrorCode object
This commit is contained in:
badaix 2021-07-04 21:33:45 +02:00
parent 78c78370ab
commit 077a6fc1a4
12 changed files with 629 additions and 152 deletions

View file

@ -25,6 +25,7 @@
#include "common/metatags.hpp"
#include "common/properties.hpp"
#include "common/utils/string_utils.hpp"
#include "server/streamreader/control_error.hpp"
#include "server/streamreader/stream_uri.hpp"
using namespace std;
@ -237,3 +238,17 @@ TEST_CASE("Librespot")
for (const auto& match : m)
std::cerr << "Match: '" << match << "'\n";
}
TEST_CASE("Error")
{
std::error_code ec = ControlErrc::can_not_control;
REQUIRE(ec);
REQUIRE(ec == ControlErrc::can_not_control);
REQUIRE(ec != ControlErrc::success);
std::cout << ec << std::endl;
ec = make_error_code(ControlErrc::can_not_control);
REQUIRE(ec.category() == snapcast::error::control::category());
std::cout << "Category: " << ec.category().name() << ", " << ec.message() << std::endl;
}