6#include <grpcpp/impl/service_type.h>
7#include <grpcpp/security/server_credentials.h>
8#include <grpcpp/server_builder.h>
10#include <viam/sdk/resource/resource.hpp>
11#include <viam/sdk/resource/resource_api.hpp>
12#include <viam/sdk/resource/resource_server_base.hpp>
55 std::shared_ptr<grpc::ServerCredentials> creds =
nullptr);
64 friend class ::viam::sdktests::TestServer;
67 std::unordered_map<API, std::shared_ptr<ResourceServer>> managed_servers_;
68 std::unique_ptr<grpc::ServerBuilder> builder_;
69 std::unique_ptr<grpc::Server> server_;
Extends APIType to additionally define a resource's subtype (e.g., camera).
Definition resource_api.hpp:33
Defines gRPC Server functionality.
Definition server.hpp:25
std::shared_ptr< ResourceServer > lookup_resource_server(const API &api)
Returns reference to managed resource server.
void start()
Starts the grpc server. Can only be called once.
void register_service(grpc::Service *service)
Registers a gRPC service.
void wait()
waits on server close, only returning when the server is closed.
void add_listening_port(const std::string &address, std::shared_ptr< grpc::ServerCredentials > creds=nullptr)
Adds a listening port to the server.
void add_resource(std::shared_ptr< Resource > resource)
Adds a specific managed resource to the associated resource server.
void shutdown()
Shutdown the gRPC server.