Viam C++ SDK current
Loading...
Searching...
No Matches
button.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <string>
7
8#include <viam/sdk/common/proto_value.hpp>
9#include <viam/sdk/components/component.hpp>
10#include <viam/sdk/resource/resource_api.hpp>
11
12namespace viam {
13namespace sdk {
14
16
23class Button : public Component {
24 public:
26 inline void push() {
27 return push({});
28 }
29
32 virtual void push(const ProtoStruct& extra) = 0;
33
37 virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
38
39 API api() const override;
40
41 protected:
42 explicit Button(std::string name);
43};
44
45template <>
47 static API api();
48};
49
50} // namespace sdk
51} // namespace viam
Definition resource_api.hpp:21
A Button represents a physical or virtual button.
Definition button.hpp:23
void push()
Push the button.
Definition button.hpp:26
virtual ProtoStruct do_command(const ProtoStruct &command)=0
Send/receive arbitrary commands to the resource.
virtual void push(const ProtoStruct &extra)=0
Push the button.
API api() const override
Returns the API associated with a particular resource.
Definition component.hpp:10
virtual std::string name() const
Return the resource's name.
Definition resource_api.hpp:46