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 <grpcpp/channel.h>
7
8#include <viam/api/component/sensor/v1/sensor.grpc.pb.h>
9
12#include <viam/sdk/config/resource.hpp>
13
14namespace viam {
15namespace sdk {
16namespace impl {
17
21class SensorClient : public Sensor {
22 public:
23 using interface_type = Sensor;
24 SensorClient(std::string name, std::shared_ptr<grpc::Channel> channel);
25 ProtoStruct get_readings(const ProtoStruct& extra) override;
26 ProtoStruct do_command(const ProtoStruct& command) override;
27 std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) override;
28
31
32 private:
33 using StubType = viam::component::sensor::v1::SensorService::StubInterface;
34 std::unique_ptr<StubType> stub_;
35 std::shared_ptr<grpc::Channel> channel_;
36};
37
38} // namespace impl
39} // namespace sdk
40} // 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
gRPC client implementation of a Sensor component.
Definition sensor_client.hpp:21
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.