Support for device power supply properties

The Environment object includes eight new properties for determining the status of the device battery or power source. The following table lists and describes these properties.

Environment object property

Datatype

Description

PowerBatteryCharging

Boolean

Indicates whether the battery is being charged.

PowerBatteryDataValid

Boolean

Indicates whether the values for PowerBatteryCharging, PowerBatteryFlags, PowerBatteryLifeRemaining, and PowerBatteryPercentage are valid. Values are:

  • TRUE – Power battery values are valid

  • FALSE – The device is unable to report the power battery values

PowerBatteryFlags

ULong

Reports the device battery charge status flags. Values and their meanings are:

  • 0 Unknown

  • 1 High charge state

  • 2 Low charge state

  • 4 Critically low charge state

  • 8 Currently charging (PowerBatteryCharging is true)

  • 128 No battery is present

Combinations of the above values are possible. For example, a value of 10 would mean that the battery has a low charge state but is also currently charging.

PowerBatteryLifeRemaining

ULong

Estimated battery life remaining in seconds.

PowerBatteryPercentage

Integer

Percentage of full battery charge remaining.

PowerLineBackup

Boolean

Device is on backup power.

PowerLineDataValid

Boolean

Determines whether the values for PowerLineOn and PowerLineBackup are valid. Values are:

  • TRUE – Power line values are valid

  • FALSE – The device is unable to report the power line values

PowerLineOn

Boolean

Device is plugged in to main power source.

For more information, see GetEnvironment and the Environment object in the online Help.