Viam C++ SDK current
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
viam::sdk::PowerSensor Class Referenceabstract

#include "components/power_sensor.hpp"

+ Inheritance diagram for viam::sdk::PowerSensor:

Classes

struct  current
 
struct  voltage
 

Public Member Functions

API api () const override
 Returns the API associated with a particular resource.
 
voltage get_voltage ()
 Returns the voltage reading of this sensor.
 
virtual voltage get_voltage (const AttributeMap &extra)=0
 Returns the voltage reading of this sensor.
 
current get_current ()
 Returns the current reading of this sensor.
 
virtual current get_current (const AttributeMap &extra)=0
 Returns the current reading of this sensor.
 
double get_power ()
 Returns the power reading of this sensor.
 
virtual double get_power (const AttributeMap &extra)=0
 Returns the power reading of this sensor.
 
AttributeMap get_readings ()
 Returns the measurements/data specific to this sensor.
 
virtual AttributeMap get_readings (const AttributeMap &extra)=0
 Returns the measurements/data specific to this sensor.
 
virtual AttributeMap do_command (const AttributeMap &command)=0
 Send/receive arbitrary commands to the resource.
 
- Public Member Functions inherited from viam::sdk::Component
viam::common::v1::ResourceName get_resource_name (std::string name) const override
 Returns a ResourceName for a particular resource name.
 
- Public Member Functions inherited from viam::sdk::Resource
 Resource (std::string name)
 
virtual std::string name () const
 Return the resource's name.
 

Static Public Member Functions

static voltage from_proto (const GetVoltageResponse &proto)
 Creates a voltage struct from its proto representation.
 
static current from_proto (const GetCurrentResponse &proto)
 Creates a current struct from its proto representation.
 
static GetVoltageResponse to_proto (const voltage &v)
 Converts a voltage struct to its proto representation.
 
static GetCurrentResponse to_proto (const current &c)
 Converts a current struct to its proto representation.
 

Protected Member Functions

 PowerSensor (std::string name)
 
- Protected Member Functions inherited from viam::sdk::Component
 Component (std::string name)
 

Detailed Description

This acts as an abstract base class to be inherited from by any drivers representing specific powersensor implementations. This class cannot be used on its own.

Member Function Documentation

◆ api()

API viam::sdk::PowerSensor::api ( ) const
overridevirtual

Returns the API associated with a particular resource.

Implements viam::sdk::Resource.

◆ do_command()

virtual AttributeMap viam::sdk::PowerSensor::do_command ( const AttributeMap & command)
pure virtual

Send/receive arbitrary commands to the resource.

Parameters
Commandthe command to execute.
Returns
The result of the executed command.

Implemented in viam::sdk::impl::PowerSensorClient.

◆ get_current() [1/2]

current viam::sdk::PowerSensor::get_current ( )
inline

Returns the current reading of this sensor.

Returns
The current reading of this sensor.

◆ get_current() [2/2]

virtual current viam::sdk::PowerSensor::get_current ( const AttributeMap & extra)
pure virtual

Returns the current reading of this sensor.

Parameters
extraAny additional arguments to this method.
Returns
The current reading of this sensor.

Implemented in viam::sdk::impl::PowerSensorClient, and viam::sdk::impl::PowerSensorClient.

◆ get_power() [1/2]

double viam::sdk::PowerSensor::get_power ( )
inline

Returns the power reading of this sensor.

Returns
The power reading of this sensor.

◆ get_power() [2/2]

virtual double viam::sdk::PowerSensor::get_power ( const AttributeMap & extra)
pure virtual

Returns the power reading of this sensor.

Parameters
extraAny additional arguments to this method.
Returns
The power reading of this sensor.

Implemented in viam::sdk::impl::PowerSensorClient, and viam::sdk::impl::PowerSensorClient.

◆ get_readings() [1/2]

AttributeMap viam::sdk::PowerSensor::get_readings ( )
inline

Returns the measurements/data specific to this sensor.

Returns
The requested measurements/data specific to this sensor.

◆ get_readings() [2/2]

virtual AttributeMap viam::sdk::PowerSensor::get_readings ( const AttributeMap & extra)
pure virtual

Returns the measurements/data specific to this sensor.

Parameters
extraAny additional arguments to the method.
Returns
The requested measurements/data specific to this sensor.

Implemented in viam::sdk::impl::PowerSensorClient, and viam::sdk::impl::PowerSensorClient.

◆ get_voltage() [1/2]

voltage viam::sdk::PowerSensor::get_voltage ( )
inline

Returns the voltage reading of this sensor.

Returns
The voltage reading of this sensor.

◆ get_voltage() [2/2]

virtual voltage viam::sdk::PowerSensor::get_voltage ( const AttributeMap & extra)
pure virtual

Returns the voltage reading of this sensor.

Parameters
extraAny additional arguments to this method.
Returns
The voltage reading of this sensor.

Implemented in viam::sdk::impl::PowerSensorClient, and viam::sdk::impl::PowerSensorClient.


The documentation for this class was generated from the following file: