static gint64 arv_gc_enumeration_get_integer_value (ArvGcInteger *gc_integer, GError **error) { ArvGcEnumeration *gc_enumeration = ARV_GC_ENUMERATION (gc_integer); return arv_gc_enumeration_get_int_value (gc_enumeration, error); }
static void arv_gc_enumeration_finalize (GObject *object) { ArvGcEnumeration *enumeration = ARV_GC_ENUMERATION (object); g_slist_free (enumeration->entries); enumeration->entries = NULL; parent_class->finalize (object); }
static void arv_gc_enumeration_set_value_from_string (ArvGcFeatureNode *node, const char *string, GError **error) { GError *local_error = NULL; arv_gc_enumeration_set_string_value (ARV_GC_ENUMERATION (node), string, &local_error); if (local_error != NULL) g_propagate_error (error, local_error); }
void arv_camera_get_frame_rate_bounds (ArvCamera *camera, double *min, double *max) { ArvGcNode *feature; g_return_if_fail (ARV_IS_CAMERA (camera)); switch (camera->priv->vendor) { case ARV_CAMERA_VENDOR_TIS: feature = arv_device_get_feature (camera->priv->device, "FPS"); if (ARV_IS_GC_FEATURE_NODE (feature) && g_strcmp0 (arv_dom_node_get_node_name (ARV_DOM_NODE (feature)), "Enumeration") == 0) { gint64 *values; guint n_values; guint i; if (min != NULL) *min = 0; if (max != NULL) *max = 0; values = arv_gc_enumeration_get_available_int_values (ARV_GC_ENUMERATION (feature), &n_values, NULL); for (i = 0; i < n_values; i++) { if (values[i] > 0) { double s; s = (int)((10000000/(double) values[i]) * 100 + 0.5) / 100.0; if (s > *max && max != NULL) *max = s; if ((*min == 0 || *min > s) && min != NULL) *min = s; } } g_free (values); } else arv_device_get_float_feature_bounds (camera->priv->device, "FPS", min, max); break; case ARV_CAMERA_VENDOR_BASLER: case ARV_CAMERA_VENDOR_PROSILICA: arv_device_get_float_feature_bounds (camera->priv->device, "AcquisitionFrameRateAbs", min, max); break; case ARV_CAMERA_VENDOR_DALSA: case ARV_CAMERA_VENDOR_UNKNOWN: arv_device_get_float_feature_bounds (camera->priv->device, camera->priv->use_exposure_time_abs ? "AcquisitionFrameRateAbs": "AcquisitionFrameRate", min, max); break; } }
static const char * arv_gc_enumeration_get_value_as_string (ArvGcFeatureNode *node, GError **error) { const char *string; GError *local_error = NULL; string = arv_gc_enumeration_get_string_value (ARV_GC_ENUMERATION (node), &local_error); if (local_error != NULL) { g_propagate_error (error, local_error); return NULL; } return string; }
//! Serialize the tree, used by QArvCamera stream operators. void QArvCamera::QArvFeatureTree::recursiveSerialization( QTextStream& out, QArvCamera* camera, QArvCamera::QArvFeatureTree* tree) { auto node = arv_gc_get_node(camera->genicam, tree->feature()); if (tree->children().count() != 0) { if (QString("Root") != tree->feature()) out << "Category: " << tree->feature() << endl; foreach (auto child, tree->children()) { recursiveSerialization(out, camera, child); } return; } if (ARV_IS_GC_COMMAND(node)) return; out << "\t" << tree->feature() << "\t"; if (ARV_IS_GC_REGISTER_NODE(node) && QString(arv_dom_node_get_node_name(ARV_DOM_NODE(node))) == "IntReg") { QArvRegister r; r.length = arv_gc_register_get_length(ARV_GC_REGISTER(node), NULL); r.value = QByteArray(r.length, 0); arv_gc_register_get(ARV_GC_REGISTER(node), r.value.data(), r.length, NULL); out << "Register\t" << QString::number(r.length) << "\t" << QString("0x") + r.value.toHex() << endl; } else if (ARV_IS_GC_ENUMERATION(node)) { out << "Enumeration\t" << arv_gc_enumeration_get_string_value(ARV_GC_ENUMERATION(node), NULL) << endl; } else if (ARV_IS_GC_STRING(node)) { out << "String\t" << arv_gc_string_get_value(ARV_GC_STRING(node), NULL) << endl; } else if (ARV_IS_GC_FLOAT(node)) { out << "Float\t" << arv_gc_float_get_value(ARV_GC_FLOAT(node), NULL) << "\t" << arv_gc_float_get_unit(ARV_GC_FLOAT(node), NULL) << endl; } else if (ARV_IS_GC_BOOLEAN(node)) { out << "Boolean\t" << arv_gc_boolean_get_value(ARV_GC_BOOLEAN(node), NULL) << endl; } else if (ARV_IS_GC_INTEGER(node)) { out << "Integer\t" << arv_gc_integer_get_value(ARV_GC_INTEGER(node), NULL) << endl; } }
static gint64 arv_gc_enumeration_get_max_string_length (ArvGcString *gc_string, GError **error) { ArvGcEnumeration *gc_enumeration = ARV_GC_ENUMERATION (gc_string); const GSList *entries, *iter; gint64 length, max_length = 0; entries = arv_gc_enumeration_get_entries (gc_enumeration); for (iter = entries; iter != NULL; iter = iter->next) { const char *name; name = arv_gc_feature_node_get_name (iter->data); length = name != NULL ? strlen (name) : 0; if (length > max_length) max_length = length; } return max_length; }
static void arv_gc_enumeration_post_new_child (ArvDomNode *self, ArvDomNode *child) { ArvGcEnumeration *node = ARV_GC_ENUMERATION (self); if (ARV_IS_GC_PROPERTY_NODE (child)) { ArvGcPropertyNode *property_node = ARV_GC_PROPERTY_NODE (child); switch (arv_gc_property_node_get_node_type (property_node)) { case ARV_GC_PROPERTY_NODE_TYPE_VALUE: case ARV_GC_PROPERTY_NODE_TYPE_P_VALUE: node->value = property_node; break; default: ARV_DOM_NODE_CLASS (parent_class)->post_new_child (self, child); break; } } else if (ARV_IS_GC_ENUM_ENTRY (child)) node->entries = g_slist_prepend (node->entries, child); }
void arv_camera_set_frame_rate (ArvCamera *camera, double frame_rate) { ArvGcNode *feature; double minimum; double maximum; g_return_if_fail (ARV_IS_CAMERA (camera)); if (frame_rate <= 0.0) return; arv_camera_get_frame_rate_bounds(camera, &minimum, &maximum); if (frame_rate < minimum) frame_rate = minimum; if (frame_rate > maximum) frame_rate = maximum; switch (camera->priv->vendor) { case ARV_CAMERA_VENDOR_BASLER: arv_device_set_string_feature_value (camera->priv->device, "TriggerSelector", "AcquisitionStart"); arv_device_set_string_feature_value (camera->priv->device, "TriggerMode", "Off"); arv_device_set_string_feature_value (camera->priv->device, "TriggerSelector", "FrameStart"); arv_device_set_string_feature_value (camera->priv->device, "TriggerMode", "Off"); arv_device_set_integer_feature_value (camera->priv->device, "AcquisitionFrameRateEnable", 1); arv_device_set_float_feature_value (camera->priv->device, "AcquisitionFrameRateAbs", frame_rate); break; case ARV_CAMERA_VENDOR_PROSILICA: arv_device_set_string_feature_value (camera->priv->device, "TriggerSelector", "FrameStart"); arv_device_set_string_feature_value (camera->priv->device, "TriggerMode", "Off"); arv_device_set_float_feature_value (camera->priv->device, "AcquisitionFrameRateAbs", frame_rate); break; case ARV_CAMERA_VENDOR_TIS: arv_device_set_string_feature_value (camera->priv->device, "TriggerSelector", "FrameStart"); arv_device_set_string_feature_value (camera->priv->device, "TriggerMode", "Off"); feature = arv_device_get_feature (camera->priv->device, "FPS"); if (ARV_IS_GC_FEATURE_NODE (feature) && g_strcmp0 (arv_dom_node_get_node_name (ARV_DOM_NODE (feature)), "Enumeration") == 0) { gint64 *values; guint n_values; guint i; values = arv_gc_enumeration_get_available_int_values (ARV_GC_ENUMERATION (feature), &n_values, NULL); for (i = 0; i < n_values; i++) { if (values[i] > 0) { double e; e = (int)((10000000/(double) values[i]) * 100 + 0.5) / 100.0; if (e == frame_rate) { arv_gc_enumeration_set_int_value (ARV_GC_ENUMERATION (feature), values[i], NULL); break; } } } g_free (values); } else arv_device_set_float_feature_value (camera->priv->device, "FPS", frame_rate); break; case ARV_CAMERA_VENDOR_DALSA: case ARV_CAMERA_VENDOR_UNKNOWN: arv_device_set_string_feature_value (camera->priv->device, "TriggerSelector", "FrameStart"); arv_device_set_string_feature_value (camera->priv->device, "TriggerMode", "Off"); arv_device_set_float_feature_value (camera->priv->device, camera->priv->use_acquisition_frame_rate_abs ? "AcquisitionFrameRateAbs": "AcquisitionFrameRate", frame_rate); break; } }
static const char * arv_gc_enumeration_get_value_as_string (ArvGcFeatureNode *node) { return arv_gc_enumeration_get_string_value (ARV_GC_ENUMERATION (node)); }
static void arv_gc_enumeration_set_value_from_string (ArvGcFeatureNode *node, const char *string) { arv_gc_enumeration_set_string_value (ARV_GC_ENUMERATION (node), string); }