Skip to content

Commit

Permalink
Merge branch 'main' into discover-dhcp-camera-outside-subnet
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelP authored Nov 2, 2023
2 parents cd7bd31 + ba0d728 commit a8a14c8
Show file tree
Hide file tree
Showing 9 changed files with 306 additions and 110 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Stable release 0.8.30
=====================

* gv: add EVK Helios and Automation Technology C6 devices to the legacy mode list (Václav, anathesys)
* gv: don't ignore POINTTOPOINT interfaces, allows for direct connection to
devices through VPNs (James)

Stable release 0.8.29
=====================

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project ('aravis', 'c', 'cpp', version: '0.8.30', meson_version: '>=0.57.0')
project ('aravis', 'c', 'cpp', version: '0.8.31', meson_version: '>=0.57.0')

gnome = import('gnome')
pkg = import ('pkgconfig')
Expand Down
76 changes: 76 additions & 0 deletions src/arvcamera.c
Original file line number Diff line number Diff line change
Expand Up @@ -2427,6 +2427,62 @@ arv_camera_is_binning_available (ArvCamera *camera, GError **error)
return horizontal && vertical;
}

/**
* arv_camera_get_gain_representation:
* @camera: a #ArvCamera
*
* Return: gain representation, %ARV_GC_REPRESENTATION_UNDEFINED if not available.
*
* Since: 0.8.31
*/

ArvGcRepresentation
arv_camera_get_gain_representation (ArvCamera *camera)
{
ArvCameraPrivate *priv = arv_camera_get_instance_private (camera);

g_return_val_if_fail (ARV_IS_CAMERA (camera), ARV_GC_REPRESENTATION_UNDEFINED);

if (priv->has_gain)
return arv_device_get_feature_representation (priv->device, "Gain");

if (priv->gain_raw_as_float)
return arv_device_get_feature_representation (priv->device, "GainRaw");
if (priv->gain_abs_as_float)
return arv_device_get_feature_representation (priv->device, "GainAbs");

return arv_device_get_feature_representation (priv->device, "GainRaw");
}

/**
* arv_camera_get_exposure_time_representation:
* @camera: a #ArvCamera
*
* Return: exposure time representation, %ARV_GC_REPRESENTATION_UNDEFINED if not available.
*
* Since: 0.8.31
*/

ArvGcRepresentation
arv_camera_get_exposure_time_representation (ArvCamera *camera)
{
ArvCameraPrivate *priv = arv_camera_get_instance_private (camera);

g_return_val_if_fail (ARV_IS_CAMERA (camera), ARV_GC_REPRESENTATION_UNDEFINED);

switch (priv->series) {
case ARV_CAMERA_SERIES_XIMEA:
return arv_device_get_feature_representation (priv->device, "ExposureTime");
case ARV_CAMERA_SERIES_RICOH:
return arv_device_get_feature_representation (priv->device, "ExposureTimeRaw");
case ARV_CAMERA_SERIES_IMPERX_CHEETAH:
return arv_device_get_feature_representation (priv->device, "ExposureMode");
default:
return arv_device_get_feature_representation (priv->device,
priv->has_exposure_time ? "ExposureTime" : "ExposureTimeAbs");
}
}

/**
* arv_camera_execute_command:
* @camera: a #ArvCamera
Expand Down Expand Up @@ -2964,6 +3020,26 @@ arv_camera_is_feature_implemented (ArvCamera *camera, const char *feature, GErro
return arv_device_is_feature_implemented (priv->device, feature, error);
}

/**
* arv_camera_get_feature_representation:
* @camera: a #ArvCamera
* @feature: feature name
*
* Return: the feature representation, %ARV_GC_REPRESENTATION_UNDEFINED if not available.
*
* Since: 0.8.31
*/

ArvGcRepresentation
arv_camera_get_feature_representation (ArvCamera *camera, const char *feature)
{
ArvCameraPrivate *priv = arv_camera_get_instance_private (camera);

g_return_val_if_fail (ARV_IS_CAMERA (camera), ARV_GC_REPRESENTATION_UNDEFINED);

return arv_device_get_feature_representation (priv->device, feature);
}

