Name

condition battery health, conditionbatteryhealth, kPMConditionConditionBatteryHealth — Conditional on the battery health.

Synopsis

condition battery health structure { invert, type, health, comparison, filter };
invert : boolean, default, optional
type : string, choice
health : string, choice
comparison : string, choice, default, optional
filter : power source filter structure, optional

Description

Conditional on the battery health.

The health of a battery backed power source can diminish over time. As the health declines, many power sources can provide a guide as to the battery's current state. This condition allows you to create events that conditionally perform only if the battery's health matches a given comparison.

Consider using this condition to check the battery's health when a user logs in, or before beginning a long running critical task.

Not every battery will have corresponding health information. This information is provided by the battery itself and thus the existence of the health information is dependent on the manufacturer.

Only one power source needs to match this condition in order to return true.

Fields

invert. Invert the condition's conclusion.

Conditions are designed to positively identify specific states. Many events will want a condition to confirm that a specific state is not occuring. To reverse the role of a positive condition, use the invert field.

If a condition is true, and the invert field is set, the condition will invert the true and return false.

If a condition is false, and the invert field is set, the condition will invert the false and return true.

invert is a boolean. If invert is omitted, the default false is used. invert is optional.

type. Type of condition to test.

type is a string. type must be battery health, kPMConditionType_BatteryHealth.

health. Current health of at least one power source.

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

  • good, kPMConditionHealth_Good.
  • fair, kPMConditionHealth_Fair.
  • poor, kPMConditionHealth_Poor.
  • check, kPMConditionHealth_Check.
  • failure, kPMConditionHealth_Failure.
  • unknown, kPMConditionHealth_Unknown.

comparison. Method to compare the battery health with.

The health values are ordered from good (high) to failure (low). The unknown state always returns false.

comparison is a string. If comparison is omitted, the default equal to is used. comparison is optional. comparison must be one of the following six constants:

  • equal to, kPMConditionComparison_EqualTo.
  • not equal to, kPMConditionComparison_NotEqualTo.
  • greater than, kPMConditionComparison_GreaterThan.
  • less than, kPMConditionComparison_LessThan.
  • greater than or equal to, kPMConditionComparison_GreaterThanOrEqualTo.
  • less than or equal to, kPMConditionComparison_LessThanOrEqualTo.

filter. Power sources to monitor.

filter is a power source filter structure. filter is optional.