@@ -50,7 +50,7 @@ auto invalid(std::string message) -> modulus::error {
|
||||
}
|
||||
|
||||
auto usage() -> std::string {
|
||||
return "usage: vamp-zero [--config PATH] [--check-config] [--health-check] [--build-info] [--once]";
|
||||
return "usage: vamp_zero [--config PATH] [--check-config] [--health-check] [--build-info] [--once]";
|
||||
}
|
||||
|
||||
auto bind_port(vamp_zero::config const &config) -> std::uint16_t {
|
||||
@@ -339,7 +339,7 @@ auto run_headless(vamp_zero::config const &config, vamp_zero::control_state &sta
|
||||
server.stop();
|
||||
io.stop();
|
||||
});
|
||||
std::cout << "vamp-zero listening on " << server.selected_port() << '\n';
|
||||
std::cout << "vamp_zero listening on " << server.selected_port() << '\n';
|
||||
io.run();
|
||||
return {};
|
||||
}
|
||||
@@ -463,7 +463,7 @@ auto vamp_zero::parse_command_line(std::int32_t argc, std::char_t **argv) -> std
|
||||
|
||||
auto vamp_zero::run(vamp_zero::command_line command) -> std::expected<void, modulus::error> {
|
||||
if (command.print_build_info) {
|
||||
std::cout << "product-vamp " << VAMP_GIT_SHA << '\n';
|
||||
std::cout << "product_vamp " << VAMP_GIT_SHA << '\n';
|
||||
return {};
|
||||
}
|
||||
auto config = vamp_zero::load_config(command.config_path);
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
namespace {
|
||||
|
||||
constexpr auto json_options = modulus::json_config::options{
|
||||
.category = "product-vamp.config",
|
||||
.category = "product_vamp.config",
|
||||
.invalid_argument_code = static_cast<std::int32_t>(vamp_zero::error_code::INVALID_ARGUMENT),
|
||||
.not_found_code = static_cast<std::int32_t>(vamp_zero::error_code::NOT_FOUND),
|
||||
};
|
||||
|
||||
constexpr auto field_options = modulus::json_config::options{
|
||||
.category = "product-vamp",
|
||||
.category = "product_vamp",
|
||||
.invalid_argument_code = static_cast<std::int32_t>(vamp_zero::error_code::INVALID_ARGUMENT),
|
||||
.not_found_code = static_cast<std::int32_t>(vamp_zero::error_code::NOT_FOUND),
|
||||
};
|
||||
|
||||
@@ -250,7 +250,7 @@ auto vamp_zero::make_router(vamp_zero::control_state &state) -> ligo::service_ro
|
||||
co_return ligo::text_response("application/octet-stream", std::move(bytes->bytes));
|
||||
});
|
||||
router.add_route("GET", "/api/health", [](ligo::request_context, boost::json::value) -> boost::asio::awaitable<std::expected<boost::json::value, modulus::error>> {
|
||||
co_return boost::json::object{{"product", "product-vamp"}, {"device", "zero"}, {"status", "ready"}};
|
||||
co_return boost::json::object{{"product", "product_vamp"}, {"device", "zero"}, {"status", "ready"}};
|
||||
});
|
||||
router.add_response_route("GET", vamp_protocol::remote_display_path, [&state](ligo::request_context, boost::json::value) -> boost::asio::awaitable<std::expected<ligo::service_response, modulus::error>> {
|
||||
auto updated = state.heartbeat();
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace {
|
||||
constexpr auto application_id = std::int64_t{0x56414D50};
|
||||
|
||||
auto connection_config(vamp_zero::database_config const &config) -> noto::connection_config {
|
||||
auto result = noto::file_connection_config(config.path, "product-vamp");
|
||||
auto result = noto::file_connection_config(config.path, "product_vamp");
|
||||
result.mode = noto::open_mode::READ_ONLY;
|
||||
result.busy_timeout = std::chrono::seconds{5};
|
||||
result.pragmas = {{.name = "query_only", .value = true}};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
auto vamp_zero::make_error(vamp_zero::error_code code, std::string message, modulus::source_location location) -> modulus::error {
|
||||
return modulus::make_error("product-vamp", static_cast<std::int32_t>(code), std::move(message), location);
|
||||
return modulus::make_error("product_vamp", static_cast<std::int32_t>(code), std::move(message), location);
|
||||
}
|
||||
|
||||
auto vamp_zero::fail_void(vamp_zero::error_code code, std::string message, modulus::source_location location) -> std::expected<void, modulus::error> {
|
||||
|
||||
@@ -39,8 +39,8 @@ auto vamp_zero::check_health(vamp_zero::config const &config) -> std::expected<v
|
||||
auto value = object == nullptr ? nullptr : object->if_contains(field);
|
||||
return value != nullptr && value->is_string() && value->as_string() == expected;
|
||||
};
|
||||
if (!matches("product", "product-vamp") || !matches("device", "zero") || !matches("status", "ready")) {
|
||||
return std::unexpected(vamp_zero::make_error(vamp_zero::error_code::UNAVAILABLE, "health response is not a ready product-vamp zero"));
|
||||
if (!matches("product", "product_vamp") || !matches("device", "zero") || !matches("status", "ready")) {
|
||||
return std::unexpected(vamp_zero::make_error(vamp_zero::error_code::UNAVAILABLE, "health response is not a ready product_vamp zero"));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -20,10 +20,10 @@ auto main(std::int32_t argc, std::char_t **argv) -> std::int32_t {
|
||||
}
|
||||
return 0;
|
||||
} catch (std::exception const &error) {
|
||||
std::cerr << "vamp-zero: unhandled exception: " << error.what() << '\n';
|
||||
std::cerr << "vamp_zero: unhandled exception: " << error.what() << '\n';
|
||||
return 1;
|
||||
} catch (...) {
|
||||
std::cerr << "vamp-zero: unhandled unknown exception\n";
|
||||
std::cerr << "vamp_zero: unhandled unknown exception\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ auto draw_switch(luma::draw_context &context, luma::rect row, std::bool_t on) ->
|
||||
context.fill_rect({track.x + 16.0F, track.y, 28.0F, 32.0F}, color);
|
||||
context.fill_ellipse({track.x, track.y, 32.0F, 32.0F}, color);
|
||||
context.fill_ellipse({track.x + 28.0F, track.y, 32.0F, 32.0F}, color);
|
||||
context.fill_ellipse({track.x + (on ? 32.0F : 4.0F), track.y + 4.0F, 24.0F, 24.0F}, vamp_zero::to_luma(vamp_style::background));
|
||||
context.fill_ellipse({track.x + (on ? 32.0F : 4.0F), track.y + 4.0F, 24.0F, 24.0F}, vamp_zero::to_luma(on ? vamp_style::background : vamp_style::ink));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ struct score_draw_cache {
|
||||
.y = bounds.y + (bounds.height - 484.0F * scale) / 2.0F,
|
||||
.width = 976.0F * scale,
|
||||
.height = 484.0F * scale};
|
||||
context.fill_rect(page, {.r = 255, .g = 255, .b = 255, .a = 255});
|
||||
context.fill_rect(page, vamp_zero::to_luma(vamp_style::background));
|
||||
context.draw_texture(**texture, {.x = 0, .y = 0, .width = 976, .height = 484}, page, {.r = 255, .g = 255, .b = 255, .a = 255});
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user