diff options
-rw-r--r-- | src/cameras/uca-mock-camera.c | 4 | ||||
-rw-r--r-- | src/cameras/uca-pco-camera.c | 4 | ||||
-rw-r--r-- | src/cameras/uca-pf-camera.c | 14 | ||||
-rw-r--r-- | src/cameras/uca-ufo-camera.c | 10 | ||||
-rw-r--r-- | src/uca-camera.c | 55 | ||||
-rw-r--r-- | src/uca-camera.h | 1 |
6 files changed, 42 insertions, 46 deletions
diff --git a/src/cameras/uca-mock-camera.c b/src/cameras/uca-mock-camera.c index a149e5b..59c5ae8 100644 --- a/src/cameras/uca-mock-camera.c +++ b/src/cameras/uca-mock-camera.c @@ -28,6 +28,7 @@ enum { }; static const gint mock_overrideables[] = { + PROP_NAME, PROP_SENSOR_WIDTH, PROP_SENSOR_HEIGHT, PROP_SENSOR_BITDEPTH, @@ -286,6 +287,9 @@ static void uca_mock_camera_get_property(GObject *object, guint property_id, GVa UcaMockCameraPrivate *priv = UCA_MOCK_CAMERA_GET_PRIVATE(object); switch (property_id) { + case PROP_NAME: + g_value_set_string(value, "mock camera"); + break; case PROP_SENSOR_WIDTH: g_value_set_uint(value, priv->width); break; diff --git a/src/cameras/uca-pco-camera.c b/src/cameras/uca-pco-camera.c index 5a52834..a56392f 100644 --- a/src/cameras/uca-pco-camera.c +++ b/src/cameras/uca-pco-camera.c @@ -93,8 +93,7 @@ GQuark uca_pco_camera_error_quark() } enum { - PROP_NAME = N_BASE_PROPERTIES, - PROP_SENSOR_EXTENDED, + PROP_SENSOR_EXTENDED = N_BASE_PROPERTIES, PROP_SENSOR_WIDTH_EXTENDED, PROP_SENSOR_HEIGHT_EXTENDED, PROP_SENSOR_TEMPERATURE, @@ -118,6 +117,7 @@ enum { }; static gint base_overrideables[] = { + PROP_NAME, PROP_SENSOR_WIDTH, PROP_SENSOR_HEIGHT, PROP_SENSOR_BITDEPTH, diff --git a/src/cameras/uca-pf-camera.c b/src/cameras/uca-pf-camera.c index 3bbd406..90f887b 100644 --- a/src/cameras/uca-pf-camera.c +++ b/src/cameras/uca-pf-camera.c @@ -62,6 +62,7 @@ GQuark uca_pf_camera_error_quark() } static gint base_overrideables[] = { + PROP_NAME, PROP_SENSOR_WIDTH, PROP_SENSOR_HEIGHT, PROP_SENSOR_BITDEPTH, @@ -81,12 +82,10 @@ static gint base_overrideables[] = { }; enum { - PROP_NAME = N_BASE_PROPERTIES, + PROP_FOO = N_BASE_PROPERTIES, N_PROPERTIES }; -static GParamSpec *pf_properties[N_PROPERTIES] = { NULL, }; - struct _UcaPfCameraPrivate { guint roi_width; @@ -337,15 +336,6 @@ static void uca_pf_camera_class_init(UcaPfCameraClass *klass) for (guint i = 0; base_overrideables[i] != 0; i++) g_object_class_override_property(gobject_class, base_overrideables[i], uca_camera_props[base_overrideables[i]]); - pf_properties[PROP_NAME] = - g_param_spec_string("name", - "Name of the camera", - "Name of the camera", - "", G_PARAM_READABLE); - - for (guint id = N_BASE_PROPERTIES; id < N_PROPERTIES; id++) - g_object_class_install_property(gobject_class, id, pf_properties[id]); - g_type_class_add_private(klass, sizeof(UcaPfCameraPrivate)); } diff --git a/src/cameras/uca-ufo-camera.c b/src/cameras/uca-ufo-camera.c index de8b128..347f3c1 100644 --- a/src/cameras/uca-ufo-camera.c +++ b/src/cameras/uca-ufo-camera.c @@ -54,12 +54,12 @@ GQuark uca_ufo_camera_error_quark() } enum { - PROP_NAME = N_BASE_PROPERTIES, - PROP_UFO_START, + PROP_UFO_START = N_BASE_PROPERTIES, N_MAX_PROPERTIES = 512 }; static gint base_overrideables[] = { + PROP_NAME, PROP_SENSOR_WIDTH, PROP_SENSOR_HEIGHT, PROP_SENSOR_HORIZONTAL_BINNING, @@ -389,12 +389,6 @@ static void uca_ufo_camera_class_init(UcaUfoCameraClass *klass) for (guint i = 0; base_overrideables[i] != 0; i++) g_object_class_override_property(gobject_class, base_overrideables[i], uca_camera_props[base_overrideables[i]]); - ufo_properties[PROP_NAME] = - g_param_spec_string("name", - "Name of the camera", - "Name of the camera", - "", G_PARAM_READABLE); - /* * This automatic property installation includes the properties created * dynamically in uca_ufo_camera_new(). diff --git a/src/uca-camera.c b/src/uca-camera.c index b36cd3a..1584569 100644 --- a/src/uca-camera.c +++ b/src/uca-camera.c @@ -74,7 +74,7 @@ static gchar *uca_camera_types[] = { #ifdef HAVE_PHOTON_FOCUS "pf", #endif - NULL + NULL }; enum { @@ -87,6 +87,7 @@ enum { */ const gchar *uca_camera_props[N_BASE_PROPERTIES] = { NULL, + "name", "sensor-width", "sensor-height", "sensor-bitdepth", @@ -169,99 +170,105 @@ static void uca_camera_class_init(UcaCameraClass *klass) klass->stop_recording = NULL; klass->grab = NULL; - camera_properties[PROP_SENSOR_WIDTH] = + camera_properties[PROP_NAME] = + g_param_spec_string("name", + "Name of the camera", + "Name of the camera", + "", G_PARAM_READABLE); + + camera_properties[PROP_SENSOR_WIDTH] = g_param_spec_uint(uca_camera_props[PROP_SENSOR_WIDTH], "Width of sensor", "Width of the sensor in pixels", 1, G_MAXUINT, 1, G_PARAM_READABLE); - camera_properties[PROP_SENSOR_HEIGHT] = + camera_properties[PROP_SENSOR_HEIGHT] = g_param_spec_uint(uca_camera_props[PROP_SENSOR_HEIGHT], "Height of sensor", "Height of the sensor in pixels", 1, G_MAXUINT, 1, G_PARAM_READABLE); - camera_properties[PROP_SENSOR_BITDEPTH] = + camera_properties[PROP_SENSOR_BITDEPTH] = g_param_spec_uint(uca_camera_props[PROP_SENSOR_BITDEPTH], "Number of bits per pixel", "Number of bits per pixel", 1, 32, 1, G_PARAM_READABLE); - camera_properties[PROP_SENSOR_HORIZONTAL_BINNING] = + camera_properties[PROP_SENSOR_HORIZONTAL_BINNING] = g_param_spec_uint(uca_camera_props[PROP_SENSOR_HORIZONTAL_BINNING], "Horizontal binning", "Number of sensor ADCs that are combined to one pixel in horizontal direction", 1, G_MAXUINT, 1, G_PARAM_READWRITE); - camera_properties[PROP_SENSOR_HORIZONTAL_BINNINGS] = + camera_properties[PROP_SENSOR_HORIZONTAL_BINNINGS] = g_param_spec_value_array(uca_camera_props[PROP_SENSOR_HORIZONTAL_BINNINGS], "Array of possible binnings", "Array of possible binnings in horizontal direction", g_param_spec_uint( uca_camera_props[PROP_SENSOR_HORIZONTAL_BINNING], - "Number of ADCs", + "Number of ADCs", "Number of ADCs that make up one pixel", 1, G_MAXUINT, 1, G_PARAM_READABLE), G_PARAM_READABLE); - camera_properties[PROP_SENSOR_VERTICAL_BINNING] = + camera_properties[PROP_SENSOR_VERTICAL_BINNING] = g_param_spec_uint(uca_camera_props[PROP_SENSOR_VERTICAL_BINNING], "Vertical binning", "Number of sensor ADCs that are combined to one pixel in vertical direction", 1, G_MAXUINT, 1, G_PARAM_READWRITE); - camera_properties[PROP_SENSOR_VERTICAL_BINNINGS] = + camera_properties[PROP_SENSOR_VERTICAL_BINNINGS] = g_param_spec_value_array(uca_camera_props[PROP_SENSOR_VERTICAL_BINNINGS], "Array of possible binnings", "Array of possible binnings in vertical direction", g_param_spec_uint( uca_camera_props[PROP_SENSOR_VERTICAL_BINNING], - "Number of ADCs", + "Number of ADCs", "Number of ADCs that make up one pixel", 1, G_MAXUINT, 1, G_PARAM_READABLE), G_PARAM_READABLE); - camera_properties[PROP_SENSOR_MAX_FRAME_RATE] = + camera_properties[PROP_SENSOR_MAX_FRAME_RATE] = g_param_spec_float(uca_camera_props[PROP_SENSOR_MAX_FRAME_RATE], "Maximum frame rate", "Maximum frame rate at full frame resolution", 0.0f, G_MAXFLOAT, 1.0f, G_PARAM_READABLE); - camera_properties[PROP_TRIGGER_MODE] = - g_param_spec_enum("trigger-mode", + camera_properties[PROP_TRIGGER_MODE] = + g_param_spec_enum("trigger-mode", "Trigger mode", "Trigger mode", UCA_TYPE_CAMERA_TRIGGER, UCA_CAMERA_TRIGGER_AUTO, G_PARAM_READWRITE); - camera_properties[PROP_ROI_X] = + camera_properties[PROP_ROI_X] = g_param_spec_uint(uca_camera_props[PROP_ROI_X], "Horizontal coordinate", "Horizontal coordinate", 0, G_MAXUINT, 0, G_PARAM_READWRITE); - camera_properties[PROP_ROI_Y] = + camera_properties[PROP_ROI_Y] = g_param_spec_uint(uca_camera_props[PROP_ROI_Y], "Vertical coordinate", "Vertical coordinate", 0, G_MAXUINT, 0, G_PARAM_READWRITE); - camera_properties[PROP_ROI_WIDTH] = + camera_properties[PROP_ROI_WIDTH] = g_param_spec_uint(uca_camera_props[PROP_ROI_WIDTH], "Width", "Width of the region of interest", 1, G_MAXUINT, 1, G_PARAM_READWRITE); - camera_properties[PROP_ROI_HEIGHT] = + camera_properties[PROP_ROI_HEIGHT] = g_param_spec_uint(uca_camera_props[PROP_ROI_HEIGHT], "Height", "Height of the region of interest", @@ -289,31 +296,31 @@ static void uca_camera_class_init(UcaCameraClass *klass) 0.0, G_MAXDOUBLE, 1.0, G_PARAM_READWRITE); - camera_properties[PROP_HAS_STREAMING] = + camera_properties[PROP_HAS_STREAMING] = g_param_spec_boolean(uca_camera_props[PROP_HAS_STREAMING], "Streaming capability", "Is the camera able to stream the data", TRUE, G_PARAM_READABLE); - camera_properties[PROP_HAS_CAMRAM_RECORDING] = + camera_properties[PROP_HAS_CAMRAM_RECORDING] = g_param_spec_boolean(uca_camera_props[PROP_HAS_CAMRAM_RECORDING], "Cam-RAM capability", "Is the camera able to record the data in-camera", FALSE, G_PARAM_READABLE); - camera_properties[PROP_TRANSFER_ASYNCHRONOUSLY] = + camera_properties[PROP_TRANSFER_ASYNCHRONOUSLY] = g_param_spec_boolean(uca_camera_props[PROP_TRANSFER_ASYNCHRONOUSLY], "Specify whether data should be transfered asynchronously", "Specify whether data should be transfered asynchronously using a specified callback", FALSE, G_PARAM_READWRITE); - camera_properties[PROP_IS_RECORDING] = + camera_properties[PROP_IS_RECORDING] = g_param_spec_boolean(uca_camera_props[PROP_IS_RECORDING], "Is camera recording", "Is the camera currently recording", FALSE, G_PARAM_READABLE); - camera_properties[PROP_IS_READOUT] = + camera_properties[PROP_IS_READOUT] = g_param_spec_boolean(uca_camera_props[PROP_IS_READOUT], "Is camera in readout mode", "Is camera in readout mode", @@ -346,7 +353,7 @@ static void uca_camera_init(UcaCamera *camera) * { * // Do whatever is necessary. In the end you will have some kind of * // Tango object t which needs to somehow hook up to the properties. A - * // list of all available properties can be enumerated with + * // list of all available properties can be enumerated with * // g_object_class_list_properties(G_OBJECT_CLASS(camera), * // &n_properties); * @@ -418,7 +425,7 @@ UcaCamera *uca_camera_new(const gchar *type, GError **error) if ((tmp_error == NULL) && (camera == NULL)) { g_set_error(error, UCA_CAMERA_ERROR, UCA_CAMERA_ERROR_NOT_FOUND, - "Camera type %s not found", type); + "Camera type %s not found", type); return NULL; } diff --git a/src/uca-camera.h b/src/uca-camera.h index 8462b3d..8924fa8 100644 --- a/src/uca-camera.h +++ b/src/uca-camera.h @@ -52,6 +52,7 @@ typedef struct _UcaCameraPrivate UcaCameraPrivate; enum { PROP_0 = 0, + PROP_NAME, PROP_SENSOR_WIDTH, PROP_SENSOR_HEIGHT, PROP_SENSOR_BITDEPTH, |