/usr/include/KF5/Solid/solid/battery.h is in libkf5solid-dev 5.28.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | /*
Copyright 2006-2007 Kevin Ottens <ervin@kde.org>
Copyright 2012 Lukas Tinkl <ltinkl@redhat.com>
Copyright 2014 Kai Uwe Broulik <kde@privat.broulik.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLID_BATTERY_H
#define SOLID_BATTERY_H
#include <solid/solid_export.h>
#include <solid/deviceinterface.h>
namespace Solid
{
class BatteryPrivate;
class Device;
/**
* This device interface is available on batteries.
*/
class SOLID_EXPORT Battery : public DeviceInterface
{
Q_OBJECT
Q_ENUMS(BatteryType ChargeState)
Q_PROPERTY(bool present READ isPresent NOTIFY presentStateChanged)
Q_PROPERTY(BatteryType type READ type CONSTANT)
Q_PROPERTY(int chargePercent READ chargePercent NOTIFY chargePercentChanged)
Q_PROPERTY(int capacity READ capacity NOTIFY capacityChanged)
Q_PROPERTY(bool rechargeable READ isRechargeable CONSTANT)
Q_PROPERTY(bool powerSupply READ isPowerSupply NOTIFY powerSupplyStateChanged)
Q_PROPERTY(ChargeState chargeState READ chargeState NOTIFY chargeStateChanged)
Q_PROPERTY(qlonglong timeToEmpty READ timeToEmpty NOTIFY timeToEmptyChanged)
Q_PROPERTY(qlonglong timeToFull READ timeToFull NOTIFY timeToFullChanged)
Q_PROPERTY(double energy READ energy NOTIFY energyChanged)
Q_PROPERTY(double energyFull READ energyFull NOTIFY energyFullChanged)
Q_PROPERTY(double energyFullDesign READ energyFullDesign NOTIFY energyFullDesignChanged)
Q_PROPERTY(double energyRate READ energyRate NOTIFY energyRateChanged)
Q_PROPERTY(double voltage READ voltage NOTIFY voltageChanged)
Q_PROPERTY(double temperature READ temperature NOTIFY temperatureChanged)
Q_PROPERTY(bool recalled READ isRecalled)
Q_PROPERTY(QString recallVendor READ recallVendor)
Q_PROPERTY(QString recallUrl READ recallUrl)
Q_PROPERTY(QString serial READ serial)
Q_PROPERTY(qlonglong remainingTime READ remainingTime NOTIFY remainingTimeChanged)
Q_DECLARE_PRIVATE(Battery)
friend class Device;
public:
/**
* This enum type defines the type of the device holding the battery
*
* - PdaBattery : A battery in a Personal Digital Assistant
* - UpsBattery : A battery in an Uninterruptible Power Supply
* - PrimaryBattery : A primary battery for the system (for example laptop battery)
* - MouseBattery : A battery in a mouse
* - KeyboardBattery : A battery in a keyboard
* - KeyboardMouseBattery : A battery in a combined keyboard and mouse
* - CameraBattery : A battery in a camera
* - PhoneBattery : A battery in a phone
* - MonitorBattery : A battery in a monitor
* - UnknownBattery : A battery in an unknown device
*/
enum BatteryType { UnknownBattery, PdaBattery, UpsBattery,
PrimaryBattery, MouseBattery, KeyboardBattery,
KeyboardMouseBattery, CameraBattery,
PhoneBattery, MonitorBattery
};
/**
* This enum type defines charge state of a battery
*
* - NoCharge : Battery charge is stable, not charging or discharging or
* the state is Unknown
* - Charging : Battery is charging
* - Discharging : Battery is discharging
* - FullyCharged: The battery is fully charged; a battery not neccessarily
* charges up to 100%
*/
enum ChargeState { NoCharge, Charging, Discharging, FullyCharged };
/**
* Technology used in the battery
*
* 0: Unknown
* 1: Lithium ion
* 2: Lithium polymer
* 3: Lithium iron phosphate
* 4: Lead acid
* 5: Nickel cadmium
* 6: Nickel metal hydride
*/
enum Technology { UnknownTechnology = 0, LithiumIon, LithiumPolymer, LithiumIronPhosphate,
LeadAcid, NickelCadmium, NickelMetalHydride
};
private:
/**
* Creates a new Battery object.
* You generally won't need this. It's created when necessary using
* Device::as().
*
* @param backendObject the device interface object provided by the backend
* @see Solid::Device::as()
*/
explicit Battery(QObject *backendObject);
public:
/**
* Destroys a Battery object.
*/
virtual ~Battery();
/**
* Get the Solid::DeviceInterface::Type of the Battery device interface.
*
* @return the Battery device interface type
* @see Solid::DeviceInterface::Type
*/
static Type deviceInterfaceType()
{
return DeviceInterface::Battery;
}
/**
* Indicates if this battery is currently present in its bay.
*
* @return true if the battery is present, false otherwise
*/
bool isPresent() const;
/**
* Indicates if this battery is currently present in its bay.
*
* @deprecated since Solid 5.0. Use isPresent instead.
*/
SOLID_DEPRECATED bool isPlugged() const { return isPresent(); }
/**
* Retrieves the type of device holding this battery.
*
* @return the type of device holding this battery
* @see Solid::Battery::BatteryType
*/
Solid::Battery::BatteryType type() const;
/**
* Retrieves the current charge level of the battery normalised
* to percent.
*
* @return the current charge level normalised to percent
*/
int chargePercent() const;
/**
* Retrieves the battery capacity normalised to percent,
* meaning how much energy can it hold compared to what it is designed to.
* The capacity of the battery will reduce with age.
* A capacity value less than 75% is usually a sign that you should renew your battery.
*
* @since 4.11
* @return the battery capacity normalised to percent
*/
int capacity() const;
/**
* Indicates if the battery is rechargeable.
*
* @return true if the battery is rechargeable, false otherwise (one time usage)
*/
bool isRechargeable() const;
/**
* Indicates if the battery is powering the machine.
*
* @return true if the battery is powersupply, false otherwise
*/
bool isPowerSupply() const;
/**
* Retrieves the current charge state of the battery. It can be in a stable
* state (no charge), charging or discharging.
*
* @return the current battery charge state
* @see Solid::Battery::ChargeState
*/
Solid::Battery::ChargeState chargeState() const;
/**
* Time (in seconds) until the battery is empty.
*
* @return time until the battery is empty
* @since 5.0
*/
qlonglong timeToEmpty() const;
/**
* Time (in seconds) until the battery is full.
*
* @return time until the battery is full
* @since 5.0
*/
qlonglong timeToFull() const;
/**
* Retrieves the technology used to manufacture the battery.
*
* @return the battery technology
* @see Solid::Battery::Technology
*/
Solid::Battery::Technology technology() const;
/**
* Amount of energy (measured in Wh) currently available in the power source.
*
* @return amount of battery energy in Wh
*/
double energy() const;
/**
* Amount of energy (measured in Wh) the battery has when it is full.
*
* @return amount of battery energy when full in Wh
* @since 5.7
*/
double energyFull() const;
/**
* Amount of energy (measured in Wh) the battery should have by design hen it is full.
*
* @return amount of battery energy when full by design in Wh
* @since 5.7
*/
double energyFullDesign() const;
/**
* Amount of energy being drained from the source, measured in W.
* If positive, the source is being discharged, if negative it's being charged.
*
* @return battery rate in Watts
*
*/
double energyRate() const;
/**
* Voltage in the Cell or being recorded by the meter.
*
* @return voltage in Volts
*/
double voltage() const;
/**
* The temperature of the battery in degrees Celsius.
*
* @return the battery temperature in degrees Celsius
* @since 5.0
*/
double temperature() const;
/**
* The battery may have been recalled by the vendor due to a suspected fault.
*
* @return true if the battery has been recalled, false otherwise
* @since 5.0
*/
bool isRecalled() const;
/**
* The vendor that has recalled the battery.
*
* @return the vendor name that has recalled the battery
* @since 5.0
*/
QString recallVendor() const;
/**
* The website URL of the vendor that has recalled the battery.
*
* @return the website URL of the vendor that has recalled the battery
* @since 5.0
*/
QString recallUrl() const;
/**
* The serial number of the battery
*
* @return the serial number of the battery
* @since 5.0
*/
QString serial() const;
/**
* Retrieves the current estimated remaining time of the system batteries
*
* @return the current global estimated remaining time in seconds
* @since 5.8
*/
qlonglong remainingTime() const;
Q_SIGNALS:
/**
* This signal is emitted if the battery gets plugged in/out of the
* battery bay.
*
* @param newState the new plugging state of the battery, type is boolean
* @param udi the UDI of the battery with thew new plugging state
*/
void presentStateChanged(bool newState, const QString &udi);
/**
* This signal is emitted when the charge percent value of this
* battery has changed.
*
* @param value the new charge percent value of the battery
* @param udi the UDI of the battery with the new charge percent
*/
void chargePercentChanged(int value, const QString &udi);
/**
* This signal is emitted when the capacity of this battery has changed.
*
* @param value the new capacity of the battery
* @param udi the UDI of the battery with the new capacity
* @since 4.11
*/
void capacityChanged(int value, const QString &udi);
/**
* This signal is emitted when the power supply state of the battery
* changes.
*
* @param newState the new power supply state, type is boolean
* @param udi the UDI of the battery with the new power supply state
* @since 4.11
*/
void powerSupplyStateChanged(bool newState, const QString &udi);
/**
* This signal is emitted when the charge state of this battery
* has changed.
*
* @param newState the new charge state of the battery, it's one of
* the type Solid::Battery::ChargeState
* @see Solid::Battery::ChargeState
* @param udi the UDI of the battery with the new charge state
*/
void chargeStateChanged(int newState, const QString &udi = QString());
/**
* This signal is emitted when the time until the battery is empty
* has changed.
*
* @param time the new remaining time
* @param udi the UDI of the battery with the new remaining time
* @since 5.0
*/
void timeToEmptyChanged(qlonglong time, const QString &udi);
/**
* This signal is emitted when the time until the battery is full
* has changed.
*
* @param time the new remaining time
* @param udi the UDI of the battery with the new remaining time
* @since 5.0
*/
void timeToFullChanged(qlonglong time, const QString &udi);
/**
* This signal is emitted when the energy value of this
* battery has changed.
*
* @param energy the new energy value of the battery
* @param udi the UDI of the battery with the new energy value
*/
void energyChanged(double energy, const QString &udi);
/**
* This signal is emitted when the energy full value of this
* battery has changed.
*
* @param energy the new energy full value of the battery
* @param udi the UDI of the battery with the new energy full value
*/
void energyFullChanged(double energy, const QString &udi);
/**
* This signal is emitted when the energy full design value of this
* battery has changed.
*
* @param energy the new energy full design value of the battery
* @param udi the UDI of the battery with the new energy full design value
*/
void energyFullDesignChanged(double energy, const QString &udi);
/**
* This signal is emitted when the energy rate value of this
* battery has changed.
*
* If positive, the source is being discharged, if negative it's being charged.
*
* @param energyRate the new energy rate value of the battery
* @param udi the UDI of the battery with the new charge percent
*/
void energyRateChanged(double energyRate, const QString &udi);
/**
* This signal is emitted when the voltage in the cell has changed.
*
* @param voltage the new voltage of the cell
* @param udi the UDI of the battery with the new voltage
* @since 5.0
*/
void voltageChanged(double voltage, const QString &udi);
/**
* This signal is emitted when the battery temperature has changed.
*
* @param temperature the new temperature of the battery in degrees Celsius
* @param udi the UDI of the battery with the new temperature
* @since 5.0
*/
void temperatureChanged(double temperature, const QString &udi);
/**
* This signal is emitted when the estimated battery remaining time changes.
*
* @param time the new remaining time
* @param udi the UDI of the battery with the new remaining time
* @since 5.8
*/
void remainingTimeChanged(qlonglong time, const QString &udi);
};
}
#endif
|