-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
added get/set register node value #833
Conversation
There was a problem hiding this 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.
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); | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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)); |
There was a problem hiding this comment.
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..,
...
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; | ||
} | ||
|
There was a problem hiding this comment.
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.
I have made the changes and merged. Thanks. |
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:
Note that
GNDC
(0x47 0x4e 0x44 0x43
) is the signature of GenDCDescriptor of the beginning of U3V payloadReference: https://www.emva.org/wp-content/uploads/GenICam_GenDC_v1_1.pdf