/**
* arv_camera_set_register_cache_policy:
* @camera: a #ArvCamera
Expand Down
20 changes: 16 additions & 4 deletions src/arvcamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ ARV_API double arv_camera_get_exposure_time (ArvCamera *camera, GError **error
ARV_API void arv_camera_get_exposure_time_bounds (ArvCamera *camera, double *min, double *max, GError **error);
ARV_API void arv_camera_set_exposure_time_auto (ArvCamera *camera, ArvAuto auto_mode, GError **error);
ARV_API ArvAuto arv_camera_get_exposure_time_auto (ArvCamera *camera, GError **error);
ARV_API ArvGcRepresentation arv_camera_get_exposure_time_representation (ArvCamera *camera);

ARV_API void arv_camera_set_exposure_mode (ArvCamera *camera, ArvExposureMode mode, GError **error);

Expand All @@ -149,6 +150,7 @@ ARV_API double arv_camera_get_gain (ArvCamera *camera, GError **error);
ARV_API void arv_camera_get_gain_bounds (ArvCamera *camera, double *min, double *max, GError **error);
ARV_API void arv_camera_set_gain_auto (ArvCamera *camera, ArvAuto auto_mode, GError **error);
ARV_API ArvAuto arv_camera_get_gain_auto (ArvCamera *camera, GError **error);
ARV_API ArvGcRepresentation arv_camera_get_gain_representation (ArvCamera *camera);

ARV_API gboolean arv_camera_is_black_level_available (ArvCamera *camera, GError **error);
ARV_API gboolean arv_camera_is_black_level_auto_available(ArvCamera *camera, GError **error);
Expand Down Expand Up @@ -208,6 +210,9 @@ ARV_API gboolean arv_camera_is_enumeration_entry_available
ARV_API gboolean arv_camera_is_feature_available (ArvCamera *camera, const char *feature, GError **error);
ARV_API gboolean arv_camera_is_feature_implemented (ArvCamera *camera, const char *feature, GError **error);

ARV_API ArvGcRepresentation arv_camera_get_feature_representation (ArvCamera *camera, const char *feature);


/* Runtime policies */

