Solid::Battery

#include <battery.h>

Inheritance diagram for Solid::Battery:

Public Types

enum  BatteryType {
  UnknownBattery, PdaBattery, UpsBattery, PrimaryBattery,
  MouseBattery, KeyboardBattery, KeyboardMouseBattery, CameraBattery,
  PhoneBattery, MonitorBattery, GamingInputBattery, BluetoothBattery
}
 
enum  ChargeState { NoCharge, Charging, Discharging, FullyCharged }
 
enum  Technology {
  UnknownTechnology = 0, LithiumIon, LithiumPolymer, LithiumIronPhosphate,
  LeadAcid, NickelCadmium, NickelMetalHydride
}
 
- Public Types inherited from Solid::DeviceInterface
enum  Type {
  Unknown = 0, GenericInterface = 1, Processor = 2, Block = 3,
  StorageAccess = 4, StorageDrive = 5, OpticalDrive = 6, StorageVolume = 7,
  OpticalDisc = 8, Camera = 9, PortableMediaPlayer = 10, Battery = 12,
  NetworkShare = 14, Last = 0xffff
}
 

Properties

int capacity
 
int chargePercent
 
ChargeState chargeState
 
double energy
 
double energyFull
 
double energyFullDesign
 
double energyRate
 
bool powerSupply
 
bool present
 
bool recalled
 
QString recallUrl
 
QString recallVendor
 
bool rechargeable
 
qlonglong remainingTime
 
QString serial
 
Technology technology
 
double temperature
 
qlonglong timeToEmpty
 
qlonglong timeToFull
 
BatteryType type
 
double voltage
 
- Properties inherited from QObject
 objectName
 

Signals

void capacityChanged (int value, const QString &udi)
 
void chargePercentChanged (int value, const QString &udi)
 
void chargeStateChanged (int newState, const QString &udi=QString())
 
void energyChanged (double energy, const QString &udi)
 
void energyFullChanged (double energy, const QString &udi)
 
void energyFullDesignChanged (double energy, const QString &udi)
 
void energyRateChanged (double energyRate, const QString &udi)
 
void powerSupplyStateChanged (bool newState, const QString &udi)
 
void presentStateChanged (bool newState, const QString &udi)
 
void remainingTimeChanged (qlonglong time, const QString &udi)
 
void temperatureChanged (double temperature, const QString &udi)
 
void timeToEmptyChanged (qlonglong time, const QString &udi)
 
void timeToFullChanged (qlonglong time, const QString &udi)
 
void voltageChanged (double voltage, const QString &udi)
 

Public Member Functions

virtual ~Battery ()
 
int capacity () const
 
int chargePercent () const
 
Solid::Battery::ChargeState chargeState () const
 
double energy () const
 
double energyFull () const
 
double energyFullDesign () const
 
double energyRate () const
 
bool isPlugged () const
 
bool isPowerSupply () const
 
bool isPresent () const
 
bool isRecalled () const
 
bool isRechargeable () const
 
QString recallUrl () const
 
QString recallVendor () const
 
qlonglong remainingTime () const
 
QString serial () const
 
Solid::Battery::Technology technology () const
 
double temperature () const
 
qlonglong timeToEmpty () const
 
qlonglong timeToFull () const
 
Solid::Battery::BatteryType type () const
 
double voltage () const
 
- Public Member Functions inherited from Solid::DeviceInterface
virtual ~DeviceInterface ()
 
bool isValid () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static Type deviceInterfaceType ()
 
- Static Public Member Functions inherited from Solid::DeviceInterface
static Type stringToType (const QString &type)
 
static QString typeDescription (Type type)
 
static QString typeToString (Type type)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from Solid::DeviceInterface
 DeviceInterface (DeviceInterfacePrivate &dd, QObject *backendObject)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Attributes inherited from Solid::DeviceInterface
DeviceInterfacePrivate * d_ptr
 

Detailed Description

This device interface is available on batteries.

Definition at line 24 of file frontend/battery.h.

