2004-12-27 00:33:52 -08:00
|
|
|
#ifndef E_MOD_MAIN_H
|
|
|
|
#define E_MOD_MAIN_H
|
|
|
|
|
2011-01-06 10:41:58 -08:00
|
|
|
#ifdef HAVE_EEZE
|
|
|
|
# include <Eeze.h>
|
|
|
|
#else
|
2013-04-23 08:08:29 -07:00
|
|
|
# include <Eldbus.h>
|
2011-01-06 10:41:58 -08:00
|
|
|
#endif
|
|
|
|
|
2004-12-27 00:33:52 -08:00
|
|
|
typedef struct _Config Config;
|
2005-02-09 04:14:08 -08:00
|
|
|
|
2008-01-28 12:37:00 -08:00
|
|
|
#define CHECK_NONE 0
|
|
|
|
#define CHECK_ACPI 1
|
|
|
|
#define CHECK_APM 2
|
|
|
|
#define CHECK_PMU 3
|
|
|
|
#define CHECK_SYS_ACPI 4
|
2004-12-27 02:49:46 -08:00
|
|
|
|
2010-05-17 00:17:59 -07:00
|
|
|
#define UNKNOWN 0
|
|
|
|
#define NOSUBSYSTEM 1
|
|
|
|
#define SUBSYSTEM 2
|
|
|
|
|
2012-03-25 21:00:53 -07:00
|
|
|
#define SUSPEND 0
|
|
|
|
#define HIBERNATE 1
|
|
|
|
#define SHUTDOWN 2
|
|
|
|
|
2010-05-17 00:17:59 -07:00
|
|
|
#define POPUP_DEBOUNCE_CYCLES 2
|
|
|
|
|
2004-12-27 00:33:52 -08:00
|
|
|
struct _Config
|
|
|
|
{
|
2006-04-20 04:30:25 -07:00
|
|
|
/* saved * loaded config values */
|
2008-01-10 23:33:57 -08:00
|
|
|
int poll_interval;
|
2008-05-03 12:51:49 -07:00
|
|
|
int alert; /* Alert on minutes remaining */
|
|
|
|
int alert_p; /* Alert on percentage remaining */
|
|
|
|
int alert_timeout; /* Popup dismissal timeout */
|
2012-03-25 21:00:53 -07:00
|
|
|
int suspend_below; /* Suspend if battery drops below this level */
|
|
|
|
int suspend_method; /* Method used to suspend the machine */
|
2009-01-31 19:26:46 -08:00
|
|
|
int force_mode; /* force use of batget or hal */
|
2006-04-20 04:30:25 -07:00
|
|
|
/* just config state */
|
2006-05-09 06:02:48 -07:00
|
|
|
E_Module *module;
|
2006-01-06 13:30:53 -08:00
|
|
|
E_Config_Dialog *config_dialog;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *instances;
|
2008-03-03 01:48:37 -08:00
|
|
|
Ecore_Exe *batget_exe;
|
|
|
|
Ecore_Event_Handler *batget_data_handler;
|
|
|
|
Ecore_Event_Handler *batget_del_handler;
|
2009-01-31 19:26:46 -08:00
|
|
|
Ecore_Timer *alert_timer;
|
2008-03-03 01:48:37 -08:00
|
|
|
int full;
|
|
|
|
int time_left;
|
2010-04-30 18:13:38 -07:00
|
|
|
int time_full;
|
2008-03-03 01:48:37 -08:00
|
|
|
int have_battery;
|
|
|
|
int have_power;
|
2012-01-10 16:29:42 -08:00
|
|
|
int desktop_notifications;
|
2010-05-22 00:04:26 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-17 01:57:47 -07:00
|
|
|
Eeze_Udev_Watch *acwatch;
|
|
|
|
Eeze_Udev_Watch *batwatch;
|
2011-10-30 09:47:50 -07:00
|
|
|
#endif
|
2016-12-09 09:00:50 -08:00
|
|
|
#if defined HAVE_EEZE || defined __OpenBSD__ || defined __NetBSD__
|
2010-05-18 03:39:30 -07:00
|
|
|
Eina_Bool fuzzy;
|
|
|
|
int fuzzcount;
|
2010-05-16 22:14:50 -07:00
|
|
|
#endif
|
2005-02-09 04:14:08 -08:00
|
|
|
};
|
|
|
|
|
2010-05-17 00:17:59 -07:00
|
|
|
typedef struct _Battery Battery;
|
|
|
|
typedef struct _Ac_Adapter Ac_Adapter;
|
|
|
|
|
|
|
|
struct _Battery
|
|
|
|
{
|
|
|
|
const char *udi;
|
2016-12-09 09:00:50 -08:00
|
|
|
#if defined HAVE_EEZE || defined __OpenBSD__ || defined __DragonFly__ || defined __FreeBSD__ || defined __NetBSD__
|
2010-05-18 03:39:30 -07:00
|
|
|
Ecore_Poller *poll;
|
2010-05-17 00:17:59 -07:00
|
|
|
#endif
|
2017-11-06 09:46:08 -08:00
|
|
|
Eina_Bool present E_BITFIELD;
|
|
|
|
Eina_Bool charging E_BITFIELD;
|
2016-12-09 09:00:50 -08:00
|
|
|
#if defined HAVE_EEZE || defined __OpenBSD__ || defined __DragonFly__ || defined __FreeBSD__ || defined __NetBSD__
|
2010-05-18 03:39:30 -07:00
|
|
|
double last_update;
|
|
|
|
double percent;
|
|
|
|
double current_charge;
|
|
|
|
double design_charge;
|
|
|
|
double last_full_charge;
|
|
|
|
double charge_rate;
|
|
|
|
double time_full;
|
|
|
|
double time_left;
|
|
|
|
#else
|
2010-05-17 00:17:59 -07:00
|
|
|
int percent;
|
|
|
|
int current_charge;
|
|
|
|
int design_charge;
|
|
|
|
int last_full_charge;
|
|
|
|
int charge_rate;
|
|
|
|
int time_full;
|
|
|
|
int time_left;
|
|
|
|
const char *type;
|
|
|
|
const char *charge_units;
|
2010-05-18 03:39:30 -07:00
|
|
|
#endif
|
|
|
|
const char *technology;
|
2010-05-17 00:17:59 -07:00
|
|
|
const char *model;
|
|
|
|
const char *vendor;
|
2017-11-06 09:46:08 -08:00
|
|
|
Eina_Bool got_prop E_BITFIELD;
|
2013-04-23 08:08:29 -07:00
|
|
|
Eldbus_Proxy *proxy;
|
2011-10-30 09:47:50 -07:00
|
|
|
int * mib;
|
2016-12-09 09:00:50 -08:00
|
|
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
|
|
|
int * mib_state;
|
|
|
|
int * mib_units;
|
|
|
|
int * mib_time;
|
|
|
|
int batteries;
|
|
|
|
int time_min;
|
2011-10-30 09:47:50 -07:00
|
|
|
#endif
|
2010-05-17 00:17:59 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Ac_Adapter
|
|
|
|
{
|
|
|
|
const char *udi;
|
2017-11-06 09:46:08 -08:00
|
|
|
Eina_Bool present E_BITFIELD;
|
2010-05-17 00:17:59 -07:00
|
|
|
const char *product;
|
2013-04-23 08:08:29 -07:00
|
|
|
Eldbus_Proxy *proxy;
|
2011-10-30 09:47:50 -07:00
|
|
|
int * mib;
|
2010-05-17 00:17:59 -07:00
|
|
|
};
|
|
|
|
|
2010-05-17 01:57:47 -07:00
|
|
|
Battery *_battery_battery_find(const char *udi);
|
|
|
|
Ac_Adapter *_battery_ac_adapter_find(const char *udi);
|
2010-05-17 00:17:59 -07:00
|
|
|
void _battery_device_update(void);
|
2010-06-19 10:53:49 -07:00
|
|
|
#ifdef HAVE_EEZE
|
2010-05-17 01:57:47 -07:00
|
|
|
/* in e_mod_udev.c */
|
2010-08-30 12:57:36 -07:00
|
|
|
int _battery_udev_start(void);
|
2010-05-18 03:39:30 -07:00
|
|
|
void _battery_udev_stop(void);
|
2010-05-17 01:57:47 -07:00
|
|
|
/* end e_mod_udev.c */
|
2016-12-09 09:00:50 -08:00
|
|
|
#elif !defined __OpenBSD__ && !defined __DragonFly__ && !defined __FreeBSD__ && !defined __NetBSD__
|
2010-06-19 10:53:49 -07:00
|
|
|
/* in e_mod_dbus.c */
|
2013-01-02 05:14:29 -08:00
|
|
|
int _battery_upower_start(void);
|
|
|
|
void _battery_upower_stop(void);
|
2010-06-19 10:53:49 -07:00
|
|
|
/* end e_mod_dbus.c */
|
2011-10-30 09:47:50 -07:00
|
|
|
#else
|
2016-12-09 09:00:50 -08:00
|
|
|
/* in e_mod_sysctl.c */
|
|
|
|
int _battery_sysctl_start(void);
|
|
|
|
void _battery_sysctl_stop(void);
|
|
|
|
/* end e_mod_sysctl.c */
|
2010-06-19 10:53:49 -07:00
|
|
|
#endif
|
2010-05-17 00:17:59 -07:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API extern E_Module_Api e_modapi;
|
2005-09-23 10:13:47 -07:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void *e_modapi_init (E_Module *m);
|
|
|
|
E_API int e_modapi_shutdown (E_Module *m);
|
|
|
|
E_API int e_modapi_save (E_Module *m);
|
2004-12-27 00:33:52 -08:00
|
|
|
|
2015-03-18 15:09:09 -07:00
|
|
|
E_Config_Dialog *e_int_config_battery_module(Evas_Object *parent, const char *params EINA_UNUSED);
|
2007-10-31 05:21:02 -07:00
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
void _battery_config_updated(void);
|
|
|
|
extern Config *battery_config;
|
2005-12-14 14:46:51 -08:00
|
|
|
|
2012-01-19 15:25:32 -08:00
|
|
|
/**
|
|
|
|
* @addtogroup Optional_Gadgets
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @defgroup Module_Battery Battery
|
|
|
|
*
|
|
|
|
* Shows battery level and current status, may do actions given some
|
|
|
|
* thresholds.
|
|
|
|
*
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2004-12-27 00:33:52 -08:00
|
|
|
#endif
|