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>
21class CanvasAutomationServiceImpl;
29class ProposalApprovalManager;
35class ImGuiTestHarnessServiceImpl;
44 using RomGetter = std::function<Rom*()>;
48 bool enable_test_harness =
true;
49 bool enable_rom_service =
true;
50 bool enable_canvas_automation =
true;
51 bool require_approval_for_rom_writes =
true;
67 absl::Status Initialize(
68 int port, test::TestManager* test_manager =
nullptr,
69 RomGetter rom_getter =
nullptr,
70 net::RomVersionManager* version_mgr =
nullptr,
71 net::ProposalApprovalManager* approval_mgr =
nullptr,
72 CanvasAutomationServiceImpl* canvas_service =
nullptr);
75 absl::Status StartAsync();
76 absl::Status AddService(std::unique_ptr<grpc::Service> service);
78 bool IsRunning()
const;
79 int Port()
const {
return config_.port; }
80 void SetConfig(
const Config& config) { config_ = config; }
84 std::unique_ptr<grpc::Server> server_;
85 std::unique_ptr<test::ImGuiTestHarnessServiceImpl> test_harness_service_;
86 std::unique_ptr<net::RomServiceImpl> rom_service_;
87 CanvasAutomationServiceImpl* canvas_service_ =
nullptr;
88 std::unique_ptr<grpc::Service> canvas_grpc_service_;
89 std::unique_ptr<grpc::Service> test_harness_grpc_wrapper_;
90 std::vector<std::unique_ptr<grpc::Service>> extra_services_;
93 absl::Status BuildServer();