[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

pm_battery_control Subroutine

Purpose

Controls and queries the battery status.

Library

Standard C Library (libc.a)

Syntax

#include <sys/pm.h>
int pm_battery_control(Command, Battery);
int Command;
struct pm_battery *Battery;

Description

The pm_battery_control subroutine controls and queries the battery status.

Parameters

Command Specifies one of the following:
PM_BATTERY_DISCHARGE
Discharges the battery.
PM_BATTERY_QUERY
Queries fuel state of the battery.
Battery Points a following pm_battery structure to return battery information. When Command is PM_BATTERY_QUERY, the following structure is used:
struct pm_battery {
   int  attribute;/*battery attributes are as follows*/
         PM_BATTERY  /* battery is supported */
         PM_BATTERY_EXIST    /* battery exists */
         PM_NICD      /*NiCd or NiMH */
         PM_CHARGE   /* now charging */
         PM_DISCHARGE   /* now discharging */
         PM_AC       /* AC power is in use */
         PM_DC       /* DC power is in use */
   int capacity;   /* battery capacity */
   int remain;   /* current remaining capacity */
   int discharge_remain;
         /*remaining capacity while discharging */
   int  discharge_time;   /* discharge time */
   int  full_charge_count; /*full charge count */
}
If a field is not applicable, -1 is set.

Return Values

PM_SUCCESS Indicates successful completion.
PM_ERROR Indicates an error condition. The variable errno is set to identify the error.

Error Codes

EINVAL The argument or command is not valid.

Implementation Specifics

The pm_battery_control subroutine is part of the Base Operating System (BOS) Runtime.

Related Information

The pm_control_state subroutine, pm_control_parameter subroutine.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]