17#include <QDBusInterface>
31 std::string
device_path = config.check(
"device_path",
32 Value(
"/org/freedesktop/UPower/devices/battery_BAT0"),
33 "Battery device path (as returned by 'upower -e', for example '/org/freedesktop/UPower/devices/battery_BAT0')").asString();
36 if (!m_interface->isValid()) {
53 voltage = m_interface->property(
"Voltage").toDouble();
59 auto energyrate = m_interface->property(
"EnergyRate").toDouble();
60 auto voltage = m_interface->property(
"Voltage").toDouble();
61 auto state = m_interface->property(
"State").toUInt();
63 if (current > 0 && state == 1 ) {
71 charge = m_interface->property(
"Percentage").toInt();
78 auto st = m_interface->property(
"State").toUInt();
79 auto wl = m_interface->property(
"WarningLevel").toUInt();
122 temperature = m_interface->property(
"Temperature").toDouble();
129 .arg(m_interface->property(
"Vendor").toString())
130 .arg(m_interface->property(
"Model").toString())
131 .arg(m_interface->property(
"Serial").toString())
upowerBattery: A device to view the battery of a linux laptop in YARP using the yarp::dev::IBattery i...
yarp::dev::ReturnValue getBatteryCurrent(double ¤t) override
Get the instantaneous current measurement.
yarp::dev::ReturnValue getBatteryInfo(std::string &info) override
get the battery hardware characteristics (e.g.
yarp::dev::ReturnValue getBatteryTemperature(double &temperature) override
get the battery temperature
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue getBatteryStatus(Battery_status &status) override
get the battery status
yarp::dev::ReturnValue getBatteryCharge(double &charge) override
get the battery status of charge
yarp::dev::ReturnValue getBatteryVoltage(double &voltage) override
Get the instantaneous voltage measurement.
@ BATTERY_CRITICAL_WARNING
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
A single value (typically within a Bottle).
#define yCError(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.