[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


pmlib_get_event_notice Subroutine

Purpose

Gets a new PM event.

Library

PM (Power Management) Library (libpm.a)

Syntax

#include <pmlib.h>

int pmlib_get_event_notice(event)
int *event;

Description

The pmlib_get_event_notice subroutine gets the latest event. It is recommended PM- aware application calls this subroutine when signal notification from pm daemon arrives.

Parameters


event Points to an integer that is the latest PM event that the PM daemon holds, event can be bit-wise OR of following values:

PMLIB_EVENT_NONE
No event.

PMLIB_EVENT_AC
Power source is changed to AC.

PMLIB_EVENT_DC
Power source is changed to DC.

PMLIB_EVENT_NOTICE_TO_FULL_ON
System will change state to full-on.

PMLIB_EVENT_NOTICE_TO_STANDBY
System will change state to standby.

PMLIB_EVENT_NOTICE_TO_SUSPEND
   System will change state to suspend.

PMLIB_EVENT_NOTICE_TO_ENABLE
System will change state to PM enable.

PMLIB_EVENT_NOTICE_TO_HIBERNATION
   System will change state to hibernation.

PMLIB_EVENT_NOTICE_TO_SHUTDOWN
   System will change state to shutdown.

PMLIB_EVENT_NOTICE_TO_TERMINATE
   PM will be unconfigured.

PMLIB_EVENT_NOTICE_OF_REJECTION
   State change request was rejected.

PMLIB_EVENT_NOTICE_COMPLETION
   State change was completed.

PMLIB_EVENT_RESUME_FROM_STANDBY
   System is resumed from standby.

PMLIB_EVENT_RESUME_FROM_SUSPEND
   System is resumed from suspend.

PMLIB_EVENT_RESUME_FROM_HIBERNATION
   System is resumed from hibernation.

PMLIB_EVENT_START_TO_CHANGE_STATE
   System state change started.

PMLIB_EVENT_FORCE_TO_CHANGE_STATE
System is forced to change state.

PMLIB_EVENT_FAIL_TO_CHANGE_STATE
   System state change failed.

Return Values

Upon successful completion, PMLIB_SUCCESS is returned. If the pmlib_get_event_notice subroutine fails, PMLIB_ERROR is returned and errno variable is set to an error code.

Error Codes


ESRCH PM daemon is not running.
EINVAL Invalid argument.

Note: If an application program is registered as PM aware, the PM daemon sends a SIGPM (equal to SIGPWR) signal to the application when an PM event occurs. The application program needs to prepare a signal handler and to use this pmlib_get_event_notice subroutine to get the to get the PM event.

Implementation Specifics

The pmlib_get_event_notice subroutine is part of the Base Operation System (BOS) Runtime.

Related Information

The pmlib_request_state (pmlib_request_state Subroutine) subroutine, pmlib_request_battery (pmlib_request_battery 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 ]