Debian Codegraph @

src/cd-sensor.h

raw
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2010-2011 Richard Hughes <[email protected]>
4 *
5 * Licensed under the GNU General Public License Version 2
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22 #ifndef __CD_SENSOR_H
23 #define __CD_SENSOR_H
24
25 #include "config.h"
26
27 #include <glib-object.h>
28 #include <gio/gio.h>
29 #include <colord-private.h>
30
31 #include <gudev/gudev.h>
32 #include <gusb.h>
33
34 #include "cd-common.h"
35
36 G_BEGIN_DECLS
37
38 #define CD_SENSOR_ERROR cd_sensor_error_quark()
39
40 #define CD_TYPE_SENSOR (cd_sensor_get_type ())
41 G_DECLARE_DERIVABLE_TYPE (CdSensor, cd_sensor, CD, SENSOR, GObject)
42
43 struct _CdSensorClass
44 {
45 GObjectClass parent_class;
46 };
47
48 typedef enum {
49 CD_SENSOR_DEBUG_MODE_REQUEST,
50 CD_SENSOR_DEBUG_MODE_RESPONSE,
51 CD_SENSOR_DEBUG_MODE_UNKNOWN
52 } CdSensorDebugMode;
53
54 /* when the data is unavailable */
55 #define CD_SENSOR_NO_VALUE -1.0f
56
57 CdSensor *cd_sensor_new (void);
58 GQuark cd_sensor_error_quark (void);
59
60 /* accessors */
61 const gchar *cd_sensor_get_id (CdSensor *sensor);
62 const gchar *cd_sensor_get_object_path (CdSensor *sensor);
63 const gchar *cd_sensor_get_device_path (CdSensor *sensor);
64 const gchar *cd_sensor_get_usb_path (CdSensor *sensor);
65 gboolean cd_sensor_register_object (CdSensor *sensor,
66 GDBusConnection *connection,
67 GDBusInterfaceInfo *info,
68 GError **error);
69 gboolean cd_sensor_set_from_device (CdSensor *sensor,
70 GUdevDevice *device,
71 GError **error);
72 GUdevDevice *cd_sensor_get_device (CdSensor *sensor);
73 void cd_sensor_set_index (CdSensor *sensor,
74 guint idx);
75 GUsbDevice *cd_sensor_open_usb_device (CdSensor *sensor,
76 gint config,
77 gint interface,
78 GError **error);
79 void cd_sensor_button_pressed (CdSensor *sensor);
80 gboolean cd_sensor_dump (CdSensor *sensor,
81 GString *data,
82 GError **error);
83 gboolean cd_sensor_get_is_embedded (CdSensor *sensor);
84 CdSensorKind cd_sensor_get_kind (CdSensor *sensor);
85 void cd_sensor_set_kind (CdSensor *sensor,
86 CdSensorKind kind);
87 gboolean cd_sensor_load (CdSensor *sensor,
88 GError **error);
89 void cd_sensor_set_state (CdSensor *sensor,
90 CdSensorState state);
91 void cd_sensor_set_state_in_idle (CdSensor *sensor,
92 CdSensorState state);
93 void cd_sensor_set_mode (CdSensor *sensor,
94 CdSensorCap mode);
95 CdSensorCap cd_sensor_get_mode (CdSensor *sensor);
96 void cd_sensor_set_serial (CdSensor *sensor,
97 const gchar *serial);
98 void cd_sensor_add_option (CdSensor *sensor,
99 const gchar *key,
100 GVariant *value);
101 void cd_sensor_add_cap (CdSensor *sensor,
102 CdSensorCap cap);
103
104 /* GModule */
105 void cd_sensor_get_sample_async (CdSensor *sensor,
106 CdSensorCap cap,
107 GCancellable *cancellable,
108 GAsyncReadyCallback callback,
109 gpointer user_data);
110 CdColorXYZ *cd_sensor_get_sample_finish (CdSensor *sensor,
111 GAsyncResult *res,
112 GError **error);
113 void cd_sensor_get_spectrum_async (CdSensor *sensor,
114 CdSensorCap cap,
115 GCancellable *cancellable,
116 GAsyncReadyCallback callback,
117 gpointer user_data);
118 CdSpectrum *cd_sensor_get_spectrum_finish (CdSensor *sensor,
119 GAsyncResult *res,
120 GError **error);
121 gboolean cd_sensor_coldplug (CdSensor *sensor,
122 GError **error);
123 gboolean cd_sensor_dump_device (CdSensor *sensor,
124 GString *data,
125 GError **error);
126 void cd_sensor_lock_async (CdSensor *sensor,
127 GCancellable *cancellable,
128 GAsyncReadyCallback callback,
129 gpointer user_data);
130 gboolean cd_sensor_lock_finish (CdSensor *sensor,
131 GAsyncResult *res,
132 GError **error);
133 void _cd_sensor_lock_async (CdSensor *sensor,
134 GCancellable *cancellable,
135 GAsyncReadyCallback callback,
136 gpointer user_data);
137 gboolean _cd_sensor_lock_finish (CdSensor *sensor,
138 GAsyncResult *res,
139 GError **error);
140 void cd_sensor_unlock_async (CdSensor *sensor,
141 GCancellable *cancellable,
142 GAsyncReadyCallback callback,
143 gpointer user_data);
144 gboolean cd_sensor_unlock_finish (CdSensor *sensor,
145 GAsyncResult *res,
146 GError **error);
147 void cd_sensor_set_options_async (CdSensor *sensor,
148 GHashTable *options,
149 GCancellable *cancellable,
150 GAsyncReadyCallback callback,
151 gpointer user_data);
152 gboolean cd_sensor_set_options_finish (CdSensor *sensor,
153 GAsyncResult *res,
154 GError **error);
155 void cd_sensor_debug_data (CdSensorDebugMode debug_mode,
156 const guint8 *data,
157 gsize length);
158 G_END_DECLS
159
160 #endif /* __CD_SENSOR_H */
161