Skip to content

Commit

Permalink
rename functions and remove unnecessary error placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
Fixstars-momoko committed Nov 1, 2023
1 parent eec3ba5 commit b9c1305
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 26 deletions.
32 changes: 14 additions & 18 deletions src/arvcamera.c
Original file line number Diff line number Diff line change
Expand Up @@ -2428,61 +2428,58 @@ arv_camera_is_binning_available (ArvCamera *camera, GError **error)
}

/**
* arv_camera_get_representation_gain:
* arv_camera_get_gain_representation:
* @camera: a #ArvCamera
* @error: a #GError placeholder, %NULL to ignore
*
* Return: enum ArvGcRepresentation, -1 if not available.
*
* Since:
*/

ArvGcRepresentation
arv_camera_get_representation_gain (ArvCamera *camera, GError **error)
arv_camera_get_gain_representation (ArvCamera *camera)
{
ArvCameraPrivate *priv = arv_camera_get_instance_private (camera);

g_return_val_if_fail (ARV_IS_CAMERA (camera), FALSE);

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

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

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

/**
* arv_camera_get_representation_exposure_time:
* arv_camera_get_exposure_time_representation:
* @camera: a #ArvCamera
* @error: a #GError placeholder, %NULL to ignore
*
* Return: enum ArvGcRepresentation, -1 if not available.
*
* Since:
*/

ArvGcRepresentation
arv_camera_get_representation_exposure_time (ArvCamera *camera, GError **error)
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), FALSE);

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

Expand Down Expand Up @@ -3027,21 +3024,20 @@ arv_camera_is_feature_implemented (ArvCamera *camera, const char *feature, GErro
* arv_camera_get_representation:
* @camera: a #ArvCamera
* @feature: feature name
* @error: a #GError placeholder, %NULL to ignore
*
* Return: enum ArvGcRepresentation, -1 if not available.
*
* Since:
*/

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

g_return_val_if_fail (ARV_IS_CAMERA (camera), FALSE);

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

/**
Expand Down
6 changes: 3 additions & 3 deletions src/arvcamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +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_representation_exposure_time(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 @@ -150,7 +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_representation_gain (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 @@ -210,7 +210,7 @@ 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_representation (ArvCamera *camera, const char *feature, GError **error);
ARV_API ArvGcRepresentation arv_camera_get_representation (ArvCamera *camera, const char *feature);


/* Runtime policies */
Expand Down
3 changes: 1 addition & 2 deletions src/arvdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,14 @@ _get_feature (ArvDevice *device, GType node_type, const char *feature, GError **
* arv_device_get_representation:
* @device: a #ArvDevice
* @feature: feature name
* @error: a #GError placeholder, %NULL to ignore
*
* Return: enum ArvGcRepresentation, -1 if not available.
*
* Since:
*/

ArvGcRepresentation
arv_device_get_representation (ArvDevice *device, const char *feature, GError **error)
arv_device_get_representation (ArvDevice *device, const char *feature)
{
ArvGcNode* node;

Expand Down
2 changes: 1 addition & 1 deletion src/arvdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ ARV_API gboolean arv_device_is_feature_available (ArvDevice *device, const cha
ARV_API gboolean arv_device_is_feature_implemented (ArvDevice *device, const char *feature, GError **error);
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_representation (ArvDevice *device, const char *feature, GError **error);
ARV_API ArvGcRepresentation arv_device_get_representation (ArvDevice *device, const char *feature);

ARV_API ArvChunkParser *arv_device_create_chunk_parser (ArvDevice *device);

Expand Down
4 changes: 2 additions & 2 deletions viewer/arvviewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ set_camera_widgets(ArvViewer *viewer)
// enables gtk widget based on feature representation
is_gain_available = arv_camera_is_gain_available (viewer->camera, NULL);
if (is_gain_available){
viewer->gain_representation = (gint)(arv_camera_get_representation_gain(viewer->camera, NULL));
viewer->gain_representation = (gint)(arv_camera_get_gain_representation(viewer->camera));
switch(viewer->gain_representation){
case ARV_GC_REPRESENTATION_UNDEFINED:
case ARV_GC_REPRESENTATION_LINEAR:
Expand Down Expand Up @@ -802,7 +802,7 @@ set_camera_widgets(ArvViewer *viewer)

is_exposure_available = arv_camera_is_exposure_time_available (viewer->camera, NULL);
if (is_exposure_available){
viewer->exposure_time_representation = (gint)(arv_camera_get_representation_exposure_time(viewer->camera, NULL));
viewer->exposure_time_representation = (gint)(arv_camera_get_exposure_time_representation(viewer->camera));
switch(viewer->exposure_time_representation){
case ARV_GC_REPRESENTATION_UNDEFINED:
case ARV_GC_REPRESENTATION_LINEAR:
Expand Down

0 comments on commit b9c1305

Please sign in to comment.