ARV_API void arv_camera_set_register_cache_policy (ArvCamera *camera, ArvRegisterCachePolicy policy);
Expand Down Expand Up @@ -237,11 +242,18 @@ ARV_API void arv_camera_gv_set_packet_size_adjustment (ArvCamera *camera,

ARV_API void arv_camera_gv_set_stream_options (ArvCamera *camera, ArvGvStreamOption options);

ARV_API void arv_camera_gv_get_persistent_ip (ArvCamera *camera, GInetAddress **ip, GInetAddressMask **mask, GInetAddress **gateway, GError **error);
ARV_API void arv_camera_gv_set_persistent_ip_from_string (ArvCamera *camera, const char *ip, const char *mask, const char *gateway, GError **error);
ARV_API void arv_camera_gv_set_persistent_ip (ArvCamera *camera, GInetAddress *ip, GInetAddressMask *mask, GInetAddress *gateway, GError **error);
ARV_API void arv_camera_gv_get_persistent_ip (ArvCamera *camera, GInetAddress **ip,
GInetAddressMask **mask, GInetAddress **gateway,
GError **error);
ARV_API void arv_camera_gv_set_persistent_ip_from_string (ArvCamera *camera, const char *ip,
const char *mask, const char *gateway,
GError **error);
ARV_API void arv_camera_gv_set_persistent_ip (ArvCamera *camera, GInetAddress *ip,
GInetAddressMask *mask, GInetAddress *gateway,
GError **error);
ARV_API ArvGvIpConfigurationMode arv_camera_gv_get_ip_configuration_mode (ArvCamera *camera, GError **error);
ARV_API void arv_camera_gv_set_ip_configuration_mode (ArvCamera *camera, ArvGvIpConfigurationMode mode, GError **error);
ARV_API void arv_camera_gv_set_ip_configuration_mode (ArvCamera *camera,
ArvGvIpConfigurationMode mode, GError **error);

ARV_API gboolean arv_camera_is_uv_device (ArvCamera *camera);
ARV_API gboolean arv_camera_uv_is_bandwidth_control_available (ArvCamera *camera, GError **error);
Expand Down
29 changes: 29 additions & 0 deletions src/arvdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,35 @@ _get_feature (ArvDevice *device, GType node_type, const char *feature, GError **
return node;
}

/**
* arv_device_get_feature_representation:
* @device: a #ArvDevice
* @feature: feature name
*
* Return: enum ArvGcRepresentation, ARV_GC_REPRESENTATION_UNDEFINED if not available.
*
* Since: 0.8.31
*/

ArvGcRepresentation
arv_device_get_feature_representation (ArvDevice *device, const char *feature)
{
ArvGcNode* node;

g_return_val_if_fail (ARV_IS_DEVICE (device), ARV_GC_REPRESENTATION_UNDEFINED);
g_return_val_if_fail (feature != NULL, ARV_GC_REPRESENTATION_UNDEFINED);

node = arv_device_get_feature (device, feature);

if (ARV_IS_GC_FLOAT(node)) {
return arv_gc_float_get_representation(ARV_GC_FLOAT(node));
}else if (ARV_IS_GC_INTEGER(node)){
return arv_gc_integer_get_representation(ARV_GC_INTEGER (node));
}

return ARV_GC_REPRESENTATION_UNDEFINED;
}

/**
* arv_device_execute_command:
* @device: a #ArvDevice
Expand Down
2 changes: 2 additions & 0 deletions src/arvdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ ARV_API gboolean arv_device_is_feature_implemented (ArvDevice *device, const ch
ARV_API ArvGcNode * arv_device_get_feature (ArvDevice *device, const char *feature);
ARV_API ArvGcAccessMode arv_device_get_feature_access_mode (ArvDevice *device, const char *feature);

ARV_API ArvGcRepresentation arv_device_get_feature_representation (ArvDevice *device, const char *feature);

ARV_API ArvChunkParser *arv_device_create_chunk_parser (ArvDevice *device);

ARV_API void arv_device_execute_command (ArvDevice *device, const char *feature, GError **error);
Expand Down
174 changes: 91 additions & 83 deletions src/arvgvdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,7 @@ arv_gv_device_is_controller (ArvGvDevice *gv_device)
static char *
_load_genicam (ArvGvDevice *gv_device, guint32 address, size_t *size, GError **error)
{
GError *local_error = NULL;
char filename[ARV_GVBS_XML_URL_SIZE];
char *genicam = NULL;
char *scheme = NULL;
Expand All @@ -1281,93 +1282,100 @@ _load_genicam (ArvGvDevice *gv_device, guint32 address, size_t *size, GError **
arv_parse_genicam_url (filename, -1, &scheme, NULL, &path, NULL, NULL,
&file_address, &file_size);

if (g_ascii_strcasecmp (scheme, "file") == 0) {
gsize len;

g_file_get_contents (path, &genicam, &len, NULL);
if (genicam)
*size = len;
} else if (g_ascii_strcasecmp (scheme, "local") == 0) {
arv_info_device ("[GvDevice::load_genicam] Xml address = 0x%" G_GINT64_MODIFIER "x - "
"size = 0x%" G_GINT64_MODIFIER "x - %s", file_address, file_size, path);

if (file_size > 0) {
genicam = g_malloc (file_size);
if (arv_gv_device_read_memory (ARV_DEVICE (gv_device), file_address, file_size,
genicam, NULL)) {

if (arv_debug_check (ARV_DEBUG_CATEGORY_MISC, ARV_DEBUG_LEVEL_DEBUG)) {
GString *string = g_string_new ("");

g_string_append_printf (string,
"[GvDevice::load_genicam] Raw data size = 0x%"
G_GINT64_MODIFIER "x\n", file_size);
arv_g_string_append_hex_dump (string, genicam, file_size);

arv_debug_misc ("%s", string->str);

g_string_free (string, TRUE);
}

if (g_str_has_suffix (path, ".zip")) {
ArvZip *zip;
const GSList *zip_files;

arv_info_device ("[GvDevice::load_genicam] Zipped xml data");

zip = arv_zip_new (genicam, file_size);
zip_files = arv_zip_get_file_list (zip);

if (zip_files != NULL) {
const char *zip_filename;
void *tmp_buffer;
size_t tmp_buffer_size;

zip_filename = arv_zip_file_get_name (zip_files->data);
tmp_buffer = arv_zip_get_file (zip, zip_filename,
&tmp_buffer_size);

g_free (genicam);
file_size = tmp_buffer_size;
genicam = tmp_buffer;
} else
arv_warning_device ("[GvDevice::load_genicam] Invalid format");
arv_zip_free (zip);
}
*size = file_size;
} else {
g_free (genicam);
genicam = NULL;
*size = 0;
}
}
} else if (g_ascii_strcasecmp (scheme, "http")) {
GFile *file;
GFileInputStream *stream;

file = g_file_new_for_uri (filename);
stream = g_file_read (file, NULL, NULL);
if(stream) {
GDataInputStream *data_stream;
gsize len;

data_stream = g_data_input_stream_new (G_INPUT_STREAM (stream));
genicam = g_data_input_stream_read_upto (data_stream, "", 0, &len, NULL, NULL);

if (genicam)
*size = len;

g_object_unref (data_stream);
g_object_unref (stream);
}
g_object_unref (file);
} else {
g_critical ("Unkown GENICAM url scheme: '%s'", filename);
}
if (scheme != NULL) {
if (g_ascii_strcasecmp (scheme, "file") == 0) {
gsize len;

g_file_get_contents (path, &genicam, &len, NULL);
if (genicam)
*size = len;
} else if (g_ascii_strcasecmp (scheme, "local") == 0) {
arv_info_device ("[GvDevice::load_genicam] Xml address = 0x%" G_GINT64_MODIFIER "x - "
"size = 0x%" G_GINT64_MODIFIER "x - %s", file_address, file_size, path);

if (file_size > 0) {
genicam = g_malloc (file_size);
if (arv_gv_device_read_memory (ARV_DEVICE (gv_device), file_address, file_size,
genicam, &local_error)) {

if (arv_debug_check (ARV_DEBUG_CATEGORY_MISC, ARV_DEBUG_LEVEL_DEBUG)) {
GString *string = g_string_new ("");

g_string_append_printf (string,
"[GvDevice::load_genicam] Raw data size = 0x%"
G_GINT64_MODIFIER "x\n", file_size);
arv_g_string_append_hex_dump (string, genicam, file_size);

arv_debug_misc ("%s", string->str);

g_string_free (string, TRUE);
}

if (g_str_has_suffix (path, ".zip")) {
ArvZip *zip;
const GSList *zip_files;

arv_info_device ("[GvDevice::load_genicam] Zipped xml data");

zip = arv_zip_new (genicam, file_size);
zip_files = arv_zip_get_file_list (zip);

if (zip_files != NULL) {
const char *zip_filename;
void *tmp_buffer;
size_t tmp_buffer_size;

zip_filename = arv_zip_file_get_name (zip_files->data);
tmp_buffer = arv_zip_get_file (zip, zip_filename,
&tmp_buffer_size);

g_free (genicam);
file_size = tmp_buffer_size;
genicam = tmp_buffer;
} else
arv_warning_device ("[GvDevice::load_genicam] Invalid format");
arv_zip_free (zip);
}
*size = file_size;
} else {
g_free (genicam);
genicam = NULL;
*size = 0;
}
}
} else if (g_ascii_strcasecmp (scheme, "http")) {
GFile *file;
GFileInputStream *stream;

file = g_file_new_for_uri (filename);
stream = g_file_read (file, NULL, NULL);
if(stream) {
GDataInputStream *data_stream;
gsize len;

data_stream = g_data_input_stream_new (G_INPUT_STREAM (stream));
genicam = g_data_input_stream_read_upto (data_stream, "", 0, &len, NULL, NULL);

if (genicam)
*size = len;

g_object_unref (data_stream);
g_object_unref (stream);
}
g_object_unref (file);
} else {
arv_warning_device ("Unkown GENICAM url scheme: '%s'", filename);
}
}

g_free (scheme);
g_free (path);

if (local_error != NULL) {
arv_warning_device("Failed to load GENICAM data: %s", local_error->message);
g_propagate_error (error, local_error);
}

return genicam;
}

Expand Down
Loading

0 comments on commit a8a14c8

Please sign in to comment.