Battery Battery Battery Battery Battery Class

Definition

Provides information about a battery controller that is currently connected to the device. For more info, see Get battery information.

public : sealed class Battery
struct winrt::Windows::Devices::Power::Battery
public sealed class Battery
Public NotInheritable Class Battery
// This class does not provide a public constructor.
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

In this context, device refers to the hardware that your app is running on. Battery controller refers to the electronics that interface between the physical battery and the operating system. A battery controller appears in Device Manager as a "Battery" under the Batteries node.

Depending on the device, it may be possible to remove the physical battery while the device remains running. For example, a laptop that's plugged into A/C power. In that case, if the battery controller were part of the laptop enclosure, you could potentially create a Battery object when no battery is connected to the device. However, if the battery controller resided on the physical battery, it would no longer be visible to the operating system and therefore you could not create a corresponding Battery object for an individual battery.

Properties

AggregateBattery AggregateBattery AggregateBattery AggregateBattery AggregateBattery

Gets a Battery object that represents all battery controllers connected to the device.

DeviceId DeviceId DeviceId DeviceId DeviceId

Gets the identifier (ID) for an individual battery controller.

Methods

FromIdAsync(String) FromIdAsync(String) FromIdAsync(String) FromIdAsync(String) FromIdAsync(String)

Gets a Battery object that represents an individual battery controller connected to the device.

GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()

Gets an Advanced Query Syntax (AQS) string that can be used to find all battery controllers that are connected to the device.

GetReport() GetReport() GetReport() GetReport() GetReport()

Gets a BatteryReport object that indicates the charge, capacity, and status of the battery or aggregate.

Events

ReportUpdated ReportUpdated ReportUpdated ReportUpdated ReportUpdated

Occurs when the charge, capacity, or status of a battery changes.

See also