YARP
Yet Another Robot Platform

batteryClient: The client side of any IBattery capable device. More...

#include <batteryClient/BatteryClient.h>

+ Inheritance diagram for BatteryClient:

Public Member Functions

bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver. More...
 
bool close () override
 Close the DeviceDriver. More...
 
yarp::os::Stamp getLastInputStamp () override
 Get the time stamp for the last read data. More...
 
bool getBatteryVoltage (double &voltage) override
 Get the instantaneous voltage measurement. More...
 
bool getBatteryCurrent (double &current) override
 Get the instantaneous current measurement. More...
 
bool getBatteryCharge (double &charge) override
 get the battery status of charge More...
 
bool getBatteryStatus (Battery_status &status) override
 get the battery status More...
 
bool getBatteryInfo (std::string &battery_info) override
 get the battery hardware charactestics (e.g. More...
 
bool getBatteryTemperature (double &temperature) override
 get the battery temperature More...
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 DeviceDriver ()
 
 DeviceDriver (const DeviceDriver &other)=delete
 
 DeviceDriver (DeviceDriver &&other) noexcept=delete
 
DeviceDriveroperator= (const DeviceDriver &other)=delete
 
DeviceDriveroperator= (DeviceDriver &&other) noexcept=delete
 
 ~DeviceDriver () override
 
bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver. More...
 
bool close () override
 Close the DeviceDriver. More...
 
virtual std::string id () const
 Return the id assigned to the PolyDriver. More...
 
virtual void setId (const std::string &id)
 Set the id for this device. More...
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver. More...
 
virtual DeviceDrivergetImplementation ()
 Some drivers are bureaucrats, pointing at others. More...
 
- Public Member Functions inherited from yarp::os::IConfig
virtual ~IConfig ()
 Destructor. More...
 
virtual bool open (Searchable &config)
 Initialize the object. More...
 
virtual bool close ()
 Shut the object down. More...
 
virtual bool configure (Searchable &config)
 Change online parameters. More...
 
- Public Member Functions inherited from yarp::dev::IPreciselyTimed
virtual ~IPreciselyTimed ()
 
virtual yarp::os::Stamp getLastInputStamp ()=0
 Return the time stamp relative to the last acquisition. More...
 
- Public Member Functions inherited from yarp::dev::IBattery
virtual ~IBattery ()
 
virtual bool getBatteryVoltage (double &voltage)=0
 Get the instantaneous voltage measurement. More...
 
virtual bool getBatteryCurrent (double &current)=0
 Get the instantaneous current measurement. More...
 
virtual bool getBatteryCharge (double &charge)=0
 get the battery status of charge More...
 
virtual bool getBatteryStatus (Battery_status &status)=0
 get the battery status More...
 
virtual bool getBatteryTemperature (double &temperature)=0
 get the battery temperature More...
 
virtual bool getBatteryInfo (std::string &battery_info)=0
 get the battery hardware characteristics (e.g. More...
 

Protected Attributes

BatteryInputPortProcessor inputPort
 
yarp::os::Port rpcPort
 
std::string local
 
std::string remote
 
std::string m_carrier
 
yarp::os::Stamp lastTs
 
std::string deviceId
 

Additional Inherited Members

- Public Types inherited from yarp::dev::IBattery
enum  Battery_status {
  BATTERY_OK_STANBY = 0 ,
  BATTERY_OK_IN_CHARGE = 1 ,
  BATTERY_OK_IN_USE = 2 ,
  BATTERY_GENERAL_ERROR = 3 ,
  BATTERY_TIMEOUT = 4 ,
  BATTERY_LOW_WARNING = 5 ,
  BATTERY_CRITICAL_WARNING = 6
}
 

Detailed Description

batteryClient: The client side of any IBattery capable device.

Still single thread! concurrent access is unsafe.

Parameters required by this device are:

Parameter name SubParameter Type Units Default Value Required Description Notes
local - string - - Yes Full port name opened by the batteryClient device.
remote - string - - Yes Full port name of the port opened on the server side, to which the batteryClient connects to.
carrier - string - tcp No The carier used for the connection with the server.

Definition at line 79 of file BatteryClient.h.

Member Function Documentation

◆ close()

bool BatteryClient::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 234 of file BatteryClient.cpp.

◆ getBatteryCharge()

bool BatteryClient::getBatteryCharge ( double &  charge)
overridevirtual

get the battery status of charge

Parameters
chargethe charge measurement (0-100%)
Returns
true/false.

Implements yarp::dev::IBattery.

Definition at line 253 of file BatteryClient.cpp.

◆ getBatteryCurrent()

bool BatteryClient::getBatteryCurrent ( double &  current)
overridevirtual

Get the instantaneous current measurement.

Parameters
currentthe current measurement
Returns
true/false.

Implements yarp::dev::IBattery.

Definition at line 247 of file BatteryClient.cpp.

◆ getBatteryInfo()

bool BatteryClient::getBatteryInfo ( std::string &  battery_info)
overridevirtual

get the battery hardware charactestics (e.g.

max voltage etc)

Parameters
astring containing the battery infos
Returns
true/false.

Implements yarp::dev::IBattery.

Definition at line 271 of file BatteryClient.cpp.

◆ getBatteryStatus()

bool BatteryClient::getBatteryStatus ( Battery_status status)
overridevirtual

get the battery status

Parameters
statusthe battery status
Returns
true/false.

Implements yarp::dev::IBattery.

Definition at line 259 of file BatteryClient.cpp.

◆ getBatteryTemperature()

bool BatteryClient::getBatteryTemperature ( double &  temperature)
overridevirtual

get the battery temperature

Parameters
tempraturethe battery temperature
Returns
true/false.

Implements yarp::dev::IBattery.

Definition at line 265 of file BatteryClient.cpp.

◆ getBatteryVoltage()

bool BatteryClient::getBatteryVoltage ( double &  voltage)
overridevirtual

Get the instantaneous voltage measurement.

Parameters
voltagethe voltage measurement
Returns
true/false.

Implements yarp::dev::IBattery.

Definition at line 241 of file BatteryClient.cpp.

◆ getLastInputStamp()

Stamp BatteryClient::getLastInputStamp ( )
overridevirtual

Get the time stamp for the last read data.

Returns
last time stamp.

Implements yarp::dev::IPreciselyTimed.

Definition at line 285 of file BatteryClient.cpp.

◆ open()

bool BatteryClient::open ( yarp::os::Searchable config)
overridevirtual

Open the DeviceDriver.

Parameters
configis a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 175 of file BatteryClient.cpp.

Member Data Documentation

◆ deviceId

std::string BatteryClient::deviceId
protected

Definition at line 91 of file BatteryClient.h.

◆ inputPort

BatteryInputPortProcessor BatteryClient::inputPort
protected

Definition at line 85 of file BatteryClient.h.

◆ lastTs

yarp::os::Stamp BatteryClient::lastTs
protected

Definition at line 90 of file BatteryClient.h.

◆ local

std::string BatteryClient::local
protected

Definition at line 87 of file BatteryClient.h.

◆ m_carrier

std::string BatteryClient::m_carrier
protected

Definition at line 89 of file BatteryClient.h.

◆ remote

std::string BatteryClient::remote
protected

Definition at line 88 of file BatteryClient.h.

◆ rpcPort

yarp::os::Port BatteryClient::rpcPort
protected

Definition at line 86 of file BatteryClient.h.


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