BatteryStatus Class

The state of the battery of the device (https://w3c.github.io/battery/#the-batterymanager-interface), returned by a BatteryStatusProvider.

public sealed class BatteryStatus : IEquatable<BatteryStatus>
Implements

Constructors

NameDescription
BatteryStatus()

BatteryStatus()

BatteryStatus.cs
public BatteryStatus()

No documentation is available.

Properties

NameDescription
ChargingGets whether the battery is charging (or there is no battery). The default is true.
ChargingTimeGets the remaining time until the battery is fully charged (0 when it is full), or null when it is unknown or the battery is discharging. The default is 0.
DefaultGets the status of a fully charged battery that is plugged in (the status reported when the user agent is unable to report it).
DischargingTimeGets the remaining time until the battery is depleted, or null when it is unknown or the battery is charging. The default is null.
LevelGets the level of the battery, between 0 (depleted) and 1 (full). The default is 1. The documents see it rounded to two decimals, to reduce fingerprinting.

Gets whether the battery is charging (or there is no battery). The default is true.

public bool Charging { get; init; }

Property value

bool

ChargingTime

BatteryStatus.cs

Gets the remaining time until the battery is fully charged (0 when it is full), or null when it is unknown or the battery is discharging. The default is 0.

public TimeSpan? ChargingTime { get; init; }

Property value

TimeSpan?

Gets the status of a fully charged battery that is plugged in (the status reported when the user agent is unable to report it).

public static BatteryStatus Default { get; }

Property value

BatteryStatus

DischargingTime

BatteryStatus.cs

Gets the remaining time until the battery is depleted, or null when it is unknown or the battery is charging. The default is null.

public TimeSpan? DischargingTime { get; init; }

Property value

TimeSpan?

Gets the level of the battery, between 0 (depleted) and 1 (full). The default is 1. The documents see it rounded to two decimals, to reduce fingerprinting.

public double Level { get; init; }

Property value

double

Methods

NameDescription
Equals(BatteryStatus?)
Equals(object?)
GetHashCode()
ToString()

Equals overloads

Equals(BatteryStatus?)

public bool Equals(BatteryStatus? other)
Parameters
other BatteryStatus?
Returns

bool

No documentation is available.

Equals(object?)

public override bool Equals(object? obj)
Parameters
obj object?
Returns

bool

No documentation is available.

GetHashCode()

public override int GetHashCode()

Returns

int

No documentation is available.

ToString()

public override string ToString()

Returns

string

No documentation is available.

Operators

NameDescription
operator ==(BatteryStatus?, BatteryStatus?)
operator !=(BatteryStatus?, BatteryStatus?)

operator ==(BatteryStatus?, BatteryStatus?)

public static bool operator ==(BatteryStatus? left, BatteryStatus? right)

Parameters

left BatteryStatus?
right BatteryStatus?

Returns

bool

No documentation is available.

operator !=(BatteryStatus?, BatteryStatus?)

public static bool operator !=(BatteryStatus? left, BatteryStatus? right)

Parameters

left BatteryStatus?
right BatteryStatus?

Returns

bool

No documentation is available.