@@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <modulus/types.hpp>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
namespace vamp_protocol {
|
||||
@@ -12,6 +15,33 @@ 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<std::uint8_t>(bytes[4]) == (title_width & 255U) &&
|
||||
static_cast<std::uint8_t>(bytes[5]) == (title_width >> 8U) &&
|
||||
static_cast<std::uint8_t>(bytes[6]) == title_height && bytes[7] == 0;
|
||||
}
|
||||
|
||||
enum class page_command {
|
||||
PREVIOUS,
|
||||
|
||||
Reference in New Issue
Block a user