summaryrefslogtreecommitdiff
path: root/src/device.c
blob: 5d98b2a740e2843bc96a0d55eff2b67633ea5de0 (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
/* Camicro - Microscope camera viewer.
 *
 * Copyright (C) 2019 Nicolas Schodet
 *
 * 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.
 *
 * Contact :
 *        Web: http://ni.fr.eu.org/
 *      Email: <nico at ni.fr.eu.org>
 */
#include "device.h"

GQuark
device_error_quark(void)
{
    return g_quark_from_static_string("device-error-quark");
}

const struct device_info *
device_get_info(struct device *device)
{
    return device->get_info(device);
}

void
device_set_exposure(struct device *device, double exposure_ms)
{
    device->set_exposure(device, exposure_ms);
}

void
device_set_gain(struct device *device, double gain)
{
    device->set_gain(device, gain);
}

void
device_set_resolution(struct device *device, int width, int height,
	int stride)
{
    device->set_resolution(device, width, height, stride);
}

bool
device_start(struct device *device, GError **error)
{
    g_return_val_if_fail(error == NULL || *error == NULL, false);
    return device->start(device, error);
}

struct image *
device_read(struct device *device, GError **error)
{
    g_return_val_if_fail(error == NULL || *error == NULL, false);
    return device->read(device, error);
}

bool
device_stop(struct device *device, GError **error)
{
    g_return_val_if_fail(error == NULL || *error == NULL, false);
    return device->stop(device, error);
}

bool
device_close(struct device *device, GError **error)
{
    g_return_val_if_fail(error == NULL || *error == NULL, false);
    return device->close(device, error);
}