Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
firewire_camera
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labrobotica
drivers
firewire_camera
Commits
fd70d0ef
Commit
fd70d0ef
authored
13 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/firewirecamera.cpp
+75
-0
75 additions, 0 deletions
src/firewirecamera.cpp
src/firewirecamera.h
+1
-0
1 addition, 0 deletions
src/firewirecamera.h
with
76 additions
and
0 deletions
src/firewirecamera.cpp
+
75
−
0
View file @
fd70d0ef
...
@@ -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
(
"
\t
Feature is present.
\n
"
);
return
true
;
}
else
{
DEBUG_INFO
(
"
\t
Feature 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
(
"
\t
Feature 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
(
"
\t
Feature 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
)
...
...
This diff is collapsed.
Click to expand it.
src/firewirecamera.h
+
1
−
0
View file @
fd70d0ef
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment