YARP
Yet Another Robot Platform
upowerBattery.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_UPOWERBATTERY_H
7 #define YARP_UPOWERBATTERY_H
8 
9 #include <yarp/dev/IBattery.h>
10 #include <yarp/dev/PolyDriver.h>
11 
12 #include <QDBusInterface>
13 
24  public yarp::dev::IBattery
25 {
26 public:
27  UpowerBattery() = default;
28  UpowerBattery(const UpowerBattery&) = delete;
32 
33  ~UpowerBattery() override = default;
34 
35  bool open(yarp::os::Searchable& config) override;
36  bool close() override;
37 
38  bool getBatteryVoltage(double& voltage) override;
39  bool getBatteryCurrent(double& current) override;
40  bool getBatteryCharge(double& charge) override;
41  bool getBatteryStatus(Battery_status& status) override;
42  bool getBatteryInfo(std::string& info) override;
43  bool getBatteryTemperature(double& temperature) override;
44 
45 private:
46  QDBusInterface *m_interface { nullptr };
47 };
48 
49 #endif
upowerBattery: A device to view the battery of a linux laptop in YARP using the yarp::dev::IBattery i...
Definition: upowerBattery.h:25
bool getBatteryCurrent(double &current) override
Get the instantaneous current measurement.
UpowerBattery & operator=(const UpowerBattery &)=delete
bool getBatteryStatus(Battery_status &status) override
get the battery status
UpowerBattery(const UpowerBattery &)=delete
UpowerBattery(UpowerBattery &&)=delete
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool close() override
Close the DeviceDriver.
~UpowerBattery() override=default
bool getBatteryTemperature(double &temperature) override
get the battery temperature
bool getBatteryCharge(double &charge) override
get the battery status of charge
bool getBatteryVoltage(double &voltage) override
Get the instantaneous voltage measurement.
bool getBatteryInfo(std::string &info) override
get the battery hardware characteristics (e.g.
UpowerBattery()=default
UpowerBattery & operator=(UpowerBattery &&)=delete
Interface implemented by all device drivers.
Definition: DeviceDriver.h:30
A generic battery interface.
Definition: IBattery.h:28
A base class for nested structures that can be searched.
Definition: Searchable.h:63