1#ifndef YAZE_APP_CORE_SERVICE_UNIFIED_GRPC_SERVER_H_
2#define YAZE_APP_CORE_SERVICE_UNIFIED_GRPC_SERVER_H_
10#include "absl/status/status.h"
15#include <grpcpp/impl/service_type.h>
16#include <grpcpp/server.h>
24class CanvasAutomationServiceImpl;
36class ProposalApprovalManager;
38class EmulatorServiceImpl;
43class ImGuiTestHarnessServiceImpl;
52 using RomGetter = std::function<Rom*()>;
53 using RomLoader = std::function<bool(
const std::string& path)>;
57 bool enable_test_harness =
true;
58 bool enable_rom_service =
true;
59 bool enable_emulator_service =
true;
60 bool enable_canvas_automation =
true;
61 bool require_approval_for_rom_writes =
true;
79 absl::Status Initialize(
81 emu::IEmulator* emulator =
nullptr,
82 RomGetter rom_getter =
nullptr,
83 RomLoader rom_loader =
nullptr,
84 test::TestManager* test_manager =
nullptr,
85 net::RomVersionManager* version_mgr =
nullptr,
86 net::ProposalApprovalManager* approval_mgr =
nullptr,
87 CanvasAutomationServiceImpl* canvas_service =
nullptr);
90 absl::Status StartAsync();
91 absl::Status AddService(std::unique_ptr<grpc::Service> service);
93 bool IsRunning()
const;
94 int Port()
const {
return config_.port; }
95 void SetConfig(
const Config& config) { config_ = config; }
99 std::unique_ptr<grpc::Server> server_;
102 std::unique_ptr<test::ImGuiTestHarnessServiceImpl> test_harness_service_;
103 std::unique_ptr<net::RomServiceImpl> rom_service_;
104 std::unique_ptr<net::EmulatorServiceImpl> emulator_service_;
105 CanvasAutomationServiceImpl* canvas_service_ =
nullptr;
108 std::unique_ptr<grpc::Service> canvas_grpc_service_;
109 std::unique_ptr<grpc::Service> test_harness_grpc_wrapper_;
110 std::vector<std::unique_ptr<grpc::Service>> extra_services_;
114 absl::Status BuildServer();