Member Enumeration Documentation

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
  • GamingInputBattery : A battery in a gaming input device (for example a wireless game pad)
  • BluetoothBattery: A generic Bluetooth device battery (if its type isn't known, a Bluetooth mouse would normally show up as a MouseBattery),
    Since
    5.54
  • UnknownBattery : A battery in an unknown device

Definition at line 69 of file frontend/battery.h.

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 necessarily charges up to 100%

Definition at line 87 of file frontend/battery.h.

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

Definition at line 101 of file frontend/battery.h.

Constructor & Destructor Documentation

Solid::Battery::~Battery ( )
virtual

Destroys a Battery object.

Definition at line 61 of file frontend/battery.cpp.

Member Function Documentation

int Solid::Battery::capacity ( ) 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
Returns
the battery capacity normalised to percent
void Solid::Battery::capacityChanged ( int  value,
const QString udi 
)
signal

This signal is emitted when the capacity of this battery has changed.

Parameters
valuethe new capacity of the battery
udithe UDI of the battery with the new capacity
Since
4.11
int Solid::Battery::chargePercent ( ) const

Retrieves the current charge level of the battery normalised to percent.

Returns
the current charge level normalised to percent
void Solid::Battery::chargePercentChanged ( int  value,
const QString udi 
)
signal

This signal is emitted when the charge percent value of this battery has changed.

Parameters
valuethe new charge percent value of the battery
udithe UDI of the battery with the new charge percent
Solid::Battery::ChargeState Solid::Battery::chargeState ( ) const

Retrieves the current charge state of the battery.

It can be in a stable state (no charge), charging or discharging.

Returns
the current battery charge state
See also
Solid::Battery::ChargeState
void Solid::Battery::chargeStateChanged ( int  newState,
const QString udi = QString() 
)
signal

This signal is emitted when the charge state of this battery has changed.

Parameters
newStatethe new charge state of the battery, it's one of the type Solid::Battery::ChargeState
See also
Solid::Battery::ChargeState
Parameters
udithe UDI of the battery with the new charge state
static Type Solid::Battery::deviceInterfaceType ( )
inlinestatic

Get the Solid::DeviceInterface::Type of the Battery device interface.

Returns
the Battery device interface type
See also
Solid::DeviceInterface::Type

Definition at line 129 of file frontend/battery.h.

double Solid::Battery::energy ( ) const

Amount of energy (measured in Wh) currently available in the power source.

Returns
amount of battery energy in Wh
void Solid::Battery::energyChanged ( double  energy,
const QString udi 
)
signal

This signal is emitted when the energy value of this battery has changed.

Parameters
energythe new energy value of the battery
udithe UDI of the battery with the new energy value
double Solid::Battery::energyFull ( ) const

Amount of energy (measured in Wh) the battery has when it is full.

Returns
amount of battery energy when full in Wh
Since
5.7
void Solid::Battery::energyFullChanged ( double  energy,
const QString udi 
)
signal

This signal is emitted when the energy full value of this battery has changed.

Parameters
energythe new energy full value of the battery
udithe UDI of the battery with the new energy full value
double Solid::Battery::energyFullDesign ( ) const

Amount of energy (measured in Wh) the battery should have by design hen it is full.

Returns
amount of battery energy when full by design in Wh
Since
5.7
void Solid::Battery::energyFullDesignChanged ( double  energy,
const QString udi 
)
signal

This signal is emitted when the energy full design value of this battery has changed.

Parameters
energythe new energy full design value of the battery
udithe UDI of the battery with the new energy full design value
double Solid::Battery::energyRate ( ) 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.

Returns
battery rate in Watts
void Solid::Battery::energyRateChanged ( double  energyRate,
const QString udi 
)
signal

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.

Parameters
energyRatethe new energy rate value of the battery
udithe UDI of the battery with the new charge percent
bool Solid::Battery::isPlugged ( ) const
inline

Indicates if this battery is currently present in its bay.

Deprecated:
since Solid 5.0. Use isPresent instead.

Definition at line 148 of file frontend/battery.h.

bool Solid::Battery::isPowerSupply ( ) const

Indicates if the battery is powering the machine.

Returns
true if the battery is powersupply, false otherwise

Definition at line 96 of file frontend/battery.cpp.

bool Solid::Battery::isPresent ( ) const

Indicates if this battery is currently present in its bay.

Returns
true if the battery is present, false otherwise

Definition at line 66 of file frontend/battery.cpp.

bool Solid::Battery::isRecalled ( ) const

The battery may have been recalled by the vendor due to a suspected fault.

Returns
true if the battery has been recalled, false otherwise
Since
5.0

Definition at line 162 of file frontend/battery.cpp.

bool Solid::Battery::isRechargeable ( ) const

Indicates if the battery is rechargeable.

Returns
true if the battery is rechargeable, false otherwise (one time usage)

Definition at line 90 of file frontend/battery.cpp.

void Solid::Battery::powerSupplyStateChanged ( bool  newState,
const QString udi 
)
signal

This signal is emitted when the power supply state of the battery changes.

Parameters
newStatethe new power supply state, type is boolean
udithe UDI of the battery with the new power supply state
Since
4.11
void Solid::Battery::presentStateChanged ( bool  newState,
const QString udi 
)
signal

This signal is emitted if the battery gets plugged in/out of the battery bay.

Parameters
newStatethe new plugging state of the battery, type is boolean
udithe UDI of the battery with thew new plugging state
QString Solid::Battery::recallUrl ( ) const

The website URL of the vendor that has recalled the battery.

Returns
the website URL of the vendor that has recalled the battery
Since
5.0
QString Solid::Battery::recallVendor ( ) const

The vendor that has recalled the battery.

Returns
the vendor name that has recalled the battery
Since
5.0
qlonglong Solid::Battery::remainingTime ( ) const

Retrieves the current estimated remaining time of the system batteries.

Returns
the current global estimated remaining time in seconds
Since
5.8
void Solid::Battery::remainingTimeChanged ( qlonglong  time,
const QString udi 
)
signal

This signal is emitted when the estimated battery remaining time changes.

Parameters
timethe new remaining time
udithe UDI of the battery with the new remaining time
Since
5.8
QString Solid::Battery::serial ( ) const

The serial number of the battery.

Returns
the serial number of the battery
Since
5.0
Solid::Battery::Technology Solid::Battery::technology ( ) const

Retrieves the technology used to manufacture the battery.

Returns
the battery technology
See also
Solid::Battery::Technology
double Solid::Battery::temperature ( ) const

The temperature of the battery in degrees Celsius.

Returns
the battery temperature in degrees Celsius
Since
5.0
void Solid::Battery::temperatureChanged ( double  temperature,
const QString udi 
)
signal

This signal is emitted when the battery temperature has changed.

Parameters
temperaturethe new temperature of the battery in degrees Celsius
udithe UDI of the battery with the new temperature
Since
5.0
qlonglong Solid::Battery::timeToEmpty ( ) const

Time (in seconds) until the battery is empty.

Returns
time until the battery is empty
Since
5.0
void Solid::Battery::timeToEmptyChanged ( qlonglong  time,
const QString udi 
)
signal

This signal is emitted when the time until the battery is empty has changed.

Parameters
timethe new remaining time
udithe UDI of the battery with the new remaining time
Since
5.0
qlonglong Solid::Battery::timeToFull ( ) const

Time (in seconds) until the battery is full.

Returns
time until the battery is full
Since
5.0
void Solid::Battery::timeToFullChanged ( qlonglong  time,
const QString udi 
)
signal

This signal is emitted when the time until the battery is full has changed.

Parameters
timethe new remaining time
udithe UDI of the battery with the new remaining time
Since
5.0
Solid::Battery::BatteryType Solid::Battery::type ( ) const

Retrieves the type of device holding this battery.

Returns
the type of device holding this battery
See also
Solid::Battery::BatteryType
double Solid::Battery::voltage ( ) const

Voltage in the Cell or being recorded by the meter.

Returns
voltage in Volts
void Solid::Battery::voltageChanged ( double  voltage,
const QString udi 
)
signal

This signal is emitted when the voltage in the cell has changed.

Parameters
voltagethe new voltage of the cell
udithe UDI of the battery with the new voltage
Since
5.0

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 4 2020 22:49:00 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.