YARP
Yet Another Robot Platform
IBattery.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_DEV_IBATTERY_H
7 #define YARP_DEV_IBATTERY_H
8 
9 #include <string>
10 
11 #include <yarp/os/Vocab.h>
12 #include <yarp/dev/api.h>
13 
16 
18 namespace yarp {
19  namespace dev {
20  class IBattery;
21  }
22 }
23 
30 {
31 public:
33  {
34  BATTERY_OK_STANBY = 0,
35  BATTERY_OK_IN_CHARGE = 1,
36  BATTERY_OK_IN_USE = 2,
37  BATTERY_GENERAL_ERROR = 3,
39  BATTERY_LOW_WARNING = 5,
40  BATTERY_CRITICAL_WARNING = 6
41  };
42 
43  virtual ~IBattery();
44 
50  virtual bool getBatteryVoltage(double &voltage) = 0;
51 
57  virtual bool getBatteryCurrent(double &current) = 0;
58 
64  virtual bool getBatteryCharge(double &charge) = 0;
65 
71  virtual bool getBatteryStatus(Battery_status &status) = 0;
72 
78  virtual bool getBatteryTemperature(double &temperature) = 0;
79 
85  virtual bool getBatteryInfo(std::string &battery_info) = 0;
86 };
87 
88 #endif // YARP_DEV_IBATTERY_H
const int BATTERY_TIMEOUT
Definition: BatteryClient.h:24
constexpr yarp::conf::vocab32_t VOCAB_IBATTERY
Definition: IBattery.h:14
constexpr yarp::conf::vocab32_t VOCAB_BATTERY_INFO
Definition: IBattery.h:15
A generic battery interface.
Definition: IBattery.h:30
virtual bool getBatteryCurrent(double &current)=0
Get the instantaneous current measurement.
virtual bool getBatteryVoltage(double &voltage)=0
Get the instantaneous voltage measurement.
virtual bool getBatteryInfo(std::string &battery_info)=0
get the battery hardware characteristics (e.g.
virtual bool getBatteryStatus(Battery_status &status)=0
get the battery status
virtual bool getBatteryCharge(double &charge)=0
get the battery status of charge
virtual bool getBatteryTemperature(double &temperature)=0
get the battery temperature
std::int32_t vocab32_t
Definition: numeric.h:78
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.
Definition: Vocab.h:28
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18