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