8#include <viam/api/component/powersensor/v1/powersensor.pb.h>
10#include <viam/sdk/common/proto_type.hpp>
11#include <viam/sdk/common/utils.hpp>
12#include <viam/sdk/config/resource.hpp>
14using namespace viam::component::powersensor::v1;
89 virtual double get_power(
const AttributeMap& extra) = 0;
105 virtual AttributeMap
do_command(
const AttributeMap& command) = 0;
Extends APIType to additionally define a resource's subtype (e.g., camera).
Definition resource_api.hpp:33
Definition component.hpp:14
Definition power_sensor.hpp:26
static voltage from_proto(const GetVoltageResponse &proto)
Creates a voltage struct from its proto representation.
static GetCurrentResponse to_proto(const current &c)
Converts a current struct to its proto representation.
virtual AttributeMap do_command(const AttributeMap &command)=0
Send/receive arbitrary commands to the resource.
current get_current()
Returns the current reading of this sensor.
Definition power_sensor.hpp:71
API api() const override
Returns the API associated with a particular resource.
virtual voltage get_voltage(const AttributeMap &extra)=0
Returns the voltage reading of this sensor.
static current from_proto(const GetCurrentResponse &proto)
Creates a current struct from its proto representation.
virtual current get_current(const AttributeMap &extra)=0
Returns the current reading of this sensor.
static GetVoltageResponse to_proto(const voltage &v)
Converts a voltage struct to its proto representation.
double get_power()
Returns the power reading of this sensor.
Definition power_sensor.hpp:82
virtual AttributeMap get_readings(const AttributeMap &extra)=0
Returns the measurements/data specific to this sensor.
voltage get_voltage()
Returns the voltage reading of this sensor.
Definition power_sensor.hpp:60
AttributeMap get_readings()
Returns the measurements/data specific to this sensor.
Definition power_sensor.hpp:93
virtual double get_power(const AttributeMap &extra)=0
Returns the power reading of this sensor.
virtual std::string name() const
Return the resource's name.
Definition resource_api.hpp:50
Definition power_sensor.hpp:37
double amperes
Current in amperes.
Definition power_sensor.hpp:39
bool is_ac
Whether the current is DC or AC.
Definition power_sensor.hpp:41
Definition power_sensor.hpp:29
double volts
Voltage in volts.
Definition power_sensor.hpp:31
bool is_ac
Whether the voltage is DC or AC.
Definition power_sensor.hpp:33