summaryrefslogtreecommitdiff
path: root/src/xfpm-hal.h
blob: c3ada3d3c4064ade5f77e004e9385964b671e8a4 (plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
 *
 * * Copyright (C) 2008 Ali <aliov@xfce.org>
 *
 * Licensed under the GNU General Public License Version 2
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef __XFPM_HAL_H
#define __XFPM_HAL_H

#include <glib.h>

#include <hal/libhal.h>

#define HAL_DBUS_SERVICE             "org.freedesktop.Hal"
#define HAL_ROOT_COMPUTER	         "/org/freedesktop/Hal/devices/computer"
#define	HAL_DBUS_INTERFACE_POWER	 "org.freedesktop.Hal.Device.SystemPowerManagement"
#define HAL_DBUS_INTERFACE_CPU       "org.freedesktop.Hal.Device.CPUFreq"
#define HAL_DBUS_INTERFACE_LCD       "org.freedesktop.Hal.Device.LaptopPanel"

G_BEGIN_DECLS

#define XFPM_TYPE_HAL                  (xfpm_hal_get_type ())
#define XFPM_HAL(o)                    (G_TYPE_CHECK_INSTANCE_CAST((o),XFPM_TYPE_HAL,XfpmHal))
#define XFPM_HAL_CLASS(k)              (G_TYPE_CHECK_CLASS_CAST((k),XFPM_TYPE_HAL,XfpmHalClass))
#define XFPM_IS_HAL(o)                 (G_TYPE_CHECK_INSTANCE_TYPE((o),XFPM_TYPE_HAL))
#define XFPM_IS_HAL_CLASS(k)           (G_TYPE_CHECK_CLASS_TYPE((k),XFPM_TYPE_HAL))
#define XFPM_HAL_GET_CLASS(k)          (G_TYPE_INSTANCE_GET_CLASS((k),XFPM_TYPE_HAL,XfpmHalClass))

typedef struct XfpmHalPrivate XfpmHalPrivate;

typedef struct {
    
    GObject        parent;
    XfpmHalPrivate *priv;
    
} XfpmHal;     

typedef struct {
    
    GObjectClass parent_class;
    
    /*signals*/
    void         (*device_added)              (XfpmHal *xfpm_hal,
                                              const gchar *udi);
    
    void         (*device_removed)            (XfpmHal *xfpm_hal,
                                              const gchar *udi);
    
    void         (*device_property_changed)   (XfpmHal *xfpm_hal,
                                              const gchar *udi,
                                              const gchar *key,
                                              gboolean is_removed,
                                              gboolean is_added);
                                              
    void         (*device_condition)          (XfpmHal *xfpm_hal,
                                              const gchar *udi,
                                              const gchar *condition_name,
                                              const gchar *condition_detail);
                                                                                        
} XfpmHalClass;    

typedef enum
{
	XFPM_HAL_ERROR_GENERAL
} XfpmHalError;

#define XFPM_HAL_ERROR xfpm_hal_error_quark()

GQuark               xfpm_hal_error_quark                  (void);
GType                xfpm_hal_get_type                     (void);
XfpmHal             *xfpm_hal_new                          (void);
gboolean             xfpm_hal_is_connected                 (XfpmHal *hal);
gboolean             xfpm_hal_power_management_can_be_used (XfpmHal *hal);
gboolean 			 xfpm_hal_cpu_freq_interface_can_be_used(XfpmHal *hal);
gboolean             xfpm_hal_connect_to_signals           (XfpmHal *hal,
                                                            gboolean device_removed,
                                                            gboolean device_added,
                                                            gboolean device_property_changed,
                                                            gboolean device_condition);
                                                            
gchar              **xfpm_hal_get_device_udi_by_capability (XfpmHal *xfpm_hal,
                                                             const gchar *capability,
                                                             gint *num,
                                                             GError **gerror);
gint32               xfpm_hal_get_int_info                 (XfpmHal *xfpm_hal,
                                                             const gchar *udi,
                                                             const gchar *property,
                                                             GError **gerror);    
gchar                *xfpm_hal_get_string_info              (XfpmHal *xfpm_hal,
                                                            const gchar *udi,
                                                            const gchar *property,
                                                            GError **gerror); 
gboolean             xfpm_hal_get_bool_info                (XfpmHal *xfpm_hal,
                                                            const gchar *udi,
                                                            const gchar *property,
                                                            GError **gerror); 
gboolean             xfpm_hal_device_have_key              (XfpmHal *xfpm_hal,
                                                            const gchar *udi,
                                                            const gchar *key);
gboolean             xfpm_hal_device_have_capability       (XfpmHal *xfpm_hal,
                                                            const gchar *udi,
                                                            const gchar *capability);
                                                            
gboolean             xfpm_hal_shutdown                     (XfpmHal *xfpm_hal);
gboolean             xfpm_hal_hibernate                    (XfpmHal *xfpm_hal,
                                                            GError **gerror,
                                                            guint8 *critical);
gboolean             xfpm_hal_suspend                      (XfpmHal *xfpm_hal,
                                                            GError **gerror,
                                                            guint8 *critical);
void                 xfpm_hal_set_brightness               (XfpmHal *xfpm_hal,
                                                            const gchar *interface,
                                                            gint level32,
                                                            GError **gerror);
gint32               xfpm_hal_get_brightness               (XfpmHal *xfpm_hal,
                                                            const gchar *interface,
                                                            GError **gerror);                                                            

gchar              **xfpm_hal_get_available_cpu_governors  (XfpmHal *xfpm_hal,
                                                            GError **gerror);
gchar               *xfpm_hal_get_current_cpu_governor     (XfpmHal *xfpm_hal,
                                                            GError **gerror);
void                 xfpm_hal_set_cpu_governor             (XfpmHal *xfpm_hal,
                                                            const gchar *governor,
                                                            GError **gerror);
void                 xfpm_hal_set_power_save               (XfpmHal *xfpm_hal,
                                                            gboolean power_save,
                                                            GError **gerror);
G_END_DECLS

#endif /* __XFPM_HAL_H */