summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cameras/pylon_camera.cpp28
-rw-r--r--src/cameras/pylon_camera.h3
-rw-r--r--src/cameras/uca-pylon-camera.c23
3 files changed, 51 insertions, 3 deletions
diff --git a/src/cameras/pylon_camera.cpp b/src/cameras/pylon_camera.cpp
index b73bc18..094e3c8 100644
--- a/src/cameras/pylon_camera.cpp
+++ b/src/cameras/pylon_camera.cpp
@@ -185,6 +185,34 @@ void pylon_camera_set_roi(guint16 roi_x, guint16 roi_y, guint16 roi_width, guint
}
}
+void pylon_camera_get_gain(gint* gain, GError** error)
+{
+ g_assert(pGrabber);
+ try
+ {
+ yat::Any gain_result;
+ pGrabber->get_gain(gain_result);
+ *gain = yat::any_cast<gint>(gain_result);
+ }
+ catch (const yat::Exception& e)
+ {
+ yat_exception_to_gerror(e, error);
+ }
+}
+
+void pylon_camera_set_gain(gint gain, GError** error)
+{
+ g_assert(pGrabber);
+ try
+ {
+ pGrabber->set_gain(yat::Any(gain));
+ }
+ catch (const yat::Exception& e)
+ {
+ yat_exception_to_gerror(e, error);
+ }
+}
+
void pylon_camera_start_acquision(GError** error)
{
g_assert(pGrabber);
diff --git a/src/cameras/pylon_camera.h b/src/cameras/pylon_camera.h
index f5c7cdc..89b450b 100644
--- a/src/cameras/pylon_camera.h
+++ b/src/cameras/pylon_camera.h
@@ -17,6 +17,9 @@ void pylon_camera_get_bit_depth(guint* depth, GError** error);
void pylon_camera_get_roi(guint16* roi_x, guint16* roi_y, guint16* roi_width, guint16* roi_height, GError** error);
void pylon_camera_set_roi(guint16 roi_x, guint16 roi_y, guint16 roi_width, guint16 roi_height, GError** error);
+void pylon_camera_get_gain(gint* gain, GError** error);
+void pylon_camera_set_gain(gint gain, GError** error);
+
void pylon_camera_start_acquision(GError** error);
void pylon_camera_stop_acquision(GError** error);
void pylon_camera_grab(gpointer *data, GError** error);
diff --git a/src/cameras/uca-pylon-camera.c b/src/cameras/uca-pylon-camera.c
index 152ff01..23aa1a3 100644
--- a/src/cameras/uca-pylon-camera.c
+++ b/src/cameras/uca-pylon-camera.c
@@ -52,6 +52,7 @@ GQuark uca_pylon_camera_error_quark()
enum {
PROP_ROI_WIDTH_DEFAULT = N_BASE_PROPERTIES,
PROP_ROI_HEIGHT_DEFAULT,
+ PROP_GAIN,
N_PROPERTIES
};
@@ -195,9 +196,11 @@ static void uca_pylon_camera_set_property(GObject *object, guint property_id, co
break;
case PROP_EXPOSURE_TIME:
- {
- pylon_camera_set_exposure_time(g_value_get_double(value), &error);
- }
+ pylon_camera_set_exposure_time(g_value_get_double(value), &error);
+ break;
+
+ case PROP_GAIN:
+ pylon_camera_set_gain(g_value_get_int(value), &error);
break;
default:
@@ -302,6 +305,14 @@ static void uca_pylon_camera_get_property(GObject *object, guint property_id, GV
g_value_set_uint(value, priv->height);
break;
+ case PROP_GAIN:
+ {
+ gint gain=0;
+ pylon_camera_get_gain(&gain, &error);
+ g_value_set_int(value, gain);
+ }
+ break;
+
case PROP_ROI_WIDTH_MULTIPLIER:
g_value_set_uint(value, 1);
break;
@@ -397,6 +408,12 @@ static void uca_pylon_camera_class_init(UcaPylonCameraClass *klass)
"ROI height default value",
0, G_MAXUINT, 0,
G_PARAM_READABLE);
+ pylon_properties[PROP_GAIN] =
+ g_param_spec_int("gain",
+ "gain",
+ "gain",
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE);
/*g_object_class_install_property(gobject_class, PROP_ROI_X, pylon_properties[PROP_ROI_X]);