aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/temperature/e_mod_main.h
blob: b9cf671870af11f779df1a0c808749b9ce150731 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H

#include "e.h"

#ifdef HAVE_EEZE
# include <Eeze.h>
#endif


typedef enum _Sensor_Type
{
   SENSOR_TYPE_NONE,
   SENSOR_TYPE_FREEBSD,
   SENSOR_TYPE_OPENBSD,
   SENSOR_TYPE_OMNIBOOK,
   SENSOR_TYPE_LINUX_MACMINI,
   SENSOR_TYPE_LINUX_I2C,
   SENSOR_TYPE_LINUX_ACPI,
   SENSOR_TYPE_LINUX_PCI,
   SENSOR_TYPE_LINUX_PBOOK,
   SENSOR_TYPE_LINUX_INTELCORETEMP,
   SENSOR_TYPE_LINUX_THINKPAD,
   SENSOR_TYPE_LINUX_SYS
} Sensor_Type;

typedef struct _Config Config;
typedef struct _Config_Face Config_Face;
typedef struct _Tempthread Tempthread;

typedef enum _Unit
{
   CELSIUS,
   FAHRENHEIT
} Unit;

struct _Tempthread
{
   Config_Face *inst;
   int poll_interval;
   Sensor_Type sensor_type;
   const char *sensor_name;
   const char *sensor_path;
   void *extn;
   E_Powersave_Sleeper *sleeper;
#ifdef HAVE_EEZE
   Eina_List *tempdevs;
#endif
   Eina_Bool initted : 1;
};

struct _Config_Face
{
   const char *id;
   /* saved * loaded config values */
   int poll_interval;
   int low, high;
   int sensor_type;
   int temp;
   const char *sensor_name;
   Unit units;
   /* config state */
   E_Gadcon_Client *gcc;
   Evas_Object *o_temp;
#ifdef HAVE_EEZE
   Ecore_Poller *poller;
   Tempthread *tth;
   int backend;
#endif
   E_Module *module;

   E_Config_Dialog *config_dialog;
   E_Menu *menu;
   Ecore_Thread *th;

   Eina_Bool have_temp:1;
};

struct _Config
{
   /* saved * loaded config values */
   Eina_Hash *faces;
   /* config state */
   E_Module *module;
};

#ifdef HAVE_EEZE
typedef enum _Backend
{
   TEMPGET,
   UDEV
} Backend;

int temperature_udev_get(Tempthread *tth);
#endif

E_API extern E_Module_Api e_modapi;

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);

void config_temperature_module(Config_Face *inst);
void temperature_face_update_config(Config_Face *inst);

int temperature_tempget_get(Tempthread *tth);

/**
 * @addtogroup Optional_Gadgets
 * @{
 *
 * @defgroup Module_Temperature Temperature
 *
 * Monitors computer temperature sensors and may do actions given some
 * thresholds.
 *
 * @see Module_CPUFreq
 * @}
 */
#endif