Viam C++ SDK current
Loading...
Searching...
No Matches
generic.hpp
1
5#pragma once
6
7#include <viam/sdk/common/proto_value.hpp>
8#include <viam/sdk/common/utils.hpp>
9#include <viam/sdk/config/resource.hpp>
10#include <viam/sdk/services/service.hpp>
11
12namespace viam {
13namespace sdk {
14
21class GenericService : public Service {
22 public:
26 virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
27
30 virtual ProtoStruct get_status() = 0;
31
33 API api() const override;
34
35 protected:
36 explicit GenericService(std::string name);
37
38 explicit GenericService(const ResourceConfig& cfg);
39};
40
41template <>
43 static API api();
44};
45
46} // namespace sdk
47} // namespace viam
Definition resource_api.hpp:21
A GenericService represents any service that can execute arbitrary commands.
Definition generic.hpp:21
virtual ProtoStruct do_command(const ProtoStruct &command)=0
Send/receive arbitrary commands to the resource.
virtual ProtoStruct get_status()=0
Get the status of the generic service.
API api() const override
Creates a GenericService API.
Definition resource.hpp:43
virtual std::string name() const
Return the resource's name.
Definition service.hpp:10
Definition resource_api.hpp:46