power source, powersource, kPMPowerSource — A power source.


power source structure { type, name, state, present, health, confidence, current capacity, charging, seconds remaining, ... };
type : string, choice
name : string
state : string, choice, optional
present : boolean, optional
health : string, choice, optional
confidence : string, choice, optional
current capacity : integer, optional, range 0..100
charging : boolean, optional
seconds remaining : integer, optional


A power source.

A power source is typically an internal or external battery or specialised power supply. Specialised power supplies include uninterruptible power supply (UPS) devices.


type. Connection type of power source.

type is a string. type must be one of the following five constants:

  • serial, kPMPowerSourceType_Serial.
  • USB, kPMPowerSourceType_USB.
  • network, kPMPowerSourceType_Network.
  • internal, kPMPowerSourceType_Internal.
  • unknown, kPMPowerSourceType_Unknown.

name. Name of the power source.

name is a string.

state. Is the power source available and in use.

state is a string. state is optional. state must be one of the following four constants:

  • off line, kPMPowerSourceState_OffLine.
  • ac power, kPMPowerSourceState_AcPower.
  • battery, kPMPowerSourceState_Battery.
  • unknown, kPMPowerSourceState_Unknown.

present. Is the power source present.

present is a boolean. present is optional.

health. Is the power source is good health.

Power sources such as batteries degrade with age and use. Some power sources are able to detect this process and provide a guide as to the health of the battery.

health is a string. health is optional. health must be one of the following six constants:

  • good, kPMPowerSourceHealth_Good.
  • fair, kPMPowerSourceHealth_Fair.
  • poor, kPMPowerSourceHealth_Poor.
  • check, kPMPowerSourceHealth_Check.
  • failure, kPMPowerSourceHealth_Failure.
  • unknown, kPMPowerSourceHealth_Unknown.

confidence. Is the health field accurate.

confidence is a string. confidence is optional. confidence must be one of the following four constants:

  • good, kPMPowerSourceConfidence_Good.
  • fair, kPMPowerSourceConfidence_Fair.
  • poor, kPMPowerSourceConfidence_Poor.
  • unknown, kPMPowerSourceConfidence_Unknown.

current capacity. Current percentage capacity.

current capacity is an integer. current capacity is optional. current capacity must be between 0 and 100, inclusive.

charging. Is the power source being charged.

charging is a boolean. charging is optional.

seconds remaining. Estimated seconds remaining until fully charged or empty.

If the power source is being charged, the seconds remaining refer to the time remaining until fully charged.

If the power source is being used, the seconds remaining refer to the time remaining until the power source is empty.

This value may not be present for all power sources.

seconds remaining is an integer. seconds remaining is optional.