include/alp/power.h File Reference


Detailed Description

Declarations for ALP Power Manager routines.

>

#include <alp/sysclass.h>
#include <glib.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  _AlpPowerBattEventDetails
struct  _AlpPowerOffEventDetails
struct  _AlpPowerWakeStateEventDetails

Power Manager Notifications

The Power Manager informs applications of changes in the device and battery states through notifications. Notifications are generated on each state change, and indicate both the new and previous states. Sleep notifications (transitions from a higher wake state to a lower), and the power-off notification sent when the device is shutting down, are delivered before the new state is entered, allowing applications to prepare for the change (e.g., save data, shut down network connections, etc.); all other notifications are sent after the fact.

As with all notifications, applications should register for the most specific power notifications possible, to minimize the amount of processing the system does during power state transation, which occur frequently. This is especially important for "sleep" notifications, since the device will not enter the lower wake state until processing of the sleep notification has been completed by all apps. In addition, most apps will have no use for power notifications when they are not running, and should therefore use alp_notify_register() to register for power notifications when started, to ensure that the registration is cancelled when the app exits.

#define ALP_NOTIFY_EVENT_POWER_BATT_CHANGE   "/alp/power/batt"
 Power Manager battery state notifications. All battery notifications.
#define ALP_NOTIFY_EVENT_POWER_BATT_STATE_CHANGE   "/alp/power/batt/state"
 Battery state change.
#define ALP_NOTIFY_EVENT_POWER_OFF   "/alp/power/off"
 Power Manager power-off notification. Device is being powered off.
#define ALP_NOTIFY_EVENT_POWER_SLEEP   "/alp/power/wake_state/sleep"
 All sleep notifications.
#define ALP_NOTIFY_EVENT_POWER_SLEEP_TO_SEMI_WAKE   "/alp/power/wake_state/sleep/semi_wake"
 Descending into "semi-wake" state.
#define ALP_NOTIFY_EVENT_POWER_SLEEP_TO_SLEEP   "/alp/power/wake_state/sleep/sleep"
 Descending into "sleep" state.
#define ALP_NOTIFY_EVENT_POWER_WAKE   "/alp/power/wake_state/wake"
 All wake notifications.
#define ALP_NOTIFY_EVENT_POWER_WAKE_STATE_CHANGE   "/alp/power/wake_state"
 Power Manager wake state notifications. All sleep and wake notifications.
#define ALP_NOTIFY_EVENT_POWER_WAKE_TO_FULL_WAKE   "/alp/power/wake_state/wake/full_wake"
 Waking into "full-wake" state.
#define ALP_NOTIFY_EVENT_POWER_WAKE_TO_SEMI_WAKE   "/alp/power/wake_state/wake/semi_wake"
 Waking into "semi-wake" state.
typedef _AlpPowerBattEventDetails AlpPowerBattEventDetails
typedef _AlpPowerOffEventDetails AlpPowerOffEventDetails
typedef _AlpPowerWakeStateEventDetails AlpPowerWakeStateEventDetails

Backlight and Timeout Names

These constants can be used as the name arguments to alp_power_set_default_timeout() and alp_power_set_brightness(), to specify the backlight device(s) to which the new timeout/brightness setting should be applied.

#define ALP_POWER_ALL_PRIMARY   "_all-primary"
 All primary backlights (LCD and keypad).
#define ALP_POWER_ALL_TIMEOUTS   "_all-timeouts"
 Auto-off timer and all primary backlights (timeout only).
#define ALP_POWER_AUTO_OFF   "_auto-off"
 Auto-off timer (timeout only).
#define ALP_POWER_PRIMARY_KEYBOARD   "_primary-key"
 Primary keyboard/keypad backlight.
#define ALP_POWER_PRIMARY_LCD   "_primary-lcd"
 Primary LCD backlight.

DPM Perfomance Levels

These values are used with alp_power_set_performance_request() to specify the minimum level of system performance (i.e., CPU and memory performance) needed by an application.

Performance values range from negative (very slow performance is acceptible) to positive (very high performance is required). The default performance level is appropriate for an interactive UI app.

