Skip to content
Snippets Groups Projects
Commit fd70d0ef authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Added a function to check whether a given feature is present in the camera or not.

Implemented the get_white_balance_value() function.
parent c4c8a0f4
No related branches found
No related tags found
No related merge requests found
...@@ -945,6 +945,32 @@ void CFirewireCamera::set_ISO_speed(float speed) ...@@ -945,6 +945,32 @@ void CFirewireCamera::set_ISO_speed(float speed)
DEBUG_INFO("ok\n"); DEBUG_INFO("ok\n");
} }
bool CFirewireCamera::is_feature_present(dc1394feature_t feature_id)
{
dc1394error_t error;
dc1394bool_t present;
DEBUG_INFO("Checking if the feature is present ... ");
error=dc1394_feature_is_present(this->camera_handle,feature_id,&present);
if ( error != DC1394_SUCCESS )
{
DEBUG_INFO("failed\n");
/* handle the error */
throw CFirewireInternalException(_HERE_,error);
}
DEBUG_INFO("ok\n");
if ( present == DC1394_TRUE)
{
DEBUG_INFO("\tFeature is present.\n");
return true;
}
else
{
DEBUG_INFO("\tFeature is not present.\n");
return false;
}
}
void CFirewireCamera::enable_feature(dc1394feature_t feature_id) void CFirewireCamera::enable_feature(dc1394feature_t feature_id)
{ {
dc1394error_t error; dc1394error_t error;
...@@ -1371,7 +1397,56 @@ void CFirewireCamera::set_white_balance_value(unsigned int u_b_value, unsigned i ...@@ -1371,7 +1397,56 @@ void CFirewireCamera::set_white_balance_value(unsigned int u_b_value, unsigned i
void CFirewireCamera::get_white_balance_value(unsigned int *u_b_value, unsigned int *v_r_value) void CFirewireCamera::get_white_balance_value(unsigned int *u_b_value, unsigned int *v_r_value)
{ {
dc1394error_t error;
dc1394bool_t present;
dc1394bool_t readable;
DEBUG_INFO("Checking if the feature is present ... ");
error=dc1394_feature_is_present(this->camera_handle,DC1394_FEATURE_WHITE_BALANCE,&present);
if ( error != DC1394_SUCCESS )
{
DEBUG_INFO("failed\n");
/* handle the error */
throw CFirewireInternalException(_HERE_,error);
}
DEBUG_INFO("ok\n");
if ( present == DC1394_TRUE)
{
DEBUG_INFO("\tFeature is present.\n");
DEBUG_INFO("Checking the reading status of the feature ... ");
error=dc1394_feature_is_readable(this->camera_handle,DC1394_FEATURE_WHITE_BALANCE,&readable);
if ( error != DC1394_SUCCESS )
{
DEBUG_INFO("failed\n");
/* handle the error */
throw CFirewireInternalException(_HERE_,error);
}
DEBUG_INFO("ok\n");
if ( readable == DC1394_TRUE)
{
DEBUG_INFO("Reading the current value ... ");
error=dc1394_feature_whitebalance_get_value(this->camera_handle,u_b_value,v_r_value);
if ( error != DC1394_SUCCESS )
{
DEBUG_INFO("failed\n");
/* handle the error */
throw CFirewireInternalException(_HERE_,error);
}
DEBUG_INFO("ok\n");
}
else
{
DEBUG_INFO("Feature is not readable.\n");
/* handle exception */
throw CFirewireFeatureException(_HERE_,dc1394_feature_get_string(DC1394_FEATURE_WHITE_BALANCE),"Is not readable.\n");
}
}
else
{
DEBUG_INFO("\tFeature is not present.\n");
/* handle exception */
throw CFirewireFeatureException(_HERE_,dc1394_feature_get_string(DC1394_FEATURE_WHITE_BALANCE),"Is not present.\n");
}
} }
void CFirewireCamera::reset(void) void CFirewireCamera::reset(void)
......
...@@ -979,6 +979,7 @@ class CFirewireCamera ...@@ -979,6 +979,7 @@ class CFirewireCamera
//@} //@}
/** @name Functions to handle the camera features */ /** @name Functions to handle the camera features */
//@{ //@{
bool is_feature_present(dc1394feature_t feature_id);
void enable_feature(dc1394feature_t feature_id); void enable_feature(dc1394feature_t feature_id);
void disable_feature(dc1394feature_t feature_id); void disable_feature(dc1394feature_t feature_id);
bool is_feature_enabled(dc1394feature_t feature_id); bool is_feature_enabled(dc1394feature_t feature_id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment