Viam C++ SDK current
Loading...
Searching...
No Matches
sensor_client.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <viam/api/component/sensor/v1/sensor.grpc.pb.h>
7
10#include <viam/sdk/config/resource.hpp>
11#include <viam/sdk/rpc/dial.hpp>
12
13namespace viam {
14namespace sdk {
15namespace impl {
16
20class SensorClient : public Sensor {
21 public:
22 using interface_type = Sensor;
23 SensorClient(std::string name, const ViamChannel& channel);
24
25 const ViamChannel& channel() const {
26 return *channel_;
27 }
28 ProtoStruct get_readings(const ProtoStruct& extra) override;
29 ProtoStruct do_command(const ProtoStruct& command) override;
30 std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) override;
31
34
35 private:
36 using StubType = viam::component::sensor::v1::SensorService::StubInterface;
37 std::unique_ptr<StubType> stub_;
38 const ViamChannel* channel_;
39};
40
41} // namespace impl
42} // namespace sdk
43} // namespace viam
virtual std::string name() const
Return the resource's name.
Definition sensor.hpp:22
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling sensor.
Definition sensor.hpp:33
ProtoStruct get_readings()
Returns the measurements/data specific to this sensor.
Definition sensor.hpp:44
Definition dial.hpp:25
gRPC client implementation of a Sensor component.
Definition sensor_client.hpp:20
ProtoStruct get_readings(const ProtoStruct &extra) override
Returns the measurements/data specific to this sensor.
std::vector< GeometryConfig > get_geometries(const ProtoStruct &extra) override
Returns GeometryConfigs associated with the calling sensor.
ProtoStruct do_command(const ProtoStruct &command) override
Send/receive arbitrary commands to the resource.
Defines a Sensor component.
Implements a gRPC server for the Sensor component.