[  Previous | Next  |  Table of Contents  |  Index  | Library Home | 
Legal | 
Search ] 
 
Technical Reference: Base Operating System and Extensions, Volume 1
Queries and controls the battery
status.
PM (Power Management) Library
(libpm.a)
#include <pmlib.h>
int pmlib_request_battery (cmd, pmb);
int cmd;
pmlib_battery_t *pmb;
| cmd
 | Determines the action to be taken by the pmlib_request_battery
subroutine and is one of the following values: 
- PMLIB_QUERY_BATTERY
 - Queries the battery state.
 - PMLIB_DISCHARGE_BATTERY
 - Discharges the battery.
  
 | 
| pmb
 | Points to the following pmlib_battery_t structure: 
 
 typedef struct _pmlib_battery {
   int attribute;          /*battery attribute*/
   int capacity;           /*battery capacity*/
   int remain;             /*current remain capacity*/
   int refresh_discharge_capacity;
   int refresh_discharge_time; /*discharge time*/
   int full_change_count;
} pmlib_battery_t;
 | 
When cmd is
PMLIB_QUERY_BATTERY, the returned pmb.attribute
is bit-wise OR of following values:
| PMLIB_BATTERY_SUPPORTED
 | Battery is supported.
 | 
| PMLIB_BATTERY_EXIST
 | Battery exists.
 | 
| PMLIB_BATTERY_NICD
 | Battery is NiCd
 | 
| PMLIB_BATTERY_CHARGING
 | Battery is being charged.
 | 
| PMLIB_BATTERY_DISCHARGING
 | Battery is being discharged.
 | 
| PMLIB_BATTERY_AC
 | AC adapter is in use.
 | 
| PMLIB_BATTERY_DC
 | Battery is in use.
 | 
| PMLIB_BATTERY_REFRESH_REQ
 | Need to refresh battery.
 | 
The
pmlib_request_battery subroutine queries the battery information or
requests to discharge the battery. The pmlib_request_
subroutine can be called by any user.
Upon successful completion,
PMLIB_SUCCESS is returned. If the
pmlib_request_state subroutine fails, PMLIB_ERROR is
returned and errno variable is set to an error code.
| ESRCH
 | PM daemon is not running.
 | 
| EINVAL
 | Invalid argument.
 | 
The
pmlib_request_battery subroutine is part of the Base Operation
System (BOS) Runtime.
The
pmlib_get_event_notice (pmlib_get_event_notice Subroutine) subroutine,
pmlib_request_state (pmlib_request_state Subroutine) subroutine, pmlib_request_parameter (pmlib_request_parameter Subroutine) subroutine,
pmlib_register_application (pmlib_register_application Subroutine) subroutine.
  [  Previous | Next  |  Table of Contents  |  Index  |
 
Library Home | 
Legal | 
Search  ]