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
41 virtual ProtoStruct get_status() = 0;
42
43 API api() const override;
44
45 protected:
46 explicit Button(std::string name);
47};
48
49template <>
51 static API api();
52};
53
54} // namespace sdk
55} // namespace viam
Definition resource_api.hpp:21
A Button represents a physical or virtual button.
Definition button.hpp:23
virtual ProtoStruct get_status()=0
Get the status of the button.
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