1
0

refactor shared

This commit is contained in:
2026-01-08 19:23:19 +08:00
parent 07cc58fb36
commit 64368b7837
23 changed files with 400 additions and 234 deletions

View File

@@ -3,14 +3,14 @@ target_sources(BasaltPresenter
PRIVATE
main.cpp
dll_loader.cpp
command_client.cpp
cmd_client.cpp
)
target_sources(BasaltPresenter
PUBLIC
FILE_SET HEADERS
FILES
dll_loader.hpp
command_client.hpp
cmd_client.hpp
)
target_include_directories(BasaltPresenter
PUBLIC

View File

@@ -1,8 +1,8 @@
#include "command_client.hpp"
#include "cmd_client.hpp"
#include <basalt/char_types.hpp>
#include <stdexcept>
namespace Basalt::Presenter {
namespace basalt::presenter::cmd_client {
CommandClient::CommandClient() : m_PipeOperator(BSTEXT("ed0e3f1f-d214-4880-9562-640bce15e72e")), m_Status(ClientStatus::Ready) {}

View File

@@ -2,16 +2,17 @@
#include <basalt/pipe_operator.hpp>
#include <cstdint>
namespace Basalt::Presenter {
namespace basalt::presenter::cmd_client {
// Protocol codes
enum class ProtocolCode : std::uint8_t {
HANDSHAKE_REQUEST = 0x61, //< Trainer -> Presenter
HANDSHAKE_RESPONSE = 0x62, //< Presenter -> Trainer
DATA_READY = 0x01, //< Presenter -> Trainer
DATA_RECEIVED = 0x02, //< Trainer -> Presenter
STOP_REQUEST = 0x71, //< Both directions
STOP = 0x71 //< Both directions (same code)
HANDSHAKE_REQUEST = 0x61, ///< Trainer -> Presenter
HANDSHAKE_RESPONSE = 0x62, ///< Presenter -> Trainer
DATA_READY = 0x01, ///< Presenter -> Trainer
DATA_RECEIVED = 0x02, ///< Trainer -> Presenter
ACTIVELY_STOP = 0x21, ///< Presenter-->Trainer
STOP_REQUEST = 0X71, ///< Presenter<--Trainer
STOP_RESPONSE = 0x72, //< Presenter-->Trainer
};
// Pixel kind values

View File

@@ -8,9 +8,9 @@
#include <unistd.h>
#endif
using ::Basalt::Shared::Char::BSStringView;
using ::basalt::shared::char_types::BSStringView;
namespace Basalt::Presenter {
namespace basalt::presenter::dll_loader {
static std::filesystem::path get_executable() {
#if defined(BASALT_OS_WINDOWS)

View File

@@ -1,5 +1,4 @@
#include <basalt/char_types.hpp>
#include <string_view>
#if defined(BASALT_OS_WINDOWS)
#include <Windows.h>
@@ -7,7 +6,7 @@
#include <dlfcn.h>
#endif
namespace Basalt::Presenter {
namespace basalt::presenter::dll_loader {
enum class DllKind {
Engine, ///< Render engine
@@ -25,7 +24,7 @@ namespace Basalt::Presenter {
#endif
public:
DllLoader(DllKind kind, const Shared::Char::BSStringView& filename);
DllLoader(DllKind kind, const shared::char_types::BSStringView& filename);
~DllLoader();
private: