Solid::Battery

Search for usage in LXR

#include <battery.h>

Inheritance diagram for Solid::Battery:

Public Types

enum  BatteryType {
  UnknownBattery , PdaBattery , UpsBattery , PrimaryBattery ,
  MouseBattery , KeyboardBattery , KeyboardMouseBattery , CameraBattery ,
  PhoneBattery , MonitorBattery , GamingInputBattery , BluetoothBattery ,
  TabletBattery , HeadphoneBattery , HeadsetBattery , TouchpadBattery
}
 
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 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

 ~Battery () override
 
int capacity () const
 
int chargePercent () const
 
Solid::Battery::ChargeState chargeState () const
 
double energy () const
 
double energyFull () const
 
double energyFullDesign () const
 
double energyRate () const
 
bool isPowerSupply () const
 
bool isPresent () const
 
bool isRechargeable () 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
 ~DeviceInterface () override
 
bool isValid () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
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 () const const
 
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 QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
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_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 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
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, 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 *context, Functor functor, 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)
 
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, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (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
SOLID_NO_EXPORT 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

◆ BatteryType

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
  • TabletBattery : A battery in a graphics tablet or pen,
    Since
    5.88
  • HeadphoneBattery : A battery in a headphone,
    Since
    6.0
  • HeadsetBattery : A battery in a headset,
    Since
    6.0
  • TouchpadBattery : A battery in a touchpad. This is how the Dualsense Wireless Controller is categorized
    Since
    6.0
  • UnknownBattery : A battery in an unknown device

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

◆ ChargeState

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 100 of file frontend/battery.h.

◆ Technology

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 114 of file frontend/battery.h.

Property Documentation

◆ capacity

int Solid::Battery::capacity
read

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

◆ chargePercent

int Solid::Battery::chargePercent
read

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

◆ chargeState

ChargeState Solid::Battery::chargeState
read

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

◆ energy

double Solid::Battery::energy
read

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

◆ energyFull

double Solid::Battery::energyFull
read

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

◆ energyFullDesign

double Solid::Battery::energyFullDesign
read

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

◆ energyRate

double Solid::Battery::energyRate
read

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

◆ powerSupply

bool Solid::Battery::powerSupply
read

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

◆ present

bool Solid::Battery::present
read

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

◆ rechargeable

bool Solid::Battery::rechargeable
read

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

◆ remainingTime

qlonglong Solid::Battery::remainingTime
read

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

◆ serial

QString Solid::Battery::serial
read

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

◆ technology

Technology Solid::Battery::technology
read

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

◆ temperature

double Solid::Battery::temperature
read

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

◆ timeToEmpty

qlonglong Solid::Battery::timeToEmpty
read

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

◆ timeToFull

qlonglong Solid::Battery::timeToFull
read

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

◆ type

BatteryType Solid::Battery::type
read

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

◆ voltage

double Solid::Battery::voltage
read

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

Constructor & Destructor Documentation

◆ ~Battery()

Solid::Battery::~Battery ( )
override

Destroys a Battery object.

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

Member Function Documentation

◆ capacity()

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

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

◆ capacityChanged

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

◆ chargePercent()

int Solid::Battery::chargePercent ( ) const

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

Returns
the current charge level normalised to percent

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

◆ chargePercentChanged

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

◆ chargeState()

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

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

◆ chargeStateChanged

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

◆ deviceInterfaceType()

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 148 of file frontend/battery.h.

◆ energy()

double Solid::Battery::energy ( ) const

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

Returns
amount of battery energy in Wh

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

◆ energyChanged

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

◆ energyFull()

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

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

◆ energyFullChanged

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

◆ energyFullDesign()

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

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

◆ energyFullDesignChanged

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

◆ energyRate()

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

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

◆ energyRateChanged

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

◆ isPowerSupply()

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 81 of file frontend/battery.cpp.

◆ isPresent()

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 51 of file frontend/battery.cpp.

◆ isRechargeable()

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 75 of file frontend/battery.cpp.

◆ powerSupplyStateChanged

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

◆ presentStateChanged

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

◆ remainingTime()

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

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

◆ remainingTimeChanged

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

◆ serial()

QString Solid::Battery::serial ( ) const

The serial number of the battery.

Returns
the serial number of the battery
Since
5.0

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

◆ technology()

Solid::Battery::Technology Solid::Battery::technology ( ) const

Retrieves the technology used to manufacture the battery.

Returns
the battery technology
See also
Solid::Battery::Technology

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

◆ temperature()

double Solid::Battery::temperature ( ) const

The temperature of the battery in degrees Celsius.

Returns
the battery temperature in degrees Celsius
Since
5.0

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

◆ temperatureChanged

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

◆ timeToEmpty()

qlonglong Solid::Battery::timeToEmpty ( ) const

Time (in seconds) until the battery is empty.

Returns
time until the battery is empty
Since
5.0

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

◆ timeToEmptyChanged

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

◆ timeToFull()

qlonglong Solid::Battery::timeToFull ( ) const

Time (in seconds) until the battery is full.

Returns
time until the battery is full
Since
5.0

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

◆ timeToFullChanged

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

◆ type()

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

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

◆ voltage()

double Solid::Battery::voltage ( ) const

Voltage in the Cell or being recorded by the meter.

Returns
voltage in Volts

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

◆ voltageChanged

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-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.