00001 /****************************************************************************** 00002 * Copyright (c) 1999-2008 ACCESS CO., LTD. All rights reserved. 00003 * Copyright (c) 2006 PalmSource, Inc (an ACCESS company). All rights reserved. 00004 *****************************************************************************/ 00012 #ifndef ALP_POWER_H_ 00013 #define ALP_POWER_H_ 1 00014 00015 #ifdef __cplusplus 00016 extern "C" { 00017 #endif 00018 00025 #include <alp/sysclass.h> 00026 #include <glib.h> 00027 #include <time.h> 00028 00029 // declare this here, to prevent everyone who uses the file from needing GTK 00030 struct _GtkWindow; 00031 00032 00037 #define ALP_STATUS_POWER_INVALID_PARAM (ALP_CLASS_POWER | 0x00010000) 00038 #define ALP_STATUS_POWER_NO_FREE_RAM (ALP_CLASS_POWER | 0x00020000) 00039 #define ALP_STATUS_POWER_NO_MISER (ALP_CLASS_POWER | 0x00030000) 00040 #define ALP_STATUS_POWER_NOT_ALLOWED (ALP_CLASS_POWER | 0x00040000) 00041 #define ALP_STATUS_POWER_TIME_PASSED (ALP_CLASS_POWER | 0x00050000) 00042 #define ALP_STATUS_POWER_NO_WAKEUP (ALP_CLASS_POWER | 0x00060000) 00043 #define ALP_STATUS_POWER_NO_DEVICE (ALP_CLASS_POWER | 0x00070000) 00044 00045 00046 00057 #define ALP_POWER_PRIMARY_LCD "_primary-lcd" 00058 #define ALP_POWER_PRIMARY_KEYBOARD "_primary-key" 00059 #define ALP_POWER_ALL_PRIMARY "_all-primary" 00060 #define ALP_POWER_AUTO_OFF "_auto-off" 00061 #define ALP_POWER_ALL_TIMEOUTS "_all-timeouts" 00062 00063 00064 00065 00074 typedef enum { 00075 ALP_POWER_FULL_WAKE_STATE, 00076 ALP_POWER_SEMI_WAKE_STATE, 00077 ALP_POWER_SLEEP_STATE, 00078 } AlpPowerWakeState; 00079 00081 00082 00092 typedef enum { 00093 ALP_POWER_NORMAL_BATTERY_STATE, 00094 ALP_POWER_LOW_BATTERY_STATE, 00095 ALP_POWER_CRITICAL_BATTERY_STATE, 00096 } AlpPowerBatteryState; 00097 00099 00100 00114 #define ALP_POWER_PERF_LEVEL_MAX 5 00115 #define ALP_POWER_PERF_LEVEL_DEFAULT 0 00116 #define ALP_POWER_PERF_LEVEL_MIN -5 00117 00118 #define ALP_POWER_PERF_LEVEL_LAUNCH ALP_POWER_PERF_LEVEL_MAX 00119 00120 00121 00122 00123 00149 alp_status_t alp_power_set_timeout(struct _GtkWindow *win, const char *name, uint32_t timeout); 00150 00151 00167 alp_status_t alp_power_acquire_wake_ref(AlpPowerWakeState state); 00168 00180 alp_status_t alp_power_release_wake_ref(AlpPowerWakeState state); 00181 00190 alp_status_t alp_power_get_wake_state(AlpPowerWakeState *stateOut); 00191 00202 alp_status_t alp_power_force_full_wake(); 00203 00204 00206 typedef gboolean (*AlpPowerWakeupCallback)(gpointer data); 00207 00240 alp_status_t alp_power_request_wakeup(time_t when, AlpPowerWakeState state, 00241 AlpPowerWakeupCallback callback, gpointer data, 00242 guint *wakeupIDOut); 00243 00254 alp_status_t alp_power_cancel_wakeup(guint wakeupID); 00255 00269 alp_status_t alp_power_wakeup_handled(); 00270 00271 00283 alp_status_t alp_power_get_battery_state(guint *percentOut, 00284 AlpPowerBatteryState *stateOut, 00285 gboolean *chargingOut); 00286 00288 alp_status_t alp_power_get_battery_thresholds(guint *lowBatteryThresholdOut, 00289 guint *criticalBatteryThresholdOut); 00290 00291 00311 alp_status_t alp_power_set_performance_request(int level); 00312 00325 alp_status_t alp_power_clear_performance_request(void); 00326 00327 00353 00354 #define ALP_NOTIFY_EVENT_POWER_WAKE_STATE_CHANGE "/alp/power/wake_state" 00355 00356 #define ALP_NOTIFY_EVENT_POWER_SLEEP "/alp/power/wake_state/sleep" 00357 00358 #define ALP_NOTIFY_EVENT_POWER_SLEEP_TO_SEMI_WAKE "/alp/power/wake_state/sleep/semi_wake" 00359 #define ALP_NOTIFY_EVENT_POWER_SLEEP_TO_SLEEP "/alp/power/wake_state/sleep/sleep" 00360 00361 #define ALP_NOTIFY_EVENT_POWER_WAKE "/alp/power/wake_state/wake" 00362 00363 #define ALP_NOTIFY_EVENT_POWER_WAKE_TO_FULL_WAKE "/alp/power/wake_state/wake/full_wake" 00364 #define ALP_NOTIFY_EVENT_POWER_WAKE_TO_SEMI_WAKE "/alp/power/wake_state/wake/semi_wake" 00365 00366 typedef struct _AlpPowerWakeStateEventDetails AlpPowerWakeStateEventDetails; 00367 struct _AlpPowerWakeStateEventDetails { 00368 AlpPowerWakeState lastState; 00369 AlpPowerWakeState newState; 00370 guint32 flags; 00371 }; 00372 00373 00375 #define ALP_NOTIFY_EVENT_POWER_BATT_CHANGE "/alp/power/batt" 00376 00377 #define ALP_NOTIFY_EVENT_POWER_BATT_STATE_CHANGE "/alp/power/batt/state" 00378 00379 typedef struct _AlpPowerBattEventDetails AlpPowerBattEventDetails; 00380 struct _AlpPowerBattEventDetails { 00381 AlpPowerBatteryState lastState; 00382 AlpPowerBatteryState newState; 00383 guint32 lastLevel; 00384 guint32 newLevel; 00385 gboolean lastCharging; 00386 gboolean newCharging; 00387 }; 00388 00389 00391 #define ALP_NOTIFY_EVENT_POWER_OFF "/alp/power/off" 00392 00393 typedef struct _AlpPowerOffEventDetails AlpPowerOffEventDetails; 00394 struct _AlpPowerOffEventDetails { 00395 guint32 flags; 00396 }; 00397 00399 00400 00405 #ifdef __cplusplus 00406 } // extern "C" 00407 #endif 00408 00409 00410 00411 #endif /* ALP_POWER_H_ */ 00412 00413
Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.