NDEVR
API Documentation
BatteryCapacityInfo

For a given BatteryCapacityType, the limits that define the state of the battery. More...

Public Member Functions

bool canChangeBatteryState () const
 Checks whether this capacity info has enough valid data to determine battery state.
void fromJSONNode (const JSONNode &node)
 Deserializes capacity info from a JSON node.
bool operator!= (const BatteryCapacityInfo &info) const
 Inequality comparison operator.
fltp04 percent () const
 Computes the capacity as a percentage of the maximum level.
void toJSONNode (JSONNode &node) const
 Serializes this capacity info into a JSON node.

Public Attributes

fltp04 critical_level = Constant<fltp04>::Invalid
 The threshold at which the battery state becomes critical.
fltp04 current_level = Constant<fltp04>::Invalid
 The current capacity level.
fltp04 discharge_rate = Constant<fltp04>::Invalid
 The rate at which capacity is being consumed.
fltp04 max_level = Constant<fltp04>::Invalid
 The maximum capacity level when fully charged.
fltp04 shutdown_level = Constant<fltp04>::Invalid
 The threshold at or below which the device should shut down.
fltp04 warning_level = Constant<fltp04>::Invalid
 The threshold at which a low-battery warning is issued.

Detailed Description

For a given BatteryCapacityType, the limits that define the state of the battery.


Definition at line 63 of file Battery.h.

Member Function Documentation

◆ canChangeBatteryState()

bool BatteryCapacityInfo::canChangeBatteryState ( ) const

Checks whether this capacity info has enough valid data to determine battery state.

Returns
True if battery state transitions can be computed from the current values.

◆ fromJSONNode()

void BatteryCapacityInfo::fromJSONNode ( const JSONNode & node)

Deserializes capacity info from a JSON node.

Parameters
[in]nodeThe JSON node to read from.

◆ operator!=()

bool BatteryCapacityInfo::operator!= ( const BatteryCapacityInfo & info) const

Inequality comparison operator.

Parameters
[in]infoThe other BatteryCapacityInfo to compare against.
Returns
True if any field differs from info.

◆ percent()

fltp04 BatteryCapacityInfo::percent ( ) const

Computes the capacity as a percentage of the maximum level.

Returns
The current level divided by the max level, as a value between 0 and 1.

◆ toJSONNode()

void BatteryCapacityInfo::toJSONNode ( JSONNode & node) const

Serializes this capacity info into a JSON node.

Parameters
[in]nodeThe JSON node to populate.

The documentation for this struct was generated from the following file: