1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- 2 * 3 * Copyright (C) 2013 Richard Hughes <richard@hughsie.com> 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 #if !defined (__HUEY_H_INSIDE__) && !defined (HUEY_COMPILATION) 23 #error "Only <huey.h> can be included directly." 24 #endif 25 26 #ifndef __HUEY_CTX_H 27 #define __HUEY_CTX_H 28 29 #include <glib-object.h> 30 #include <gio/gio.h> 31 #include <gusb.h> 32 #include <colord-private.h> 33 34 G_BEGIN_DECLS 35 36 #define HUEY_CTX_ERROR (huey_ctx_error_quark ()) 37 #define HUEY_CTX_TYPE_ERROR (huey_ctx_error_get_type ()) 38 39 #define HUEY_TYPE_CTX (huey_ctx_get_type ()) 40 G_DECLARE_DERIVABLE_TYPE (HueyCtx, huey_ctx, HUEY, CTX, GObject) 41 42 struct _HueyCtxClass 43 { 44 GObjectClass parent_class; 45 /*< private >*/ 46 /* Padding for future expansion */ 47 void (*_huey_ctx_reserved1) (void); 48 void (*_huey_ctx_reserved2) (void); 49 void (*_huey_ctx_reserved3) (void); 50 void (*_huey_ctx_reserved4) (void); 51 void (*_huey_ctx_reserved5) (void); 52 void (*_huey_ctx_reserved6) (void); 53 void (*_huey_ctx_reserved7) (void); 54 void (*_huey_ctx_reserved8) (void); 55 }; 56 57 /** 58 * HueyCtxError: 59 * @HUEY_CTX_ERROR_FAILED: the request failed for an unknown reason 60 * 61 * Errors that can be thrown 62 */ 63 typedef enum 64 { 65 HUEY_CTX_ERROR_FAILED, 66 HUEY_CTX_ERROR_NO_SUPPORT, 67 HUEY_CTX_ERROR_LAST 68 } HueyCtxError; 69 70 GQuark huey_ctx_error_quark (void); 71 HueyCtx *huey_ctx_new (void); 72 73 CdColorXYZ *huey_ctx_take_sample (HueyCtx *ctx, 74 CdSensorCap cap, 75 GError **error) 76 G_GNUC_WARN_UNUSED_RESULT; 77 GUsbDevice *huey_ctx_get_device (HueyCtx *ctx); 78 void huey_ctx_set_device (HueyCtx *ctx, 79 GUsbDevice *device); 80 gboolean huey_ctx_setup (HueyCtx *ctx, 81 GError **error) 82 G_GNUC_WARN_UNUSED_RESULT; 83 const CdMat3x3 *huey_ctx_get_calibration_lcd (HueyCtx *ctx); 84 const CdMat3x3 *huey_ctx_get_calibration_crt (HueyCtx *ctx); 85 gfloat huey_ctx_get_calibration_value (HueyCtx *ctx); 86 const CdVec3 *huey_ctx_get_dark_offset (HueyCtx *ctx); 87 const gchar *huey_ctx_get_unlock_string (HueyCtx *ctx); 88 89 G_END_DECLS 90 91 #endif /* __HUEY_CTX_H */ 92 93