Name
condition power state, conditionpowerstate, kPMConditionConditionPowerState — Conditional on the computer's power source state.
Synopsis
condition power state structure { invert, type, state, filter };
invert : boolean, default, optional |
type : string, choice |
state : string, choice |
filter : power source filter structure, optional
|
Description
Conditional on the computer's power source state.
A power source may be using the mains power, battery power, be off-line, or be in an unknown state. This condition tests the current power sources and can be used to determine if the computer is connected to the mains power, or to a battery.
Be aware that a computer can have multiple sources of power. Use the filter to restrict the power sources to test.
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 power state, kPMConditionType_PowerState
.
state. Current state of at least one power source.
state
is a string. state
must be one of the following four constants:
- off line,
kPMConditionState_OffLine
. - ac power,
kPMConditionState_AcPower
. - battery,
kPMConditionState_Battery
. - unknown,
kPMConditionState_Unknown
.
filter. Power sources to monitor.
filter
is a power source filter structure. filter
is optional.