Debian Codegraph @

src/ArvGeneric.h

raw
1 /*
2 GigE interface wrapper on araviss
3 Copyright (C) 2016 Hendrik Beijeman ([email protected])
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 #ifndef CPP_ARV_GENERIC_H
20 #define CPP_ARV_GENERIC_H
21
22 //#extern "C" {
23 #include <stddef.h>
24 #include <stdio.h>
25 #include <arv.h>
26 //}
27
28 #include "ArvInterface.h"
29
30 using namespace arv;
31
32 class ArvGeneric : public arv::ArvCamera
33 {
34 public:
35 ArvGeneric(void *camera_device);
36 ~ArvGeneric();
37
38 bool is_connected();
39 bool is_exposing();
40 bool connect();
41 bool disconnect();
42 const char *vendor_name();
43 const char *model_name();
44 const char *device_id();
45 int get_frame_byte_size();
46 min_max_property<int> get_bin_x();
47 min_max_property<int> get_bin_y();
48 min_max_property<int> get_x_offset();
49 min_max_property<int> get_y_offset();
50 min_max_property<int> get_width();
51 min_max_property<int> get_height();
52 min_max_property<int> get_bpp();
53 min_max_property<double> get_pixel_pitch();
54 min_max_property<double> get_exposure();
55 min_max_property<double> get_gain();
56 min_max_property<double> get_frame_rate();
57
58 void set_bin(int const bin_x, int const bin_y);
59 void set_geometry(int const x, int const y, int const w, int const h);
60 void update_geometry(void);
61 void set_exposure_time(double const val);
62 void set_gain(double const val);
63
64 void exposure_start(void);
65 void exposure_abort(void);
66 ARV_EXPOSURE_STATUS exposure_poll(void (*fn_image_callback)(void *const, uint8_t const *const, size_t),
67 void *const usr_ptr);
68
69 protected:
70 void _init(void);
71 bool _configure(void);
72 void _test_exposure_and_abort(void);
73 template <typename T>
74 bool _get_bounds(void (*fn_arv_bounds)(::ArvCamera *, T *min, T *max, GError**), min_max_property<T> *prop);
75 template <typename T>
76 void _set_cam_exposure_property(void (*arv_set)(::ArvCamera *, T, GError**), min_max_property<T> *prop, T const new_val);
77
78 const char *_str_val(const char *s);
79 bool _get_initial_config();
80 bool _set_initial_config();
81 void _get_image(void (*fn_image_callback)(void *const, uint8_t const *const, size_t), void *const usr_ptr);
82
83 /* aravis library state variables */
84 ::ArvCamera *camera;
85 ::ArvDevice *dev;
86 ::ArvStream *stream;
87 ::ArvBuffer *buffer;
88 ::GError *error;
89
90 /* streaming, capturing functions */
91 ::ArvStream *_stream_create(void);
92 ::ArvBuffer *_buffer_create(void);
93 bool _stream_active();
94 void _stream_start();
95 void _stream_stop();
96 void _trigger_exposure();
97
98 bool stream_active;
99
100 /* Camera properties */
101 struct
102 {
103 min_max_property<gint> bin_x;
104 min_max_property<gint> bin_y;
105 min_max_property<gint> x_offset;
106 min_max_property<gint> y_offset;
107 min_max_property<gint> width;
108 min_max_property<gint> height;
109
110 min_max_property<double> pixel_pitch;
111
112 min_max_property<double> exposure;
113 min_max_property<double> gain;
114 min_max_property<double> frame_rate;
115
116 const char *vendor_name;
117 const char *model_name;
118 const char *device_id;
119 } cam;
120 };
121
122 #endif /*CPP_ARV_CAMERA_H*/