Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added get/set register node value #833

Closed

Conversation

Fixstars-momoko
Copy link
Contributor

I have implemented an API to set/get the value of the "Register-Type" node in order for the Aravis library to handle cameras in the GENDC data format in the future.
Currently, when using the arv-tool to display the GenDC descriptor, it appears as follows:

$ ./arv-tool-0.8.exe -n  <name of camera> control GenDCDescriptor
Length of GenDCDescriptor = 1280
Content of GenDCDescriptor =
        0x47 0x4e 0x44 0x43 0x01 0x00 0x00 0x00
...

Note that

  • gendc is supported as U3V camera's payload type from U3V v1.2
  • GNDC (0x47 0x4e 0x44 0x43) is the signature of GenDCDescriptor of the beginning of U3V payload
  • I only have U3V camera whose data format is GenDC; I have never tested on GigE.

Reference: https://www.emva.org/wp-content/uploads/GenICam_GenDC_v1_1.pdf

Copy link
Contributor

@EmmanuelP EmmanuelP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Some minor things to fix before it can go in.

Comment on lines +2853 to +2882
arv_camera_get_register (ArvCamera *camera, const char *feature,guint64 length, void* value, GError **error)
{
ArvCameraPrivate *priv = arv_camera_get_instance_private (camera);

g_return_if_fail (ARV_IS_CAMERA (camera));

arv_device_get_register_feature_value (priv->device, feature, length, value, error);
}

/**
* arv_camera_get_register_length:
* @camera: a #ArvCamera
* @feature: feature name
* @error: a #GError placeholder
*
* Returns: the length of register value, 0 if not available
*
* Since:
*/

guint64
arv_camera_get_register_length (ArvCamera *camera, const char *feature, GError **error)
{
ArvCameraPrivate *priv = arv_camera_get_instance_private (camera);

g_return_val_if_fail (ARV_IS_CAMERA (camera), 0);

return arv_device_get_register_feature_length (priv->device, feature, error);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would simplify the API here, and make get_register allocate a buffer and return the buffer length, and suppress get_register_length.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And rename get_register to dup_register, which makes clear the data must be freed after use.

Comment on lines +383 to +389
if (error == NULL){
printf("Content of %s =", tokens[0]);
for( int i = 0; i < length; i++){
if ( i%8 == 0){
printf("\n\t");
}
printf("0x%02x ", *((buffer)+i));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use arv_g_string_append_hex_dump here.

Please format the output as:

GenDCDescriptor = 128 bytes@0x0900
01e0 c8 b7 89 b0 45 fa 3d 9d 8c e9 a7 33 46 85 1f 2c  ....E.=....3F..,
...

Comment on lines +836 to +867
void
arv_device_get_register_feature_value (ArvDevice *device, const char *feature, guint64 length, void* value, GError **error)
{
ArvGcNode *node;

node = _get_feature (device, ARV_TYPE_GC_REGISTER, feature, error);
if (node != NULL)
arv_gc_register_get (ARV_GC_REGISTER (node), value, length, error);
}

/**
* arv_device_get_register_feature_length:
* @device: a #ArvDevice
* @feature: feature name
* @error: a #GError placeholder
*
* Returns: the length of register value, 0 if not available
*
* Since:
*/

guint64
arv_device_get_register_feature_length (ArvDevice *device, const char *feature, GError **error)
{
ArvGcNode *node;
node = _get_feature (device, ARV_TYPE_GC_REGISTER, feature, error);
if (node != NULL)
return arv_gc_register_get_length(ARV_GC_REGISTER (node), error);

return 0;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark here about the API simplification. In arvDevice, the get_register function should take care to check the buffer length value is lower than the maximum size (2^16), and return an error otherwise.

@EmmanuelP
Copy link
Contributor

I have made the changes and merged. Thanks.

@EmmanuelP EmmanuelP closed this Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants