YARP
Yet Another Robot Platform
IBattery.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_DEV_IBATTERY_H
10 #define YARP_DEV_IBATTERY_H
11 
12 #include <string>
13 
14 #include <yarp/os/Vocab.h>
15 #include <yarp/dev/api.h>
16 
19 
21 namespace yarp {
22  namespace dev {
23  class IBattery;
24  }
25 }
26 
33 {
34 public:
36  {
37  BATTERY_OK_STANBY = 0,
38  BATTERY_OK_IN_CHARGE = 1,
39  BATTERY_OK_IN_USE = 2,
40  BATTERY_GENERAL_ERROR = 3,
42  BATTERY_LOW_WARNING = 5,
43  BATTERY_CRITICAL_WARNING = 6
44  };
45 
46  virtual ~IBattery();
47 
53  virtual bool getBatteryVoltage(double &voltage) = 0;
54 
60  virtual bool getBatteryCurrent(double &current) = 0;
61 
67  virtual bool getBatteryCharge(double &charge) = 0;
68 
74  virtual bool getBatteryStatus(Battery_status &status) = 0;
75 
81  virtual bool getBatteryTemperature(double &temperature) = 0;
82 
88  virtual bool getBatteryInfo(std::string &battery_info) = 0;
89 };
90 
91 #endif // YARP_DEV_IBATTERY_H
yarp::dev::IBattery::Battery_status
Battery_status
Definition: IBattery.h:36
yarp::dev::IBattery::getBatteryInfo
virtual bool getBatteryInfo(std::string &battery_info)=0
get the battery hardware characteristics (e.g.
yarp::os::createVocab
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
yarp::dev::IBattery::getBatteryStatus
virtual bool getBatteryStatus(Battery_status &status)=0
get the battery status
yarp::dev::IBattery::getBatteryTemperature
virtual bool getBatteryTemperature(double &temperature)=0
get the battery temperature
VOCAB_BATTERY_INFO
constexpr yarp::conf::vocab32_t VOCAB_BATTERY_INFO
Definition: IBattery.h:18
BATTERY_TIMEOUT
const int BATTERY_TIMEOUT
Definition: BatteryClient.h:37
VOCAB_IBATTERY
constexpr yarp::conf::vocab32_t VOCAB_IBATTERY
Definition: IBattery.h:17
yarp::dev::IBattery::getBatteryCurrent
virtual bool getBatteryCurrent(double &current)=0
Get the instantaneous current measurement.
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::IBattery::getBatteryVoltage
virtual bool getBatteryVoltage(double &voltage)=0
Get the instantaneous voltage measurement.
yarp::dev::IBattery
A generic battery interface.
Definition: IBattery.h:33
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::conf::vocab32_t
std::int32_t vocab32_t
Definition: numeric.h:52
Vocab.h
yarp::dev::IBattery::~IBattery
virtual ~IBattery()
api.h
yarp::dev::IBattery::getBatteryCharge
virtual bool getBatteryCharge(double &charge)=0
get the battery status of charge