1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2  *
3  * Copyright (C) 2010-2013 Richard Hughes <richard@hughsie.com>
4  *
5  * Licensed under the GNU Lesser General Public License Version 2.1
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library 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 GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
20  */
21 
22 #if !defined (__COLORD_H_INSIDE__) && !defined (CD_COMPILATION)
23 #error "Only <colord.h> can be included directly."
24 #endif
25 
26 #ifndef __CD_CLIENT_H
27 #define __CD_CLIENT_H
28 
29 #include <glib-object.h>
30 #include <gio/gio.h>
31 
32 #include "cd-device.h"
33 #include "cd-profile.h"
34 #include "cd-sensor.h"
35 
36 G_BEGIN_DECLS
37 
38 #define CD_CLIENT_ERROR		(cd_client_error_quark ())
39 #define CD_CLIENT_TYPE_ERROR	(cd_client_error_get_type ())
40 
41 #define CD_TYPE_CLIENT (cd_client_get_type ())
42 G_DECLARE_DERIVABLE_TYPE (CdClient, cd_client, CD, CLIENT, GObject)
43 
44 struct _CdClientClass
45 {
46 	GObjectClass		 parent_class;
47 	void			(*device_added)		(CdClient		*client,
48 							 CdDevice		*device);
49 	void			(*device_removed)	(CdClient		*client,
50 							 CdDevice		*device);
51 	void			(*device_changed)	(CdClient		*client,
52 							 CdDevice		*device);
53 	void			(*profile_added)	(CdClient		*client,
54 							 CdProfile		*profile);
55 	void			(*profile_removed)	(CdClient		*client,
56 							 CdProfile		*profile);
57 	void			(*profile_changed)	(CdClient		*client,
58 							 CdProfile		*profile);
59 	void			(*sensor_added)		(CdClient		*client,
60 							 CdSensor		*sensor);
61 	void			(*sensor_removed)	(CdClient		*client,
62 							 CdSensor		*sensor);
63 	void			(*sensor_changed)	(CdClient		*client,
64 							 CdSensor		*sensor);
65 	void			(*changed)              (CdClient		*client);
66 	/*< private >*/
67 	/* Padding for future expansion */
68 	void (*_cd_client_reserved1) (void);
69 	void (*_cd_client_reserved2) (void);
70 	void (*_cd_client_reserved3) (void);
71 	void (*_cd_client_reserved4) (void);
72 	void (*_cd_client_reserved5) (void);
73 	void (*_cd_client_reserved6) (void);
74 	void (*_cd_client_reserved7) (void);
75 	void (*_cd_client_reserved8) (void);
76 };
77 
78 GQuark		 cd_client_error_quark			(void);
79 CdClient	*cd_client_new				(void);
80 
81 /* async */
82 void		 cd_client_connect			(CdClient	*client,
83 							 GCancellable	*cancellable,
84 							 GAsyncReadyCallback callback,
85 							 gpointer	 user_data);
86 gboolean	 cd_client_connect_finish		(CdClient	*client,
87 							 GAsyncResult	*res,
88 							 GError		**error)
89 							 G_GNUC_WARN_UNUSED_RESULT;
90 void		cd_client_create_device			(CdClient	*client,
91 							 const gchar	*id,
92 							 CdObjectScope	 scope,
93 							 GHashTable	*properties,
94 							 GCancellable	*cancellable,
95 							 GAsyncReadyCallback callback,
96 							 gpointer	 user_data);
97 CdDevice	*cd_client_create_device_finish		(CdClient	*client,
98 							 GAsyncResult	*res,
99 							 GError		**error)
100 							 G_GNUC_WARN_UNUSED_RESULT;
101 void		cd_client_create_profile		(CdClient	*client,
102 							 const gchar	*id,
103 							 CdObjectScope	 scope,
104 							 GHashTable	*properties,
105 							 GCancellable	*cancellable,
106 							 GAsyncReadyCallback callback,
107 							 gpointer	 user_data);
108 CdProfile	*cd_client_create_profile_finish	(CdClient	*client,
109 							 GAsyncResult	*res,
110 							 GError		**error)
111 							 G_GNUC_WARN_UNUSED_RESULT;
112 void		 cd_client_create_profile_for_icc	(CdClient	*client,
113 							 CdIcc		*icc,
114 							 CdObjectScope	 scope,
115 							 GCancellable	*cancellable,
116 							 GAsyncReadyCallback callback,
117 							 gpointer	 user_data);
118 CdProfile	*cd_client_create_profile_for_icc_finish (CdClient	*client,
119 							 GAsyncResult	*res,
120 							 GError		**error)
121 							 G_GNUC_WARN_UNUSED_RESULT;
122 void		cd_client_import_profile		(CdClient	*client,
123 							 GFile		*file,
124 							 GCancellable	*cancellable,
125 							 GAsyncReadyCallback callback,
126 							 gpointer	 user_data);
127 CdProfile	*cd_client_import_profile_finish	(CdClient	*client,
128 							 GAsyncResult	*res,
129 							 GError		**error)
130 							 G_GNUC_WARN_UNUSED_RESULT;
131 void		 cd_client_delete_device		(CdClient	*client,
132 							 CdDevice	*device,
133 							 GCancellable	*cancellable,
134 							 GAsyncReadyCallback callback,
135 							 gpointer	 user_data);
136 gboolean	 cd_client_delete_device_finish		(CdClient	*client,
137 							 GAsyncResult	*res,
138 							 GError		**error)
139 							 G_GNUC_WARN_UNUSED_RESULT;
140 void		 cd_client_delete_profile		(CdClient	*client,
141 							 CdProfile	*profile,
142 							 GCancellable	*cancellable,
143 							 GAsyncReadyCallback callback,
144 							 gpointer	 user_data);
145 gboolean	 cd_client_delete_profile_finish	(CdClient	*client,
146 							 GAsyncResult	*res,
147 							 GError		**error)
148 							 G_GNUC_WARN_UNUSED_RESULT;
149 void		cd_client_find_device			(CdClient	*client,
150 							 const gchar	*id,
151 							 GCancellable	*cancellable,
152 							 GAsyncReadyCallback callback,
153 							 gpointer	 user_data);
154 CdDevice	*cd_client_find_device_finish 		(CdClient	*client,
155 							 GAsyncResult	*res,
156 							 GError		**error)
157 							 G_GNUC_WARN_UNUSED_RESULT;
158 void		cd_client_find_device_by_property	(CdClient	*client,
159 							 const gchar	*key,
160 							 const gchar	*value,
161 							 GCancellable	*cancellable,
162 							 GAsyncReadyCallback callback,
163 							 gpointer	 user_data);
164 CdDevice	*cd_client_find_device_by_property_finish (CdClient	*client,
165 							 GAsyncResult	*res,
166 							 GError		**error)
167 							 G_GNUC_WARN_UNUSED_RESULT;
168 void		cd_client_find_profile			(CdClient	*client,
169 							 const gchar	*id,
170 							 GCancellable	*cancellable,
171 							 GAsyncReadyCallback callback,
172 							 gpointer	 user_data);
173 CdProfile	*cd_client_find_profile_finish 		(CdClient	*client,
174 							 GAsyncResult	*res,
175 							 GError		**error)
176 							 G_GNUC_WARN_UNUSED_RESULT;
177 
178 void		cd_client_find_profile_by_filename	(CdClient	*client,
179 							 const gchar	*filename,
180 							 GCancellable	*cancellable,
181 							 GAsyncReadyCallback callback,
182 							 gpointer	 user_data);
183 CdProfile	*cd_client_find_profile_by_filename_finish (CdClient	*client,
184 							 GAsyncResult	*res,
185 							 GError		**error)
186 							 G_GNUC_WARN_UNUSED_RESULT;
187 void		cd_client_get_standard_space		(CdClient	*client,
188 							 CdStandardSpace standard_space,
189 							 GCancellable	*cancellable,
190 							 GAsyncReadyCallback callback,
191 							 gpointer	 user_data);
192 CdProfile	*cd_client_get_standard_space_finish	(CdClient	*client,
193 							 GAsyncResult	*res,
194 							 GError		**error)
195 							 G_GNUC_WARN_UNUSED_RESULT;
196 void		 cd_client_get_devices			(CdClient	*client,
197 							 GCancellable	*cancellable,
198 							 GAsyncReadyCallback callback,
199 							 gpointer	 user_data);
200 GPtrArray	*cd_client_get_devices_finish		(CdClient	*client,
201 							 GAsyncResult	*res,
202 							 GError		**error)
203 							 G_GNUC_WARN_UNUSED_RESULT;
204 void		 cd_client_get_devices_by_kind		(CdClient	*client,
205 							 CdDeviceKind	 kind,
206 							 GCancellable	*cancellable,
207 							 GAsyncReadyCallback callback,
208 							 gpointer	 user_data);
209 GPtrArray	*cd_client_get_devices_by_kind_finish	(CdClient	*client,
210 							 GAsyncResult	*res,
211 							 GError		**error)
212 							 G_GNUC_WARN_UNUSED_RESULT;
213 void		 cd_client_get_profiles			(CdClient	*client,
214 							 GCancellable	*cancellable,
215 							 GAsyncReadyCallback callback,
216 							 gpointer	 user_data);
217 GPtrArray	*cd_client_get_profiles_finish		(CdClient	*client,
218 							 GAsyncResult	*res,
219 							 GError		**error)
220 							 G_GNUC_WARN_UNUSED_RESULT;
221 void		 cd_client_get_sensors			(CdClient	*client,
222 							 GCancellable	*cancellable,
223 							 GAsyncReadyCallback callback,
224 							 gpointer	 user_data);
225 GPtrArray	*cd_client_get_sensors_finish		(CdClient	*client,
226 							 GAsyncResult	*res,
227 							 GError		**error)
228 							 G_GNUC_WARN_UNUSED_RESULT;
229 void		cd_client_find_profile_by_property	(CdClient	*client,
230 							 const gchar	*key,
231 							 const gchar	*value,
232 							 GCancellable	*cancellable,
233 							 GAsyncReadyCallback callback,
234 							 gpointer	 user_data);
235 CdProfile	*cd_client_find_profile_by_property_finish (CdClient	*client,
236 							 GAsyncResult	*res,
237 							 GError		**error)
238 							 G_GNUC_WARN_UNUSED_RESULT;
239 void		cd_client_find_sensor			(CdClient	*client,
240 							 const gchar	*id,
241 							 GCancellable	*cancellable,
242 							 GAsyncReadyCallback callback,
243 							 gpointer	 user_data);
244 CdSensor	*cd_client_find_sensor_finish 		(CdClient	*client,
245 							 GAsyncResult	*res,
246 							 GError		**error)
247 							 G_GNUC_WARN_UNUSED_RESULT;
248 
249 /* getters */
250 gboolean	 cd_client_get_connected		(CdClient	*client);
251 gboolean	 cd_client_get_has_server		(CdClient	*client);
252 const gchar	*cd_client_get_daemon_version		(CdClient	*client);
253 const gchar	*cd_client_get_system_vendor		(CdClient	*client);
254 const gchar	*cd_client_get_system_model		(CdClient	*client);
255 
256 G_END_DECLS
257 
258 #endif /* __CD_CLIENT_H */
259 
260