Ejemplo n.º 1
0
void
arv_gc_property_node_set_double (ArvGcPropertyNode *node, double v_double, GError **error)
{
	ArvDomNode *pvalue_node;

	g_return_if_fail (ARV_IS_GC_PROPERTY_NODE (node));
	g_return_if_fail (error == NULL || *error == NULL);

	pvalue_node = _get_pvalue_node (node);
	if (pvalue_node == NULL) {
		char buffer[G_ASCII_DTOSTR_BUF_SIZE];

		g_ascii_dtostr (buffer, G_ASCII_DTOSTR_BUF_SIZE, v_double);
		_set_value_data (node, buffer);
		return ;
	}

	if (ARV_IS_GC_FLOAT (pvalue_node)) {
		GError *local_error = NULL;

		arv_gc_float_set_value (ARV_GC_FLOAT (pvalue_node), v_double, &local_error);

		if (local_error != NULL)
			g_propagate_error (error, local_error);

		return;
	}

	arv_warning_genicam ("[GcPropertyNode::set_double] Invalid linked node '%s'",
			     arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (pvalue_node)));
}
Ejemplo n.º 2
0
double
arv_gc_property_node_get_double (ArvGcPropertyNode *node, GError **error)
{
	ArvDomNode *pvalue_node;

	g_return_val_if_fail (ARV_IS_GC_PROPERTY_NODE (node), 0.0);
	g_return_val_if_fail (error == NULL || *error == NULL, 0.0);

	pvalue_node = _get_pvalue_node (node);
	if (pvalue_node == NULL)
		return g_ascii_strtod (_get_value_data (node), NULL);


	if (ARV_IS_GC_FLOAT (pvalue_node)) {
		GError *local_error = NULL;
		double value;

		value = arv_gc_float_get_value (ARV_GC_FLOAT (pvalue_node), &local_error);

		if (local_error != NULL)
			g_propagate_error (error, local_error);

		return value;
	}

	arv_warning_genicam ("[GcPropertyNode::get_double] Invalid node '%s'",
			     arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (pvalue_node)));

	return 0.0;
}
Ejemplo n.º 3
0
void
arv_gc_float_set_value (ArvGcFloat *gc_float, double value, GError **error)
{
	g_return_if_fail (ARV_IS_GC_FLOAT (gc_float));
	g_return_if_fail (error == NULL || *error == NULL);

	ARV_GC_FLOAT_GET_INTERFACE (gc_float)->set_value (gc_float, value, error);
}
Ejemplo n.º 4
0
double
arv_gc_float_get_value (ArvGcFloat *gc_float, GError **error)
{
	g_return_val_if_fail (ARV_IS_GC_FLOAT (gc_float), 0.0);
	g_return_val_if_fail (error == NULL || *error == NULL, 0.0);

	return ARV_GC_FLOAT_GET_INTERFACE (gc_float)->get_value (gc_float, error);
}
Ejemplo n.º 5
0
ArvCamera *
arv_camera_new (const char *name)
{
    ArvCamera *camera;
    ArvDevice *device;

    device = arv_open_device (name);

    if (!ARV_IS_DEVICE (device))
        return NULL;

    camera = g_object_new (ARV_TYPE_CAMERA, "device", device, NULL);

    camera->priv->use_gain_raw = !ARV_IS_GC_FLOAT (arv_device_get_feature (device, "Gain"));
    camera->priv->use_exposure_time_abs = !ARV_IS_GC_FLOAT (arv_device_get_feature (device, "ExposureTime"));
    camera->priv->use_acquisition_frame_rate_abs = !ARV_IS_GC_FLOAT (arv_device_get_feature (device, "AcquisitionFrameRate"));

    return camera;
}
Ejemplo n.º 6
0
void arv_gc_float_impose_max (ArvGcFloat *gc_float, double maximum, GError **error)
{
	ArvGcFloatInterface *float_interface;

	g_return_if_fail (ARV_IS_GC_FLOAT (gc_float));
	g_return_if_fail (error == NULL || *error == NULL);

	float_interface = ARV_GC_FLOAT_GET_INTERFACE (gc_float);

	if (float_interface->impose_max != NULL)
		float_interface->impose_max (gc_float, maximum, error);
	else
		g_set_error (error, ARV_GC_ERROR, ARV_GC_ERROR_PROPERTY_NOT_DEFINED, "<Max> node not found for '%s'",
			     arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_float)));
}
Ejemplo n.º 7
0
//! 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;
  }
}
Ejemplo n.º 8
0
double
arv_gc_float_get_inc (ArvGcFloat *gc_float, GError **error)
{
	ArvGcFloatInterface *float_interface;

	g_return_val_if_fail (ARV_IS_GC_FLOAT (gc_float), 0.0);
	g_return_val_if_fail (error == NULL || *error == NULL, 0.0);

	float_interface = ARV_GC_FLOAT_GET_INTERFACE (gc_float);

	if (float_interface->get_inc != NULL)
		return float_interface->get_inc (gc_float, error);

	g_set_error (error, ARV_GC_ERROR, ARV_GC_ERROR_PROPERTY_NOT_DEFINED, "<Inc> node not found for '%s'",
		     arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_float)));

	return 1;
}
Ejemplo n.º 9
0
double
arv_chunk_parser_get_float_value (ArvChunkParser *parser, ArvBuffer *buffer, const char *chunk)
{
	ArvGcNode *node;
	double value = 0.0;

	g_return_val_if_fail (ARV_IS_CHUNK_PARSER (parser), 0.0);
	g_return_val_if_fail (ARV_IS_BUFFER (buffer), 0.0);

	node = arv_gc_get_node (parser->priv->genicam, chunk);
	arv_gc_set_buffer (parser->priv->genicam, buffer);

	if (ARV_IS_GC_FLOAT (node))
		value = arv_gc_float_get_value (ARV_GC_FLOAT (node), NULL);
	else 
		arv_warning_chunk ("[ArvChunkParser::get_float_value] Node '%s' is not a float", chunk);

	return value;
}