#define ALP_POWER_PERF_LEVEL_DEFAULT   0
#define ALP_POWER_PERF_LEVEL_LAUNCH   ALP_POWER_PERF_LEVEL_MAX
 level used for launching apps
#define ALP_POWER_PERF_LEVEL_MAX   5
#define ALP_POWER_PERF_LEVEL_MIN   -5

Power Manager Error Codes

#define ALP_STATUS_POWER_INVALID_PARAM   (ALP_CLASS_POWER | 0x00010000)
 Invalid parameter value.
#define ALP_STATUS_POWER_NO_DEVICE   (ALP_CLASS_POWER | 0x00070000)
 Specified device doesn't exist.
#define ALP_STATUS_POWER_NO_FREE_RAM   (ALP_CLASS_POWER | 0x00020000)
 Memory allocation failed.
#define ALP_STATUS_POWER_NO_MISER   (ALP_CLASS_POWER | 0x00030000)
 Can't connect to Power Miser daeomon.
#define ALP_STATUS_POWER_NO_WAKEUP   (ALP_CLASS_POWER | 0x00060000)
 Specified wake-up is not active.
#define ALP_STATUS_POWER_NOT_ALLOWED   (ALP_CLASS_POWER | 0x00040000)
 Operation not allowed.
#define ALP_STATUS_POWER_TIME_PASSED   (ALP_CLASS_POWER | 0x00050000)
 Requested wake-up time is in the past.

Battery States

These values are returned through the
stateOut parameter to alp_power_get_battery_state(), to indicate the system's current battery charge state.

enum  AlpPowerBatteryState { ALP_POWER_NORMAL_BATTERY_STATE, ALP_POWER_LOW_BATTERY_STATE, ALP_POWER_CRITICAL_BATTERY_STATE }

Wake State Names

These values describe the device's current "wake state": fully on, partially on, or asleep.

enum  AlpPowerWakeState { ALP_POWER_FULL_WAKE_STATE, ALP_POWER_SEMI_WAKE_STATE, ALP_POWER_SLEEP_STATE }

Defines

#define ALP_POWER_H_   1

Typedefs

typedef gboolean(* AlpPowerWakeupCallback )(gpointer data)
 Prototype for functions which handle Power Manager wake-up events.

Functions

alp_status_t alp_power_acquire_wake_ref (AlpPowerWakeState state)
 Request device enter/remain in the specified "wake state".
alp_status_t alp_power_cancel_wakeup (guint wakeupID)
 Cancel a wake-up event.
alp_status_t alp_power_clear_performance_request (void)
 Cancel DPM performance request for the current process.
alp_status_t alp_power_force_full_wake ()
 Force device into full-wake.
alp_status_t alp_power_get_battery_state (guint *percentOut, AlpPowerBatteryState *stateOut, gboolean *chargingOut)
 Retrieve current battery state.
alp_status_t alp_power_get_battery_thresholds (guint *lowBatteryThresholdOut, guint *criticalBatteryThresholdOut)
 Retrieve thresholds for transitions between battery states, in percentage charge remaining.
alp_status_t alp_power_get_wake_state (AlpPowerWakeState *stateOut)
 Retrieve device's current "wake state".
alp_status_t alp_power_release_wake_ref (AlpPowerWakeState state)
 Cancel previous request for specified "wake state".
alp_status_t alp_power_request_wakeup (time_t when, AlpPowerWakeState state, AlpPowerWakeupCallback callback, gpointer data, guint *wakeupIDOut)
 Schedule wake-up at specified time.
alp_status_t alp_power_set_performance_request (int level)
 Set DPM performance request for current process.
alp_status_t alp_power_set_timeout (struct _GtkWindow *win, const char *name, uint32_t timeout)
 Set task-specific backlight/auto-off timeout, effective while the window is shown.
alp_status_t alp_power_wakeup_handled ()
 Signal asynchronous completion of wake-up event.


Define Documentation

#define ALP_POWER_H_   1
 


Generated on Wed Jul 30 07:06:40 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.