| 1 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- |
| 2 |
* |
| 3 |
* Copyright (C) 2011-2016 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 |
#if !defined (__COLORHUG_H_INSIDE__) && !defined (CD_COMPILATION) |
| 23 |
#error "Only <colorhug.h> can be included directly." |
| 24 |
#endif |
| 25 |
|
| 26 |
#ifndef CH_DEVICE_H |
| 27 |
#define CH_DEVICE_H |
| 28 |
|
| 29 |
#include <glib.h> |
| 30 |
#include <gusb.h> |
| 31 |
#include <colord-private.h> |
| 32 |
|
| 33 |
#include "ch-common.h" |
| 34 |
|
| 35 |
G_BEGIN_DECLS |
| 36 |
|
| 37 |
#define CH_DEVICE_ERROR (ch_device_error_quark ()) |
| 38 |
|
| 39 |
GQuark ch_device_error_quark (void); |
| 40 |
gboolean ch_device_open (GUsbDevice *device, |
| 41 |
GError **error) |
| 42 |
G_GNUC_WARN_UNUSED_RESULT; |
| 43 |
gboolean ch_device_close (GUsbDevice *device, |
| 44 |
GError **error) |
| 45 |
G_GNUC_WARN_UNUSED_RESULT; |
| 46 |
gboolean ch_device_is_colorhug (GUsbDevice *device); |
| 47 |
ChDeviceMode ch_device_get_mode (GUsbDevice *device); |
| 48 |
void ch_device_write_command_async (GUsbDevice *device, |
| 49 |
guint8 cmd, |
| 50 |
const guint8 *buffer_in, |
| 51 |
gsize buffer_in_len, |
| 52 |
guint8 *buffer_out, |
| 53 |
gsize buffer_out_len, |
| 54 |
GCancellable *cancellable, |
| 55 |
GAsyncReadyCallback callback, |
| 56 |
gpointer user_data); |
| 57 |
gboolean ch_device_write_command_finish (GUsbDevice *device, |
| 58 |
GAsyncResult *res, |
| 59 |
GError **error) |
| 60 |
G_GNUC_WARN_UNUSED_RESULT; |
| 61 |
gboolean ch_device_write_command (GUsbDevice *device, |
| 62 |
guint8 cmd, |
| 63 |
const guint8 *buffer_in, |
| 64 |
gsize buffer_in_len, |
| 65 |
guint8 *buffer_out, |
| 66 |
gsize buffer_out_len, |
| 67 |
GCancellable *cancellable, |
| 68 |
GError **error) |
| 69 |
G_GNUC_WARN_UNUSED_RESULT; |
| 70 |
gboolean ch_device_check_firmware (GUsbDevice *device, |
| 71 |
const guint8 *data, |
| 72 |
gsize data_len, |
| 73 |
GError **error) |
| 74 |
G_GNUC_WARN_UNUSED_RESULT; |
| 75 |
guint16 ch_device_get_runcode_address (GUsbDevice *device); |
| 76 |
const gchar *ch_device_get_guid (GUsbDevice *device); |
| 77 |
gboolean ch_device_open_full (GUsbDevice *device, |
| 78 |
GCancellable *cancellable, |
| 79 |
GError **error); |
| 80 |
gboolean ch_device_self_test (GUsbDevice *device, |
| 81 |
GCancellable *cancellable, |
| 82 |
GError **error); |
| 83 |
gboolean ch_device_set_serial_number (GUsbDevice *device, |
| 84 |
guint32 value, |
| 85 |
GCancellable *cancellable, |
| 86 |
GError **error); |
| 87 |
gboolean ch_device_get_serial_number (GUsbDevice *device, |
| 88 |
guint32 *value, |
| 89 |
GCancellable *cancellable, |
| 90 |
GError **error); |
| 91 |
gboolean ch_device_set_leds (GUsbDevice *device, |
| 92 |
ChStatusLed value, |
| 93 |
GCancellable *cancellable, |
| 94 |
GError **error); |
| 95 |
gboolean ch_device_get_leds (GUsbDevice *device, |
| 96 |
ChStatusLed *value, |
| 97 |
GCancellable *cancellable, |
| 98 |
GError **error); |
| 99 |
gboolean ch_device_set_illuminants (GUsbDevice *device, |
| 100 |
ChIlluminant value, |
| 101 |
GCancellable *cancellable, |
| 102 |
GError **error); |
| 103 |
gboolean ch_device_get_illuminants (GUsbDevice *device, |
| 104 |
ChIlluminant *value, |
| 105 |
GCancellable *cancellable, |
| 106 |
GError **error); |
| 107 |
gboolean ch_device_set_pcb_errata (GUsbDevice *device, |
| 108 |
ChPcbErrata value, |
| 109 |
GCancellable *cancellable, |
| 110 |
GError **error); |
| 111 |
gboolean ch_device_get_pcb_errata (GUsbDevice *device, |
| 112 |
ChPcbErrata *value, |
| 113 |
GCancellable *cancellable, |
| 114 |
GError **error); |
| 115 |
gboolean ch_device_set_ccd_calibration (GUsbDevice *device, |
| 116 |
gdouble nm_start, |
| 117 |
gdouble c0, |
| 118 |
gdouble c1, |
| 119 |
gdouble c2, |
| 120 |
GCancellable *cancellable, |
| 121 |
GError **error); |
| 122 |
gboolean ch_device_set_crypto_key (GUsbDevice *device, |
| 123 |
guint32 keys[4], |
| 124 |
GCancellable *cancellable, |
| 125 |
GError **error); |
| 126 |
gboolean ch_device_get_ccd_calibration (GUsbDevice *device, |
| 127 |
gdouble *nm_start, |
| 128 |
gdouble *c0, |
| 129 |
gdouble *c1, |
| 130 |
gdouble *c2, |
| 131 |
GCancellable *cancellable, |
| 132 |
GError **error); |
| 133 |
gboolean ch_device_set_integral_time (GUsbDevice *device, |
| 134 |
guint16 value, |
| 135 |
GCancellable *cancellable, |
| 136 |
GError **error); |
| 137 |
gboolean ch_device_get_integral_time (GUsbDevice *device, |
| 138 |
guint16 *value, |
| 139 |
GCancellable *cancellable, |
| 140 |
GError **error); |
| 141 |
gboolean ch_device_get_temperature (GUsbDevice *device, |
| 142 |
gdouble *value, |
| 143 |
GCancellable *cancellable, |
| 144 |
GError **error); |
| 145 |
gboolean ch_device_get_adc_calibration_pos (GUsbDevice *device, |
| 146 |
gdouble *value, |
| 147 |
GCancellable *cancellable, |
| 148 |
GError **error); |
| 149 |
gboolean ch_device_get_adc_calibration_neg (GUsbDevice *device, |
| 150 |
gdouble *value, |
| 151 |
GCancellable *cancellable, |
| 152 |
GError **error); |
| 153 |
gboolean ch_device_get_error (GUsbDevice *device, |
| 154 |
ChError *status, |
| 155 |
ChCmd *cmd, |
| 156 |
GCancellable *cancellable, |
| 157 |
GError **error); |
| 158 |
gboolean ch_device_take_reading_spectral(GUsbDevice *device, |
| 159 |
ChSpectrumKind value, |
| 160 |
GCancellable *cancellable, |
| 161 |
GError **error); |
| 162 |
CdColorXYZ *ch_device_take_reading_xyz (GUsbDevice *device, |
| 163 |
guint16 calibration_idx, |
| 164 |
GCancellable *cancellable, |
| 165 |
GError **error); |
| 166 |
CdSpectrum *ch_device_get_spectrum (GUsbDevice *device, |
| 167 |
GCancellable *cancellable, |
| 168 |
GError **error); |
| 169 |
CdSpectrum *ch_device_get_spectrum_full (GUsbDevice *device, |
| 170 |
ChSpectrumKind kind, |
| 171 |
GCancellable *cancellable, |
| 172 |
GError **error); |
| 173 |
gboolean ch_device_set_spectrum_full (GUsbDevice *device, |
| 174 |
ChSpectrumKind kind, |
| 175 |
CdSpectrum *sp, |
| 176 |
GCancellable *cancellable, |
| 177 |
GError **error); |
| 178 |
gboolean ch_device_load_sram (GUsbDevice *device, |
| 179 |
GCancellable *cancellable, |
| 180 |
GError **error); |
| 181 |
gboolean ch_device_save_sram (GUsbDevice *device, |
| 182 |
GCancellable *cancellable, |
| 183 |
GError **error); |
| 184 |
GBytes *ch_device_read_sram (GUsbDevice *device, |
| 185 |
guint16 addr, |
| 186 |
guint16 len, |
| 187 |
GCancellable *cancellable, |
| 188 |
GError **error); |
| 189 |
gboolean ch_device_write_sram (GUsbDevice *device, |
| 190 |
guint16 addr, |
| 191 |
GBytes *data, |
| 192 |
GCancellable *cancellable, |
| 193 |
GError **error); |
| 194 |
|
| 195 |
G_END_DECLS |
| 196 |
|
| 197 |
#endif |