Viam C++ SDK current
Loading...
Searching...
No Matches
button_client.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <memory>
7
8#include <viam/api/component/button/v1/button.grpc.pb.h>
9
11#include <viam/sdk/rpc/dial.hpp>
12
13namespace viam {
14namespace sdk {
15namespace impl {
16
20class ButtonClient : public Button {
21 public:
22 using interface_type = Button;
23 ButtonClient(std::string name, const ViamChannel& channel);
24
25 const ViamChannel& channel() const {
26 return *channel_;
27 }
28
29 void push(const ProtoStruct& extra) override;
30 ProtoStruct do_command(const ProtoStruct& command) override;
31
32 using Button::push;
33
34 private:
35 using StubType = viam::component::button::v1::ButtonService::StubInterface;
36 std::unique_ptr<StubType> stub_;
37 const ViamChannel* channel_;
38};
39
40} // namespace impl
41} // namespace sdk
42} // namespace viam
Defines a Button component.
A Button represents a physical or virtual button.
Definition button.hpp:23
void push()
Push the button.
Definition button.hpp:26
virtual std::string name() const
Return the resource's name.
Definition dial.hpp:25
gRPC client implementation of a Button component
Definition button_client.hpp:20
ProtoStruct do_command(const ProtoStruct &command) override
Send/receive arbitrary commands to the resource.
void push(const ProtoStruct &extra) override
Push the button.