UI
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
|
||||
#include <ligo.hpp>
|
||||
|
||||
#include <vamp_protocol/page_control.hpp>
|
||||
#include <vamp_zero/config.hpp>
|
||||
#include <vamp_zero/menu.hpp>
|
||||
#include <vamp_zero/types.hpp>
|
||||
|
||||
namespace vamp_zero {
|
||||
|
||||
class control_state {
|
||||
public:
|
||||
control_state(vamp_zero::config config, vamp_zero::app_state state);
|
||||
auto config() const -> vamp_zero::config;
|
||||
auto snapshot() const -> vamp_zero::app_state;
|
||||
auto apply(vamp_protocol::page_command command) -> vamp_zero::app_state;
|
||||
auto apply(vamp_zero::menu_action const &action) -> vamp_zero::app_state;
|
||||
auto heartbeat() -> vamp_zero::app_state;
|
||||
auto refresh_connection() -> std::optional<vamp_zero::app_state>;
|
||||
auto set_observer(std::function<void(vamp_zero::app_state)> observer) -> void;
|
||||
auto finish_playback(std::uint64_t session, std::string error = {}, std::shared_ptr<vamp_zero::catalog const> catalog = {}) -> void;
|
||||
private:
|
||||
auto pico_connected_locked() const -> std::bool_t;
|
||||
auto snapshot_locked() const -> vamp_zero::app_state;
|
||||
mutable std::mutex mutex_{};
|
||||
vamp_zero::config config_{};
|
||||
vamp_zero::app_state state_{};
|
||||
std::chrono::steady_clock::time_point last_heartbeat_{};
|
||||
std::function<void(vamp_zero::app_state)> observer_{};
|
||||
};
|
||||
|
||||
auto make_router(vamp_zero::control_state &state) -> ligo::service_router;
|
||||
auto validated_title_path(std::string const &assets_path, std::string const &identifier) -> std::expected<std::string, modulus::error>;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user