#pragma once #include #include #include #include namespace vamp_protocol { constexpr std::char_t root_path[] = "/"; constexpr std::char_t status_path[] = "/api/status"; constexpr std::char_t remote_next_path[] = "/api/remote/next"; constexpr std::char_t remote_previous_path[] = "/api/remote/previous"; constexpr std::char_t remote_select_path[] = "/api/remote/select"; constexpr std::char_t remote_heartbeat_path[] = "/api/remote/heartbeat"; constexpr std::char_t remote_display_path[] = "/api/remote/display"; constexpr std::char_t remote_title_path[] = "/api/remote/title"; constexpr auto title_width = std::size_t{296}; constexpr auto title_height = std::size_t{64}; constexpr auto title_header_size = std::size_t{8}; constexpr auto title_image_size = title_header_size + title_width * title_height / 2U; constexpr auto title_id_size = std::size_t{64}; inline auto valid_title_id(std::string_view value) -> std::bool_t { if (value.size() != title_id_size) { return false; } for (auto character : value) { if (!((character >= '0' && character <= '9') || (character >= 'a' && character <= 'f'))) { return false; } } return true; } // VPTI, little-endian uint16 dimensions, then row-major coverage, high nibble first. inline auto valid_title_image(std::string_view bytes) -> std::bool_t { return bytes.size() == title_image_size && bytes.substr(0U, 4U) == "VPTI" && static_cast(bytes[4]) == (title_width & 255U) && static_cast(bytes[5]) == (title_width >> 8U) && static_cast(bytes[6]) == title_height && bytes[7] == 0; } enum class page_command { PREVIOUS, NEXT, SELECT, }; auto page_command_path(vamp_protocol::page_command command) -> std::char_t const *; auto page_command_name(vamp_protocol::page_command command) -> std::char_t const *; auto page_command_display_label(vamp_protocol::page_command command) -> std::char_t const *; }