clients/grpc: Initial start for gRPC proxy
[src/agl-compositor.git] / clients / grpc.h
1 #include <grpc/grpc.h>
2 #include <grpcpp/grpcpp.h>
3 #include <grpcpp/server.h>
4 #include <grpcpp/server_builder.h>
5 #include <grpcpp/server_context.h>
6
7 #include <grpcpp/ext/proto_server_reflection_plugin.h>
8 #include <grpcpp/health_check_service_interface.h>
9
10 #include "agl_shell.grpc.pb.h"
11 #include "agl-shell-client-protocol.h"
12
13 namespace {
14        const char kDefaultGrpcServiceAddress[] = "127.0.0.1:14005";
15 }
16
17
18 class GrpcServiceImpl final : public agl_shell_ipc::AglShellManagerService::CallbackService {
19
20        grpc::ServerUnaryReactor *ActivateApp(grpc::CallbackServerContext *context,
21                        const ::agl_shell_ipc::ActivateRequest* request,
22                        google::protobuf::Empty* /*response*/);
23
24        grpc::ServerUnaryReactor *DeactivateApp(grpc::CallbackServerContext *context,
25                        const ::agl_shell_ipc::DeactivateRequest* request,
26                        google::protobuf::Empty* /*response*/);
27
28        grpc::ServerUnaryReactor *SetAppSplit(grpc::CallbackServerContext *context,
29                        const ::agl_shell_ipc::SplitRequest* request,
30                        google::protobuf::Empty* /*response*/);
31
32        grpc::ServerUnaryReactor *SetAppFloat(grpc::CallbackServerContext *context,
33                        const ::agl_shell_ipc::FloatRequest* request,
34                        google::protobuf::Empty* /*response*/);
35 };
36
37
38 class Shell {
39 public:
40         std::shared_ptr<struct agl_shell> m_shell;
41         Shell(std::shared_ptr<struct agl_shell> shell) : m_shell(shell) { }
42         void ActivateApp(const std::string &app_id, const std::string &output_name);
43         void DeactivateApp(const std::string &app_id);
44         void SetAppSplit(const std::string &app_id, uint32_t orientation);
45         void SetAppFloat(const std::string &app_id);
46
47 };